diff options
author | mikeh <mikeh@FreeBSD.org> | 2001-05-27 20:26:22 +0000 |
---|---|---|
committer | mikeh <mikeh@FreeBSD.org> | 2001-05-27 20:26:22 +0000 |
commit | aa40e2eac7ab213ab193707b4dec5e4bb0a8325b (patch) | |
tree | 35781af5ff6a267c8e45e7cc6091e7df70c229ce /usr.bin/mail/list.c | |
parent | 83f67b8f31f7864baf3998922833c641684ff0f0 (diff) | |
download | FreeBSD-src-aa40e2eac7ab213ab193707b4dec5e4bb0a8325b.zip FreeBSD-src-aa40e2eac7ab213ab193707b4dec5e4bb0a8325b.tar.gz |
Cleanup mail(1)'s varying styles by converting to using style(9).
Also take a stab at cleaning up BDECFLAGS and convert all uses of
NOSTR, NIL, NONE, NOVAR, NOGRP, NOGE to NULL. Also kill 'register' to
get diffs somewhat closer to OpenBSD/NetBSD.
There are no functional changes however.
Reviewed by: nra (visual inspection)
Diffstat (limited to 'usr.bin/mail/list.c')
-rw-r--r-- | usr.bin/mail/list.c | 210 |
1 files changed, 105 insertions, 105 deletions
diff --git a/usr.bin/mail/list.c b/usr.bin/mail/list.c index d5bd968..04b1586 100644 --- a/usr.bin/mail/list.c +++ b/usr.bin/mail/list.c @@ -60,21 +60,21 @@ getmsglist(buf, vector, flags) char *buf; int *vector, flags; { - register int *ip; - register struct message *mp; + int *ip; + struct message *mp; if (msgCount == 0) { *vector = 0; - return 0; + return (0); } if (markall(buf, flags) < 0) - return(-1); + return (-1); ip = vector; for (mp = &message[0]; mp < &message[msgCount]; mp++) if (mp->m_flag & MMARK) *ip++ = mp - &message[0] + 1; *ip = 0; - return(ip - vector); + return (ip - vector); } /* @@ -104,12 +104,12 @@ struct coltab { int co_mask; /* m_status bits to mask */ int co_equal; /* ... must equal this */ } coltab[] = { - 'n', CMNEW, MNEW, MNEW, - 'o', CMOLD, MNEW, 0, - 'u', CMUNREAD, MREAD, 0, - 'd', CMDELETED, MDELETED, MDELETED, - 'r', CMREAD, MREAD, MREAD, - 0, 0, 0, 0 + { 'n', CMNEW, MNEW, MNEW }, + { 'o', CMOLD, MNEW, 0 }, + { 'u', CMUNREAD, MREAD, 0 }, + { 'd', CMDELETED, MDELETED, MDELETED}, + { 'r', CMREAD, MREAD, MREAD }, + { 0, 0, 0, 0 } }; static int lastcolmod; @@ -119,9 +119,9 @@ markall(buf, f) char buf[]; int f; { - register char **np; - register int i; - register struct message *mp; + char **np; + int i; + struct message *mp; char *namelist[NMLSIZE], *bufp; int tok, beg, mc, star, other, valdot, colmod, colresult; @@ -143,13 +143,13 @@ markall(buf, f) number: if (star) { printf("No numbers mixed with *\n"); - return(-1); + return (-1); } mc++; other++; if (beg != 0) { if (check(lexnumber, f)) - return(-1); + return (-1); for (i = beg; i <= lexnumber; i++) if (f == MDELETED || (message[i - 1].m_flag & MDELETED) == 0) mark(i); @@ -158,7 +158,7 @@ number: } beg = lexnumber; if (check(beg, f)) - return(-1); + return (-1); tok = scan(&bufp); regret(tok); if (tok != TDASH) { @@ -170,14 +170,14 @@ number: case TPLUS: if (beg != 0) { printf("Non-numeric second argument\n"); - return(-1); + return (-1); } i = valdot; do { i++; if (i > msgCount) { printf("Referencing beyond EOF\n"); - return(-1); + return (-1); } } while ((message[i - 1].m_flag & MDELETED) != f); mark(i); @@ -190,7 +190,7 @@ number: i--; if (i <= 0) { printf("Referencing before 1\n"); - return(-1); + return (-1); } } while ((message[i - 1].m_flag & MDELETED) != f); mark(i); @@ -200,7 +200,7 @@ number: case TSTRING: if (beg != 0) { printf("Non-numeric second argument\n"); - return(-1); + return (-1); } other++; if (lexstring[0] == ':') { @@ -208,7 +208,7 @@ number: if (colresult == 0) { printf("Unknown colon modifier \"%s\"\n", lexstring); - return(-1); + return (-1); } colmod |= colresult; } @@ -221,24 +221,24 @@ number: case TDOT: lexnumber = metamess(lexstring[0], f); if (lexnumber == -1) - return(-1); + return (-1); goto number; case TSTAR: if (other) { printf("Can't mix \"*\" with anything\n"); - return(-1); + return (-1); } star++; break; case TERROR: - return -1; + return (-1); } tok = scan(&bufp); } lastcolmod = colmod; - *np = NOSTR; + *np = NULL; mc = 0; if (star) { for (i = 0; i < msgCount; i++) @@ -248,9 +248,9 @@ number: } if (mc == 0) { printf("No applicable messages.\n"); - return(-1); + return (-1); } - return(0); + return (0); } /* @@ -271,7 +271,7 @@ number: if (np > namelist) { for (i = 1; i <= msgCount; i++) { - for (mc = 0, np = &namelist[0]; *np != NOSTR; np++) + for (mc = 0, np = &namelist[0]; *np != NULL; np++) if (**np == '/') { if (matchsubj(*np, i)) { mc++; @@ -301,10 +301,10 @@ number: if (mc == 0) { printf("No applicable messages from {%s", namelist[0]); - for (np = &namelist[1]; *np != NOSTR; np++) + for (np = &namelist[1]; *np != NULL; np++) printf(", %s", *np); printf("}\n"); - return(-1); + return (-1); } } @@ -315,10 +315,10 @@ number: if (colmod != 0) { for (i = 1; i <= msgCount; i++) { - register struct coltab *colp; + struct coltab *colp; mp = &message[i - 1]; - for (colp = &coltab[0]; colp->co_char; colp++) + for (colp = &coltab[0]; colp->co_char != '\0'; colp++) if (colp->co_bit & colmod) if ((mp->m_flag & colp->co_mask) != colp->co_equal) @@ -329,17 +329,17 @@ number: if (mp->m_flag & MMARK) break; if (mp >= &message[msgCount]) { - register struct coltab *colp; + struct coltab *colp; printf("No messages satisfy"); - for (colp = &coltab[0]; colp->co_char; colp++) + for (colp = &coltab[0]; colp->co_char != '\0'; colp++) if (colp->co_bit & colmod) printf(" :%c", colp->co_char); printf("\n"); - return(-1); + return (-1); } } - return(0); + return (0); } /* @@ -350,14 +350,14 @@ int evalcol(col) int col; { - register struct coltab *colp; + struct coltab *colp; if (col == 0) - return(lastcolmod); - for (colp = &coltab[0]; colp->co_char; colp++) + return (lastcolmod); + for (colp = &coltab[0]; colp->co_char != '\0'; colp++) if (colp->co_char == col) - return(colp->co_bit); - return(0); + return (colp->co_bit); + return (0); } /* @@ -369,18 +369,18 @@ int check(mesg, f) int mesg, f; { - register struct message *mp; + struct message *mp; if (mesg < 1 || mesg > msgCount) { printf("%d: Invalid message number\n", mesg); - return(-1); + return (-1); } mp = &message[mesg-1]; if (f != MDELETED && (mp->m_flag & MDELETED) != 0) { printf("%d: Inappropriate message\n", mesg); - return(-1); + return (-1); } - return(0); + return (0); } /* @@ -393,12 +393,12 @@ getrawlist(line, argv, argc) char **argv; int argc; { - register char c, *cp, *cp2, quotec; + char c, *cp, *cp2, quotec; int argn; char *linebuf; size_t linebufsize = BUFSIZ; - if ((linebuf = (char *)malloc(linebufsize)) == NULL) + if ((linebuf = malloc(linebufsize)) == NULL) err(1, "Out of memory"); argn = 0; @@ -468,8 +468,8 @@ getrawlist(line, argv, argc) if (c == '?') *cp2++ = '\177'; /* null doesn't show up anyway */ - else if (c >= 'A' && c <= '_' || - c >= 'a' && c <= 'z') + else if ((c >= 'A' && c <= '_') || + (c >= 'a' && c <= 'z')) *cp2++ = c & 037; else { *cp2++ = '^'; @@ -487,9 +487,9 @@ getrawlist(line, argv, argc) *cp2 = '\0'; argv[argn++] = savestr(linebuf); } - argv[argn] = NOSTR; - free(linebuf); - return argn; + argv[argn] = NULL; + (void)free(linebuf); + return (argn); } /* @@ -503,30 +503,30 @@ struct lex { char l_char; char l_token; } singles[] = { - '$', TDOLLAR, - '.', TDOT, - '^', TUP, - '*', TSTAR, - '-', TDASH, - '+', TPLUS, - '(', TOPEN, - ')', TCLOSE, - 0, 0 + { '$', TDOLLAR }, + { '.', TDOT }, + { '^', TUP }, + { '*', TSTAR }, + { '-', TDASH }, + { '+', TPLUS }, + { '(', TOPEN }, + { ')', TCLOSE }, + { 0, 0 } }; int scan(sp) char **sp; { - register char *cp, *cp2; - register int c; - register struct lex *lp; + char *cp, *cp2; + int c; + struct lex *lp; int quotec; if (regretp >= 0) { strcpy(lexstring, string_stack[regretp]); lexnumber = numberstack[regretp]; - return(regretstack[regretp--]); + return (regretstack[regretp--]); } cp = *sp; cp2 = lexstring; @@ -546,7 +546,7 @@ scan(sp) if (c == '\0') { *sp = --cp; - return(TEOL); + return (TEOL); } /* @@ -564,7 +564,7 @@ scan(sp) } *cp2 = '\0'; *sp = --cp; - return(TNUMBER); + return (TNUMBER); } /* @@ -572,12 +572,12 @@ scan(sp) * if found. */ - for (lp = &singles[0]; lp->l_char != 0; lp++) + for (lp = &singles[0]; lp->l_char != '\0'; lp++) if (c == lp->l_char) { lexstring[0] = c; lexstring[1] = '\0'; *sp = cp; - return(lp->l_token); + return (lp->l_token); } /* @@ -604,13 +604,13 @@ scan(sp) *cp2++ = c; c = *cp++; } - if (quotec && c == 0) { + if (quotec && c == '\0') { fprintf(stderr, "Missing %c\n", quotec); - return TERROR; + return (TERROR); } *sp = --cp; *cp2 = '\0'; - return(TSTRING); + return (TSTRING); } /* @@ -645,19 +645,19 @@ int first(f, m) int f, m; { - register struct message *mp; + struct message *mp; if (msgCount == 0) - return 0; + return (0); f &= MDELETED; m &= MDELETED; for (mp = dot; mp < &message[msgCount]; mp++) if ((mp->m_flag & m) == f) - return mp - message + 1; + return (mp - message + 1); for (mp = dot-1; mp >= &message[0]; mp--) if ((mp->m_flag & m) == f) - return mp - message + 1; - return 0; + return (mp - message + 1); + return (0); } /* @@ -669,21 +669,21 @@ matchsender(str, mesg) char *str; int mesg; { - register char *cp, *cp2, *backup; + char *cp, *cp2, *backup; - if (!*str) /* null string matches nothing instead of everything */ - return 0; + if (*str == '\0') /* null string matches nothing instead of everything */ + return (0); backup = cp2 = nameof(&message[mesg - 1], 0); cp = str; - while (*cp2) { - if (*cp == 0) - return(1); + while (*cp2 != '\0') { + if (*cp == '\0') + return (1); if (toupper(*cp++) != toupper(*cp2++)) { cp2 = ++backup; cp = str; } } - return(*cp == 0); + return (*cp == '\0'); } /* @@ -700,8 +700,8 @@ matchsubj(str, mesg) char *str; int mesg; { - register struct message *mp; - register char *cp, *cp2, *backup; + struct message *mp; + char *cp, *cp2, *backup; str++; if (*str == '\0') @@ -714,7 +714,7 @@ matchsubj(str, mesg) * Now look, ignoring case, for the word in the string. */ - if (value("searchheaders") && (cp = strchr(str, ':'))) { + if (value("searchheaders") && (cp = strchr(str, ':')) != NULL) { *cp++ = '\0'; cp2 = hfield(str, mp); cp[-1] = ':'; @@ -723,18 +723,18 @@ matchsubj(str, mesg) cp = str; cp2 = hfield("subject", mp); } - if (cp2 == NOSTR) - return(0); + if (cp2 == NULL) + return (0); backup = cp2; - while (*cp2) { - if (*cp == 0) - return(1); + while (*cp2 != '\0') { + if (*cp == '\0') + return (1); if (toupper(*cp++) != toupper(*cp2++)) { cp2 = ++backup; cp = str; } } - return(*cp == 0); + return (*cp == 0); } /* @@ -744,7 +744,7 @@ void mark(mesg) int mesg; { - register int i; + int i; i = mesg; if (i < 1 || i > msgCount) @@ -759,7 +759,7 @@ void unmark(mesg) int mesg; { - register int i; + int i; i = mesg; if (i < 1 || i > msgCount) @@ -774,8 +774,8 @@ int metamess(meta, f) int meta, f; { - register int c, m; - register struct message *mp; + int c, m; + struct message *mp; c = meta; switch (c) { @@ -785,9 +785,9 @@ metamess(meta, f) */ for (mp = &message[0]; mp < &message[msgCount]; mp++) if ((mp->m_flag & MDELETED) == f) - return(mp - &message[0] + 1); + return (mp - &message[0] + 1); printf("No applicable messages\n"); - return(-1); + return (-1); case '$': /* @@ -795,9 +795,9 @@ metamess(meta, f) */ for (mp = &message[msgCount-1]; mp >= &message[0]; mp--) if ((mp->m_flag & MDELETED) == f) - return(mp - &message[0] + 1); + return (mp - &message[0] + 1); printf("No applicable messages\n"); - return(-1); + return (-1); case '.': /* @@ -806,12 +806,12 @@ metamess(meta, f) m = dot - &message[0] + 1; if ((dot->m_flag & MDELETED) != f) { printf("%d: Inappropriate message\n", m); - return(-1); + return (-1); } - return(m); + return (m); default: printf("Unknown metachar (%c)\n", c); - return(-1); + return (-1); } } |