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/edit.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/edit.c')
-rw-r--r-- | usr.bin/mail/edit.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/usr.bin/mail/edit.c b/usr.bin/mail/edit.c index 62103ad..2f3539b 100644 --- a/usr.bin/mail/edit.c +++ b/usr.bin/mail/edit.c @@ -59,7 +59,7 @@ editor(msgvec) int *msgvec; { - return edit1(msgvec, 'e'); + return (edit1(msgvec, 'e')); } /* @@ -70,7 +70,7 @@ visual(msgvec) int *msgvec; { - return edit1(msgvec, 'v'); + return (edit1(msgvec, 'v')); } /* @@ -83,10 +83,9 @@ edit1(msgvec, type) int *msgvec; int type; { - register int c; - int i; + int c, i; FILE *fp; - register struct message *mp; + struct message *mp; off_t size; /* @@ -100,7 +99,7 @@ edit1(msgvec, type) char *p; printf("Edit message %d [ynq]? ", msgvec[i]); - if (fgets(buf, sizeof buf, stdin) == 0) + if (fgets(buf, sizeof(buf), stdin) == 0) break; for (p = buf; *p == ' ' || *p == '\t'; p++) ; @@ -114,7 +113,7 @@ edit1(msgvec, type) sigint = signal(SIGINT, SIG_IGN); fp = run_editor(setinput(mp), mp->m_size, type, readonly); if (fp != NULL) { - (void) fseek(otf, 0L, 2); + (void)fseek(otf, 0L, 2); size = ftell(otf); mp->m_block = blockof(size); mp->m_offset = boffsetof(size); @@ -130,11 +129,11 @@ edit1(msgvec, type) } if (ferror(otf)) warnx("/tmp"); - (void) Fclose(fp); + (void)Fclose(fp); } - (void) signal(SIGINT, sigint); + (void)signal(SIGINT, sigint); } - return 0; + return (0); } /* @@ -145,17 +144,18 @@ edit1(msgvec, type) */ FILE * run_editor(fp, size, type, readonly) - register FILE *fp; + FILE *fp; off_t size; int type, readonly; { - register FILE *nf = NULL; - register int t; + FILE *nf = NULL; + int t; time_t modtime; char *edit, tempname[PATHSIZE]; struct stat statb; - snprintf(tempname, sizeof(tempname), "%s/mail.ReXXXXXXXXXX", tmpdir); + (void)snprintf(tempname, sizeof(tempname), + "%s/mail.ReXXXXXXXXXX", tmpdir); if ((t = mkstemp(tempname)) == -1 || (nf = Fdopen(t, "w")) == NULL) { warn("%s", tempname); @@ -163,38 +163,38 @@ run_editor(fp, size, type, readonly) } if (readonly && fchmod(t, 0400) == -1) { warn("%s", tempname); - (void) rm(tempname); + (void)rm(tempname); goto out; } if (size >= 0) while (--size >= 0 && (t = getc(fp)) != EOF) - (void) putc(t, nf); + (void)putc(t, nf); else while ((t = getc(fp)) != EOF) - (void) putc(t, nf); - (void) fflush(nf); + (void)putc(t, nf); + (void)fflush(nf); if (fstat(fileno(nf), &statb) < 0) modtime = 0; else modtime = statb.st_mtime; if (ferror(nf)) { - (void) Fclose(nf); + (void)Fclose(nf); warnx("%s", tempname); - (void) rm(tempname); + (void)rm(tempname); nf = NULL; goto out; } if (Fclose(nf) < 0) { warn("%s", tempname); - (void) rm(tempname); + (void)rm(tempname); nf = NULL; goto out; } nf = NULL; - if ((edit = value(type == 'e' ? "EDITOR" : "VISUAL")) == NOSTR) + if ((edit = value(type == 'e' ? "EDITOR" : "VISUAL")) == NULL) edit = type == 'e' ? _PATH_EX : _PATH_VI; - if (run_command(edit, 0, -1, -1, tempname, NOSTR, NOSTR) < 0) { - (void) rm(tempname); + if (run_command(edit, 0, -1, -1, tempname, NULL, NULL) < 0) { + (void)rm(tempname); goto out; } /* @@ -202,7 +202,7 @@ run_editor(fp, size, type, readonly) * temporary and return. */ if (readonly) { - (void) rm(tempname); + (void)rm(tempname); goto out; } if (stat(tempname, &statb) < 0) { @@ -210,7 +210,7 @@ run_editor(fp, size, type, readonly) goto out; } if (modtime == statb.st_mtime) { - (void) rm(tempname); + (void)rm(tempname); goto out; } /* @@ -218,10 +218,10 @@ run_editor(fp, size, type, readonly) */ if ((nf = Fopen(tempname, "a+")) == NULL) { warn("%s", tempname); - (void) rm(tempname); + (void)rm(tempname); goto out; } - (void) rm(tempname); + (void)rm(tempname); out: - return nf; + return (nf); } |