From: Joey Schulze Date: Fri, 10 Dec 2004 13:32:24 +0000 (+0000) Subject: Obey to the new coding style X-Git-Tag: upstream_newmail_0-4~10 X-Git-Url: https://git.infodrom.org/?p=infodrom%2Fnewmail;a=commitdiff_plain;h=832043701e5eaab18f850f518670418c9edb6bac Obey to the new coding style --- diff --git a/folder.c b/folder.c index 11b41dd..1c63872 100644 --- a/folder.c +++ b/folder.c @@ -59,15 +59,15 @@ void add_folder(char *path) } if ((thisfolder = (struct folder *)malloc(sizeof(struct folder))) == NULL) { - perror("malloc"); - exit(1); + perror ("malloc"); + exit (1); } if ((cp = index(path, '=')) != NULL) { *cp++ = '\0'; if ((thisfolder->prefix = (char *)strdup(cp)) == NULL) { - perror("strdup"); - exit(1); + perror ("strdup"); + exit (1); } strcpy(thisfolder->prefix, cp); } else { @@ -76,13 +76,13 @@ void add_folder(char *path) if ((cp = rindex(path, '/')) != NULL) { cp++; if ((thisfolder->prefix = (char *)strdup(cp)) == NULL) { - perror("strdup"); - exit(1); + perror ("strdup"); + exit (1); } } else { if ((thisfolder->prefix = (char *)strdup(path)) == NULL) { - perror("strdup"); - exit(1); + perror ("strdup"); + exit (1); } } } else @@ -90,8 +90,8 @@ void add_folder(char *path) } if ((thisfolder->path = (char *)strdup(path)) == NULL) { - perror("strdup"); - exit(1); + perror ("strdup"); + exit (1); } sh = stat(path, &st); @@ -119,13 +119,13 @@ void add_default_folder() if ((env = getenv("MAIL")) == NULL) { uid = getuid(); if ((pw = getpwuid(uid)) == NULL) { - perror("getpwuid"); - exit(1); + perror ("getpwuid"); + exit (1); } - snprintf(path, sizeof(path), "%s/%s", _PATH_MAILDIR, pw->pw_name); + snprintf (path, sizeof(path), "%s/%s", _PATH_MAILDIR, pw->pw_name); } else { - snprintf(path, sizeof(path), env); + snprintf (path, sizeof(path), env); } add_folder(path); @@ -144,13 +144,13 @@ void fix_prefix() if ((cp = rindex(folders[0]->path, '/')) != NULL) { cp++; if ((folders[0]->prefix = (char *)strdup(cp)) == NULL) { - perror("strdup"); - exit(1); + perror ("strdup"); + exit (1); } } else { if ((folders[0]->prefix = (char *)strdup(folders[0]->path)) == NULL) { - perror("strdup"); - exit(1); + perror ("strdup"); + exit (1); } } } @@ -166,9 +166,9 @@ void watch_folders(int opt_flags) if (newmail) { if (!(opt_flags & OPT_WINDOW)) { if (opt_flags & OPT_BELL) - putchar('\007'); - putchar('\n'); + putchar ('\007'); + putchar ('\n'); } - fflush(stdout); + fflush (stdout); } } diff --git a/mbox.c b/mbox.c index a15b9e2..6385b92 100644 --- a/mbox.c +++ b/mbox.c @@ -43,7 +43,7 @@ struct mail { */ char *stringcopy(char *dest, const char *src, size_t n) { - strncpy(dest, src, n-1); + strncpy (dest, src, n-1); dest[n-1] = '\0'; return dest; } @@ -99,31 +99,31 @@ char *realname(char *from) if (*cpl == '"' && *cpr == '"') { cpl++;cpr--; } if (cpr > cpl) { - stringcopy(name, cpl, - sizeof(name) < cpr-cpl+2?sizeof(name):cpr-cpl+2); + stringcopy (name, cpl, + sizeof(name) < cpr-cpl+2?sizeof(name):cpr-cpl+2); if (index(name, '"') != NULL) - stringcopy(name, strip_quotes(name), sizeof(name)); + stringcopy (name, strip_quotes(name), sizeof(name)); } else { /* Apparently no realname included */ cpl = index(from, '<'); cpr = index(from, '>'); - stringcopy(name, cpl+1, - sizeof(name) < cpr-cpl?sizeof(name):cpr-cpl); + stringcopy (name, cpl+1, + sizeof(name) < cpr-cpl?sizeof(name):cpr-cpl); } /* From: login@host.domain (REALNAME) */ } else if ((cpl = index(from, '(')) != NULL && (cpr = index(from, ')')) != NULL) { - stringcopy(name, cpl+1, - sizeof(name) < cpr-cpl?sizeof(name):cpr-cpl); + stringcopy (name, cpl+1, + sizeof(name) < cpr-cpl?sizeof(name):cpr-cpl); /* From: login@host.domain */ } else { /* Strip leading spaces */ cpl=from;while (*cpl && isspace(*cpl)) cpl++; for (cpr=cpl; *cpr && !isspace(*cpr); cpr++); - stringcopy(name, cpl, - sizeof(name) < cpr-cpl+1?sizeof(name):cpr-cpl+1); + stringcopy (name, cpl, + sizeof(name) < cpr-cpl+1?sizeof(name):cpr-cpl+1); } return name; @@ -141,8 +141,8 @@ char *reduce_from_(char *from_) for (cpr=cpl; *cpr && !isspace(*cpr); cpr++); if (cpr > cpl) - stringcopy(name, cpl, - sizeof(name) < cpr-cpl+1?sizeof(name):cpr-cpl+1); + stringcopy (name, cpl, + sizeof(name) < cpr-cpl+1?sizeof(name):cpr-cpl+1); return name; } @@ -184,7 +184,7 @@ int inspect_mbox(char *path, char *prefix, off_t size, int opt_flags) lookahead = fgetc(f); if (lookahead == TAB) { if ((cp = fgets(tmp, sizeof(tmp), f)) != NULL) { - strncat(buf, tmp, sizeof(buf)-strlen(buf)-1); + strncat (buf, tmp, sizeof(buf)-strlen(buf)-1); if (strlen(buf) > 0 && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; if (strlen(buf) > 0 && buf[strlen(buf)-1] == '\r') @@ -217,11 +217,11 @@ int inspect_mbox(char *path, char *prefix, off_t size, int opt_flags) newmail = 1; if (strlen(from)) - stringcopy(realfrom, realname(from), sizeof(realfrom)); + stringcopy (realfrom, realname(from), sizeof(realfrom)); else - stringcopy(realfrom, reduce_from_(from_), sizeof(realfrom)); + stringcopy (realfrom, reduce_from_(from_), sizeof(realfrom)); - emit(prefix, realfrom, subject, priority, opt_flags); + emit (prefix, realfrom, subject, priority, opt_flags); #ifdef FROM_DETECTION from_[0] = from[0] = to[0] = subject[0] = '\0'; @@ -231,15 +231,15 @@ int inspect_mbox(char *path, char *prefix, off_t size, int opt_flags) priority = 0; } else { if (strncasecmp(buf, "From ", 5) == 0) - stringcopy(from_, buf+5, sizeof(from_)); + stringcopy (from_, buf+5, sizeof(from_)); else if (strncasecmp(buf, "From: ", 6) == 0) - stringcopy(from, buf+6, sizeof(from)); + stringcopy (from, buf+6, sizeof(from)); #ifdef FROM_DETECTION else if (strncasecmp(buf, "To: ", 4) == 0) - stringcopy(to, buf+4, sizeof(to)); + stringcopy (to, buf+4, sizeof(to)); #endif else if (strncasecmp(buf, "Subject: ", 9) == 0) - stringcopy(subject, buf+9, sizeof(subject)); + stringcopy (subject, buf+9, sizeof(subject)); else if (strncasecmp(buf, "Priority: urgent", 16) == 0 && buf[16] == '\0') priority = 1; else if (strncasecmp(buf, "X-Priority: 1", 13) == 0 && buf[13] == '\0') @@ -250,7 +250,7 @@ int inspect_mbox(char *path, char *prefix, off_t size, int opt_flags) } else if (readnewline && strncasecmp(buf, "From ", 5) == 0) { inheader = 1; readnewline = 0; - stringcopy(from_, buf+5, sizeof(from_)); + stringcopy (from_, buf+5, sizeof(from_)); } else readnewline = 0; } diff --git a/newmail.c b/newmail.c index 4ee7876..c613361 100644 --- a/newmail.c +++ b/newmail.c @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) if (tmp_i > 0) opt_interval = tmp_i; else - fprintf(stderr, "Interval not greater as zero, ignoring\n"); + fprintf (stderr, "Interval not greater as zero, ignoring\n"); break; case 'r': opt_flags |= OPT_RAW; @@ -70,23 +70,23 @@ int main(int argc, char *argv[]) add_default_folder(); else while (optind < argc) - add_folder(argv[optind++]); + add_folder (argv[optind++]); fix_prefix(); if (!(opt_flags & OPT_WINDOW)) { if (fork()) return 0; - signal(SIGINT, SIG_IGN); - signal(SIGQUIT, SIG_IGN); + signal (SIGINT, SIG_IGN); + signal (SIGQUIT, SIG_IGN); } while (1) { /* Loop over all files */ - watch_folders(opt_flags); + watch_folders (opt_flags); /* wait for the next incarnation */ - sleep(opt_interval); + sleep (opt_interval); } /* Not reached */ diff --git a/output.c b/output.c index a5d7098..f9935ae 100644 --- a/output.c +++ b/output.c @@ -48,18 +48,18 @@ void emit(char *prefix, char *realname, char *subject, int priority, int opt_fla { if (opt_flags & OPT_WINDOW) { if (prefix != NULL) - printf("%s: ", prefix); + printf ("%s: ", prefix); if (priority) - printf("%s: ", PRIO_WIN); - printf("%s - %s\n", realname, subject); + printf ("%s: ", PRIO_WIN); + printf ("%s - %s\n", realname, subject); } else { - printf("\r>> "); + printf ("\r>> "); if (prefix != NULL) - printf("%s: ", prefix); + printf ("%s: ", prefix); if (priority) - printf("%s %s - %s\n", PRIO_FROM, realname, subject); + printf ("%s %s - %s\n", PRIO_FROM, realname, subject); else - printf("%s %s - %s\n", MAIL_FROM, realname, subject); + printf ("%s %s - %s\n", MAIL_FROM, realname, subject); } }