Removed the space between function names and the opening parenthesis.
authormarkus schnalke <meillo@marmaro.de>
Tue, 1 Nov 2011 08:05:30 +0000 (09:05 +0100)
committermarkus schnalke <meillo@marmaro.de>
Tue, 1 Nov 2011 08:05:30 +0000 (09:05 +0100)
165 files changed:
h/aliasbr.h
h/crawl_folders.h
h/dropsbr.h
h/fmt_scan.h
h/mf.h
h/mh.h
h/mhparse.h
h/mts.h
h/nmh.h
h/picksbr.h
h/prototypes.h
h/scansbr.h
h/signals.h
h/tws.h
sbr/addrsbr.c
sbr/ambigsw.c
sbr/brkstring.c
sbr/check_charset.c
sbr/closefds.c
sbr/concat.c
sbr/context_del.c
sbr/context_find.c
sbr/context_foil.c
sbr/context_read.c
sbr/context_replace.c
sbr/context_save.c
sbr/copyip.c
sbr/cpydata.c
sbr/cpydgst.c
sbr/crawl_folders.c
sbr/discard.c
sbr/dtime.c
sbr/error.c
sbr/fdcompare.c
sbr/fmt_addr.c
sbr/fmt_compile.c
sbr/fmt_new.c
sbr/fmt_rfc2047.c
sbr/fmt_scan.c
sbr/folder_addmsg.c
sbr/folder_delmsgs.c
sbr/folder_free.c
sbr/folder_pack.c
sbr/folder_read.c
sbr/folder_realloc.c
sbr/gans.c
sbr/getans.c
sbr/getanswer.c
sbr/getarguments.c
sbr/getcpy.c
sbr/getfolder.c
sbr/lock_file.c
sbr/m_atoi.c
sbr/m_backup.c
sbr/m_convert.c
sbr/m_draft.c
sbr/m_getfld.c
sbr/m_gmprot.c
sbr/m_maildir.c
sbr/m_mktemp.c
sbr/m_name.c
sbr/makedir.c
sbr/mf.c
sbr/mts.c
sbr/path.c
sbr/pidstatus.c
sbr/pidwait.c
sbr/print_help.c
sbr/print_sw.c
sbr/print_version.c
sbr/push.c
sbr/putenv.c
sbr/readconfig.c
sbr/refile.c
sbr/ruserpass.c
sbr/seq_add.c
sbr/seq_bits.c
sbr/seq_del.c
sbr/seq_getnum.c
sbr/seq_list.c
sbr/seq_nameok.c
sbr/seq_print.c
sbr/seq_read.c
sbr/seq_save.c
sbr/seq_setcur.c
sbr/seq_setprev.c
sbr/seq_setunseen.c
sbr/showfile.c
sbr/signals.c
sbr/snprintb.c
sbr/ssequal.c
sbr/strcasecmp.c
sbr/strdup.c
sbr/strindex.c
sbr/trimcpy.c
sbr/uprf.c
sbr/utils.c
sbr/vfgets.c
uip/ali.c
uip/aliasbr.c
uip/anno.c
uip/annosbr.c
uip/ap.c
uip/burst.c
uip/comp.c
uip/conflict.c
uip/dist.c
uip/distsbr.c
uip/dp.c
uip/dropsbr.c
uip/flist.c
uip/fmtdump.c
uip/folder.c
uip/forw.c
uip/ftpsbr.c
uip/inc.c
uip/install-mh.c
uip/mark.c
uip/mhbuild.c
uip/mhbuildsbr.c
uip/mhcachesbr.c
uip/mhfree.c
uip/mhl.c
uip/mhlist.c
uip/mhlistsbr.c
uip/mhlsbr.c
uip/mhmail.c
uip/mhmisc.c
uip/mhoutsbr.c
uip/mhparam.c
uip/mhparse.c
uip/mhpath.c
uip/mhshow.c
uip/mhshowsbr.c
uip/mhstore.c
uip/mhstoresbr.c
uip/mhtest.c
uip/msgchk.c
uip/new.c
uip/packf.c
uip/pick.c
uip/picksbr.c
uip/prompter.c
uip/rcvdist.c
uip/rcvpack.c
uip/rcvstore.c
uip/rcvtty.c
uip/refile.c
uip/repl.c
uip/replsbr.c
uip/rmf.c
uip/rmm.c
uip/scan.c
uip/scansbr.c
uip/send.c
uip/sendsbr.c
uip/show.c
uip/slocal.c
uip/sortm.c
uip/spost.c
uip/termsbr.c
uip/viamail.c
uip/whatnow.c
uip/whatnowproc.c
uip/whatnowsbr.c

index 5405531..c38223a 100644 (file)
@@ -33,17 +33,17 @@ struct home {
        struct home *h_next;    /* next home in list                     */
 };
 
-struct home *seek_home (char *);
+struct home *seek_home(char *);
 
 /*
 ** prototypes
 */
-int alias (char *);
-int akvisible (void);
-void init_pw (void);
-char *akresult (struct aka *);
-char *akvalue (char *);
-char *akerror (int);
+int alias(char *);
+int akvisible(void);
+void init_pw(void);
+char *akresult(struct aka *);
+char *akvalue(char *);
+char *akerror(int);
 
 /* codes returned by alias() */
 
index e81acb1..afc249c 100644 (file)
@@ -16,4 +16,4 @@ typedef boolean (crawl_callback_t)(char *folder, void *baton);
 ** directory) and `baton'; the callback may direct crawl_folders not to crawl
 ** its children; see above.
 */
-void crawl_folders (char *dir, crawl_callback_t *callback, void *baton);
+void crawl_folders(char *dir, crawl_callback_t *callback, void *baton);
index 2742ae6..b32d316 100644 (file)
@@ -43,13 +43,13 @@ struct drop {
 /*
 ** prototypes
 */
-int mbx_open (char *, int, uid_t, gid_t, mode_t);
-int mbx_read (FILE *, long, struct drop **, int);
+int mbx_open(char *, int, uid_t, gid_t, mode_t);
+int mbx_read(FILE *, long, struct drop **, int);
 int mbx_write(char *, int, FILE *, int, long, long, off_t, int, int);
-int mbx_copy (char *, int, int, int, int, char *, int);
-int mbx_size (int, off_t, off_t);
-int mbx_close (char *, int);
-char *map_name (char *);
-int map_read (char *, long, struct drop **, int);
-int map_write (char *, int, int, long, off_t, off_t, long, int, int);
-int map_chk (char *, int, struct drop *, long, int);
+int mbx_copy(char *, int, int, int, int, char *, int);
+int mbx_size(int, off_t, off_t);
+int mbx_close(char *, int);
+char *map_name(char *);
+int map_read(char *, long, struct drop **, int);
+int map_write(char *, int, int, long, off_t, off_t, long, int, int);
+int map_chk(char *, int, struct drop *, long, int);
index f65dab1..96acd56 100644 (file)
@@ -87,6 +87,6 @@ struct format {
 /*
 ** prototypes
 */
-struct format *fmt_scan (struct format *, char *, int, int *);
-char *new_fs (char *, char *, char *);
-int fmt_compile (char *, struct format **);
+struct format *fmt_scan(struct format *, char *, int, int *);
+char *new_fs(char *, char *, char *);
+int fmt_compile(char *, struct format **);
diff --git a/h/mf.h b/h/mf.h
index b5a7892..373a692 100644 (file)
--- a/h/mf.h
+++ b/h/mf.h
@@ -68,5 +68,5 @@ struct adrx {
 /*
 ** prototypes
 */
-char *legal_person (char *);
-struct adrx *getadrx (char *);
+char *legal_person(char *);
+struct adrx *getadrx(char *);
diff --git a/h/mh.h b/h/mh.h
index 70bfee7..2e3be95 100644 (file)
--- a/h/mh.h
+++ b/h/mh.h
@@ -263,7 +263,7 @@ extern char *msg_delim;      /*  .. */
 ** miscellaneous macros
 */
 
-#define pidXwait(pid,cp) pidstatus (pidwait (pid, NOTOK), stdout, cp)
+#define pidXwait(pid,cp) pidstatus(pidwait(pid, NOTOK), stdout, cp)
 
 #ifndef max
 # define max(a,b) ((a) > (b) ? (a) : (b))
index bef3f4f..9d31c4a 100644 (file)
@@ -271,12 +271,12 @@ extern struct str2init str2methods[];
 /*
 ** prototypes
 */
-int pidcheck (int);
-CT parse_mime (char *);
-int add_header (CT, char *, char *);
-int get_ctinfo (unsigned char *, CT, int);
-int params_external (CT, int);
-int open7Bit (CT, char **);
-void close_encoding (CT);
+int pidcheck(int);
+CT parse_mime(char *);
+int add_header(CT, char *, char *);
+int get_ctinfo(unsigned char *, CT, int);
+int params_external(CT, int);
+int open7Bit(CT, char **);
+void close_encoding(CT);
 
 extern int checksw;    /* Add Content-MD5 field */
diff --git a/h/mts.h b/h/mts.h
index df1d9b5..5ddd837 100644 (file)
--- a/h/mts.h
+++ b/h/mts.h
@@ -16,10 +16,10 @@ extern char *mmdflfil;
 extern char *uucpldir;
 extern char *uucplfil;
 
-#define MAILDIR (mmdfldir && *mmdfldir ? mmdfldir : getenv ("HOME"))
-#define MAILFIL (mmdflfil && *mmdflfil ? mmdflfil : getusername ())
-#define UUCPDIR (uucpldir && *uucpldir ? uucpldir : getenv ("HOME"))
-#define UUCPFIL (uucplfil && *uucplfil ? uucplfil : getusername ())
+#define MAILDIR (mmdfldir && *mmdfldir ? mmdfldir : getenv("HOME"))
+#define MAILFIL (mmdflfil && *mmdflfil ? mmdflfil : getusername())
+#define UUCPDIR (uucpldir && *uucpldir ? uucpldir : getenv("HOME"))
+#define UUCPFIL (uucplfil && *uucplfil ? uucplfil : getusername())
 
 char *getusername(void);
 char *getfullname(void);
@@ -30,13 +30,13 @@ char *getfullname(void);
 extern char *mmdlm1;
 extern char *mmdlm2;
 
-#define isdlm1(s) (strcmp (s, mmdlm1) == 0)
-#define isdlm2(s) (strcmp (s, mmdlm2) == 0)
+#define isdlm1(s) (strcmp(s, mmdlm1) == 0)
+#define isdlm2(s) (strcmp(s, mmdlm2) == 0)
 
 /*
 ** Read mts.conf file
 */
-void mts_init (char *);
+void mts_init(char *);
 
 /*
 ** Global MailDelivery File
diff --git a/h/nmh.h b/h/nmh.h
index 4ae127d..75d4d2a 100644 (file)
--- a/h/nmh.h
+++ b/h/nmh.h
 #include <signal.h>
 
 #define bcmp(b1,b2,length)      memcmp(b1, b2, length)
-#define bcopy(b1,b2,length)     memcpy (b2, b1, length)
-#define bcpy(b1,b2,length)      memcmp (b1, b2, length)
-#define bzero(b,length)         memset (b, 0, length)
+#define bcopy(b1,b2,length)     memcpy(b2, b1, length)
+#define bcpy(b1,b2,length)      memcmp(b1, b2, length)
+#define bzero(b,length)         memset(b, 0, length)
 
 #ifdef HAVE_KILLPG
 # define KILLPG(pgrp,sig) killpg(pgrp,sig);
index d69825a..31b904e 100644 (file)
@@ -5,5 +5,5 @@
 /*
 ** prototypes
 */
-int pcompile (char **, char *);
-int pmatches (FILE *, int, long, long);
+int pcompile(char **, char *);
+int pmatches(FILE *, int, long, long);
index baf40d9..81c4801 100644 (file)
@@ -6,12 +6,12 @@
 ** missing system prototypes
 */
 #ifndef HAVE_TERMCAP_H
-extern int tgetent (char *bp, char *name);
-extern int tgetnum (char *id);
-extern int tgetflag (char *id);
-extern char *tgetstr (char *id, char **area);
-extern char *tgoto (char *cm, int destcol, int destline);
-extern int tputs (char *cp, int affcnt, int (*outc) (int));
+extern int tgetent(char *bp, char *name);
+extern int tgetnum(char *id);
+extern int tgetflag(char *id);
+extern char *tgetstr(char *id, char **area);
+extern char *tgoto(char *cm, int destcol, int destline);
+extern int tputs(char *cp, int affcnt, int (*outc) (int));
 #endif
 
 /*
@@ -22,119 +22,119 @@ char *etcpath(char *);
 /*
 ** prototypes from the nmh subroutine library
 */
-void adios (char *, char *, ...) NORETURN;
-void admonish (char *, char *, ...);
-void advertise (char *, char *, char *, va_list);
-void advise (char *, char *, ...);
-void ambigsw (char *, struct swit *);
+void adios(char *, char *, ...) NORETURN;
+void admonish(char *, char *, ...);
+void advertise(char *, char *, char *, va_list);
+void advise(char *, char *, ...);
+void ambigsw(char *, struct swit *);
 int atooi(char *);
-char **brkstring (char *, char *, char *);
-int check_charset (char *, int);
+char **brkstring(char *, char *, char *);
+int check_charset(char *, int);
 void closefds(int);
-char *concat (char *, ...);
-int context_del (char *);
-char *context_find (char *);
-int context_foil (char *);
-void context_read (void);
-void context_replace (char *, char *);
-void context_save (void);
-char *copy (char *, char *);
-char **copyip (char **, char **, int);
-void cpydata (int, int, char *, char *);
-void cpydgst (int, int, char *, char *);
-int decode_rfc2047 (char *, char *, size_t);
-void discard (FILE *);
-int default_done (int);
+char *concat(char *, ...);
+int context_del(char *);
+char *context_find(char *);
+int context_foil(char *);
+void context_read(void);
+void context_replace(char *, char *);
+void context_save(void);
+char *copy(char *, char *);
+char **copyip(char **, char **, int);
+void cpydata(int, int, char *, char *);
+void cpydgst(int, int, char *, char *);
+int decode_rfc2047(char *, char *, size_t);
+void discard(FILE *);
+int default_done(int);
 int ext_hook(char *, char *, char *);
-int fdcompare (int, int);
-int folder_addmsg (struct msgs **, char *, int, int, int, int, char *);
-int folder_delmsgs (struct msgs *, int, int);
-void folder_free (struct msgs *);
-int folder_pack (struct msgs **, int);
-struct msgs *folder_read (char *);
-struct msgs *folder_realloc (struct msgs *, int, int);
-int gans (char *, struct swit *);
-char **getans (char *, struct swit *);
-int getanswer (char *);
-char **getarguments (char *, int, char **, int);
+int fdcompare(int, int);
+int folder_addmsg(struct msgs **, char *, int, int, int, int, char *);
+int folder_delmsgs(struct msgs *, int, int);
+void folder_free(struct msgs *);
+int folder_pack(struct msgs **, int);
+struct msgs *folder_read(char *);
+struct msgs *folder_realloc(struct msgs *, int, int);
+int gans(char *, struct swit *);
+char **getans(char *, struct swit *);
+int getanswer(char *);
+char **getarguments(char *, int, char **, int);
 char *get_charset();
-char *getcpy (char *);
+char *getcpy(char *);
 char *getfolder(int);
 int lkclose(int, char*);
 int lkfclose(FILE *, char *);
 FILE *lkfopen(char *, char *);
 int lkopen(char *, int, mode_t);
-int m_atoi (char *);
-char *m_backup (char *);
-int m_convert (struct msgs *, char *);
-char *m_draft (char *);
-int m_getfld (int, unsigned char *, unsigned char *, int, FILE *);
-int m_gmprot (void);
-char *m_maildir (char *);
-char *m_mailpath (char *);
-char *m_name (int);
-int m_putenv (char *, char *);
+int m_atoi(char *);
+char *m_backup(char *);
+int m_convert(struct msgs *, char *);
+char *m_draft(char *);
+int m_getfld(int, unsigned char *, unsigned char *, int, FILE *);
+int m_gmprot(void);
+char *m_maildir(char *);
+char *m_mailpath(char *);
+char *m_name(int);
+int m_putenv(char *, char *);
 char *m_mktemp(const char *, int *, FILE **);
 char *m_mktemp2(const char *, const char *, int *, FILE **);
 void m_unknown(FILE *);
-int makedir (char *);
+int makedir(char *);
 char *nmh_getpass(const char *);
 char *norm_charmap(char *);
-char *new_fs (char *, char *, char *);
+char *new_fs(char *, char *, char *);
 char *path(char *, int);
 int peekc(FILE *ib);
-int pidwait (pid_t, int);
-int pidstatus (int, FILE *, char *);
+int pidwait(pid_t, int);
+int pidstatus(int, FILE *, char *);
 char *pluspath(char *);
-void print_help (char *, struct swit *, int);
-void print_sw (char *, struct swit *, char *, FILE *);
-void print_version (char *);
-void push (void);
-char *pwd (void);
+void print_help(char *, struct swit *, int);
+void print_sw(char *, struct swit *, char *, FILE *);
+void print_version(char *);
+void push(void);
+char *pwd(void);
 char *r1bindex(char *, int);
-void readconfig (struct node **, FILE *, char *, int);
-int refile (char **, char *);
+void readconfig(struct node **, FILE *, char *, int);
+int refile(char **, char *);
 void ruserpass(char *, char **, char **);
-int seq_addmsg (struct msgs *, char *, int, int, int);
-int seq_addsel (struct msgs *, char *, int, int);
-char *seq_bits (struct msgs *);
-int seq_delmsg (struct msgs *, char *, int);
-int seq_delsel (struct msgs *, char *, int, int);
-int seq_getnum (struct msgs *, char *);
-char *seq_list (struct msgs *, char *);
-int seq_nameok (unsigned char *);
-void seq_print (struct msgs *, char *);
-void seq_printall (struct msgs *);
-void seq_read (struct msgs *);
-void seq_save (struct msgs *);
-void seq_setcur (struct msgs *, int);
-void seq_setprev (struct msgs *);
-void seq_setunseen (struct msgs *, int);
-int showfile (char **, char *);
+int seq_addmsg(struct msgs *, char *, int, int, int);
+int seq_addsel(struct msgs *, char *, int, int);
+char *seq_bits(struct msgs *);
+int seq_delmsg(struct msgs *, char *, int);
+int seq_delsel(struct msgs *, char *, int, int);
+int seq_getnum(struct msgs *, char *);
+char *seq_list(struct msgs *, char *);
+int seq_nameok(unsigned char *);
+void seq_print(struct msgs *, char *);
+void seq_printall(struct msgs *);
+void seq_read(struct msgs *);
+void seq_save(struct msgs *);
+void seq_setcur(struct msgs *, int);
+void seq_setprev(struct msgs *);
+void seq_setunseen(struct msgs *, int);
+int showfile(char **, char *);
 int smatch(char *, struct swit *);
-char *snprintb (char *, size_t, unsigned, char *);
-int ssequal (char *, char *);
-int stringdex (char *, char *);
-char *trimcpy (unsigned char *);
-int unputenv (char *);
-int uprf (char *, char *);
-int vfgets (FILE *, char **);
-char *write_charset_8bit (void);
+char *snprintb(char *, size_t, unsigned, char *);
+int ssequal(char *, char *);
+int stringdex(char *, char *);
+char *trimcpy(unsigned char *);
+int unputenv(char *);
+int uprf(char *, char *);
+int vfgets(FILE *, char **);
+char *write_charset_8bit(void);
 
 #ifdef RPATHS
-int get_returnpath (char *, int, char *, int);
+int get_returnpath(char *, int, char *, int);
 #endif
 
 /*
 ** prototypes for compatibility functions in library
 */
 #ifndef HAVE_SNPRINTF_PROTOTYPE
-int snprintf (char *, size_t, const char *, ...);
-int vsnprintf (char *, size_t, const char *, va_list);
+int snprintf(char *, size_t, const char *, ...);
+int vsnprintf(char *, size_t, const char *, va_list);
 #endif
 
-int mh_strcasecmp (const char *s1, const char *s2);
-int strncasecmp (const char *s1, const char *s2, size_t n);
+int mh_strcasecmp(const char *s1, const char *s2);
+int strncasecmp(const char *s1, const char *s2, size_t n);
 
 
 /*
@@ -148,12 +148,12 @@ char *OfficialName(char *);
 /*
 ** prototypes for some routines in uip
 */
-int annotate (char *, char *, char *, int, int, int, int);
+int annotate(char *, char *, char *, int, int, int, int);
 void annolist(char *, char *, char *, int);
 void annopreserve(int);
-int distout (char *, char *, char *);
-void replout (FILE *, char *, char *, struct msgs *, int,
-               int, char *, char *, char *);
-int sendsbr (char **, int, char *, struct stat *, int, char *, int);
-int what_now (char *, int, int, char *, char *,
-               int, struct msgs *, char *, int, char *);
+int distout(char *, char *, char *);
+void replout(FILE *, char *, char *, struct msgs *, int, int,
+               char *, char *, char *);
+int sendsbr(char **, int, char *, struct stat *, int, char *, int);
+int what_now(char *, int, int, char *, char *, int, struct msgs *,
+               char *, int, char *);
index bba2b44..45dd1fe 100644 (file)
@@ -35,4 +35,4 @@ extern char *scanl;
 /*
 ** prototypes
 */
-int scan (FILE *, int, int, char *, int, int, int, char *, long, int);
+int scan(FILE *, int, int, char *, int, int, int, char *, long, int);
index 645c340..d805d19 100644 (file)
@@ -26,6 +26,6 @@ typedef RETSIGTYPE (*SIGNAL_HANDLER)(int);
 /*
 ** prototypes
 */
-int SIGPROCMASK (int, const sigset_t *, sigset_t *);
-SIGNAL_HANDLER SIGNAL (int, SIGNAL_HANDLER);
-SIGNAL_HANDLER SIGNAL2 (int, SIGNAL_HANDLER);
+int SIGPROCMASK(int, const sigset_t *, sigset_t *);
+SIGNAL_HANDLER SIGNAL(int, SIGNAL_HANDLER);
+SIGNAL_HANDLER SIGNAL2(int, SIGNAL_HANDLER);
diff --git a/h/tws.h b/h/tws.h
index 77ccaa6..289a673 100644 (file)
--- a/h/tws.h
+++ b/h/tws.h
@@ -44,7 +44,7 @@ struct tws {
 #define TW_YES   0x0040  /*   yes, found                   */
 #define TW_NO    0x0000  /*   no, not found                */
 
-#define dtwszone(tw) dtimezone (tw->tw_zone, tw->tw_flags)
+#define dtwszone(tw) dtimezone(tw->tw_zone, tw->tw_flags)
 
 extern char *tw_dotw[];
 extern char *tw_ldotw[];
@@ -53,17 +53,17 @@ extern char *tw_moty[];
 /*
 ** prototypes
 */
-char *dtime (time_t *, int);
-char *dtimenow (int);
-char *dctime (struct tws *);
-struct tws *dlocaltimenow (void);
-struct tws *dlocaltime (time_t *);
-struct tws *dgmtime (time_t *);
-char *dasctime (struct tws *, int);
-char *dtimezone (int, int);
-void twscopy (struct tws *, struct tws *);
-int twsort (struct tws *, struct tws *);
-time_t dmktime (struct tws *);
-void set_dotw (struct tws *);
+char *dtime(time_t *, int);
+char *dtimenow(int);
+char *dctime(struct tws *);
+struct tws *dlocaltimenow(void);
+struct tws *dlocaltime(time_t *);
+struct tws *dgmtime(time_t *);
+char *dasctime(struct tws *, int);
+char *dtimezone(int, int);
+void twscopy(struct tws *, struct tws *);
+int twsort(struct tws *, struct tws *);
+time_t dmktime(struct tws *);
+void set_dotw(struct tws *);
 
-struct tws *dparsetime (char *);
+struct tws *dparsetime(char *);
index c8eb0c8..df81839 100644 (file)
@@ -79,21 +79,21 @@ extern boolean  username_extension_masquerading;  /* defined in mts.c */
 /*
 ** external prototypes
 */
-char *getusername (void);
+char *getusername(void);
 
 
 char *
-getname (char *addrs)
+getname(char *addrs)
 {
        struct adrx *ap;
 
        pers = mbox = host = route = grp = note = NULL;
        err[0] = '\0';
 
-       if ((ap = getadrx (addrs ? addrs : "")) == NULL)
+       if ((ap = getadrx(addrs ? addrs : "")) == NULL)
                return NULL;
 
-       strncpy (adr, ap->text, sizeof(adr));
+       strncpy(adr, ap->text, sizeof(adr));
        pers = ap->pers;
        mbox = ap->mbox;
        host = ap->host;
@@ -102,14 +102,14 @@ getname (char *addrs)
        ingrp = ap->ingrp;
        note = ap->note;
        if (ap->err && *ap->err)
-               strncpy (err, ap->err, sizeof(err));
+               strncpy(err, ap->err, sizeof(err));
 
        return adr;
 }
 
 
 struct mailname *
-getm (char *str, char *dfhost, int dftype, int wanthost, char *eresult)
+getm(char *str, char *dfhost, int dftype, int wanthost, char *eresult)
 {
        char *pp;
        struct mailname *mp;
@@ -119,70 +119,70 @@ getm (char *str, char *dfhost, int dftype, int wanthost, char *eresult)
 
        if (err[0]) {
                if (eresult)
-                       strcpy (eresult, err);
+                       strcpy(eresult, err);
                else
                        if (wanthost == AD_HOST)
-                               admonish (NULL, "bad address '%s' - %s", str, err);
+                               admonish(NULL, "bad address '%s' - %s", str, err);
                return NULL;
        }
        if (pers == NULL && mbox == NULL && host == NULL && route == NULL
                && grp == NULL) {
                if (eresult)
-                       strcpy (eresult, "null address");
+                       strcpy(eresult, "null address");
                else
                        if (wanthost == AD_HOST)
-                               admonish (NULL, "null address '%s'", str);
+                               admonish(NULL, "null address '%s'", str);
                return NULL;
        }
        if (mbox == NULL && grp == NULL) {
                if (eresult)
-                       strcpy (eresult, "no mailbox in address");
+                       strcpy(eresult, "no mailbox in address");
                else if (wanthost == AD_HOST)
-                       admonish (NULL, "no mailbox in address '%s'", str);
+                       admonish(NULL, "no mailbox in address '%s'", str);
                return NULL;
        }
 
        if (dfhost == NULL) {
-               dfhost = LocalName ();
+               dfhost = LocalName();
                dftype = LOCALHOST;
        }
 
-       mp = (struct mailname *) calloc ((size_t) 1, sizeof(*mp));
+       mp = (struct mailname *) calloc((size_t) 1, sizeof(*mp));
        if (mp == NULL) {
                if (eresult)
-                       strcpy (eresult, "insufficient memory to represent address");
+                       strcpy(eresult, "insufficient memory to represent address");
                else if (wanthost == AD_HOST)
-                       adios (NULL, "insufficient memory to represent address");
+                       adios(NULL, "insufficient memory to represent address");
                return NULL;
        }
 
        mp->m_next = NULL;
-       mp->m_text = getcpy (str);
+       mp->m_text = getcpy(str);
        if (pers)
-               mp->m_pers = getcpy (pers);
+               mp->m_pers = getcpy(pers);
 
        if (mbox == NULL) {
                mp->m_type = BADHOST;
                mp->m_nohost = 1;
                mp->m_ingrp = ingrp;
-               mp->m_gname = getcpy (grp);
+               mp->m_gname = getcpy(grp);
                if (note)
-                       mp->m_note = getcpy (note);
+                       mp->m_note = getcpy(note);
                return mp;
        }
 
        if (host) {
-               mp->m_mbox = getcpy (mbox);
-               mp->m_host = getcpy (host);
+               mp->m_mbox = getcpy(mbox);
+               mp->m_host = getcpy(host);
        } else {
                if ((pp = strchr(mbox, '!'))) {
                        *pp++ = '\0';
-                       mp->m_mbox = getcpy (pp);
-                       mp->m_host = getcpy (mbox);
+                       mp->m_mbox = getcpy(pp);
+                       mp->m_host = getcpy(mbox);
                        mp->m_type = UUCPHOST;
                } else {
                        mp->m_nohost = 1;
-                       mp->m_mbox = getcpy (mbox);
+                       mp->m_mbox = getcpy(mbox);
 #ifdef DUMB
                        if (route == NULL && dftype == LOCALHOST) {
                                mp->m_host = NULL;
@@ -190,7 +190,7 @@ getm (char *str, char *dfhost, int dftype, int wanthost, char *eresult)
                        } else
 #endif /* DUMB */
                        {
-                               mp->m_host = route ? NULL : getcpy (dfhost);
+                               mp->m_host = route ? NULL : getcpy(dfhost);
                                mp->m_type = route ? NETHOST : dftype;
                        }
                }
@@ -198,22 +198,22 @@ getm (char *str, char *dfhost, int dftype, int wanthost, char *eresult)
        }
 
        if (wanthost == AD_NHST)
-               mp->m_type = !mh_strcasecmp (LocalName (), mp->m_host)
+               mp->m_type = !mh_strcasecmp(LocalName(), mp->m_host)
                        ? LOCALHOST : NETHOST;
 #ifdef DUMB
        else
-               mp->m_type = mh_strcasecmp (LocalName(), mp->m_host) ?  NETHOST : LOCALHOST;
+               mp->m_type = mh_strcasecmp(LocalName(), mp->m_host) ?  NETHOST : LOCALHOST;
 #else /* not DUMB */
        else
-               if (pp = OfficialName (mp->m_host)) {
+               if (pp = OfficialName(mp->m_host)) {
        got_real_host: ;
                        free (mp->m_host);
-                       mp->m_host = getcpy (pp);
-                       mp->m_type = mh_strcasecmp (LocalName(), mp->m_host) ? NETHOST : LOCALHOST;
+                       mp->m_host = getcpy(pp);
+                       mp->m_type = mh_strcasecmp(LocalName(), mp->m_host) ? NETHOST : LOCALHOST;
                } else {
                        if (dp = strchr(mp->m_host, '.')) {
                                *dp = NULL;
-                               if (pp = OfficialName (mp->m_host))
+                               if (pp = OfficialName(mp->m_host))
                                        goto got_real_host;
                                *dp = '.';
                        }
@@ -223,77 +223,77 @@ getm (char *str, char *dfhost, int dftype, int wanthost, char *eresult)
 
 got_host: ;
        if (route)
-               mp->m_path = getcpy (route);
+               mp->m_path = getcpy(route);
        mp->m_ingrp = ingrp;
        if (grp)
-               mp->m_gname = getcpy (grp);
+               mp->m_gname = getcpy(grp);
        if (note)
-               mp->m_note = getcpy (note);
+               mp->m_note = getcpy(note);
 
        return mp;
 }
 
 
 void
-mnfree (struct mailname *mp)
+mnfree(struct mailname *mp)
 {
        if (!mp)
                return;
 
        if (mp->m_text)
-               free (mp->m_text);
+               free(mp->m_text);
        if (mp->m_pers)
-               free (mp->m_pers);
+               free(mp->m_pers);
        if (mp->m_mbox)
-               free (mp->m_mbox);
+               free(mp->m_mbox);
        if (mp->m_host)
-               free (mp->m_host);
+               free(mp->m_host);
        if (mp->m_path)
-               free (mp->m_path);
+               free(mp->m_path);
        if (mp->m_gname)
-               free (mp->m_gname);
+               free(mp->m_gname);
        if (mp->m_note)
-               free (mp->m_note);
+               free(mp->m_note);
 
-       free ((char *) mp);
+       free((char *) mp);
 }
 
 
 #define empty(s) ((s) ? (s) : "")
 
 char *
-adrformat (struct mailname *mp)
+adrformat(struct mailname *mp)
 {
        static char addr[BUFSIZ];
        static char buffer[BUFSIZ];
 
 #ifdef DUMB
        if (mp->m_nohost)
-               strncpy (addr, mp->m_mbox ? mp->m_mbox : "", sizeof(addr));
+               strncpy(addr, mp->m_mbox ? mp->m_mbox : "", sizeof(addr));
        else
 #endif /* DUMB */
 
 #ifndef BANG
        if (mp->m_type != UUCPHOST)
-               snprintf (addr, sizeof(addr), mp->m_host ? "%s%s@%s" : "%s%s",
+               snprintf(addr, sizeof(addr), mp->m_host ? "%s%s@%s" : "%s%s",
                        empty(mp->m_path), empty(mp->m_mbox), mp->m_host);
        else
 #endif /* not BANG */
-               snprintf (addr, sizeof(addr), "%s!%s", mp->m_host, mp->m_mbox);
+               snprintf(addr, sizeof(addr), "%s!%s", mp->m_host, mp->m_mbox);
 
        if (mp->m_pers || mp->m_path) {
                if (mp->m_note)
-                       snprintf (buffer, sizeof(buffer), "%s %s <%s>",
-                               legal_person (mp->m_pers ? mp->m_pers : mp->m_mbox),
+                       snprintf(buffer, sizeof(buffer), "%s %s <%s>",
+                               legal_person(mp->m_pers ? mp->m_pers : mp->m_mbox),
                                mp->m_note, addr);
                else
-                       snprintf (buffer, sizeof(buffer), "%s <%s>",
-                               legal_person (mp->m_pers ? mp->m_pers : mp->m_mbox),
+                       snprintf(buffer, sizeof(buffer), "%s <%s>",
+                               legal_person(mp->m_pers ? mp->m_pers : mp->m_mbox),
                                addr);
        } else if (mp->m_note)
-               snprintf (buffer, sizeof(buffer), "%s %s", addr, mp->m_note);
+               snprintf(buffer, sizeof(buffer), "%s %s", addr, mp->m_note);
        else
-               strncpy (buffer, addr, sizeof(buffer));
+               strncpy(buffer, addr, sizeof(buffer));
 
        return buffer;
 }
@@ -313,7 +313,7 @@ adrformat (struct mailname *mp)
 */
 
 int
-ismymbox (struct mailname *np)
+ismymbox(struct mailname *np)
 {
        int oops;
        register int len, i;
@@ -330,15 +330,15 @@ ismymbox (struct mailname *np)
        */
        if (am == NULL) {
                mq.m_next = NULL;
-               mq.m_mbox = getusername ();
-               if ((am = context_find ("alternate-mailboxes")) == NULL)
+               mq.m_mbox = getusername();
+               if ((am = context_find("alternate-mailboxes")) == NULL)
                        am = getusername();
                else {
                        mp = &mq;
                        oops = 0;
-                       while ((cp = getname (am))) {
-                               if ((mp->m_next = getm (cp, NULL, 0, AD_NAME, NULL)) == NULL) {
-                                       admonish (NULL, "illegal address: %s", cp);
+                       while ((cp = getname(am))) {
+                               if ((mp->m_next = getm(cp, NULL, 0, AD_NAME, NULL)) == NULL) {
+                                       admonish(NULL, "illegal address: %s", cp);
                                        oops++;
                                } else {
                                        mp = mp->m_next;
@@ -347,7 +347,7 @@ ismymbox (struct mailname *np)
                                                mp->m_type |= W_MBEG;
                                                mp->m_mbox++;
                                        }
-                                       if (*(cp = mp->m_mbox + strlen (mp->m_mbox) - 1) == '*') {
+                                       if (*(cp = mp->m_mbox + strlen(mp->m_mbox) - 1) == '*') {
                                                mp->m_type |= W_MEND;
                                                *cp = '\0';
                                        }
@@ -356,19 +356,19 @@ ismymbox (struct mailname *np)
                                                        mp->m_type |= W_HBEG;
                                                        mp->m_host++;
                                                }
-                                               if (*(cp = mp->m_host + strlen (mp->m_host) - 1) == '*') {
+                                               if (*(cp = mp->m_host + strlen(mp->m_host) - 1) == '*') {
                                                        mp->m_type |= W_HEND;
                                                        *cp = '\0';
                                                }
                                        }
-                                       if ((cp = getenv ("MHWDEBUG")) && *cp)
-                                               fprintf (stderr, "mbox=\"%s\" host=\"%s\" %s\n",
+                                       if ((cp = getenv("MHWDEBUG")) && *cp)
+                                               fprintf(stderr, "mbox=\"%s\" host=\"%s\" %s\n",
                                                        mp->m_mbox, mp->m_host,
-                                                       snprintb (buffer, sizeof(buffer), (unsigned) mp->m_type, WBITS));
+                                                       snprintb(buffer, sizeof(buffer), (unsigned) mp->m_type, WBITS));
                                }
                        }
                        if (oops)
-                               advise (NULL, "please fix the %s: entry in your %s file",
+                               advise(NULL, "please fix the %s: entry in your %s file",
                                        "alternate-mailboxes", mh_profile);
                }
        }
@@ -378,17 +378,17 @@ ismymbox (struct mailname *np)
 
        switch (np->m_type) {
                case NETHOST:
-                       len = strlen (cp = LocalName ());
-                       if (!uprf (np->m_host, cp) || np->m_host[len] != '.')
+                       len = strlen(cp = LocalName());
+                       if (!uprf(np->m_host, cp) || np->m_host[len] != '.')
                                break;
                        goto local_test;
 
                case UUCPHOST:
-                       if (mh_strcasecmp (np->m_host, SystemName()))
+                       if (mh_strcasecmp(np->m_host, SystemName()))
                                break;  /* fall */
                case LOCALHOST:
 local_test: ;
-                       if (!mh_strcasecmp (np->m_mbox, mq.m_mbox))
+                       if (!mh_strcasecmp(np->m_mbox, mq.m_mbox))
                                return 1;
                        break;
 
@@ -404,24 +404,24 @@ local_test: ;
                mp = mp->m_next;
                if (!np->m_mbox)
                        continue;
-               if ((len = strlen (cp = np->m_mbox))
-                       < (i = strlen (pp = mp->m_mbox)))
+               if ((len = strlen(cp = np->m_mbox))
+                       < (i = strlen(pp = mp->m_mbox)))
                        continue;
                switch (mp->m_type & W_MBOX) {
                        case W_NIL:
-                               if (mh_strcasecmp (cp, pp))
+                               if (mh_strcasecmp(cp, pp))
                                        continue;
                                break;
                        case W_MBEG:
-                               if (mh_strcasecmp (cp + len - i, pp))
+                               if (mh_strcasecmp(cp + len - i, pp))
                                        continue;
                                break;
                        case W_MEND:
-                               if (!uprf (cp, pp))
+                               if (!uprf(cp, pp))
                                        continue;
                                break;
                        case W_MBEG | W_MEND:
-                               if (stringdex (pp, cp) < 0)
+                               if (stringdex(pp, cp) < 0)
                                        continue;
                                break;
                }
@@ -430,12 +430,12 @@ local_test: ;
                        return 1;
                if (np->m_host == NULL)
                        continue;
-               if ((len = strlen (cp = np->m_host))
-                       < (i = strlen (pp = mp->m_host)))
+               if ((len = strlen(cp = np->m_host))
+                       < (i = strlen(pp = mp->m_host)))
                        continue;
                switch (mp->m_type & W_HOST) {
                        case W_NIL:
-                               if (mh_strcasecmp (cp, pp))
+                               if (mh_strcasecmp(cp, pp))
                                        continue;
                                break;
                        case W_HBEG:
@@ -443,11 +443,11 @@ local_test: ;
                                        continue;
                                break;
                        case W_HEND:
-                               if (!uprf (cp, pp))
+                               if (!uprf(cp, pp))
                                        continue;
                                break;
                        case W_HBEG | W_HEND:
-                               if (stringdex (pp, cp) < 0)
+                               if (stringdex(pp, cp) < 0)
                                        continue;
                                break;
                }
@@ -474,7 +474,7 @@ local_test: ;
 
 
 char *
-OfficialName (char *name)
+OfficialName(char *name)
 {
        unsigned char *p;
        char *q, site[BUFSIZ];
@@ -483,11 +483,11 @@ OfficialName (char *name)
        static char buffer[BUFSIZ];
 
        for (p = name, q = site; *p && (q - site < sizeof(site) - 1); p++, q++)
-               *q = isupper (*p) ? tolower (*p) : *p;
+               *q = isupper(*p) ? tolower(*p) : *p;
        *q = '\0';
        q = site;
 
-       if (!mh_strcasecmp (LocalName(), site))
+       if (!mh_strcasecmp(LocalName(), site))
                return LocalName();
 
        memset(&hints, 0, sizeof(hints));
@@ -495,12 +495,12 @@ OfficialName (char *name)
        hints.ai_family = PF_UNSPEC;
 
        if (getaddrinfo(q, NULL, &hints, &res) == 0) {
-               strncpy (buffer, res->ai_canonname, sizeof(buffer));
+               strncpy(buffer, res->ai_canonname, sizeof(buffer));
                buffer[sizeof(buffer) - 1] = '\0';
                freeaddrinfo(res);
                return buffer;
        }
 
-       strncpy (buffer, site, sizeof(buffer));
+       strncpy(buffer, site, sizeof(buffer));
        return buffer;
 }
index 6105a50..f2126b7 100644 (file)
@@ -10,8 +10,8 @@
 
 
 void
-ambigsw (char *arg, struct swit *swp)
+ambigsw(char *arg, struct swit *swp)
 {
-       advise (NULL, "-%s ambiguous.  It matches", arg);
-       print_sw (arg, swp, "-", stderr);
+       advise(NULL, "-%s ambiguous.  It matches", arg);
+       print_sw(arg, swp, "-", stderr);
 }
index 4496ae6..4e71ab5 100644 (file)
@@ -19,11 +19,11 @@ static int len = 0;             /* current size of "broken"           */
 /*
 ** static prototypes
 */
-static int brkany (char, char *);
+static int brkany(char, char *);
 
 
 char **
-brkstring (char *str, char *brksep, char *brkterm)
+brkstring(char *str, char *brksep, char *brkterm)
 {
        int i;
        char c, *s;
@@ -31,7 +31,7 @@ brkstring (char *str, char *brksep, char *brkterm)
        /* allocate initial space for pointers on first call */
        if (!broken) {
                len = NUMBROKEN;
-               broken = (char **) mh_xmalloc ((size_t) (len * sizeof(*broken)));
+               broken = (char **) mh_xmalloc((size_t) (len * sizeof(*broken)));
        }
 
        /*
@@ -45,17 +45,17 @@ brkstring (char *str, char *brksep, char *brkterm)
        /* enlarge pointer array, if necessary */
        if (i >= len) {
                len += NUMBROKEN;
-               broken = mh_xrealloc (broken, (size_t) (len * sizeof(*broken)));
+               broken = mh_xrealloc(broken, (size_t) (len * sizeof(*broken)));
        }
 
-       while (brkany (c = *s, brksep))
+       while (brkany(c = *s, brksep))
                *s++ = '\0';
 
        /*
        ** we are either at the end of the string, or the
        ** terminator found has been found, so finish up.
        */
-       if (!c || brkany (c, brkterm)) {
+       if (!c || brkany(c, brkterm)) {
                *s = '\0';
                broken[i] = NULL;
                return broken;
@@ -64,7 +64,7 @@ brkstring (char *str, char *brksep, char *brkterm)
        /* set next start addr */
        broken[i] = s;
 
-       while ((c = *++s) && !brkany (c, brksep) && !brkany (c, brkterm))
+       while ((c = *++s) && !brkany(c, brksep) && !brkany(c, brkterm))
                ;    /* empty body */
        }
 
@@ -78,7 +78,7 @@ brkstring (char *str, char *brksep, char *brkterm)
 */
 
 static int
-brkany (char c, char *str)
+brkany(char c, char *str)
 {
        char *s;
 
index cba270d..d11d772 100644 (file)
 ** Get the current character set
 */
 char *
-get_charset ()
+get_charset()
 {
-       char *charset = getenv ("MM_CHARSET");
+       char *charset = getenv("MM_CHARSET");
 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
        if (!charset)
-               charset = norm_charmap(nl_langinfo (CODESET));
+               charset = norm_charmap(nl_langinfo(CODESET));
 #endif
        return charset;
 }
@@ -35,7 +35,7 @@ get_charset ()
 */
 
 int
-check_charset (char *str, int len)
+check_charset(char *str, int len)
 {
        static char *mm_charset = NULL;
        static char *alt_charset = NULL;
@@ -44,15 +44,15 @@ check_charset (char *str, int len)
 
        /* Cache the name of our default character set */
        if (!mm_charset) {
-               if (!(mm_charset = get_charset ()))
+               if (!(mm_charset = get_charset()))
                        mm_charset = "US-ASCII";
-               mm_len = strlen (mm_charset);
+               mm_len = strlen(mm_charset);
 
                /* US-ASCII is a subset of the ISO-8859-X and UTF-8 character sets */
                if (!strncasecmp("ISO-8859-", mm_charset, 9) ||
                        !mh_strcasecmp("UTF-8", mm_charset)) {
                        alt_charset = "US-ASCII";
-                       alt_len = strlen (alt_charset);
+                       alt_len = strlen(alt_charset);
                }
        }
 
@@ -71,7 +71,7 @@ check_charset (char *str, int len)
 ** using for 8bit text.
 */
 char *
-write_charset_8bit (void)
+write_charset_8bit(void)
 {
        static char *mm_charset = NULL;
 
@@ -79,7 +79,7 @@ write_charset_8bit (void)
        ** Cache the name of the character set to
        ** use for 8bit text.
        */
-       if (!mm_charset && !(mm_charset = get_charset ()))
+       if (!mm_charset && !(mm_charset = get_charset()))
                mm_charset = "x-unknown";
 
        return mm_charset;
index 0f87bde..8a4da49 100644 (file)
@@ -15,5 +15,5 @@ closefds(int i)
        int nbits = OPEN_MAX;
 
        for (; i < nbits; i++)
-               close (i);
+               close(i);
 }
index 65ded77..4c3fcff 100644 (file)
 
 
 char *
-concat (char *s1, ...)
+concat(char *s1, ...)
 {
        char *cp, *dp, *sp;
        size_t len;
        va_list list;
 
-       len = strlen (s1) + 1;
+       len = strlen(s1) + 1;
        va_start(list, s1);
        while ((cp = va_arg(list, char *)))
-               len += strlen (cp);
+               len += strlen(cp);
        va_end(list);
 
        dp = sp = mh_xmalloc(len);
@@ -29,7 +29,7 @@ concat (char *s1, ...)
        sp = copy(s1, sp);
 
        va_start(list, s1);
-       while ((cp = va_arg (list, char *)))
+       while ((cp = va_arg(list, char *)))
                sp = copy(cp, sp);
        va_end(list);
 
index 1341424..6eebd7e 100644 (file)
 */
 
 int
-context_del (char *key)
+context_del(char *key)
 {
        register struct node *np, *pp;
 
        for (np = m_defs, pp = NULL; np; pp = np, np = np->n_next) {
-               if (!mh_strcasecmp (np->n_name, key)) {
+               if (!mh_strcasecmp(np->n_name, key)) {
                        if (!np->n_context)
-                               admonish (NULL, "bug: context_del(key=\"%s\")", np->n_name);
+                               admonish(NULL, "bug: context_del(key=\"%s\")", np->n_name);
                        if (pp)
                                pp->n_next = np->n_next;
                        else
                                m_defs = np->n_next;
-                       free (np->n_name);
+                       free(np->n_name);
                        if (np->n_field)
-                               free (np->n_field);
-                       free ((char *) np);
+                               free(np->n_field);
+                       free((char *) np);
                        ctxflags |= CTXMOD;
                        return 0;
                }
index e5ba5ff..64ed8e0 100644 (file)
 
 
 char *
-context_find (char *str)
+context_find(char *str)
 {
        struct node *np;
 
        for (np = m_defs; np; np = np->n_next)
-               if (!mh_strcasecmp (np->n_name, str))
+               if (!mh_strcasecmp(np->n_name, str))
                        return (np->n_field);
 
        return NULL;
index 93b198d..e7d7da8 100644 (file)
@@ -15,7 +15,7 @@
 */
 
 int
-context_foil (char *path)
+context_foil(char *path)
 {
        register struct node *np;
 
@@ -43,23 +43,23 @@ context_foil (char *path)
        ** If path is given, create a minimal profile/context list
        */
        if (path) {
-               m_defs = (struct node *) mh_xmalloc (sizeof(*np));
+               m_defs = (struct node *) mh_xmalloc(sizeof(*np));
 
                np = m_defs;
-               if (!(np->n_name = strdup ("Path"))) {
-                       advise (NULL, "strdup failed");
+               if (!(np->n_name = strdup("Path"))) {
+                       advise(NULL, "strdup failed");
                        return -1;
                }
-               if (!(np->n_field = strdup (path))) {
-                       advise (NULL, "strdup failed");
+               if (!(np->n_field = strdup(path))) {
+                       advise(NULL, "strdup failed");
                        return -1;
                }
                np->n_context = 0;
                np->n_next = NULL;
 
-               if (mypath == NULL && (mypath = getenv ("HOME")) != NULL)
-                       if (!(mypath = strdup (mypath))) {
-                               advise (NULL, "strdup failed");
+               if (mypath == NULL && (mypath = getenv("HOME")) != NULL)
+                       if (!(mypath = strdup(mypath))) {
+                               advise(NULL, "strdup failed");
                                return -1;
                        }
        }
index 1e1a84e..ea7d5da 100644 (file)
@@ -27,7 +27,7 @@
 #include <pwd.h>     /* structure for getpwuid() results */
 
 void
-context_read (void)
+context_read(void)
 {
        char buf[BUFSIZ];            /* path name buffer                 */
        char *cp;                    /* miscellaneous pointer            */
@@ -79,8 +79,8 @@ context_read (void)
                cp = mh_profile;
        }
 
-       readconfig (&m_defs, ib, cp, 0);
-       fclose (ib);
+       readconfig(&m_defs, ib, cp, 0);
+       fclose(ib);
 
        /*
        ** Find the user's nmh directory, which is specified by the "path"
@@ -88,28 +88,28 @@ context_read (void)
        ** one rooted in the home directory.
        */
 
-       if ((cp = context_find ("path")) == (char *)0)
+       if ((cp = context_find("path")) == (char *)0)
                adios(NULL, "Your %s file does not contain a path entry.", defpath);
 
        if (*cp == '\0')
                adios(NULL, "Your `%s' profile file does not contain a valid path entry.", defpath);
 
        if (*cp != '/')
-               (void)snprintf (nd = buf, sizeof(buf), "%s/%s", mypath, cp);
+               (void)snprintf(nd = buf, sizeof(buf), "%s/%s", mypath, cp);
        else
                nd = cp;
 
        if (stat(nd, &st) == -1) {
                if (errno != ENOENT)
-                       adios (nd, "error opening");
-               cp = concat ("Your MH-directory \"", nd, "\" doesn't exist; Create it? ", NULL);
+                       adios(nd, "error opening");
+               cp = concat("Your MH-directory \"", nd, "\" doesn't exist; Create it? ", NULL);
                if (!getanswer(cp))
-                       adios (NULL, "unable to access MH-directory \"%s\"", nd);
-               free (cp);
-               if (!makedir (nd))
-                       adios (NULL, "unable to create %s", nd);
+                       adios(NULL, "unable to access MH-directory \"%s\"", nd);
+               free(cp);
+               if (!makedir(nd))
+                       adios(NULL, "unable to create %s", nd);
        } else if ((st.st_mode & S_IFDIR) == 0)
-               adios ((char *)0, "`%s' is not a directory", nd);
+               adios((char *)0, "`%s' is not a directory", nd);
 
        /*
        ** Open and read user's context file.  The name of the context
@@ -117,7 +117,7 @@ context_read (void)
        ** environment variable.
        */
 
-       if ((cp = getenv ("MHCONTEXT")) == (char *)0 || *cp == '\0')
+       if ((cp = getenv("MHCONTEXT")) == (char *)0 || *cp == '\0')
                cp = context;
 
        /*
@@ -131,11 +131,11 @@ context_read (void)
                return;
        }
 
-       ctxpath = getcpy (m_maildir (cp));
+       ctxpath = getcpy(m_maildir(cp));
 
-       if ((ib = lkfopen (ctxpath, "r"))) {
-               readconfig ((struct node **) 0, ib, cp, 1);
-               lkfclose (ib, ctxpath);
+       if ((ib = lkfopen(ctxpath, "r"))) {
+               readconfig((struct node **) 0, ib, cp, 1);
+               lkfclose(ib, ctxpath);
        }
 
        return;
index bb49a90..6b3aa2f 100644 (file)
@@ -11,7 +11,7 @@
 
 
 void
-context_replace (char *key, char *value)
+context_replace(char *key, char *value)
 {
        register struct node *np;
 
@@ -19,11 +19,11 @@ context_replace (char *key, char *value)
        ** If list is emtpy, allocate head of profile/context list.
        */
        if (!m_defs) {
-               m_defs = (struct node *) mh_xmalloc (sizeof(*np));
+               m_defs = (struct node *) mh_xmalloc(sizeof(*np));
 
                np = m_defs;
-               np->n_name = getcpy (key);
-               np->n_field = getcpy (value);
+               np->n_name = getcpy(key);
+               np->n_field = getcpy(value);
                np->n_context = 1;
                np->n_next = NULL;
                ctxflags |= CTXMOD;
@@ -35,13 +35,13 @@ context_replace (char *key, char *value)
        ** this key, and replace its value if found.
        */
        for (np = m_defs;; np = np->n_next) {
-               if (!mh_strcasecmp (np->n_name, key)) {
-                       if (strcmp (value, np->n_field)) {
+               if (!mh_strcasecmp(np->n_name, key)) {
+                       if (strcmp(value, np->n_field)) {
                                if (!np->n_context)
-                                       admonish (NULL, "bug: context_replace(key=\"%s\",value=\"%s\")", key, value);
+                                       admonish(NULL, "bug: context_replace(key=\"%s\",value=\"%s\")", key, value);
                                if (np->n_field)
-                                       free (np->n_field);
-                               np->n_field = getcpy (value);
+                                       free(np->n_field);
+                               np->n_field = getcpy(value);
                                ctxflags |= CTXMOD;
                        }
                        return;
@@ -53,11 +53,11 @@ context_replace (char *key, char *value)
        /*
        ** Else add this new entry at the end
        */
-       np->n_next = (struct node *) mh_xmalloc (sizeof(*np));
+       np->n_next = (struct node *) mh_xmalloc(sizeof(*np));
 
        np = np->n_next;
-       np->n_name = getcpy (key);
-       np->n_field = getcpy (value);
+       np->n_name = getcpy(key);
+       np->n_field = getcpy(value);
        np->n_context = 1;
        np->n_next = NULL;
        ctxflags |= CTXMOD;
index 7d99cc3..e62aca8 100644 (file)
@@ -16,7 +16,7 @@ static int m_chkids(void);
 
 
 void
-context_save (void)
+context_save(void)
 {
        int action;
        register struct node *np;
@@ -31,28 +31,28 @@ context_save (void)
                return;
        ctxflags &= ~CTXMOD;
 
-       if ((action = m_chkids ()) > 0)
+       if ((action = m_chkids()) > 0)
                return;  /* child did it for us */
 
        /* block a few signals */
-       sigemptyset (&set);
-       sigaddset (&set, SIGHUP);
-       sigaddset (&set, SIGINT);
-       sigaddset (&set, SIGQUIT);
-       sigaddset (&set, SIGTERM);
-       SIGPROCMASK (SIG_BLOCK, &set, &oset);
-
-       if (!(out = lkfopen (ctxpath, "w")))
-               adios (ctxpath, "unable to write");
+       sigemptyset(&set);
+       sigaddset(&set, SIGHUP);
+       sigaddset(&set, SIGINT);
+       sigaddset(&set, SIGQUIT);
+       sigaddset(&set, SIGTERM);
+       SIGPROCMASK(SIG_BLOCK, &set, &oset);
+
+       if (!(out = lkfopen(ctxpath, "w")))
+               adios(ctxpath, "unable to write");
        for (np = m_defs; np; np = np->n_next)
                if (np->n_context)
-                       fprintf (out, "%s: %s\n", np->n_name, np->n_field);
-       lkfclose (out, ctxpath);
+                       fprintf(out, "%s: %s\n", np->n_name, np->n_field);
+       lkfclose(out, ctxpath);
 
-       SIGPROCMASK (SIG_SETMASK, &oset, &set); /* reset the signal mask */
+       SIGPROCMASK(SIG_SETMASK, &oset, &set); /* reset the signal mask */
 
        if (action == 0)
-               _exit (0);    /* we are child, time to die */
+               _exit(0);    /* we are child, time to die */
 }
 
 /*
@@ -66,28 +66,28 @@ context_save (void)
 */
 
 static int
-m_chkids (void)
+m_chkids(void)
 {
        int i;
        pid_t pid;
 
-       if (getuid () == geteuid ())
+       if (getuid() == geteuid())
                return (-1);
 
-       for (i = 0; (pid = fork ()) == -1 && i < 5; i++)
-               sleep (5);
+       for (i = 0; (pid = fork()) == -1 && i < 5; i++)
+               sleep(5);
 
        switch (pid) {
                case -1:
                        break;
 
                case 0:
-                       setgid (getgid ());
-                       setuid (getuid ());
+                       setgid(getgid());
+                       setuid(getuid());
                        break;
 
                default:
-                       pidwait (pid, -1);
+                       pidwait(pid, -1);
                        break;
        }
 
index e4253da..e5ded82 100644 (file)
@@ -10,7 +10,7 @@
 
 
 char **
-copyip (char **p, char **q, int len_q)
+copyip(char **p, char **q, int len_q)
 {
        while (*p && --len_q > 0)
                *q++ = *p++;
index 207bc03..048579e 100644 (file)
@@ -9,7 +9,7 @@
 #include <h/mh.h>
 
 void
-cpydata (int in, int out, char *ifile, char *ofile)
+cpydata(int in, int out, char *ifile, char *ofile)
 {
        int i;
        char buffer[BUFSIZ];
index 04ca76e..86211cf 100644 (file)
 #define S2 1
 
 #define output(c)  if (bp >= dp) {flush(); *bp++ = c;} else *bp++ = c
-#define flush()  if ((j = bp - outbuf) && write (out, outbuf, j) != j) \
-               adios (ofile, "error writing"); \
+#define flush()  if ((j = bp - outbuf) && write(out, outbuf, j) != j) \
+               adios(ofile, "error writing"); \
        else \
                bp = outbuf
 
 
 void
-cpydgst (int in, int out, char *ifile, char *ofile)
+cpydgst(int in, int out, char *ifile, char *ofile)
 {
        register int i, j, state;
        register char *cp, *ep;
@@ -40,20 +40,20 @@ cpydgst (int in, int out, char *ifile, char *ofile)
        char buffer[BUFSIZ], outbuf[BUFSIZ];
 
        dp = (bp = outbuf) + sizeof outbuf;
-       for (state = S1; (i = read (in, buffer, sizeof buffer)) > 0;)
+       for (state = S1; (i = read(in, buffer, sizeof buffer)) > 0;)
                for (ep = (cp = buffer) + i; cp < ep; cp++) {
                        if (*cp == '\0')
                                continue;
                        switch (state) {
                                case S1:
                                        if (*cp == '-') {
-                                               output ('-');
-                                               output (' ');
+                                               output('-');
+                                               output(' ');
                                        }
                                        state = S2;  /* fall */
 
                                case S2:
-                                       output (*cp);
+                                       output(*cp);
                                        if (*cp == '\n')
                                                state = S1;
                                        break;
@@ -61,6 +61,6 @@ cpydgst (int in, int out, char *ifile, char *ofile)
                }
 
        if (i == -1)
-               adios (ifile, "error reading");
+               adios(ifile, "error reading");
        flush();
 }
index 2691a78..0693a21 100644 (file)
@@ -27,19 +27,19 @@ struct crawl_context {
 */
 
 static void
-add_folder (char *fold, struct crawl_context *crawl)
+add_folder(char *fold, struct crawl_context *crawl)
 {
        register int i, j;
 
        /* if necessary, reallocate the space for folder names */
        if (crawl->foldp >= crawl->max) {
                crawl->max += CRAWL_NUMFOLDERS;
-               crawl->folders = mh_xrealloc (crawl->folders,
+               crawl->folders = mh_xrealloc(crawl->folders,
                        crawl->max * sizeof(char *));
        }
 
        for (i = crawl->start; i < crawl->foldp; i++)
-               if (strcmp (fold, crawl->folders[i]) < 0) {
+               if (strcmp(fold, crawl->folders[i]) < 0) {
                        for (j = crawl->foldp - 1; j >= i; j--)
                                crawl->folders[j + 1] = crawl->folders[j];
                        crawl->foldp++;
@@ -52,7 +52,7 @@ add_folder (char *fold, struct crawl_context *crawl)
 }
 
 static void
-add_children (char *name, struct crawl_context *crawl)
+add_children(char *name, struct crawl_context *crawl)
 {
        char *prefix, *child;
        struct stat st;
@@ -60,18 +60,18 @@ add_children (char *name, struct crawl_context *crawl)
        DIR * dd;
        int child_is_folder;
 
-       if (!(dd = opendir (name))) {
-               admonish (name, "unable to read directory ");
+       if (!(dd = opendir(name))) {
+               admonish(name, "unable to read directory ");
                return;
        }
 
-       if (strcmp (name, ".") == 0) {
-               prefix = getcpy ("");
+       if (strcmp(name, ".") == 0) {
+               prefix = getcpy("");
        } else {
-               prefix = concat (name, "/", (void *)NULL);
+               prefix = concat(name, "/", (void *)NULL);
        }
 
-       while ((dp = readdir (dd))) {
+       while ((dp = readdir(dd))) {
                /*
                ** If the system supports it, try to skip processing of
                ** children we know are not directories or symlinks.
@@ -84,31 +84,31 @@ add_children (char *name, struct crawl_context *crawl)
                        continue;
                }
 #endif
-               if (!strcmp (dp->d_name, ".") || !strcmp (dp->d_name, "..")) {
+               if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) {
                        continue;
                }
-               child = concat (prefix, dp->d_name, (void *)NULL);
+               child = concat(prefix, dp->d_name, (void *)NULL);
                /*
                ** If we have no d_type or d_type is DT_LNK or DT_UNKNOWN,
                ** stat the child to see what it is.
                */
                if (child_is_folder == -1) {
-                       child_is_folder = (stat (child, &st) != -1 && S_ISDIR(st.st_mode));
+                       child_is_folder = (stat(child, &st) != -1 && S_ISDIR(st.st_mode));
                }
                if (child_is_folder) {
                        /* add_folder saves child in the list, don't free it */
-                       add_folder (child, crawl);
+                       add_folder(child, crawl);
                } else {
-                       free (child);
+                       free(child);
                }
        }
 
-       closedir (dd);
+       closedir(dd);
        free(prefix);
 }
 
 static void
-crawl_folders_body (struct crawl_context *crawl, char *dir,
+crawl_folders_body(struct crawl_context *crawl, char *dir,
        crawl_callback_t *callback, void *baton)
 {
        int i;
@@ -117,18 +117,18 @@ crawl_folders_body (struct crawl_context *crawl, char *dir,
 
        crawl->start = crawl->foldp;
 
-       add_children (dir, crawl);
+       add_children(dir, crawl);
 
        for (i = crawl->start; i < crawl->foldp; i++) {
                char *fold = crawl->folders[i];
                int crawl_children = 1;
 
                if (callback != NULL) {
-                       crawl_children = callback (fold, baton);
+                       crawl_children = callback(fold, baton);
                }
 
                if (crawl_children) {
-                       crawl_folders_body (crawl, fold, callback, baton);
+                       crawl_folders_body(crawl, fold, callback, baton);
                }
        }
 
@@ -137,19 +137,19 @@ crawl_folders_body (struct crawl_context *crawl, char *dir,
 }
 
 void
-crawl_folders (char *dir, crawl_callback_t *callback, void *baton)
+crawl_folders(char *dir, crawl_callback_t *callback, void *baton)
 {
-       struct crawl_context *crawl = mh_xmalloc (sizeof(*crawl));
+       struct crawl_context *crawl = mh_xmalloc(sizeof(*crawl));
        crawl->max = CRAWL_NUMFOLDERS;
        crawl->total = crawl->start = crawl->foldp = 0;
-       crawl->folders = mh_xmalloc (crawl->max * sizeof(*crawl->folders));
+       crawl->folders = mh_xmalloc(crawl->max * sizeof(*crawl->folders));
 
-       crawl_folders_body (crawl, dir, callback, baton);
+       crawl_folders_body(crawl, dir, callback, baton);
 
        /*
        ** Note that we "leak" the folder names, on the assumption that the
        ** caller is using them.
        */
-       free (crawl->folders);
-       free (crawl);
+       free(crawl->folders);
+       free(crawl);
 }
index eb7e7c8..03eaa10 100644 (file)
@@ -27,7 +27,7 @@
 
 
 void
-discard (FILE *io)
+discard(FILE *io)
 {
 #ifndef HAVE_TERMIOS_H
 # ifdef HAVE_TERMIO_H
@@ -41,19 +41,19 @@ discard (FILE *io)
                return;
 
 #ifdef HAVE_TERMIOS_H
-       tcflush (fileno(io), TCOFLUSH);
+       tcflush(fileno(io), TCOFLUSH);
 #else
 # ifdef HAVE_TERMIO_H
-       if (ioctl (fileno(io), TCGETA, &tio) != -1)
-               ioctl (fileno(io), TCSETA, &tio);
+       if (ioctl(fileno(io), TCGETA, &tio) != -1)
+               ioctl(fileno(io), TCSETA, &tio);
 # else
-       if (ioctl (fileno(io), TIOCGETP, (char *) &tio) != -1)
-               ioctl (fileno(io), TIOCSETP, (char *) &tio);
+       if (ioctl(fileno(io), TIOCGETP, (char *) &tio) != -1)
+               ioctl(fileno(io), TIOCSETP, (char *) &tio);
 # endif
 #endif
 
 #if defined(_FSTDIO) || defined(__DragonFly__)
-       fpurge (io);
+       fpurge(io);
 #else
 # ifdef LINUX_STDIO
        io->_IO_write_ptr = io->_IO_write_base;
index 60ab9d7..737f998 100644 (file)
@@ -118,12 +118,12 @@ static int dmsize[] = {
 */
 
 struct tws *
-dlocaltimenow (void)
+dlocaltimenow(void)
 {
        time_t clock;
 
-       time (&clock);
-       return dlocaltime (&clock);
+       time(&clock);
+       return dlocaltime(&clock);
 }
 
 
@@ -134,7 +134,7 @@ dlocaltimenow (void)
 */
 
 struct tws *
-dlocaltime (time_t *clock)
+dlocaltime(time_t *clock)
 {
        static struct tws tw;
        struct tm *tm;
@@ -146,7 +146,7 @@ dlocaltime (time_t *clock)
        if (!clock)
                return NULL;
 
-       tm = localtime (clock);
+       tm = localtime(clock);
 
        tw.tw_sec  = tm->tm_sec;
        tw.tw_min  = tm->tm_min;
@@ -175,7 +175,7 @@ dlocaltime (time_t *clock)
        tzset();
        tw.tw_zone = -(timezone / 60);
 # else
-       ftime (&tb);
+       ftime(&tb);
        tw.tw_zone = -tb.timezone;
 # endif
 #endif
@@ -198,7 +198,7 @@ dlocaltime (time_t *clock)
 */
 
 struct tws *
-dgmtime (time_t *clock)
+dgmtime(time_t *clock)
 {
        static struct tws tw;
        struct tm *tm;
@@ -206,7 +206,7 @@ dgmtime (time_t *clock)
        if (!clock)
                return NULL;
 
-       tm = gmtime (clock);
+       tm = gmtime(clock);
 
        tw.tw_sec  = tm->tm_sec;
        tw.tw_min  = tm->tm_min;
@@ -247,14 +247,14 @@ dgmtime (time_t *clock)
 */
 
 char *
-dctime (struct tws *tw)
+dctime(struct tws *tw)
 {
        static char buffer[26];
 
        if (!tw)
                return NULL;
 
-       snprintf (buffer, sizeof(buffer), "%.3s %.3s %02d %02d:%02d:%02d %.4d\n",
+       snprintf(buffer, sizeof(buffer), "%.3s %.3s %02d %02d:%02d:%02d %.4d\n",
                tw_dotw[tw->tw_wday], tw_moty[tw->tw_mon], tw->tw_mday,
                tw->tw_hour, tw->tw_min, tw->tw_sec,
                tw->tw_year < 100 ? tw->tw_year + 1900 : tw->tw_year);
@@ -274,12 +274,12 @@ dctime (struct tws *tw)
 */
 
 char *
-dtimenow (int alpha_timezone)
+dtimenow(int alpha_timezone)
 {
        time_t clock;
 
-       time (&clock);
-       return dtime (&clock, alpha_timezone);
+       time(&clock);
+       return dtime(&clock, alpha_timezone);
 }
 
 
@@ -295,14 +295,14 @@ dtimenow (int alpha_timezone)
 */
 
 char *
-dtime (time_t *clock, int alpha_timezone)
+dtime(time_t *clock, int alpha_timezone)
 {
        if (alpha_timezone)
                /* use alpha-numeric timezones */
-               return dasctime (dlocaltime (clock), TW_NULL);
+               return dasctime(dlocaltime(clock), TW_NULL);
        else
                /* use numeric timezones */
-               return dasctime (dlocaltime (clock), TW_ZONE);
+               return dasctime(dlocaltime(clock), TW_ZONE);
 }
 
 
@@ -316,7 +316,7 @@ dtime (time_t *clock, int alpha_timezone)
 */
 
 char *
-dasctime (struct tws *tw, int flags)
+dasctime(struct tws *tw, int flags)
 {
        char buffer[80];
        static char result[80];
@@ -336,12 +336,12 @@ dasctime (struct tws *tw, int flags)
                tw->tw_hour, tw->tw_min, tw->tw_sec, result);
 
        if ((tw->tw_flags & TW_SDAY) == TW_SEXP)
-               snprintf (result, sizeof(result), "%s, %s", tw_dotw[tw->tw_wday], buffer);
+               snprintf(result, sizeof(result), "%s, %s", tw_dotw[tw->tw_wday], buffer);
        else
                if ((tw->tw_flags & TW_SDAY) == TW_SNIL)
-                       strncpy (result, buffer, sizeof(result));
+                       strncpy(result, buffer, sizeof(result));
                else
-                       snprintf (result, sizeof(result), "%s (%s)", buffer, tw_dotw[tw->tw_wday]);
+                       snprintf(result, sizeof(result), "%s (%s)", buffer, tw_dotw[tw->tw_wday]);
 
        return result;
 }
@@ -352,7 +352,7 @@ dasctime (struct tws *tw, int flags)
 */
 
 char *
-dtimezone (int offset, int flags)
+dtimezone(int offset, int flags)
 {
        int hours, mins;
        struct zone *z;
@@ -381,8 +381,8 @@ dtimezone (int offset, int flags)
        if (flags & TW_DST)
                hours += 1;
 #endif /* ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST */
-       snprintf (buffer, sizeof(buffer), "%s%02d%02d",
-               offset < 0 ? "-" : "+", abs (hours), abs (mins));
+       snprintf(buffer, sizeof(buffer), "%s%02d%02d",
+               offset < 0 ? "-" : "+", abs(hours), abs(mins));
        return buffer;
 }
 
@@ -395,7 +395,7 @@ dtimezone (int offset, int flags)
 */
 
 time_t
-dmktime (struct tws *tw)
+dmktime(struct tws *tw)
 {
        int i, sec, min, hour, mday, mon, year;
        time_t result;
@@ -420,8 +420,8 @@ dmktime (struct tws *tw)
                year += 100;
 
        for (i = 1970; i < year; i++)
-               result += dysize (i);
-       if (dysize (year) == 366 && mon >= 3)
+               result += dysize(i);
+       if (dysize(year) == 366 && mon >= 3)
                result++;
        while (--mon)
                result += dmsize[mon - 1];
@@ -444,7 +444,7 @@ dmktime (struct tws *tw)
 */
 
 void
-set_dotw (struct tws *tw)
+set_dotw(struct tws *tw)
 {
        int month, day, year, century;
 
@@ -475,7 +475,7 @@ set_dotw (struct tws *tw)
 */
 
 void
-twscopy (struct tws *tb, struct tws *tw)
+twscopy(struct tws *tb, struct tws *tw)
 {
        *tb = *tw;  /* struct copy */
 
@@ -500,14 +500,14 @@ twscopy (struct tws *tb, struct tws *tw)
 */
 
 int
-twsort (struct tws *tw1, struct tws *tw2)
+twsort(struct tws *tw1, struct tws *tw2)
 {
        time_t c1, c2;
 
        if (tw1->tw_clock == 0)
-               dmktime (tw1);
+               dmktime(tw1);
        if (tw2->tw_clock == 0)
-               dmktime (tw2);
+               dmktime(tw2);
 
        return ((c1 = tw1->tw_clock) > (c2 = tw2->tw_clock) ? 1
                : c1 == c2 ? 0 : -1);
index 42511c9..7db8d18 100644 (file)
 ** print out error message
 */
 void
-advise (char *what, char *fmt, ...)
+advise(char *what, char *fmt, ...)
 {
        va_list ap;
 
        va_start(ap, fmt);
-       advertise (what, NULL, fmt, ap);
+       advertise(what, NULL, fmt, ap);
        va_end(ap);
 }
 
@@ -34,14 +34,14 @@ advise (char *what, char *fmt, ...)
 ** print out error message and exit
 */
 void
-adios (char *what, char *fmt, ...)
+adios(char *what, char *fmt, ...)
 {
        va_list ap;
 
        va_start(ap, fmt);
-       advertise (what, NULL, fmt, ap);
+       advertise(what, NULL, fmt, ap);
        va_end(ap);
-       done (1);
+       done(1);
 }
 
 
@@ -49,12 +49,12 @@ adios (char *what, char *fmt, ...)
 ** admonish the user
 */
 void
-admonish (char *what, char *fmt, ...)
+admonish(char *what, char *fmt, ...)
 {
        va_list ap;
 
        va_start(ap, fmt);
-       advertise (what, "continuing...", fmt, ap);
+       advertise(what, "continuing...", fmt, ap);
        va_end(ap);
 }
 
@@ -68,7 +68,7 @@ admonish (char *what, char *fmt, ...)
 ** sexy syscall()...
 */
 void
-advertise (char *what, char *tail, char *fmt, va_list ap)
+advertise(char *what, char *tail, char *fmt, va_list ap)
 {
        int  eindex = errno;
 
@@ -77,65 +77,65 @@ advertise (char *what, char *tail, char *fmt, va_list ap)
        struct iovec iob[20], *iov;
 #endif
 
-       fflush (stdout);
+       fflush(stdout);
 
 #ifdef HAVE_WRITEV
-       fflush (stderr);
+       fflush(stderr);
        iov = iob;
 
        if (invo_name && *invo_name) {
-               iov->iov_len = strlen (iov->iov_base = invo_name);
+               iov->iov_len = strlen(iov->iov_base = invo_name);
                iov++;
-               iov->iov_len = strlen (iov->iov_base = ": ");
+               iov->iov_len = strlen(iov->iov_base = ": ");
                iov++;
        }
 
-       vsnprintf (buffer, sizeof(buffer), fmt, ap);
-       iov->iov_len = strlen (iov->iov_base = buffer);
+       vsnprintf(buffer, sizeof(buffer), fmt, ap);
+       iov->iov_len = strlen(iov->iov_base = buffer);
        iov++;
        if (what) {
                if (*what) {
-                       iov->iov_len = strlen (iov->iov_base = " ");
+                       iov->iov_len = strlen(iov->iov_base = " ");
                        iov++;
-                       iov->iov_len = strlen (iov->iov_base = what);
+                       iov->iov_len = strlen(iov->iov_base = what);
                        iov++;
-                       iov->iov_len = strlen (iov->iov_base = ": ");
+                       iov->iov_len = strlen(iov->iov_base = ": ");
                        iov++;
                }
-               if (!(iov->iov_base = strerror (eindex))) {
+               if (!(iov->iov_base = strerror(eindex))) {
                        /* this shouldn't happen, but we'll test for it just in case */
-                       snprintf (err, sizeof(err), "Error %d", eindex);
+                       snprintf(err, sizeof(err), "Error %d", eindex);
                        iov->iov_base = err;
                }
-               iov->iov_len = strlen (iov->iov_base);
+               iov->iov_len = strlen(iov->iov_base);
                iov++;
        }
        if (tail && *tail) {
-               iov->iov_len = strlen (iov->iov_base = ", ");
+               iov->iov_len = strlen(iov->iov_base = ", ");
                iov++;
-               iov->iov_len = strlen (iov->iov_base = tail);
+               iov->iov_len = strlen(iov->iov_base = tail);
                iov++;
        }
-       iov->iov_len = strlen (iov->iov_base = "\n");
+       iov->iov_len = strlen(iov->iov_base = "\n");
        iov++;
-       writev (fileno (stderr), iob, iov - iob);
+       writev(fileno(stderr), iob, iov - iob);
 #else
        if (invo_name && *invo_name)
-               fprintf (stderr, "%s: ", invo_name);
-       vfprintf (stderr, fmt, ap);
+               fprintf(stderr, "%s: ", invo_name);
+       vfprintf(stderr, fmt, ap);
 
        if (what) {
                char *s;
 
                if (*what)
-                       fprintf (stderr, " %s: ", what);
+                       fprintf(stderr, " %s: ", what);
                if ((s = strerror(eindex)))
-                       fprintf (stderr, "%s", s);
+                       fprintf(stderr, "%s", s);
                else
-                       fprintf (stderr, "Error %d", eindex);
+                       fprintf(stderr, "Error %d", eindex);
        }
        if (tail)
-               fprintf (stderr, ", %s", tail);
-       fputc ('\n', stderr);
+               fprintf(stderr, ", %s", tail);
+       fputc('\n', stderr);
 #endif
 }
index 769c525..937d196 100644 (file)
 
 
 int
-fdcompare (int fd1, int fd2)
+fdcompare(int fd1, int fd2)
 {
        register int i, n1, n2, resp;
        register char *c1, *c2;
        char b1[BUFSIZ], b2[BUFSIZ];
 
        resp = 1;
-       while ((n1 = read (fd1, b1, sizeof(b1))) >= 0
-               && (n2 = read (fd2, b2, sizeof(b2))) >= 0
+       while ((n1 = read(fd1, b1, sizeof(b1))) >= 0
+               && (n2 = read(fd2, b2, sizeof(b2))) >= 0
                && n1 == n2) {
                c1 = b1;
                c2 = b2;
@@ -33,7 +33,7 @@ fdcompare (int fd1, int fd2)
        resp = 0;
 
 leave: ;
-       lseek (fd1, (off_t) 0, SEEK_SET);
-       lseek (fd2, (off_t) 0, SEEK_SET);
+       lseek(fd1, (off_t) 0, SEEK_SET);
+       lseek(fd2, (off_t) 0, SEEK_SET);
        return resp;
 }
index a2338e3..d6218b5 100644 (file)
@@ -22,11 +22,11 @@ static unsigned int bufsiz;  /* current size of buf         */
 
 /* check if there's enough room in buf for str.  add more mem if needed */
 #define CHECKMEM(str) \
-       if ((len = strlen (str)) >= bufend - dst) {\
+       if ((len = strlen(str)) >= bufend - dst) {\
                int i = dst - buf;\
                int n = last_dst - buf;\
                bufsiz += ((dst + len - bufend) / BUFINCR + 1) * BUFINCR;\
-               buf = mh_xrealloc (buf, bufsiz);\
+               buf = mh_xrealloc(buf, bufsiz);\
                dst = buf + i;\
                last_dst = buf + n;\
                bufend = buf + bufsiz;\
@@ -49,7 +49,7 @@ static unsigned int bufsiz;  /* current size of buf         */
 */
 
 char *
-formataddr (char *orig, char *str)
+formataddr(char *orig, char *str)
 {
        register int len;
        register int isgroup;
@@ -60,7 +60,7 @@ formataddr (char *orig, char *str)
 
        /* if we don't have a buffer yet, get one */
        if (bufsiz == 0) {
-               buf = mh_xmalloc (BUFINCR);
+               buf = mh_xmalloc(BUFINCR);
                last_dst = buf;  /* XXX */
                bufsiz = BUFINCR - 6;  /* leave some slop */
                bufend = buf + bufsiz;
@@ -76,13 +76,13 @@ formataddr (char *orig, char *str)
                *dst = '\0';
        } else {
                dst = last_dst;  /* XXX */
-               CHECKMEM (orig);
-               CPY (orig);
+               CHECKMEM(orig);
+               CPY(orig);
        }
 
        /* concatenate all the new addresses onto 'buf' */
-       for (isgroup = 0; (cp = getname (str)); ) {
-               if ((mp = getm (cp, NULL, 0, fmt_norm, NULL)) == NULL)
+       for (isgroup = 0; (cp = getname(str)); ) {
+               if ((mp = getm(cp, NULL, 0, fmt_norm, NULL)) == NULL)
                        continue;
 
                if (isgroup && (mp->m_gname || !mp->m_ingrp)) {
@@ -95,14 +95,14 @@ formataddr (char *orig, char *str)
                        *dst++ = ' ';
                }
                if (mp->m_gname) {
-                       CHECKMEM (mp->m_gname);
-                       CPY (mp->m_gname);
+                       CHECKMEM(mp->m_gname);
+                       CPY(mp->m_gname);
                        isgroup++;
                }
-               sp = adrformat (mp);
-               CHECKMEM (sp);
-               CPY (sp);
-               mnfree (mp);
+               sp = adrformat(mp);
+               CHECKMEM(sp);
+               CPY(sp);
+               mnfree(mp);
        }
 
        if (isgroup)
index 9d8f41d..bcd7b3d 100644 (file)
@@ -189,7 +189,7 @@ static struct ftable functable[] = {
 static char *format_string;
 static unsigned char *usr_fstring;  /* for CERROR */
 
-#define CERROR(str) compile_error (str, cp)
+#define CERROR(str) compile_error(str, cp)
 
 /*
 ** external prototypes
@@ -201,11 +201,11 @@ extern char *getusername(void);
 */
 static struct ftable *lookup(char *);
 static void compile_error(char *, char *);
-static char *compile (char *);
+static char *compile(char *);
 static char *do_spec(char *);
 static char *do_name(char *, int);
 static char *do_func(char *);
-static char *do_expr (char *, int);
+static char *do_expr(char *, int);
 static char *do_loop(char *);
 static char *do_if(char *);
 
@@ -218,7 +218,7 @@ lookup(char *name)
        register char c = *name;
 
        while ((nm = t->name)) {
-               if (*nm == c && strcmp (nm, name) == 0)
+               if (*nm == c && strcmp(nm, name) == 0)
                        return (ftbl = t);
 
                t++;
@@ -247,7 +247,7 @@ compile_error(char *str, char *cp)
 
        advise(NULL, "\"%s\": format compile error - %s",
                   &usr_fstring[errpos-errctx], str);
-       adios (NULL, "%*s", errctx+1, "^");
+       adios(NULL, "%*s", errctx+1, "^");
 }
 
 /*
@@ -263,8 +263,8 @@ fmt_compile(char *fstring, struct format **fmt)
        int i;
 
        if (format_string)
-               free (format_string);
-       format_string = getcpy (fstring);
+               free(format_string);
+       format_string = getcpy(fstring);
        usr_fstring = fstring;
 
        /* init the component hash table. */
@@ -283,10 +283,10 @@ fmt_compile(char *fstring, struct format **fmt)
        i = strlen(fstring)/2 + 1;
        if (i == 1)
                i++;
-       next_fp = formatvec = (struct format *)calloc ((size_t) i,
+       next_fp = formatvec = (struct format *)calloc((size_t) i,
                sizeof(struct format));
        if (next_fp == NULL)
-               adios (NULL, "unable to allocate format storage");
+               adios(NULL, "unable to allocate format storage");
 
        ncomp = 0;
        infunction = 0;
@@ -302,7 +302,7 @@ fmt_compile(char *fstring, struct format **fmt)
 }
 
 static char *
-compile (char *sp)
+compile(char *sp)
 {
        register char *cp = sp;
        register int  c;
@@ -327,7 +327,7 @@ compile (char *sp)
 
                switch (c = *++cp) {
                case '%':
-                       PUTC (*cp);
+                       PUTC(*cp);
                        cp++;
                        break;
 
@@ -437,7 +437,7 @@ do_name(char *sp, int preprocess)
 
        case FT_MYMBOX:
                if (!primed) {
-                       ismymbox ((struct mailname *) 0);
+                       ismymbox((struct mailname *) 0);
                        primed++;
                }
                /* fall through */
@@ -478,7 +478,7 @@ do_func(char *sp)
                CERROR("'(', '{', ' ' or ')' expected");
        }
        cp[-1] = '\0';
-       if ((t = lookup (sp)) == 0) {
+       if ((t = lookup(sp)) == 0) {
                CERROR("unknown function");
        }
        if (isspace(c))
@@ -554,22 +554,22 @@ do_func(char *sp)
 }
 
 static char *
-do_expr (char *sp, int preprocess)
+do_expr(char *sp, int preprocess)
 {
        register char *cp = sp;
        register int  c;
 
        if ((c = *cp++) == '{') {
-               cp = do_name (cp, preprocess);
+               cp = do_name(cp, preprocess);
                fp->f_type = FT_LS_COMP;
        } else if (c == '(') {
-               cp = do_func (cp);
+               cp = do_func(cp);
        } else if (c == ')') {
                return (--cp);
        } else if (c == '%' && *cp == '<') {
-               cp = do_if (cp+1);
+               cp = do_if(cp+1);
        } else {
-               CERROR ("'(', '{', '%<' or ')' expected");
+               CERROR("'(', '{', '%<' or ')' expected");
        }
        return (cp);
 }
@@ -581,9 +581,9 @@ do_loop(char *sp)
        struct format *floop;
 
        floop = next_fp;
-       cp = compile (cp);
+       cp = compile(cp);
        if (*cp++ != ']')
-               CERROR ("']' expected");
+               CERROR("']' expected");
 
        LV(FT_DONE, 1);  /* not yet done */
        LV(FT_GOTO, 0);
@@ -604,7 +604,7 @@ do_if(char *sp)
                        if ((c = *cp++) == '{') /*}*/{
                                cp = do_name(cp, 0);
                                fp->f_type = FT_LS_COMP;
-                               LV (FT_IF_S, 0);
+                               LV(FT_IF_S, 0);
                        } else if (c == '(') {
                                cp = do_func(cp);
                                /* see if we can merge the load and the "if" */
@@ -617,9 +617,9 @@ do_if(char *sp)
                                        ** function 's return type is.
                                        */
                                        if (ftbl->flags & TFL_PUTS) {
-                                               LV (FT_IF_S, 0);
+                                               LV(FT_IF_S, 0);
                                        } else {
-                                               LV (FT_IF_V_NE, 0);
+                                               LV(FT_IF_V_NE, 0);
                                        }
                                }
                        } else {
@@ -628,7 +628,7 @@ do_if(char *sp)
                }
 
                fexpr = fp;  /* loc of [ELS]IF */
-               cp = compile (cp);  /* compile IF TRUE stmts */
+               cp = compile(cp);  /* compile IF TRUE stmts */
                if (fif)
                        fif->f_skip = next_fp - fif;
 
@@ -639,7 +639,7 @@ do_if(char *sp)
 
                        fexpr = (struct format *)NULL;/* no extra ENDIF */
 
-                       cp = compile (cp);  /* compile ELSE stmts */
+                       cp = compile(cp);  /* compile ELSE stmts */
                        fif->f_skip = next_fp - fif;
                        c = *cp++;
                } else if (c == '?') {  /* another ELSIF */
index 7576ae4..4e56378 100644 (file)
@@ -16,7 +16,7 @@ static char *formats = 0;
 /*
 ** static prototypes
 */
-static void normalize (char *);
+static void normalize(char *);
 
 
 /*
@@ -24,34 +24,34 @@ static void normalize (char *);
 */
 
 char *
-new_fs (char *form, char *format, char *default_fs)
+new_fs(char *form, char *format, char *default_fs)
 {
        struct stat st;
        register FILE *fp;
 
        if (formats)
-               free (formats);
+               free(formats);
 
        if (form) {
-               if ((fp = fopen (etcpath (form), "r")) == NULL)
-                       adios (form, "unable to open format file");
+               if ((fp = fopen(etcpath(form), "r")) == NULL)
+                       adios(form, "unable to open format file");
 
-               if (fstat (fileno (fp), &st) == -1)
-                       adios (form, "unable to stat format file");
+               if (fstat(fileno(fp), &st) == -1)
+                       adios(form, "unable to stat format file");
 
-               formats = mh_xmalloc ((size_t) st.st_size + 1);
+               formats = mh_xmalloc((size_t) st.st_size + 1);
 
-               if (read (fileno(fp), formats, (int) st.st_size) != st.st_size)
-                       adios (form, "error reading format file");
+               if (read(fileno(fp), formats, (int) st.st_size) != st.st_size)
+                       adios(form, "error reading format file");
 
                formats[st.st_size] = '\0';
 
-               fclose (fp);
+               fclose(fp);
        } else {
-               formats = getcpy (format ? format : default_fs);
+               formats = getcpy(format ? format : default_fs);
        }
 
-       normalize (formats);  /* expand escapes */
+       normalize(formats);  /* expand escapes */
 
        return formats;
 }
@@ -62,7 +62,7 @@ new_fs (char *form, char *format, char *default_fs)
 */
 
 static void
-normalize (char *cp)
+normalize(char *cp)
 {
        char *dp;
 
index 5bc7850..dc123e5 100644 (file)
@@ -38,7 +38,7 @@ static signed char index_64[128] = {
 #define char64(c) (((unsigned char) (c) > 127) ? -1 : index_64[(unsigned char) (c)])
 
 static int
-unqp (unsigned char byte1, unsigned char byte2)
+unqp(unsigned char byte1, unsigned char byte2)
 {
        if (hexindex[byte1] == -1 || hexindex[byte2] == -1)
                return -1;
@@ -57,7 +57,7 @@ unqp (unsigned char byte1, unsigned char byte2)
 #define ADDCHR(C) do { *q++ = (C); dstlen--; if (!dstlen) goto buffull; } while (0)
 
 int
-decode_rfc2047 (char *str, char *dst, size_t dstlen)
+decode_rfc2047(char *str, char *dst, size_t dstlen)
 {
        char *p, *q, *pp;
        char *startofmime, *endofmime;
@@ -81,7 +81,7 @@ decode_rfc2047 (char *str, char *dst, size_t dstlen)
        ** Do a quick and dirty check for the '=' character.
        ** This should quickly eliminate many cases.
        */
-       if (!strchr (str, '='))
+       if (!strchr(str, '='))
                return 0;
 
        for (p = str, q = dst; *p; p++) {
@@ -222,7 +222,7 @@ decode_rfc2047 (char *str, char *dst, size_t dstlen)
                        if (quoted_printable) {
                                for (pp = startofmime; pp < endofmime; pp++) {
                                        if (*pp == '=') {
-                                               c = unqp (pp[1], pp[2]);
+                                               c = unqp(pp[1], pp[2]);
                                                if (c == -1)
                                                        continue;
                                                if (c != 0)
@@ -302,7 +302,7 @@ decode_rfc2047 (char *str, char *dst, size_t dstlen)
                                                ** which won't work if either
                                                ** encoding was stateful
                                                */
-                                               iconv (cd, 0, 0, &saveq, &savedstlen);
+                                               iconv(cd, 0, 0, &saveq, &savedstlen);
                                                if (!savedstlen)
                                                        break;
                                                *saveq++ = '?';
index 8a8e4c1..ac98883 100644 (file)
@@ -29,7 +29,7 @@
 
 #define NFMTS MAXARGS
 
-extern char *formataddr ();  /* hook for custom address formatting */
+extern char *formataddr();  /* hook for custom address formatting */
 
 #ifdef LBL
 struct msgs *fmt_current_folder; /* current folder (set by main program) */
@@ -41,9 +41,9 @@ struct mailname fmt_mnull;
 /*
 ** static prototypes
 */
-static int match (char *, char *);
-static char *get_x400_friendly (char *, char *, int);
-static int get_x400_comp (char *, char *, char *, int);
+static int match(char *, char *);
+static char *get_x400_friendly(char *, char *, int);
+static int get_x400_comp(char *, char *, char *, int);
 
 
 /*
@@ -52,7 +52,7 @@ static int get_x400_comp (char *, char *, char *, int);
 */
 
 static int
-match (char *str, char *sub)
+match(char *str, char *sub)
 {
        int c1, c2;
        char *s1, *s2;
@@ -208,7 +208,7 @@ cptrimmed(char **dest, char *str, unsigned int wid, char fill, size_t n) {
 }
 
 static void
-cpstripped (char **start, char *end, char *str)
+cpstripped(char **start, char *end, char *str)
 {
        int c;
        char *s = str;
@@ -248,7 +248,7 @@ static char *lmonth[] = {
 };
 
 static char *
-get_x400_friendly (char *mbox, char *buffer, int buffer_len)
+get_x400_friendly(char *mbox, char *buffer, int buffer_len)
 {
        char given[BUFSIZ], surname[BUFSIZ];
 
@@ -259,40 +259,40 @@ get_x400_friendly (char *mbox, char *buffer, int buffer_len)
        if (*mbox != '/')
                return NULL;
 
-       if (get_x400_comp (mbox, "/PN=", buffer, buffer_len)) {
+       if (get_x400_comp(mbox, "/PN=", buffer, buffer_len)) {
                for (mbox = buffer; (mbox = strchr(mbox, '.')); )
                        *mbox++ = ' ';
 
                return buffer;
        }
 
-       if (!get_x400_comp (mbox, "/S=", surname, sizeof(surname)))
+       if (!get_x400_comp(mbox, "/S=", surname, sizeof(surname)))
                return NULL;
 
-       if (get_x400_comp (mbox, "/G=", given, sizeof(given)))
-               snprintf (buffer, buffer_len, "%s %s", given, surname);
+       if (get_x400_comp(mbox, "/G=", given, sizeof(given)))
+               snprintf(buffer, buffer_len, "%s %s", given, surname);
        else
-               snprintf (buffer, buffer_len, "%s", surname);
+               snprintf(buffer, buffer_len, "%s", surname);
 
        return buffer;
 }
 
 static int
-get_x400_comp (char *mbox, char *key, char *buffer, int buffer_len)
+get_x400_comp(char *mbox, char *key, char *buffer, int buffer_len)
 {
        int idx;
        char *cp;
 
-       if ((idx = stringdex (key, mbox)) < 0
-               || !(cp = strchr(mbox += idx + strlen (key), '/')))
+       if ((idx = stringdex(key, mbox)) < 0
+               || !(cp = strchr(mbox += idx + strlen(key), '/')))
                return 0;
 
-       snprintf (buffer, buffer_len, "%*.*s", (int)(cp - mbox), (int)(cp - mbox), mbox);
+       snprintf(buffer, buffer_len, "%*.*s", (int)(cp - mbox), (int)(cp - mbox), mbox);
        return 1;
 }
 
 struct format *
-fmt_scan (struct format *format, char *scanl, int width, int *dat)
+fmt_scan(struct format *format, char *scanl, int width, int *dat)
 {
        char *cp, *ep;
        unsigned char *sp;
@@ -324,10 +324,10 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                switch (fmt->f_type) {
 
                case FT_COMP:
-                       cpstripped (&cp, ep, fmt->f_comp->c_text);
+                       cpstripped(&cp, ep, fmt->f_comp->c_text);
                        break;
                case FT_COMPF:
-                       cptrimmed (&cp, fmt->f_comp->c_text, fmt->f_width, fmt->f_fill, ep - cp);
+                       cptrimmed(&cp, fmt->f_comp->c_text, fmt->f_width, fmt->f_fill, ep - cp);
                        break;
 
                case FT_LIT:
@@ -350,13 +350,13 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                        break;
 
                case FT_STR:
-                       cpstripped (&cp, ep, str);
+                       cpstripped(&cp, ep, str);
                        break;
                case FT_STRF:
-                       cptrimmed (&cp, str, fmt->f_width, fmt->f_fill, ep - cp);
+                       cptrimmed(&cp, str, fmt->f_width, fmt->f_fill, ep - cp);
                        break;
                case FT_STRFW:
-                       adios (NULL, "internal error (FT_STRFW)");
+                       adios(NULL, "internal error (FT_STRFW)");
 
                case FT_NUM:
                        n = snprintf(cp, ep - cp + 1, "%d", value);
@@ -368,7 +368,7 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                        }
                        break;
                case FT_NUMF:
-                       cpnumber (&cp, value, fmt->f_width, fmt->f_fill, ep - cp);
+                       cpnumber(&cp, value, fmt->f_width, fmt->f_fill, ep - cp);
                        break;
 
                case FT_CHAR:
@@ -414,7 +414,7 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                        break;
 
                case FT_IF_MATCH:
-                       if (!(value = (str && match (str, fmt->f_text)))) {
+                       if (!(value = (str && match(str, fmt->f_text)))) {
                                fmt += fmt->f_skip;
                                continue;
                        }
@@ -422,20 +422,20 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
 
                case FT_V_MATCH:
                        if (str)
-                               value = match (str, fmt->f_text);
+                               value = match(str, fmt->f_text);
                        else
                                value = 0;
                        break;
 
                case FT_IF_AMATCH:
-                       if (!(value = (str && uprf (str, fmt->f_text)))) {
+                       if (!(value = (str && uprf(str, fmt->f_text)))) {
                                fmt += fmt->f_skip;
                                continue;
                        }
                        break;
 
                case FT_V_AMATCH:
-                       value = uprf (str, fmt->f_text);
+                       value = uprf(str, fmt->f_text);
                        break;
 
                case FT_S_NONNULL:
@@ -472,11 +472,11 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                        str = fmt->f_text;
                        break;
                case FT_LS_GETENV:
-                       if (!(str = getenv (fmt->f_text)))
+                       if (!(str = getenv(fmt->f_text)))
                                str = "";
                        break;
                case FT_LS_CFIND:
-                       if (!(str = context_find (fmt->f_text)))
+                       if (!(str = context_find(fmt->f_text)))
                                str = "";
                        break;
 
@@ -583,24 +583,24 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                        str = lmonth[fmt->f_comp->c_tws->tw_mon];
                        break;
                case FT_LS_ZONE:
-                       str = dtwszone (fmt->f_comp->c_tws);
+                       str = dtwszone(fmt->f_comp->c_tws);
                        break;
                case FT_LV_YEAR:
                        value = fmt->f_comp->c_tws->tw_year;
                        break;
                case FT_LV_WDAY:
                        if (!(((tws = fmt->f_comp->c_tws)->tw_flags) & (TW_SEXP|TW_SIMP)))
-                               set_dotw (tws);
+                               set_dotw(tws);
                        value = tws->tw_wday;
                        break;
                case FT_LS_DAY:
                        if (!(((tws = fmt->f_comp->c_tws)->tw_flags) & (TW_SEXP|TW_SIMP)))
-                               set_dotw (tws);
+                               set_dotw(tws);
                        str = tw_dotw[tws->tw_wday];
                        break;
                case FT_LS_WEEKDAY:
                        if (!(((tws = fmt->f_comp->c_tws)->tw_flags) & (TW_SEXP|TW_SIMP)))
-                               set_dotw (tws);
+                               set_dotw(tws);
                        str = tw_ldotw[tws->tw_wday];
                        break;
                case FT_LV_YDAY:
@@ -620,7 +620,7 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                        break;
                case FT_LV_DAYF:
                        if (!(((tws = fmt->f_comp->c_tws)->tw_flags) & (TW_SEXP|TW_SIMP)))
-                               set_dotw (tws);
+                               set_dotw(tws);
                        switch (fmt->f_comp->c_tws->tw_flags & TW_SDAY) {
                                case TW_SEXP:
                                        value = 1; break;
@@ -639,10 +639,10 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                        value = fmt->f_comp->c_tws->tw_flags & TW_DST;
                        break;
                case FT_LS_822DATE:
-                       str = dasctime (fmt->f_comp->c_tws , TW_ZONE);
+                       str = dasctime(fmt->f_comp->c_tws , TW_ZONE);
                        break;
                case FT_LS_PRETTY:
-                       str = dasctime (fmt->f_comp->c_tws, TW_NULL);
+                       str = dasctime(fmt->f_comp->c_tws, TW_NULL);
                        break;
 
                case FT_LS_PERS:
@@ -685,7 +685,7 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                                goto unfriendly;
                        if ((str = mn->m_pers) == NULL) {
                                if ((str = mn->m_note)) {
-                                       strncpy (buffer, str, sizeof(buffer));
+                                       strncpy(buffer, str, sizeof(buffer));
                                        buffer[sizeof(buffer)-1] = '\0';
                                        str = buffer;
                                        if (*str == '(')
@@ -699,7 +699,7 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                                                        else
                                                                break;
                                        }
-                               } else if (!(str = get_x400_friendly (mn->m_mbox,
+                               } else if (!(str = get_x400_friendly(mn->m_mbox,
                                        buffer, sizeof(buffer)))) {
                unfriendly: ;
                                        switch (mn->m_type) {
@@ -707,13 +707,13 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                                                str = mn->m_mbox;
                                                break;
                                        case UUCPHOST:
-                                               snprintf (buffer, sizeof(buffer), "%s!%s",
+                                               snprintf(buffer, sizeof(buffer), "%s!%s",
                                                        mn->m_host, mn->m_mbox);
                                                str = buffer;
                                                break;
                                        default:
                                                if (mn->m_mbox) {
-                                                       snprintf (buffer, sizeof(buffer), "%s@%s",
+                                                       snprintf(buffer, sizeof(buffer), "%s@%s",
                                                                mn->m_mbox, mn->m_host);
                                                        str= buffer;
                                                } else
@@ -782,7 +782,7 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                                *comp->c_tws = *tws;
                                comp->c_flags &= ~CF_TRUE;
                        } else if ((comp->c_flags & CF_DATEFAB) == 0) {
-                               memset ((char *) comp->c_tws, 0, sizeof *comp->c_tws);
+                               memset((char *) comp->c_tws, 0, sizeof *comp->c_tws);
                                comp->c_flags = CF_TRUE;
                        }
                        comp->c_flags |= CF_PARSED;
@@ -793,7 +793,7 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                        ** hook for custom address list formatting
                        ** (see replsbr.c)
                        */
-                       str = formataddr (savestr, str);
+                       str = formataddr(savestr, str);
                        break;
 
                case FT_PUTADDR:
@@ -811,9 +811,9 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
 
                        lp = str;
                        wid = value;
-                       len = strlen (str);
+                       len = strlen(str);
                        sp = fmt->f_text;
-                       indent = strlen (sp);
+                       indent = strlen(sp);
                        wid -= indent;
                        while( (c = *sp++) && cp < ep)
                                *cp++ = c;
@@ -847,7 +847,7 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                                                *cp++ = ' ';
                                }
                        }
-                       cpstripped (&cp, ep, lp);
+                       cpstripped(&cp, ep, lp);
                        }
                        break;
 
@@ -856,9 +856,9 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                        if (comp->c_flags & CF_PARSED)
                                break;
                        if (comp->c_mn != &fmt_mnull)
-                               mnfree (comp->c_mn);
+                               mnfree(comp->c_mn);
                        if ((sp = comp->c_text) && (sp = getname(sp)) &&
-                               (mn = getm (sp, NULL, 0, fmt_norm, NULL))) {
+                               (mn = getm(sp, NULL, 0, fmt_norm, NULL))) {
                                comp->c_mn = mn;
                                while (getname(""))
                                        ;
@@ -878,9 +878,9 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                        */
                        comp = fmt->f_comp;
                        if (comp->c_mn != &fmt_mnull)
-                               mnfree (comp->c_mn);
+                               mnfree(comp->c_mn);
                        if ((sp = comp->c_text) && (sp = getname(sp)) &&
-                               (mn = getm (sp, NULL, 0, AD_NAME, NULL))) {
+                               (mn = getm(sp, NULL, 0, AD_NAME, NULL))) {
                                comp->c_mn = mn;
                                if (ismymbox(mn))
                                        comp->c_flags |= CF_TRUE;
@@ -888,7 +888,7 @@ fmt_scan (struct format *format, char *scanl, int width, int *dat)
                                        comp->c_flags &= ~CF_TRUE;
                                while ((sp = getname(sp)))
                                        if ((comp->c_flags & CF_TRUE) == 0 &&
-                                               (mn = getm (sp, NULL, 0, AD_NAME, NULL)))
+                                               (mn = getm(sp, NULL, 0, AD_NAME, NULL)))
                                                if (ismymbox(mn))
                                                        comp->c_flags |= CF_TRUE;
                        } else {
index 5d1690e..423384a 100644 (file)
@@ -16,7 +16,7 @@
 */
 
 int
-folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
+folder_addmsg(struct msgs **mpp, char *msgfile, int selected,
        int unseen, int preserve, int deleting, char *from_dir)
 {
        int infd, outfd, linkerr, msgnum;
@@ -28,7 +28,7 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
        mp = *mpp;
 
        /* should we preserve the numbering of the message? */
-       if (preserve && (msgnum = m_atoi (msgfile)) > 0) {
+       if (preserve && (msgnum = m_atoi(msgfile)) > 0) {
                ;
        } else if (mp->nummsg == 0) {
                /* check if we are adding to empty folder */
@@ -51,17 +51,17 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
                ** extend message status range to cover this message number.
                */
                if (msgnum > mp->hghoff) {
-                       if ((mp = folder_realloc (mp, mp->lowoff, msgnum + 100)))
+                       if ((mp = folder_realloc(mp, mp->lowoff, msgnum + 100)))
                                *mpp = mp;
                        else {
-                               advise (NULL, "unable to allocate folder storage");
+                               advise(NULL, "unable to allocate folder storage");
                                return -1;
                        }
                } else if (msgnum < mp->lowoff) {
-                       if ((mp = folder_realloc (mp, msgnum, mp->hghoff)))
+                       if ((mp = folder_realloc(mp, msgnum, mp->hghoff)))
                                *mpp = mp;
                        else {
-                               advise (NULL, "unable to allocate folder storage");
+                               advise(NULL, "unable to allocate folder storage");
                                return -1;
                        }
                }
@@ -70,21 +70,21 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
                ** If a message is already in that slot,
                ** then loop to next available slot.
                */
-               if (does_exist (mp, msgnum))
+               if (does_exist(mp, msgnum))
                        continue;
 
                /* setup the bit flags for this message */
-               clear_msg_flags (mp, msgnum);
-               set_exists (mp, msgnum);
+               clear_msg_flags(mp, msgnum);
+               set_exists(mp, msgnum);
 
                /* should we set the SELECT_UNSEEN bit? */
                if (unseen) {
-                       set_unseen (mp, msgnum);
+                       set_unseen(mp, msgnum);
                }
 
                /* should we set the SELECTED bit? */
                if (selected) {
-                       set_selected (mp, msgnum);
+                       set_selected(mp, msgnum);
 
                        /* check if highest or lowest selected */
                        if (mp->numsel == 0) {
@@ -117,8 +117,8 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
                /* increment message count */
                mp->nummsg++;
 
-               nmsg = m_name (msgnum);
-               snprintf (newmsg, sizeof(newmsg), "%s/%s", mp->foldpath, nmsg);
+               nmsg = m_name(msgnum);
+               snprintf(newmsg, sizeof(newmsg), "%s/%s", mp->foldpath, nmsg);
 
                /*
                ** Now try to link message into folder.  Then run the
@@ -129,7 +129,7 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
                ** Run the add hook if the message is getting copied or
                ** linked somewhere else.
                */
-               if (link (msgfile, newmsg) != -1) {
+               if (link(msgfile, newmsg) != -1) {
 
                        if (deleting) {
                                (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", from_dir, msgfile);
@@ -154,7 +154,7 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
                        ** slot (hghmsg+1).
                        */
                        if (linkerr == EEXIST) {
-                               if (stat (msgfile, &st2) == 0 && stat (newmsg, &st1) == 0
+                               if (stat(msgfile, &st2) == 0 && stat(newmsg, &st1) == 0
                                        && st2.st_ino == st1.st_ino) {
                                        return msgnum;
                                } else {
@@ -169,23 +169,23 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
                        ** error, else just copy the message.
                        */
                        if (linkerr == EXDEV) {
-                               if (stat (newmsg, &st1) == 0) {
-                                       advise (NULL, "message %s:%s already exists", mp->foldpath, newmsg);
+                               if (stat(newmsg, &st1) == 0) {
+                                       advise(NULL, "message %s:%s already exists", mp->foldpath, newmsg);
                                        return -1;
                                } else {
-                                       if ((infd = open (msgfile, O_RDONLY)) == -1) {
-                                               advise (msgfile, "unable to open message %s", msgfile);
+                                       if ((infd = open(msgfile, O_RDONLY)) == -1) {
+                                               advise(msgfile, "unable to open message %s", msgfile);
                                                return -1;
                                        }
-                                       fstat (infd, &st1);
-                                       if ((outfd = creat (newmsg, (int) st1.st_mode & 0777)) == -1) {
-                                               advise (newmsg, "unable to create");
-                                               close (infd);
+                                       fstat(infd, &st1);
+                                       if ((outfd = creat(newmsg, (int) st1.st_mode & 0777)) == -1) {
+                                               advise(newmsg, "unable to create");
+                                               close(infd);
                                                return -1;
                                        }
-                                       cpydata (infd, outfd, msgfile, newmsg);
-                                       close (infd);
-                                       close (outfd);
+                                       cpydata(infd, outfd, msgfile, newmsg);
+                                       close(infd);
+                                       close(outfd);
 
                                        if (deleting) {
                                                (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", from_dir, msgfile);
@@ -201,7 +201,7 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
                        ** Else, some other type of link error,
                        ** so just return error.
                        */
-                       advise (newmsg, "error linking %s to", msgfile);
+                       advise(newmsg, "error linking %s to", msgfile);
                        return -1;
                }
        }
index 5df5b5f..77131b1 100644 (file)
@@ -19,7 +19,7 @@
 */
 
 int
-folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
+folder_delmsgs(struct msgs *mp, int unlink_msgs, int nohook)
 {
        pid_t pid;
        int msgnum, vecp, retval = 0;
@@ -32,43 +32,43 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
        if (rmmproc) {
                /* Unset the EXISTS flag for each message to be removed */
                for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
-                       if (is_selected (mp, msgnum))
-                       unset_exists (mp, msgnum);
+                       if (is_selected(mp, msgnum))
+                       unset_exists(mp, msgnum);
                }
 
                /* Mark that the sequence information has changed */
                mp->msgflags |= SEQMOD;
 
                if (mp->numsel > MAXARGS - 2)
-                       adios (NULL, "more than %d messages for %s exec", MAXARGS - 2,
+                       adios(NULL, "more than %d messages for %s exec", MAXARGS - 2,
                                rmmproc);
-               vec = (char **) calloc ((size_t) (mp->numsel + 2), sizeof(*vec));
+               vec = (char **) calloc((size_t) (mp->numsel + 2), sizeof(*vec));
                if (vec == NULL)
-                       adios (NULL, "unable to allocate exec vector");
+                       adios(NULL, "unable to allocate exec vector");
                vecp = 1;
                for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
-                       if (is_selected (mp, msgnum) &&
-                               !(vec[vecp++] = strdup (m_name (msgnum))))
-                       adios (NULL, "strdup failed");
+                       if (is_selected(mp, msgnum) &&
+                               !(vec[vecp++] = strdup(m_name(msgnum))))
+                       adios(NULL, "strdup failed");
                }
                vec[vecp] = NULL;
 
-               fflush (stdout);
-               vec[0] = r1bindex (rmmproc, '/');
+               fflush(stdout);
+               vec[0] = r1bindex(rmmproc, '/');
 
                switch (pid = vfork()) {
                case -1:
-                       advise ("fork", "unable to");
+                       advise("fork", "unable to");
                        return -1;
 
                case 0:
-                       execvp (rmmproc, vec);
-                       fprintf (stderr, "unable to exec ");
-                       perror (rmmproc);
-                       _exit (-1);
+                       execvp(rmmproc, vec);
+                       fprintf(stderr, "unable to exec ");
+                       perror(rmmproc);
+                       _exit(-1);
 
                default:
-                       return (pidwait (pid, -1));
+                       return (pidwait(pid, -1));
                }
        }
 
@@ -76,9 +76,9 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
        ** Either unlink or rename the SELECTED messages
        */
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
-               if (is_selected (mp, msgnum)) {
+               if (is_selected(mp, msgnum)) {
                        /* unselect message */
-                       unset_selected (mp, msgnum);
+                       unset_selected(mp, msgnum);
                        mp->numsel--;
 
                        /*
@@ -96,34 +96,34 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
                                (void)ext_hook("del-hook", msgpath, (char *)0);
                        }
 
-                       dp = m_name (msgnum);
+                       dp = m_name(msgnum);
 
                        if (unlink_msgs) {
                                /* just unlink the messages */
-                               if (unlink (dp) == -1) {
-                                       admonish (dp, "unable to unlink");
+                               if (unlink(dp) == -1) {
+                                       admonish(dp, "unable to unlink");
                                        retval = -1;
                                        continue;
                                }
                        } else {
                                /* or rename messages with standard prefix */
-                               strncpy (buf, m_backup (dp), sizeof(buf));
-                               if (rename (dp, buf) == -1) {
-                                       admonish (buf, "unable to rename %s to", dp);
+                               strncpy(buf, m_backup(dp), sizeof(buf));
+                               if (rename(dp, buf) == -1) {
+                                       admonish(buf, "unable to rename %s to", dp);
                                        retval = -1;
                                        continue;
                                }
                        }
 
                        /* If removal was successful, decrement message count */
-                       unset_exists (mp, msgnum);
+                       unset_exists(mp, msgnum);
                        mp->nummsg--;
                }
        }
 
        /* Sanity check */
        if (mp->numsel != 0)
-       adios (NULL, "oops, mp->numsel should be 0");
+       adios(NULL, "oops, mp->numsel should be 0");
 
        /* Mark that the sequence information has changed */
        mp->msgflags |= SEQMOD;
index d88febe..d383d78 100644 (file)
@@ -10,7 +10,7 @@
 
 
 void
-folder_free (struct msgs *mp)
+folder_free(struct msgs *mp)
 {
        int i;
 
@@ -18,12 +18,12 @@ folder_free (struct msgs *mp)
                return;
 
        if (mp->foldpath)
-               free (mp->foldpath);
+               free(mp->foldpath);
 
        /* free the sequence names */
        for (i = 0; mp->msgattrs[i]; i++)
-               free (mp->msgattrs[i]);
+               free(mp->msgattrs[i]);
 
-       free (mp->msgstats);  /* free message status area   */
-       free (mp);  /* free main folder structure */
+       free(mp->msgstats);  /* free message status area   */
+       free(mp);  /* free main folder structure */
 }
index 29ed687..5280e30 100644 (file)
@@ -15,7 +15,7 @@
 */
 
 int
-folder_pack (struct msgs **mpp, int verbose)
+folder_pack(struct msgs **mpp, int verbose)
 {
        int hole, msgnum, newcurrent = 0;
        char newmsg[BUFSIZ], oldmsg[BUFSIZ];
@@ -34,21 +34,21 @@ folder_pack (struct msgs **mpp, int verbose)
        ** for all numbers from 1 to current high message.
        */
        if (mp->lowoff > 1) {
-               if ((mp = folder_realloc (mp, 1, mp->hghmsg)))
+               if ((mp = folder_realloc(mp, 1, mp->hghmsg)))
                        *mpp = mp;
                else {
-                       advise (NULL, "unable to allocate folder storage");
+                       advise(NULL, "unable to allocate folder storage");
                        return -1;
                }
        }
 
        for (msgnum = mp->lowmsg, hole = 1; msgnum <= mp->hghmsg; msgnum++) {
-               if (does_exist (mp, msgnum)) {
+               if (does_exist(mp, msgnum)) {
                        if (msgnum != hole) {
-                               strncpy (newmsg, m_name (hole), sizeof(newmsg));
-                               strncpy (oldmsg, m_name (msgnum), sizeof(oldmsg));
+                               strncpy(newmsg, m_name(hole), sizeof(newmsg));
+                               strncpy(oldmsg, m_name(msgnum), sizeof(oldmsg));
                                if (verbose)
-                                       printf ("message %s becomes %s\n", oldmsg, newmsg);
+                                       printf("message %s becomes %s\n", oldmsg, newmsg);
 
                                /*
                                ** Invoke the external refile hook for each
@@ -62,8 +62,8 @@ folder_pack (struct msgs **mpp, int verbose)
                                ext_hook("ref-hook", oldmsg, newmsg);
 
                                /* move the message file */
-                               if (rename (oldmsg, newmsg) == -1) {
-                                       advise (newmsg, "unable to rename %s to", oldmsg);
+                               if (rename(oldmsg, newmsg) == -1) {
+                                       advise(newmsg, "unable to rename %s to", oldmsg);
                                        return -1;
                                }
 
@@ -72,7 +72,7 @@ folder_pack (struct msgs **mpp, int verbose)
                                        newcurrent = hole;
 
                                /* copy the attribute flags for this message */
-                               copy_msg_flags (mp, hole, msgnum);
+                               copy_msg_flags(mp, hole, msgnum);
 
                                if (msgnum == mp->lowsel)
                                        mp->lowsel = hole;
@@ -95,7 +95,7 @@ folder_pack (struct msgs **mpp, int verbose)
 
        /* update the "cur" sequence */
        if (newcurrent != 0)
-               seq_setcur (mp, newcurrent);
+               seq_setcur(mp, newcurrent);
 
        return 0;
 }
index 5743166..222b490 100644 (file)
@@ -22,7 +22,7 @@
 */
 
 struct msgs *
-folder_read (char *name)
+folder_read(char *name)
 {
        int msgnum, prefix_len, len, *mi;
        struct msgs *mp;
@@ -30,21 +30,21 @@ folder_read (char *name)
        struct dirent *dp;
        DIR *dd;
 
-       name = m_mailpath (name);
-       if (!(dd = opendir (name))) {
-               free (name);
+       name = m_mailpath(name);
+       if (!(dd = opendir(name))) {
+               free(name);
                return NULL;
        }
 
-       if (stat (name, &st) == -1) {
-               free (name);
+       if (stat(name, &st) == -1) {
+               free(name);
                return NULL;
        }
 
        /* Allocate the main structure for folder information */
-       mp = (struct msgs *) mh_xmalloc ((size_t) sizeof(*mp));
+       mp = (struct msgs *) mh_xmalloc((size_t) sizeof(*mp));
 
-       clear_folder_flags (mp);
+       clear_folder_flags(mp);
        mp->foldpath = name;
        mp->lowmsg = 0;
        mp->hghmsg = 0;
@@ -54,8 +54,8 @@ folder_read (char *name)
        mp->numsel = 0;
        mp->nummsg = 0;
 
-       if (access (name, W_OK) == -1)
-               set_readonly (mp);
+       if (access(name, W_OK) == -1)
+               set_readonly(mp);
        prefix_len = strlen(backup_prefix);
 
        /*
@@ -63,17 +63,17 @@ folder_read (char *name)
        ** name of the messages in this folder.
        */
        len = NUMMSGS;
-       mi = (int *) mh_xmalloc ((size_t) (len * sizeof(*mi)));
+       mi = (int *) mh_xmalloc((size_t) (len * sizeof(*mi)));
 
-       while ((dp = readdir (dd))) {
-               if ((msgnum = m_atoi (dp->d_name)) && msgnum > 0) {
+       while ((dp = readdir(dd))) {
+               if ((msgnum = m_atoi(dp->d_name)) && msgnum > 0) {
                        /*
                        ** Check if we need to allocate more
                        ** temporary elements for message names.
                        */
                        if (mp->nummsg >= len) {
                                len += NUMMSGS;
-                               mi = (int *) mh_xrealloc (mi, (size_t) (len * sizeof(*mi)));
+                               mi = (int *) mh_xrealloc(mi, (size_t) (len * sizeof(*mi)));
                        }
 
                        /* Check if this is the first message we've seen */
@@ -111,43 +111,43 @@ folder_read (char *name)
                                        ** skip any files beginning with
                                        ** backup prefix
                                        */
-                                       if (!strncmp (dp->d_name, backup_prefix, prefix_len))
+                                       if (!strncmp(dp->d_name, backup_prefix, prefix_len))
                                                continue;
 
                                        /* skip the altmsg link file */
-                                       if (!strcmp (dp->d_name, altmsglink))
+                                       if (!strcmp(dp->d_name, altmsglink))
                                                continue;
 
                                        /*
                                        ** indicate that there are other
                                        ** files in folder
                                        */
-                                       set_other_files (mp);
+                                       set_other_files(mp);
                                        continue;
                        }
                }
        }
 
-       closedir (dd);
-       mp->lowoff = max (mp->lowmsg, 1);
+       closedir(dd);
+       mp->lowoff = max(mp->lowmsg, 1);
 
        /* Go ahead and allocate space for 100 additional messages. */
        mp->hghoff = mp->hghmsg + 100;
 
        /* for testing, allocate minimal necessary space */
-       /* mp->hghoff = max (mp->hghmsg, 1); */
+       /* mp->hghoff = max(mp->hghmsg, 1); */
 
        /*
        ** Allocate space for status of each message.
        */
-       mp->msgstats = mh_xmalloc (MSGSTATSIZE(mp, mp->lowoff, mp->hghoff));
+       mp->msgstats = mh_xmalloc(MSGSTATSIZE(mp, mp->lowoff, mp->hghoff));
 
        /*
        ** Clear all the flag bits for all the message
        ** status entries we just allocated.
        */
        for (msgnum = mp->lowoff; msgnum <= mp->hghoff; msgnum++)
-               clear_msg_flags (mp, msgnum);
+               clear_msg_flags(mp, msgnum);
 
        /*
        ** Scan through the array of messages we've seen and
@@ -155,14 +155,14 @@ folder_read (char *name)
        ** newly allocated mp->msgstats area.
        */
        for (msgnum = 0; msgnum < mp->nummsg; msgnum++)
-               set_exists (mp, mi[msgnum]);
+               set_exists(mp, mi[msgnum]);
 
-       free (mi);  /* We don't need this anymore */
+       free(mi);  /* We don't need this anymore */
 
        /*
        ** Read and initialize the sequence information.
        */
-       seq_read (mp);
+       seq_read(mp);
 
        return mp;
 }
index 2418abd..f1b703f 100644 (file)
 */
 
 struct msgs *
-folder_realloc (struct msgs *mp, int lo, int hi)
+folder_realloc(struct msgs *mp, int lo, int hi)
 {
        int msgnum;
 
        /* sanity checks */
        if (lo < 1)
-               adios (NULL, "BUG: called folder_realloc with lo (%d) < 1", lo);
+               adios(NULL, "BUG: called folder_realloc with lo (%d) < 1", lo);
        if (hi < 1)
-               adios (NULL, "BUG: called folder_realloc with hi (%d) < 1", hi);
+               adios(NULL, "BUG: called folder_realloc with hi (%d) < 1", hi);
        if (mp->nummsg > 0 && lo > mp->lowmsg)
-               adios (NULL, "BUG: called folder_realloc with lo (%d) > mp->lowmsg (%d)",
+               adios(NULL, "BUG: called folder_realloc with lo (%d) > mp->lowmsg (%d)",
                           lo, mp->lowmsg);
        if (mp->nummsg > 0 && hi < mp->hghmsg)
-               adios (NULL, "BUG: called folder_realloc with hi (%d) < mp->hghmsg (%d)",
+               adios(NULL, "BUG: called folder_realloc with hi (%d) < mp->hghmsg (%d)",
                           hi, mp->hghmsg);
 
        /* Check if we really need to reallocate anything */
@@ -44,7 +44,7 @@ folder_realloc (struct msgs *mp, int lo, int hi)
                ** status array.  So we don't have to move anything and can
                ** just realloc the message status array.
                */
-               mp->msgstats = mh_xrealloc (mp->msgstats, MSGSTATSIZE(mp, lo, hi));
+               mp->msgstats = mh_xrealloc(mp->msgstats, MSGSTATSIZE(mp, lo, hi));
        } else {
                /*
                ** We are changing the offset of the message status
@@ -53,7 +53,7 @@ folder_realloc (struct msgs *mp, int lo, int hi)
                seqset_t *tmpstats;
 
                /* first allocate the new message status space */
-               tmpstats = mh_xmalloc (MSGSTATSIZE(mp, lo, hi));
+               tmpstats = mh_xmalloc(MSGSTATSIZE(mp, lo, hi));
 
                /* then copy messages status array with shift */
                if (mp->nummsg > 0) {
@@ -73,13 +73,13 @@ folder_realloc (struct msgs *mp, int lo, int hi)
        */
        if (mp->nummsg > 0) {
                for (msgnum = mp->lowoff; msgnum < mp->lowmsg; msgnum++)
-                       clear_msg_flags (mp, msgnum);
+                       clear_msg_flags(mp, msgnum);
                for (msgnum = mp->hghmsg + 1; msgnum <= mp->hghoff; msgnum++)
-                       clear_msg_flags (mp, msgnum);
+                       clear_msg_flags(mp, msgnum);
        } else {
                /* no messages, so clear entire range */
                for (msgnum = mp->lowoff; msgnum <= mp->hghoff; msgnum++)
-                       clear_msg_flags (mp, msgnum);
+                       clear_msg_flags(mp, msgnum);
        }
 
        return mp;
index 27d91cd..2b9a015 100644 (file)
@@ -10,7 +10,7 @@
 
 
 int
-gans (char *prompt, struct swit *ansp)
+gans(char *prompt, struct swit *ansp)
 {
        register int i;
        register char *cp;
@@ -18,10 +18,10 @@ gans (char *prompt, struct swit *ansp)
        char ansbuf[BUFSIZ];
 
        for (;;) {
-               printf ("%s", prompt);
-               fflush (stdout);
+               printf("%s", prompt);
+               fflush(stdout);
                cp = ansbuf;
-               while ((i = getchar ()) != '\n') {
+               while ((i = getchar()) != '\n') {
                        if (i == EOF)
                                return 0;
                        if (cp < &ansbuf[sizeof ansbuf - 1]) {
@@ -36,13 +36,13 @@ gans (char *prompt, struct swit *ansp)
                }
                *cp = '\0';
                if (ansbuf[0] == '?' || cp == ansbuf) {
-                       printf ("Options are:\n");
+                       printf("Options are:\n");
                        for (ap = ansp; ap->sw; ap++)
-                               printf ("  %s\n", ap->sw);
+                               printf("  %s\n", ap->sw);
                        continue;
                }
-               if ((i = smatch (ansbuf, ansp)) < 0) {
-                       printf ("%s: %s.\n", ansbuf, i == -1 ? "unknown" : "ambiguous");
+               if ((i = smatch(ansbuf, ansp)) < 0) {
+                       printf("%s: %s.\n", ansbuf, i == -1 ? "unknown" : "ambiguous");
                        continue;
                }
                return i;
index 3e38d87..919fd32 100644 (file)
@@ -17,49 +17,49 @@ static jmp_buf sigenv;
 /*
 ** static prototypes
 */
-static RETSIGTYPE intrser (int);
+static RETSIGTYPE intrser(int);
 
 
 char **
-getans (char *prompt, struct swit *ansp)
+getans(char *prompt, struct swit *ansp)
 {
        int i;
        SIGNAL_HANDLER istat = NULL;
        char *cp, **cpp;
 
-       if (!(setjmp (sigenv))) {
-               istat = SIGNAL (SIGINT, intrser);
+       if (!(setjmp(sigenv))) {
+               istat = SIGNAL(SIGINT, intrser);
        } else {
-               SIGNAL (SIGINT, istat);
+               SIGNAL(SIGINT, istat);
                return NULL;
        }
 
        for (;;) {
-               printf ("%s", prompt);
-               fflush (stdout);
+               printf("%s", prompt);
+               fflush(stdout);
                cp = ansbuf;
-               while ((i = getchar ()) != '\n') {
+               while ((i = getchar()) != '\n') {
                        if (i == EOF)
-                               longjmp (sigenv, 1);
+                               longjmp(sigenv, 1);
                        if (cp < &ansbuf[sizeof ansbuf - 1])
                                *cp++ = i;
                }
                *cp = '\0';
                if (ansbuf[0] == '?' || cp == ansbuf) {
-                       printf ("Options are:\n");
-                       print_sw (ALL, ansp, "", stdout);
+                       printf("Options are:\n");
+                       print_sw(ALL, ansp, "", stdout);
                        continue;
                }
-               cpp = brkstring (ansbuf, " ", NULL);
-               switch (smatch (*cpp, ansp)) {
+               cpp = brkstring(ansbuf, " ", NULL);
+               switch (smatch(*cpp, ansp)) {
                        case AMBIGSW:
-                               ambigsw (*cpp, ansp);
+                               ambigsw(*cpp, ansp);
                                continue;
                        case UNKWNSW:
-                               printf (" -%s unknown. Hit <CR> for help.\n", *cpp);
+                               printf(" -%s unknown. Hit <CR> for help.\n", *cpp);
                                continue;
                        default:
-                               SIGNAL (SIGINT, istat);
+                               SIGNAL(SIGINT, istat);
                                return cpp;
                }
        }
@@ -67,10 +67,10 @@ getans (char *prompt, struct swit *ansp)
 
 
 static RETSIGTYPE
-intrser (int i)
+intrser(int i)
 {
        /*
        ** should this be siglongjmp?
        */
-       longjmp (sigenv, 1);
+       longjmp(sigenv, 1);
 }
index 4707255..9bac0e5 100644 (file)
 
 
 int
-getanswer (char *prompt)
+getanswer(char *prompt)
 {
        static int interactive = -1;
 
        if (interactive < 0)
-               interactive = isatty (fileno (stdin)) ? 1 : 0;
+               interactive = isatty(fileno(stdin)) ? 1 : 0;
 
-       return (interactive ? gans (prompt, anoyes) : 1);
+       return (interactive ? gans(prompt, anoyes) : 1);
 }
index 5dbdf56..ce33c2e 100644 (file)
@@ -10,7 +10,7 @@
 #include <h/utils.h>
 
 char **
-getarguments (char *invo_name, int argc, char **argv, int check_context)
+getarguments(char *invo_name, int argc, char **argv, int check_context)
 {
        char *cp = NULL, **ap = NULL, **bp = NULL, **arguments = NULL;
        int n = 0;
@@ -18,9 +18,9 @@ getarguments (char *invo_name, int argc, char **argv, int check_context)
        /*
        ** Check if profile/context specifies any arguments
        */
-       if (check_context && (cp = context_find (invo_name))) {
-               cp = getcpy (cp);  /* make copy */
-               ap = brkstring (cp, " ", "\n");  /* split string */
+       if (check_context && (cp = context_find(invo_name))) {
+               cp = getcpy(cp);  /* make copy */
+               ap = brkstring(cp, " ", "\n");  /* split string */
 
                /* Count number of arguments split */
                bp = ap;
@@ -28,7 +28,7 @@ getarguments (char *invo_name, int argc, char **argv, int check_context)
                        n++;
        }
 
-       arguments = (char **) mh_xmalloc ((argc + n) * sizeof(*arguments));
+       arguments = (char **) mh_xmalloc((argc + n) * sizeof(*arguments));
        bp = arguments;
 
        /* Copy any arguments from profile/context */
index b2891b8..478986a 100644 (file)
 
 
 char *
-getcpy (char *str)
+getcpy(char *str)
 {
        char *cp;
        size_t len;
 
        if (str) {
                len = strlen(str) + 1;
-               cp = mh_xmalloc (len);
-               memcpy (cp, str, len);
+               cp = mh_xmalloc(len);
+               memcpy(cp, str, len);
        } else {
-               cp = mh_xmalloc ((size_t) 1);
+               cp = mh_xmalloc((size_t) 1);
                *cp = '\0';
        }
        return cp;
index 02910c3..9a6b18b 100644 (file)
@@ -17,13 +17,13 @@ getfolder(int wantcurrent)
        /*
        ** If wantcurrent == 1, then try the current folder first
        */
-       if (wantcurrent && (folder = context_find (pfolder)) && *folder != '\0')
+       if (wantcurrent && (folder = context_find(pfolder)) && *folder != '\0')
                return folder;
 
        /*
        ** Else try the Inbox profile entry
        */
-       if ((folder = context_find (inbox)) && *folder != '\0')
+       if ((folder = context_find(inbox)) && *folder != '\0')
                return folder;
 
        /*
index d3d447e..34d743e 100644 (file)
@@ -98,19 +98,19 @@ static struct lock *l_top = NULL;
 ** static prototypes
 */
 #ifdef KERNEL_LOCKING
-static int lkopen_kernel (char *, int, mode_t);
+static int lkopen_kernel(char *, int, mode_t);
 #endif
 
 #ifdef DOT_LOCKING
-static int lkopen_dot (char *, int, mode_t);
-static void lockname (char *, struct lockinfo *, int);
-static void timerON (char *, int);
-static void timerOFF (int);
-static RETSIGTYPE alrmser (int);
+static int lkopen_dot(char *, int, mode_t);
+static void lockname(char *, struct lockinfo *, int);
+static void timerON(char *, int);
+static void timerOFF(int);
+static RETSIGTYPE alrmser(int);
 #endif
 
 #if !defined(HAVE_LIBLOCKFILE)
-static int lockit (struct lockinfo *);
+static int lockit(struct lockinfo *);
 #endif
 
 /*
@@ -119,7 +119,7 @@ static int lockit (struct lockinfo *);
 */
 
 int
-lkopen (char *file, int access, mode_t mode)
+lkopen(char *file, int access, mode_t mode)
 {
 #ifdef KERNEL_LOCKING
        return lkopen_kernel(file, access, mode);
@@ -137,7 +137,7 @@ lkopen (char *file, int access, mode_t mode)
 */
 
 int
-lkclose (int fd, char *file)
+lkclose(int fd, char *file)
 {
 #ifdef FCNTL_LOCKING
        struct flock buf;
@@ -159,26 +159,26 @@ lkclose (int fd, char *file)
 #endif
 
 #ifdef FLOCK_LOCKING
-       flock (fd, LOCK_UN);
+       flock(fd, LOCK_UN);
 #endif
 
 #ifdef LOCKF_LOCKING
        /* make sure we unlock the whole thing */
-       lseek (fd, (off_t) 0, SEEK_SET);
-       lockf (fd, F_ULOCK, 0L);
+       lseek(fd, (off_t) 0, SEEK_SET);
+       lockf(fd, F_ULOCK, 0L);
 #endif
 
 #ifdef DOT_LOCKING
-       lockname (file, &lkinfo, 0);  /* get name of lock file */
+       lockname(file, &lkinfo, 0);  /* get name of lock file */
 #if !defined(HAVE_LIBLOCKFILE)
-       unlink (lkinfo.curlock);  /* remove lock file */
+       unlink(lkinfo.curlock);  /* remove lock file */
 #else
        lockfile_remove(lkinfo.curlock);
 #endif /* HAVE_LIBLOCKFILE */
-       timerOFF (fd);  /* turn off lock timer   */
+       timerOFF(fd);  /* turn off lock timer   */
 #endif /* DOT_LOCKING */
 
-       return (close (fd));
+       return (close(fd));
 }
 
 
@@ -188,33 +188,33 @@ lkclose (int fd, char *file)
 */
 
 FILE *
-lkfopen (char *file, char *mode)
+lkfopen(char *file, char *mode)
 {
        int fd, access;
        FILE *fp;
 
-       if (strcmp (mode, "r") == 0)
+       if (strcmp(mode, "r") == 0)
                access = O_RDONLY;
-       else if (strcmp (mode, "r+") == 0)
+       else if (strcmp(mode, "r+") == 0)
                access = O_RDWR;
-       else if (strcmp (mode, "w") == 0)
+       else if (strcmp(mode, "w") == 0)
                access = O_WRONLY | O_CREAT | O_TRUNC;
-       else if (strcmp (mode, "w+") == 0)
+       else if (strcmp(mode, "w+") == 0)
                access = O_RDWR | O_CREAT | O_TRUNC;
-       else if (strcmp (mode, "a") == 0)
+       else if (strcmp(mode, "a") == 0)
                access = O_WRONLY | O_CREAT | O_APPEND;
-       else if (strcmp (mode, "a+") == 0)
+       else if (strcmp(mode, "a+") == 0)
                access = O_RDWR | O_CREAT | O_APPEND;
        else {
                errno = EINVAL;
                return NULL;
        }
 
-       if ((fd = lkopen (file, access, 0666)) == -1)
+       if ((fd = lkopen(file, access, 0666)) == -1)
                return NULL;
 
-       if ((fp = fdopen (fd, mode)) == NULL) {
-               close (fd);
+       if ((fp = fdopen(fd, mode)) == NULL) {
+               close(fd);
                return NULL;
        }
 
@@ -228,7 +228,7 @@ lkfopen (char *file, char *mode)
 */
 
 int
-lkfclose (FILE *fp, char *file)
+lkfclose(FILE *fp, char *file)
 {
 #ifdef FCNTL_LOCKING
        struct flock buf;
@@ -250,26 +250,26 @@ lkfclose (FILE *fp, char *file)
 #endif
 
 #ifdef FLOCK_LOCKING
-       flock (fileno(fp), LOCK_UN);
+       flock(fileno(fp), LOCK_UN);
 #endif
 
 #ifdef LOCKF_LOCKING
        /* make sure we unlock the whole thing */
-       fseek (fp, 0L, SEEK_SET);
-       lockf (fileno(fp), F_ULOCK, 0L);
+       fseek(fp, 0L, SEEK_SET);
+       lockf(fileno(fp), F_ULOCK, 0L);
 #endif
 
 #ifdef DOT_LOCKING
-       lockname (file, &lkinfo, 0);  /* get name of lock file */
+       lockname(file, &lkinfo, 0);  /* get name of lock file */
 #if !defined(HAVE_LIBLOCKFILE)
-       unlink (lkinfo.curlock);  /* remove lock file */
+       unlink(lkinfo.curlock);  /* remove lock file */
 #else
        lockfile_remove(lkinfo.curlock);
 #endif /* HAVE_LIBLOCKFILE */
-       timerOFF (fileno(fp));  /* turn off lock timer   */
+       timerOFF(fileno(fp));  /* turn off lock timer   */
 #endif /* DOT_LOCKING */
 
-       return (fclose (fp));
+       return (fclose(fp));
 }
 
 
@@ -280,7 +280,7 @@ lkfclose (FILE *fp, char *file)
 */
 
 static int
-lkopen_kernel (char *file, int access, mode_t mode)
+lkopen_kernel(char *file, int access, mode_t mode)
 {
        int fd, i, j;
 
@@ -307,7 +307,7 @@ lkopen_kernel (char *file, int access, mode_t mode)
                }
 # endif /* LOCKF_LOCKING || FCNTL_LOCKING */
 
-               if ((fd = open (file, access | O_NDELAY, mode)) == -1)
+               if ((fd = open(file, access | O_NDELAY, mode)) == -1)
                        return -1;
 
 # ifdef FCNTL_LOCKING
@@ -315,31 +315,31 @@ lkopen_kernel (char *file, int access, mode_t mode)
                buf.l_whence = SEEK_SET;
                buf.l_start  = 0;
                buf.l_len = 0;
-               if (fcntl (fd, F_SETLK, &buf) != -1)
+               if (fcntl(fd, F_SETLK, &buf) != -1)
                        return fd;
 # endif
 
 # ifdef FLOCK_LOCKING
-               if (flock (fd, (((access & 03) == O_RDONLY) ? LOCK_SH :
+               if (flock(fd, (((access & 03) == O_RDONLY) ? LOCK_SH :
                        LOCK_EX) | LOCK_NB) != -1)
                        return fd;
 # endif
 
 # ifdef LOCKF_LOCKING
-               if (lockf (fd, F_TLOCK, 0L) != -1) {
+               if (lockf(fd, F_TLOCK, 0L) != -1) {
                        /* see if we should be at the end */
                        if (j & O_APPEND)
-                               lseek (fd, (off_t) 0, SEEK_END);
+                               lseek(fd, (off_t) 0, SEEK_END);
                        return fd;
                }
 # endif
 
                j = errno;
-               close (fd);
-               sleep (5);
+               close(fd);
+               sleep(5);
        }
 
-       close (fd);
+       close(fd);
        errno = j;
        return -1;
 }
@@ -354,29 +354,29 @@ lkopen_kernel (char *file, int access, mode_t mode)
 */
 
 static int
-lkopen_dot (char *file, int access, mode_t mode)
+lkopen_dot(char *file, int access, mode_t mode)
 {
        int fd;
        struct lockinfo lkinfo;
 
        /* open the file */
-       if ((fd = open (file, access, mode)) == -1)
+       if ((fd = open(file, access, mode)) == -1)
                return -1;
 
        /*
        ** Get the name of the eventual lock file, as well
        ** as a name for a temporary lock file.
        */
-       lockname (file, &lkinfo, 1);
+       lockname(file, &lkinfo, 1);
 
 #if !defined(HAVE_LIBLOCKFILE)
        {
                int i;
                for (i = 0;;) {
                        /* attempt to create lock file */
-                       if (lockit (&lkinfo) == 0) {
+                       if (lockit(&lkinfo) == 0) {
                                /* if successful, turn on timer and return */
-                               timerON (lkinfo.curlock, fd);
+                               timerON(lkinfo.curlock, fd);
                                return fd;
                        } else {
                                /*
@@ -385,25 +385,25 @@ lkopen_dot (char *file, int access, mode_t mode)
                                ** lock file.
                                */
                                struct stat st;
-                               if (stat (lkinfo.curlock, &st) == -1) {
+                               if (stat(lkinfo.curlock, &st) == -1) {
                                        if (i++ > 5)
                                                return -1;
-                                       sleep (5);
+                                       sleep(5);
                                } else {
                                        time_t curtime;
                                        i = 0;
-                                       time (&curtime);
+                                       time(&curtime);
 
                                        /*
                                        ** check for stale lockfile,
                                        ** else sleep
                                        */
                                        if (curtime > st.st_ctime + RSECS)
-                                               unlink (lkinfo.curlock);
+                                               unlink(lkinfo.curlock);
                                        else
-                                               sleep (5);
+                                               sleep(5);
                                }
-                               lockname (file, &lkinfo, 1);
+                               lockname(file, &lkinfo, 1);
                        }
                }
        }
@@ -425,7 +425,7 @@ lkopen_dot (char *file, int access, mode_t mode)
 */
 
 static int
-lockit (struct lockinfo *li)
+lockit(struct lockinfo *li)
 {
        int fd;
        char *curlock, *tmplock;
@@ -452,11 +452,11 @@ lockit (struct lockinfo *li)
 
 #if 0
        /* write our process id into lock file */
-       snprintf (buffer, sizeof(buffer), "nmh lock: pid %d\n", (int) getpid());
+       snprintf(buffer, sizeof(buffer), "nmh lock: pid %d\n", (int) getpid());
        write(fd, buffer, strlen(buffer) + 1);
 #endif
 
-       close (fd);
+       close(fd);
 
        /*
        ** Now try to create the real lock file
@@ -474,7 +474,7 @@ lockit (struct lockinfo *li)
 */
 
 static void
-lockname (char *file, struct lockinfo *li, int isnewlock)
+lockname(char *file, struct lockinfo *li, int isnewlock)
 {
        int bplen, tmplen;
        char *bp, *cp;
@@ -483,20 +483,20 @@ lockname (char *file, struct lockinfo *li, int isnewlock)
        struct stat st;
 #endif
 
-       if ((cp = strrchr (file, '/')) == NULL || *++cp == 0)
+       if ((cp = strrchr(file, '/')) == NULL || *++cp == 0)
                cp = file;
 
        bp = li->curlock;
        bplen = 0;
 #ifdef LOCKDIR
-       snprintf (bp, sizeof(li->curlock), "%s/", lockdir);
-       tmplen = strlen (bp);
+       snprintf(bp, sizeof(li->curlock), "%s/", lockdir);
+       tmplen = strlen(bp);
        bp += tmplen;
        bplen += tmplen;
 #else
        if (cp != file) {
-               snprintf (bp, sizeof(li->curlock), "%.*s", (int)(cp - file), file);
-               tmplen = strlen (bp);
+               snprintf(bp, sizeof(li->curlock), "%.*s", (int)(cp - file), file);
+               tmplen = strlen(bp);
                bp += tmplen;
                bplen += tmplen;
        }
@@ -508,14 +508,14 @@ lockname (char *file, struct lockinfo *li, int isnewlock)
        ** If we start supporting mmdf style dot locking,
        ** we will need to change the return value of lockname
        */
-       if (stat (file, &st) == -1)
+       if (stat(file, &st) == -1)
                return -1;
 
-       snprintf (bp, sizeof(li->curlock) - bplen, "LCK%05d.%05d",
+       snprintf(bp, sizeof(li->curlock) - bplen, "LCK%05d.%05d",
                st.st_dev, st.st_ino);
 #endif
 
-       snprintf (bp, sizeof(li->curlock) - bplen, "%s.lock", cp);
+       snprintf(bp, sizeof(li->curlock) - bplen, "%s.lock", cp);
 
 #if !defined(HAVE_LIBLOCKFILE)
        /*
@@ -523,11 +523,12 @@ lockname (char *file, struct lockinfo *li, int isnewlock)
        ** the temporary lock file for lockit()
        */
        if (isnewlock) {
-               if ((cp = strrchr (li->curlock, '/')) == NULL || *++cp == 0)
-                       strncpy (li->tmplock, ",LCK.XXXXXX", sizeof(li->tmplock));
+               if ((cp = strrchr(li->curlock, '/')) == NULL || *++cp == 0)
+                       strncpy(li->tmplock, ",LCK.XXXXXX", sizeof(li->tmplock));
                else
-                       snprintf (li->tmplock, sizeof(li->tmplock), "%.*s,LCK.XXXXXX",
-                                (int)(cp - li->curlock), li->curlock);
+                       snprintf(li->tmplock, sizeof(li->tmplock),
+                                       "%.*s,LCK.XXXXXX",
+                                       (int)(cp - li->curlock), li->curlock);
        }
 #endif
 }
@@ -539,23 +540,23 @@ lockname (char *file, struct lockinfo *li, int isnewlock)
 */
 
 static void
-timerON (char *curlock, int fd)
+timerON(char *curlock, int fd)
 {
        struct lock *lp;
        size_t len;
 
-       lp = (struct lock *) mh_xmalloc (sizeof(*lp));
+       lp = (struct lock *) mh_xmalloc(sizeof(*lp));
 
        len = strlen(curlock) + 1;
        lp->l_fd = fd;
-       lp->l_lock = mh_xmalloc (len);
-       memcpy (lp->l_lock, curlock, len);
+       lp->l_lock = mh_xmalloc(len);
+       memcpy(lp->l_lock, curlock, len);
        lp->l_next = l_top;
 
        if (!l_top) {
                /* perhaps SIGT{STP,TIN,TOU} ? */
-               SIGNAL (SIGALRM, alrmser);
-               alarm (NSECS);
+               SIGNAL(SIGALRM, alrmser);
+               alarm(NSECS);
        }
 
        l_top = lp;
@@ -568,7 +569,7 @@ timerON (char *curlock, int fd)
 */
 
 static void
-timerOFF (int fd)
+timerOFF(int fd)
 {
        struct lock *pp, *lp;
 
@@ -585,14 +586,14 @@ timerOFF (int fd)
                        else
                                pp->l_next = lp->l_next;
 
-                       free (lp->l_lock);
-                       free (lp);
+                       free(lp->l_lock);
+                       free(lp);
                }
        }
 
        /* if there are locks left, restart timer */
        if (l_top)
-               alarm (NSECS);
+               alarm(NSECS);
 }
 
 
@@ -602,13 +603,13 @@ timerOFF (int fd)
 */
 
 static RETSIGTYPE
-alrmser (int sig)
+alrmser(int sig)
 {
        char *lockfile;
        struct lock *lp;
 
 #ifndef RELIABLE_SIGNALS
-       SIGNAL (SIGALRM, alrmser);
+       SIGNAL(SIGALRM, alrmser);
 #endif
 
        /* update the ctime of all the lock files */
@@ -617,8 +618,8 @@ alrmser (int sig)
 #if !defined(HAVE_LIBLOCKFILE)
                {
                        int j;
-                       if (*lockfile && (j = creat (lockfile, 0600)) != -1)
-                               close (j);
+                       if (*lockfile && (j = creat(lockfile, 0600)) != -1)
+                               close(j);
                }
 #else
        lockfile_touch(lockfile);
@@ -626,7 +627,7 @@ alrmser (int sig)
        }
 
        /* restart the alarm */
-       alarm (NSECS);
+       alarm(NSECS);
 }
 
 #endif /* DOT_LOCKING */
index 0222533..03bf0d0 100644 (file)
@@ -12,7 +12,7 @@
 
 
 int
-m_atoi (char *str)
+m_atoi(char *str)
 {
        int i;
        unsigned char *cp;
index e8c5566..17f7ad5 100644 (file)
@@ -10,7 +10,7 @@
 
 
 char *
-m_backup (char *file)
+m_backup(char *file)
 {
        char *cp;
        static char buffer[BUFSIZ];
index cd18406..89da537 100644 (file)
@@ -29,19 +29,19 @@ static char *delimp;
 /*
 ** static prototypes
 */
-static int m_conv (struct msgs *, char *, int);
-static int attr (struct msgs *, char *);
+static int m_conv(struct msgs *, char *, int);
+static int attr(struct msgs *, char *);
 
 
 int
-m_convert (struct msgs *mp, char *name)
+m_convert(struct msgs *mp, char *name)
 {
        int first, last, found, range, err;
        unsigned char *bp;
        char *cp;
 
        /* check if user defined sequence */
-       err = attr (mp, cp = name);
+       err = attr(mp, cp = name);
 
        if (err == -1)
                return 0;
@@ -59,57 +59,57 @@ m_convert (struct msgs *mp, char *name)
        ** Check for special "new" sequence, which
        ** is valid only if ALLOW_NEW is set.
        */
-       if ((mp->msgflags & ALLOW_NEW) && !strcmp (cp, "new")) {
-               if ((err = first = getnew (mp)) <= 0)
+       if ((mp->msgflags & ALLOW_NEW) && !strcmp(cp, "new")) {
+               if ((err = first = getnew(mp)) <= 0)
                        goto badmsg;
                else
                        goto single;
        }
 
-       if (!strcmp (cp, "all"))
+       if (!strcmp(cp, "all"))
                cp = "first-last";
 
-       if ((err = first = m_conv (mp, cp, FIRST)) <= 0)
+       if ((err = first = m_conv(mp, cp, FIRST)) <= 0)
                goto badmsg;
 
        cp = delimp;
        if (*cp != '\0' && *cp != '-' && *cp != ':') {
 badelim:
-               advise (NULL, "illegal argument delimiter: `%c'(0%o)",
+               advise(NULL, "illegal argument delimiter: `%c'(0%o)",
                                *delimp, *delimp);
                return 0;
        }
 
        if (*cp == '-') {
                cp++;
-               if ((err = last = m_conv (mp, cp, LAST)) <= 0) {
+               if ((err = last = m_conv(mp, cp, LAST)) <= 0) {
 badmsg:
                        switch (err) {
                        case BADMSG:
-                               advise (NULL, "no %s message", cp);
+                               advise(NULL, "no %s message", cp);
                                break;
 
                        case BADNUM:
-                               advise (NULL, "message %s doesn't exist", cp);
+                               advise(NULL, "message %s doesn't exist", cp);
                                break;
 
                        case BADRNG:
-                               advise (NULL, "message %s out of range 1-%d",
+                               advise(NULL, "message %s out of range 1-%d",
                                                cp, mp->hghmsg);
                                break;
 
                        case BADLST:
 badlist:
-                               advise (NULL, "bad message list %s", name);
+                               advise(NULL, "bad message list %s", name);
                                break;
 
                        case BADNEW:
-                               advise (NULL, "folder full, no %s message",
+                               advise(NULL, "folder full, no %s message",
                                                name);
                                break;
 
                        default:
-                               advise (NULL, "no messages match specification");
+                               advise(NULL, "no messages match specification");
                        }
                        return 0;
                }
@@ -120,7 +120,7 @@ badlist:
                        goto badelim;
                if (first > mp->hghmsg || last < mp->lowmsg) {
 rangerr:
-                       advise (NULL, "no messages in range %s", name);
+                       advise(NULL, "no messages in range %s", name);
                        return 0;
                }
 
@@ -139,9 +139,9 @@ rangerr:
                        convdir = 1;
                        cp++;
                }
-               if ((range = atoi (bp = cp)) == 0)
+               if ((range = atoi(bp = cp)) == 0)
                        goto badlist;
-               while (isdigit (*bp))
+               while (isdigit(*bp))
                        bp++;
                if (*bp)
                        goto badelim;
@@ -157,7 +157,7 @@ rangerr:
 
                for (last = first; last >= mp->lowmsg && last <= mp->hghmsg;
                        last += convdir)
-                       if (does_exist (mp, last))
+                       if (does_exist(mp, last))
                                if (--range <= 0)
                                        break;
                if (last < mp->lowmsg)
@@ -180,15 +180,15 @@ single:
                ** check if message is in-range and exists.
                */
                if (mp->msgflags & ALLOW_NEW) {
-                       set_select_empty (mp, first);
+                       set_select_empty(mp, first);
                } else {
                        if (first > mp->hghmsg
                                || first < mp->lowmsg
-                               || !(does_exist (mp, first))) {
-                               if (!strcmp (name, "cur") || !strcmp (name, "."))
-                                       advise (NULL, "no %s message", name);
+                               || !(does_exist(mp, first))) {
+                               if (!strcmp(name, "cur") || !strcmp(name, "."))
+                                       advise(NULL, "no %s message", name);
                                else
-                                       advise (NULL, "message %d doesn't exist", first);
+                                       advise(NULL, "message %d doesn't exist", first);
                                return 0;
                        }
                }
@@ -201,10 +201,10 @@ single:
        ** if we are selecting an empty slot.
        */
        for (; first <= last; first++) {
-               if (does_exist (mp, first) ||
-                       ((mp->msgflags & ALLOW_NEW) && is_select_empty (mp, first))) {
-                       if (!is_selected (mp, first)) {
-                               set_selected (mp, first);
+               if (does_exist(mp, first) ||
+                       ((mp->msgflags & ALLOW_NEW) && is_select_empty(mp, first))) {
+                       if (!is_selected(mp, first)) {
+                               set_selected(mp, first);
                                mp->numsel++;
                                if (mp->lowsel == 0 || first < mp->lowsel)
                                        mp->lowsel = first;
@@ -235,7 +235,7 @@ single:
 */
 
 static int
-m_conv (struct msgs *mp, char *str, int call)
+m_conv(struct msgs *mp, char *str, int call)
 {
        register int i;
        register unsigned char *cp, *bp;
@@ -243,11 +243,11 @@ m_conv (struct msgs *mp, char *str, int call)
 
        convdir = 1;
        cp = bp = str;
-       if (isdigit (*cp)) {
-               while (isdigit (*bp))
+       if (isdigit(*cp)) {
+               while (isdigit(*bp))
                        bp++;
                delimp = bp;
-               i = atoi (cp);
+               i = atoi(cp);
 
                if (i <= mp->hghmsg)
                        return i;
@@ -273,32 +273,32 @@ m_conv (struct msgs *mp, char *str, int call)
        *bp++ = '\0';
        delimp = cp;
 
-       if (!strcmp (buf, "first"))
+       if (!strcmp(buf, "first"))
                return (mp->hghmsg || !(mp->msgflags & ALLOW_NEW)
                                ? mp->lowmsg : BADMSG);
 
-       if (!strcmp (buf, "last")) {
+       if (!strcmp(buf, "last")) {
                convdir = -1;
                return (mp->hghmsg || !(mp->msgflags & ALLOW_NEW) ? mp->hghmsg : BADMSG);
        }
 
-       if (!strcmp (buf, "cur") || !strcmp (buf, "."))
+       if (!strcmp(buf, "cur") || !strcmp(buf, "."))
                return (mp->curmsg > 0 ? mp->curmsg : BADMSG);
 
-       if (!strcmp (buf, "prev")) {
+       if (!strcmp(buf, "prev")) {
                convdir = -1;
                for (i = (mp->curmsg <= mp->hghmsg) ? mp->curmsg - 1 : mp->hghmsg;
                        i >= mp->lowmsg; i--) {
-                       if (does_exist (mp, i))
+                       if (does_exist(mp, i))
                                return i;
                }
                return BADMSG;
        }
 
-       if (!strcmp (buf, "next")) {
+       if (!strcmp(buf, "next")) {
                for (i = (mp->curmsg >= mp->lowmsg) ? mp->curmsg + 1 : mp->lowmsg;
                        i <= mp->hghmsg; i++) {
-                       if (does_exist (mp, i))
+                       if (does_exist(mp, i))
                                return i;
                }
                return BADMSG;
@@ -322,7 +322,7 @@ m_conv (struct msgs *mp, char *str, int call)
 */
 
 static int
-attr (struct msgs *mp, char *cp)
+attr(struct msgs *mp, char *cp)
 {
        register unsigned char *dp;
        char *bp = NULL;
@@ -333,15 +333,15 @@ attr (struct msgs *mp, char *cp)
        int first = 0;
 
        /* hack for "cur-name", "cur-n", etc. */
-       if (!strcmp (cp, "cur"))
+       if (!strcmp(cp, "cur"))
                return 0;
-       if (ssequal ("cur:", cp))  /* this code need to be rewritten... */
+       if (ssequal("cur:", cp))  /* this code need to be rewritten... */
                return 0;
 
        /* Check for sequence negation */
-       if ((dp = context_find (nsequence)) && *dp != '\0' && ssequal (dp, cp)) {
+       if ((dp = context_find(nsequence)) && *dp != '\0' && ssequal(dp, cp)) {
                inverted = 1;
-               cp += strlen (dp);
+               cp += strlen(dp);
        }
 
        convdir = 1;  /* convert direction */
@@ -359,18 +359,18 @@ attr (struct msgs *mp, char *cp)
                ** seq:first (or)
                ** seq:last
                */
-               if (isalpha (*dp)) {
-                       if (!strcmp (dp, "prev")) {
+               if (isalpha(*dp)) {
+                       if (!strcmp(dp, "prev")) {
                                convdir = -1;
                                first = (mp->curmsg > 0) && (mp->curmsg <= mp->hghmsg)
                                        ? mp->curmsg - 1 : mp->hghmsg;
-                       } else if (!strcmp (dp, "next")) {
+                       } else if (!strcmp(dp, "next")) {
                                convdir = 1;
                                first = (mp->curmsg >= mp->lowmsg)
                                        ? mp->curmsg + 1 : mp->lowmsg;
-                       } else if (!strcmp (dp, "first")) {
+                       } else if (!strcmp(dp, "first")) {
                                convdir = 1;
-                       } else if (!strcmp (dp, "last")) {
+                       } else if (!strcmp(dp, "last")) {
                                convdir = -1;
                        } else
                                return BADLST;
@@ -388,7 +388,7 @@ attr (struct msgs *mp, char *cp)
                        }
                        if ((range = atoi(dp)) == 0)
                                return BADLST;
-                       while (isdigit (*dp))
+                       while (isdigit(*dp))
                                dp++;
                        if (*dp)
                                return BADLST;
@@ -397,7 +397,7 @@ attr (struct msgs *mp, char *cp)
                *bp = '\0';  /* temporarily terminate sequence name */
        }
 
-       i = seq_getnum (mp, cp);  /* get index of sequence */
+       i = seq_getnum(mp, cp);  /* get index of sequence */
 
        if (bp)
                *bp = ':';  /* restore sequence name */
@@ -408,10 +408,10 @@ attr (struct msgs *mp, char *cp)
 
        for (j = first ? first : (convdir > 0) ? mp->lowmsg : mp->hghmsg;
                j >= mp->lowmsg && j <= mp->hghmsg; j += convdir) {
-               if (does_exist (mp, j)
-                       && inverted ? !in_sequence (mp, i, j) : in_sequence (mp, i, j)) {
-                       if (!is_selected (mp, j)) {
-                               set_selected (mp, j);
+               if (does_exist(mp, j)
+                       && inverted ? !in_sequence(mp, i, j) : in_sequence(mp, i, j)) {
+                       if (!is_selected(mp, j)) {
+                               set_selected(mp, j);
                                mp->numsel++;
                                if (mp->lowsel == 0 || j < mp->lowsel)
                                        mp->lowsel = j;
@@ -434,6 +434,6 @@ attr (struct msgs *mp, char *cp)
 
        if (first)
                return BADMSG;
-       advise (NULL, "sequence %s %s", cp, inverted ? "full" : "empty");
+       advise(NULL, "sequence %s %s", cp, inverted ? "full" : "empty");
        return -1;
 }
index 845fb96..3920315 100644 (file)
@@ -24,19 +24,19 @@ m_draft(char *which)
        char *folder;
 
        cp = draftfolder;
-       folder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
+       folder = path(*cp == '+' || *cp == '@' ? cp + 1 : cp,
                        *cp != '@' ? TFOLDER : TSUBCWF);
 
-       chdir (m_maildir (""));
-       strncpy (buffer, m_maildir (folder), sizeof(buffer));
+       chdir(m_maildir(""));
+       strncpy(buffer, m_maildir(folder), sizeof(buffer));
 
-       create_folder (buffer, 0, done);
+       create_folder(buffer, 0, done);
 
-       if (chdir (buffer) == -1)
-               adios (buffer, "unable to change directory to");
+       if (chdir(buffer) == -1)
+               adios(buffer, "unable to change directory to");
 
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /*
        ** Make sure we have enough message status space for all
@@ -45,11 +45,11 @@ m_draft(char *which)
        ** end, go ahead and add 10 additional slots.
        */
        if (mp->hghmsg >= mp->hghoff) {
-               if (!(mp = folder_realloc (mp, 1, mp->hghmsg + 10)))
-                       adios (NULL, "unable to allocate folder storage");
+               if (!(mp = folder_realloc(mp, 1, mp->hghmsg + 10)))
+                       adios(NULL, "unable to allocate folder storage");
        } else if (mp->lowoff > 1) {
-               if (!(mp = folder_realloc (mp, 1, mp->hghoff)))
-                       adios (NULL, "unable to allocate folder storage");
+               if (!(mp = folder_realloc(mp, 1, mp->hghoff)))
+                       adios(NULL, "unable to allocate folder storage");
        }
 
        mp->msgflags |= ALLOW_NEW;  /* allow the "new" sequence */
@@ -59,15 +59,15 @@ m_draft(char *which)
        ** Usually it is "cur" (for the current draft) or "new"
        ** (to start a new draft).
        */
-       if (!m_convert (mp, which))
-               done (1);
-       seq_setprev (mp);
+       if (!m_convert(mp, which))
+               done(1);
+       seq_setprev(mp);
 
-       snprintf (buffer, sizeof(buffer), "%s/%s", mp->foldpath,
-                       m_name (mp->lowsel));
-       seq_setcur (mp, mp->lowsel);
-       seq_save (mp);
-       folder_free (mp);
+       snprintf(buffer, sizeof(buffer), "%s/%s", mp->foldpath,
+                       m_name(mp->lowsel));
+       seq_setcur(mp, mp->lowsel);
+       seq_save(mp);
+       folder_free(mp);
 
        return buffer;
 }
index 1ce52b6..26707a2 100644 (file)
@@ -42,7 +42,7 @@
 ** This worked fine, until one day: a message with no body portion arrived.
 ** Then the
 **
-**                 while (eom (c = Getc (iob), iob))
+**                 while (eom(c = Getc(iob), iob))
 **                      continue;
 **
 ** loop caused m_getfld() to return FMTERR.  So, that logic was changed to
 /*
 ** static prototypes
 */
-static int m_Eom (int, FILE *);
+static int m_Eom(int, FILE *);
 static unsigned char *matchc(int, char *, int, char *);
 static unsigned char *locc(int, unsigned char *, unsigned char);
 
@@ -207,7 +207,7 @@ extern int  _filbuf(FILE*);
 
 
 int
-m_getfld (int state, unsigned char *name, unsigned char *buf,
+m_getfld(int state, unsigned char *name, unsigned char *buf,
        int bufsz, FILE *iob)
 {
        register unsigned char  *bp, *cp, *ep, *sp;
@@ -218,10 +218,10 @@ m_getfld (int state, unsigned char *name, unsigned char *buf,
                *buf = 0;
                return FILEEOF;
        }
-       if (eom (c, iob)) {
+       if (eom(c, iob)) {
                if (! eom_action) {
                        /* flush null messages */
-                       while ((c = Getc(iob)) >= 0 && eom (c, iob))
+                       while ((c = Getc(iob)) >= 0 && eom(c, iob))
                                ;
                        if (c >= 0)
                                ungetc(c, iob);
@@ -240,10 +240,10 @@ m_getfld (int state, unsigned char *name, unsigned char *buf,
                                while (c != '\n' && (c = Getc(iob)) >= 0)
                                        ;
 
-                               if (c < 0 || (c = Getc(iob)) < 0 || eom (c, iob)) {
+                               if (c < 0 || (c = Getc(iob)) < 0 || eom(c, iob)) {
                                        if (! eom_action) {
                                                /* flush null messages */
-                                               while ((c = Getc(iob)) >= 0 && eom (c, iob))
+                                               while ((c = Getc(iob)) >= 0 && eom(c, iob))
                                                        ;
                                                if (c >= 0)
                                                        ungetc(c, iob);
@@ -288,7 +288,7 @@ m_getfld (int state, unsigned char *name, unsigned char *buf,
                                        if (_filbuf(iob) == EOF) {
 #endif
                                                *cp = *buf = 0;
-                                               advise (NULL, "eof encountered in field \"%s\"", name);
+                                               advise(NULL, "eof encountered in field \"%s\"", name);
                                                return FMTERR;
                                        }
 #ifdef LINUX_STDIO
@@ -339,11 +339,11 @@ m_getfld (int state, unsigned char *name, unsigned char *buf,
                                                ** guess we'll blow up.
                                                */
                                                *cp = *buf = 0;
-                                               advise (NULL, "eol encountered in field \"%s\"", name);
+                                               advise(NULL, "eol encountered in field \"%s\"", name);
                                                state = FMTERR;
                                                goto finish;
                                        }
-                                       memcpy (buf, name, j - 1);
+                                       memcpy(buf, name, j - 1);
                                        buf[j - 1] = '\n';
                                        buf[j] = '\0';
                                        /*
@@ -360,18 +360,18 @@ m_getfld (int state, unsigned char *name, unsigned char *buf,
                                        ** should be harmless enough, right?
                                        ** This is a corrupt message anyway.
                                        */
-                                       fseek (iob, ftell (iob) - 2, SEEK_SET);
+                                       fseek(iob, ftell(iob) - 2, SEEK_SET);
                                        return BODY;
                                }
                                if ((i -= j) <= 0) {
                                        *cp = *buf = 0;
-                                       advise (NULL, "field name \"%s\" exceeds %d bytes", name, NAMESZ - 2);
+                                       advise(NULL, "field name \"%s\" exceeds %d bytes", name, NAMESZ - 2);
                                        state = LENERR;
                                        goto finish;
                                }
                        }
 
-                       while (isspace (*--cp) && cp >= name)
+                       while (isspace(*--cp) && cp >= name)
                                ;
                        *++cp = 0;
                        /* fall through */
@@ -403,16 +403,16 @@ m_getfld (int state, unsigned char *name, unsigned char *buf,
                                        if ((j = *++ep) != ' ' && j != '\t') {
 #ifdef LINUX_STDIO
                                                j = ep - (unsigned char *) iob->_IO_read_ptr;
-                                               memcpy (cp, iob->_IO_read_ptr, j);
+                                               memcpy(cp, iob->_IO_read_ptr, j);
                                                iob->_IO_read_ptr = ep;
 #elif defined(__DragonFly__)
                                                j = ep - (unsigned char *) ((struct __FILE_public *)iob)->_p;
-                                               memcpy (cp, ((struct __FILE_public *)iob)->_p, j);
+                                               memcpy(cp, ((struct __FILE_public *)iob)->_p, j);
                                                ((struct __FILE_public *)iob)->_p = ep;
                                                ((struct __FILE_public *)iob)->_r -= j;
 #else
                                                j = ep - (unsigned char *) iob->_ptr;
-                                               memcpy (cp, iob->_ptr, j);
+                                               memcpy(cp, iob->_ptr, j);
                                                iob->_ptr = ep;
                                                iob->_cnt -= j;
 #endif
@@ -429,13 +429,13 @@ m_getfld (int state, unsigned char *name, unsigned char *buf,
                                */
 #ifdef LINUX_STDIO
                                c += bp - (unsigned char *) iob->_IO_read_ptr;
-                               memcpy( cp, iob->_IO_read_ptr, c);
+                               memcpy(cp, iob->_IO_read_ptr, c);
 #elif defined(__DragonFly__)
                                c += bp - (unsigned char *) ((struct __FILE_public *)iob)->_p;
-                               memcpy( cp, ((struct __FILE_public *)iob)->_p, c);
+                               memcpy(cp, ((struct __FILE_public *)iob)->_p, c);
 #else
                                c += bp - (unsigned char *) iob->_ptr;
-                               memcpy( cp, iob->_ptr, c);
+                               memcpy(cp, iob->_ptr, c);
 #endif
                                i -= c;
                                cp += c;
@@ -628,7 +628,7 @@ m_getfld (int state, unsigned char *name, unsigned char *buf,
                        break;
 
                default:
-                       adios (NULL, "m_getfld() called with bogus state of %d", state);
+                       adios(NULL, "m_getfld() called with bogus state of %d", state);
        }
 finish:
        *cp = 0;
@@ -665,29 +665,29 @@ m_unknown(FILE *iob)
 
        msg_style = MS_UNKNOWN;
 
-       pos = ftell (iob);
-       if (fread (text, sizeof(*text), 5, iob) == 5
-               && strncmp (text, "From ", 5) == 0) {
+       pos = ftell(iob);
+       if (fread(text, sizeof(*text), 5, iob) == 5
+               && strncmp(text, "From ", 5) == 0) {
                msg_style = MS_MBOX;
                delimstr = "\nFrom ";
 #ifndef RPATHS
-               while ((c = getc (iob)) != '\n' && c >= 0)
+               while ((c = getc(iob)) != '\n' && c >= 0)
                        ;
 #else /* RPATHS */
                cp = unixbuf;
-               while ((c = getc (iob)) != '\n' && cp - unixbuf < BUFSIZ - 1)
+               while ((c = getc(iob)) != '\n' && cp - unixbuf < BUFSIZ - 1)
                        *cp++ = c;
                *cp = 0;
 #endif /* RPATHS */
        } else {
                /* not a Unix style maildrop */
-               fseek (iob, pos, SEEK_SET);
+               fseek(iob, pos, SEEK_SET);
                if (mmdlm2 == NULL || *mmdlm2 == 0)
                        mmdlm2 = "\001\001\001\001\n";
                delimstr = mmdlm2;
                msg_style = MS_MMDF;
        }
-       c = strlen (delimstr);
+       c = strlen(delimstr);
        fdelim = (unsigned char *) mh_xmalloc((size_t) (c + 3));
        *fdelim++ = '\0';
        *fdelim = '\n';
@@ -695,24 +695,24 @@ m_unknown(FILE *iob)
        edelim = (unsigned char *)msg_delim+1;
        fdelimlen = c + 1;
        edelimlen = c - 1;
-       strcpy (msg_delim, delimstr);
+       strcpy(msg_delim, delimstr);
        delimend = (unsigned char *)msg_delim + edelimlen;
        if (edelimlen <= 1)
-               adios (NULL, "maildrop delimiter must be at least 2 bytes");
+               adios(NULL, "maildrop delimiter must be at least 2 bytes");
        /*
        ** build a Boyer-Moore end-position map for the matcher in m_getfld.
        ** N.B. - we don't match just the first char (since it's the newline
        ** separator) or the last char (since the matchc would have found it
        ** if it was a real delim).
        */
-       pat_map = (unsigned char **) calloc (256, sizeof(unsigned char *));
+       pat_map = (unsigned char **) calloc(256, sizeof(unsigned char *));
 
        for (cp = (char *) fdelim + 1; cp < (char *) delimend; cp++ )
                pat_map[(unsigned char)*cp] = (unsigned char *) cp;
 
        if (msg_style == MS_MMDF) {
                /* flush extra msg hdrs */
-               while ((c = Getc(iob)) >= 0 && eom (c, iob))
+               while ((c = Getc(iob)) >= 0 && eom(c, iob))
                        ;
                if (c >= 0)
                        ungetc(c, iob);
@@ -725,7 +725,7 @@ m_unknown(FILE *iob)
 */
 
 static int
-m_Eom (int c, FILE *iob)
+m_Eom(int c, FILE *iob)
 {
        register long pos = 0L;
        register int i;
@@ -734,9 +734,9 @@ m_Eom (int c, FILE *iob)
        register char *cp;
 #endif /* RPATHS */
 
-       pos = ftell (iob);
-       if ((i = fread (text, sizeof *text, edelimlen, iob)) != edelimlen
-               || strncmp (text, (char *)edelim, edelimlen)) {
+       pos = ftell(iob);
+       if ((i = fread(text, sizeof *text, edelimlen, iob)) != edelimlen
+               || strncmp(text, (char *)edelim, edelimlen)) {
                if (i == 0 && msg_style == MS_MBOX)
                        /*
                        ** the final newline in the (brain damaged) unix-format
@@ -745,22 +745,22 @@ m_Eom (int c, FILE *iob)
                        return 1;
 
 #if 0
-               fseek (iob, pos, SEEK_SET);
+               fseek(iob, pos, SEEK_SET);
 #endif
 
-               fseek (iob, (long)(pos-1), SEEK_SET);
-               getc (iob);  /* should be OK */
+               fseek(iob, (long)(pos-1), SEEK_SET);
+               getc(iob);  /* should be OK */
                return 0;
        }
 
        if (msg_style == MS_MBOX) {
 #ifndef RPATHS
-               while ((c = getc (iob)) != '\n')
+               while ((c = getc(iob)) != '\n')
                        if (c < 0)
                                break;
 #else /* RPATHS */
                cp = unixbuf;
-               while ((c = getc (iob)) != '\n' && c >= 0 && cp - unixbuf < BUFSIZ - 1)
+               while ((c = getc(iob)) != '\n' && c >= 0 && cp - unixbuf < BUFSIZ - 1)
                        *cp++ = c;
                *cp = 0;
 #endif /* RPATHS */
@@ -783,7 +783,7 @@ m_Eom (int c, FILE *iob)
 */
 
 int
-get_returnpath (char *rp, int rplen, char *dd, int ddlen)
+get_returnpath(char *rp, int rplen, char *dd, int ddlen)
 {
        char *ap, *bp, *cp, *dp;
 
@@ -796,8 +796,8 @@ get_returnpath (char *rp, int rplen, char *dd, int ddlen)
        ** if this message uses UUCP style addressing
        */
        while ((cp = strchr(++cp, 'r'))) {
-               if (strncmp (cp, "remote from", 11) == 0) {
-                       cp = strrchr (cp, ' ');
+               if (strncmp(cp, "remote from", 11) == 0) {
+                       cp = strrchr(cp, ' ');
                        break;
                }
        }
@@ -808,11 +808,11 @@ get_returnpath (char *rp, int rplen, char *dd, int ddlen)
        */
        if (cp) {
                /* return path for UUCP style addressing */
-               dp = strchr (++cp, '\n');
-               snprintf (rp, rplen, "%.*s!%.*s\n", (int)(dp - cp), cp, (int)(bp - ap), ap);
+               dp = strchr(++cp, '\n');
+               snprintf(rp, rplen, "%.*s!%.*s\n", (int)(dp - cp), cp, (int)(bp - ap), ap);
        } else {
                /* return path for standard domain addressing */
-               snprintf (rp, rplen, "%.*s\n", (int)(bp - ap), ap);
+               snprintf(rp, rplen, "%.*s\n", (int)(bp - ap), ap);
        }
 
        /*
@@ -823,7 +823,7 @@ get_returnpath (char *rp, int rplen, char *dd, int ddlen)
                bp++;
 
        /* Now get delivery date from envelope */
-       snprintf (dd, ddlen, "%.*s\n", 24, bp);
+       snprintf(dd, ddlen, "%.*s\n", 24, bp);
 
        unixbuf[0] = 0;
        return 1;
index 999e6f7..9c86e77 100644 (file)
@@ -10,9 +10,9 @@
 
 
 int
-m_gmprot (void)
+m_gmprot(void)
 {
        register char *cp;
 
-       return atooi ((cp = context_find ("msg-protect")) && *cp ? cp : msgprot);
+       return atooi ((cp = context_find("msg-protect")) && *cp ? cp : msgprot);
 }
index 1ba21c8..95f72af 100644 (file)
@@ -20,16 +20,16 @@ static char mailfold[BUFSIZ];
 /*
 ** static prototypes
 */
-static char *exmaildir (char *);
+static char *exmaildir(char *);
 
 
 char *
-m_maildir (char *folder)
+m_maildir(char *folder)
 {
        register char *cp, *ep;
 
-       if ((cp = exmaildir (folder))
-               && (ep = cp + strlen (cp) - 1) > cp
+       if ((cp = exmaildir(folder))
+               && (ep = cp + strlen(cp) - 1) > cp
                && *ep == '/')
                *ep = '\0';
 
@@ -38,21 +38,21 @@ m_maildir (char *folder)
 
 
 char *
-m_mailpath (char *folder)
+m_mailpath(char *folder)
 {
        register char *cp;
        char maildir[BUFSIZ];
 
        if (*folder != '/'
-               && strncmp (folder, CWD, NCWD)
-               && strcmp (folder, DOT)
-               && strcmp (folder, DOTDOT)
-               && strncmp (folder, PWD, NPWD)) {
-               strncpy (maildir, mailfold, sizeof(maildir));  /* preserve... */
-               cp = getcpy (m_maildir (folder));
-               strncpy (mailfold, maildir, sizeof(mailfold));
+               && strncmp(folder, CWD, NCWD)
+               && strcmp(folder, DOT)
+               && strcmp(folder, DOTDOT)
+               && strncmp(folder, PWD, NPWD)) {
+               strncpy(maildir, mailfold, sizeof(maildir));  /* preserve... */
+               cp = getcpy(m_maildir(folder));
+               strncpy(mailfold, maildir, sizeof(mailfold));
        } else {
-               cp = path (folder, TFOLDER);
+               cp = path(folder, TFOLDER);
        }
 
        return cp;
@@ -60,7 +60,7 @@ m_mailpath (char *folder)
 
 
 static char *
-exmaildir (char *folder)
+exmaildir(char *folder)
 {
        register char *cp, *pp;
 
@@ -68,28 +68,26 @@ exmaildir (char *folder)
        if (folder == NULL)
                folder = getfolder(1);
 
-       if (!(*folder != '/'
-               && strncmp (folder, CWD, NCWD)
-               && strcmp (folder, DOT)
-               && strcmp (folder, DOTDOT)
-               && strncmp (folder, PWD, NPWD))) {
-               strncpy (mailfold, folder, sizeof(mailfold));
+       if (!(*folder != '/' && strncmp(folder, CWD, NCWD)
+                       && strcmp(folder, DOT) && strcmp(folder, DOTDOT)
+                       && strncmp(folder, PWD, NPWD))) {
+               strncpy(mailfold, folder, sizeof(mailfold));
                return mailfold;
        }
 
        cp = mailfold;
-       if ((pp = context_find ("path")) && *pp) {
+       if ((pp = context_find("path")) && *pp) {
                if (*pp != '/') {
-                       sprintf (cp, "%s/", mypath);
-                       cp += strlen (cp);
+                       sprintf(cp, "%s/", mypath);
+                       cp += strlen(cp);
                }
-               cp = copy (pp, cp);
+               cp = copy(pp, cp);
        } else {
-               cp = copy (path ("./", TFOLDER), cp);
+               cp = copy(path("./", TFOLDER), cp);
        }
        if (cp[-1] != '/')
                *cp++ = '/';
-       strcpy (cp, folder);
+       strcpy(cp, folder);
 
        return mailfold;
 }
index 9b9652b..c0c1a9c 100644 (file)
@@ -41,7 +41,7 @@ static char *get_temp_dir();
 **    char *tmp_pathname = m_mktemp2(NULL, "mypre", ...);
 */
 char *
-m_mktemp (
+m_mktemp(
        const char *pfx_in,  /* Pathname prefix for temporary file. */
        int *fd_ret,         /* (return,opt.) File descriptor to temp file. */
        FILE **fp_ret        /* (return,opt.) FILE pointer to temp file. */
@@ -100,7 +100,7 @@ m_mktemp (
 ** above) is used to create the temp file.
 */
 char *
-m_mktemp2 (
+m_mktemp2(
        const char *dir_in,   /* Directory to place temp file. */
        const char *pfx_in,   /* Basename prefix for temp file. */
        int *fd_ret,          /* (return,opt.) File descriptor to temp file. */
@@ -119,7 +119,7 @@ m_mktemp2 (
                return m_mktemp(buffer, fd_ret, fp_ret);
        }
 
-       if ((cp = r1bindex ((char *)dir_in, '/')) == dir_in) {
+       if ((cp = r1bindex((char *)dir_in, '/')) == dir_in) {
                /* No directory component */
                return m_mktemp(pfx_in, fd_ret, fp_ret);
        }
index 20acffe..ef391e6 100644 (file)
@@ -12,11 +12,11 @@ static char name[BUFSIZ];
 
 
 char *
-m_name (int num)
+m_name(int num)
 {
        if (num <= 0)
                return "?";
 
-       snprintf (name, sizeof(name), "%d", num);
+       snprintf(name, sizeof(name), "%d", num);
        return name;
 }
index 89e9045..1c13bb6 100644 (file)
@@ -16,7 +16,7 @@
 #include <sys/file.h>
 
 int
-makedir (char *dir)
+makedir(char *dir)
 {
        char path[PATH_MAX];
        char* folder_perms_ASCII;
@@ -28,7 +28,7 @@ makedir (char *dir)
        context_save();  /* save the context file */
        fflush(stdout);
 
-       if (!(folder_perms_ASCII = context_find ("folder-protect")))
+       if (!(folder_perms_ASCII = context_find("folder-protect")))
                folder_perms_ASCII = foldprot;  /* defaults to "700" */
 
        /*
@@ -49,19 +49,19 @@ makedir (char *dir)
        */
        saved_umask = umask(0);
 
-       if (getuid () == geteuid ()) {
+       if (getuid() == geteuid()) {
                c = strncpy(path, dir, sizeof(path));
 
                while (!had_an_error && (c = strchr((c + 1), '/')) != NULL) {
                        *c = (char)0;
                        if (access(path, X_OK)) {
                                if (errno != ENOENT){
-                                       advise (dir, "unable to create directory");
+                                       advise(dir, "unable to create directory");
                                        had_an_error = 1;
                                }
                                /* Create an outer directory. */
                                if (mkdir(path, folder_perms)) {
-                                       advise (dir, "unable to create directory");
+                                       advise(dir, "unable to create directory");
                                        had_an_error = 1;
                                }
                        }
@@ -73,37 +73,40 @@ makedir (char *dir)
                        ** Create the innermost nested subdirectory of the
                        ** path we're being asked to create.
                        */
-                       if (mkdir (dir, folder_perms) == -1) {
-                               advise (dir, "unable to create directory");
+                       if (mkdir(dir, folder_perms) == -1) {
+                               advise(dir, "unable to create directory");
                                had_an_error = 1;
                        }
                }
        } else {
-               /* Ummm, why do we want to avoid creating directories with the effective
-                  user ID?  None of the nmh tools are installed such that the effective
-                  should be different from the real, and if some parent process made
-                  the two be different, I don't see why it should be our job to enforce
-                  the real UID.  Also, why the heck do we call the mkdir executable
-                  rather than the library function in this case??  If we do want to
-                  call the mkdir executable, we should at least be giving it -p (and
-                  change the single chmod() call below) so it can successfully create
-                  nested directories like the above code can.
-
-                  -- Dan Harkless <dan-nmh@dilvish.speed.net> */
+               /*
+               ** Ummm, why do we want to avoid creating directories
+               ** with the effective user ID?  None of the nmh tools are
+               ** installed such that the effective should be different
+               ** from the real, and if some parent process made the two
+               ** be different, I don't see why it should be our job to
+               ** enforce the real UID.  Also, why the heck do we call
+               ** the mkdir executable rather than the library function in
+               ** this case??  If we do want to call the mkdir executable,
+               ** we should at least be giving it -p (and change the single
+               ** chmod() call below) so it can successfully create nested
+               ** directories like the above code can.
+               ** -- Dan Harkless <dan-nmh@dilvish.speed.net>
+               */
                switch (pid = vfork()) {
                        case -1:
-                               advise ("fork", "unable to");
+                               advise("fork", "unable to");
                                return 0;
 
                        case 0:
-                               setgid (getgid ());
-                               setuid (getuid ());
+                               setgid(getgid());
+                               setuid(getuid());
 
-                               execl ("/bin/mkdir", "mkdir", dir, NULL);
-                               execl ("/usr/bin/mkdir", "mkdir", dir, NULL);
-                               fprintf (stderr, "unable to exec ");
-                               perror ("mkdir");
-                               _exit (-1);
+                               execl("/bin/mkdir", "mkdir", dir, NULL);
+                               execl("/usr/bin/mkdir", "mkdir", dir, NULL);
+                               fprintf(stderr, "unable to exec ");
+                               perror("mkdir");
+                               _exit(-1);
 
                        default:
                                if (pidXwait(pid, "mkdir"))
@@ -111,7 +114,7 @@ makedir (char *dir)
                                break;
                }
 
-               chmod (dir, folder_perms);
+               chmod(dir, folder_perms);
        }
 
        umask(saved_umask);  /* put the user's umask back */
index 8f7e357..d93ad26 100644 (file)
--- a/sbr/mf.c
+++ b/sbr/mf.c
 /*
 ** static prototypes
 */
-static char *getcpy (char *);
-static int isat (char *);
-static int parse_address (void);
-static int phrase (char *);
-static int route_addr (char *);
-static int local_part (char *);
-static int domain (char *);
-static int route (char *);
-static int my_lex (char *);
+static char *getcpy(char *);
+static int isat(char *);
+static int parse_address(void);
+static int phrase(char *);
+static int route_addr(char *);
+static int local_part(char *);
+static int domain(char *);
+static int route(char *);
+static int my_lex(char *);
 
 
 static char *
-getcpy (char *s)
+getcpy(char *s)
 {
        register char *p;
 
@@ -40,8 +40,8 @@ getcpy (char *s)
                for(;;)
                        pause();
        }
-       p = mh_xmalloc ((size_t) (strlen (s) + 2));
-       strcpy (p, s);
+       p = mh_xmalloc((size_t) (strlen(s) + 2));
+       strcpy(p, s);
        return p;
 }
 
@@ -52,12 +52,12 @@ getcpy (char *s)
 
 
 static int
-isat (char *p)
+isat(char *p)
 {
-       return (strncmp (p, " AT ", 4)
-               && strncmp (p, " At ", 4)
-               && strncmp (p, " aT ", 4)
-               && strncmp (p, " at ", 4) ? FALSE : TRUE);
+       return (strncmp(p, " AT ", 4)
+               && strncmp(p, " At ", 4)
+               && strncmp(p, " aT ", 4)
+               && strncmp(p, " at ", 4) ? FALSE : TRUE);
 }
 
 
@@ -176,38 +176,38 @@ static struct adrx  adrxs2;
 
 
 struct adrx *
-getadrx (char *addrs)
+getadrx(char *addrs)
 {
        register char *bp;
        register struct adrx *adrxp = &adrxs2;
 
        if (pers)
-               free (pers);
+               free(pers);
        if (mbox)
-               free (mbox);
+               free(mbox);
        if (host)
-               free (host);
+               free(host);
        if (path)
-               free (path);
+               free(path);
        if (grp)
-               free (grp);
+               free(grp);
        if (note)
-               free (note);
+               free(note);
        pers = mbox = host = path = grp = note = NULL;
        err[0] = 0;
 
        if (dp == NULL) {
-               dp = cp = getcpy (addrs ? addrs : "");
+               dp = cp = getcpy(addrs ? addrs : "");
                glevel = 0;
        } else if (cp == NULL) {
-               free (dp);
+               free(dp);
                dp = NULL;
                return NULL;
        }
 
-       switch (parse_address ()) {
+       switch (parse_address()) {
                case DONE:
-                       free (dp);
+                       free(dp);
                        dp = cp = NULL;
                        return NULL;
 
@@ -219,7 +219,7 @@ getadrx (char *addrs)
 
                                default:  /* catch trailing comments */
                                        bp = cp;
-                                       my_lex (adr);
+                                       my_lex(adr);
                                        cp = bp;
                                        break;
                        }
@@ -237,18 +237,18 @@ getadrx (char *addrs)
                                        break;
 
                                default:
-                                       my_lex (adr);
+                                       my_lex(adr);
                                        continue;
                        }
                        break;
                }
-       while (isspace (*ap))
+       while (isspace(*ap))
                ap++;
        if (cp)
-               sprintf (adr, "%.*s", (int)(cp - ap), ap);
+               sprintf(adr, "%.*s", (int)(cp - ap), ap);
        else
-               strcpy (adr, ap);
-       bp = adr + strlen (adr) - 1;
+               strcpy(adr, ap);
+       bp = adr + strlen(adr) - 1;
        if (*bp == ',' || *bp == ';' || *bp == '\n')
                *bp = 0;
 
@@ -267,26 +267,26 @@ getadrx (char *addrs)
 
 
 static int
-parse_address (void)
+parse_address(void)
 {
        char buffer[BUFSIZ];
 
 again: ;
        ap = cp;
-       switch (my_lex (buffer)) {
+       switch (my_lex(buffer)) {
                case LX_ATOM:
                case LX_QSTR:
-                       pers = getcpy (buffer);
+                       pers = getcpy(buffer);
                        break;
 
                case LX_SEMI:
                        if (glevel-- <= 0) {
-                               strcpy (err, "extraneous semi-colon");
+                               strcpy(err, "extraneous semi-colon");
                                return NOTOK;
                        }
                case LX_COMA:
                        if (note) {
-                               free (note);
+                               free(note);
                                note = NULL;
                        }
                        goto again;
@@ -299,46 +299,46 @@ again: ;
 
                case LX_AT:  /* sigh (3) */
                        cp = ap;
-                       if (route_addr (buffer) == NOTOK)
+                       if (route_addr(buffer) == NOTOK)
                                return NOTOK;
                        return OK;  /* why be choosy? */
 
                default:
-                       sprintf (err, "illegal address construct (%s)", buffer);
+                       sprintf(err, "illegal address construct (%s)", buffer);
                        return NOTOK;
        }
 
-       switch (my_lex (buffer)) {
+       switch (my_lex(buffer)) {
                case LX_ATOM:
                case LX_QSTR:
-                       pers = add (buffer, add (" ", pers));
+                       pers = add(buffer, add(" ", pers));
        more_phrase: ;  /* sigh (1) */
-                       if (phrase (buffer) == NOTOK)
+                       if (phrase(buffer) == NOTOK)
                                return NOTOK;
 
                        switch (last_lex) {
                                case LX_LBRK:
                        get_addr: ;
-                                       if (route_addr (buffer) == NOTOK)
+                                       if (route_addr(buffer) == NOTOK)
                                                return NOTOK;
                                        if (last_lex == LX_RBRK)
                                                return OK;
-                                       sprintf (err, "missing right-bracket (%s)", buffer);
+                                       sprintf(err, "missing right-bracket (%s)", buffer);
                                        return NOTOK;
 
                                case LX_COLN:
                        get_group: ;
                                        if (glevel++ > 0) {
-                                               sprintf (err, "nested groups not allowed (%s)", pers);
+                                               sprintf(err, "nested groups not allowed (%s)", pers);
                                                return NOTOK;
                                        }
-                                       grp = add (": ", pers);
+                                       grp = add(": ", pers);
                                        pers = NULL;
                                        {
                                                char   *pp = cp;
 
                                                for (;;)
-                                                       switch (my_lex (buffer)) {
+                                                       switch (my_lex(buffer)) {
                                                                case LX_SEMI:
                                                                case LX_END: /* tsk, tsk */
                                                                        glevel--;
@@ -349,16 +349,16 @@ again: ;
 
                                                                default:
                                                                        cp = pp;
-                                                                       return parse_address ();
+                                                                       return parse_address();
                                                        }
                                        }
 
                                case LX_DOT:  /* sigh (1) */
-                                       pers = add (".", pers);
+                                       pers = add(".", pers);
                                        goto more_phrase;
 
                                default:
-                                       sprintf (err, "no mailbox in address, only a phrase (%s%s)", pers, buffer);
+                                       sprintf(err, "no mailbox in address, only a phrase (%s%s)", pers, buffer);
                                        return NOTOK;
                        }
 
@@ -369,9 +369,9 @@ again: ;
                        goto get_group;
 
                case LX_DOT:
-                       mbox = add (buffer, pers);
+                       mbox = add(buffer, pers);
                        pers = NULL;
-                       if (route_addr (buffer) == NOTOK)
+                       if (route_addr(buffer) == NOTOK)
                                return NOTOK;
                        goto check_end;
 
@@ -379,13 +379,13 @@ again: ;
                        ingrp = glevel;
                        mbox = pers;
                        pers = NULL;
-                       if (domain (buffer) == NOTOK)
+                       if (domain(buffer) == NOTOK)
                                return NOTOK;
        check_end: ;
                        switch (last_lex) {
                                case LX_SEMI:
                                        if (glevel-- <= 0) {
-                                               strcpy (err, "extraneous semi-colon");
+                                               strcpy(err, "extraneous semi-colon");
                                                return NOTOK;
                                        }
                                case LX_COMA:
@@ -393,7 +393,7 @@ again: ;
                                        return OK;
 
                                default:
-                                       sprintf (err, "junk after local@domain (%s)", buffer);
+                                       sprintf(err, "junk after local@domain (%s)", buffer);
                                        return NOTOK;
                        }
 
@@ -402,7 +402,7 @@ again: ;
                case LX_END:
                        ingrp = glevel;
                        if (last_lex == LX_SEMI && glevel-- <= 0) {
-                               strcpy (err, "extraneous semi-colon");
+                               strcpy(err, "extraneous semi-colon");
                                return NOTOK;
                        }
                        mbox = pers;
@@ -410,20 +410,20 @@ again: ;
                        return OK;
 
                default:
-                       sprintf (err, "missing mailbox (%s)", buffer);
+                       sprintf(err, "missing mailbox (%s)", buffer);
                        return NOTOK;
        }
 }
 
 
 static int
-phrase (char *buffer)
+phrase(char *buffer)
 {
        for (;;)
-               switch (my_lex (buffer)) {
+               switch (my_lex(buffer)) {
                        case LX_ATOM:
                        case LX_QSTR:
-                               pers = add (buffer, add (" ", pers));
+                               pers = add(buffer, add(" ", pers));
                                continue;
 
                        default:
@@ -433,23 +433,23 @@ phrase (char *buffer)
 
 
 static int
-route_addr (char *buffer)
+route_addr(char *buffer)
 {
        register char *pp = cp;
 
-       if (my_lex (buffer) == LX_AT) {
-               if (route (buffer) == NOTOK)
+       if (my_lex(buffer) == LX_AT) {
+               if (route(buffer) == NOTOK)
                        return NOTOK;
        }
        else
                cp = pp;
 
-       if (local_part (buffer) == NOTOK)
+       if (local_part(buffer) == NOTOK)
                return NOTOK;
 
        switch (last_lex) {
                case LX_AT:
-                       return domain (buffer);
+                       return domain(buffer);
 
                case LX_SEMI:  /* if in group */
                case LX_RBRK:  /* no host */
@@ -458,33 +458,33 @@ route_addr (char *buffer)
                        return OK;
 
                default:
-                       sprintf (err, "no at-sign after local-part (%s)", buffer);
+                       sprintf(err, "no at-sign after local-part (%s)", buffer);
                        return NOTOK;
        }
 }
 
 
 static int
-local_part (char *buffer)
+local_part(char *buffer)
 {
        ingrp = glevel;
 
        for (;;) {
-               switch (my_lex (buffer)) {
+               switch (my_lex(buffer)) {
                        case LX_ATOM:
                        case LX_QSTR:
-                               mbox = add (buffer, mbox);
+                               mbox = add(buffer, mbox);
                                break;
 
                        default:
-                               sprintf (err, "no mailbox in local-part (%s)",
+                               sprintf(err, "no mailbox in local-part (%s)",
                                                buffer);
                                return NOTOK;
                }
 
-               switch (my_lex (buffer)) {
+               switch (my_lex(buffer)) {
                        case LX_DOT:
-                               mbox = add (buffer, mbox);
+                               mbox = add(buffer, mbox);
                                continue;
 
                        default:
@@ -495,28 +495,28 @@ local_part (char *buffer)
 
 
 static int
-domain (char *buffer)
+domain(char *buffer)
 {
        for (;;) {
-               switch (my_lex (buffer)) {
+               switch (my_lex(buffer)) {
                        case LX_ATOM:
                        case LX_DLIT:
-                               host = add (buffer, host);
+                               host = add(buffer, host);
                                break;
 
                        default:
-                               sprintf (err, "no sub-domain in domain-part of address (%s)", buffer);
+                               sprintf(err, "no sub-domain in domain-part of address (%s)", buffer);
                                return NOTOK;
                }
 
-               switch (my_lex (buffer)) {
+               switch (my_lex(buffer)) {
                        case LX_DOT:
-                               host = add (buffer, host);
+                               host = add(buffer, host);
                                continue;
 
                        case LX_AT:  /* sigh (0) */
-                               mbox = add (host, add ("%", mbox));
-                               free (host);
+                               mbox = add(host, add("%", mbox));
+                               free(host);
                                host = NULL;
                                continue;
 
@@ -528,35 +528,35 @@ domain (char *buffer)
 
 
 static int
-route (char *buffer)
+route(char *buffer)
 {
-       path = getcpy ("@");
+       path = getcpy("@");
 
        for (;;) {
-               switch (my_lex (buffer)) {
+               switch (my_lex(buffer)) {
                        case LX_ATOM:
                        case LX_DLIT:
-                               path = add (buffer, path);
+                               path = add(buffer, path);
                                break;
 
                        default:
-                               sprintf (err, "no sub-domain in domain-part of address (%s)", buffer);
+                               sprintf(err, "no sub-domain in domain-part of address (%s)", buffer);
                                return NOTOK;
                }
-               switch (my_lex (buffer)) {
+               switch (my_lex(buffer)) {
                        case LX_COMA:
-                               path = add (buffer, path);
+                               path = add(buffer, path);
                                for (;;) {
-                                       switch (my_lex (buffer)) {
+                                       switch (my_lex(buffer)) {
                                                case LX_COMA:
                                                        continue;
 
                                                case LX_AT:
-                                                       path = add (buffer, path);
+                                                       path = add(buffer, path);
                                                        break;
 
                                                default:
-                                                       sprintf (err, "no at-sign found for next domain in route (%s)",
+                                                       sprintf(err, "no at-sign found for next domain in route (%s)",
                                                                         buffer);
                                        }
                                        break;
@@ -565,15 +565,15 @@ route (char *buffer)
 
                        case LX_AT:  /* XXX */
                        case LX_DOT:
-                               path = add (buffer, path);
+                               path = add(buffer, path);
                                continue;
 
                        case LX_COLN:
-                               path = add (buffer, path);
+                               path = add(buffer, path);
                                return OK;
 
                        default:
-                               sprintf (err, "no colon found to terminate route (%s)", buffer);
+                               sprintf(err, "no colon found to terminate route (%s)", buffer);
                                return NOTOK;
                }
        }
@@ -581,7 +581,7 @@ route (char *buffer)
 
 
 static int
-my_lex (char *buffer)
+my_lex(char *buffer)
 {
        /* buffer should be at least BUFSIZ bytes long */
        int i, gotat = 0;
@@ -604,9 +604,9 @@ my_lex (char *buffer)
        if (!cp)
                return (last_lex = LX_END);
 
-       gotat = isat (cp);
+       gotat = isat(cp);
        c = *cp++;
-       while (isspace (c))
+       while (isspace(c))
                c = *cp++;
        if (c == 0) {
                cp = NULL;
@@ -637,9 +637,8 @@ my_lex (char *buffer)
                                        ADDCHR(c);
                                        if (--i < 0) {
                                                *bp = 0;
-                                               note = note ? add (buffer, add (" ", note))
-                                                       : getcpy (buffer);
-                                               return my_lex (buffer);
+                                               note = note ? add(buffer, add(" ", note)) : getcpy(buffer);
+                                               return my_lex(buffer);
                                        }
                        }
        }
@@ -696,7 +695,7 @@ my_lex (char *buffer)
                if (c == special[i].lx_chr)
                        return (last_lex = special[i].lx_val);
 
-       if (iscntrl (c))
+       if (iscntrl(c))
                return (last_lex = LX_ERR);
 
        for (;;) {
@@ -705,7 +704,7 @@ my_lex (char *buffer)
                for (i = 0; special[i].lx_chr != 0; i++)
                        if (c == special[i].lx_chr)
                                goto got_atom;
-               if (iscntrl (c) || isspace (c))
+               if (iscntrl(c) || isspace(c))
                        break;
                ADDCHR(c);
        }
@@ -727,7 +726,7 @@ got_atom: ;
 
 
 char *
-legal_person (char *p)
+legal_person(char *p)
 {
        int i;
        register char *cp;
@@ -738,7 +737,7 @@ legal_person (char *p)
        for (cp = p; *cp; cp++)
                for (i = 0; special[i].lx_chr; i++)
                        if (*cp == special[i].lx_chr) {
-                               sprintf (buffer, "\"%s\"", p);
+                               sprintf(buffer, "\"%s\"", p);
                                return buffer;
                        }
 
index 55c0f02..3313aef 100644 (file)
--- a/sbr/mts.c
+++ b/sbr/mts.c
 /*
 ** static prototypes
 */
-static char *tailor_value (unsigned char *);
-static void getuserinfo (void);
+static char *tailor_value(unsigned char *);
+static void getuserinfo(void);
 static const char *get_mtsconf_pathname(void);
 static const char *get_mtsuserconf_pathname(void);
-static void mts_read_conf_file (FILE *fp);
+static void mts_read_conf_file(FILE *fp);
 
 /*
 ** *mmdfldir and *uucpldir are the maildrop directories.  If maildrops
@@ -109,25 +109,25 @@ static struct bind binds[] = {
 */
 
 void
-mts_init (char *name)
+mts_init(char *name)
 {
        const char *cp;
        FILE *fp;
        static int inited = 0;
 
-       if (inited++ || (fp = fopen (get_mtsconf_pathname(), "r")) == NULL)
+       if (inited++ || (fp = fopen(get_mtsconf_pathname(), "r")) == NULL)
                return;
        mts_read_conf_file(fp);
-       fclose (fp);
+       fclose(fp);
 
        cp = get_mtsuserconf_pathname();
        if (cp != NULL &&
-               ((fp = fopen (get_mtsuserconf_pathname(), "r")) != NULL)) {
+               ((fp = fopen(get_mtsuserconf_pathname(), "r")) != NULL)) {
                mts_read_conf_file(fp);
-               fclose (fp);
+               fclose(fp);
        }
 
-       Everyone = atoi (everyone);
+       Everyone = atoi(everyone);
 
        if (strstr(masquerade, "draft_from") != NULL)
                draft_from_masquerading = TRUE;
@@ -148,7 +148,7 @@ mts_init (char *name)
 */
 
 static char *
-tailor_value (unsigned char *s)
+tailor_value(unsigned char *s)
 {
        int i, r;
        char *bp;
@@ -171,24 +171,24 @@ tailor_value (unsigned char *s)
                                        break;
 
                                default:
-                                       if (!isdigit (*s)) {
+                                       if (!isdigit(*s)) {
                                                *bp++ = QUOTE;
                                                *bp = *s;
                                        }
                                        r = *s != '0' ? 10 : 8;
-                                       for (i = 0; isdigit (*s); s++)
+                                       for (i = 0; isdigit(*s); s++)
                                                i = i * r + *s - '0';
                                        s--;
-                                       *bp = toascii (i);
+                                       *bp = toascii(i);
                                        break;
                        }
                }
        }
        *bp = 0;
 
-       len = strlen (buffer) + 1;
-       bp = mh_xmalloc (len);
-       memcpy (bp, buffer, len);
+       len = strlen(buffer) + 1;
+       bp = mh_xmalloc(len);
+       memcpy(bp, buffer, len);
 
        return bp;
 }
@@ -198,7 +198,7 @@ tailor_value (unsigned char *s)
 */
 
 char *
-LocalName (void)
+LocalName(void)
 {
        static char buffer[BUFSIZ] = "";
        struct addrinfo hints, *res;
@@ -210,16 +210,16 @@ LocalName (void)
        if (buffer[0])
                return buffer;
 
-       mts_init ("mts");
+       mts_init("mts");
 
        memset(buffer, 0, sizeof(buffer));
 #ifdef HAVE_UNAME
        /* first get our local name */
-       uname (&name);
-       strncpy (buffer, name.nodename, sizeof(buffer) - 1);
+       uname(&name);
+       strncpy(buffer, name.nodename, sizeof(buffer) - 1);
 #else
        /* first get our local name */
-       gethostname (buffer, sizeof(buffer) - 1);
+       gethostname(buffer, sizeof(buffer) - 1);
 #endif
        /* now fully qualify our name */
 
@@ -241,7 +241,7 @@ LocalName (void)
 */
 
 char *
-SystemName (void)
+SystemName(void)
 {
        static char buffer[BUFSIZ] = "";
 
@@ -253,13 +253,13 @@ SystemName (void)
        if (buffer[0])
                return buffer;
 
-       mts_init ("mts");
+       mts_init("mts");
 
 #ifdef HAVE_UNAME
-       uname (&name);
-       strncpy (buffer, name.nodename, sizeof(buffer));
+       uname(&name);
+       strncpy(buffer, name.nodename, sizeof(buffer));
 #else
-       gethostname (buffer, sizeof(buffer));
+       gethostname(buffer, sizeof(buffer));
 #endif
 
        return buffer;
@@ -271,7 +271,7 @@ SystemName (void)
 */
 
 char *
-getusername (void)
+getusername(void)
 {
        if (username[0] == '\0')
                getuserinfo();
@@ -286,7 +286,7 @@ getusername (void)
 */
 
 char *
-getfullname (void)
+getfullname(void)
 {
        if (username[0] == '\0')
                getuserinfo();
@@ -302,18 +302,18 @@ getfullname (void)
 */
 
 static void
-getuserinfo (void)
+getuserinfo(void)
 {
        register unsigned char *cp;
        register char *np;
        register struct passwd *pw;
 
-       if ((pw = getpwuid (getuid ())) == NULL
+       if ((pw = getpwuid(getuid())) == NULL
                || pw->pw_name == NULL
                || *pw->pw_name == '\0') {
-               strncpy (username, "unknown", sizeof(username));
-               snprintf (fullname, sizeof(fullname), "The Unknown User-ID (%d)",
-                       (int) getuid ());
+               strncpy(username, "unknown", sizeof(username));
+               snprintf(fullname, sizeof(fullname), "The Unknown User-ID (%d)",
+                       (int) getuid());
                return;
        }
 
@@ -359,7 +359,7 @@ getuserinfo (void)
                for (cp = fullname;
                        *np != '\0' && *np != ',' && *np != '<';) {
                        if (*np == '&') {  /* blech! */
-                               strcpy (cp, pw->pw_name);
+                               strcpy(cp, pw->pw_name);
                                *cp = toupper(*cp);
                                while (*cp)
                                        cp++;
@@ -379,7 +379,7 @@ getuserinfo (void)
                */
                for (cp = fullname; *np != '\0' && *np != ',';) {
                        if (*np == '&') {  /* blech! */
-                               strcpy (cp, pw->pw_name);
+                               strcpy(cp, pw->pw_name);
                                *cp = toupper(*cp);
                                while (*cp)
                                        cp++;
@@ -406,30 +406,30 @@ getuserinfo (void)
                *cp = '\0';
        }
        if (!mmailid_masquerading || *np == '\0')
-               strncpy (username, pw->pw_name, sizeof(username));
+               strncpy(username, pw->pw_name, sizeof(username));
 
        /*
        ** The $SIGNATURE environment variable overrides the GECOS field's
        ** idea of your real name.
        */
-       if ((cp = getenv ("SIGNATURE")) && *cp)
-               strncpy (fullname, cp, sizeof(fullname));
+       if ((cp = getenv("SIGNATURE")) && *cp)
+               strncpy(fullname, cp, sizeof(fullname));
 
        if (strchr(fullname, '.')) {  /*  quote any .'s */
                char tmp[BUFSIZ];
 
                /* should quote "'s too */
-               snprintf (tmp, sizeof(tmp), "\"%s\"", fullname);
-               strncpy (fullname, tmp, sizeof(fullname));
+               snprintf(tmp, sizeof(tmp), "\"%s\"", fullname);
+               strncpy(fullname, tmp, sizeof(fullname));
        }
 
        return;
 }
 
 static const char*
-get_mtsconf_pathname (void)
+get_mtsconf_pathname(void)
 {
-       const char *cp = getenv ( "MHMTSCONF ");
+       const char *cp = getenv( "MHMTSCONF ");
        if (cp != NULL && *cp != '\0') {
                return cp;
        }
@@ -437,9 +437,9 @@ get_mtsconf_pathname (void)
 }
 
 static const char*
-get_mtsuserconf_pathname (void)
+get_mtsuserconf_pathname(void)
 {
-       const char *cp = getenv ( "MHMTSUSERCONF" );
+       const char *cp = getenv( "MHMTSUSERCONF" );
        if (cp != NULL && *cp != '\0') {
                return cp;
        }
@@ -447,13 +447,13 @@ get_mtsuserconf_pathname (void)
 }
 
 static void
-mts_read_conf_file (FILE *fp)
+mts_read_conf_file(FILE *fp)
 {
        unsigned char *bp;
        char *cp, buffer[BUFSIZ];
        struct bind *b;
 
-       while (fgets (buffer, sizeof(buffer), fp)) {
+       while (fgets(buffer, sizeof(buffer), fp)) {
                if (!(cp = strchr(buffer, '\n')))
                        break;
                *cp = 0;
@@ -462,13 +462,13 @@ mts_read_conf_file (FILE *fp)
                if (!(bp = strchr(buffer, ':')))
                        break;
                *bp++ = 0;
-               while (isspace (*bp))
+               while (isspace(*bp))
                        *bp++ = 0;
 
                for (b = binds; b->keyword; b++)
-                       if (!strcmp (buffer, b->keyword))
+                       if (!strcmp(buffer, b->keyword))
                                break;
-               if (b->keyword && (cp = tailor_value (bp)))
+               if (b->keyword && (cp = tailor_value(bp)))
                        *b->value = cp;
        }
 }
index 502ad97..b19415a 100644 (file)
@@ -34,8 +34,8 @@ path(char *name, int flag)
 {
        register char *cp, *ep;
 
-       if ((cp = expath (name, flag))
-               && (ep = cp + strlen (cp) - 1) > cp
+       if ((cp = expath(name, flag))
+               && (ep = cp + strlen(cp) - 1) > cp
                && *ep == '/')
                *ep = '\0';
 
@@ -44,62 +44,62 @@ path(char *name, int flag)
 
 
 static char *
-expath (char *name, int flag)
+expath(char *name, int flag)
 {
        register char *cp, *ep;
        char buffer[BUFSIZ];
 
        if (flag == TSUBCWF) {
-               snprintf (buffer, sizeof(buffer), "%s/%s", getfolder (1), name);
-               name = m_mailpath (buffer);
-               compath (name);
-               snprintf (buffer, sizeof(buffer), "%s/", m_maildir (""));
-               if (ssequal (buffer, name)) {
+               snprintf(buffer, sizeof(buffer), "%s/%s", getfolder(1), name);
+               name = m_mailpath(buffer);
+               compath(name);
+               snprintf(buffer, sizeof(buffer), "%s/", m_maildir(""));
+               if (ssequal(buffer, name)) {
                        cp = name;
-                       name = getcpy (name + strlen (buffer));
-                       free (cp);
+                       name = getcpy(name + strlen(buffer));
+                       free(cp);
                }
                flag = TFOLDER;
        }
 
        if (*name == '/' || (flag == TFOLDER
-               && (strncmp (name, CWD, NCWD) && strcmp (name, DOT)
-               && strcmp (name, DOTDOT) && strncmp (name, PWD, NPWD))))
-               return getcpy (name);
+               && (strncmp(name, CWD, NCWD) && strcmp(name, DOT)
+               && strcmp(name, DOTDOT) && strncmp(name, PWD, NPWD))))
+               return getcpy(name);
 
        if (pwds == NULL)
-               pwds = pwd ();
+               pwds = pwd();
 
-       if (strcmp (name, DOT) == 0 || strcmp (name, CWD) == 0)
-               return getcpy (pwds);
+       if (strcmp(name, DOT) == 0 || strcmp(name, CWD) == 0)
+               return getcpy(pwds);
 
-       ep = pwds + strlen (pwds);
+       ep = pwds + strlen(pwds);
        if ((cp = strrchr(pwds, '/')) == NULL)
                cp = ep;
        else
                if (cp == pwds)
                        cp++;
 
-       if (strncmp (name, CWD, NCWD) == 0)
+       if (strncmp(name, CWD, NCWD) == 0)
                name += NCWD;
 
-       if (strcmp (name, DOTDOT) == 0 || strcmp (name, PWD) == 0) {
-               snprintf (buffer, sizeof(buffer), "%.*s", (int)(cp - pwds), pwds);
-               return getcpy (buffer);
+       if (strcmp(name, DOTDOT) == 0 || strcmp(name, PWD) == 0) {
+               snprintf(buffer, sizeof(buffer), "%.*s", (int)(cp - pwds), pwds);
+               return getcpy(buffer);
        }
 
-       if (strncmp (name, PWD, NPWD) == 0)
+       if (strncmp(name, PWD, NPWD) == 0)
                name += NPWD;
        else
                cp = ep;
 
-       snprintf (buffer, sizeof(buffer), "%.*s/%s", (int)(cp - pwds), pwds, name);
-       return getcpy (buffer);
+       snprintf(buffer, sizeof(buffer), "%.*s/%s", (int)(cp - pwds), pwds, name);
+       return getcpy(buffer);
 }
 
 
 static void
-compath (char *f)
+compath(char *f)
 {
        register char *cp, *dp;
 
@@ -121,13 +121,13 @@ compath (char *f)
                                        continue;
 
                                case '.':
-                                       if (strcmp (cp, DOT) == 0) {
+                                       if (strcmp(cp, DOT) == 0) {
                                                if (cp > f + 1)
                                                        cp--;
                                                *cp = '\0';
                                                break;
                                        }
-                                       if (strcmp (cp, DOTDOT) == 0) {
+                                       if (strcmp(cp, DOTDOT) == 0) {
                                                for (cp -= 2; cp > f; cp--)
                                                        if (*cp == '/')
                                                                break;
@@ -136,18 +136,18 @@ compath (char *f)
                                                *cp = '\0';
                                                break;
                                        }
-                                       if (strncmp (cp, PWD, NPWD) == 0) {
+                                       if (strncmp(cp, PWD, NPWD) == 0) {
                                                for (dp = cp - 2; dp > f; dp--)
                                                        if (*dp == '/')
                                                                break;
                                                if (dp <= f)
                                                        dp = f;
-                                               strcpy (dp, cp + NPWD - 1);
+                                               strcpy(dp, cp + NPWD - 1);
                                                cp = dp;
                                                continue;
                                        }
-                                       if (strncmp (cp, CWD, NCWD) == 0) {
-                                               strcpy (cp - 1, cp + NCWD - 1);
+                                       if (strncmp(cp, CWD, NCWD) == 0) {
+                                               strcpy(cp - 1, cp + NCWD - 1);
                                                cp--;
                                                continue;
                                        }
index ff8cf48..f845058 100644 (file)
@@ -26,7 +26,7 @@
 #endif
 
 int
-pidstatus (int status, FILE *fp, char *cp)
+pidstatus(int status, FILE *fp, char *cp)
 {
        int signum;
 
@@ -42,21 +42,21 @@ pidstatus (int status, FILE *fp, char *cp)
        if (WIFEXITED(status)) {
                if ((signum = WEXITSTATUS(status))) {
                        if (cp)
-                               fprintf (fp, "%s: ", cp);
-                       fprintf (fp, "exit %d\n", signum);
+                               fprintf(fp, "%s: ", cp);
+                       fprintf(fp, "exit %d\n", signum);
                }
        } else if (WIFSIGNALED(status)) {
                /* If child process terminated due to receipt of a signal */
                signum = WTERMSIG(status);
                if (signum != SIGINT) {
                        if (cp)
-                               fprintf (fp, "%s: ", cp);
-                       fprintf (fp, "signal %d", signum);
+                               fprintf(fp, "%s: ", cp);
+                       fprintf(fp, "signal %d", signum);
                        if (signum >= 0 && signum < sizeof(sigmsg) && sigmsg[signum] != NULL)
-                               fprintf (fp, " (%s%s)\n", sigmsg[signum],
+                               fprintf(fp, " (%s%s)\n", sigmsg[signum],
                                         WCOREDUMP(status) ? ", core dumped" : "");
                        else
-                               fprintf (fp, "%s\n", WCOREDUMP(status) ? " (core dumped)" : "");
+                               fprintf(fp, "%s\n", WCOREDUMP(status) ? " (core dumped)" : "");
                }
        }
 
index 65c55b9..ebee02e 100644 (file)
@@ -16,7 +16,7 @@
 #endif
 
 int
-pidwait (pid_t id, int sigsok)
+pidwait(pid_t id, int sigsok)
 {
        pid_t pid;
        SIGNAL_HANDLER istat = NULL, qstat = NULL;
@@ -29,8 +29,8 @@ pidwait (pid_t id, int sigsok)
 
        if (sigsok == -1) {
                /* ignore a couple of signals */
-               istat = SIGNAL (SIGINT, SIG_IGN);
-               qstat = SIGNAL (SIGQUIT, SIG_IGN);
+               istat = SIGNAL(SIGINT, SIG_IGN);
+               qstat = SIGNAL(SIGQUIT, SIG_IGN);
        }
 
 #ifdef HAVE_WAITPID
@@ -43,8 +43,8 @@ pidwait (pid_t id, int sigsok)
 
        if (sigsok == -1) {
                /* reset the signal handlers */
-               SIGNAL (SIGINT, istat);
-               SIGNAL (SIGQUIT, qstat);
+               SIGNAL(SIGINT, istat);
+               SIGNAL(SIGQUIT, qstat);
        }
 
 #ifdef HAVE_UNION_WAIT
index a46a88b..039ab31 100644 (file)
 
 
 void
-print_help (char *str, struct swit *swp, int print_context)
+print_help(char *str, struct swit *swp, int print_context)
 {
        char *s;
 
        /* print Usage string */
-       printf ("Usage: %s\n", str);
+       printf("Usage: %s\n", str);
 
        /* print all the switches */
-       printf ("  switches are:\n");
-       print_sw (ALL, swp, "-", stdout);
+       printf("  switches are:\n");
+       print_sw(ALL, swp, "-", stdout);
 
        /*
        ** check if we should print any profile entries
        */
-       if (print_context && (s = context_find (invo_name)))
-               printf ("\nProfile: %s\n", s);
+       if (print_context && (s = context_find(invo_name)))
+               printf("\nProfile: %s\n", s);
 }
index 8e489dc..6f0c981 100644 (file)
@@ -10,7 +10,7 @@
 
 
 void
-print_sw (char *substr, struct swit *swp, char *prefix, FILE *fp)
+print_sw(char *substr, struct swit *swp, char *prefix, FILE *fp)
 {
        int len, optno;
        register int i;
@@ -20,12 +20,12 @@ print_sw (char *substr, struct swit *swp, char *prefix, FILE *fp)
        len = strlen(substr);
        for (; swp->sw; swp++) {
                /* null matches all strings */
-               if (!*substr || (ssequal (substr, swp->sw) && len >= swp->minchars)) {
+               if (!*substr || (ssequal(substr, swp->sw) && len >= swp->minchars)) {
                        optno = 0;
                        /* next switch */
                        if ((sp = (&swp[1])->sw)) {
                                if (!*substr && sp[0] == 'n' && sp[1] == 'o' &&
-                                               strcmp (&sp[2], swp->sw) == 0 && (
+                                               strcmp(&sp[2], swp->sw) == 0 && (
                                                ((&swp[1])->minchars == 0 && swp->minchars == 0) ||
                                                ((&swp[1])->minchars == (swp->minchars) + 2)))
                                        optno++;
@@ -35,14 +35,14 @@ print_sw (char *substr, struct swit *swp, char *prefix, FILE *fp)
                                cp = buf;
                                *cp++ = '(';
                                if (optno) {
-                                       strcpy (cp, "[no]");
-                                       cp += strlen (cp);
+                                       strcpy(cp, "[no]");
+                                       cp += strlen(cp);
                                }
                                for (cp1 = swp->sw, i = 0; i < swp->minchars; i++)
                                        *cp++ = *cp1++;
                                *cp++ = ')';
                                while ((*cp++ = *cp1++));
-                               fprintf (fp, "  %s%s\n", prefix, buf);
+                               fprintf(fp, "  %s%s\n", prefix, buf);
                        } else {
                                if (!swp->minchars)
                                        fprintf(fp, optno ? "  %s[no]%s\n" : "  %s%s\n",
index 162e171..8361c66 100644 (file)
@@ -10,7 +10,7 @@
 
 
 void
-print_version (char *invo_name)
+print_version(char *invo_name)
 {
        printf("%s -- %s\n", invo_name, version_str);
 }
index 70fba6c..d664927 100644 (file)
@@ -18,31 +18,31 @@ push(void)
        int i;
 
        for (i = 0; (pid = fork()) == -1 && i < 5; i++)
-               sleep (5);
+               sleep(5);
 
        switch (pid) {
                case -1:
                        /* fork error */
-                       advise (NULL, "unable to fork, so can't push...");
+                       advise(NULL, "unable to fork, so can't push...");
                        break;
 
                case 0:
                        /* child, block a few signals and continue */
-                       SIGNAL (SIGHUP, SIG_IGN);
-                       SIGNAL (SIGINT, SIG_IGN);
-                       SIGNAL (SIGQUIT, SIG_IGN);
-                       SIGNAL (SIGTERM, SIG_IGN);
+                       SIGNAL(SIGHUP, SIG_IGN);
+                       SIGNAL(SIGINT, SIG_IGN);
+                       SIGNAL(SIGQUIT, SIG_IGN);
+                       SIGNAL(SIGTERM, SIG_IGN);
 #ifdef SIGTSTP
-                       SIGNAL (SIGTSTP, SIG_IGN);
-                       SIGNAL (SIGTTIN, SIG_IGN);
-                       SIGNAL (SIGTTOU, SIG_IGN);
+                       SIGNAL(SIGTSTP, SIG_IGN);
+                       SIGNAL(SIGTTIN, SIG_IGN);
+                       SIGNAL(SIGTTOU, SIG_IGN);
 #endif
-                       freopen ("/dev/null", "r", stdin);
-                       freopen ("/dev/null", "w", stdout);
+                       freopen("/dev/null", "r", stdin);
+                       freopen("/dev/null", "w", stdout);
                        break;
 
                default:
                        /* parent, just exit */
-                       done (0);
+                       done(0);
        }
 }
index 5b53298..5c7279b 100644 (file)
@@ -14,28 +14,28 @@ extern char **environ;
 /*
 ** prototypes
 */
-int m_putenv (char *, char *);
-int unputenv (char *);
-static int nvmatch (char *, char *);
+int m_putenv(char *, char *);
+int unputenv(char *);
+static int nvmatch(char *, char *);
 
 
 int
-m_putenv (char *name, char *value)
+m_putenv(char *name, char *value)
 {
        register int i;
        register char **ep, **nep, *cp;
 
-       cp = mh_xmalloc ((size_t) (strlen (name) + strlen (value) + 2));
+       cp = mh_xmalloc((size_t) (strlen(name) + strlen(value) + 2));
 
-       sprintf (cp, "%s=%s", name, value);
+       sprintf(cp, "%s=%s", name, value);
 
        for (ep = environ, i = 0; *ep; ep++, i++)
-               if (nvmatch (name, *ep)) {
+               if (nvmatch(name, *ep)) {
                        *ep = cp;
                        return 0;
                }
 
-       nep = (char **) mh_xmalloc ((size_t) ((i + 2) * sizeof(*nep)));
+       nep = (char **) mh_xmalloc((size_t) ((i + 2) * sizeof(*nep)));
 
        for (ep = environ, i = 0; *ep; nep[i++] = *ep++)
                continue;
@@ -47,12 +47,12 @@ m_putenv (char *name, char *value)
 
 
 int
-unputenv (char *name)
+unputenv(char *name)
 {
        char **ep, **nep;
 
        for (ep = environ; *ep; ep++)
-               if (nvmatch (name, *ep))
+               if (nvmatch(name, *ep))
                        break;
        if (*ep == NULL)
                return 1;
@@ -66,7 +66,7 @@ unputenv (char *name)
 
 
 static int
-nvmatch (char *s1, char *s2)
+nvmatch(char *s1, char *s2)
 {
        while (*s1 == *s2++)
                if (*s1++ == '=')
index cc8be82..ef43bde 100644 (file)
@@ -46,7 +46,7 @@ static struct node **opp = NULL;
 
 
 void
-readconfig (struct node **npp, FILE *ib, char *file, int ctx)
+readconfig(struct node **npp, FILE *ib, char *file, int ctx)
 {
        register int state;
        register char *cp;
@@ -55,29 +55,29 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx)
        register struct procstr *ps;
 
        if (npp == NULL && (npp = opp) == NULL) {
-               admonish (NULL, "bug: readconfig called but pump not primed");
+               admonish(NULL, "bug: readconfig called but pump not primed");
                return;
        }
 
        for (state = FLD;;) {
-               switch (state = m_getfld (state, name, field, sizeof(field), ib)) {
+               switch (state = m_getfld(state, name, field, sizeof(field), ib)) {
                        case FLD:
                        case FLDPLUS:
                        case FLDEOF:
-                               np = (struct node *) mh_xmalloc (sizeof(*np));
+                               np = (struct node *) mh_xmalloc(sizeof(*np));
                                *npp = np;
                                *(npp = &np->n_next) = NULL;
-                               np->n_name = getcpy (name);
+                               np->n_name = getcpy(name);
                                if (state == FLDPLUS) {
-                                       cp = getcpy (field);
+                                       cp = getcpy(field);
                                        while (state == FLDPLUS) {
-                                               state = m_getfld (state, name, field, sizeof(field), ib);
-                                               cp = add (field, cp);
+                                               state = m_getfld(state, name, field, sizeof(field), ib);
+                                               cp = add(field, cp);
                                        }
-                                       np->n_field = trimcpy (cp);
-                                       free (cp);
+                                       np->n_field = trimcpy(cp);
+                                       free(cp);
                                } else {
-                                       np->n_field = trimcpy (field);
+                                       np->n_field = trimcpy(field);
                                }
                                np->n_context = ctx;
 
@@ -86,7 +86,7 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx)
                                ** field value to the global variable.
                                */
                                for (ps = procs; ps->procname; ps++)
-                                       if (strcmp (np->n_name, ps->procname) == 0) {
+                                       if (strcmp(np->n_name, ps->procname) == 0) {
                                                *ps->procnaddr = np->n_field;
                                                break;
                                        }
@@ -96,13 +96,13 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx)
 
                        case BODY:
                        case BODYEOF:
-                               adios (NULL, "no blank lines are permitted in %s", file);
+                               adios(NULL, "no blank lines are permitted in %s", file);
 
                        case FILEEOF:
                                break;
 
                        default:
-                               adios (NULL, "%s is poorly formatted", file);
+                               adios(NULL, "%s is poorly formatted", file);
                }
                break;
        }
index ef95db8..21d933c 100644 (file)
 
 
 int
-refile (char **arg, char *file)
+refile(char **arg, char *file)
 {
        pid_t pid;
        register int vecp;
        char *vec[MAXARGS];
 
        vecp = 0;
-       vec[vecp++] = r1bindex (fileproc, '/');
+       vec[vecp++] = r1bindex(fileproc, '/');
        vec[vecp++] = "-nolink";  /* override bad .mh_profile defaults */
        vec[vecp++] = "-nopreserve";
        vec[vecp++] = "-file";
@@ -35,16 +35,16 @@ refile (char **arg, char *file)
 
        switch (pid = vfork()) {
                case -1:
-                       advise ("fork", "unable to");
+                       advise("fork", "unable to");
                        return -1;
 
                case 0:
-                       execvp (fileproc, vec);
-                       fprintf (stderr, "unable to exec ");
-                       perror (fileproc);
-                       _exit (-1);
+                       execvp(fileproc, vec);
+                       fprintf(stderr, "unable to exec ");
+                       perror(fileproc);
+                       _exit(-1);
 
                default:
-                       return (pidwait (pid, -1));
+                       return (pidwait(pid, -1));
        }
 }
index c1e9243..f88fcef 100644 (file)
@@ -145,7 +145,7 @@ done:
                if ((myname = getlogin()) == NULL) {
                        struct passwd *pp;
 
-                       if ((pp = getpwuid (getuid())) != NULL)
+                       if ((pp = getpwuid(getuid())) != NULL)
                                myname = pp->pw_name;
                }
                printf("Name (%s:%s): ", host, myname);
@@ -157,7 +157,7 @@ done:
                }
 
                *aname = mh_xmalloc((size_t) strlen(myname) + 1);
-               strcpy (*aname, myname);
+               strcpy(*aname, myname);
        }
 
        if (!*apass) {
@@ -172,7 +172,7 @@ done:
                }
 
                *apass = mh_xmalloc((size_t) strlen(mypass) + 1);
-               strcpy (*apass, mypass);
+               strcpy(*apass, mypass);
        }
 
 }
index 4e01692..d8f019a 100644 (file)
 */
 
 int
-seq_addsel (struct msgs *mp, char *cp, int public, int zero)
+seq_addsel(struct msgs *mp, char *cp, int public, int zero)
 {
        int i, msgnum, new_seq = 1;
 
-       if (!seq_nameok (cp))
+       if (!seq_nameok(cp))
                return 0;
 
        /*
        ** We keep mp->curmsg and "cur" sequence in sync.
        ** See seq_list() and seq_init().
        */
-       if (!strcmp (current,cp))
+       if (!strcmp(current,cp))
                mp->curmsg = mp->hghsel;
 
        /*
        ** Get the number for this sequence
        */
        for (i = 0; mp->msgattrs[i]; i++) {
-               if (!strcmp (mp->msgattrs[i], cp)) {
+               if (!strcmp(mp->msgattrs[i], cp)) {
                        new_seq = 0;
                        break;
                }
@@ -51,11 +51,11 @@ seq_addsel (struct msgs *mp, char *cp, int public, int zero)
        */
        if (new_seq) {
                if (i >= NUMATTRS) {
-                       advise (NULL, "only %d sequences allowed (no room for %s)!", NUMATTRS, cp);
+                       advise(NULL, "only %d sequences allowed (no room for %s)!", NUMATTRS, cp);
                        return 0;
                }
-               if (!(mp->msgattrs[i] = strdup (cp))) {
-                       advise (NULL, "strdup failed");
+               if (!(mp->msgattrs[i] = strdup(cp))) {
+                       advise(NULL, "strdup failed");
                        return 0;
                }
                mp->msgattrs[i + 1] = NULL;
@@ -67,7 +67,7 @@ seq_addsel (struct msgs *mp, char *cp, int public, int zero)
        */
        if (new_seq || zero) {
                for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++)
-                       clear_sequence (mp, i, msgnum);
+                       clear_sequence(mp, i, msgnum);
        }
 
        /*
@@ -75,25 +75,25 @@ seq_addsel (struct msgs *mp, char *cp, int public, int zero)
        ** for all selected messages.
        */
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
-               if (is_selected (mp, msgnum))
-                       add_sequence (mp, i, msgnum);
+               if (is_selected(mp, msgnum))
+                       add_sequence(mp, i, msgnum);
 
        /*
        ** Set the public/private bit for this sequence.
        */
        if (public == 1)
-               make_seq_public (mp, i);
+               make_seq_public(mp, i);
        else if (public == 0)
-               make_seq_private (mp, i);
+               make_seq_private(mp, i);
        else if (new_seq) {
                /*
                ** If public == -1, then only set the
                ** public/private bit for new sequences.
                */
-               if (is_readonly (mp))
-                       make_seq_private (mp, i);
+               if (is_readonly(mp))
+                       make_seq_private(mp, i);
                else
-                       make_seq_public (mp, i);
+                       make_seq_public(mp, i);
        }
 
        mp->msgflags |= SEQMOD;
@@ -114,24 +114,24 @@ seq_addsel (struct msgs *mp, char *cp, int public, int zero)
 */
 
 int
-seq_addmsg (struct msgs *mp, char *cp, int msgnum, int public, int zero)
+seq_addmsg(struct msgs *mp, char *cp, int msgnum, int public, int zero)
 {
        int i, j, new_seq = 1;
 
-       if (!seq_nameok (cp))
+       if (!seq_nameok(cp))
                return 0;
 
        /*
        ** keep mp->curmsg and msgattrs["cur"] in sync - see seq_list()
        */
-       if (!strcmp (current,cp))
+       if (!strcmp(current,cp))
                mp->curmsg = msgnum;
 
        /*
        ** Get the number for this sequence
        */
        for (i = 0; mp->msgattrs[i]; i++) {
-               if (!strcmp (mp->msgattrs[i], cp)) {
+               if (!strcmp(mp->msgattrs[i], cp)) {
                        new_seq = 0;
                        break;
                }
@@ -142,11 +142,11 @@ seq_addmsg (struct msgs *mp, char *cp, int msgnum, int public, int zero)
        */
        if (new_seq) {
                if (i >= NUMATTRS) {
-                       advise (NULL, "only %d sequences allowed (no room for %s)!", NUMATTRS, cp);
+                       advise(NULL, "only %d sequences allowed (no room for %s)!", NUMATTRS, cp);
                        return 0;
                }
-               if (!(mp->msgattrs[i] = strdup (cp))) {
-                       advise (NULL, "strdup failed");
+               if (!(mp->msgattrs[i] = strdup(cp))) {
+                       advise(NULL, "strdup failed");
                        return 0;
                }
                mp->msgattrs[i + 1] = NULL;
@@ -158,31 +158,31 @@ seq_addmsg (struct msgs *mp, char *cp, int msgnum, int public, int zero)
        */
        if (new_seq || zero) {
                for (j = mp->lowmsg; j <= mp->hghmsg; j++)
-                       clear_sequence (mp, i, j);
+                       clear_sequence(mp, i, j);
        }
 
        /*
        ** Now flip on the bit for this sequence
        ** for this particular message.
        */
-       add_sequence (mp, i, msgnum);
+       add_sequence(mp, i, msgnum);
 
        /*
        ** Set the public/private bit for this sequence.
        */
        if (public == 1)
-               make_seq_public (mp, i);
+               make_seq_public(mp, i);
        else if (public == 0)
-               make_seq_private (mp, i);
+               make_seq_private(mp, i);
        else if (new_seq) {
                /*
                ** If public == -1, then only set the
                ** public/private bit for new sequences.
                */
-               if (is_readonly (mp))
-                       make_seq_private (mp, i);
+               if (is_readonly(mp))
+                       make_seq_private(mp, i);
                else
-                       make_seq_public (mp, i);
+                       make_seq_public(mp, i);
        }
 
        mp->msgflags |= SEQMOD;
index 3d52ed5..589bc03 100644 (file)
 
 
 char *
-seq_bits (struct msgs *mp)
+seq_bits(struct msgs *mp)
 {
        int i;
        size_t len;
        static char buffer[BUFSIZ];
 
-       strncpy (buffer, MBITS, sizeof(buffer));
+       strncpy(buffer, MBITS, sizeof(buffer));
 
        for (i = 0; mp->msgattrs[i]; i++) {
-               len = strlen (buffer);
-               snprintf (buffer + len, sizeof(buffer) - len,
+               len = strlen(buffer);
+               snprintf(buffer + len, sizeof(buffer) - len,
                        "%c%s", FFATTRSLOT + 1 + i, mp->msgattrs[i]);
        }
 
index 1dbb0b8..92e2f1e 100644 (file)
 */
 
 int
-seq_delsel (struct msgs *mp, char *cp, int public, int zero)
+seq_delsel(struct msgs *mp, char *cp, int public, int zero)
 {
        int i, msgnum, new_seq = 1;
 
-       if (!seq_nameok (cp))
+       if (!seq_nameok(cp))
                return 0;
 
        /*
        ** Get the number for this sequence
        */
        for (i = 0; mp->msgattrs[i]; i++) {
-               if (!strcmp (mp->msgattrs[i], cp)) {
+               if (!strcmp(mp->msgattrs[i], cp)) {
                        new_seq = 0;
                        break;
                }
@@ -49,11 +49,11 @@ seq_delsel (struct msgs *mp, char *cp, int public, int zero)
                */
                if (new_seq) {
                        if (i >= NUMATTRS) {
-                               advise (NULL, "only %d sequences allowed (no room for %s)!", NUMATTRS, cp);
+                               advise(NULL, "only %d sequences allowed (no room for %s)!", NUMATTRS, cp);
                                return 0;
                        }
-                       if (!(mp->msgattrs[i] = strdup (cp))) {
-                               advise (NULL, "strdup failed");
+                       if (!(mp->msgattrs[i] = strdup(cp))) {
+                               advise(NULL, "strdup failed");
                                return 0;
                        }
                        mp->msgattrs[i + 1] = NULL;
@@ -62,14 +62,14 @@ seq_delsel (struct msgs *mp, char *cp, int public, int zero)
                ** now add sequence bit to all existing messages
                */
                for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++) {
-                       if (does_exist (mp, msgnum))
-                               add_sequence (mp, i, msgnum);
+                       if (does_exist(mp, msgnum))
+                               add_sequence(mp, i, msgnum);
                        else
-                               clear_sequence (mp, i, msgnum);
+                               clear_sequence(mp, i, msgnum);
                }
        } else {
                if (new_seq) {
-                       advise (NULL, "no such sequence as %s", cp);
+                       advise(NULL, "no such sequence as %s", cp);
                        return 0;
                }
        }
@@ -78,25 +78,25 @@ seq_delsel (struct msgs *mp, char *cp, int public, int zero)
        ** Now clear the bit on all selected messages
        */
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
-               if (is_selected (mp, msgnum))
-                       clear_sequence (mp, i, msgnum);
+               if (is_selected(mp, msgnum))
+                       clear_sequence(mp, i, msgnum);
 
        /*
        ** Set the public/private bit for this sequence.
        */
        if (public == 1)
-               make_seq_public (mp, i);
+               make_seq_public(mp, i);
        else if (public == 0)
-               make_seq_private (mp, i);
+               make_seq_private(mp, i);
        else if (new_seq) {
                /*
                ** If public == -1, then only set the
                ** public/private bit for new sequences.
                */
-               if (is_readonly (mp))
-                       make_seq_private (mp, i);
+               if (is_readonly(mp))
+                       make_seq_private(mp, i);
                else
-                       make_seq_public (mp, i);
+                       make_seq_public(mp, i);
        }
 
        mp->msgflags |= SEQMOD;
@@ -111,21 +111,21 @@ seq_delsel (struct msgs *mp, char *cp, int public, int zero)
 */
 
 int
-seq_delmsg (struct msgs *mp, char *cp, int msgnum)
+seq_delmsg(struct msgs *mp, char *cp, int msgnum)
 {
        int i;
 
-       if (!seq_nameok (cp))
+       if (!seq_nameok(cp))
                return 0;
 
        for (i = 0; mp->msgattrs[i]; i++) {
-               if (!strcmp (mp->msgattrs[i], cp)) {
-                       clear_sequence (mp, i, msgnum);
+               if (!strcmp(mp->msgattrs[i], cp)) {
+                       clear_sequence(mp, i, msgnum);
                        mp->msgflags |= SEQMOD;
                        return 1;
                }
        }
 
-       advise (NULL, "no such sequence as %s", cp);
+       advise(NULL, "no such sequence as %s", cp);
        return 0;
 }
index 34e6049..4605915 100644 (file)
 
 
 int
-seq_getnum (struct msgs *mp, char *seqname)
+seq_getnum(struct msgs *mp, char *seqname)
 {
        int i;
 
        for (i = 0; mp->msgattrs[i]; i++)
-               if (!strcmp (mp->msgattrs[i], seqname))
+               if (!strcmp(mp->msgattrs[i], seqname))
                        return i;
 
        return -1;
index 87c5d04..1e2e606 100644 (file)
@@ -27,7 +27,7 @@ seq_list(struct msgs *mp, char *seqname)
        /* On first invocation, allocate initial buffer space */
        if (!buffer) {
                len = MAXBUFFER;
-               buffer = mh_xmalloc ((size_t) len);
+               buffer = mh_xmalloc((size_t) len);
        }
 
        /*
@@ -36,7 +36,7 @@ seq_list(struct msgs *mp, char *seqname)
        ** This is returned, even if message doesn't exist or the
        ** folder is empty.
        */
-       if (!strcmp (current, seqname)) {
+       if (!strcmp(current, seqname)) {
                if (mp->curmsg) {
                        sprintf(buffer, "%s", m_name(mp->curmsg));
                        return (buffer);
@@ -49,7 +49,7 @@ seq_list(struct msgs *mp, char *seqname)
                return NULL;
 
        /* Get the index of the sequence */
-       if ((seqnum = seq_getnum (mp, seqname)) == -1)
+       if ((seqnum = seq_getnum(mp, seqname)) == -1)
                return NULL;
 
        bp = buffer;
@@ -72,7 +72,7 @@ seq_list(struct msgs *mp, char *seqname)
                        char *newbuf;
 
                        len += MAXBUFFER;
-                       newbuf = mh_xrealloc (buffer, (size_t) len);
+                       newbuf = mh_xrealloc(buffer, (size_t) len);
                        bp = newbuf + (bp - buffer);
                        buffer = newbuf;
                }
index e9598c0..f9ed1b0 100644 (file)
 
 
 int
-seq_nameok (unsigned char *s)
+seq_nameok(unsigned char *s)
 {
        unsigned char *pp;
 
        if (s == NULL || *s == '\0') {
-               advise (NULL, "empty sequence name");
+               advise(NULL, "empty sequence name");
                return 0;
        }
 
@@ -23,13 +23,13 @@ seq_nameok (unsigned char *s)
        ** Make sure sequence name doesn't clash with one
        ** of the `reserved' sequence names.
        */
-       if (!(strcmp (s, "new") &&
-                 strcmp (s, "all") &&
-                 strcmp (s, "first") &&
-                 strcmp (s, "last") &&
-                 strcmp (s, "prev") &&
-                 strcmp (s, "next"))) {
-               advise (NULL, "illegal sequence name: %s", s);
+       if (!(strcmp(s, "new") &&
+                 strcmp(s, "all") &&
+                 strcmp(s, "first") &&
+                 strcmp(s, "last") &&
+                 strcmp(s, "prev") &&
+                 strcmp(s, "next"))) {
+               advise(NULL, "illegal sequence name: %s", s);
                return 0;
        }
 
@@ -37,8 +37,8 @@ seq_nameok (unsigned char *s)
        ** First character in a sequence name must be
        ** an alphabetic character ...
        */
-       if (!isalpha (*s)) {
-               advise (NULL, "illegal sequence name: %s", s);
+       if (!isalpha(*s)) {
+               advise(NULL, "illegal sequence name: %s", s);
                return 0;
        }
 
@@ -46,8 +46,8 @@ seq_nameok (unsigned char *s)
        ** and can be followed by zero or more alphanumeric characters
        */
        for (pp = s + 1; *pp; pp++)
-               if (!isalnum (*pp)) {
-                       advise (NULL, "illegal sequence name: %s", s);
+               if (!isalnum(*pp)) {
+                       advise(NULL, "illegal sequence name: %s", s);
                        return 0;
                }
 
index e73424e..7cd7c1a 100644 (file)
 ** Print all the sequences in a folder
 */
 void
-seq_printall (struct msgs *mp)
+seq_printall(struct msgs *mp)
 {
        int i;
        char *list;
 
        for (i = 0; mp->msgattrs[i]; i++) {
-               list = seq_list (mp, mp->msgattrs[i]);
-               printf ("%s%s: %s\n", mp->msgattrs[i],
-                       is_seq_private (mp, i) ? " (private)" : "",
+               list = seq_list(mp, mp->msgattrs[i]);
+               printf("%s%s: %s\n", mp->msgattrs[i],
+                       is_seq_private(mp, i) ? " (private)" : "",
                        empty(list));
        }
 }
@@ -32,17 +32,17 @@ seq_printall (struct msgs *mp)
 ** Print a particular sequence in a folder
 */
 void
-seq_print (struct msgs *mp, char *seqname)
+seq_print(struct msgs *mp, char *seqname)
 {
        int i;
        char *list;
 
        /* get the index of sequence */
-       i = seq_getnum (mp, seqname);
+       i = seq_getnum(mp, seqname);
 
        /* get sequence information */
-       list = seq_list (mp, seqname);
+       list = seq_list(mp, seqname);
 
-       printf ("%s%s: %s\n", seqname, (i == -1) ? "" :
+       printf("%s%s: %s\n", seqname, (i == -1) ? "" :
                is_seq_private(mp, i) ? " (private)" : "", empty(list));
 }
index 448f9ef..141c1a2 100644 (file)
@@ -13,9 +13,9 @@
 /*
 ** static prototypes
 */
-static int seq_init (struct msgs *, char *, char *);
-static void seq_public (struct msgs *);
-static void seq_private (struct msgs *);
+static int seq_init(struct msgs *, char *, char *);
+static void seq_public(struct msgs *);
+static void seq_private(struct msgs *);
 
 
 /*
@@ -25,25 +25,25 @@ static void seq_private (struct msgs *);
 */
 
 void
-seq_read (struct msgs *mp)
+seq_read(struct msgs *mp)
 {
        /*
        ** Initialize the list of sequence names.  Go ahead and
        ** add the "cur" sequence to the list of sequences.
        */
-       mp->msgattrs[0] = getcpy (current);
+       mp->msgattrs[0] = getcpy(current);
        mp->msgattrs[1] = NULL;
-       make_all_public (mp);  /* initially, make all public */
+       make_all_public(mp);  /* initially, make all public */
 
        /* If folder is empty, don't scan for sequence information */
        if (mp->nummsg == 0)
                return;
 
        /* Initialize the public sequences */
-       seq_public (mp);
+       seq_public(mp);
 
        /* Initialize the private sequences */
-       seq_private (mp);
+       seq_private(mp);
 }
 
 
@@ -52,7 +52,7 @@ seq_read (struct msgs *mp)
 */
 
 static void
-seq_public (struct msgs *mp)
+seq_public(struct msgs *mp)
 {
        int state;
        char *cp, seqfile[PATH_MAX];
@@ -69,27 +69,27 @@ seq_public (struct msgs *mp)
                return;
 
        /* get filename of sequence file */
-       snprintf (seqfile, sizeof(seqfile), "%s/%s", mp->foldpath, mh_seq);
+       snprintf(seqfile, sizeof(seqfile), "%s/%s", mp->foldpath, mh_seq);
 
-       if ((fp = lkfopen (seqfile, "r")) == NULL)
+       if ((fp = lkfopen(seqfile, "r")) == NULL)
                return;
 
        /* Use m_getfld to scan sequence file */
        for (state = FLD;;) {
-               switch (state = m_getfld (state, name, field, sizeof(field), fp)) {
+               switch (state = m_getfld(state, name, field, sizeof(field), fp)) {
                        case FLD:
                        case FLDPLUS:
                        case FLDEOF:
                                if (state == FLDPLUS) {
-                                       cp = getcpy (field);
+                                       cp = getcpy(field);
                                        while (state == FLDPLUS) {
-                                               state = m_getfld (state, name, field, sizeof(field), fp);
-                                               cp = add (field, cp);
+                                               state = m_getfld(state, name, field, sizeof(field), fp);
+                                               cp = add(field, cp);
                                        }
-                                       seq_init (mp, getcpy (name), trimcpy (cp));
-                                       free (cp);
+                                       seq_init(mp, getcpy(name), trimcpy(cp));
+                                       free(cp);
                                } else {
-                                       seq_init (mp, getcpy (name), trimcpy (field));
+                                       seq_init(mp, getcpy(name), trimcpy(field));
                                }
                                if (state == FLDEOF)
                                        break;
@@ -97,19 +97,19 @@ seq_public (struct msgs *mp)
 
                        case BODY:
                        case BODYEOF:
-                               adios (NULL, "no blank lines are permitted in %s", seqfile);
+                               adios(NULL, "no blank lines are permitted in %s", seqfile);
                                /* fall */
 
                        case FILEEOF:
                                break;
 
                        default:
-                               adios (NULL, "%s is poorly formatted", seqfile);
+                               adios(NULL, "%s is poorly formatted", seqfile);
                }
                break;  /* break from for loop */
        }
 
-       lkfclose (fp, seqfile);
+       lkfclose(fp, seqfile);
 }
 
 
@@ -121,24 +121,25 @@ seq_public (struct msgs *mp)
 */
 
 static void
-seq_private (struct msgs *mp)
+seq_private(struct msgs *mp)
 {
        int i, j, alen, plen;
        char *cp;
        struct node *np;
 
-       alen = strlen ("atr-");
-       plen = strlen (mp->foldpath) + 1;
+       alen = strlen("atr-");
+       plen = strlen(mp->foldpath) + 1;
 
        for (np = m_defs; np; np = np->n_next) {
-               if (ssequal ("atr-", np->n_name)
-                       && (j = strlen (np->n_name) - plen) > alen
-                       && *(np->n_name + j) == '-'
-                       && strcmp (mp->foldpath, np->n_name + j + 1) == 0) {
-                       cp = getcpy (np->n_name + alen);
+               if (ssequal("atr-", np->n_name)
+                               && (j = strlen(np->n_name) - plen) > alen
+                               && *(np->n_name + j) == '-'
+                               && strcmp(mp->foldpath, np->n_name + j + 1)
+                               == 0) {
+                       cp = getcpy(np->n_name + alen);
                        *(cp + j - alen) = '\0';
-                       if ((i = seq_init (mp, cp, getcpy (np->n_field))) != -1)
-                               make_seq_private (mp, i);
+                       if ((i = seq_init(mp, cp, getcpy(np->n_field))) != -1)
+                               make_seq_private(mp, i);
                }
        }
 }
@@ -155,7 +156,7 @@ seq_private (struct msgs *mp)
 */
 
 static int
-seq_init (struct msgs *mp, char *name, char *field)
+seq_init(struct msgs *mp, char *name, char *field)
 {
        int i, j, k, is_current;
        char *cp, **ap;
@@ -164,7 +165,7 @@ seq_init (struct msgs *mp, char *name, char *field)
        ** Check if this is "cur" sequence,
        ** so we can do some special things.
        */
-       is_current = !strcmp (current, name);
+       is_current = !strcmp(current, name);
 
        /*
        ** Search for this sequence name to see if we've seen
@@ -173,17 +174,17 @@ seq_init (struct msgs *mp, char *name, char *field)
        ** mesages in this folder.
        */
        for (i = 0; mp->msgattrs[i]; i++) {
-               if (!strcmp (mp->msgattrs[i], name)) {
+               if (!strcmp(mp->msgattrs[i], name)) {
                        for (j = mp->lowmsg; j <= mp->hghmsg; j++)
-                               clear_sequence (mp, i, j);
+                               clear_sequence(mp, i, j);
                        break;
                }
        }
 
        /* Return error, if too many sequences */
        if (i >= NUMATTRS) {
-               free (name);
-               free (field);
+               free(name);
+               free(field);
                return -1;
        }
 
@@ -192,7 +193,7 @@ seq_init (struct msgs *mp, char *name, char *field)
        ** name string.  Else add it to the list of sequence names.
        */
        if (mp->msgattrs[i]) {
-               free (name);
+               free(name);
        } else {
                mp->msgattrs[i] = name;
                mp->msgattrs[i + 1] = NULL;
@@ -201,11 +202,11 @@ seq_init (struct msgs *mp, char *name, char *field)
        /*
        ** Split up the different message ranges at whitespace
        */
-       for (ap = brkstring (field, " ", "\n"); *ap; ap++) {
+       for (ap = brkstring(field, " ", "\n"); *ap; ap++) {
                if ((cp = strchr(*ap, '-')))
                        *cp++ = '\0';
-               if ((j = m_atoi (*ap)) > 0) {
-                       k = cp ? m_atoi (cp) : j;
+               if ((j = m_atoi(*ap)) > 0) {
+                       k = cp ? m_atoi(cp) : j;
 
                        /*
                        ** Keep mp->curmsg and "cur" sequence in synch.  Unlike
@@ -222,12 +223,13 @@ seq_init (struct msgs *mp, char *name, char *field)
                        ** and flip on bit for this sequence.
                        */
                        for (; j <= k; j++) {
-                               if (j >= mp->lowmsg && j <= mp->hghmsg && does_exist(mp, j))
-                                       add_sequence (mp, i, j);
+                               if (j >= mp->lowmsg && j <= mp->hghmsg &&
+                                               does_exist(mp, j))
+                                       add_sequence(mp, i, j);
                        }
                }
        }
 
-       free (field);  /* free string containing message ranges */
+       free(field);  /* free string containing message ranges */
        return i;
 }
index e6f5a5b..15d3f1c 100644 (file)
@@ -21,7 +21,7 @@
 */
 
 void
-seq_save (struct msgs *mp)
+seq_save(struct msgs *mp)
 {
        int i;
        char flags, *cp, attr[BUFSIZ], seqfile[PATH_MAX];
@@ -42,28 +42,28 @@ seq_save (struct msgs *mp)
        ** is readonly.  This will force all sequences to be private.
        */
        if (mh_seq == NULL || *mh_seq == '\0')
-               set_readonly (mp);
+               set_readonly(mp);
        else
-               snprintf (seqfile, sizeof(seqfile), "%s/%s", mp->foldpath,
+               snprintf(seqfile, sizeof(seqfile), "%s/%s", mp->foldpath,
                                mh_seq);
 
        for (i = 0; mp->msgattrs[i]; i++) {
-               snprintf (attr, sizeof(attr), "atr-%s-%s", mp->msgattrs[i],
+               snprintf(attr, sizeof(attr), "atr-%s-%s", mp->msgattrs[i],
                                mp->foldpath);
 
                /* get space separated list of sequence ranges */
                if (!(cp = seq_list(mp, mp->msgattrs[i]))) {
-                       context_del (attr);  /* delete sequence from context */
+                       context_del(attr);  /* delete sequence from context */
                        continue;
                }
 
                if (is_readonly(mp) || is_seq_private(mp, i)) {
 priv:
                        /* sequence is private */
-                       context_replace (attr, cp);  /* update sequence in context   */
+                       context_replace(attr, cp);  /* update seq in ctx */
                } else {
                        /* sequence is public */
-                       context_del (attr);  /* delete sequence from context */
+                       context_del(attr);  /* delete sequence from context */
 
                        if (!fp) {
                                /*
@@ -71,35 +71,36 @@ priv:
                                ** If that fails (probably because folder is
                                ** readonly), then make sequence private.
                                */
-                               if ((fp = lkfopen (seqfile, "w")) == NULL
-                                               && (unlink (seqfile) == -1 ||
-                                                       (fp = lkfopen (seqfile, "w")) == NULL)) {
-                                       admonish (attr, "unable to write");
+                               if ((fp = lkfopen(seqfile, "w")) == NULL
+                                               && (unlink(seqfile) == -1 ||
+                                               (fp = lkfopen(seqfile, "w"))
+                                               == NULL)) {
+                                       admonish(attr, "unable to write");
                                        goto priv;
                                }
 
                                /* block a few signals */
-                               sigemptyset (&set);
+                               sigemptyset(&set);
                                sigaddset(&set, SIGHUP);
                                sigaddset(&set, SIGINT);
                                sigaddset(&set, SIGQUIT);
                                sigaddset(&set, SIGTERM);
-                               SIGPROCMASK (SIG_BLOCK, &set, &oset);
+                               SIGPROCMASK(SIG_BLOCK, &set, &oset);
                        }
-                       fprintf (fp, "%s: %s\n", mp->msgattrs[i], cp);
+                       fprintf(fp, "%s: %s\n", mp->msgattrs[i], cp);
                }
        }
 
        if (fp) {
-               lkfclose (fp, seqfile);
-               SIGPROCMASK (SIG_SETMASK, &oset, &set);  /* reset signal mask */
+               lkfclose(fp, seqfile);
+               SIGPROCMASK(SIG_SETMASK, &oset, &set);  /* reset signal mask */
        } else {
                /*
                ** If folder is not readonly, and we didn't save any
                ** public sequences, then remove that file.
                */
                if (!is_readonly(mp))
-                       unlink (seqfile);
+                       unlink(seqfile);
        }
 
        /*
index 357c04b..0de8b97 100644 (file)
 
 
 void
-seq_setcur (struct msgs *mp, int msgnum)
+seq_setcur(struct msgs *mp, int msgnum)
 {
        /*
        ** Just call seq_addmsg() to update the
        ** "cur" sequence.
        */
-       seq_addmsg (mp, current, msgnum, -1, 1);
+       seq_addmsg(mp, current, msgnum, -1, 1);
 }
index 530c11f..c66c132 100644 (file)
@@ -17,7 +17,7 @@
 */
 
 void
-seq_setprev (struct msgs *mp)
+seq_setprev(struct msgs *mp)
 {
        char **ap, *cp, *dp;
 
@@ -25,10 +25,10 @@ seq_setprev (struct msgs *mp)
        ** Get the list of sequences for Previous-Sequence
        ** and split them.
        */
-       if ((cp = context_find (psequence))) {
-               dp = getcpy (cp);
-               if (!(ap = brkstring (dp, " ", "\n")) || !*ap) {
-                       free (dp);
+       if ((cp = context_find(psequence))) {
+               dp = getcpy(cp);
+               if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
+                       free(dp);
                        return;
                }
        } else {
@@ -37,7 +37,7 @@ seq_setprev (struct msgs *mp)
 
        /* Now add all SELECTED messages to each sequence */
        for (; *ap; ap++)
-               seq_addsel (mp, *ap, -1, 1);
+               seq_addsel(mp, *ap, -1, 1);
 
-       free (dp);
+       free(dp);
 }
index 8c9fe41..b18de5d 100644 (file)
@@ -18,7 +18,7 @@
 */
 
 void
-seq_setunseen (struct msgs *mp, int seen)
+seq_setunseen(struct msgs *mp, int seen)
 {
        int msgnum;
        char **ap, *cp, *dp;
@@ -27,10 +27,10 @@ seq_setunseen (struct msgs *mp, int seen)
        ** Get the list of sequences for Unseen-Sequence
        ** and split them.
        */
-       if ((cp = context_find (usequence))) {
-               dp = getcpy (cp);
-               if (!(ap = brkstring (dp, " ", "\n")) || !*ap) {
-                       free (dp);
+       if ((cp = context_find(usequence))) {
+               dp = getcpy(cp);
+               if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
+                       free(dp);
                        return;
                }
        } else {
@@ -46,14 +46,14 @@ seq_setunseen (struct msgs *mp, int seen)
                        /* make sure sequence exists first */
                        if (seq_getnum(mp, *ap) != -1)
                                for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
-                                       if (is_unseen (mp, msgnum))
-                                               seq_delmsg (mp, *ap, msgnum);
+                                       if (is_unseen(mp, msgnum))
+                                               seq_delmsg(mp, *ap, msgnum);
                } else {
                        for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++)
-                               if (is_unseen (mp, msgnum))
-                                       seq_addmsg (mp, *ap, msgnum, -1, 0);
+                               if (is_unseen(mp, msgnum))
+                                       seq_addmsg(mp, *ap, msgnum, -1, 0);
                }
        }
 
-       free (dp);
+       free(dp);
 }
index ac9fc69..c0d3608 100644 (file)
@@ -10,7 +10,7 @@
 
 
 int
-showfile (char **arg, char *file)
+showfile(char **arg, char *file)
 {
        pid_t pid;
        int isdraft, vecp;
@@ -24,19 +24,19 @@ showfile (char **arg, char *file)
        ** then really invoked the mhlproc instead
        ** (which is usually mhl anyway).
        */
-       if (!strcmp (r1bindex (lproc, '/'), "mhl"))
+       if (!strcmp(r1bindex(lproc, '/'), "mhl"))
                lproc = mhlproc;
 
        switch (pid = vfork()) {
        case -1:
                /* fork error */
-               advise ("fork", "unable to");
+               advise("fork", "unable to");
                return 1;
 
        case 0:
                /* child */
                vecp = 0;
-               vec[vecp++] = r1bindex (lproc, '/');
+               vec[vecp++] = r1bindex(lproc, '/');
                isdraft = 1;
                if (arg) {
                        while (*arg) {
@@ -46,20 +46,20 @@ showfile (char **arg, char *file)
                        }
                }
                if (isdraft) {
-                       if (!strcmp (vec[0], "show"))
+                       if (!strcmp(vec[0], "show"))
                                vec[vecp++] = "-file";
                        vec[vecp++] = file;
                }
                vec[vecp] = NULL;
 
-               execvp (lproc, vec);
-               fprintf (stderr, "unable to exec ");
-               perror (lproc);
-               _exit (-1);
+               execvp(lproc, vec);
+               fprintf(stderr, "unable to exec ");
+               perror(lproc);
+               _exit(-1);
 
        default:
                /* parent */
-               return (pidwait (pid, -1) & 0377 ? 1 : 0);
+               return (pidwait(pid, -1) & 0377 ? 1 : 0);
        }
 
        return 1;  /* NOT REACHED */
index 1f1b0be..77d61ce 100644 (file)
@@ -11,7 +11,7 @@
 
 
 int
-SIGPROCMASK (int how, const sigset_t *set, sigset_t *oset)
+SIGPROCMASK(int how, const sigset_t *set, sigset_t *oset)
 {
 #ifdef POSIX_SIGNALS
        return sigprocmask(how, set, oset);
@@ -47,7 +47,7 @@ SIGPROCMASK (int how, const sigset_t *set, sigset_t *oset)
 */
 
 SIGNAL_HANDLER
-SIGNAL (int sig, SIGNAL_HANDLER func)
+SIGNAL(int sig, SIGNAL_HANDLER func)
 {
 #ifdef POSIX_SIGNALS
        struct sigaction act, oact;
@@ -69,7 +69,7 @@ SIGNAL (int sig, SIGNAL_HANDLER func)
                return (SIG_ERR);
        return (oact.sa_handler);
 #else
-       return signal (sig, func);
+       return signal(sig, func);
 #endif
 }
 
@@ -81,7 +81,7 @@ SIGNAL (int sig, SIGNAL_HANDLER func)
 ** signals if available.
 */
 SIGNAL_HANDLER
-SIGNAL2 (int sig, SIGNAL_HANDLER func)
+SIGNAL2(int sig, SIGNAL_HANDLER func)
 {
 #ifdef POSIX_SIGNALS
        struct sigaction act, oact;
@@ -109,8 +109,8 @@ SIGNAL2 (int sig, SIGNAL_HANDLER func)
 #else
        SIGNAL_HANDLER ofunc;
 
-       if ((ofunc = signal (sig, SIG_IGN)) != SIG_IGN)
-               signal (sig, func);
+       if ((ofunc = signal(sig, SIG_IGN)) != SIG_IGN)
+               signal(sig, func);
        return ofunc;
 #endif
 }
index 655831c..ce7bf8a 100644 (file)
 
 
 char *
-snprintb (char *buffer, size_t n, unsigned v, char *bits)
+snprintb(char *buffer, size_t n, unsigned v, char *bits)
 {
        register int i, j;
        register char c, *bp;
 
-       snprintf (buffer, n, bits && *bits == 010 ? "0%o" : "0x%x", v);
+       snprintf(buffer, n, bits && *bits == 010 ? "0%o" : "0x%x", v);
        bp = buffer + strlen(buffer);
 
        if (bits && *++bits) {
index 95c6776..99b1249 100644 (file)
@@ -22,7 +22,7 @@
 */
 
 int
-ssequal (char *s1, char *s2)
+ssequal(char *s1, char *s2)
 {
        if (!s1)
                s1 = "";
index 354fd0f..608b4a5 100644 (file)
@@ -15,7 +15,7 @@
 */
 
 int
-mh_strcasecmp (const char *s1, const char *s2)
+mh_strcasecmp(const char *s1, const char *s2)
 {
        const unsigned char *us1, *us2;
 
index 7696e5f..2d30d86 100644 (file)
@@ -11,7 +11,7 @@
 
 
 char *
-strdup (const char *str)
+strdup(const char *str)
 {
        char *cp;
        size_t len;
@@ -20,7 +20,7 @@ strdup (const char *str)
                return NULL;
 
        len = strlen(str) + 1;
-       cp = mh_xmalloc (len);
-       memcpy (cp, str, len);
+       cp = mh_xmalloc(len);
+       memcpy(cp, str, len);
        return cp;
 }
index fdde7fd..2513b30 100644 (file)
@@ -9,7 +9,7 @@
 #include <h/mh.h>
 
 int
-stringdex (char *p1, char *p2)
+stringdex(char *p1, char *p2)
 {
        char *p;
 
@@ -17,7 +17,7 @@ stringdex (char *p1, char *p2)
                return -1;
 
        for (p = p2; *p; p++)
-               if (uprf (p, p1))
+               if (uprf(p, p1))
                        return (p - p2);
 
        return -1;
index 1f590c3..64dd848 100644 (file)
@@ -12,7 +12,7 @@
 
 
 char *
-trimcpy (unsigned char *cp)
+trimcpy(unsigned char *cp)
 {
        unsigned char *sp;
 
index ea0964e..836a98b 100644 (file)
@@ -13,7 +13,7 @@
 
 
 int
-uprf (char *c1, char *c2)
+uprf(char *c1, char *c2)
 {
        int c, mask;
 
index f450c58..5c1253d 100644 (file)
@@ -68,17 +68,17 @@ pwd(void)
        register char *cp;
        static char curwd[PATH_MAX];
 
-       if (!getcwd (curwd, PATH_MAX)) {
-               admonish (NULL, "unable to determine working directory");
+       if (!getcwd(curwd, PATH_MAX)) {
+               admonish(NULL, "unable to determine working directory");
                if (!mypath || !*mypath
-                       || (strcpy (curwd, mypath), chdir (curwd)) == -1) {
-                       strcpy (curwd, "/");
-                       chdir (curwd);
+                       || (strcpy(curwd, mypath), chdir(curwd)) == -1) {
+                       strcpy(curwd, "/");
+                       chdir(curwd);
                }
                return curwd;
        }
 
-       if ((cp = curwd + strlen (curwd) - 1) > curwd && *cp == '/')
+       if ((cp = curwd + strlen(curwd) - 1) > curwd && *cp == '/')
                *cp = '\0';
 
        return curwd;
@@ -93,27 +93,27 @@ pwd(void)
 **       -- malloc'ed memory.  Then free "s1".
 */
 char *
-add (char *s2, char *s1)
+add(char *s2, char *s1)
 {
        char *cp;
        size_t len1 = 0, len2 = 0;
 
        if (s1)
-               len1 = strlen (s1);
+               len1 = strlen(s1);
        if (s2)
-               len2 = strlen (s2);
+               len2 = strlen(s2);
 
-       cp = mh_xmalloc (len1 + len2 + 1);
+       cp = mh_xmalloc(len1 + len2 + 1);
 
        /* Copy s1 and free it */
        if (s1) {
-               memcpy (cp, s1, len1);
-               free (s1);
+               memcpy(cp, s1, len1);
+               free(s1);
        }
 
        /* Copy s2 */
        if (s2)
-               memcpy (cp + len1, s2, len2);
+               memcpy(cp + len1, s2, len2);
 
        /* Now NULL terminate the string */
        cp[len1 + len2] = '\0';
@@ -131,7 +131,7 @@ folder_exists(char *folder)
        struct stat st;
        int exists = 0;
 
-       if (stat (folder, &st) == -1) {
+       if (stat(folder, &st) == -1) {
                /*
                ** The folder either doesn't exist, or we hit an error.
                ** Either way return a failure.
@@ -157,21 +157,21 @@ create_folder(char *folder, int autocreate, void (*done_callback)(int))
        extern int errno;
        char *cp;
 
-       if (stat (folder, &st) == -1) {
+       if (stat(folder, &st) == -1) {
                if (errno != ENOENT)
-                       adios (folder, "error on folder");
+                       adios(folder, "error on folder");
                if (autocreate == 0) {
                        /* ask before creating folder */
-                       cp = concat ("Create folder \"", folder, "\"? ", NULL);
-                       if (!getanswer (cp))
-                               done_callback (1);
-                       free (cp);
+                       cp = concat("Create folder \"", folder, "\"? ", NULL);
+                       if (!getanswer(cp))
+                               done_callback(1);
+                       free(cp);
                } else if (autocreate == -1) {
                        /* do not create, so exit */
-                       done_callback (1);
+                       done_callback(1);
                }
-               if (!makedir (folder))
-                       adios (NULL, "unable to create folder %s", folder);
+               if (!makedir(folder))
+                       adios(NULL, "unable to create folder %s", folder);
        }
 }
 
@@ -180,13 +180,13 @@ create_folder(char *folder, int autocreate, void (*done_callback)(int))
 **     Return the number of digits in a nonnegative integer.
 */
 int
-num_digits (int n)
+num_digits(int n)
 {
        int ndigits = 0;
 
        /* Sanity check */
        if (n < 0)
-               adios (NULL, "oops, num_digits called with negative value");
+               adios(NULL, "oops, num_digits called with negative value");
 
        if (n == 0)
                return 1;
@@ -219,11 +219,11 @@ open_form(char **form, char *def)
 {
        int in;
        if (*form) {
-               if ((in = open (etcpath (*form), O_RDONLY)) == NOTOK)
-                       adios (*form, "unable to open form file");
+               if ((in = open(etcpath(*form), O_RDONLY)) == NOTOK)
+                       adios(*form, "unable to open form file");
        } else {
-               if ((in = open (etcpath (def), O_RDONLY)) == NOTOK)
-                       adios (def, "unable to open default components file");
+               if ((in = open(etcpath(def), O_RDONLY)) == NOTOK)
+                       adios(def, "unable to open default components file");
                *form = def;
        }
        return in;
index e9ed23e..bd01a2c 100644 (file)
@@ -13,7 +13,7 @@
 
 
 int
-vfgets (FILE *in, char **bp)
+vfgets(FILE *in, char **bp)
 {
        int toggle;
        char *cp, *dp, *ep, *fp;
@@ -21,21 +21,21 @@ vfgets (FILE *in, char **bp)
        static char *pp = NULL;
 
        if (pp == NULL)
-               pp = mh_xmalloc ((size_t) (len = BUFSIZ));
+               pp = mh_xmalloc((size_t) (len = BUFSIZ));
 
        for (ep = (cp = pp) + len - 1;;) {
-               if (fgets (cp, ep - cp + 1, in) == NULL) {
+               if (fgets(cp, ep - cp + 1, in) == NULL) {
                        if (cp != pp) {
                                *bp = pp;
                                return 0;
                        }
-                       return (ferror (in) && !feof (in) ? -1 : 1);
+                       return (ferror(in) && !feof(in) ? -1 : 1);
                }
 
-               if ((dp = cp + strlen (cp) - 2) < cp || *dp != QUOTE) {
+               if ((dp = cp + strlen(cp) - 2) < cp || *dp != QUOTE) {
 wrong_guess:
                        if (cp > ++dp)
-                               adios (NULL, "vfgets() botch -- you lose big");
+                               adios(NULL, "vfgets() botch -- you lose big");
                        if (*dp == '\n') {
                                *bp = pp;
                                return 0;
@@ -63,7 +63,7 @@ wrong_guess:
                if (cp >= ep) {
                        int curlen = cp - pp;
 
-                       dp = mh_xrealloc (pp, (size_t) (len += BUFSIZ));
+                       dp = mh_xrealloc(pp, (size_t) (len += BUFSIZ));
                        cp = dp + curlen;
                        ep = (pp = dp) + len - 1;
                }
index 21b95e1..6b9dbf5 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
@@ -48,12 +48,12 @@ extern struct aka *akahead;
 /*
 ** prototypes
 */
-static void print_aka (char *, int, int);
-static void print_usr (char *, int, int);
+static void print_aka(char *, int, int);
+static void print_usr(char *, int, int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int i, vecp = 0, inverted = 0, list = 0;
        int noalias = 0, normalize = AD_NHST;
@@ -64,38 +64,38 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       mts_init (invo_name);
-       arguments = getarguments (invo_name, argc, argv, 1);
+       mts_init(invo_name);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [switches] aliases ...",
+                                       snprintf(buf, sizeof(buf), "%s [switches] aliases ...",
                                                invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
-                                       print_version (invo_name);
-                                       done (1);
+                                       print_version(invo_name);
+                                       done(1);
 
                                case ALIASW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       if ((i = alias (cp)) != AK_OK)
-                                               adios (NULL, "aliasing error in %s - %s", cp, akerror (i));
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       if ((i = alias(cp)) != AK_OK)
+                                               adios(NULL, "aliasing error in %s - %s", cp, akerror(i));
                                        continue;
                                case NALIASW:
                                        noalias++;
@@ -128,16 +128,16 @@ main (int argc, char **argv)
 
        if (!noalias) {
                /* allow Aliasfile: profile entry */
-               if ((cp = context_find ("Aliasfile"))) {
+               if ((cp = context_find("Aliasfile"))) {
                        char *dp = NULL;
 
                        for (ap = brkstring(dp = getcpy(cp), " ", "\n"); ap && *ap; ap++)
-                               if ((i = alias (*ap)) != AK_OK)
-                                       adios (NULL, "aliasing error in %s - %s", *ap, akerror (i));
+                               if ((i = alias(*ap)) != AK_OK)
+                                       adios(NULL, "aliasing error in %s - %s", *ap, akerror(i));
                        if (dp)
                                free(dp);
                }
-               alias (AliasFile);
+               alias(AliasFile);
        }
 
        /*
@@ -145,39 +145,39 @@ main (int argc, char **argv)
        */
        if (inverted) {
                if (vecp == 0)
-                       adios (NULL, "usage: %s -user addresses ...  (you forgot the addresses)",
+                       adios(NULL, "usage: %s -user addresses ...  (you forgot the addresses)",
                                   invo_name);
 
                for (i = 0; i < vecp; i++)
-                       print_usr (vec[i], list, normalize);
+                       print_usr(vec[i], list, normalize);
 
-               done (0);
+               done(0);
        }
 
        if (vecp) {
                /* print specified aliases */
                for (i = 0; i < vecp; i++)
-                       print_aka (akvalue (vec[i]), list, 0);
+                       print_aka(akvalue(vec[i]), list, 0);
        } else {
                /* print them all */
                for (ak = akahead; ak; ak = ak->ak_next) {
-                       printf ("%s: ", ak->ak_name);
-                       pos += strlen (ak->ak_name) + 1;
-                       print_aka (akresult (ak), list, pos);
+                       printf("%s: ", ak->ak_name);
+                       pos += strlen(ak->ak_name) + 1;
+                       print_aka(akresult(ak), list, pos);
                }
        }
 
-       done (0);
+       done(0);
        return 1;
 }
 
 static void
-print_aka (char *p, int list, int margin)
+print_aka(char *p, int list, int margin)
 {
        char c;
 
        if (p == NULL) {
-               printf ("<empty>\n");
+               printf("<empty>\n");
                return;
        }
 
@@ -186,13 +186,13 @@ print_aka (char *p, int list, int margin)
                        case ',':
                                if (*p) {
                                        if (list)
-                                               printf ("\n%*s", margin, "");
+                                               printf("\n%*s", margin, "");
                                        else {
                                                if (pos >= 68) {
-                                                       printf (",\n ");
+                                                       printf(",\n ");
                                                        pos = 2;
                                                } else {
-                                                       printf (", ");
+                                                       printf(", ");
                                                        pos += 2;
                                                }
                                        }
@@ -203,55 +203,55 @@ print_aka (char *p, int list, int margin)
 
                        default:
                                pos++;
-                               putchar (c);
+                               putchar(c);
                }
        }
 
-       putchar ('\n');
+       putchar('\n');
        pos = 1;
 }
 
 static void
-print_usr (char *s, int list, int norm)
+print_usr(char *s, int list, int norm)
 {
        register char *cp, *pp, *vp;
        register struct aka *ak;
        register struct mailname *mp, *np;
 
-       if ((pp = getname (s)) == NULL)
-               adios (NULL, "no address in \"%s\"", s);
-       if ((mp = getm (pp, NULL, 0, norm, NULL)) == NULL)
-               adios (NULL, "bad address \"%s\"", s);
-       while (getname (""))
+       if ((pp = getname(s)) == NULL)
+               adios(NULL, "no address in \"%s\"", s);
+       if ((mp = getm(pp, NULL, 0, norm, NULL)) == NULL)
+               adios(NULL, "bad address \"%s\"", s);
+       while (getname(""))
                continue;
 
        vp = NULL;
        for (ak = akahead; ak; ak = ak->ak_next) {
-               pp = akresult (ak);
-               while ((cp = getname (pp))) {
-                       if ((np = getm (cp, NULL, 0, norm, NULL)) == NULL)
+               pp = akresult(ak);
+               while ((cp = getname(pp))) {
+                       if ((np = getm(cp, NULL, 0, norm, NULL)) == NULL)
                                continue;
-                       if (!mh_strcasecmp (mp->m_host, np->m_host)
-                                       && !mh_strcasecmp (mp->m_mbox, np->m_mbox)) {
-                               vp = vp ? add (ak->ak_name, add (",", vp))
-                                       : getcpy (ak->ak_name);
-                               mnfree (np);
-                               while (getname (""))
+                       if (!mh_strcasecmp(mp->m_host, np->m_host)
+                                       && !mh_strcasecmp(mp->m_mbox, np->m_mbox)) {
+                               vp = vp ? add(ak->ak_name, add(",", vp))
+                                       : getcpy(ak->ak_name);
+                               mnfree(np);
+                               while (getname(""))
                                        continue;
                                break;
                        }
-                       mnfree (np);
+                       mnfree(np);
                }
        }
-       mnfree (mp);
+       mnfree(mp);
 
 #if 0
-       printf ("%s: ", s);
-       print_aka (vp ? vp : s, list, pos += strlen (s) + 1);
+       printf("%s: ", s);
+       print_aka(vp ? vp : s, list, pos += strlen(s) + 1);
 #else
-       print_aka (vp ? vp : s, list, 0);
+       print_aka(vp ? vp : s, list, 0);
 #endif
 
        if (vp)
-               free (vp);
+               free(vp);
 }
index 094b1a5..43a0e1b 100644 (file)
@@ -24,40 +24,40 @@ struct home *hometail = NULL;
 /*
 ** prototypes
 */
-int alias (char *);
-int akvisible (void);
-void init_pw (void);
-char *akresult (struct aka *);
-char *akvalue (char *);
-char *akerror (int);
-
-static  char *akval (struct aka *, char *);
-static int aleq (char *, char *);
-static char *scanp (unsigned char *);
-static char *getp (char *);
-static char *seekp (char *, char *, char **);
-static int addfile (struct aka *, char *);
-static int addgroup (struct aka *, char *);
-static int addmember (struct aka *, char *);
-static int addall (struct aka *);
-static char *getalias (char *);
-static void add_aka (struct aka *, char *);
-static struct aka *akalloc (char *);
-static struct home *hmalloc (struct passwd *);
-struct home *seek_home (char *);
+int alias(char *);
+int akvisible(void);
+void init_pw(void);
+char *akresult(struct aka *);
+char *akvalue(char *);
+char *akerror(int);
+
+static  char *akval(struct aka *, char *);
+static int aleq(char *, char *);
+static char *scanp(unsigned char *);
+static char *getp(char *);
+static char *seekp(char *, char *, char **);
+static int addfile(struct aka *, char *);
+static int addgroup(struct aka *, char *);
+static int addmember(struct aka *, char *);
+static int addall(struct aka *);
+static char *getalias(char *);
+static void add_aka(struct aka *, char *);
+static struct aka *akalloc(char *);
+static struct home *hmalloc(struct passwd *);
+struct home *seek_home(char *);
 
 
 /* Do mh alias substitution on 's' and return the results. */
 char *
-akvalue (char *s)
+akvalue(char *s)
 {
        register char *v;
 
        if (akahead == NULL)
-               alias (AliasFile);
+               alias(AliasFile);
 
        akvis = -1;
-       v = akval (akahead, s);
+       v = akval(akahead, s);
        if (akvis == -1)
                akvis = 0;
        return v;
@@ -65,27 +65,27 @@ akvalue (char *s)
 
 
 int
-akvisible (void)
+akvisible(void)
 {
        return akvis;
 }
 
 
 char *
-akresult (struct aka *ak)
+akresult(struct aka *ak)
 {
        register char *cp = NULL, *dp, *pp;
        register struct adr *ad;
 
        for (ad = ak->ak_addr; ad; ad = ad->ad_next) {
-               pp = ad->ad_local ? akval (ak->ak_next, ad->ad_text)
-                       : getcpy (ad->ad_text);
+               pp = ad->ad_local ? akval(ak->ak_next, ad->ad_text)
+                       : getcpy(ad->ad_text);
 
                if (cp) {
                        dp = cp;
-                       cp = concat (cp, ",", pp, NULL);
-                       free (dp);
-                       free (pp);
+                       cp = concat(cp, ",", pp, NULL);
+                       free(dp);
+                       free(pp);
                } else
                        cp = pp;
        }
@@ -97,21 +97,21 @@ akresult (struct aka *ak)
 
 
 static char *
-akval (struct aka *ak, char *s)
+akval(struct aka *ak, char *s)
 {
        if (!s)
                return s;  /* XXX */
 
        for (; ak; ak = ak->ak_next)
-               if (aleq (s, ak->ak_name))
-                       return akresult (ak);
+               if (aleq(s, ak->ak_name))
+                       return akresult(ak);
 
-       return getcpy (s);
+       return getcpy(s);
 }
 
 
 static int
-aleq (char *string, char *aliasent)
+aleq(char *string, char *aliasent)
 {
        register char c;
 
@@ -129,7 +129,7 @@ aleq (char *string, char *aliasent)
 
 
 int
-alias (char *file)
+alias(char *file)
 {
        int i;
        register char *bp, *cp, *pp;
@@ -138,24 +138,24 @@ alias (char *file)
        register FILE *fp;
 
        if (*file != '/'
-                       && (strncmp (file, "./", 2) && strncmp (file, "../", 3)))
-               file = etcpath (file);
-       if ((fp = fopen (file, "r")) == NULL) {
+                       && (strncmp(file, "./", 2) && strncmp(file, "../", 3)))
+               file = etcpath(file);
+       if ((fp = fopen(file, "r")) == NULL) {
                akerrst = file;
                return AK_NOFILE;
        }
 
-       while (vfgets (fp, &ap) == OK) {
+       while (vfgets(fp, &ap) == OK) {
                bp = ap;
-               switch (*(pp = scanp (bp))) {
+               switch (*(pp = scanp(bp))) {
                        case '<':  /* recurse a level */
-                               if (!*(cp = getp (pp + 1))) {
+                               if (!*(cp = getp(pp + 1))) {
                                        akerrst = "'<' without alias-file";
-                                       fclose (fp);
+                                       fclose(fp);
                                        return AK_ERROR;
                                }
-                               if ((i = alias (cp)) != AK_OK) {
-                                       fclose (fp);
+                               if ((i = alias(cp)) != AK_OK) {
+                                       fclose(fp);
                                        return i;
                                }
 
@@ -167,12 +167,12 @@ alias (char *file)
                }
 
                akerrst = bp;
-               if (!*(cp = seekp (pp, &lc, &ap))) {
-                       fclose (fp);
+               if (!*(cp = seekp(pp, &lc, &ap))) {
+                       fclose(fp);
                        return AK_ERROR;
                }
-               if (!(ak = akalloc (cp))) {
-                       fclose (fp);
+               if (!(ak = akalloc(cp))) {
+                       fclose(fp);
                        return AK_LIMIT;
                }
                switch (lc) {
@@ -185,88 +185,88 @@ alias (char *file)
                                break;
 
                        default:
-                               fclose (fp);
+                               fclose(fp);
                                return AK_ERROR;
                }
 
-               switch (*(pp = scanp (ap))) {
+               switch (*(pp = scanp(ap))) {
                        case 0:  /* EOL */
-                               fclose (fp);
+                               fclose(fp);
                                return AK_ERROR;
 
                        case '<':  /* read values from file */
-                               if (!*(cp = getp (pp + 1))) {
-                                       fclose (fp);
+                               if (!*(cp = getp(pp + 1))) {
+                                       fclose(fp);
                                        return AK_ERROR;
                                }
-                               if (!addfile (ak, cp)) {
-                                       fclose (fp);
+                               if (!addfile(ak, cp)) {
+                                       fclose(fp);
                                        return AK_NOFILE;
                                }
                                break;
 
                        case '=':  /* UNIX group */
-                               if (!*(cp = getp (pp + 1))) {
-                                       fclose (fp);
+                               if (!*(cp = getp(pp + 1))) {
+                                       fclose(fp);
                                        return AK_ERROR;
                                }
-                               if (!addgroup (ak, cp)) {
-                                       fclose (fp);
+                               if (!addgroup(ak, cp)) {
+                                       fclose(fp);
                                        return AK_NOGROUP;
                                }
                                break;
 
                        case '+':  /* UNIX group members */
-                               if (!*(cp = getp (pp + 1))) {
-                                       fclose (fp);
+                               if (!*(cp = getp(pp + 1))) {
+                                       fclose(fp);
                                        return AK_ERROR;
                                }
-                               if (!addmember (ak, cp)) {
-                                       fclose (fp);
+                               if (!addmember(ak, cp)) {
+                                       fclose(fp);
                                        return AK_NOGROUP;
                                }
                                break;
 
                        case '*':  /* Everyone */
-                               addall (ak);
+                               addall(ak);
                                break;
 
                        default:  /* list */
-                               while ((cp = getalias (pp)))
-                                       add_aka (ak, cp);
+                               while ((cp = getalias(pp)))
+                                       add_aka(ak, cp);
                                break;
                }
        }
 
-       fclose (fp);
+       fclose(fp);
        return AK_OK;
 }
 
 
 char *
-akerror (int i)
+akerror(int i)
 {
        static char buffer[BUFSIZ];
 
        switch (i) {
                case AK_NOFILE:
-                       snprintf (buffer, sizeof(buffer), "unable to read '%s'", akerrst);
+                       snprintf(buffer, sizeof(buffer), "unable to read '%s'", akerrst);
                        break;
 
                case AK_ERROR:
-                       snprintf (buffer, sizeof(buffer), "error in line '%s'", akerrst);
+                       snprintf(buffer, sizeof(buffer), "error in line '%s'", akerrst);
                        break;
 
                case AK_LIMIT:
-                       snprintf (buffer, sizeof(buffer), "out of memory while on '%s'", akerrst);
+                       snprintf(buffer, sizeof(buffer), "out of memory while on '%s'", akerrst);
                        break;
 
                case AK_NOGROUP:
-                       snprintf (buffer, sizeof(buffer), "no such group as '%s'", akerrst);
+                       snprintf(buffer, sizeof(buffer), "no such group as '%s'", akerrst);
                        break;
 
                default:
-                       snprintf (buffer, sizeof(buffer), "unknown error (%d)", i);
+                       snprintf(buffer, sizeof(buffer), "unknown error (%d)", i);
                        break;
        }
 
@@ -275,21 +275,21 @@ akerror (int i)
 
 
 static char *
-scanp (unsigned char *p)
+scanp(unsigned char *p)
 {
-       while (isspace (*p))
+       while (isspace(*p))
                p++;
        return p;
 }
 
 
 static char *
-getp (char *p)
+getp(char *p)
 {
-       register unsigned char  *cp = scanp (p);
+       register unsigned char  *cp = scanp(p);
 
        p = cp;
-       while (!isspace (*cp) && *cp)
+       while (!isspace(*cp) && *cp)
                cp++;
        *cp = 0;
 
@@ -298,12 +298,12 @@ getp (char *p)
 
 
 static char *
-seekp (char *p, char *c, char **a)
+seekp(char *p, char *c, char **a)
 {
        register unsigned char *cp;
 
-       p = cp = scanp (p);
-       while (!isspace (*cp) && *cp && *cp != ':' && *cp != ';')
+       p = cp = scanp(p);
+       while (!isspace(*cp) && *cp && *cp != ':' && *cp != ';')
                cp++;
        *c = *cp;
        *cp++ = 0;
@@ -314,35 +314,35 @@ seekp (char *p, char *c, char **a)
 
 
 static int
-addfile (struct aka *ak, char *file)
+addfile(struct aka *ak, char *file)
 {
        register char *cp;
        char buffer[BUFSIZ];
        register FILE *fp;
 
-       if (!(fp = fopen (etcpath (file), "r"))) {
+       if (!(fp = fopen(etcpath(file), "r"))) {
                akerrst = file;
                return 0;
        }
 
-       while (fgets (buffer, sizeof buffer, fp))
-               while ((cp = getalias (buffer)))
-                       add_aka (ak, cp);
+       while (fgets(buffer, sizeof buffer, fp))
+               while ((cp = getalias(buffer)))
+                       add_aka(ak, cp);
 
-       fclose (fp);
+       fclose(fp);
        return 1;
 }
 
 
 static int
-addgroup (struct aka *ak, char *grp)
+addgroup(struct aka *ak, char *grp)
 {
        register char *gp;
-       register struct group *gr = getgrnam (grp);
+       register struct group *gr = getgrnam(grp);
        register struct home *hm = NULL;
 
        if (!gr)
-               gr = getgrgid (atoi (grp));
+               gr = getgrgid(atoi(grp));
        if (!gr) {
                akerrst = grp;
                return 0;
@@ -350,7 +350,7 @@ addgroup (struct aka *ak, char *grp)
 
 #ifndef DBMPWD
        if (homehead == NULL)
-               init_pw ();
+               init_pw();
 #endif /* DBMPWD */
 
        while ((gp = *gr->gr_mem++))
@@ -359,14 +359,14 @@ addgroup (struct aka *ak, char *grp)
                struct passwd *pw;
 #endif /* DBMPWD */
                for (hm = homehead; hm; hm = hm->h_next)
-                       if (!strcmp (hm->h_name, gp)) {
-                               add_aka (ak, hm->h_name);
+                       if (!strcmp(hm->h_name, gp)) {
+                               add_aka(ak, hm->h_name);
                                break;
                        }
 #ifdef DBMPWD
                if ((pw = getpwnam(gp))) {
                                hmalloc(pw);
-                               add_aka (ak, gp);
+                               add_aka(ak, gp);
                }
        }
 #endif /* DBMPWD */
@@ -376,17 +376,17 @@ addgroup (struct aka *ak, char *grp)
 
 
 static int
-addmember (struct aka *ak, char *grp)
+addmember(struct aka *ak, char *grp)
 {
        gid_t gid;
-       register struct group *gr = getgrnam (grp);
+       register struct group *gr = getgrnam(grp);
        register struct home *hm = NULL;
 
        if (gr)
                gid = gr->gr_gid;
        else {
-               gid = atoi (grp);
-               gr = getgrgid (gid);
+               gid = atoi(grp);
+               gr = getgrgid(gid);
        }
        if (!gr) {
                akerrst = grp;
@@ -396,18 +396,18 @@ addmember (struct aka *ak, char *grp)
 #ifndef DBMPWD
        if (homehead == NULL)
 #endif /* DBMPWD */
-               init_pw ();
+               init_pw();
 
        for (hm = homehead; hm; hm = hm->h_next)
                if (hm->h_gid == gid)
-                       add_aka (ak, hm->h_name);
+                       add_aka(ak, hm->h_name);
 
        return 1;
 }
 
 
 static int
-addall (struct aka *ak)
+addall(struct aka *ak)
 {
        int noshell = NoShell == NULL || *NoShell == 0;
        register struct home *hm;
@@ -415,21 +415,21 @@ addall (struct aka *ak)
 #ifndef DBMPWD
        if (homehead == NULL)
 #endif /* DBMPWD */
-               init_pw ();
+               init_pw();
        if (Everyone < 0)
                Everyone = EVERYONE;
 
        for (hm = homehead; hm; hm = hm->h_next)
                if (hm->h_uid > Everyone
-                               && (noshell || strcmp (hm->h_shell, NoShell)))
-                       add_aka (ak, hm->h_name);
+                               && (noshell || strcmp(hm->h_shell, NoShell)))
+                       add_aka(ak, hm->h_name);
 
        return homehead != NULL;
 }
 
 
 static char *
-getalias (char *addrs)
+getalias(char *addrs)
 {
        register unsigned char *pp, *qp;
        static char *cp = NULL;
@@ -440,7 +440,7 @@ getalias (char *addrs)
                if (*cp == 0)
                        return (cp = NULL);
 
-       for (pp = cp; isspace (*pp); pp++)
+       for (pp = cp; isspace(*pp); pp++)
                continue;
        if (*pp == 0)
                return (cp = NULL);
@@ -450,7 +450,7 @@ getalias (char *addrs)
                *qp++ = 0;
        for (cp = qp, qp--; qp > pp; qp--)
                if (*qp != 0) {
-                       if (isspace (*qp))
+                       if (isspace(*qp))
                                *qp = 0;
                        else
                                break;
@@ -461,16 +461,16 @@ getalias (char *addrs)
 
 
 static void
-add_aka (struct aka *ak, char *pp)
+add_aka(struct aka *ak, char *pp)
 {
        register struct adr *ad, *ld;
 
        for (ad = ak->ak_addr, ld = NULL; ad; ld = ad, ad = ad->ad_next)
-               if (!strcmp (pp, ad->ad_text))
+               if (!strcmp(pp, ad->ad_text))
                        return;
 
-       ad = (struct adr *) mh_xmalloc (sizeof(*ad));
-       ad->ad_text = getcpy (pp);
+       ad = (struct adr *) mh_xmalloc(sizeof(*ad));
+       ad->ad_text = getcpy(pp);
        ad->ad_local = strchr(pp, '@') == NULL && strchr(pp, '!') == NULL;
        ad->ad_next = NULL;
        if (ak->ak_addr)
@@ -481,7 +481,7 @@ add_aka (struct aka *ak, char *pp)
 
 
 void
-init_pw (void)
+init_pw(void)
 {
        register struct passwd  *pw;
 #ifdef DBMPWD
@@ -495,13 +495,13 @@ init_pw (void)
                init++;
 #endif /* DBMPWD */
 
-               setpwent ();
+               setpwent();
 
-               while ((pw = getpwent ()))
-                       if (!hmalloc (pw))
+               while ((pw = getpwent()))
+                       if (!hmalloc(pw))
                                break;
 
-               endpwent ();
+               endpwent();
 #ifdef DBMPWD
        }
 #endif /* DBMPWD */
@@ -509,13 +509,13 @@ init_pw (void)
 
 
 static struct aka *
-akalloc (char *id)
+akalloc(char *id)
 {
        register struct aka *p;
 
-       p = (struct aka *) mh_xmalloc (sizeof(*p));
+       p = (struct aka *) mh_xmalloc(sizeof(*p));
 
-       p->ak_name = getcpy (id);
+       p->ak_name = getcpy(id);
        p->ak_visible = 0;
        p->ak_addr = NULL;
        p->ak_next = NULL;
@@ -530,17 +530,17 @@ akalloc (char *id)
 
 
 static struct home *
-hmalloc (struct passwd *pw)
+hmalloc(struct passwd *pw)
 {
        register struct home *p;
 
-       p = (struct home *) mh_xmalloc (sizeof(*p));
+       p = (struct home *) mh_xmalloc(sizeof(*p));
 
-       p->h_name = getcpy (pw->pw_name);
+       p->h_name = getcpy(pw->pw_name);
        p->h_uid = pw->pw_uid;
        p->h_gid = pw->pw_gid;
-       p->h_home = getcpy (pw->pw_dir);
-       p->h_shell = getcpy (pw->pw_shell);
+       p->h_home = getcpy(pw->pw_dir);
+       p->h_shell = getcpy(pw->pw_shell);
        p->h_ngrps = 0;
        p->h_next = NULL;
        if (hometail != NULL)
@@ -554,7 +554,7 @@ hmalloc (struct passwd *pw)
 
 
 struct home *
-seek_home (char *name)
+seek_home(char *name)
 {
        register struct home *hp;
 #ifdef DBMPWD
@@ -565,11 +565,11 @@ seek_home (char *name)
 #else  /* DBMPWD */
 
        if (homehead == NULL)
-               init_pw ();
+               init_pw();
 #endif /* DBMPWD */
 
        for (hp = homehead; hp; hp = hp->h_next)
-               if (!mh_strcasecmp (name, hp->h_name))
+               if (!mh_strcasecmp(name, hp->h_name))
                        return hp;
 
 #ifdef DBMPWD
@@ -580,7 +580,7 @@ seek_home (char *name)
        for (c = name, c1 = lname; *c && (c1 - lname < sizeof(lname) - 1);
                        c++, c1++) {
                if (isalpha(*c) && isupper(*c))
-                       *c1 = tolower (*c);
+                       *c1 = tolower(*c);
                else
                        *c1 = *c;
        }
index 8967961..a2cfc84 100644 (file)
@@ -77,11 +77,11 @@ static struct swit switches[] = {
 /*
 ** static prototypes
 */
-static void make_comp (unsigned char **);
+static void make_comp(unsigned char **);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int inplace = 1, datesw = 1;
        int msgnum;
@@ -99,37 +99,37 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
+                                       snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
                                                invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case COMPSW:
                                        if (comp)
-                                               adios (NULL, "only one component at a time!");
+                                               adios(NULL, "only one component at a time!");
                                        if (!(comp = *argp++) || *comp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case DATESW:
@@ -148,9 +148,9 @@ main (int argc, char **argv)
 
                                case TEXTSW:
                                        if (text)
-                                               adios (NULL, "only one body at a time!");
+                                               adios(NULL, "only one body at a time!");
                                        if (!(text = *argp++) || *text == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case DELETESW:  /* delete annotations */
@@ -163,7 +163,7 @@ main (int argc, char **argv)
 
                                case NUMBERSW:  /* number listing or delete by number */
                                        if (number != 0)
-                                               adios (NULL, "only one number at a time!");
+                                               adios(NULL, "only one number at a time!");
 
                                        if (argp - arguments == argc - 1 || **argp == '-')
                                                number = 1;
@@ -173,7 +173,7 @@ main (int argc, char **argv)
                                                                number = -1;
 
                                                        else if (!(number = atoi(*argp)))
-                                                       adios (NULL, "missing argument to %s", argp[-2]);
+                                                       adios(NULL, "missing argument to %s", argp[-2]);
 
                                                argp++;
                                        }
@@ -196,9 +196,9 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else
                        app_msgarg(&msgs, cp);
        }
@@ -208,31 +208,31 @@ main (int argc, char **argv)
                datesw = 0;
 #endif /* UCI */
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
        if (!msgs.size)
                app_msgarg(&msgs, "cur");
        if (!folder)
-               folder = getfolder (1);
-       maildir = m_maildir (folder);
+               folder = getfolder(1);
+       maildir = m_maildir(folder);
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
        if (mp->nummsg == 0)
-               adios (NULL, "no messages in %s", folder);
+               adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
-               if (!m_convert (mp, msgs.msgs[msgnum]))
-                       done (1);
+               if (!m_convert(mp, msgs.msgs[msgnum]))
+                       done(1);
 
-       make_comp (&comp);
+       make_comp(&comp);
 
        /* annotate all the SELECTED messages */
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
@@ -240,44 +240,44 @@ main (int argc, char **argv)
                        if (list)
                                annolist(m_name(msgnum), comp, text, number);
                        else
-                               annotate (m_name (msgnum), comp, text, inplace, datesw, delete, append);
+                               annotate(m_name(msgnum), comp, text, inplace, datesw, delete, append);
                }
        }
 
-       context_replace (pfolder, folder);  /* update current folder  */
-       seq_setcur (mp, mp->lowsel);  /* update current message */
-       seq_save (mp);  /* synchronize message sequences */
-       folder_free (mp);  /* free folder/message structure */
-       context_save ();  /* save the context file */
-       done (0);
+       context_replace(pfolder, folder);  /* update current folder  */
+       seq_setcur(mp, mp->lowsel);  /* update current message */
+       seq_save(mp);  /* synchronize message sequences */
+       folder_free(mp);  /* free folder/message structure */
+       context_save();  /* save the context file */
+       done(0);
        return 1;
 }
 
 static void
-make_comp (unsigned char **ap)
+make_comp(unsigned char **ap)
 {
        register unsigned char *cp;
        char buffer[BUFSIZ];
 
        if (*ap == NULL) {
-               printf ("Enter component name: ");
-               fflush (stdout);
+               printf("Enter component name: ");
+               fflush(stdout);
 
-               if (fgets (buffer, sizeof buffer, stdin) == NULL)
-                       done (1);
-               *ap = trimcpy (buffer);
+               if (fgets(buffer, sizeof buffer, stdin) == NULL)
+                       done(1);
+               *ap = trimcpy(buffer);
        }
 
-       if ((cp = *ap + strlen (*ap) - 1) > *ap && *cp == ':')
+       if ((cp = *ap + strlen(*ap) - 1) > *ap && *cp == ':')
                *cp = 0;
-       if (strlen (*ap) == 0)
-               adios (NULL, "null component name");
+       if (strlen(*ap) == 0)
+               adios(NULL, "null component name");
        if (**ap == '-')
-               adios (NULL, "invalid component name %s", *ap);
-       if (strlen (*ap) >= NAMESZ)
-               adios (NULL, "too large component name %s", *ap);
+               adios(NULL, "invalid component name %s", *ap);
+       if (strlen(*ap) >= NAMESZ)
+               adios(NULL, "too large component name %s", *ap);
 
        for (cp = *ap; *cp; cp++)
-               if (!isalnum (*cp) && *cp != '-')
-                       adios (NULL, "invalid component name %s", *ap);
+               if (!isalnum(*cp) && *cp != '-')
+                       adios(NULL, "invalid component name %s", *ap);
 }
index db74870..e48f7d9 100644 (file)
@@ -17,7 +17,7 @@
 /*
 ** static prototypes
 */
-static int annosbr (int, char *, char *, char *, int, int, int, int);
+static int annosbr(int, char *, char *, char *, int, int, int, int);
 
 /*
 ** This "local" global and the annopreserve() function are a hack that
@@ -29,7 +29,7 @@ static int annosbr (int, char *, char *, char *, int, int, int, int);
 static int preserve_actime_and_modtime = 0;
 
 int
-annotate (char *file, char *comp, char *text, int inplace, int datesw,
+annotate(char *file, char *comp, char *text, int inplace, int datesw,
        int delete, int append)
 {
        int i, fd;
@@ -37,13 +37,13 @@ annotate (char *file, char *comp, char *text, int inplace, int datesw,
        struct stat s;
 
        /* open and lock the file to be annotated */
-       if ((fd = lkopen (file, O_RDWR, 0)) == NOTOK) {
+       if ((fd = lkopen(file, O_RDWR, 0)) == NOTOK) {
                switch (errno) {
                        case ENOENT:
                                break;
 
                        default:
-                               admonish (file, "unable to lock and open");
+                               admonish(file, "unable to lock and open");
                                break;
                }
                return 1;
@@ -57,12 +57,12 @@ annotate (char *file, char *comp, char *text, int inplace, int datesw,
        b.actime = s.st_atime;
        b.modtime = s.st_mtime;
 
-       i = annosbr (fd, file, comp, text, inplace, datesw, delete, append);
+       i = annosbr(fd, file, comp, text, inplace, datesw, delete, append);
 
        if (preserve_actime_and_modtime && utime(file, &b) == -1)
                advise("can't set access and modification times for %s", file);
 
-       lkclose (fd, file);
+       lkclose(fd, file);
        return i;
 }
 
@@ -162,7 +162,7 @@ annopreserve(int preserve)
 }
 
 static int
-annosbr (int fd, char *file, char *comp, char *text, int inplace,
+annosbr(int fd, char *file, char *comp, char *text, int inplace,
        int datesw, int delete, int append)
 {
        int mode, tmpfd;
@@ -178,10 +178,10 @@ annosbr (int fd, char *file, char *comp, char *text, int inplace,
        int length;  /* length of field name */
        int n;  /* number of bytes written */
 
-       mode = fstat (fd, &st) != NOTOK ? (st.st_mode & 0777) : m_gmprot ();
+       mode = fstat(fd, &st) != NOTOK ? (st.st_mode & 0777) : m_gmprot();
 
-       strncpy (tmpfil, m_mktemp2(file, "annotate", NULL, &tmp), sizeof(tmpfil));
-       chmod (tmpfil, mode);
+       strncpy(tmpfil, m_mktemp2(file, "annotate", NULL, &tmp), sizeof(tmpfil));
+       chmod(tmpfil, mode);
 
        /*
        ** We're going to need to copy some of the message file to the
@@ -373,7 +373,7 @@ annosbr (int fd, char *file, char *comp, char *text, int inplace,
                }
 
                if (datesw)
-                       fprintf (tmp, "%s: %s\n", comp, dtimenow (0));
+                       fprintf(tmp, "%s: %s\n", comp, dtimenow(0));
                if ((cp = text)) {
                        do {
                                while (*cp == ' ' || *cp == '\t')
@@ -382,14 +382,14 @@ annosbr (int fd, char *file, char *comp, char *text, int inplace,
                                while (*cp && *cp++ != '\n')
                                        continue;
                                if (cp - sp)
-                                       fprintf (tmp, "%s: %*.*s", comp, (int)(cp - sp), (int)(cp - sp), sp);
+                                       fprintf(tmp, "%s: %*.*s", comp, (int)(cp - sp), (int)(cp - sp), sp);
                        } while (*cp);
                        if (cp[-1] != '\n' && cp != text)
-                               putc ('\n', tmp);
+                               putc('\n', tmp);
                }
        }
 
-       fflush (tmp);
+       fflush(tmp);
 
        /*
        ** We've been messing with the input file position.  Move the
@@ -403,14 +403,14 @@ annosbr (int fd, char *file, char *comp, char *text, int inplace,
                        adios(NULL, "can't seek.");
        }
 
-       cpydata (fd, fileno (tmp), file, tmpfil);
-       fclose (tmp);
+       cpydata(fd, fileno(tmp), file, tmpfil);
+       fclose(tmp);
 
        if (inplace) {
-               if ((tmpfd = open (tmpfil, O_RDONLY)) == NOTOK)
-                       adios (tmpfil, "unable to open for re-reading");
+               if ((tmpfd = open(tmpfil, O_RDONLY)) == NOTOK)
+                       adios(tmpfil, "unable to open for re-reading");
 
-               lseek (fd, (off_t) 0, SEEK_SET);
+               lseek(fd, (off_t) 0, SEEK_SET);
 
                /*
                **  We're making the file shorter if we're deleting a
@@ -421,25 +421,25 @@ annosbr (int fd, char *file, char *comp, char *text, int inplace,
                if (delete >= -1 && ftruncate(fd, 0) == -1)
                        adios(tmpfil, "unable to truncate.");
 
-               cpydata (tmpfd, fd, tmpfil, file);
-               close (tmpfd);
-               unlink (tmpfil);
+               cpydata(tmpfd, fd, tmpfil, file);
+               close(tmpfd);
+               unlink(tmpfil);
        } else {
-               strncpy (buffer, m_backup (file), sizeof(buffer));
-               if (rename (file, buffer) == NOTOK) {
+               strncpy(buffer, m_backup(file), sizeof(buffer));
+               if (rename(file, buffer) == NOTOK) {
                        switch (errno) {
                                case ENOENT:  /* unlinked early - no annotations */
-                                       unlink (tmpfil);
+                                       unlink(tmpfil);
                                        break;
 
                                default:
-                                       admonish (buffer, "unable to rename %s to", file);
+                                       admonish(buffer, "unable to rename %s to", file);
                                        break;
                        }
                        return 1;
                }
-               if (rename (tmpfil, file) == NOTOK) {
-                       admonish (file, "unable to rename %s to", tmpfil);
+               if (rename(tmpfil, file) == NOTOK) {
+                       admonish(file, "unable to rename %s to", tmpfil);
                        return 1;
                }
        }
index a9f0775..41e990a 100644 (file)
--- a/uip/ap.c
+++ b/uip/ap.c
@@ -43,16 +43,16 @@ static int dat[5];
 /*
 ** prototypes
 */
-int sc_width (void);  /* from termsbr.c */
+int sc_width(void);  /* from termsbr.c */
 
 /*
 ** static prototypes
 */
-static int process (char *, int, int);
+static int process(char *, int, int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int addrp = 0, normalize = AD_HOST;
        int width = 0, status = 0;
@@ -63,49 +63,48 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       mts_init (invo_name);
-       arguments = getarguments (invo_name, argc, argv, 1);
+       mts_init(invo_name);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
 
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [switches] addrs ...",
-                                               invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [switches] addrs ...", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
-                                       print_version (invo_name);
-                                       done (1);
+                                       print_version(invo_name);
+                                       done(1);
 
                                case FORMSW:
                                        if (!(form = *argp++) || *form == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        format = NULL;
                                        continue;
                                case FMTSW:
                                        if (!(format = *argp++) || *format == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        form = NULL;
                                        continue;
 
                                case WIDTHSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       width = atoi (cp);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       width = atoi(cp);
                                        continue;
 
                                case NORMSW:
@@ -117,27 +116,27 @@ main (int argc, char **argv)
                        }
                }
                if (addrp > NADDRS)
-                       adios (NULL, "more than %d addresses", NADDRS);
+                       adios(NULL, "more than %d addresses", NADDRS);
                else
                        addrs[addrp++] = cp;
        }
        addrs[addrp] = NULL;
 
        if (addrp == 0)
-               adios (NULL, "usage: %s [switches] addrs ...", invo_name);
+               adios(NULL, "usage: %s [switches] addrs ...", invo_name);
 
        /* get new format string */
-       nfs = new_fs (form, format, FORMAT);
+       nfs = new_fs(form, format, FORMAT);
 
        if (width == 0) {
-               if ((width = sc_width ()) < WIDTH / 2)
+               if ((width = sc_width()) < WIDTH / 2)
                        width = WIDTH / 2;
                width -= 2;
        }
        if (width > WBUFSIZ)
                width = WBUFSIZ;
        fmt_norm = normalize;
-       fmt_compile (nfs, &fmt);
+       fmt_compile(nfs, &fmt);
 
        dat[0] = 0;
        dat[1] = 0;
@@ -146,9 +145,9 @@ main (int argc, char **argv)
        dat[4] = 0;
 
        for (addrp = 0; addrs[addrp]; addrp++)
-               status += process (addrs[addrp], width, normalize);
+               status += process(addrs[addrp], width, normalize);
 
-       done (status);
+       done(status);
        return 1;
 }
 
@@ -160,7 +159,7 @@ struct pqpair {
 
 
 static int
-process (char *arg, int length, int norm)
+process(char *arg, int length, int norm)
 {
        int status = 0;
        register char *cp;
@@ -171,36 +170,37 @@ process (char *arg, int length, int norm)
        register struct mailname *mp;
 
        (q = &pq)->pq_next = NULL;
-       while ((cp = getname (arg))) {
-               if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
-                       adios (NULL, "unable to allocate pqpair memory");
-               if ((mp = getm (cp, NULL, 0, norm, error)) == NULL) {
-                       p->pq_text = getcpy (cp);
-                       p->pq_error = getcpy (error);
+       while ((cp = getname(arg))) {
+               if ((p = (struct pqpair *)
+                               calloc((size_t) 1, sizeof(*p))) == NULL)
+                       adios(NULL, "unable to allocate pqpair memory");
+               if ((mp = getm(cp, NULL, 0, norm, error)) == NULL) {
+                       p->pq_text = getcpy(cp);
+                       p->pq_error = getcpy(error);
                        status++;
                } else {
-                       p->pq_text = getcpy (mp->m_text);
-                       mnfree (mp);
+                       p->pq_text = getcpy(mp->m_text);
+                       mnfree(mp);
                }
                q = (q->pq_next = p);
        }
 
        for (p = pq.pq_next; p; p = q) {
-               FINDCOMP (cptr, "text");
+               FINDCOMP(cptr, "text");
                if (cptr)
                        cptr->c_text = p->pq_text;
-               FINDCOMP (cptr, "error");
+               FINDCOMP(cptr, "error");
                if (cptr)
                        cptr->c_text = p->pq_error;
 
-               fmt_scan (fmt, buffer, length, dat);
-               fputs (buffer, stdout);
+               fmt_scan(fmt, buffer, length, dat);
+               fputs(buffer, stdout);
 
-               free (p->pq_text);
+               free(p->pq_text);
                if (p->pq_error)
-                       free (p->pq_error);
+                       free(p->pq_error);
                q = p->pq_next;
-               free ((char *) p);
+               free((char *) p);
        }
 
        return status;
index 9d33214..374eff5 100644 (file)
@@ -38,13 +38,13 @@ struct smsg {
 /*
 ** static prototypes
 */
-static int find_delim (int, struct smsg *);
-static void burst (struct msgs **, int, struct smsg *, int, int, int, char *);
-static void cpybrst (FILE *, FILE *, char *, char *, int);
+static int find_delim(int, struct smsg *);
+static void burst(struct msgs **, int, struct smsg *, int, int, int, char *);
+static void cpybrst(FILE *, FILE *, char *, char *, int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int inplace = 0, quietsw = 0, verbosw = 0;
        int msgp = 0, hi, msgnum, numburst;
@@ -56,31 +56,30 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown\n", cp);
+                               adios(NULL, "-%s unknown\n", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
-                                               invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case INPLSW:
                                inplace++;
@@ -106,68 +105,66 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else {
                        msgs[msgp++] = cp;
                }
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
        if (!msgp)
                msgs[msgp++] = "cur";
        if (!folder)
-               folder = getfolder (1);
-       maildir = m_maildir (folder);
+               folder = getfolder(1);
+       maildir = m_maildir(folder);
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
        if (mp->nummsg == 0)
-               adios (NULL, "no messages in %s", folder);
+               adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgp; msgnum++)
-               if (!m_convert (mp, msgs[msgnum]))
-                       done (1);
-       seq_setprev (mp);  /* set the previous-sequence */
+               if (!m_convert(mp, msgs[msgnum]))
+                       done(1);
+       seq_setprev(mp);  /* set the previous-sequence */
 
        smsgs = (struct smsg *)
-               calloc ((size_t) (MAXFOLDER + 2), sizeof(*smsgs));
+               calloc((size_t) (MAXFOLDER + 2), sizeof(*smsgs));
        if (smsgs == NULL)
-               adios (NULL, "unable to allocate burst storage");
+               adios(NULL, "unable to allocate burst storage");
 
        hi = mp->hghmsg + 1;
 
        /* burst all the SELECTED messages */
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
-               if (is_selected (mp, msgnum)) {
-                       if ((numburst = find_delim (msgnum, smsgs)) >= 1) {
+               if (is_selected(mp, msgnum)) {
+                       if ((numburst = find_delim(msgnum, smsgs)) >= 1) {
                                if (verbosw)
-                                       printf ("%d message%s exploded from digest %d\n",
-                                                       numburst, numburst > 1 ? "s" : "", msgnum);
-                               burst (&mp, msgnum, smsgs, numburst, inplace, verbosw, maildir);
+                                       printf("%d message%s exploded from digest %d\n", numburst, numburst > 1 ? "s" : "", msgnum);
+                               burst(&mp, msgnum, smsgs, numburst, inplace, verbosw, maildir);
                        } else {
                                if (numburst == 0) {
                                        if (!quietsw)
-                                               admonish (NULL, "message %d not in digest format",
-                                                                 msgnum);
+                                               admonish(NULL, "message %d not in digest format", msgnum);
                                }  /* this pair of braces was missing before 1999-07-15 */
                                else
-                                       adios (NULL, "burst() botch -- you lose big");
+                                       adios(NULL, "burst() botch -- you lose big");
                        }
                }
        }
 
-       free ((char *) smsgs);
-       context_replace (pfolder, folder);  /* update current folder */
+       free((char *) smsgs);
+       context_replace(pfolder, folder);  /* update current folder */
 
        /*
        ** If -inplace is given, then the first message burst becomes
@@ -177,16 +174,16 @@ main (int argc, char **argv)
        */
        if (inplace) {
                if (mp->lowsel != mp->curmsg)
-                       seq_setcur (mp, mp->lowsel);
+                       seq_setcur(mp, mp->lowsel);
        } else {
                if (hi <= mp->hghmsg)
-                       seq_setcur (mp, hi);
+                       seq_setcur(mp, hi);
        }
 
-       seq_save (mp);  /* synchronize message sequences */
-       context_save (); /* save the context file */
-       folder_free (mp); /* free folder/message structure */
-       done (0);
+       seq_save(mp);  /* synchronize message sequences */
+       context_save(); /* save the context file */
+       folder_free(mp); /* free folder/message structure */
+       done(0);
        return 1;
 }
 
@@ -197,7 +194,7 @@ main (int argc, char **argv)
 */
 
 static int
-find_delim (int msgnum, struct smsg *smsgs)
+find_delim(int msgnum, struct smsg *smsgs)
 {
        int ld3, wasdlm, msgp;
        long pos;
@@ -206,44 +203,47 @@ find_delim (int msgnum, struct smsg *smsgs)
        char buffer[BUFSIZ];
        FILE *in;
 
-       ld3 = strlen (delim3);
+       ld3 = strlen(delim3);
 
-       if ((in = fopen (msgnam = m_name (msgnum), "r")) == NULL)
-               adios (msgnam, "unable to read message");
+       if ((in = fopen(msgnam = m_name(msgnum), "r")) == NULL)
+               adios(msgnam, "unable to read message");
 
        for (msgp = 0, pos = 0L; msgp <= MAXFOLDER;) {
-               while (fgets (buffer, sizeof(buffer), in) && buffer[0] == '\n')
-                       pos += (long) strlen (buffer);
-               if (feof (in))
+               while (fgets(buffer, sizeof(buffer), in) && buffer[0] == '\n')
+                       pos += (long) strlen(buffer);
+               if (feof(in))
                        break;
-               fseek (in, pos, SEEK_SET);
+               fseek(in, pos, SEEK_SET);
                smsgs[msgp].s_start = pos;
 
-               for (c = 0; fgets (buffer, sizeof(buffer), in); c = buffer[0]) {
-                       if (strncmp (buffer, delim3, ld3) == 0
+               for (c = 0; fgets(buffer, sizeof(buffer), in); c = buffer[0]) {
+                       if (strncmp(buffer, delim3, ld3) == 0
                                        && (msgp == 1 || c == '\n')
-                                       && ((cc = peekc (in)) == '\n' || cc == EOF))
+                                       && ((cc = peekc(in)) == '\n' ||
+                                       cc == EOF))
                                break;
                        else
-                               pos += (long) strlen (buffer);
+                               pos += (long) strlen(buffer);
                }
 
-               wasdlm = strncmp (buffer, delim3, ld3) == 0;
+               wasdlm = strncmp(buffer, delim3, ld3) == 0;
                if (smsgs[msgp].s_start != pos)
-                       smsgs[msgp++].s_stop = (c == '\n' && wasdlm) ? pos - 1 : pos;
-               if (feof (in)) {
+                       smsgs[msgp++].s_stop = (c == '\n' && wasdlm) ?
+                                       pos - 1 : pos;
+               if (feof(in)) {
 #if 0
                        if (wasdlm) {
-                               smsgs[msgp - 1].s_stop -= ((long) strlen (buffer) + 1);
+                               smsgs[msgp - 1].s_stop -=
+                                               ((long) strlen(buffer) + 1);
                                msgp++;  /* fake "End of XXX Digest" */
                        }
 #endif
                        break;
                }
-               pos += (long) strlen (buffer);
+               pos += (long) strlen(buffer);
        }
 
-       fclose (in);
+       fclose(in);
        return (msgp - 1);  /* toss "End of XXX Digest" */
 }
 
@@ -253,7 +253,7 @@ find_delim (int msgnum, struct smsg *smsgs)
 */
 
 static void
-burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
+burst(struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
        int inplace, int verbosw, char *maildir)
 {
        int i, j, mode;
@@ -263,10 +263,11 @@ burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
        struct stat st;
        struct msgs *mp;
 
-       if ((in = fopen (msgnam = m_name (msgnum), "r")) == NULL)
-               adios (msgnam, "unable to read message");
+       if ((in = fopen(msgnam = m_name(msgnum), "r")) == NULL)
+               adios(msgnam, "unable to read message");
 
-       mode = fstat (fileno(in), &st) != NOTOK ? (st.st_mode & 0777) : m_gmprot();
+       mode = fstat(fileno(in), &st) != NOTOK ?
+                       (st.st_mode & 0777) : m_gmprot();
        mp = *mpp;
 
        /*
@@ -274,8 +275,8 @@ burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
        ** structure for all the new messages.
        */
        if ((mp->hghmsg + numburst > mp->hghoff) &&
-               !(mp = folder_realloc (mp, mp->lowoff, mp->hghmsg + numburst)))
-               adios (NULL, "unable to allocate folder storage");
+               !(mp = folder_realloc(mp, mp->lowoff, mp->hghmsg + numburst)))
+               adios(NULL, "unable to allocate folder storage");
        *mpp = mp;
 
        j = mp->hghmsg;  /* old value */
@@ -300,27 +301,27 @@ burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
        */
        if (inplace) {
                for (i = mp->hghmsg; j > msgnum; i--, j--) {
-                       strncpy (f1, m_name (i), sizeof(f1));
-                       strncpy (f2, m_name (j), sizeof(f2));
-                       if (does_exist (mp, j)) {
+                       strncpy(f1, m_name(i), sizeof(f1));
+                       strncpy(f2, m_name(j), sizeof(f2));
+                       if (does_exist(mp, j)) {
                                if (verbosw)
-                                       printf ("message %d becomes message %d\n", j, i);
+                                       printf("message %d becomes message %d\n", j, i);
 
-                               if (rename (f2, f1) == NOTOK)
-                                       admonish (f1, "unable to rename %s to", f2);
+                               if (rename(f2, f1) == NOTOK)
+                                       admonish(f1, "unable to rename %s to", f2);
 
-                               (void)snprintf(f1, sizeof (f1), "%s/%d", maildir, i);
-                               (void)snprintf(f2, sizeof (f2), "%s/%d", maildir, j);
+                               snprintf(f1, sizeof (f1), "%s/%d", maildir, i);
+                               snprintf(f2, sizeof (f2), "%s/%d", maildir, j);
                                ext_hook("ref-hook", f1, f2);
 
-                               copy_msg_flags (mp, i, j);
-                               clear_msg_flags (mp, j);
+                               copy_msg_flags(mp, i, j);
+                               clear_msg_flags(mp, j);
                                mp->msgflags |= SEQMOD;
                        }
                }
        }
 
-       unset_selected (mp, msgnum);
+       unset_selected(mp, msgnum);
 
        /* new hghmsg is hghmsg + numburst
        **
@@ -346,37 +347,38 @@ burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
 
        i = inplace ? msgnum + numburst : mp->hghmsg;
        for (j = numburst; j >= (inplace ? 0 : 1); i--, j--) {
-               strncpy (f1, m_name (i), sizeof(f1));
-               strncpy (f2, m_mktemp(invo_name, NULL, &out), sizeof(f2));
+               strncpy(f1, m_name(i), sizeof(f1));
+               strncpy(f2, m_mktemp(invo_name, NULL, &out), sizeof(f2));
 
                if (verbosw && i != msgnum)
-                       printf ("message %d of digest %d becomes message %d\n", j, msgnum, i);
+                       printf("message %d of digest %d becomes message %d\n",
+                                       j, msgnum, i);
 
-               chmod (f2, mode);
-               fseek (in, smsgs[j].s_start, SEEK_SET);
-               cpybrst (in, out, msgnam, f2,
+               chmod(f2, mode);
+               fseek(in, smsgs[j].s_start, SEEK_SET);
+               cpybrst(in, out, msgnam, f2,
                                (int) (smsgs[j].s_stop - smsgs[j].s_start));
-               fclose (out);
+               fclose(out);
 
                if (i == msgnum) {
-                       strncpy (f3, m_backup (f1), sizeof(f3));
-                       if (rename (f1, f3) == NOTOK)
-                               admonish (f3, "unable to rename %s to", f1);
+                       strncpy(f3, m_backup(f1), sizeof(f3));
+                       if (rename(f1, f3) == NOTOK)
+                               admonish(f3, "unable to rename %s to", f1);
 
                        (void)snprintf(f3, sizeof (f3), "%s/%d", maildir, i);
                        ext_hook("del-hook", f3, (char *)0);
                }
-               if (rename (f2, f1) == NOTOK)
-                       admonish (f1, "unable to rename %s to", f2);
+               if (rename(f2, f1) == NOTOK)
+                       admonish(f1, "unable to rename %s to", f2);
 
                (void)snprintf(f3, sizeof (f3), "%s/%d", maildir, i);
                ext_hook("add-hook", f3, (char *)0);
 
-               copy_msg_flags (mp, i, msgnum);
+               copy_msg_flags(mp, i, msgnum);
                mp->msgflags |= SEQMOD;
        }
 
-       fclose (in);
+       fclose(in);
 }
 
 
@@ -390,11 +392,11 @@ burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
 */
 
 static void
-cpybrst (FILE *in, FILE *out, char *ifile, char *ofile, int len)
+cpybrst(FILE *in, FILE *out, char *ifile, char *ofile, int len)
 {
        register int c, state;
 
-       for (state = S1; (c = fgetc (in)) != EOF && len > 0; len--) {
+       for (state = S1; (c = fgetc(in)) != EOF && len > 0; len--) {
                if (c == 0)
                        continue;
                switch (state) {
@@ -407,7 +409,7 @@ cpybrst (FILE *in, FILE *out, char *ifile, char *ofile, int len)
                                        default:
                                                state = S2;
                                        case '\n':
-                                               fputc (c, out);
+                                               fputc(c, out);
                                                break;
                                }
                                break;
@@ -417,7 +419,7 @@ cpybrst (FILE *in, FILE *out, char *ifile, char *ofile, int len)
                                        case '\n':
                                                state = S1;
                                        default:
-                                               fputc (c, out);
+                                               fputc(c, out);
                                                break;
                                }
                                break;
@@ -430,16 +432,16 @@ cpybrst (FILE *in, FILE *out, char *ifile, char *ofile, int len)
 
                                        default:
                                                state = (c == '\n') ? S1 : S2;
-                                               fputc ('-', out);
-                                               fputc (c, out);
+                                               fputc('-', out);
+                                               fputc(c, out);
                                                break;
                                }
                                break;
                }
        }
 
-       if (ferror (in) && !feof (in))
-               adios (ifile, "error reading");
-       if (ferror (out))
-               adios (ofile, "error writing");
+       if (ferror(in) && !feof(in))
+               adios(ifile, "error reading");
+       if (ferror(out))
+               adios(ofile, "error writing");
 }
index b39b6e7..83b002a 100644 (file)
@@ -50,7 +50,7 @@ static struct swit aqrunl[] = {
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int use = NOUSE, nedit = 0, nwhat = 0;
        int i, in, out;
@@ -64,35 +64,34 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [+folder] [msg] [switches]",
-                                               invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [+folder] [msg] [switches]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case EDITRSW:
                                        if (!(ed = *argp++) || *ed == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        nedit = 0;
                                        continue;
                                case NEDITSW:
@@ -101,7 +100,7 @@ main (int argc, char **argv)
 
                                case WHATSW:
                                        if (!(whatnowproc = *argp++) || *whatnowproc == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        nwhat = 0;
                                        continue;
                                case NWHATSW:
@@ -110,7 +109,7 @@ main (int argc, char **argv)
 
                                case FORMSW:
                                        if (!(form = *argp++) || *form == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case USESW:
@@ -123,24 +122,24 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else {
                        if (msg)
-                               adios (NULL, "only one message at a time!");
+                               adios(NULL, "only one message at a time!");
                        else
                                msg = cp;
                }
        }
 
-       cwd = getcpy (pwd ());
+       cwd = getcpy(pwd());
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        if (form && (folder || msg))
-                       adios (NULL, "can't mix forms and folders/msgs");
+                       adios(NULL, "can't mix forms and folders/msgs");
 
        if (!use && (folder || msg)) {
                /*
@@ -149,43 +148,43 @@ main (int argc, char **argv)
                if (!msg)
                        msg = "cur";
                if (!folder)
-                       folder = getfolder (1);
-               maildir = m_maildir (folder);
+                       folder = getfolder(1);
+               maildir = m_maildir(folder);
 
-               if (chdir (maildir) == NOTOK)
-                       adios (maildir, "unable to change directory to");
+               if (chdir(maildir) == NOTOK)
+                       adios(maildir, "unable to change directory to");
 
                /* read folder and create message structure */
-               if (!(mp = folder_read (folder)))
-                       adios (NULL, "unable to read folder %s", folder);
+               if (!(mp = folder_read(folder)))
+                       adios(NULL, "unable to read folder %s", folder);
 
                /* check for empty folder */
                if (mp->nummsg == 0)
-                       adios (NULL, "no messages in %s", folder);
+                       adios(NULL, "no messages in %s", folder);
 
                /* parse the message range/sequence/name and set SELECTED */
-               if (!m_convert (mp, msg))
-                       done (1);
-               seq_setprev (mp);  /* set the previous-sequence */
+               if (!m_convert(mp, msg))
+                       done(1);
+               seq_setprev(mp);  /* set the previous-sequence */
 
                if (mp->numsel > 1)
-                       adios (NULL, "only one message at a time!");
+                       adios(NULL, "only one message at a time!");
 
-               if ((in = open (form = getcpy (m_name (mp->lowsel)),
+               if ((in = open(form = getcpy(m_name(mp->lowsel)),
                                O_RDONLY)) == NOTOK)
-                       adios (form, "unable to open message");
+                       adios(form, "unable to open message");
        } else
                in = open_form(&form, components);
 
 try_it_again:
-       strncpy (drft, m_draft(use ? (msg?msg:"cur") : "new"), sizeof(drft));
+       strncpy(drft, m_draft(use ? (msg?msg:"cur") : "new"), sizeof(drft));
 
        /*
        ** Check if we have an existing draft
        */
-       if ((out = open (drft, O_RDONLY)) != NOTOK) {
-               i = fdcompare (in, out);
-               close (out);
+       if ((out = open(drft, O_RDONLY)) != NOTOK) {
+               i = fdcompare(in, out);
+               close(out);
 
                /*
                ** If we have given -use flag, or if the
@@ -195,15 +194,16 @@ try_it_again:
                if (use || i)
                        goto edit_it;
 
-               if (stat (drft, &st) == NOTOK)
-                       adios (drft, "unable to stat");
-               printf ("Draft \"%s\" exists (%ld bytes).", drft, (long) st.st_size);
+               if (stat(drft, &st) == NOTOK)
+                       adios(drft, "unable to stat");
+               printf("Draft \"%s\" exists (%ld bytes).",
+                               drft, (long) st.st_size);
                for (i = LISTDSW; i != YESW;) {
-                       if (!(argp = getans ("\nDisposition? ", aqrunl)))
-                               done (1);
-                       switch (i = smatch (*argp, aqrunl)) {
+                       if (!(argp = getans("\nDisposition? ", aqrunl)))
+                               done(1);
+                       switch (i = smatch(*argp, aqrunl)) {
                                case NOSW:
-                                       done (0);
+                                       done(0);
                                case NEWSW:
                                        use = NOUSE;
                                        goto try_it_again;
@@ -213,33 +213,33 @@ try_it_again:
                                        use++;
                                        goto edit_it;
                                case LISTDSW:
-                                       showfile (++argp, drft);
+                                       showfile(++argp, drft);
                                        break;
                                case REFILSW:
-                                       if (refile (++argp, drft) == 0)
+                                       if (refile(++argp, drft) == 0)
                                                i = YESW;
                                        break;
                                default:
-                                       advise (NULL, "say what?");
+                                       advise(NULL, "say what?");
                                        break;
                        }
                }
        } else if (use) {
-               adios (drft, "unable to open");
+               adios(drft, "unable to open");
        }
 
-       if ((out = creat (drft, m_gmprot ())) == NOTOK)
-               adios (drft, "unable to create");
-       cpydata (in, out, form, drft);
-       close (in);
-       close (out);
+       if ((out = creat(drft, m_gmprot())) == NOTOK)
+               adios(drft, "unable to create");
+       cpydata(in, out, form, drft);
+       close(in);
+       close(out);
 
 edit_it:
-       context_save ();  /* save the context file */
+       context_save();  /* save the context file */
 
        if (nwhat)
-               done (0);
-       what_now (ed, nedit, use, drft, NULL, 0, NULLMP, NULL, 0, cwd);
-       done (1);
+               done(0);
+       what_now(ed, nedit, use, drft, NULL, 0, NULLMP, NULL, 0, cwd);
+       done(1);
        return 1;
 }
index fdd6de2..909bbc8 100644 (file)
@@ -47,19 +47,19 @@ extern struct home *homehead;
 /*
 ** prototypes
 */
-void alias_files (int, char **);
-void pwd_names (void);
-void grp_names (void);
-void grp_members (void);
-void grp_ids (void);
-void maildrops (void);
+void alias_files(int, char **);
+void pwd_names(void);
+void grp_names(void);
+void grp_members(void);
+void grp_ids(void);
+void maildrops(void);
 void mdrop(char *);
-int check (char *);
-void setup (void);
+int check(char *);
+void setup(void);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int akp = 0, dp = 0;
        char *cp, **argp, **arguments;
@@ -68,48 +68,47 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* foil search of user profile/context */
-       if (context_foil (NULL) == -1)
-               done (1);
+       if (context_foil(NULL) == -1)
+               done(1);
 
-       mts_init (invo_name);
-       arguments = getarguments (invo_name, argc, argv, 0);
+       mts_init(invo_name);
+       arguments = getarguments(invo_name, argc, argv, 0);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [switches] [aliasfiles ...]",
-                                               invo_name);
-                                       print_help (buf, switches, 0);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [switches] [aliasfiles ...]", invo_name);
+                                       print_help(buf, switches, 0);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case MAILSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        if (mail)
-                                               adios (NULL, "mail to one address only");
+                                               adios(NULL, "mail to one address only");
                                        else
                                                mail = cp;
                                        continue;
 
                                case SERCHSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        if (dp >= NDIRS)
-                                               adios (NULL, "more than %d directories", NDIRS);
+                                               adios(NULL, "more than %d directories", NDIRS);
                                        dirs[dp++] = cp;
                                        continue;
                        }
@@ -120,63 +119,64 @@ main (int argc, char **argv)
        if (akp == 0)
                akv[akp++] = AliasFile;
        if (!homehead)
-               init_pw ();
+               init_pw();
        if (!mail)
                out = stdout;
        dirs[dp] = NULL;
 
-       alias_files (akp, akv);
-       pwd_names ();
-       grp_names ();
-       grp_members ();
-       grp_ids ();
+       alias_files(akp, akv);
+       pwd_names();
+       grp_names();
+       grp_members();
+       grp_ids();
 #ifdef UCI
-       ldr_names ();
-       ldr_ship ();
+       ldr_names();
+       ldr_ship();
 #endif /* UCI */
-       maildrops ();
+       maildrops();
 
-       done (0);
+       done(0);
        return 1;
 }
 
 
 void
-alias_files (int akp, char **akv)
+alias_files(int akp, char **akv)
 {
        register int i, err;
 
        for (i = 0; i < akp; i++)
-               if ((err = alias (akv[i])) != AK_OK) {
-                       setup ();
-                       fprintf (out, "aliasing error in %s - %s\n", akv[i], akerror (err));
+               if ((err = alias(akv[i])) != AK_OK) {
+                       setup();
+                       fprintf(out, "aliasing error in %s - %s\n", akv[i],
+                                       akerror(err));
                } else if (out && !mail)
-                       fprintf (out, "alias file %s is ok\n", akv[i]);
+                       fprintf(out, "alias file %s is ok\n", akv[i]);
 }
 
 
 void
-pwd_names (void)
+pwd_names(void)
 {
        int hit = 0;
        register struct home *hm, *lm;
 
        for (hm = homehead; hm; hm = hm->h_next)
                for (lm = hm->h_next; lm; lm = lm->h_next)
-                       if (strcmp (hm->h_name, lm->h_name) == 0) {
-                               setup ();
-                               fprintf (out, "duplicate user %s(uid=%d)\n",
+                       if (strcmp(hm->h_name, lm->h_name) == 0) {
+                               setup();
+                               fprintf(out, "duplicate user %s(uid=%d)\n",
                                                lm->h_name, (int) lm->h_uid);
                                hit++;
                        }
 
        if (!hit && out && !mail)
-               fprintf (out, "no duplicate users\n");
+               fprintf(out, "no duplicate users\n");
 }
 
 
 void
-grp_names (void)
+grp_names(void)
 {
        int numgroups, maxgroups;
        int i, hit = 0;
@@ -188,12 +188,12 @@ grp_names (void)
        maxgroups = NGRPS;
        grps = (char **) mh_xmalloc((size_t) (maxgroups * sizeof(*grps)));
 
-       setgrent ();
-       while ((gr = getgrent ())) {
+       setgrent();
+       while ((gr = getgrent())) {
                for (i = 0; i < numgroups; i++)
-                       if (!strcmp (grps[i], gr->gr_name)) {
-                               setup ();
-                               fprintf (out, "duplicate group %s(gid=%d)\n",
+                       if (!strcmp(grps[i], gr->gr_name)) {
+                               setup();
+                               fprintf(out, "duplicate group %s(gid=%d)\n",
                                                gr->gr_name, (int) gr->gr_gid);
                                hit++;
                                break;
@@ -204,97 +204,94 @@ grp_names (void)
                                grps = (char **) mh_xrealloc(grps,
                                        (size_t) (maxgroups * sizeof(*grps)));
                        }
-                       grps[numgroups++] = getcpy (gr->gr_name);
+                       grps[numgroups++] = getcpy(gr->gr_name);
                }
        }
-       endgrent ();
+       endgrent();
 
        for (i = 0; i < numgroups; i++)
-               free (grps[i]);
-       free (grps);
+               free(grps[i]);
+       free(grps);
 
        if (!hit && out && !mail)
-               fprintf (out, "no duplicate groups\n");
+               fprintf(out, "no duplicate groups\n");
 }
 
 
 void
-grp_members (void)
+grp_members(void)
 {
        register int hit = 0;
        register char **cp, **dp;
        register struct group *gr;
        register struct home  *hm;
 
-       setgrent ();
-       while ((gr = getgrent ())) {
+       setgrent();
+       while ((gr = getgrent())) {
                for (cp = gr->gr_mem; *cp; cp++) {
                        for (hm = homehead; hm; hm = hm->h_next)
-                               if (!strcmp (*cp, hm->h_name))
+                               if (!strcmp(*cp, hm->h_name))
                                        break;
                        if (hm == NULL) {
-                               setup ();
-                               fprintf (out, "group %s(gid=%d) has unknown member %s\n",
-                                               gr->gr_name, (int) gr->gr_gid, *cp);
+                               setup();
+                               fprintf(out, "group %s(gid=%d) has unknown member %s\n", gr->gr_name, (int) gr->gr_gid, *cp);
                                hit++;
                        } else {
                                hm->h_ngrps++;
                        }
 
                        for (dp = cp + 1; *dp; dp++)
-                               if (strcmp (*cp, *dp) == 0) {
-                                       setup ();
-                                       fprintf (out, "group %s(gid=%d) has duplicate member %s\n",
-                                                       gr->gr_name, (int) gr->gr_gid, *cp);
+                               if (strcmp(*cp, *dp) == 0) {
+                                       setup();
+                                       fprintf(out, "group %s(gid=%d) has duplicate member %s\n", gr->gr_name, (int) gr->gr_gid, *cp);
                                        hit++;
                                }
                }
        }
-       endgrent ();
+       endgrent();
 
        for (hm = homehead; hm; hm = hm->h_next)
                if (hm->h_ngrps > NGROUPS_MAX) {
-                       setup ();
-                       fprintf (out, "user %s is a member of %d groups (max %d)\n",
+                       setup();
+                       fprintf(out, "user %s is a member of %d groups (max %d)\n",
                                        hm->h_name, hm->h_ngrps, NGROUPS_MAX);
                        hit++;
                }
 
        if (!hit && out && !mail)
-               fprintf (out, "all group members accounted for\n");
+               fprintf(out, "all group members accounted for\n");
 }
 
 
 void
-grp_ids (void)
+grp_ids(void)
 {  /* -DRAND not implemented at most places */
        register int hit = 0;
        register struct home *hm;
 
        for (hm = homehead; hm; hm = hm->h_next)
-               if (getgrgid (hm->h_gid) == NULL) {
-                       setup ();
-                       fprintf (out, "user %s(uid=%d) has unknown group-id %d\n",
-                                       hm->h_name, (int) hm->h_uid, (int) hm->h_gid);
+               if (getgrgid(hm->h_gid) == NULL) {
+                       setup();
+                       fprintf(out, "user %s(uid=%d) has unknown group-id %d\n", hm->h_name, (int) hm->h_uid, (int) hm->h_gid);
                        hit++;
                }
 
        if (!hit && out && !mail)
-               fprintf (out, "all group-id users accounted for\n");
+               fprintf(out, "all group-id users accounted for\n");
 }
 
 
 void
-maildrops (void)
+maildrops(void)
 {
        register int i;
 
        if (mmdfldir && *mmdfldir)
-               mdrop (mmdfldir);
+               mdrop(mmdfldir);
        if (uucpldir && *uucpldir)
-               mdrop (uucpldir);
+               mdrop(uucpldir);
        for (i = 0; dirs[i]; i++)
-               mdrop (dirs[i]);
+               mdrop(dirs[i]);
 }
 
 
@@ -303,41 +300,40 @@ mdrop(char *drop)
 {
        register int hit = 0;
        register struct dirent *dp;
-       register DIR *dd = opendir (drop);
+       register DIR *dd = opendir(drop);
 
        if (!dd) {
-               setup ();
-               fprintf (out, "unable to open maildrop area %s\n", drop);
+               setup();
+               fprintf(out, "unable to open maildrop area %s\n", drop);
                return;
        }
 
-       while ((dp = readdir (dd)))
-               if (dp->d_name[0] != '.' && !check (dp->d_name)) {
-                       setup ();
-                       fprintf (out, "there is a maildrop for the unknown user %s in %s\n",
-                                       dp->d_name, drop);
+       while ((dp = readdir(dd)))
+               if (dp->d_name[0] != '.' && !check(dp->d_name)) {
+                       setup();
+                       fprintf(out, "there is a maildrop for the unknown user %s in %s\n", dp->d_name, drop);
                        hit++;
                }
 
-       closedir (dd);
+       closedir(dd);
        if (!hit && out && !mail)
-               fprintf (out, "all maildrops accounted for in %s\n", drop);
+               fprintf(out, "all maildrops accounted for in %s\n", drop);
 }
 
 
 int
-check (char *s)
+check(char *s)
 {
        register struct home *hm;
 
        for (hm = homehead; hm; hm = hm->h_next)
-               if (!strcmp (s, hm->h_name))
+               if (!strcmp(s, hm->h_name))
                        return 1;
        return 0;
 }
 
 void
-setup (void)
+setup(void)
 {
        int fd, pd[2];
 
@@ -345,33 +341,34 @@ setup (void)
                return;
 
        if (mail) {
-               if (pipe (pd) == NOTOK)
-                       adios ("pipe", "unable to");
+               if (pipe(pd) == NOTOK)
+                       adios("pipe", "unable to");
 
-               switch (fork ()) {
+               switch (fork()) {
                        case NOTOK:
-                               adios ("fork", "unable to");
+                               adios("fork", "unable to");
 
                        case OK:
-                               close (pd[1]);
+                               close(pd[1]);
                                if (pd[0] != 0) {
-                                       dup2 (pd[0], 0);
-                                       close (pd[0]);
+                                       dup2(pd[0], 0);
+                                       close(pd[0]);
                                }
-                               if ((fd = open ("/dev/null", O_WRONLY)) != NOTOK)
+                               if ((fd = open("/dev/null", O_WRONLY))
+                                               != NOTOK)
                                        if (fd != 1) {
-                                               dup2 (fd, 1);
-                                               close (fd);
+                                               dup2(fd, 1);
+                                               close(fd);
                                        }
-                               execlp (mailproc, r1bindex (mailproc, '/'),
-                                               mail, "-subject", invo_name, NULL);
-                               adios (mailproc, "unable to exec ");
+                               execlp(mailproc, r1bindex (mailproc, '/'),
+                                               mail, "-subject", invo_name,
+                                               NULL);
+                               adios(mailproc, "unable to exec ");
 
                        default:
-                               close (pd[0]);
-                               out = fdopen (pd[1], "w");
-                               fprintf (out, "%s: the following is suspicious\n\n",
-                                               invo_name);
+                               close(pd[0]);
+                               out = fdopen(pd[1], "w");
+                               fprintf(out, "%s: the following is suspicious\n\n", invo_name);
                }
        }
 }
@@ -390,8 +387,8 @@ struct grpldr {
        char **gl_ldr;
 };
 
-int setglent (), endglent ();
-struct grpldr *getglent (), *getglnam ();
+int setglent(), endglent();
+struct grpldr *getglent(), *getglnam();
 
 
 /* taken from the getglent() routines */
@@ -406,9 +403,9 @@ static char *gl_ldr[MAXGLS + 1];
 
 setglent() {
        if (glp == NULL)
-               glp = fopen (GLDRS, "r");
+               glp = fopen(GLDRS, "r");
        else
-               rewind (glp);
+               rewind(glp);
 
        return (glp != NULL);
 }
@@ -416,28 +413,28 @@ setglent() {
 
 endglent() {
        if (glp != NULL) {
-               fclose (glp);
+               fclose(glp);
                glp = NULL;
        }
 
        return 1;
 }
 
-struct grpldr  *getglent () {
+struct grpldr *getglent() {
        register char  *cp, **q;
 
-       if (glp == NULL && !setglent ())
+       if (glp == NULL && !setglent())
                return NULL;
-       if ((cp = fgets (line, BUFSIZ, glp)) == NULL)
+       if ((cp = fgets(line, BUFSIZ, glp)) == NULL)
                return NULL;
 
        grpldr.gl_name = cp;
        grpldr.gl_ldr = q = gl_ldr;
 
        while (*cp) {
-               while (*cp && !isspace (*cp))
+               while (*cp && !isspace(*cp))
                        cp++;
-               while (*cp && isspace (*cp))
+               while (*cp && isspace(*cp))
                        *cp++ = '\0';
                if (*cp == '\0')
                        break;
@@ -451,89 +448,85 @@ struct grpldr  *getglent () {
        return (&grpldr);
 }
 
-struct grpldr  *getglnam (name)
+struct grpldr *getglnam(name)
 char   *name;
 {
        register struct grpldr  *gl = NULL;
 
-       setglent ();
-       while (gl = getglent ())
-               if (strcmp (name, gl->gl_name) == 0)
+       setglent();
+       while (gl = getglent())
+               if (strcmp(name, gl->gl_name) == 0)
                        break;
-       endglent ();
+       endglent();
 
        return gl;
 }
 
-ldr_names () {
+ldr_names() {
        register int gp, hit = 0;
        char *gldrs[NGRPS];
        register struct grpldr  *gl;
 
        gldrs[0] = NULL;
-       setglent ();
-       while (gl = getglent ()) {
-               if (getgrnam (gl->gl_name) == NULL) {
-                       setup ();
-                       fprintf (out, "unknown group %s in group leaders file\n",
+       setglent();
+       while (gl = getglent()) {
+               if (getgrnam(gl->gl_name) == NULL) {
+                       setup();
+                       fprintf(out, "unknown group %s in group leaders file\n",
                                        gl->gl_name);
                        hit++;
                }
                for (gp = 0; gldrs[gp]; gp++)
-                       if (strcmp (gldrs[gp], gl->gl_name) == 0) {
-                               setup ();
-                               fprintf (out, "duplicate group %s in group leaders file\n",
-                                               gl->gl_name);
+                       if (strcmp(gldrs[gp], gl->gl_name) == 0) {
+                               setup();
+                               fprintf(out, "duplicate group %s in group leaders file\n", gl->gl_name);
                                hit++;
                                break;
                        }
                if (gldrs[gp] == NULL)
                        if (gp < NGRPS) {
-                               gldrs[gp++] = getcpy (gl->gl_name);
+                               gldrs[gp++] = getcpy(gl->gl_name);
                                gldrs[gp] = NULL;
                        } else {
-                               setup ();
-                               fprintf (out, "more than %d groups in group leaders file%s\n",
-                                               " (time to recompile)", NGRPS - 1);
+                               setup();
+                               fprintf(out, "more than %d groups in group leaders file (time to recompile)\n", NGRPS - 1);
                                hit++;
                        }
        }
-       endglent ();
+       endglent();
 
        for (gp = 0; gldrs[gp]; gp++)
-               free (gldrs[gp]);
+               free(gldrs[gp]);
 
        if (!hit && out && !mail)
-               fprintf (out, "all groups in group leaders file accounted for\n");
+               fprintf(out, "all groups in group leaders file accounted for\n");
 }
 
 
-ldr_ship () {
+ldr_ship() {
        register int hit = 0;
        register char **cp, **dp;
        register struct grpldr  *gl;
 
-       setglent ();
-       while (gl = getglent ())
+       setglent();
+       while (gl = getglent())
                for (cp = gl->gl_ldr; *cp; cp++) {
-                       if (!check (*cp)) {
-                               setup ();
-                               fprintf (out, "group %s has unknown leader %s\n",
-                                               gl->gl_name, *cp);
+                       if (!check(*cp)) {
+                               setup();
+                               fprintf(out, "group %s has unknown leader %s\n", gl->gl_name, *cp);
                                hit++;
                        }
 
                        for (dp = cp + 1; *dp; dp++)
-                               if (strcmp (*cp, *dp) == 0) {
-                                       setup ();
-                                       fprintf (out, "group %s had duplicate leader %s\n",
-                                                       gl->gl_name, *cp);
+                               if (strcmp(*cp, *dp) == 0) {
+                                       setup();
+                                       fprintf(out, "group %s had duplicate leader %s\n", gl->gl_name, *cp);
                                        hit++;
                                }
                }
-       endglent ();
+       endglent();
 
        if (!hit && out && !mail)
-               fprintf (out, "all group leaders accounted for\n");
+               fprintf(out, "all group leaders accounted for\n");
 }
 #endif /* UCI */
index 86c564f..89315c2 100644 (file)
@@ -40,7 +40,7 @@ static struct swit switches[] = {
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int anot = 0, inplace = 1, nedit = 0;
        int nwhat = 0, in, out;
@@ -53,31 +53,30 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [+folder] [msg] [switches]",
-                                               invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [+folder] [msg] [switches]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case ANNOSW:
                                        anot++;
@@ -88,7 +87,7 @@ main (int argc, char **argv)
 
                                case EDITRSW:
                                        if (!(ed = *argp++) || *ed == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        nedit = 0;
                                        continue;
                                case NEDITSW:
@@ -97,7 +96,7 @@ main (int argc, char **argv)
 
                                case WHATSW:
                                        if (!(whatnowproc = *argp++) || *whatnowproc == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        nwhat = 0;
                                        continue;
                                case NWHATSW:
@@ -106,14 +105,14 @@ main (int argc, char **argv)
 
                                case FILESW:
                                        if (file)
-                                               adios (NULL, "only one file at a time!");
+                                               adios(NULL, "only one file at a time!");
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       file = path (cp, TFILE);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       file = path(cp, TFILE);
                                        continue;
                                case FORMSW:
                                        if (!(form = *argp++) || *form == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case INPLSW:
@@ -126,34 +125,34 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else {
                        if (msg)
-                               adios (NULL, "only one message at a time!");
+                               adios(NULL, "only one message at a time!");
                        else
                                msg = cp;
                }
        }
 
-       cwd = getcpy (pwd ());
+       cwd = getcpy(pwd());
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
        if (file && (msg || folder))
-               adios (NULL, "can't mix files and folders/msgs");
+               adios(NULL, "can't mix files and folders/msgs");
 
        in = open_form(&form, distcomps);
 
-       strncpy (drft, m_draft("new"), sizeof(drft));
+       strncpy(drft, m_draft("new"), sizeof(drft));
 
-       if ((out = creat (drft, m_gmprot ())) == NOTOK)
-               adios (drft, "unable to create");
+       if ((out = creat(drft, m_gmprot())) == NOTOK)
+               adios(drft, "unable to create");
 
-       cpydata (in, out, form, drft);
-       close (in);
-       close (out);
+       cpydata(in, out, form, drft);
+       close(in);
+       close(out);
 
        if (file) {
                /*
@@ -167,44 +166,44 @@ main (int argc, char **argv)
                if (!msg)
                        msg = "cur";
                if (!folder)
-                       folder = getfolder (1);
-               maildir = m_maildir (folder);
+                       folder = getfolder(1);
+               maildir = m_maildir(folder);
 
-               if (chdir (maildir) == NOTOK)
-                       adios (maildir, "unable to change directory to");
+               if (chdir(maildir) == NOTOK)
+                       adios(maildir, "unable to change directory to");
 
                /* read folder and create message structure */
-               if (!(mp = folder_read (folder)))
-                       adios (NULL, "unable to read folder %s", folder);
+               if (!(mp = folder_read(folder)))
+                       adios(NULL, "unable to read folder %s", folder);
 
                /* check for empty folder */
                if (mp->nummsg == 0)
-                       adios (NULL, "no messages in %s", folder);
+                       adios(NULL, "no messages in %s", folder);
 
                /* parse the message range/sequence/name and set SELECTED */
-               if (!m_convert (mp, msg))
-                       done (1);
-               seq_setprev (mp);  /* set the previous-sequence */
+               if (!m_convert(mp, msg))
+                       done(1);
+               seq_setprev(mp);  /* set the previous-sequence */
 
                if (mp->numsel > 1)
-                       adios (NULL, "only one message at a time!");
+                       adios(NULL, "only one message at a time!");
        }
 
-       msgnam = file ? file : getcpy (m_name (mp->lowsel));
-       if ((in = open (msgnam, O_RDONLY)) == NOTOK)
-               adios (msgnam, "unable to open message");
+       msgnam = file ? file : getcpy(m_name(mp->lowsel));
+       if ((in = open(msgnam, O_RDONLY)) == NOTOK)
+               adios(msgnam, "unable to open message");
 
        if (!file) {
-               context_replace (pfolder, folder);  /* update current folder */
-               seq_setcur (mp, mp->lowsel);  /* update current message */
-               seq_save (mp);  /* synchronize sequences  */
-               context_save ();  /* save the context file  */
+               context_replace(pfolder, folder);  /* update current folder */
+               seq_setcur(mp, mp->lowsel);  /* update current message */
+               seq_save(mp);  /* synchronize sequences  */
+               context_save();  /* save the context file  */
        }
 
        if (nwhat)
-               done (0);
-       what_now (ed, nedit, NOUSE, drft, msgnam, 1, mp,
-               anot ? "Resent" : NULL, inplace, cwd);
-       done (1);
+               done(0);
+       what_now(ed, nedit, NOUSE, drft, msgnam, 1, mp, anot ? "Resent" : NULL,
+                       inplace, cwd);
+       done(1);
        return 1;
 }
index 7c46da1..319e496 100644 (file)
@@ -24,7 +24,7 @@ static int  txtfd = NOTOK;
 static void ready_msg(char *);
 
 int
-distout (char *drft, char *msgnam, char *backup)
+distout(char *drft, char *msgnam, char *backup)
 {
        int state;
        register unsigned char *dp;
@@ -32,42 +32,44 @@ distout (char *drft, char *msgnam, char *backup)
        char name[NAMESZ], buffer[BUFSIZ];
        register FILE *ifp, *ofp;
 
-       if (rename (drft, strcpy (backup, m_backup (drft))) == NOTOK)
-               adios (backup, "unable to rename %s to",drft);
-       if ((ifp = fopen (backup, "r")) == NULL)
-               adios (backup, "unable to read");
+       if (rename(drft, strcpy(backup, m_backup(drft))) == NOTOK)
+               adios(backup, "unable to rename %s to",drft);
+       if ((ifp = fopen(backup, "r")) == NULL)
+               adios(backup, "unable to read");
 
-       if ((ofp = fopen (drft, "w")) == NULL)
-               adios (drft, "unable to create temporary file");
-       chmod (drft, m_gmprot ());
+       if ((ofp = fopen(drft, "w")) == NULL)
+               adios(drft, "unable to create temporary file");
+       chmod(drft, m_gmprot());
 
-       ready_msg (msgnam);
-       lseek (hdrfd, (off_t) 0, SEEK_SET); /* msgnam not accurate */
-       cpydata (hdrfd, fileno (ofp), msgnam, drft);
+       ready_msg(msgnam);
+       lseek(hdrfd, (off_t) 0, SEEK_SET); /* msgnam not accurate */
+       cpydata(hdrfd, fileno(ofp), msgnam, drft);
 
        for (state = FLD, resent = NULL;;)
-               switch (state =
-                               m_getfld (state, name, buffer, sizeof buffer, ifp)) {
+               switch (state = m_getfld (state, name, buffer,
+                               sizeof buffer, ifp)) {
                        case FLD:
                        case FLDPLUS:
                        case FLDEOF:
-                               if (uprf (name, "distribute-"))
-                                       snprintf (name, sizeof(name), "%s%s", "Resent", &name[10]);
-                               if (uprf (name, "distribution-"))
-                                       snprintf (name, sizeof(name), "%s%s", "Resent", &name[12]);
-                               if (!uprf (name, "resent")) {
-                                       advise (NULL, BADHDR, "draft", name);
+                               if (uprf(name, "distribute-"))
+                                       snprintf(name, sizeof(name), "%s%s",
+                                                       "Resent", &name[10]);
+                               if (uprf(name, "distribution-"))
+                                       snprintf(name, sizeof(name), "%s%s",
+                                                       "Resent", &name[12]);
+                               if (!uprf(name, "resent")) {
+                                       advise(NULL, BADHDR, "draft", name);
                                        goto leave_bad;
                                }
                                if (state == FLD)
-                                       resent = add (":", add (name, resent));
-                               resent = add (buffer, resent);
-                               fprintf (ofp, "%s: %s", name, buffer);
+                                       resent = add(":", add(name, resent));
+                               resent = add(buffer, resent);
+                               fprintf(ofp, "%s: %s", name, buffer);
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, name,
-                                                       buffer, sizeof buffer, ifp);
-                                       resent = add (buffer, resent);
-                                       fputs (buffer, ofp);
+                                       state = m_getfld(state, name, buffer,
+                                                       sizeof buffer, ifp);
+                                       resent = add(buffer, resent);
+                                       fputs(buffer, ofp);
                                }
                                if (state == FLDEOF)
                                        goto process;
@@ -76,8 +78,8 @@ distout (char *drft, char *msgnam, char *backup)
                        case BODY:
                        case BODYEOF:
                                for (dp = buffer; *dp; dp++)
-                                       if (!isspace (*dp)) {
-                                               advise (NULL, BADTXT, "draft");
+                                       if (!isspace(*dp)) {
+                                               advise(NULL, BADTXT, "draft");
                                                goto leave_bad;
                                        }
 
@@ -86,45 +88,46 @@ distout (char *drft, char *msgnam, char *backup)
 
                        case LENERR:
                        case FMTERR:
-                               advise (NULL, BADRFT, "draft");
+                               advise(NULL, BADRFT, "draft");
                leave_bad: ;
-                               fclose (ifp);
-                               fclose (ofp);
-                               unlink (drft);
-                               if (rename (backup, drft) == NOTOK)
-                                       adios (drft, "unable to rename %s to", backup);
+                               fclose(ifp);
+                               fclose(ofp);
+                               unlink(drft);
+                               if (rename(backup, drft) == NOTOK)
+                                       adios(drft, "unable to rename %s to",
+                                                       backup);
                                return NOTOK;
 
                        default:
-                               adios (NULL, "getfld() returned %d", state);
+                               adios(NULL, "getfld() returned %d", state);
                }
 process: ;
-       fclose (ifp);
-       fflush (ofp);
+       fclose(ifp);
+       fflush(ofp);
 
        if (!resent) {
-               advise (NULL, BADMSG, "draft");
-               fclose (ofp);
-               unlink (drft);
-               if (rename (backup, drft) == NOTOK)
-                       adios (drft, "unable to rename %s to", backup);
+               advise(NULL, BADMSG, "draft");
+               fclose(ofp);
+               unlink(drft);
+               if (rename(backup, drft) == NOTOK)
+                       adios(drft, "unable to rename %s to", backup);
                return NOTOK;
        }
-       free (resent);
+       free(resent);
 
        if (txtfd != NOTOK) {
-               lseek (txtfd, (off_t) 0, SEEK_SET); /* msgnam not accurate */
-               cpydata (txtfd, fileno (ofp), msgnam, drft);
+               lseek(txtfd, (off_t) 0, SEEK_SET); /* msgnam not accurate */
+               cpydata(txtfd, fileno(ofp), msgnam, drft);
        }
 
-       fclose (ofp);
+       fclose(ofp);
 
        return OK;
 }
 
 
 static void
-ready_msg (char *msgnam)
+ready_msg(char *msgnam)
 {
        int state, out;
        char name[NAMESZ], buffer[BUFSIZ], tmpfil[BUFSIZ];
@@ -132,12 +135,12 @@ ready_msg (char *msgnam)
        char *cp = NULL;
 
        if (hdrfd != NOTOK)
-               close (hdrfd), hdrfd = NOTOK;
+               close(hdrfd), hdrfd = NOTOK;
        if (txtfd != NOTOK)
-               close (txtfd), txtfd = NOTOK;
+               close(txtfd), txtfd = NOTOK;
 
-       if ((ifp = fopen (msgnam, "r")) == NULL)
-               adios (msgnam, "unable to open message");
+       if ((ifp = fopen(msgnam, "r")) == NULL)
+               adios(msgnam, "unable to open message");
 
        cp = m_mktemp2(NULL, "dist", &hdrfd, NULL);
        if (cp == NULL) {
@@ -145,24 +148,24 @@ ready_msg (char *msgnam)
        }
        fchmod(hdrfd, 0600);
        strncpy(tmpfil, cp, sizeof(tmpfil));
-       if ((out = dup (hdrfd)) == NOTOK
-                       || (ofp = fdopen (out, "w")) == NULL)
-               adios (NULL, "no file descriptors -- you lose big");
-       unlink (tmpfil);
+       if ((out = dup(hdrfd)) == NOTOK
+                       || (ofp = fdopen(out, "w")) == NULL)
+               adios(NULL, "no file descriptors -- you lose big");
+       unlink(tmpfil);
 
        for (state = FLD;;)
-               switch (state =
-                               m_getfld (state, name, buffer, sizeof buffer, ifp)) {
+               switch (state = m_getfld (state, name, buffer, sizeof buffer,
+                               ifp)) {
                        case FLD:
                        case FLDPLUS:
                        case FLDEOF:
-                               if (uprf (name, "resent"))
-                                       fprintf (ofp, "Prev-");
-                               fprintf (ofp, "%s: %s", name, buffer);
+                               if (uprf(name, "resent"))
+                                       fprintf(ofp, "Prev-");
+                               fprintf(ofp, "%s: %s", name, buffer);
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, name,
-                                                       buffer, sizeof buffer, ifp);
-                                       fputs (buffer, ofp);
+                                       state = m_getfld(state, name, buffer,
+                                                       sizeof buffer, ifp);
+                                       fputs(buffer, ofp);
                                }
                                if (state == FLDEOF)
                                        goto process;
@@ -170,35 +173,37 @@ ready_msg (char *msgnam)
 
                        case BODY:
                        case BODYEOF:
-                               fclose (ofp);
+                               fclose(ofp);
 
                                cp = m_mktemp2(NULL, "dist", &txtfd, NULL);
                                if (cp == NULL) {
                                        adios("distsbr", "unable to create temporary file");
                                }
                                fchmod(txtfd, 0600);
-                               strncpy (tmpfil, cp, sizeof(tmpfil));
-                               if ((out = dup (txtfd)) == NOTOK
-                                               || (ofp = fdopen (out, "w")) == NULL)
-                                       adios (NULL, "no file descriptors -- you lose big");
-                               unlink (tmpfil);
-                               fprintf (ofp, "\n%s", buffer);
+                               strncpy(tmpfil, cp, sizeof(tmpfil));
+                               if ((out = dup(txtfd)) == NOTOK
+                                               || (ofp = fdopen(out, "w"))
+                                               == NULL)
+                                       adios(NULL, "no file descriptors -- you lose big");
+                               unlink(tmpfil);
+                               fprintf(ofp, "\n%s", buffer);
                                while (state == BODY) {
-                                       state = m_getfld (state, name,
-                                                       buffer, sizeof buffer, ifp);
-                                       fputs (buffer, ofp);
+                                       state = m_getfld(state, name, buffer,
+                                                       sizeof buffer, ifp);
+                                       fputs(buffer, ofp);
                                }
                        case FILEEOF:
                                goto process;
 
                        case LENERR:
                        case FMTERR:
-                               adios (NULL, "format error in message %s", msgnam);
+                               adios(NULL, "format error in message %s",
+                                               msgnam);
 
                        default:
-                               adios (NULL, "getfld() returned %d", state);
+                               adios(NULL, "getfld() returned %d", state);
                }
 process: ;
-       fclose (ifp);
-       fclose (ofp);
+       fclose(ifp);
+       fclose(ofp);
 }
index 67b2fee..878e2c1 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
@@ -38,16 +38,16 @@ static int dat[5];
 /*
 ** prototypes
 */
-int sc_width (void);  /* from termsbr.c */
+int sc_width(void);  /* from termsbr.c */
 
 /*
 ** static prototypes
 */
-static int process (char *, int);
+static int process(char *, int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int datep = 0, width = 0, status = 0;
        char *cp, *form = NULL, *format = NULL, *nfs;
@@ -57,71 +57,70 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [switches] dates ...",
-                                               invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [switches] dates ...", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case FORMSW:
                                        if (!(form = *argp++) || *form == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        format = NULL;
                                        continue;
                                case FMTSW:
                                        if (!(format = *argp++) || *format == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        form = NULL;
                                        continue;
 
                                case WIDTHSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       width = atoi (cp);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       width = atoi(cp);
                                        continue;
                        }
                }
                if (datep > NDATES)
-                       adios (NULL, "more than %d dates", NDATES);
+                       adios(NULL, "more than %d dates", NDATES);
                else
                        dates[datep++] = cp;
        }
        dates[datep] = NULL;
 
        if (datep == 0)
-               adios (NULL, "usage: %s [switches] dates ...", invo_name);
+               adios(NULL, "usage: %s [switches] dates ...", invo_name);
 
        /* get new format string */
-       nfs = new_fs (form, format, FORMAT);
+       nfs = new_fs(form, format, FORMAT);
 
        if (width == 0) {
-               if ((width = sc_width ()) < WIDTH / 2)
+               if ((width = sc_width()) < WIDTH / 2)
                        width = WIDTH / 2;
                width -= 2;
        }
        if (width > WBUFSIZ)
                width = WBUFSIZ;
-       fmt_compile (nfs, &fmt);
+       fmt_compile(nfs, &fmt);
 
        dat[0] = 0;
        dat[1] = 0;
@@ -130,26 +129,26 @@ main (int argc, char **argv)
        dat[4] = 0;
 
        for (datep = 0; dates[datep]; datep++)
-               status += process (dates[datep], width);
+               status += process(dates[datep], width);
 
-       context_save ();  /* save the context file */
-       done (status);
+       context_save();  /* save the context file */
+       done(status);
        return 1;
 }
 
 
 static int
-process (char *date, int length)
+process(char *date, int length)
 {
        int status = 0;
        char buffer[WBUFSIZ + 1];
        register struct comp *cptr;
 
-       FINDCOMP (cptr, "text");
+       FINDCOMP(cptr, "text");
        if (cptr)
                cptr->c_text = date;
-       fmt_scan (fmt, buffer, length, dat);
-       fputs (buffer, stdout);
+       fmt_scan(fmt, buffer, length, dat);
+       fputs(buffer, stdout);
 
        return status;
 }
index 40de763..a857a1a 100644 (file)
@@ -30,9 +30,9 @@
 /*
 ** static prototypes
 */
-static int mbx_chk_mbox (int);
-static int mbx_chk_mmdf (int);
-static int map_open (char *, int);
+static int mbx_chk_mbox(int);
+static int mbx_chk_mmdf(int);
+static int map_open(char *, int);
 
 
 /*
@@ -41,7 +41,7 @@ static int map_open (char *, int);
 */
 
 int
-mbx_open (char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
+mbx_open(char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
 {
        int j, count, fd;
        struct stat st;
@@ -50,7 +50,8 @@ mbx_open (char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
 
        /* attempt to open and lock file */
        for (count = 4; count > 0; count--) {
-               if ((fd = lkopen (file, O_RDWR | O_CREAT | O_NONBLOCK, mode)) == NOTOK) {
+               if ((fd = lkopen(file, O_RDWR | O_CREAT | O_NONBLOCK, mode))
+                               == NOTOK) {
                        switch (errno) {
 #if defined(FCNTL_LOCKING) || defined(LOCKF_LOCKING)
                                case EACCES:
@@ -62,7 +63,7 @@ mbx_open (char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
 #endif
                                case ETXTBSY:
                                        j = errno;
-                                       sleep (5);
+                                       sleep(5);
                                        break;
 
                                default:
@@ -87,13 +88,13 @@ mbx_open (char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
        /*
        ** Do sanity checks on maildrop.
        */
-       if (fstat (fd, &st) == NOTOK) {
+       if (fstat(fd, &st) == NOTOK) {
                /*
                ** The stat failed.  So we make sure file
                ** has right ownership/modes
                */
-               chown (file, uid, gid);
-               chmod (file, mode);
+               chown(file, uid, gid);
+               chmod(file, mode);
        } else if (st.st_size > (off_t) 0) {
                int status;
 
@@ -101,17 +102,17 @@ mbx_open (char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
                switch (mbx_style) {
                        case MMDF_FORMAT:
                        default:
-                               status = mbx_chk_mmdf (fd);
+                               status = mbx_chk_mmdf(fd);
                                break;
 
                        case MBOX_FORMAT:
-                               status = mbx_chk_mbox (fd);
+                               status = mbx_chk_mbox(fd);
                                break;
                }
 
                /* if error, attempt to close it */
                if (status == NOTOK) {
-                       close (fd);
+                       close(fd);
                        return NOTOK;
                }
        }
@@ -125,10 +126,10 @@ mbx_open (char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
 */
 
 static int
-mbx_chk_mbox (int fd)
+mbx_chk_mbox(int fd)
 {
        /* just seek to the end */
-       if (lseek (fd, (off_t) 0, SEEK_END) == (off_t) NOTOK)
+       if (lseek(fd, (off_t) 0, SEEK_END) == (off_t) NOTOK)
                return NOTOK;
 
        return OK;
@@ -140,24 +141,23 @@ mbx_chk_mbox (int fd)
 */
 
 static int
-mbx_chk_mmdf (int fd)
+mbx_chk_mmdf(int fd)
 {
        size_t count;
        char ldelim[BUFSIZ];
 
-       count = strlen (mmdlm2);
+       count = strlen(mmdlm2);
 
        /* casting -count to off_t, seem to break FreeBSD 2.2.6 */
-       if (lseek (fd, (long) (-count), SEEK_END) == (off_t) NOTOK)
+       if (lseek(fd, (long) (-count), SEEK_END) == (off_t) NOTOK)
                return NOTOK;
-       if (read (fd, ldelim, count) != count)
+       if (read(fd, ldelim, count) != count)
                return NOTOK;
 
        ldelim[count] = 0;
 
-       if (strcmp (ldelim, mmdlm2)
-                       && write (fd, "\n", 1) != 1
-                       && write (fd, mmdlm2, count) != count)
+       if (strcmp(ldelim, mmdlm2) && write(fd, "\n", 1) != 1
+                       && write(fd, mmdlm2, count) != count)
                return NOTOK;
 
        return OK;
@@ -165,7 +165,7 @@ mbx_chk_mmdf (int fd)
 
 
 int
-mbx_read (FILE *fp, long pos, struct drop **drops, int noisy)
+mbx_read(FILE *fp, long pos, struct drop **drops, int noisy)
 {
        register int len, size;
        register long ld1, ld2;
@@ -173,33 +173,33 @@ mbx_read (FILE *fp, long pos, struct drop **drops, int noisy)
        char buffer[BUFSIZ];
        register struct drop *cp, *dp, *ep, *pp;
 
-       pp = (struct drop *) calloc ((size_t) (len = MAXFOLDER), sizeof(*dp));
+       pp = (struct drop *) calloc((size_t) (len = MAXFOLDER), sizeof(*dp));
        if (pp == NULL) {
                if (noisy)
-                       admonish (NULL, "unable to allocate drop storage");
+                       admonish(NULL, "unable to allocate drop storage");
                return NOTOK;
        }
 
-       ld1 = (long) strlen (mmdlm1);
-       ld2 = (long) strlen (mmdlm2);
+       ld1 = (long) strlen(mmdlm1);
+       ld2 = (long) strlen(mmdlm2);
 
-       fseek (fp, pos, SEEK_SET);
-       for (ep = (dp = pp) + len - 1; fgets (buffer, sizeof(buffer), fp);) {
+       fseek(fp, pos, SEEK_SET);
+       for (ep = (dp = pp) + len - 1; fgets(buffer, sizeof(buffer), fp);) {
                size = 0;
-               if (strcmp (buffer, mmdlm1) == 0)
+               if (strcmp(buffer, mmdlm1) == 0)
                        pos += ld1, dp->d_start = (long) pos;
                else {
-                       dp->d_start = (long)pos , pos += (long) strlen (buffer);
+                       dp->d_start = (long)pos , pos += (long) strlen(buffer);
                        for (bp = buffer; *bp; bp++, size++)
                                if (*bp == '\n')
                                        size++;
                }
 
-               while (fgets (buffer, sizeof(buffer), fp) != NULL)
-                       if (strcmp (buffer, mmdlm2) == 0)
+               while (fgets(buffer, sizeof(buffer), fp) != NULL)
+                       if (strcmp(buffer, mmdlm2) == 0)
                                break;
                        else {
-                               pos += (long) strlen (buffer);
+                               pos += (long) strlen(buffer);
                                for (bp = buffer; *bp; bp++, size++)
                                        if (*bp == '\n')
                                                size++;
@@ -216,17 +216,18 @@ mbx_read (FILE *fp, long pos, struct drop **drops, int noisy)
                if (dp >= ep) {
                        register int curlen = dp - pp;
 
-                       cp = (struct drop *) mh_xrealloc ((char *) pp,
-                                                                       (size_t) (len += MAXFOLDER) * sizeof(*pp));
+                       cp = (struct drop *) mh_xrealloc((char *) pp,
+                                       (size_t) (len += MAXFOLDER) *
+                                       sizeof(*pp));
                        dp = cp + curlen, ep = (pp = cp) + len - 1;
                }
        }
 
        if (dp == pp)
-               free ((char *) pp);
+               free((char *) pp);
        else
                *drops = pp;
-       return (dp - pp);
+       return(dp - pp);
 }
 
 
@@ -240,21 +241,21 @@ mbx_write(char *mailbox, int md, FILE *fp, int id, long last,
        register char *cp;
        char buffer[BUFSIZ];
 
-       off = (long) lseek (md, (off_t) 0, SEEK_CUR);
-       j = strlen (mmdlm1);
-       if (write (md, mmdlm1, j) != j)
+       off = (long) lseek(md, (off_t) 0, SEEK_CUR);
+       j = strlen(mmdlm1);
+       if (write(md, mmdlm1, j) != j)
                return NOTOK;
-       start = lseek (md, (off_t) 0, SEEK_CUR);
+       start = lseek(md, (off_t) 0, SEEK_CUR);
        size = 0;
 
-       fseek (fp, pos, SEEK_SET);
-       while (fgets (buffer, sizeof(buffer), fp) && (pos < stop)) {
-               i = strlen (buffer);
-               for (j = 0; (j = stringdex (mmdlm1, buffer)) >= 0; buffer[j]++)
+       fseek(fp, pos, SEEK_SET);
+       while (fgets(buffer, sizeof(buffer), fp) && (pos < stop)) {
+               i = strlen(buffer);
+               for (j = 0; (j = stringdex(mmdlm1, buffer)) >= 0; buffer[j]++)
                        continue;
-               for (j = 0; (j = stringdex (mmdlm2, buffer)) >= 0; buffer[j]++)
+               for (j = 0; (j = stringdex(mmdlm2, buffer)) >= 0; buffer[j]++)
                        continue;
-               if (write (md, buffer, i) != i)
+               if (write(md, buffer, i) != i)
                        return NOTOK;
                pos += (long) i;
                if (mapping)
@@ -263,12 +264,13 @@ mbx_write(char *mailbox, int md, FILE *fp, int id, long last,
                                        size++;
        }
 
-       stop = lseek (md, (off_t) 0, SEEK_CUR);
-       j = strlen (mmdlm2);
-       if (write (md, mmdlm2, j) != j)
+       stop = lseek(md, (off_t) 0, SEEK_CUR);
+       j = strlen(mmdlm2);
+       if (write(md, mmdlm2, j) != j)
                return NOTOK;
        if (mapping)
-               map_write (mailbox, md, id, last, start, stop, off, size, noisy);
+               map_write(mailbox, md, id, last, start, stop, off, size,
+                               noisy);
 
        return OK;
 }
@@ -279,8 +281,8 @@ mbx_write(char *mailbox, int md, FILE *fp, int id, long last,
 */
 
 int
-mbx_copy (char *mailbox, int mbx_style, int md, int fd,
-                 int mapping, char *text, int noisy)
+mbx_copy(char *mailbox, int mbx_style, int md, int fd, int mapping,
+               char *text, int noisy)
 {
        int i, j, size;
        off_t start, stop;
@@ -288,36 +290,32 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
        char *cp, buffer[BUFSIZ];
        FILE *fp;
 
-       pos = (long) lseek (md, (off_t) 0, SEEK_CUR);
+       pos = (long) lseek(md, (off_t) 0, SEEK_CUR);
        size = 0;
 
        switch (mbx_style) {
                case MMDF_FORMAT:
                default:
-                       j = strlen (mmdlm1);
-                       if (write (md, mmdlm1, j) != j)
+                       j = strlen(mmdlm1);
+                       if (write(md, mmdlm1, j) != j)
                                return NOTOK;
-                       start = lseek (md, (off_t) 0, SEEK_CUR);
+                       start = lseek(md, (off_t) 0, SEEK_CUR);
 
                        if (text) {
-                               i = strlen (text);
-                               if (write (md, text, i) != i)
+                               i = strlen(text);
+                               if (write(md, text, i) != i)
                                        return NOTOK;
                                for (cp = text; *cp++; size++)
                                        if (*cp == '\n')
                                                size++;
                        }
 
-                       while ((i = read (fd, buffer, sizeof(buffer))) > 0) {
-                               for (j = 0;
-                                               (j = stringdex (mmdlm1, buffer)) >= 0;
-                                               buffer[j]++)
+                       while ((i = read(fd, buffer, sizeof(buffer))) > 0) {
+                               for (j = 0; (j = stringdex(mmdlm1, buffer)) >= 0; buffer[j]++)
                                        continue;
-                               for (j = 0;
-                                               (j = stringdex (mmdlm2, buffer)) >= 0;
-                                               buffer[j]++)
+                               for (j = 0; (j = stringdex(mmdlm2, buffer)) >= 0; buffer[j]++)
                                        continue;
-                               if (write (md, buffer, i) != i)
+                               if (write(md, buffer, i) != i)
                                        return NOTOK;
                                if (mapping)
                                        for (cp = buffer; i-- > 0; size++)
@@ -325,35 +323,37 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
                                                        size++;
                        }
 
-                       stop = lseek (md, (off_t) 0, SEEK_CUR);
-                       j = strlen (mmdlm2);
-                       if (write (md, mmdlm2, j) != j)
+                       stop = lseek(md, (off_t) 0, SEEK_CUR);
+                       j = strlen(mmdlm2);
+                       if (write(md, mmdlm2, j) != j)
                                return NOTOK;
                        if (mapping)
-                               map_write (mailbox, md, 0, (long) 0, start, stop, pos, size, noisy);
+                               map_write(mailbox, md, 0, (long) 0, start,
+                                               stop, pos, size, noisy);
 
                        return (i != NOTOK ? OK : NOTOK);
 
                case MBOX_FORMAT:
-                       if ((j = dup (fd)) == NOTOK)
+                       if ((j = dup(fd)) == NOTOK)
                                return NOTOK;
-                       if ((fp = fdopen (j, "r")) == NULL) {
-                               close (j);
+                       if ((fp = fdopen(j, "r")) == NULL) {
+                               close(j);
                                return NOTOK;
                        }
-                       start = lseek (md, (off_t) 0, SEEK_CUR);
+                       start = lseek(md, (off_t) 0, SEEK_CUR);
 
                        /* If text is given, we add it to top of message */
                        if (text) {
-                               i = strlen (text);
-                               if (write (md, text, i) != i)
+                               i = strlen(text);
+                               if (write(md, text, i) != i)
                                        return NOTOK;
                                for (cp = text; *cp++; size++)
                                        if (*cp == '\n')
                                                size++;
                        }
 
-                       for (j = 0; fgets (buffer, sizeof(buffer), fp) != NULL; j++) {
+                       for (j = 0; fgets(buffer, sizeof(buffer), fp) != NULL;
+                                       j++) {
 
                                /*
                                ** Check the first line, and make some changes.
@@ -363,7 +363,8 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
                                        ** Change the "Return-Path:" field
                                        ** (if in first line) back to "From ".
                                        */
-                                       if (!strncmp (buffer, "Return-Path:", 12)) {
+                                       if (!strncmp(buffer, "Return-Path:",
+                                                       12)) {
                                                char tmpbuffer[BUFSIZ];
                                                char *tp, *ep, *fp;
 
@@ -372,9 +373,8 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
                                                if (!(fp = strchr(ep + 1, ' ')))
                                                        fp = strchr(ep + 1, '\n');
                                                tp = dctime(dlocaltimenow());
-                                               snprintf (buffer, sizeof(buffer), "From %.*s  %s",
-                                                               (int)(fp - ep), ep, tp);
-                                       } else if (!strncmp (buffer, "X-Envelope-From:", 16)) {
+                                               snprintf(buffer, sizeof(buffer), "From %.*s  %s", (int)(fp - ep), ep, tp);
+                                       } else if (!strncmp(buffer, "X-Envelope-From:", 16)) {
                                                /*
                                                ** Change the "X-Envelope-From:"
                                                ** field (if first line) back
@@ -385,8 +385,8 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
 
                                                strncpy(tmpbuffer, buffer, sizeof(tmpbuffer));
                                                ep = tmpbuffer + 17;
-                                               snprintf (buffer, sizeof(buffer), "From %s", ep);
-                                       } else if (strncmp (buffer, "From ", 5)) {
+                                               snprintf(buffer, sizeof(buffer), "From %s", ep);
+                                       } else if (strncmp(buffer, "From ", 5)) {
                                                /*
                                                ** If there is already a "From "
                                                ** line, then leave it alone.
@@ -398,7 +398,7 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
                                                strncpy(tmpbuffer, buffer, sizeof(tmpbuffer));
                                                ep = "nobody@nowhere";
                                                tp = dctime(dlocaltimenow());
-                                               snprintf (buffer, sizeof(buffer), "From %s  %s%s", ep, tp, tmpbuffer);
+                                               snprintf(buffer, sizeof(buffer), "From %s  %s%s", ep, tp, tmpbuffer);
                                        }
                                }
 
@@ -406,13 +406,13 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
                                ** If this is not first line, and begins with
                                ** "From ", then prepend line with ">".
                                */
-                               if (j != 0 && strncmp (buffer, "From ", 5) == 0) {
-                                       write (md, ">", 1);
+                               if (j != 0 && strncmp(buffer, "From ", 5) == 0) {
+                                       write(md, ">", 1);
                                        size++;
                                }
-                               i = strlen (buffer);
-                               if (write (md, buffer, i) != i) {
-                                       fclose (fp);
+                               i = strlen(buffer);
+                               if (write(md, buffer, i) != i) {
+                                       fclose(fp);
                                        return NOTOK;
                                }
                                if (mapping)
@@ -420,18 +420,18 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
                                                if (*cp++ == '\n')
                                                        size++;
                        }
-                       if (write (md, "\n", 1) != 1) {
-                               fclose (fp);
+                       if (write(md, "\n", 1) != 1) {
+                               fclose(fp);
                                return NOTOK;
                        }
                        if (mapping)
                                size += 2;
 
-                       fclose (fp);
-                       lseek (fd, (off_t) 0, SEEK_END);
-                       stop = lseek (md, (off_t) 0, SEEK_CUR);
+                       fclose(fp);
+                       lseek(fd, (off_t) 0, SEEK_END);
+                       stop = lseek(md, (off_t) 0, SEEK_CUR);
                        if (mapping)
-                               map_write (mailbox, md, 0, (long) 0, start,
+                               map_write(mailbox, md, 0, (long) 0, start,
                                                stop, pos, size, noisy);
 
                        return OK;
@@ -440,24 +440,24 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
 
 
 int
-mbx_size (int md, off_t start, off_t stop)
+mbx_size(int md, off_t start, off_t stop)
 {
        register int i, fd;
        register long pos;
        register FILE *fp;
 
-       if ((fd = dup (md)) == NOTOK || (fp = fdopen (fd, "r")) == NULL) {
+       if ((fd = dup(md)) == NOTOK || (fp = fdopen(fd, "r")) == NULL) {
                if (fd != NOTOK)
-                       close (fd);
+                       close(fd);
                return NOTOK;
        }
 
-       fseek (fp, start, SEEK_SET);
+       fseek(fp, start, SEEK_SET);
        for (i = 0, pos = stop - start; pos-- > 0; i++)
-               if (fgetc (fp) == '\n')
+               if (fgetc(fp) == '\n')
                        i++;
 
-       fclose (fp);
+       fclose(fp);
        return i;
 }
 
@@ -467,9 +467,9 @@ mbx_size (int md, off_t start, off_t stop)
 */
 
 int
-mbx_close (char *mailbox, int md)
+mbx_close(char *mailbox, int md)
 {
-       if (lkclose (md, mailbox) == 0)
+       if (lkclose(md, mailbox) == 0)
                return OK;
        return NOTOK;
 }
@@ -477,55 +477,58 @@ mbx_close (char *mailbox, int md)
 
 /*
 ** This function is performed implicitly by getbbent.c:
-**     bb->bb_map = map_name (bb->bb_file);
+**     bb->bb_map = map_name(bb->bb_file);
 */
 
 char *
-map_name (char *file)
+map_name(char *file)
 {
        register char *cp, *dp;
        static char buffer[BUFSIZ];
 
-       if ((dp = strchr(cp = r1bindex (file, '/'), '.')) == NULL)
-               dp = cp + strlen (cp);
+       if ((dp = strchr(cp = r1bindex(file, '/'), '.')) == NULL)
+               dp = cp + strlen(cp);
        if (cp == file)
-               snprintf (buffer, sizeof(buffer), ".%.*s%s", (int)(dp - cp), cp, ".map");
+               snprintf(buffer, sizeof(buffer), ".%.*s%s",
+                               (int)(dp - cp), cp, ".map");
        else
                snprintf (buffer, sizeof(buffer), "%.*s.%.*s%s",
-                               (int)(cp - file), file, (int)(dp - cp), cp, ".map");
+                               (int)(cp - file), file, (int)(dp - cp),
+                               cp, ".map");
 
        return buffer;
 }
 
 
 int
-map_read (char *file, long pos, struct drop **drops, int noisy)
+map_read(char *file, long pos, struct drop **drops, int noisy)
 {
        register int i, md, msgp;
        register char *cp;
        struct drop d;
        register struct drop *mp, *dp;
 
-       if ((md = open (cp = map_name (file), O_RDONLY)) == NOTOK
-                       || map_chk (cp, md, mp = &d, pos, noisy)) {
+       if ((md = open(cp = map_name(file), O_RDONLY)) == NOTOK
+                       || map_chk(cp, md, mp = &d, pos, noisy)) {
                if (md != NOTOK)
-                       close (md);
+                       close(md);
                return 0;
        }
 
        msgp = mp->d_id;
-       dp = (struct drop *) calloc ((size_t) (msgp + 1), sizeof(*dp));
+       dp = (struct drop *) calloc((size_t) (msgp + 1), sizeof(*dp));
        if (dp == NULL) {
-               close (md);
+               close(md);
                return 0;
        }
 
        memcpy((char *) dp, (char *) mp, sizeof(*dp));
 
-       lseek (md, (off_t) sizeof(*mp), SEEK_SET);
-       if ((i = read (md, (char *) (dp + 1), msgp * sizeof(*dp))) < sizeof(*dp)) {
+       lseek(md, (off_t) sizeof(*mp), SEEK_SET);
+       if ((i = read(md, (char *) (dp + 1), msgp * sizeof(*dp))) <
+                       sizeof(*dp)) {
                i = 0;
-               free ((char *) dp);
+               free((char *) dp);
        } else {
 #ifdef NTOHLSWAP
                register struct drop *tdp;
@@ -541,14 +544,14 @@ map_read (char *file, long pos, struct drop **drops, int noisy)
                *drops = dp;
        }
 
-       close (md);
+       close(md);
 
        return (i / sizeof(*dp));
 }
 
 
 int
-map_write (char *mailbox, int md, int id, long last, off_t start,
+map_write(char *mailbox, int md, int id, long last, off_t start,
                   off_t stop, long pos, int size, int noisy)
 {
        register int i;
@@ -559,40 +562,42 @@ map_write (char *mailbox, int md, int id, long last, off_t start,
        register FILE *fp;
        struct stat st;
 
-       if ((fd = map_open (file = map_name (mailbox), md)) == NOTOK)
+       if ((fd = map_open(file = map_name(mailbox), md)) == NOTOK)
                return NOTOK;
 
-       if ((fstat (fd, &st) == OK) && (st.st_size > 0))
+       if ((fstat(fd, &st) == OK) && (st.st_size > 0))
                clear = 0;
        else
                clear = 1;
 
-       if (!clear && map_chk (file, fd, &d1, pos, noisy)) {
-               unlink (file);
-               mbx_close (file, fd);
-               if ((fd = map_open (file, md)) == NOTOK)
+       if (!clear && map_chk(file, fd, &d1, pos, noisy)) {
+               unlink(file);
+               mbx_close(file, fd);
+               if ((fd = map_open(file, md)) == NOTOK)
                        return NOTOK;
                clear++;
        }
 
        if (clear) {
-               if ((td = dup (md)) == NOTOK || (fp = fdopen (td, "r")) == NULL) {
+               if ((td = dup(md)) == NOTOK ||
+                               (fp = fdopen(td, "r")) == NULL) {
                        if (noisy)
-                               admonish (file, "unable to %s", td != NOTOK ? "fdopen" : "dup");
+                               admonish(file, "unable to %s", td != NOTOK ?
+                                               "fdopen" : "dup");
                        if (td != NOTOK)
-                               close (td);
-                       mbx_close (file, fd);
+                               close(td);
+                       mbx_close(file, fd);
                        return NOTOK;
                }
 
-               switch (i = mbx_read (fp, 0, &rp, noisy)) {
+               switch (i = mbx_read(fp, 0, &rp, noisy)) {
                        case NOTOK:
-                               fclose (fp);
-                               mbx_close (file, fd);
+                               fclose(fp);
+                               mbx_close(file, fd);
                                return NOTOK;
 
                        case OK:
-                               fclose (fp);
+                               fclose(fp);
                                break;
 
                        default:
@@ -600,17 +605,17 @@ map_write (char *mailbox, int md, int id, long last, off_t start,
                                for (dp = rp; i-- >0; dp++) {
                                        if (dp->d_start == start)
                                                dp->d_id = id;
-                                       lseek (fd, (off_t) (++d1.d_id * sizeof(*dp)), SEEK_SET);
-                                       if (write (fd, (char *) dp, sizeof(*dp)) != sizeof(*dp)) {
+                                       lseek(fd, (off_t) (++d1.d_id * sizeof(*dp)), SEEK_SET);
+                                       if (write(fd, (char *) dp, sizeof(*dp)) != sizeof(*dp)) {
                                                if (noisy)
-                                                       admonish (file, "write error");
-                                               mbx_close (file, fd);
-                                               fclose (fp);
+                                                       admonish(file, "write error");
+                                               mbx_close(file, fd);
+                                               fclose(fp);
                                                return NOTOK;
                                        }
                                }
-                               free ((char *) rp);
-                               fclose (fp);
+                               free((char *) rp);
+                               fclose(fp);
                                break;
                }
        }
@@ -619,14 +624,14 @@ map_write (char *mailbox, int md, int id, long last, off_t start,
                        last = d1.d_start;
                dp = &d2;
                dp->d_id = id;
-               dp->d_size = (long) (size ? size : mbx_size (fd, start, stop));
+               dp->d_size = (long) (size ? size : mbx_size(fd, start, stop));
                dp->d_start = start;
                dp->d_stop = stop;
-               lseek (fd, (off_t) (++d1.d_id * sizeof(*dp)), SEEK_SET);
-               if (write (fd, (char *) dp, sizeof(*dp)) != sizeof(*dp)) {
+               lseek(fd, (off_t) (++d1.d_id * sizeof(*dp)), SEEK_SET);
+               if (write(fd, (char *) dp, sizeof(*dp)) != sizeof(*dp)) {
                        if (noisy)
-                               admonish (file, "write error");
-                       mbx_close (file, fd);
+                               admonish(file, "write error");
+                       mbx_close(file, fd);
                        return NOTOK;
                }
        }
@@ -634,43 +639,44 @@ map_write (char *mailbox, int md, int id, long last, off_t start,
        dp = &d1;
        dp->d_size = DRVRSN;
        dp->d_start = (long) last;
-       dp->d_stop = lseek (md, (off_t) 0, SEEK_CUR);
+       dp->d_stop = lseek(md, (off_t) 0, SEEK_CUR);
 
-       lseek (fd, (off_t) 0, SEEK_SET);
-       if (write (fd, (char *) dp, sizeof(*dp)) != sizeof(*dp)) {
+       lseek(fd, (off_t) 0, SEEK_SET);
+       if (write(fd, (char *) dp, sizeof(*dp)) != sizeof(*dp)) {
                if (noisy)
-                       admonish (file, "write error");
-               mbx_close (file, fd);
+                       admonish(file, "write error");
+               mbx_close(file, fd);
                return NOTOK;
        }
 
-       mbx_close (file, fd);
+       mbx_close(file, fd);
 
        return OK;
 }
 
 
 static int
-map_open (char *file, int md)
+map_open(char *file, int md)
 {
        mode_t mode;
        struct stat st;
 
-       mode = fstat (md, &st) != NOTOK ? (mode_t) (st.st_mode & 0777) : m_gmprot ();
-       return mbx_open (file, OTHER_FORMAT, st.st_uid, st.st_gid, mode);
+       mode = fstat(md, &st) != NOTOK ?
+                       (mode_t) (st.st_mode & 0777) : m_gmprot();
+       return mbx_open(file, OTHER_FORMAT, st.st_uid, st.st_gid, mode);
 }
 
 
 int
-map_chk (char *file, int fd, struct drop *dp, long pos, int noisy)
+map_chk(char *file, int fd, struct drop *dp, long pos, int noisy)
 {
        long count;
        struct drop d, tmpd;
        register struct drop *dl;
 
-       if (read (fd, (char *) &tmpd, sizeof(*dp)) != sizeof(*dp)) {
+       if (read(fd, (char *) &tmpd, sizeof(*dp)) != sizeof(*dp)) {
 #ifdef notdef
-               admonish (NULL, "%s: missing or partial index", file);
+               admonish(NULL, "%s: missing or partial index", file);
 #endif /* notdef */
                return NOTOK;
        }
@@ -685,33 +691,31 @@ map_chk (char *file, int fd, struct drop *dp, long pos, int noisy)
 
        if (dp->d_size != DRVRSN) {
                if (noisy)
-                       admonish (NULL, "%s: version mismatch (%d != %d)",
-                               file, dp->d_size, DRVRSN);
+                       admonish(NULL, "%s: version mismatch (%d != %d)",
+                                       file, dp->d_size, DRVRSN);
                return NOTOK;
        }
 
        if (dp->d_stop != pos) {
                if (noisy && pos != (long) 0)
-                       admonish (NULL,
-                                       "%s: pointer mismatch or incomplete index (%ld!=%ld)",
-                                       file, dp->d_stop, (long) pos);
+                       admonish(NULL, "%s: pointer mismatch or incomplete index (%ld!=%ld)", file, dp->d_stop, (long) pos);
                return NOTOK;
        }
 
-       if ((long) ((dp->d_id + 1) * sizeof(*dp)) != (long) lseek (fd, (off_t) 0, SEEK_END)) {
+       if ((long) ((dp->d_id + 1) * sizeof(*dp)) != (long) lseek(fd, (off_t) 0, SEEK_END)) {
                if (noisy)
-                       admonish (NULL, "%s: corrupt index(1)", file);
+                       admonish(NULL, "%s: corrupt index(1)", file);
                return NOTOK;
        }
 
        dl = &d;
-       count = (long) strlen (mmdlm2);
-       lseek (fd, (off_t) (dp->d_id * sizeof(*dp)), SEEK_SET);
-       if (read (fd, (char *) dl, sizeof(*dl)) != sizeof(*dl)
+       count = (long) strlen(mmdlm2);
+       lseek(fd, (off_t) (dp->d_id * sizeof(*dp)), SEEK_SET);
+       if (read(fd, (char *) dl, sizeof(*dl)) != sizeof(*dl)
                        || (ntohl(dl->d_stop) != dp->d_stop
                                && ntohl(dl->d_stop) + count != dp->d_stop)) {
                if (noisy)
-                       admonish (NULL, "%s: corrupt index(2)", file);
+                       admonish(NULL, "%s: corrupt index(2)", file);
                return NOTOK;
        }
 
index 17916fb..0f44555 100644 (file)
@@ -137,16 +137,17 @@ main(int argc, char **argv)
        ** If program was invoked with name ending
        ** in `s', then add switch `-all'.
        */
-       if (argv[0][strlen (argv[0]) - 1] == 's')
+       if (argv[0][strlen(argv[0]) - 1] == 's')
                all = TRUE;
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /* allocate the initial space to record the folder names */
        numfolders = 0;
        maxfolders = MAXFOLDERS;
-       foldersToDo = (char **) mh_xmalloc ((size_t) (maxfolders * sizeof(*foldersToDo)));
+       foldersToDo = (char **) mh_xmalloc((size_t)
+                       (maxfolders * sizeof(*foldersToDo)));
 
        /* no sequences yet */
        numsequences = 0;
@@ -162,21 +163,21 @@ main(int argc, char **argv)
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf(buf, sizeof(buf), "%s [+folder1 [+folder2 ...]][switches]",
-                                               invo_name);
+                               snprintf(buf, sizeof(buf), "%s [+folder1 [+folder2 ...]][switches]", invo_name);
                                print_help(buf, switches, 1);
                                done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case SEQSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
 
                                /* check if too many sequences specified */
                                if (numsequences >= NUMATTRS)
-                                       adios (NULL, "too many sequences (more than %d) specified", NUMATTRS);
+                                       adios(NULL, "too many sequences (more than %d) specified", NUMATTRS);
                                sequencesToDo[numsequences++] = cp;
                                break;
 
@@ -225,25 +226,24 @@ main(int argc, char **argv)
                        */
                        if (numfolders >= maxfolders) {
                                maxfolders += MAXFOLDERS;
-                               foldersToDo = (char **) mh_xrealloc (foldersToDo,
-                                       (size_t) (maxfolders * sizeof(*foldersToDo)));
+                               foldersToDo = (char **) mh_xrealloc(foldersToDo, (size_t) (maxfolders * sizeof(*foldersToDo)));
                        }
                        if (*cp == '+' || *cp == '@') {
                                foldersToDo[numfolders++] =
-                                       pluspath (cp);
+                                       pluspath(cp);
                        } else
                                foldersToDo[numfolders++] = cp;
                }
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        /* get current folder */
-       strncpy (curfolder, getfolder(1), sizeof(curfolder));
+       strncpy(curfolder, getfolder(1), sizeof(curfolder));
 
        /* get nmh base directory */
-       nmhdir = m_maildir ("");
+       nmhdir = m_maildir("");
 
        /*
        ** If we didn't specify any sequences, we search
@@ -257,16 +257,15 @@ main(int argc, char **argv)
                        char **ap, *dp;
 
                        dp = getcpy(cp);
-                       ap = brkstring (dp, " ", "\n");
+                       ap = brkstring(dp, " ", "\n");
                        for (; ap && *ap; ap++) {
                                if (numsequences >= NUMATTRS)
-                                       adios (NULL, "too many sequences (more than %d) in %s profile entry",
-                                                  NUMATTRS, usequence);
+                                       adios(NULL, "too many sequences (more than %d) in %s profile entry", NUMATTRS, usequence);
                                else
                                        sequencesToDo[numsequences++] = *ap;
                        }
                } else {
-                       adios (NULL, "no sequence specified or %s profile entry found", usequence);
+                       adios(NULL, "no sequence specified or %s profile entry found", usequence);
                }
        }
 
@@ -274,7 +273,7 @@ main(int argc, char **argv)
        ScanFolders();
        qsort(folders, nFolders, sizeof(struct Folder), (qsort_comp) CompareFolders);
        PrintFolders();
-       done (0);
+       done(0);
        return 1;
 }
 
@@ -323,14 +322,15 @@ ScanFolders(void)
        /*
         * change directory to base of nmh directory
         */
-       if (chdir (nmhdir) == NOTOK)
-               adios (nmhdir, "unable to change directory to");
+       if (chdir(nmhdir) == NOTOK)
+               adios(nmhdir, "unable to change directory to");
 
        if (numfolders > 0) {
                /* Update context */
-               strncpy (curfolder, foldersToDo[numfolders - 1], sizeof(curfolder));
-               context_replace (pfolder, curfolder);/* update current folder */
-               context_save ();  /* save the context file */
+               strncpy(curfolder, foldersToDo[numfolders - 1],
+                               sizeof(curfolder));
+               context_replace(pfolder, curfolder);/* update current folder */
+               context_save();  /* save the context file */
 
                /*
                ** Scan each given folder.  If -all is given,
@@ -377,8 +377,8 @@ BuildFolderList(char *dirName, int searchdepth)
        ** If base directory, don't add it to the
        ** folder list. We just recurse into it.
        */
-       if (!strcmp (dirName, ".")) {
-               BuildFolderListRecurse (".", &st, 0);
+       if (!strcmp(dirName, ".")) {
+               BuildFolderListRecurse(".", &st, 0);
                return;
        }
 
@@ -387,7 +387,8 @@ BuildFolderList(char *dirName, int searchdepth)
        ** If recursing and directory has subfolders,
        ** then build folder list for subfolders.
        */
-       if (AddFolder(dirName, showzero) && (recurse || searchdepth) && st.st_nlink > 2)
+       if (AddFolder(dirName, showzero) && (recurse || searchdepth) &&
+                       st.st_nlink > 2)
                BuildFolderListRecurse(dirName, &st, searchdepth - 1);
 }
 
@@ -421,7 +422,7 @@ BuildFolderListRecurse(char *dirName, struct stat *s, int searchdepth)
        ** A hack so that we don't see a
        ** leading "./" in folder names.
        */
-       base = strcmp (dirName, ".") ? dirName : dirName + 1;
+       base = strcmp(dirName, ".") ? dirName : dirName + 1;
 
        while (nlinks && (dp = readdir(dir))) {
                if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) {
@@ -436,7 +437,7 @@ BuildFolderListRecurse(char *dirName, struct stat *s, int searchdepth)
                for (n = dp->d_name; *n && isdigit(*n); n++);
                if (!*n)
                        continue;
-               strncpy (name, base, sizeof(name) - 2);
+               strncpy(name, base, sizeof(name) - 2);
                if (*base)
                        strcat(name, "/");
                strncat(name, dp->d_name, sizeof(name) - strlen(name) - 1);
@@ -445,7 +446,7 @@ BuildFolderListRecurse(char *dirName, struct stat *s, int searchdepth)
                        ** Check if this was really a symbolic link pointing
                        ** to a directory.  If not, then decrement link count.
                        */
-                       if (lstat (name, &st) == -1)
+                       if (lstat(name, &st) == -1)
                                nlinks--;
                        /* Add this folder to the list */
                        if (AddFolder(name, showzero) &&
@@ -471,7 +472,7 @@ AddFolder(char *name, int force)
        struct msgs *mp;
 
        /* Read folder and create message structure */
-       if (!(mp = folder_read (name))) {
+       if (!(mp = folder_read(name))) {
                /* Oops, error occurred.  Record it and continue. */
                AllocFolders(&folders, &nFoldersAlloced, nFolders + 1);
                f = &folders[nFolders++];
@@ -491,7 +492,8 @@ AddFolder(char *name, int force)
                /* Now count messages in this sequence */
                nSeq[i] = 0;
                if (mp->nummsg > 0 && seqnum[i] != -1) {
-                       for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++) {
+                       for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg;
+                                       msgnum++) {
                                if (in_sequence(mp, seqnum[i], msgnum))
                                        nSeq[i]++;
                        }
@@ -519,11 +521,12 @@ AddFolder(char *name, int force)
                /* record the sequence information */
                for (i = 0; i < numsequences; i++) {
                        f->nSeq[i] = nSeq[i];
-                       f->private[i] = (seqnum[i] != -1) ? is_seq_private(mp, seqnum[i]) : 0;
+                       f->private[i] = (seqnum[i] != -1) ?
+                                       is_seq_private(mp, seqnum[i]) : 0;
                }
        }
 
-       folder_free (mp);  /* free folder/message structure */
+       folder_free(mp);  /* free folder/message structure */
        return 1;
 }
 
@@ -564,8 +567,9 @@ PrintFolders(void)
 
                for (j = 0; j < numsequences; j++) {
                        /* find maximum width of sequence name */
-                       len = strlen (sequencesToDo[j]);
-                       if ((folders[i].nSeq[j] > 0 || showzero) && (len > maxseqlen))
+                       len = strlen(sequencesToDo[j]);
+                       if ((folders[i].nSeq[j] > 0 || showzero) &&
+                                       (len > maxseqlen))
                                maxseqlen = len;
 
                        /* find the maximum number of messages in sequence */
@@ -584,21 +588,21 @@ PrintFolders(void)
                        if (folders[i].nSeq[j] > 0 || showzero) {
                                /* Add `+' to end of name of current folder */
                                if (strcmp(curfolder, folders[i].name))
-                                       snprintf(tmpname, sizeof(tmpname), "%s", folders[i].name);
+                                       snprintf(tmpname, sizeof(tmpname),
+                                                       "%s", folders[i].name);
                                else
-                                       snprintf(tmpname, sizeof(tmpname), "%s+", folders[i].name);
+                                       snprintf(tmpname, sizeof(tmpname),
+                                                       "%s+",
+                                                       folders[i].name);
 
                                if (folders[i].error) {
-                                       printf("%-*s is unreadable\n", maxfolderlen+1, tmpname);
+                                       printf("%-*s is unreadable\n",
+                                                       maxfolderlen+1,
+                                                       tmpname);
                                        continue;
                                }
 
-                               printf("%-*s has %*d in sequence %-*s%s; out of %*d\n",
-                                          maxfolderlen+1, tmpname,
-                                          num_digits(maxseq), folders[i].nSeq[j],
-                                          maxseqlen, sequencesToDo[j],
-                                          !has_private ? "" : folders[i].private[j] ? " (private)" : "          ",
-                                          num_digits(maxnum), folders[i].nMsgs);
+                               printf("%-*s has %*d in sequence %-*s%s; out of %*d\n", maxfolderlen+1, tmpname, num_digits(maxseq), folders[i].nSeq[j], maxseqlen, sequencesToDo[j], !has_private ? "" : folders[i].private[j] ? " (private)" : "          ", num_digits(maxnum), folders[i].nMsgs);
                        }
                }
        }
@@ -628,10 +632,12 @@ AllocFolders(struct Folder **f, int *nfa, int n)
                return;
        if (*f == NULL) {
                *nfa = 10;
-               *f = (struct Folder *) mh_xmalloc (*nfa * (sizeof(struct Folder)));
+               *f = (struct Folder *) mh_xmalloc(
+                               *nfa * (sizeof(struct Folder)));
        } else {
                *nfa *= 2;
-               *f = (struct Folder *) mh_xrealloc (*f, *nfa * (sizeof(struct Folder)));
+               *f = (struct Folder *) mh_xrealloc(
+                               *f, *nfa * (sizeof(struct Folder)));
        }
 }
 
@@ -657,10 +663,12 @@ AssignPriority(char *name)
                        continue;
                if (ol < bestLen)
                        continue;
-               if (o->name[0] == '*' && !strcmp(o->name + 1, name + (nl - ol + 1))) {
+               if (o->name[0] == '*' && !strcmp(o->name + 1,
+                               name + (nl - ol + 1))) {
                        best = o->priority;
                        bestLen = ol;
-               } else if (o->name[ol - 1] == '*' && strncmp(o->name, name, ol - 1) == 0) {
+               } else if (o->name[ol - 1] == '*' &&
+                               strncmp(o->name, name, ol - 1) == 0) {
                        best = o->priority;
                        bestLen = ol;
                }
@@ -673,17 +681,17 @@ AssignPriority(char *name)
 */
 
 static void
-do_readonly_folders (void)
+do_readonly_folders(void)
 {
        int atrlen;
        char atrcur[BUFSIZ];
        register struct node *np;
 
-       snprintf (atrcur, sizeof(atrcur), "atr-%s-", current);
-       atrlen = strlen (atrcur);
+       snprintf(atrcur, sizeof(atrcur), "atr-%s-", current);
+       atrlen = strlen(atrcur);
 
        for (np = m_defs; np; np = np->n_next)
-               if (ssequal (atrcur, np->n_name)
-                               && !ssequal (nmhdir, np->n_name + atrlen))
-                       BuildFolderList (np->n_name + atrlen, 0);
+               if (ssequal(atrcur, np->n_name)
+                               && !ssequal(nmhdir, np->n_name + atrlen))
+                       BuildFolderList(np->n_name + atrlen, 0);
 }
index 9b326a3..2096c64 100644 (file)
@@ -30,7 +30,7 @@ static int lused = 0;
 /*
 ** static prototypes
 */
-static void fmt_dump (struct format *);
+static void fmt_dump(struct format *);
 static void dumpone(struct format *);
 static int findlabel(struct format *);
 static void assignlabel(struct format *);
@@ -42,7 +42,7 @@ static void litputc(char);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int ncomps;
        char *cp, *form = NULL, *format = NULL;
@@ -52,46 +52,46 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [switches]", invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [switches]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case FORMSW:
                                        if (!(form = *argp++) || *form == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        format = NULL;
                                        continue;
                                case FMTSW:
                                        if (!(format = *argp++) || *format == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        form = NULL;
                                        continue;
 
                        }
                }
                if (form)
-                       adios (NULL, "only one form at a time!");
+                       adios(NULL, "only one form at a time!");
                else
                        form = cp;
        }
@@ -99,7 +99,7 @@ main (int argc, char **argv)
        /*
        ** Get new format string.  Must be before chdir().
        */
-       nfs = new_fs (form, format, FORMAT);
+       nfs = new_fs(form, format, FORMAT);
        ncomps = fmt_compile(nfs, &fmt);
 
        fmt_dump(fmt);
@@ -108,419 +108,419 @@ main (int argc, char **argv)
 }
 
 static void
-fmt_dump (struct format *fmth)
+fmt_dump(struct format *fmth)
 {
-               int i;
-               register struct format *fmt, *addr;
-
-               /* Assign labels */
-               for (fmt = fmth; fmt; ++fmt) {
-                               i = fmt->f_type;
-                               if (i == FT_IF_S ||
-                                       i == FT_IF_S_NULL ||
-                                       i == FT_IF_V_EQ ||
-                                       i == FT_IF_V_NE ||
-                                       i == FT_IF_V_GT ||
-                                       i == FT_IF_MATCH ||
-                                       i == FT_IF_AMATCH ||
-                                       i == FT_GOTO) {
-                                               addr = fmt + fmt->f_skip;
-                                               if (findlabel(addr) < 0)
-                                                               assignlabel(addr);
-                               }
-                               if (fmt->f_type == FT_DONE && fmt->f_value == 0)
-                                               break;
+       int i;
+       register struct format *fmt, *addr;
+
+       /* Assign labels */
+       for (fmt = fmth; fmt; ++fmt) {
+               i = fmt->f_type;
+               if (i == FT_IF_S || i == FT_IF_S_NULL || i == FT_IF_V_EQ ||
+                               i == FT_IF_V_NE || i == FT_IF_V_GT ||
+                               i == FT_IF_MATCH || i == FT_IF_AMATCH ||
+                               i == FT_GOTO) {
+                       addr = fmt + fmt->f_skip;
+                       if (findlabel(addr) < 0)
+                               assignlabel(addr);
                }
+               if (fmt->f_type == FT_DONE && fmt->f_value == 0)
+                       break;
+       }
 
-               /* Dump them out! */
-               for (fmt = fmth; fmt; ++fmt) {
-                               dumpone(fmt);
-                               if (fmt->f_type == FT_DONE && fmt->f_value == 0)
-                                               break;
-               }
+       /* Dump them out! */
+       for (fmt = fmth; fmt; ++fmt) {
+               dumpone(fmt);
+               if (fmt->f_type == FT_DONE && fmt->f_value == 0)
+                       break;
+       }
 }
 
 static void
 dumpone(struct format *fmt)
 {
-               register int i;
-
-               if ((i = findlabel(fmt)) >= 0)
-                               printf("L%d:", i);
-               putchar('\t');
-
-               fputs(f_typestr((int)fmt->f_type), stdout);
-
-               switch (fmt->f_type) {
-
-               case FT_COMP:
-               case FT_LS_COMP:
-               case FT_LV_COMPFLAG:
-               case FT_LV_COMP:
-                               printf(", comp ");
-                               litputs(fmt->f_comp->c_name);
-                               if (fmt->f_comp->c_type)
-                                               printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
-                               if (fmt->f_comp->c_flags)
-                                               printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags));
-                               break;
-
-               case FT_LV_SEC:
-               case FT_LV_MIN:
-               case FT_LV_HOUR:
-               case FT_LV_MDAY:
-               case FT_LV_MON:
-               case FT_LS_MONTH:
-               case FT_LS_LMONTH:
-               case FT_LS_ZONE:
-               case FT_LV_YEAR:
-               case FT_LV_WDAY:
-               case FT_LS_DAY:
-               case FT_LS_WEEKDAY:
-               case FT_LV_YDAY:
-               case FT_LV_ZONE:
-               case FT_LV_CLOCK:
-               case FT_LV_RCLOCK:
-               case FT_LV_DAYF:
-               case FT_LV_ZONEF:
-               case FT_LV_DST:
-               case FT_LS_822DATE:
-               case FT_LS_PRETTY:
-               case FT_LOCALDATE:
-               case FT_GMTDATE:
-               case FT_PARSEDATE:
-                               printf(", c_name ");
-                               litputs(fmt->f_comp->c_name);
-                               if (fmt->f_comp->c_type)
-                                               printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
-                               if (fmt->f_comp->c_flags)
-                                               printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags));
-                               break;
-
-               case FT_LS_ADDR:
-               case FT_LS_PERS:
-               case FT_LS_MBOX:
-               case FT_LS_HOST:
-               case FT_LS_PATH:
-               case FT_LS_GNAME:
-               case FT_LS_NOTE:
-               case FT_LS_822ADDR:
-               case FT_LV_HOSTTYPE:
-               case FT_LV_INGRPF:
-               case FT_LV_NOHOSTF:
-               case FT_LS_FRIENDLY:
-               case FT_PARSEADDR:
-               case FT_MYMBOX:
-                               printf(", c_name ");
-                               litputs(fmt->f_comp->c_name);
-                               if (fmt->f_comp->c_type)
-                                               printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
-                               if (fmt->f_comp->c_flags)
-                                               printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags));
-                               break;
-
-               case FT_COMPF:
-                               printf(", width %d, fill '", fmt->f_width);
-                               litputc(fmt->f_fill);
-                               printf("' name ");
-                               litputs(fmt->f_comp->c_name);
-                               if (fmt->f_comp->c_type)
-                                               printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
-                               if (fmt->f_comp->c_flags)
-                                               printf(", c_flags %s", c_flagsstr(fmt->f_comp->c_flags));
-                               break;
-
-               case FT_STRF:
-               case FT_NUMF:
-                               printf(", width %d, fill '", fmt->f_width);
-                               litputc(fmt->f_fill);
-                               putchar('\'');
-                               break;
-
-               case FT_LIT:
+       register int i;
+
+       if ((i = findlabel(fmt)) >= 0)
+               printf("L%d:", i);
+       putchar('\t');
+
+       fputs(f_typestr((int)fmt->f_type), stdout);
+
+       switch (fmt->f_type) {
+
+       case FT_COMP:
+       case FT_LS_COMP:
+       case FT_LV_COMPFLAG:
+       case FT_LV_COMP:
+               printf(", comp ");
+               litputs(fmt->f_comp->c_name);
+               if (fmt->f_comp->c_type)
+                       printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
+               if (fmt->f_comp->c_flags)
+                       printf(", c_flags %s",
+                                       c_flagsstr(fmt->f_comp->c_flags));
+               break;
+
+       case FT_LV_SEC:
+       case FT_LV_MIN:
+       case FT_LV_HOUR:
+       case FT_LV_MDAY:
+       case FT_LV_MON:
+       case FT_LS_MONTH:
+       case FT_LS_LMONTH:
+       case FT_LS_ZONE:
+       case FT_LV_YEAR:
+       case FT_LV_WDAY:
+       case FT_LS_DAY:
+       case FT_LS_WEEKDAY:
+       case FT_LV_YDAY:
+       case FT_LV_ZONE:
+       case FT_LV_CLOCK:
+       case FT_LV_RCLOCK:
+       case FT_LV_DAYF:
+       case FT_LV_ZONEF:
+       case FT_LV_DST:
+       case FT_LS_822DATE:
+       case FT_LS_PRETTY:
+       case FT_LOCALDATE:
+       case FT_GMTDATE:
+       case FT_PARSEDATE:
+               printf(", c_name ");
+               litputs(fmt->f_comp->c_name);
+               if (fmt->f_comp->c_type)
+                       printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
+               if (fmt->f_comp->c_flags)
+                       printf(", c_flags %s",
+                                       c_flagsstr(fmt->f_comp->c_flags));
+               break;
+
+       case FT_LS_ADDR:
+       case FT_LS_PERS:
+       case FT_LS_MBOX:
+       case FT_LS_HOST:
+       case FT_LS_PATH:
+       case FT_LS_GNAME:
+       case FT_LS_NOTE:
+       case FT_LS_822ADDR:
+       case FT_LV_HOSTTYPE:
+       case FT_LV_INGRPF:
+       case FT_LV_NOHOSTF:
+       case FT_LS_FRIENDLY:
+       case FT_PARSEADDR:
+       case FT_MYMBOX:
+               printf(", c_name ");
+               litputs(fmt->f_comp->c_name);
+               if (fmt->f_comp->c_type)
+                       printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
+               if (fmt->f_comp->c_flags)
+                       printf(", c_flags %s",
+                                       c_flagsstr(fmt->f_comp->c_flags));
+               break;
+
+       case FT_COMPF:
+               printf(", width %d, fill '", fmt->f_width);
+               litputc(fmt->f_fill);
+               printf("' name ");
+               litputs(fmt->f_comp->c_name);
+               if (fmt->f_comp->c_type)
+                       printf(", c_type %s", c_typestr(fmt->f_comp->c_type));
+               if (fmt->f_comp->c_flags)
+                       printf(", c_flags %s",
+                                       c_flagsstr(fmt->f_comp->c_flags));
+               break;
+
+       case FT_STRF:
+       case FT_NUMF:
+               printf(", width %d, fill '", fmt->f_width);
+               litputc(fmt->f_fill);
+               putchar('\'');
+               break;
+
+       case FT_LIT:
 #ifdef FT_LIT_FORCE
-               case FT_LIT_FORCE:
+       case FT_LIT_FORCE:
 #endif
-                               putchar(' ');
-                               litputs(fmt->f_text);
-                               break;
-
-               case FT_LITF:
-                               printf(", width %d, fill '", fmt->f_width);
-                               litputc(fmt->f_fill);
-                               printf("' ");
-                               litputs(fmt->f_text);
-                               break;
-
-               case FT_CHAR:
-                               putchar(' ');
-                               putchar('\'');
-                               litputc(fmt->f_char);
-                               putchar('\'');
-                               break;
-
-
-               case FT_IF_S:
-               case FT_IF_S_NULL:
-               case FT_IF_MATCH:
-               case FT_IF_AMATCH:
-                               printf(" continue else goto");
-               case FT_GOTO:
-                               i = findlabel(fmt + fmt->f_skip);
-                               printf(" L%d", i);
-                               break;
-
-               case FT_IF_V_EQ:
-               case FT_IF_V_NE:
-               case FT_IF_V_GT:
-                               i = findlabel(fmt + fmt->f_skip);
-                               printf(" %d continue else goto L%d", fmt->f_value, i);
-                               break;
-
-               case FT_V_EQ:
-               case FT_V_NE:
-               case FT_V_GT:
-               case FT_LV_LIT:
-               case FT_LV_PLUS_L:
-               case FT_LV_MINUS_L:
-               case FT_LV_DIVIDE_L:
-               case FT_LV_MODULO_L:
-                               printf(" value %d", fmt->f_value);
-                               break;
-
-               case FT_LS_LIT:
-                               printf(" str ");
-                               litputs(fmt->f_text);
-                               break;
-
-               case FT_LS_GETENV:
-                               printf(" getenv ");
-                               litputs(fmt->f_text);
-                               break;
-
-               case FT_LS_DECODECOMP:
-                               printf(", comp ");
-                               litputs(fmt->f_comp->c_name);
-                               break;
-
-               case FT_LS_DECODE:
-                               break;
-
-               case FT_LS_TRIM:
-                               printf(", width %d", fmt->f_width);
-                               break;
-
-               case FT_LV_DAT:
-                               printf(", value dat[%d]", fmt->f_value);
-                               break;
-               }
-               putchar('\n');
+               putchar(' ');
+               litputs(fmt->f_text);
+               break;
+
+       case FT_LITF:
+               printf(", width %d, fill '", fmt->f_width);
+               litputc(fmt->f_fill);
+               printf("' ");
+               litputs(fmt->f_text);
+               break;
+
+       case FT_CHAR:
+               putchar(' ');
+               putchar('\'');
+               litputc(fmt->f_char);
+               putchar('\'');
+               break;
+
+
+       case FT_IF_S:
+       case FT_IF_S_NULL:
+       case FT_IF_MATCH:
+       case FT_IF_AMATCH:
+               printf(" continue else goto");
+       case FT_GOTO:
+               i = findlabel(fmt + fmt->f_skip);
+               printf(" L%d", i);
+               break;
+
+       case FT_IF_V_EQ:
+       case FT_IF_V_NE:
+       case FT_IF_V_GT:
+               i = findlabel(fmt + fmt->f_skip);
+               printf(" %d continue else goto L%d", fmt->f_value, i);
+               break;
+
+       case FT_V_EQ:
+       case FT_V_NE:
+       case FT_V_GT:
+       case FT_LV_LIT:
+       case FT_LV_PLUS_L:
+       case FT_LV_MINUS_L:
+       case FT_LV_DIVIDE_L:
+       case FT_LV_MODULO_L:
+               printf(" value %d", fmt->f_value);
+               break;
+
+       case FT_LS_LIT:
+               printf(" str ");
+               litputs(fmt->f_text);
+               break;
+
+       case FT_LS_GETENV:
+               printf(" getenv ");
+               litputs(fmt->f_text);
+               break;
+
+       case FT_LS_DECODECOMP:
+               printf(", comp ");
+               litputs(fmt->f_comp->c_name);
+               break;
+
+       case FT_LS_DECODE:
+               break;
+
+       case FT_LS_TRIM:
+               printf(", width %d", fmt->f_width);
+               break;
+
+       case FT_LV_DAT:
+               printf(", value dat[%d]", fmt->f_value);
+               break;
+       }
+       putchar('\n');
 }
 
 static int
 findlabel(struct format *addr)
 {
-               register int i;
+       register int i;
 
-               for (i = 0; i < lused; ++i)
-                               if (addr == lvec[i])
-                                               return(i);
-               return(-1);
+       for (i = 0; i < lused; ++i)
+               if (addr == lvec[i])
+                       return(i);
+       return(-1);
 }
 
 static void
 assignlabel(struct format *addr)
 {
-               lvec[lused++] = addr;
+       lvec[lused++] = addr;
 }
 
 static char *
 f_typestr(int t)
 {
-               static char buf[32];
+       static char buf[32];
 
-               switch (t) {
-               case FT_COMP: return("COMP");
-               case FT_COMPF: return("COMPF");
-               case FT_LIT: return("LIT");
-               case FT_LITF: return("LITF");
+       switch (t) {
+       case FT_COMP: return("COMP");
+       case FT_COMPF: return("COMPF");
+       case FT_LIT: return("LIT");
+       case FT_LITF: return("LITF");
 #ifdef FT_LIT_FORCE
-               case FT_LIT_FORCE: return("LIT_FORCE");
+       case FT_LIT_FORCE: return("LIT_FORCE");
 #endif
-               case FT_CHAR: return("CHAR");
-               case FT_NUM: return("NUM");
-               case FT_NUMF: return("NUMF");
-               case FT_STR: return("STR");
-               case FT_STRF: return("STRF");
-               case FT_STRFW: return("STRFW");
-               case FT_PUTADDR: return("PUTADDR");
-               case FT_LS_COMP: return("LS_COMP");
-               case FT_LS_LIT: return("LS_LIT");
-               case FT_LS_GETENV: return("LS_GETENV");
-               case FT_LS_DECODECOMP: return("FT_LS_DECODECOMP");
-               case FT_LS_DECODE: return("FT_LS_DECODE");
-               case FT_LS_TRIM: return("LS_TRIM");
-               case FT_LV_COMP: return("LV_COMP");
-               case FT_LV_COMPFLAG: return("LV_COMPFLAG");
-               case FT_LV_LIT: return("LV_LIT");
-               case FT_LV_DAT: return("LV_DAT");
-               case FT_LV_STRLEN: return("LV_STRLEN");
-               case FT_LV_PLUS_L: return("LV_PLUS_L");
-               case FT_LV_MINUS_L: return("LV_MINUS_L");
-               case FT_LV_DIVIDE_L: return("LV_DIVIDE_L");
-               case FT_LV_MODULO_L: return("LV_MODULO_L");
-               case FT_LV_CHAR_LEFT: return("LV_CHAR_LEFT");
-               case FT_LS_MONTH: return("LS_MONTH");
-               case FT_LS_LMONTH: return("LS_LMONTH");
-               case FT_LS_ZONE: return("LS_ZONE");
-               case FT_LS_DAY: return("LS_DAY");
-               case FT_LS_WEEKDAY: return("LS_WEEKDAY");
-               case FT_LS_822DATE: return("LS_822DATE");
-               case FT_LS_PRETTY: return("LS_PRETTY");
-               case FT_LV_SEC: return("LV_SEC");
-               case FT_LV_MIN: return("LV_MIN");
-               case FT_LV_HOUR: return("LV_HOUR");
-               case FT_LV_MDAY: return("LV_MDAY");
-               case FT_LV_MON: return("LV_MON");
-               case FT_LV_YEAR: return("LV_YEAR");
-               case FT_LV_YDAY: return("LV_YDAY");
-               case FT_LV_WDAY: return("LV_WDAY");
-               case FT_LV_ZONE: return("LV_ZONE");
-               case FT_LV_CLOCK: return("LV_CLOCK");
-               case FT_LV_RCLOCK: return("LV_RCLOCK");
-               case FT_LV_DAYF: return("LV_DAYF");
-               case FT_LV_DST: return("LV_DST");
-               case FT_LV_ZONEF: return("LV_ZONEF");
-               case FT_LS_ADDR: return("LS_ADDR");
-               case FT_LS_PERS: return("LS_PERS");
-               case FT_LS_MBOX: return("LS_MBOX");
-               case FT_LS_HOST: return("LS_HOST");
-               case FT_LS_PATH: return("LS_PATH");
-               case FT_LS_GNAME: return("LS_GNAME");
-               case FT_LS_NOTE: return("LS_NOTE");
-               case FT_LS_822ADDR: return("LS_822ADDR");
-               case FT_LS_FRIENDLY: return("LS_FRIENDLY");
-               case FT_LV_HOSTTYPE: return("LV_HOSTTYPE");
-               case FT_LV_INGRPF: return("LV_INGRPF");
-               case FT_LV_NOHOSTF: return("LV_NOHOSTF");
-               case FT_LOCALDATE: return("LOCALDATE");
-               case FT_GMTDATE: return("GMTDATE");
-               case FT_PARSEDATE: return("PARSEDATE");
-               case FT_PARSEADDR: return("PARSEADDR");
-               case FT_FORMATADDR: return("FORMATADDR");
-               case FT_MYMBOX: return("MYMBOX");
+       case FT_CHAR: return("CHAR");
+       case FT_NUM: return("NUM");
+       case FT_NUMF: return("NUMF");
+       case FT_STR: return("STR");
+       case FT_STRF: return("STRF");
+       case FT_STRFW: return("STRFW");
+       case FT_PUTADDR: return("PUTADDR");
+       case FT_LS_COMP: return("LS_COMP");
+       case FT_LS_LIT: return("LS_LIT");
+       case FT_LS_GETENV: return("LS_GETENV");
+       case FT_LS_DECODECOMP: return("FT_LS_DECODECOMP");
+       case FT_LS_DECODE: return("FT_LS_DECODE");
+       case FT_LS_TRIM: return("LS_TRIM");
+       case FT_LV_COMP: return("LV_COMP");
+       case FT_LV_COMPFLAG: return("LV_COMPFLAG");
+       case FT_LV_LIT: return("LV_LIT");
+       case FT_LV_DAT: return("LV_DAT");
+       case FT_LV_STRLEN: return("LV_STRLEN");
+       case FT_LV_PLUS_L: return("LV_PLUS_L");
+       case FT_LV_MINUS_L: return("LV_MINUS_L");
+       case FT_LV_DIVIDE_L: return("LV_DIVIDE_L");
+       case FT_LV_MODULO_L: return("LV_MODULO_L");
+       case FT_LV_CHAR_LEFT: return("LV_CHAR_LEFT");
+       case FT_LS_MONTH: return("LS_MONTH");
+       case FT_LS_LMONTH: return("LS_LMONTH");
+       case FT_LS_ZONE: return("LS_ZONE");
+       case FT_LS_DAY: return("LS_DAY");
+       case FT_LS_WEEKDAY: return("LS_WEEKDAY");
+       case FT_LS_822DATE: return("LS_822DATE");
+       case FT_LS_PRETTY: return("LS_PRETTY");
+       case FT_LV_SEC: return("LV_SEC");
+       case FT_LV_MIN: return("LV_MIN");
+       case FT_LV_HOUR: return("LV_HOUR");
+       case FT_LV_MDAY: return("LV_MDAY");
+       case FT_LV_MON: return("LV_MON");
+       case FT_LV_YEAR: return("LV_YEAR");
+       case FT_LV_YDAY: return("LV_YDAY");
+       case FT_LV_WDAY: return("LV_WDAY");
+       case FT_LV_ZONE: return("LV_ZONE");
+       case FT_LV_CLOCK: return("LV_CLOCK");
+       case FT_LV_RCLOCK: return("LV_RCLOCK");
+       case FT_LV_DAYF: return("LV_DAYF");
+       case FT_LV_DST: return("LV_DST");
+       case FT_LV_ZONEF: return("LV_ZONEF");
+       case FT_LS_ADDR: return("LS_ADDR");
+       case FT_LS_PERS: return("LS_PERS");
+       case FT_LS_MBOX: return("LS_MBOX");
+       case FT_LS_HOST: return("LS_HOST");
+       case FT_LS_PATH: return("LS_PATH");
+       case FT_LS_GNAME: return("LS_GNAME");
+       case FT_LS_NOTE: return("LS_NOTE");
+       case FT_LS_822ADDR: return("LS_822ADDR");
+       case FT_LS_FRIENDLY: return("LS_FRIENDLY");
+       case FT_LV_HOSTTYPE: return("LV_HOSTTYPE");
+       case FT_LV_INGRPF: return("LV_INGRPF");
+       case FT_LV_NOHOSTF: return("LV_NOHOSTF");
+       case FT_LOCALDATE: return("LOCALDATE");
+       case FT_GMTDATE: return("GMTDATE");
+       case FT_PARSEDATE: return("PARSEDATE");
+       case FT_PARSEADDR: return("PARSEADDR");
+       case FT_FORMATADDR: return("FORMATADDR");
+       case FT_MYMBOX: return("MYMBOX");
 #ifdef FT_ADDTOSEQ
-               case FT_ADDTOSEQ: return("ADDTOSEQ");
+       case FT_ADDTOSEQ: return("ADDTOSEQ");
 #endif
-               case FT_SAVESTR: return("SAVESTR");
+       case FT_SAVESTR: return("SAVESTR");
 #ifdef FT_PAUSE
-               case FT_PAUSE: return ("PAUSE");
+       case FT_PAUSE: return ("PAUSE");
 #endif
-               case FT_DONE: return("DONE");
-               case FT_NOP: return("NOP");
-               case FT_GOTO: return("GOTO");
-               case FT_IF_S_NULL: return("IF_S_NULL");
-               case FT_IF_S: return("IF_S");
-               case FT_IF_V_EQ: return("IF_V_EQ");
-               case FT_IF_V_NE: return("IF_V_NE");
-               case FT_IF_V_GT: return("IF_V_GT");
-               case FT_IF_MATCH: return("IF_MATCH");
-               case FT_IF_AMATCH: return("IF_AMATCH");
-               case FT_S_NULL: return("S_NULL");
-               case FT_S_NONNULL: return("S_NONNULL");
-               case FT_V_EQ: return("V_EQ");
-               case FT_V_NE: return("V_NE");
-               case FT_V_GT: return("V_GT");
-               case FT_V_MATCH: return("V_MATCH");
-               case FT_V_AMATCH: return("V_AMATCH");
-               default:
-                               printf(buf, "/* ??? #%d */", t);
-                               return(buf);
-               }
+       case FT_DONE: return("DONE");
+       case FT_NOP: return("NOP");
+       case FT_GOTO: return("GOTO");
+       case FT_IF_S_NULL: return("IF_S_NULL");
+       case FT_IF_S: return("IF_S");
+       case FT_IF_V_EQ: return("IF_V_EQ");
+       case FT_IF_V_NE: return("IF_V_NE");
+       case FT_IF_V_GT: return("IF_V_GT");
+       case FT_IF_MATCH: return("IF_MATCH");
+       case FT_IF_AMATCH: return("IF_AMATCH");
+       case FT_S_NULL: return("S_NULL");
+       case FT_S_NONNULL: return("S_NONNULL");
+       case FT_V_EQ: return("V_EQ");
+       case FT_V_NE: return("V_NE");
+       case FT_V_GT: return("V_GT");
+       case FT_V_MATCH: return("V_MATCH");
+       case FT_V_AMATCH: return("V_AMATCH");
+       default:
+               printf(buf, "/* ??? #%d */", t);
+               return(buf);
+       }
 }
 
 #define FNORD(v, s) if (t & (v)) { \
                if (i++ > 0) \
-                               strcat(buf, "|"); \
+                       strcat(buf, "|"); \
                strcat(buf, s); }
 
 static char *
 c_typestr(int t)
 {
-               register int i;
-               static char buf[64];
-
-               buf[0] = '\0';
-               if (t & ~(CT_ADDR|CT_DATE))
-                               printf(buf, "0x%x ", t);
-               strcat(buf, "<");
-               i = 0;
-               FNORD(CT_ADDR, "ADDR");
-               FNORD(CT_DATE, "DATE");
-               strcat(buf, ">");
-               return(buf);
+       register int i;
+       static char buf[64];
+
+       buf[0] = '\0';
+       if (t & ~(CT_ADDR|CT_DATE))
+               printf(buf, "0x%x ", t);
+       strcat(buf, "<");
+       i = 0;
+       FNORD(CT_ADDR, "ADDR");
+       FNORD(CT_DATE, "DATE");
+       strcat(buf, ">");
+       return(buf);
 }
 
 static char *
 c_flagsstr(int t)
 {
-               register int i;
-               static char buf[64];
-
-               buf[0] = '\0';
-               if (t & ~(CF_TRUE|CF_PARSED|CF_DATEFAB))
-                               printf(buf, "0x%x ", t);
-               strcat(buf, "<");
-               i = 0;
-               FNORD(CF_TRUE, "TRUE");
-               FNORD(CF_PARSED, "PARSED");
-               FNORD(CF_DATEFAB, "DATEFAB");
-               strcat(buf, ">");
-               return(buf);
+       register int i;
+       static char buf[64];
+
+       buf[0] = '\0';
+       if (t & ~(CF_TRUE|CF_PARSED|CF_DATEFAB))
+               printf(buf, "0x%x ", t);
+       strcat(buf, "<");
+       i = 0;
+       FNORD(CF_TRUE, "TRUE");
+       FNORD(CF_PARSED, "PARSED");
+       FNORD(CF_DATEFAB, "DATEFAB");
+       strcat(buf, ">");
+       return(buf);
 }
 #undef FNORD
 
 static void
 litputs(char *s)
 {
-               if (s) {
-                               putc('"', stdout);
-                               while (*s)
-                                               litputc(*s++);
-                               putc('"', stdout);
-               } else
-                               fputs("<nil>", stdout);
+       if (s) {
+               putc('"', stdout);
+               while (*s)
+                       litputc(*s++);
+               putc('"', stdout);
+       } else
+               fputs("<nil>", stdout);
 }
 
 static void
 litputc(char c)
 {
-               if (c & ~ 0177) {
-                               putc('M', stdout);
-                               putc('-', stdout);
-                               c &= 0177;
+       if (c & ~ 0177) {
+               putc('M', stdout);
+               putc('-', stdout);
+               c &= 0177;
+       }
+       if (c < 0x20 || c == 0177) {
+               if (c == '\b') {
+                       putc('\\', stdout);
+                       putc('b', stdout);
+               } else if (c == '\f') {
+                       putc('\\', stdout);
+                       putc('f', stdout);
+               } else if (c == '\n') {
+                       putc('\\', stdout);
+                       putc('n', stdout);
+               } else if (c == '\r') {
+                       putc('\\', stdout);
+                       putc('r', stdout);
+               } else if (c == '\t') {
+                       putc('\\', stdout);
+                       putc('t', stdout);
+               } else {
+                       putc('^', stdout);
+                       putc(c ^ 0x40, stdout);
+                       /* DEL to ?, others to alpha */
                }
-               if (c < 0x20 || c == 0177) {
-                               if (c == '\b') {
-                                               putc('\\', stdout);
-                                               putc('b', stdout);
-                               } else if (c == '\f') {
-                                               putc('\\', stdout);
-                                               putc('f', stdout);
-                               } else if (c == '\n') {
-                                               putc('\\', stdout);
-                                               putc('n', stdout);
-                               } else if (c == '\r') {
-                                               putc('\\', stdout);
-                                               putc('r', stdout);
-                               } else if (c == '\t') {
-                                               putc('\\', stdout);
-                                               putc('t', stdout);
-                               } else {
-                                               putc('^', stdout);
-                                               putc(c ^ 0x40, stdout);
-                                               /* DEL to ?, others to alpha */
-                               }
-               } else
-                               putc(c, stdout);
+       } else
+               putc(c, stdout);
 }
index a5326c1..06788b2 100644 (file)
@@ -104,15 +104,15 @@ static int maxFolderInfo;
 /*
 ** static prototypes
 */
-static int get_folder_info (char *, char *);
+static int get_folder_info(char *, char *);
 static crawl_callback_t get_folder_info_callback;
-static void print_folders (void);
-static int sfold (struct msgs *, char *);
-static void readonly_folders (void);
+static void print_folders(void);
+static int sfold(struct msgs *, char *);
+static void readonly_folders(void);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int printsw = 0, listsw = 0;
        int pushsw = 0, popsw = 0;
@@ -122,7 +122,7 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
@@ -131,29 +131,28 @@ main (int argc, char **argv)
        ** If program was invoked with name ending
        ** in `s', then add switch `-all'.
        */
-       if (argv[0][strlen (argv[0]) - 1] == 's')
+       if (argv[0][strlen(argv[0]) - 1] == 's')
                all = 1;
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [+folder] [msg] [switches]",
-                                               invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [+folder] [msg] [switches]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case ALLSW:
                                        all = 1;
@@ -240,20 +239,20 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (argfolder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               argfolder = pluspath (cp);
+                               argfolder = pluspath(cp);
                } else {
                        if (msg)
-                               adios (NULL, "only one (current) message at a time!");
+                               adios(NULL, "only one (current) message at a time!");
                        else
                                msg = cp;
                }
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
-       nmhdir = concat (m_maildir (""), "/", NULL);
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
+       nmhdir = concat(m_maildir(""), "/", NULL);
 
        /*
        ** If we aren't working with the folder stack
@@ -267,77 +266,76 @@ main (int argc, char **argv)
                if (!argfolder) {
                        /* If no folder is given, the current folder and */
                        /* the top of the folder stack are swapped. */
-                       if ((cp = context_find (stack))) {
-                               dp = getcpy (cp);
-                               ap = brkstring (dp, " ", "\n");
+                       if ((cp = context_find(stack))) {
+                               dp = getcpy(cp);
+                               ap = brkstring(dp, " ", "\n");
                                argfolder = getcpy(*ap++);
                        } else {
-                               adios (NULL, "no other folder");
+                               adios(NULL, "no other folder");
                        }
-                       for (cp = getcpy (getfolder (1)); *ap; ap++)
-                               cp = add (*ap, add (" ", cp));
-                       free (dp);
-                       context_replace (stack, cp);  /* update folder stack */
+                       for (cp = getcpy(getfolder(1)); *ap; ap++)
+                               cp = add(*ap, add(" ", cp));
+                       free(dp);
+                       context_replace(stack, cp);  /* update folder stack */
                } else {
                        /* update folder stack */
-                       context_replace (stack,
-                                       (cp = context_find (stack))
-                                       ? concat (getfolder (1), " ", cp, NULL)
-                                       : getcpy (getfolder (1)));
+                       context_replace(stack, (cp = context_find (stack)) ?
+                                       concat(getfolder(1), " ", cp, NULL) :
+                                       getcpy(getfolder(1)));
                }
        }
 
        /* Popping a folder off of the folder stack */
        if (popsw) {
                if (argfolder)
-                       adios (NULL, "sorry, no folders allowed with -pop");
-               if ((cp = context_find (stack))) {
-                       dp = getcpy (cp);
-                       ap = brkstring (dp, " ", "\n");
+                       adios(NULL, "sorry, no folders allowed with -pop");
+               if ((cp = context_find(stack))) {
+                       dp = getcpy(cp);
+                       ap = brkstring(dp, " ", "\n");
                        argfolder = getcpy(*ap++);
                } else {
-                       adios (NULL, "folder stack empty");
+                       adios(NULL, "folder stack empty");
                }
                if (*ap) {
                        /* if there's anything left in the stack */
-                       cp = getcpy (*ap++);
+                       cp = getcpy(*ap++);
                        for (; *ap; ap++)
-                               cp = add (*ap, add (" ", cp));
-                       context_replace (stack, cp);  /* update folder stack */
+                               cp = add(*ap, add(" ", cp));
+                       context_replace(stack, cp);  /* update folder stack */
                } else {
                        /* delete folder stack entry from context */
-                       context_del (stack);
+                       context_del(stack);
                }
-               free (dp);
+               free(dp);
        }
        if (pushsw || popsw) {
                cp = m_maildir(argfolder);
-               if (access (cp, F_OK) == NOTOK)
-                       adios (cp, "unable to find folder");
+               if (access(cp, F_OK) == NOTOK)
+                       adios(cp, "unable to find folder");
                /* update current folder   */
-               context_replace (pfolder, argfolder);
-               context_save ();  /* save the context file   */
+               context_replace(pfolder, argfolder);
+               context_save();  /* save the context file   */
                argfolder = NULL;
        }
 
        /* Listing the folder stack */
        if (listsw) {
-               printf ("%s", argfolder ? argfolder : getfolder (1));
-               if ((cp = context_find (stack))) {
-                       dp = getcpy (cp);
-                       for (ap = brkstring (dp, " ", "\n"); *ap; ap++)
-                               printf (" %s", *ap);
-                       free (dp);
+               printf("%s", argfolder ? argfolder : getfolder(1));
+               if ((cp = context_find(stack))) {
+                       dp = getcpy(cp);
+                       for (ap = brkstring(dp, " ", "\n"); *ap; ap++)
+                               printf(" %s", *ap);
+                       free(dp);
                }
-               printf ("\n");
+               printf("\n");
 
                if (!printsw)
-                       done (0);
+                       done(0);
        }
 
        /* Allocate initial space to record folder information */
        maxFolderInfo = CRAWL_NUMFOLDERS;
-       fi = mh_xmalloc (maxFolderInfo * sizeof(*fi));
+       fi = mh_xmalloc(maxFolderInfo * sizeof(*fi));
 
        /*
        ** Scan the folders
@@ -350,40 +348,43 @@ main (int argc, char **argv)
                ** change directory to base of nmh directory for
                ** crawl_folders
                */
-               if (chdir (nmhdir) == NOTOK)
-                       adios (nmhdir, "unable to change directory to");
+               if (chdir(nmhdir) == NOTOK)
+                       adios(nmhdir, "unable to change directory to");
                if (!argfolder) {
                        if (msg)
-                               admonish (NULL, "no folder given for message %s", msg);
-                       readonly_folders (); /* do any readonly folders */
-                       strncpy (folder, (cp = context_find (pfolder)) ? cp : "", sizeof(folder));
-                       crawl_folders (".", get_folder_info_callback, NULL);
+                               admonish(NULL, "no folder given for message %s", msg);
+                       readonly_folders(); /* do any readonly folders */
+                       strncpy(folder, (cp = context_find(pfolder)) ?
+                                       cp : "", sizeof(folder));
+                       crawl_folders(".", get_folder_info_callback, NULL);
                } else {
-                       strncpy (folder, argfolder, sizeof(folder));
-                       if (get_folder_info (argfolder, msg)) {
+                       strncpy(folder, argfolder, sizeof(folder));
+                       if (get_folder_info(argfolder, msg)) {
                                /* update current folder */
-                               context_replace (pfolder, argfolder);
-                               context_save ();
+                               context_replace(pfolder, argfolder);
+                               context_save();
                        }
                        /*
                        ** Since recurse wasn't done in get_folder_info(),
                        ** we still need to list all level-1 sub-folders.
                        */
                        if (!frecurse)
-                               crawl_folders (folder, get_folder_info_callback, NULL);
+                               crawl_folders(folder, get_folder_info_callback,
+                                               NULL);
                }
        } else {
-               strncpy (folder, argfolder ? argfolder : getfolder (1), sizeof(folder));
+               strncpy(folder, argfolder ? argfolder : getfolder (1),
+                               sizeof(folder));
 
                /*
                ** Check if folder exists.  If not, then see if
                ** we should create it, or just exit.
                */
-               create_folder (m_maildir (folder), fcreat, done);
+               create_folder(m_maildir(folder), fcreat, done);
 
-               if (get_folder_info (folder, msg) && argfolder) {
+               if (get_folder_info(folder, msg) && argfolder) {
                        /* update current folder */
-                       context_replace (pfolder, argfolder);
+                       context_replace(pfolder, argfolder);
                        }
        }
 
@@ -392,13 +393,13 @@ main (int argc, char **argv)
        */
        print_folders();
 
-       context_save ();
-       done (0);
+       context_save();
+       done(0);
        return 1;
 }
 
 static int
-get_folder_info_body (char *fold, char *msg, boolean *crawl_children)
+get_folder_info_body(char *fold, char *msg, boolean *crawl_children)
 {
        int i, retval = 1;
        struct msgs *mp = NULL;
@@ -411,7 +412,7 @@ get_folder_info_body (char *fold, char *msg, boolean *crawl_children)
        */
        if (total_folders >= maxFolderInfo) {
                maxFolderInfo += CRAWL_NUMFOLDERS;
-               fi = mh_xrealloc (fi, maxFolderInfo * sizeof(*fi));
+               fi = mh_xrealloc(fi, maxFolderInfo * sizeof(*fi));
        }
 
        fi[i].name   = fold;
@@ -426,20 +427,20 @@ get_folder_info_body (char *fold, char *msg, boolean *crawl_children)
                /*
                ** create message structure and get folder info
                */
-               if (!(mp = folder_read (fold))) {
-                       admonish (NULL, "unable to read folder %s", fold);
+               if (!(mp = folder_read(fold))) {
+                       admonish(NULL, "unable to read folder %s", fold);
                        return 0;
                }
 
                /* set the current message */
-               if (msg && !sfold (mp, msg))
+               if (msg && !sfold(mp, msg))
                        retval = 0;
 
                if (fpack) {
-                       if (folder_pack (&mp, fverb) == -1)
-                               done (1);
-                       seq_save (mp);  /* synchronize the sequences */
-                       context_save ();  /* save the context file */
+                       if (folder_pack(&mp, fverb) == -1)
+                               done(1);
+                       seq_save(mp);  /* synchronize the sequences */
+                       context_save();  /* save the context file */
                }
 
                /* record info for this folder */
@@ -448,10 +449,10 @@ get_folder_info_body (char *fold, char *msg, boolean *crawl_children)
                        fi[i].curmsg = mp->curmsg;
                        fi[i].lowmsg = mp->lowmsg;
                        fi[i].hghmsg = mp->hghmsg;
-                       fi[i].others = other_files (mp);
+                       fi[i].others = other_files(mp);
                }
 
-               folder_free (mp); /* free folder/message structure */
+               folder_free(mp); /* free folder/message structure */
        }
 
        *crawl_children = (frecurse && (fshort || fi[i].others)
@@ -460,24 +461,24 @@ get_folder_info_body (char *fold, char *msg, boolean *crawl_children)
 }
 
 static boolean
-get_folder_info_callback (char *fold, void *baton)
+get_folder_info_callback(char *fold, void *baton)
 {
        boolean crawl_children;
-       get_folder_info_body (fold, NULL, &crawl_children);
-       fflush (stdout);
+       get_folder_info_body(fold, NULL, &crawl_children);
+       fflush(stdout);
        return crawl_children;
 }
 
 static int
-get_folder_info (char *fold, char *msg)
+get_folder_info(char *fold, char *msg)
 {
        boolean crawl_children;
        int retval;
 
-       retval = get_folder_info_body (fold, msg, &crawl_children);
+       retval = get_folder_info_body(fold, msg, &crawl_children);
 
        if (crawl_children) {
-               crawl_folders (fold, get_folder_info_callback, NULL);
+               crawl_folders(fold, get_folder_info_callback, NULL);
        }
 return retval;
 }
@@ -487,7 +488,7 @@ return retval;
 */
 
 static void
-print_folders (void)
+print_folders(void)
 {
        int i, len, hasempty = 0, curprinted;
        int maxlen = 0, maxnummsg = 0, maxlowmsg = 0;
@@ -502,7 +503,7 @@ print_folders (void)
        */
        for (i = 0; i < total_folders; i++) {
                /* length of folder name */
-               len = strlen (fi[i].name);
+               len = strlen(fi[i].name);
                if (len > maxlen)
                        maxlen = len;
 
@@ -535,10 +536,10 @@ print_folders (void)
                if (fi[i].nummsg == 0)
                        hasempty = 1;
        }
-       nummsgdigits = num_digits (maxnummsg);
-       lowmsgdigits = num_digits (maxlowmsg);
-       hghmsgdigits = num_digits (maxhghmsg);
-       curmsgdigits = num_digits (maxcurmsg);
+       nummsgdigits = num_digits(maxnummsg);
+       lowmsgdigits = num_digits(maxlowmsg);
+       hghmsgdigits = num_digits(maxhghmsg);
+       curmsgdigits = num_digits(maxcurmsg);
 
        if (hasempty && nummsgdigits < 2)
                nummsgdigits = 2;
@@ -547,7 +548,7 @@ print_folders (void)
        ** Print the header
        */
        if (fheader > 0 || (all && !fshort && fheader >= 0))
-               printf ("%-*s %*s %-*s; %-*s %*s\n",
+               printf("%-*s %*s %-*s; %-*s %*s\n",
                                maxlen+1, "FOLDER",
                                nummsgdigits + 13, "# MESSAGES",
                                lowmsgdigits + hghmsgdigits + 4, " RANGE",
@@ -560,43 +561,47 @@ print_folders (void)
        if (all || fshort || ftotal < 1) {
                for (i = 0; i < total_folders; i++) {
                        if (fshort) {
-                               printf ("%s\n", fi[i].name);
+                               printf("%s\n", fi[i].name);
                                continue;
                        }
 
                        /* Add `+' to end of name, if folder is current */
-                       if (strcmp (folder, fi[i].name))
-                               snprintf (tmpname, sizeof(tmpname), "%s", fi[i].name);
+                       if (strcmp(folder, fi[i].name))
+                               snprintf(tmpname, sizeof(tmpname), "%s",
+                                               fi[i].name);
                        else
-                               snprintf (tmpname, sizeof(tmpname), "%s+", fi[i].name);
+                               snprintf(tmpname, sizeof(tmpname), "%s+",
+                                               fi[i].name);
 
                        if (fi[i].error) {
-                               printf ("%-*s is unreadable\n", maxlen+1, tmpname);
+                               printf("%-*s is unreadable\n", maxlen+1,
+                                               tmpname);
                                continue;
                        }
 
-                       printf ("%-*s ", maxlen+1, tmpname);
+                       printf("%-*s ", maxlen+1, tmpname);
 
                        curprinted = 0; /* remember if we print cur */
                        if (fi[i].nummsg == 0) {
-                               printf ("has %*s messages%*s",
-                                               nummsgdigits, "no",
-                                               fi[i].others ? lowmsgdigits + hghmsgdigits + 5 : 0, "");
+                               printf("has %*s messages%*s", nummsgdigits, "no", fi[i].others ? lowmsgdigits + hghmsgdigits + 5 : 0, "");
                        } else {
-                               printf ("has %*d message%s  (%*d-%*d)",
+                               printf("has %*d message%s  (%*d-%*d)",
                                                nummsgdigits, fi[i].nummsg,
-                                               (fi[i].nummsg == 1) ? " " : "s",
+                                               (fi[i].nummsg == 1) ?
+                                               " " : "s",
                                                lowmsgdigits, fi[i].lowmsg,
                                                hghmsgdigits, fi[i].hghmsg);
                                if (fi[i].curmsg >= fi[i].lowmsg && fi[i].curmsg <= fi[i].hghmsg) {
                                        curprinted = 1;
-                                       printf ("; cur=%*d", curmsgdigits, fi[i].curmsg);
+                                       printf("; cur=%*d", curmsgdigits,
+                                                       fi[i].curmsg);
                                }
                        }
 
                        if (fi[i].others)
-                               printf (";%*s (others)", curprinted ? 0 : curmsgdigits + 6, "");
-                       printf (".\n");
+                               printf(";%*s (others)", curprinted ?
+                                               0 : curmsgdigits + 6, "");
+                       printf(".\n");
                }
        }
 
@@ -605,13 +610,13 @@ print_folders (void)
        */
        if (ftotal > 0 || (all && !fshort && ftotal >= 0)) {
                if (all)
-                       printf ("\n");
-               printf ("TOTAL = %d message%c in %d folder%s.\n",
+                       printf("\n");
+               printf("TOTAL = %d message%c in %d folder%s.\n",
                                total_msgs, total_msgs != 1 ? 's' : ' ',
                                total_folders, total_folders != 1 ? "s" : "");
        }
 
-       fflush (stdout);
+       fflush(stdout);
 }
 
 /*
@@ -619,20 +624,20 @@ print_folders (void)
 */
 
 static int
-sfold (struct msgs *mp, char *msg)
+sfold(struct msgs *mp, char *msg)
 {
        /* parse the message range/sequence/name and set SELECTED */
-       if (!m_convert (mp, msg))
+       if (!m_convert(mp, msg))
                return 0;
 
        if (mp->numsel > 1) {
-               admonish (NULL, "only one message at a time!");
+               admonish(NULL, "only one message at a time!");
                return 0;
        }
-       seq_setprev (mp);  /* set the previous-sequence */
-       seq_setcur (mp, mp->lowsel);  /* set current message */
-       seq_save (mp);  /* synchronize message sequences */
-       context_save ();  /* save the context file */
+       seq_setprev(mp);  /* set the previous-sequence */
+       seq_setcur(mp, mp->lowsel);  /* set current message */
+       seq_save(mp);  /* synchronize message sequences */
+       context_save();  /* save the context file */
 
        return 1;
 }
@@ -643,17 +648,17 @@ sfold (struct msgs *mp, char *msg)
 */
 
 static void
-readonly_folders (void)
+readonly_folders(void)
 {
        int atrlen;
        char atrcur[BUFSIZ];
        register struct node *np;
 
-       snprintf (atrcur, sizeof(atrcur), "atr-%s-", current);
-       atrlen = strlen (atrcur);
+       snprintf(atrcur, sizeof(atrcur), "atr-%s-", current);
+       atrlen = strlen(atrcur);
 
        for (np = m_defs; np; np = np->n_next)
-               if (ssequal (atrcur, np->n_name)
-                               && !ssequal (nmhdir, np->n_name + atrlen))
-                       get_folder_info (np->n_name + atrlen, NULL);
+               if (ssequal(atrcur, np->n_name)
+                               && !ssequal(nmhdir, np->n_name + atrlen))
+                       get_folder_info(np->n_name + atrlen, NULL);
 }
index 5c71c55..9ad2877 100644 (file)
@@ -83,14 +83,14 @@ static struct msgs *mp = NULL;  /* used a lot */
 /*
 ** static prototypes
 */
-static void mhl_draft (int, char *, int, int, char *, char *, int);
-static void copy_draft (int, char *, char *, int, int, int);
-static void copy_mime_draft (int);
-static int build_form (char *, char *, int, int);
+static void mhl_draft(int, char *, int, int, char *, char *, int);
+static void copy_draft(int, char *, char *, int, int, int);
+static void copy_mime_draft(int);
+static int build_form(char *, char *, int, int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int msgp = 0, anot = 0, inplace = 1, mime = 0;
        int issue = 0, volume = 0, dashstuff = 0;
@@ -109,31 +109,30 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
-                                               invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case ANNOSW:
                                        anot++;
@@ -144,7 +143,7 @@ main (int argc, char **argv)
 
                                case EDITRSW:
                                        if (!(ed = *argp++) || *ed == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        nedit = 0;
                                        continue;
                                case NEDITSW:
@@ -153,7 +152,7 @@ main (int argc, char **argv)
 
                                case WHATSW:
                                        if (!(whatnowproc = *argp++) || *whatnowproc == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        nwhat = 0;
                                        continue;
 #ifdef MHE
@@ -166,24 +165,24 @@ main (int argc, char **argv)
 
                                case FILESW:
                                        if (file)
-                                               adios (NULL, "only one file at a time!");
+                                               adios(NULL, "only one file at a time!");
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       file = path (cp, TFILE);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       file = path(cp, TFILE);
                                        continue;
                                case FILTSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       filter = getcpy (etcpath (cp));
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       filter = getcpy(etcpath(cp));
                                        mime = 0;
                                        continue;
                                case FORMSW:
                                        if (!(form = *argp++) || *form == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case FRMTSW:
-                                       filter = getcpy (etcpath (mhlforward));
+                                       filter = getcpy(etcpath(mhlforward));
                                        continue;
                                case NFRMTSW:
                                        filter = NULL;
@@ -206,20 +205,20 @@ main (int argc, char **argv)
 
                                case DGSTSW:
                                        if (!(digest = *argp++) || *digest == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        mime = 0;
                                        continue;
                                case ISSUESW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       if ((issue = atoi (cp)) < 1)
-                                               adios (NULL, "bad argument %s %s", argp[-2], cp);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       if ((issue = atoi(cp)) < 1)
+                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
                                        continue;
                                case VOLUMSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       if ((volume = atoi (cp)) < 1)
-                                               adios (NULL, "bad argument %s %s", argp[-2], cp);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       if ((volume = atoi(cp)) < 1)
+                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
                                        continue;
 
                                case BITSTUFFSW:
@@ -232,26 +231,26 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else {
                        msgs[msgp++] = cp;
                }
        }
 
-       cwd = getcpy (pwd ());
+       cwd = getcpy(pwd());
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
        if (file && (msgp || folder))
-               adios (NULL, "can't mix files and folders/msgs");
+               adios(NULL, "can't mix files and folders/msgs");
 
 #ifdef MHE
-       strncpy (drft, buildsw ? m_maildir ("draft")
+       strncpy(drft, buildsw ? m_maildir("draft")
                : m_draft("new"), sizeof(drft));
 #else
-       strncpy (drft, m_draft("new"), sizeof(drft));
+       strncpy(drft, m_draft("new"), sizeof(drft));
 #endif /* MHE */
 
        if (file) {
@@ -266,101 +265,103 @@ main (int argc, char **argv)
                if (!msgp)
                        msgs[msgp++] = "cur";
                if (!folder)
-                       folder = getfolder (1);
-               maildir = m_maildir (folder);
+                       folder = getfolder(1);
+               maildir = m_maildir(folder);
 
-               if (chdir (maildir) == NOTOK)
-                       adios (maildir, "unable to change directory to");
+               if (chdir(maildir) == NOTOK)
+                       adios(maildir, "unable to change directory to");
 
                /* read folder and create message structure */
-               if (!(mp = folder_read (folder)))
-                       adios (NULL, "unable to read folder %s", folder);
+               if (!(mp = folder_read(folder)))
+                       adios(NULL, "unable to read folder %s", folder);
 
                /* check for empty folder */
                if (mp->nummsg == 0)
-                       adios (NULL, "no messages in %s", folder);
+                       adios(NULL, "no messages in %s", folder);
 
                /* parse all the message ranges/sequences and set SELECTED */
                for (msgnum = 0; msgnum < msgp; msgnum++)
-                       if (!m_convert (mp, msgs[msgnum]))
-                               done (1);
-               seq_setprev (mp);  /* set the previous sequence */
+                       if (!m_convert(mp, msgs[msgnum]))
+                               done(1);
+               seq_setprev(mp);  /* set the previous sequence */
        }
 
-       if (filter && access (filter, R_OK) == NOTOK)
-               adios (filter, "unable to read");
+       if (filter && access(filter, R_OK) == NOTOK)
+               adios(filter, "unable to read");
 
        /*
        ** Open form (component) file.
        */
        if (digest) {
                if (issue == 0) {
-                       snprintf (buf, sizeof(buf), IFORMAT, digest);
-                       if (volume == 0
-                                       && (cp = context_find (buf))
-                                       && ((issue = atoi (cp)) < 0))
+                       snprintf(buf, sizeof(buf), IFORMAT, digest);
+                       if (volume == 0 && (cp = context_find(buf))
+                                       && ((issue = atoi(cp)) < 0))
                                issue = 0;
                        issue++;
                }
                if (volume == 0)
-                       snprintf (buf, sizeof(buf), VFORMAT, digest);
-               if ((cp = context_find (buf)) == NULL || (volume = atoi (cp)) <= 0)
+                       snprintf(buf, sizeof(buf), VFORMAT, digest);
+               if ((cp = context_find(buf)) == NULL ||
+                               (volume = atoi(cp)) <= 0)
                        volume = 1;
                if (!form)
                        form = digestcomps;
-               in = build_form (form, digest, volume, issue);
+               in = build_form(form, digest, volume, issue);
        } else
                in = open_form(&form, forwcomps);
 
-       if ((out = creat (drft, m_gmprot ())) == NOTOK)
-               adios (drft, "unable to create");
+       if ((out = creat(drft, m_gmprot())) == NOTOK)
+               adios(drft, "unable to create");
 
        /*
        ** copy the components into the draft
        */
-       cpydata (in, out, form, drft);
-       close (in);
+       cpydata(in, out, form, drft);
+       close(in);
 
        if (file) {
                /* just copy the file into the draft */
-               if ((in = open (file, O_RDONLY)) == NOTOK)
-                       adios (file, "unable to open");
-               cpydata (in, out, file, drft);
-               close (in);
-               close (out);
+               if ((in = open(file, O_RDONLY)) == NOTOK)
+                       adios(file, "unable to open");
+               cpydata(in, out, file, drft);
+               close(in);
+               close(out);
        } else {
                /*
                ** If filter file is defined, then format the
                ** messages into the draft using mhlproc.
                */
                if (filter)
-                       mhl_draft (out, digest, volume, issue, drft, filter, dashstuff);
+                       mhl_draft(out, digest, volume, issue, drft, filter,
+                                       dashstuff);
                else if (mime)
-                       copy_mime_draft (out);
+                       copy_mime_draft(out);
                else
-                       copy_draft (out, digest, drft, volume, issue, dashstuff);
-               close (out);
+                       copy_draft(out, digest, drft, volume, issue,
+                                       dashstuff);
+               close(out);
 
                if (digest) {
-                       snprintf (buf, sizeof(buf), IFORMAT, digest);
-                       snprintf (value, sizeof(value), "%d", issue);
-                       context_replace (buf, getcpy (value));
-                       snprintf (buf, sizeof(buf), VFORMAT, digest);
-                       snprintf (value, sizeof(value), "%d", volume);
-                       context_replace (buf, getcpy (value));
+                       snprintf(buf, sizeof(buf), IFORMAT, digest);
+                       snprintf(value, sizeof(value), "%d", issue);
+                       context_replace(buf, getcpy(value));
+                       snprintf(buf, sizeof(buf), VFORMAT, digest);
+                       snprintf(value, sizeof(value), "%d", volume);
+                       context_replace(buf, getcpy(value));
                }
 
-               context_replace (pfolder, folder);  /* update current folder */
-               seq_setcur (mp, mp->lowsel);  /* update current message */
-               seq_save (mp);  /* synchronize sequences */
-               context_save ();  /* save the context file */
+               context_replace(pfolder, folder);  /* update current folder */
+               seq_setcur(mp, mp->lowsel);  /* update current message */
+               seq_save(mp);  /* synchronize sequences */
+               context_save();  /* save the context file */
        }
 
        if (nwhat)
-               done (0);
-       what_now (ed, nedit, NOUSE, drft, NULL, 0, mp,
+               done(0);
+       what_now(ed, nedit, NOUSE, drft, NULL, 0, mp,
                anot ? "Forwarded" : NULL, inplace, cwd);
-       done (1);
+       done(1);
        return 1;
 }
 
@@ -372,7 +373,7 @@ main (int argc, char **argv)
 */
 
 static void
-mhl_draft (int out, char *digest, int volume, int issue,
+mhl_draft(int out, char *digest, int volume, int issue,
        char *file, char *filter, int dashstuff)
 {
        pid_t child_id;
@@ -381,21 +382,21 @@ mhl_draft (int out, char *digest, int volume, int issue,
        char buf1[BUFSIZ];
        char buf2[BUFSIZ];
 
-       if (pipe (pd) == NOTOK)
-               adios ("pipe", "unable to create");
+       if (pipe(pd) == NOTOK)
+               adios("pipe", "unable to create");
 
-       vec[0] = r1bindex (mhlproc, '/');
+       vec[0] = r1bindex(mhlproc, '/');
 
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
-               sleep (5);
+               sleep(5);
        switch (child_id) {
                case NOTOK:
-                       adios ("fork", "unable to");
+                       adios("fork", "unable to");
 
                case OK:
-                       close (pd[0]);
-                       dup2 (pd[1], 1);
-                       close (pd[1]);
+                       close(pd[0]);
+                       dup2(pd[1], 1);
+                       close(pd[1]);
 
                        i = 1;
                        vec[i++] = "-forwall";
@@ -406,10 +407,10 @@ mhl_draft (int out, char *digest, int volume, int issue,
                                vec[i++] = "-digest";
                                vec[i++] = digest;
                                vec[i++] = "-issue";
-                               snprintf (buf1, sizeof(buf1), "%d", issue);
+                               snprintf(buf1, sizeof(buf1), "%d", issue);
                                vec[i++] = buf1;
                                vec[i++] = "-volume";
-                               snprintf (buf2, sizeof(buf2), "%d", volume);
+                               snprintf(buf2, sizeof(buf2), "%d", volume);
                                vec[i++] = buf2;
                        }
 
@@ -424,8 +425,7 @@ mhl_draft (int out, char *digest, int volume, int issue,
                                vec[i++] = "-nodashstuffing";
 
                        if (mp->numsel >= MAXARGS - i)
-                               adios (NULL, "more than %d messages for %s exec",
-                                               MAXARGS - i, vec[0]);
+                               adios(NULL, "more than %d messages for %s exec", MAXARGS - i, vec[0]);
 
                        /*
                        ** Now add the message names to filter.  We can only
@@ -435,19 +435,19 @@ mhl_draft (int out, char *digest, int volume, int issue,
                        for (msgnum = mp->lowsel;
                                        msgnum <= mp->hghsel && i < sizeof(vec) - 1;
                                        msgnum++)
-                               if (is_selected (mp, msgnum))
-                                       vec[i++] = getcpy (m_name (msgnum));
+                               if (is_selected(mp, msgnum))
+                                       vec[i++] = getcpy(m_name(msgnum));
                        vec[i] = NULL;
 
-                       execvp (mhlproc, vec);
-                       fprintf (stderr, "unable to exec ");
-                       perror (mhlproc);
-                       _exit (-1);
+                       execvp(mhlproc, vec);
+                       fprintf(stderr, "unable to exec ");
+                       perror(mhlproc);
+                       _exit(-1);
 
                default:
-                       close (pd[1]);
-                       cpydata (pd[0], out, vec[0], file);
-                       close (pd[0]);
+                       close(pd[1]);
+                       cpydata(pd[0], out, vec[0], file);
+                       close(pd[0]);
                        pidXwait(child_id, mhlproc);
                        break;
        }
@@ -461,7 +461,7 @@ mhl_draft (int out, char *digest, int volume, int issue,
 */
 
 static void
-copy_draft (int out, char *digest, char *file, int volume, int issue,
+copy_draft(int out, char *digest, char *file, int volume, int issue,
                int dashstuff)
 {
        int fd,i, msgcnt, msgnum;
@@ -471,36 +471,36 @@ copy_draft (int out, char *digest, char *file, int volume, int issue,
 
        msgcnt = 1;
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
-               if (is_selected (mp, msgnum)) {
+               if (is_selected(mp, msgnum)) {
                        if (digest) {
-                               strncpy (buffer, msgnum == mp->lowsel ?
+                               strncpy(buffer, msgnum == mp->lowsel ?
                                        delim3 : delim4, sizeof(buffer));
                        } else {
                                /* Get buffer ready to go */
                                bp = buffer;
                                buflen = sizeof(buffer);
 
-                               strncpy (bp, "\n-------", buflen);
-                               len = strlen (bp);
+                               strncpy(bp, "\n-------", buflen);
+                               len = strlen(bp);
                                bp += len;
                                buflen -= len;
 
                                if (msgnum == mp->lowsel) {
-                                       snprintf (bp, buflen, " Forwarded Message%s",
-                                               mp->numsel > 1 ? "s" : "");
+                                       snprintf(bp, buflen, " Forwarded Message%s", mp->numsel > 1 ? "s" : "");
                                } else {
-                                       snprintf (bp, buflen, " Message %d", msgcnt);
+                                       snprintf(bp, buflen, " Message %d", msgcnt);
                                }
-                               len = strlen (bp);
+                               len = strlen(bp);
                                bp += len;
                                buflen -= len;
 
-                               strncpy (bp, "\n\n", buflen);
+                               strncpy(bp, "\n\n", buflen);
                        }
-                       write (out, buffer, strlen (buffer));
+                       write(out, buffer, strlen(buffer));
 
-                       if ((fd = open (msgnam = m_name (msgnum), O_RDONLY)) == NOTOK) {
-                               admonish (msgnam, "unable to read message");
+                       if ((fd = open(msgnam = m_name (msgnum), O_RDONLY))
+                                       == NOTOK) {
+                               admonish(msgnam, "unable to read message");
                                continue;
                        }
 
@@ -509,32 +509,34 @@ copy_draft (int out, char *digest, char *file, int volume, int issue,
                        ** unless given the -nodashstuffing flag.
                        */
                        if (dashstuff >= 0)
-                               cpydgst (fd, out, msgnam, file);
+                               cpydgst(fd, out, msgnam, file);
                        else
-                               cpydata (fd, out, msgnam, file);
+                               cpydata(fd, out, msgnam, file);
 
-                       close (fd);
+                       close(fd);
                        msgcnt++;
                }
        }
 
        if (digest) {
-               strncpy (buffer, delim4, sizeof(buffer));
+               strncpy(buffer, delim4, sizeof(buffer));
        } else {
-               snprintf (buffer, sizeof(buffer), "\n------- End of Forwarded Message%s\n\n",
+               snprintf(buffer, sizeof(buffer),
+                               "\n------- End of Forwarded Message%s\n\n",
                                mp->numsel > 1 ? "s" : "");
        }
-       write (out, buffer, strlen (buffer));
+       write(out, buffer, strlen(buffer));
 
        if (digest) {
-               snprintf (buffer, sizeof(buffer), "End of %s Digest [Volume %d Issue %d]\n",
+               snprintf(buffer, sizeof(buffer),
+                               "End of %s Digest [Volume %d Issue %d]\n",
                                digest, volume, issue);
-               i = strlen (buffer);
+               i = strlen(buffer);
                for (bp = buffer + i; i > 1; i--)
                        *bp++ = '*';
                *bp++ = '\n';
                *bp = 0;
-               write (out, buffer, strlen (buffer));
+               write(out, buffer, strlen(buffer));
        }
 }
 
@@ -544,25 +546,26 @@ copy_draft (int out, char *digest, char *file, int volume, int issue,
 */
 
 static void
-copy_mime_draft (int out)
+copy_mime_draft(int out)
 {
        int msgnum;
        char buffer[BUFSIZ];
 
-       snprintf (buffer, sizeof(buffer), "#forw [forwarded message%s] +%s",
-               mp->numsel == 1 ? "" : "s", mp->foldpath);
-       write (out, buffer, strlen (buffer));
+       snprintf(buffer, sizeof(buffer), "#forw [forwarded message%s] +%s",
+                       mp->numsel == 1 ? "" : "s", mp->foldpath);
+       write(out, buffer, strlen(buffer));
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
-               if (is_selected (mp, msgnum)) {
-                       snprintf (buffer, sizeof(buffer), " %s", m_name (msgnum));
-                       write (out, buffer, strlen (buffer));
+               if (is_selected(mp, msgnum)) {
+                       snprintf(buffer, sizeof(buffer), " %s",
+                                       m_name(msgnum));
+                       write(out, buffer, strlen(buffer));
                }
-       write (out, "\n", 1);
+       write(out, "\n", 1);
 }
 
 
 static int
-build_form (char *form, char *digest, int volume, int issue)
+build_form(char *form, char *digest, int volume, int issue)
 {
        int in;
        int fmtsize;
@@ -575,18 +578,18 @@ build_form (char *form, char *digest, int volume, int issue)
        char *cp = NULL;
 
        /* Get new format string */
-       nfs = new_fs (form, NULL, NULL);
-       fmtsize = strlen (nfs) + 256;
+       nfs = new_fs(form, NULL, NULL);
+       fmtsize = strlen(nfs) + 256;
 
        /* Compile format string */
-       fmt_compile (nfs, &fmt);
+       fmt_compile(nfs, &fmt);
 
-       FINDCOMP (cptr, "digest");
+       FINDCOMP(cptr, "digest");
        if (cptr)
                cptr->c_text = digest;
-       FINDCOMP (cptr, "date");
+       FINDCOMP(cptr, "date");
        if (cptr)
-               cptr->c_text = getcpy(dtimenow (0));
+               cptr->c_text = getcpy(dtimenow(0));
 
        dat[0] = issue;
        dat[1] = volume;
@@ -596,18 +599,18 @@ build_form (char *form, char *digest, int volume, int issue)
 
        cp = m_mktemp2(NULL, invo_name, NULL, &tmp);
        if (cp == NULL) adios("forw", "unable to create temporary file");
-       strncpy (tmpfil, cp, sizeof(tmpfil));
-       unlink (tmpfil);
-       if ((in = dup (fileno (tmp))) == NOTOK)
-               adios ("dup", "unable to");
-
-       line = mh_xmalloc ((unsigned) fmtsize);
-       fmt_scan (fmt, line, fmtsize, dat);
-       fputs (line, tmp);
-       free (line);
-       if (fclose (tmp))
-               adios (tmpfil, "error writing");
-
-       lseek (in, (off_t) 0, SEEK_SET);
+       strncpy(tmpfil, cp, sizeof(tmpfil));
+       unlink(tmpfil);
+       if ((in = dup(fileno(tmp))) == NOTOK)
+               adios("dup", "unable to");
+
+       line = mh_xmalloc((unsigned) fmtsize);
+       fmt_scan(fmt, line, fmtsize, dat);
+       fputs(line, tmp);
+       free(line);
+       if (fclose(tmp))
+               adios(tmpfil, "error writing");
+
+       lseek(in, (off_t) 0, SEEK_SET);
        return in;
 }
index fb306f4..7d6d72b 100644 (file)
@@ -31,46 +31,46 @@ extern int v_verbose;
 #include <errno.h>
 
 #define start_tcp_client(res) \
-       socket (res->ai_family, res->ai_socktype, res->ai_protocol)
+       socket(res->ai_family, res->ai_socktype, res->ai_protocol)
 
 #define join_tcp_server(fd, sock, len) \
-       connect ((fd), (struct sockaddr *) (sock), len)
+       connect((fd), (struct sockaddr *) (sock), len)
 
 /*
 ** prototypes
 */
-int ftp_get (char *, char *, char *, char *, char *, char *, int, int);
-int ftp_trans (char *, char *, char *, char *, char *, char *, char *,
+int ftp_get(char *, char *, char *, char *, char *, char *, int, int);
+int ftp_trans(char *, char *, char *, char *, char *, char *, char *,
                int, int);
 
 /*
 ** static prototypes
 */
-static int start_tcp_server (struct sockaddr_in *, int, int, int);
-static void _asnprintf (char *, int, char *, va_list);
-static int ftp_quit (void);
-static int ftp_read (char *, char *, char *, int);
-static int initconn (void);
-static int dataconn (void);
-static int command (int arg1, ...);
-static int vcommand (int, va_list);
-static int getreply (int, int);
+static int start_tcp_server(struct sockaddr_in *, int, int, int);
+static void _asnprintf(char *, int, char *, va_list);
+static int ftp_quit(void);
+static int ftp_read(char *, char *, char *, int);
+static int initconn(void);
+static int dataconn(void);
+static int command(int arg1, ...);
+static int vcommand(int, va_list);
+static int getreply(int, int);
 
 
 static int
-start_tcp_server (struct sockaddr_in *sock, int backlog, int opt1, int opt2)
+start_tcp_server(struct sockaddr_in *sock, int backlog, int opt1, int opt2)
 {
        int eindex, sd;
 
-       if ((sd = socket (AF_INET, SOCK_STREAM, 0)) == NOTOK)
+       if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == NOTOK)
                return NOTOK;
 
-       if (bind (sd, (struct sockaddr *) sock, sizeof *sock) == NOTOK) {
+       if (bind(sd, (struct sockaddr *) sock, sizeof *sock) == NOTOK) {
                eindex = errno;
-               close (sd);
+               close(sd);
                errno = eindex;
        } else {
-               listen (sd, backlog);
+               listen(sd, backlog);
        }
 
        return sd;
@@ -80,7 +80,7 @@ start_tcp_server (struct sockaddr_in *sock, int backlog, int opt1, int opt2)
 static int __len__;
 
 #define join_tcp_client(fd,sock) \
-       accept ((fd), (struct sockaddr *) (sock), \
+       accept((fd), (struct sockaddr *) (sock), \
                (__len__ = sizeof *(sock), &__len__))
 
 #define read_tcp_socket read
@@ -88,7 +88,7 @@ static int __len__;
 #define close_tcp_socket close
 
 static void
-_asnprintf (char *bp, int len_bp, char *what, va_list ap)
+_asnprintf(char *bp, int len_bp, char *what, va_list ap)
 {
        int eindex, len;
        char *fmt;
@@ -96,7 +96,7 @@ _asnprintf (char *bp, int len_bp, char *what, va_list ap)
        eindex = errno;
 
        *bp = '\0';
-       fmt = va_arg (ap, char *);
+       fmt = va_arg(ap, char *);
 
        if (fmt) {
                vsnprintf(bp, len_bp, fmt, ap);
@@ -109,16 +109,16 @@ _asnprintf (char *bp, int len_bp, char *what, va_list ap)
                char *s;
 
                if (*what) {
-                       snprintf (bp, len_bp, " %s: ", what);
-                       len = strlen (bp);
+                       snprintf(bp, len_bp, " %s: ", what);
+                       len = strlen(bp);
                        bp += len;
                        len_bp -= len;
                }
                if ((s = strerror(eindex)))
-                       strncpy (bp, s, len_bp);
+                       strncpy(bp, s, len_bp);
                else
-                       snprintf (bp, len_bp, "Error %d", eindex);
-               bp += strlen (bp);
+                       snprintf(bp, len_bp, "Error %d", eindex);
+               bp += strlen(bp);
        }
 
        errno = eindex;
@@ -126,22 +126,22 @@ _asnprintf (char *bp, int len_bp, char *what, va_list ap)
 
 
 int
-ftp_get (char *host, char *user, char *password, char *cwd,
+ftp_get(char *host, char *user, char *password, char *cwd,
                 char *remote, char *local, int ascii, int stayopen)
 {
-       return ftp_trans (host, user, password, cwd, remote, local,
+       return ftp_trans(host, user, password, cwd, remote, local,
                "RETR", ascii, stayopen);
 }
 
 
 int
-ftp_trans (char *host, char *user, char *password, char *cwd, char *remote,
+ftp_trans(char *host, char *user, char *password, char *cwd, char *remote,
        char *local, char *cmd, int ascii, int stayopen)
 {
        int result;
 
        if (stayopen <= 0) {
-               result = ftp_quit ();
+               result = ftp_quit();
                if (host == NULL)
                        return result;
        }
@@ -159,32 +159,35 @@ ftp_trans (char *host, char *user, char *password, char *cwd, char *remote,
                result = getaddrinfo(host, "ftp", &hints, &res);
 
                if (result) {
-                       fprintf(stderr, "%s/ftp: %s\n", host, gai_strerror(result));
+                       fprintf(stderr, "%s/ftp: %s\n",
+                                       host, gai_strerror(result));
                        return NOTOK;
                }
 
-               if ((ftp_fd = start_tcp_client (res)) == NOTOK) {
-                       perror (host);
+               if ((ftp_fd = start_tcp_client(res)) == NOTOK) {
+                       perror(host);
                        freeaddrinfo(res);
                        return NOTOK;
                }
-               if (join_tcp_server (ftp_fd, res->ai_addr, res->ai_addrlen) == NOTOK) {
-                       perror (host);
+               if (join_tcp_server(ftp_fd, res->ai_addr, res->ai_addrlen)
+                               == NOTOK) {
+                       perror(host);
                        freeaddrinfo(res);
-                       close_tcp_socket (ftp_fd), ftp_fd = NOTOK;
+                       close_tcp_socket(ftp_fd), ftp_fd = NOTOK;
                        return NOTOK;
                }
                freeaddrinfo(res);
-               getreply (1, 0);
+               getreply(1, 0);
 
                if (v_verbose) {
-                       fprintf (stdout, "Connected to %s\n", host);
-                       fflush (stdout);
+                       fprintf(stdout, "Connected to %s\n", host);
+                       fflush(stdout);
                }
 
                if (user) {
-                       if ((result = command (0, "USER %s", user)) == CONTINUE)
-                               result = command (1, "PASS %s", password);
+                       if ((result = command (0, "USER %s", user))
+                                       == CONTINUE)
+                               result = command(1, "PASS %s", password);
                        if (result != COMPLETE) {
                                result = NOTOK;
                                goto out;
@@ -196,41 +199,41 @@ ftp_trans (char *host, char *user, char *password, char *cwd, char *remote,
        }
 
        if (cwd && ((result = command (0, "CWD %s", cwd)) != COMPLETE
-                                       && result != CONTINUE)) {
+                       && result != CONTINUE)) {
                result = NOTOK;
                goto out;
        }
 
-       if (command (1, ascii ? "TYPE A" : "TYPE I") != COMPLETE) {
+       if (command(1, ascii ? "TYPE A" : "TYPE I") != COMPLETE) {
                result = NOTOK;
                goto out;
        }
 
-       result = ftp_read (remote, local, cmd, ascii);
+       result = ftp_read(remote, local, cmd, ascii);
 
 out: ;
        if (result != OK || !stayopen)
-               ftp_quit ();
+               ftp_quit();
 
        return result;
 }
 
 
 static int
-ftp_quit (void)
+ftp_quit(void)
 {
        int n;
 
        if (ftp_fd == NOTOK)
                return OK;
 
-       n = command (1, "QUIT");
-       close_tcp_socket (ftp_fd), ftp_fd = NOTOK;
+       n = command(1, "QUIT");
+       close_tcp_socket(ftp_fd), ftp_fd = NOTOK;
        return (n == 0 || n == COMPLETE ? OK : NOTOK);
 }
 
 static int
-ftp_read (char *remote, char *local, char *cmd, int ascii)
+ftp_read(char *remote, char *local, char *cmd, int ascii)
 {
        int istdio = 0, istore;
        register int cc;
@@ -238,33 +241,33 @@ ftp_read (char *remote, char *local, char *cmd, int ascii)
        char buffer[BUFSIZ];
        FILE *fp = NULL;
 
-       if (initconn () == NOTOK)
+       if (initconn() == NOTOK)
                goto bad;
 
        v_noise = v_verbose;
-       if (command (-1, *remote ? "%s %s" : "%s", cmd, remote) != PRELIM)
+       if (command(-1, *remote ? "%s %s" : "%s", cmd, remote) != PRELIM)
                goto bad;
 
        expectingreply++;
-       if (dataconn () == NOTOK) {
+       if (dataconn() == NOTOK) {
 bad: ;
                if (fp && !istdio)
-                       fclose (fp);
+                       fclose(fp);
                if (data_fd != NOTOK)
-                       close_tcp_socket (data_fd), data_fd = NOTOK;
+                       close_tcp_socket(data_fd), data_fd = NOTOK;
                if (expectingreply)
-                       getreply (-2, 0);
+                       getreply(-2, 0);
 
                return NOTOK;
        }
 
-       istore = !strcmp (cmd, "STOR");
+       istore = !strcmp(cmd, "STOR");
 
-       if ((istdio = !strcmp (local, "-")))
+       if ((istdio = !strcmp(local, "-")))
                fp = istore ? stdin : stdout;
        else
-               if ((fp = fopen (local, istore ? "r" : "w")) == NULL) {
-                       perror (local);
+               if ((fp = fopen(local, istore ? "r" : "w")) == NULL) {
+                       perror(local);
                        goto bad;
                }
 
@@ -273,46 +276,48 @@ bad: ;
                        int c;
                        FILE *out;
 
-                       if (!(out = fdopen (data_fd, "w"))) {
-                               perror ("fdopen");
+                       if (!(out = fdopen(data_fd, "w"))) {
+                               perror("fdopen");
                                goto bad;
                        }
 
-                       while ((c = getc (fp)) != EOF) {
+                       while ((c = getc(fp)) != EOF) {
                                if (c == '\n')
-                                       putc ('\r', out);
-                               if (putc (c, out) == EOF) {
-                                       perror ("putc");
-                                       fclose (out);
+                                       putc('\r', out);
+                               if (putc(c, out) == EOF) {
+                                       perror("putc");
+                                       fclose(out);
                                        data_fd = NOTOK;
                                        goto bad;
                                }
                        }
 
-                       fclose (out);
+                       fclose(out);
                        data_fd = NOTOK;
                } else {
-                       while ((cc = fread (buffer, sizeof *buffer, sizeof buffer, fp)) > 0)
-                               if (write_tcp_socket (data_fd, buffer, cc) != cc) {
-                                       perror ("write_tcp_socket");
+                       while ((cc = fread(buffer, sizeof *buffer,
+                                       sizeof buffer, fp)) > 0)
+                               if (write_tcp_socket(data_fd, buffer, cc)
+                                               != cc) {
+                                       perror("write_tcp_socket");
                                        goto bad;
                                }
 
-                       close_tcp_socket (data_fd), data_fd = NOTOK;
+                       close_tcp_socket(data_fd), data_fd = NOTOK;
                }
        } else {
                if (ascii) {
                        int c;
                        FILE *in;
 
-                       if (!(in = fdopen (data_fd, "r"))) {
-                               perror ("fdopen");
+                       if (!(in = fdopen(data_fd, "r"))) {
+                               perror("fdopen");
                                goto bad;
                        }
 
-                       while ((c = getc (in)) != EOF) {
+                       while ((c = getc(in)) != EOF) {
                                if (c == '\r')
-                                       switch (c = getc (in)) {
+                                       switch (c = getc(in)) {
                                                case EOF:
                                                case '\0':
                                                        c = '\r';
@@ -322,91 +327,93 @@ bad: ;
                                                        break;
 
                                                default:
-                                                       putc ('\r', fp);
+                                                       putc('\r', fp);
                                                        break;
                                                }
 
-                               if (putc (c, fp) == EOF) {
-                                       perror ("putc");
-                                       fclose (in);
+                               if (putc(c, fp) == EOF) {
+                                       perror("putc");
+                                       fclose(in);
                                        data_fd = NOTOK;
                                        goto bad;
                                }
                        }
 
-                       fclose (in);
+                       fclose(in);
                        data_fd = NOTOK;
                } else {
-                       while ((cc = read_tcp_socket (data_fd, buffer, sizeof buffer)) > 0)
-                               if (fwrite (buffer, sizeof *buffer, cc, fp) == 0) {
-                                       perror ("fwrite");
+                       while ((cc = read_tcp_socket(data_fd, buffer,
+                                       sizeof buffer)) > 0)
+                               if (fwrite(buffer, sizeof *buffer, cc, fp)
+                                               == 0) {
+                                       perror("fwrite");
                                        goto bad;
                                }
                        if (cc < 0) {
-                               perror ("read_tcp_socket");
+                               perror("read_tcp_socket");
                                goto bad;
                        }
 
-                       close_tcp_socket (data_fd), data_fd = NOTOK;
+                       close_tcp_socket(data_fd), data_fd = NOTOK;
                }
        }
 
        if (!istdio)
-               fclose (fp);
+               fclose(fp);
 
        v_noise = v_verbose;
-       return (getreply (1, 0) == COMPLETE ? OK : NOTOK);
+       return (getreply(1, 0) == COMPLETE ? OK : NOTOK);
 }
 
 
 #define UC(b) (((int) b) & 0xff)
 
 static int
-initconn (void)
+initconn(void)
 {
        int len;
        register char *a, *p;
        struct sockaddr_in in_socket;
 
-       if (getsockname (ftp_fd, (struct sockaddr *) &in_socket,
+       if (getsockname(ftp_fd, (struct sockaddr *) &in_socket,
                (len = sizeof(in_socket), &len)) == NOTOK) {
-               perror ("getsockname");
+               perror("getsockname");
                return NOTOK;
        }
        in_socket.sin_port = 0;
-       if ((data_fd = start_tcp_server (&in_socket, 1, 0, 0)) == NOTOK) {
-               perror ("start_tcp_server");
+       if ((data_fd = start_tcp_server(&in_socket, 1, 0, 0)) == NOTOK) {
+               perror("start_tcp_server");
                return NOTOK;
        }
 
-       if (getsockname (data_fd, (struct sockaddr *) &in_socket,
+       if (getsockname(data_fd, (struct sockaddr *) &in_socket,
                (len = sizeof in_socket, &len)) == NOTOK) {
-               perror ("getsockname");
+               perror("getsockname");
                return NOTOK;
        }
 
        a = (char *) &in_socket.sin_addr;
        p = (char *) &in_socket.sin_port;
 
-       if (command (1, "PORT %d,%d,%d,%d,%d,%d",
-               UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),
-               UC(p[0]), UC(p[1])) == COMPLETE)
+       if (command(1, "PORT %d,%d,%d,%d,%d,%d",
+                       UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),
+                       UC(p[0]), UC(p[1])) == COMPLETE)
                return OK;
 
        return NOTOK;
 }
 
 static int
-dataconn (void)
+dataconn(void)
 {
        int fd;
        struct sockaddr_in in_socket;
 
-       if ((fd = join_tcp_client (data_fd, &in_socket)) == NOTOK) {
-               perror ("join_tcp_client");
+       if ((fd = join_tcp_client(data_fd, &in_socket)) == NOTOK) {
+               perror("join_tcp_client");
                return NOTOK;
        }
-       close_tcp_socket (data_fd);
+       close_tcp_socket(data_fd);
        data_fd = fd;
 
        return OK;
@@ -414,20 +421,20 @@ dataconn (void)
 
 
 static int
-command (int arg1, ...)
+command(int arg1, ...)
 {
        int val;
        va_list ap;
 
-       va_start (ap, arg1);
-       val = vcommand (arg1, ap);
-       va_end (ap);
+       va_start(ap, arg1);
+       val = vcommand(arg1, ap);
+       va_end(ap);
 
        return val;
 }
 
 static int
-vcommand (int complete, va_list ap)
+vcommand(int complete, va_list ap)
 {
        int len;
        char buffer[BUFSIZ];
@@ -435,24 +442,24 @@ vcommand (int complete, va_list ap)
        if (ftp_fd == NOTOK)
                return NOTOK;
 
-       _asnprintf (buffer, sizeof(buffer), NULL, ap);
+       _asnprintf(buffer, sizeof(buffer), NULL, ap);
        if (v_debug)
-               fprintf (stderr, "<--- %s\n", buffer);
+               fprintf(stderr, "<--- %s\n", buffer);
 
-       strcat (buffer, "\r\n");
-       len = strlen (buffer);
+       strcat(buffer, "\r\n");
+       len = strlen(buffer);
 
-       if (write_tcp_socket (ftp_fd, buffer, len) != len) {
-               perror ("write_tcp_socket");
+       if (write_tcp_socket(ftp_fd, buffer, len) != len) {
+               perror("write_tcp_socket");
                return NOTOK;
        }
 
-       return (getreply (complete, !strcmp (buffer, "QUIT")));
+       return(getreply(complete, !strcmp(buffer, "QUIT")));
 }
 
 
 static int
-getreply (int complete, int expecteof)
+getreply(int complete, int expecteof)
 {
        for (;;) {
                register int code, dig, n;
@@ -466,11 +473,11 @@ getreply (int complete, int expecteof)
                for (;;) {
                        unsigned char c;
 
-                       if (read_tcp_socket (ftp_fd, &c, 1) < 1) {
+                       if (read_tcp_socket(ftp_fd, &c, 1) < 1) {
                                if (expecteof)
                                        return OK;
 
-                               perror ("read_tcp_socket");
+                               perror("read_tcp_socket");
                                return DONE;
                        }
                        if (c == '\n')
@@ -481,7 +488,7 @@ getreply (int complete, int expecteof)
                        if (dig < 4) {
                                if (isdigit(c))
                                        code = code * 10 + (c - '0');
-                               else if (isspace (c))
+                               else if (isspace(c))
                                        /* XXX: naughty FTP... */
                                        continuation++;
                        } else
@@ -492,21 +499,21 @@ getreply (int complete, int expecteof)
                }
 
                if (v_debug)
-                       fprintf (stderr, "---> %s\n", buffer);
+                       fprintf(stderr, "---> %s\n", buffer);
                if (continuation)
                        continue;
 
                n -= '0';
 
                if (v_noise) {
-                       fprintf (stdout, "%s\n", buffer);
-                       fflush (stdout);
+                       fprintf(stdout, "%s\n", buffer);
+                       fflush(stdout);
                        v_noise = 0;
                } else
                        if ((complete == -1 && n != PRELIM)
                                || (complete == 0 && n != CONTINUE && n != COMPLETE)
                                || (complete == 1 && n != COMPLETE))
-                               fprintf (stderr, "%s\n", buffer);
+                               fprintf(stderr, "%s\n", buffer);
 
                return n;
        }
index 8947a66..186312e 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -127,7 +127,7 @@ static void inc_done(int) NORETURN;
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int chgflag = 1, trnflag = 1;
        int noisy = 1, width = 0;
@@ -163,36 +163,36 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       mts_init (invo_name);
-       arguments = getarguments (invo_name, argc, argv, 1);
+       mts_init(invo_name);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf), "%s [+folder] [switches]", invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               snprintf(buf, sizeof(buf), "%s [+folder] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case AUDSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               audfile = getcpy (m_maildir (cp));
+                                       adios(NULL, "missing argument to %s", argp[-2]);
+                               audfile = getcpy(m_maildir(cp));
                                continue;
                        case NAUDSW:
                                audfile = NULL;
@@ -221,8 +221,9 @@ main (int argc, char **argv)
 
                        case FILESW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               from = path (cp, TFILE);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               from = path(cp, TFILE);
 
                                /*
                                ** If the truncate file is in default state,
@@ -241,29 +242,33 @@ main (int argc, char **argv)
 
                        case FORMSW:
                                if (!(form = *argp++) || *form == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
                                format = NULL;
                                continue;
                        case FMTSW:
                                if (!(format = *argp++) || *format == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
                                form = NULL;
                                continue;
 
                        case WIDTHSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               width = atoi (cp);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               width = atoi(cp);
                                continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else {
-                       adios (NULL, "usage: %s [+folder] [switches]", invo_name);
+                       adios(NULL, "usage: %s [+folder] [switches]",
+                                       invo_name);
                }
        }
 
@@ -280,29 +285,29 @@ main (int argc, char **argv)
        */
        if (from)
                newmail = from;
-       else if ((newmail = getenv ("MAILDROP")) && *newmail)
-               newmail = m_mailpath (newmail);
-       else if ((newmail = context_find ("maildrop")) && *newmail)
-               newmail = m_mailpath (newmail);
+       else if ((newmail = getenv("MAILDROP")) && *newmail)
+               newmail = m_mailpath(newmail);
+       else if ((newmail = context_find("maildrop")) && *newmail)
+               newmail = m_mailpath(newmail);
        else {
-               newmail = concat (MAILDIR, "/", MAILFIL, NULL);
+               newmail = concat(MAILDIR, "/", MAILFIL, NULL);
        }
-       if (stat (newmail, &s1) == NOTOK || s1.st_size == 0)
-               adios (NULL, "no mail to incorporate");
+       if (stat(newmail, &s1) == NOTOK || s1.st_size == 0)
+               adios(NULL, "no mail to incorporate");
 
        if ((cp = strdup(newmail)) == (char *)0)
-               adios (NULL, "error allocating memory to copy newmail");
+               adios(NULL, "error allocating memory to copy newmail");
 
        newmail = cp;
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
        if (!folder)
-               folder = getfolder (0);
-       maildir = m_maildir (folder);
+               folder = getfolder(0);
+       maildir = m_maildir(folder);
 
        if ((maildir_copy = strdup(maildir)) == (char *)0)
-               adios (maildir, "error allocating memory to copy maildir");
+               adios(maildir, "error allocating memory to copy maildir");
 
        if (!folder_exists(maildir)) {
                /*
@@ -312,35 +317,35 @@ main (int argc, char **argv)
                if (noisy)
                        create_folder(maildir, 0, done);
                else
-                       done (1);
+                       done(1);
        }
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
-       if (access (newmail, W_OK) != NOTOK) {
+       if (access(newmail, W_OK) != NOTOK) {
                locked++;
                if (trnflag) {
-                       SIGNAL (SIGHUP, SIG_IGN);
-                       SIGNAL (SIGINT, SIG_IGN);
-                       SIGNAL (SIGQUIT, SIG_IGN);
-                       SIGNAL (SIGTERM, SIG_IGN);
+                       SIGNAL(SIGHUP, SIG_IGN);
+                       SIGNAL(SIGINT, SIG_IGN);
+                       SIGNAL(SIGQUIT, SIG_IGN);
+                       SIGNAL(SIGTERM, SIG_IGN);
                }
 
                GETGROUPPRIVS();  /* Reset gid to lock mail file */
-               in = lkfopen (newmail, "r");
+               in = lkfopen(newmail, "r");
                DROPGROUPPRIVS();
                if (in == NULL)
-                       adios (NULL, "unable to lock and fopen %s", newmail);
-               fstat (fileno(in), &s1);
+                       adios(NULL, "unable to lock and fopen %s", newmail);
+               fstat(fileno(in), &s1);
        } else {
                trnflag = 0;
-               if ((in = fopen (newmail, "r")) == NULL)
-                       adios (newmail, "unable to read");
+               if ((in = fopen(newmail, "r")) == NULL)
+                       adios(newmail, "unable to read");
        }
 
        /* This shouldn't be necessary but it can't hurt. */
@@ -348,58 +353,57 @@ main (int argc, char **argv)
 
        if (audfile) {
                int i;
-               if ((i = stat (audfile, &st)) == NOTOK)
-                       advise (NULL, "Creating Receive-Audit: %s", audfile);
-               if ((aud = fopen (audfile, "a")) == NULL)
-                       adios (audfile, "unable to append to");
+               if ((i = stat(audfile, &st)) == NOTOK)
+                       advise(NULL, "Creating Receive-Audit: %s", audfile);
+               if ((aud = fopen(audfile, "a")) == NULL)
+                       adios(audfile, "unable to append to");
                else if (i == NOTOK)
-                       chmod (audfile, m_gmprot ());
+                       chmod(audfile, m_gmprot());
 
-               fprintf (aud, from ? "<<inc>> %s  -ms %s\n" : "<<inc>> %s\n",
-                        dtimenow (0), from);
+               fprintf(aud, from ? "<<inc>> %s  -ms %s\n" : "<<inc>> %s\n",
+                        dtimenow(0), from);
        }
 
 #ifdef MHE
-       if (context_find ("mhe")) {
+       if (context_find("mhe")) {
                int i;
-               cp = concat (maildir, "/++", NULL);
-               i = stat (cp, &st);
-               if ((mhe = fopen (cp, "a")) == NULL)
-                       admonish (cp, "unable to append to");
+               cp = concat(maildir, "/++", NULL);
+               i = stat(cp, &st);
+               if ((mhe = fopen(cp, "a")) == NULL)
+                       admonish(cp, "unable to append to");
                else
                        if (i == NOTOK)
-                               chmod (cp, m_gmprot ());
-               free (cp);
+                               chmod(cp, m_gmprot());
+               free(cp);
        }
 #endif /* MHE */
 
        /* Get new format string */
-       nfs = new_fs (form, format, FORMAT);
+       nfs = new_fs(form, format, FORMAT);
 
        if (noisy) {
-               printf ("Incorporating new mail into %s...\n\n", folder);
-               fflush (stdout);
+               printf("Incorporating new mail into %s...\n\n", folder);
+               fflush(stdout);
        }
 
        /*
        ** Get the mail from file (usually mail spool)
        */
-       m_unknown (in);  /* the MAGIC invocation... */
+       m_unknown(in);  /* the MAGIC invocation... */
        hghnum = msgnum = mp->hghmsg;
        for (;;) {
                /*
                ** Check if we need to allocate more space for message status.
                ** If so, then add space for an additional 100 messages.
                */
-               if (msgnum >= mp->hghoff
-                       && !(mp = folder_realloc (mp, mp->lowoff, mp->hghoff + 100))) {
-                       advise (NULL, "unable to allocate folder storage");
+               if (msgnum >= mp->hghoff && !(mp = folder_realloc(mp, mp->lowoff, mp->hghoff + 100))) {
+                       advise(NULL, "unable to allocate folder storage");
                        incerr = NOTOK;
                        break;
                }
 
                /* create scanline for new message */
-               switch (incerr = scan (in, msgnum + 1, msgnum + 1, nfs, width,
+               switch (incerr = scan(in, msgnum + 1, msgnum + 1, nfs, width,
                        msgnum == hghnum && chgflag, 1, NULL, 0L, noisy)) {
                case SCNFAT:
                case SCNEOF:
@@ -407,17 +411,19 @@ main (int argc, char **argv)
 
                case SCNERR:
                        if (aud)
-                               fputs ("inc aborted!\n", aud);
+                               fputs("inc aborted!\n", aud);
                        /* doesn't clean up locks! */
-                       advise (NULL, "aborted!");
+                       advise(NULL, "aborted!");
                        break;
 
                case SCNNUM:
-                       advise (NULL, "BUG in %s, number out of range", invo_name);
+                       advise(NULL, "BUG in %s, number out of range",
+                                       invo_name);
                        break;
 
                default:
-                       advise (NULL, "BUG in %s, scan() botch (%d)", invo_name, incerr);
+                       advise(NULL, "BUG in %s, scan() botch (%d)",
+                                       invo_name, incerr);
                        break;
 
                case SCNMSG:
@@ -426,25 +432,26 @@ main (int argc, char **argv)
                        **  Run the external program hook on the message.
                        */
 
-                       (void)snprintf(b, sizeof (b), "%s/%d", maildir_copy, msgnum + 1);
-                       (void)ext_hook("add-hook", b, (char *)0);
+                       snprintf(b, sizeof (b), "%s/%d", maildir_copy,
+                                       msgnum + 1);
+                       ext_hook("add-hook", b, (char *)0);
 
                        if (aud)
-                               fputs (scanl, aud);
+                               fputs(scanl, aud);
 #ifdef MHE
                        if (mhe)
-                               fputs (scanl, mhe);
+                               fputs(scanl, mhe);
 #endif /* MHE */
                        if (noisy)
-                               fflush (stdout);
+                               fflush(stdout);
                        msgnum++;
                        mp->hghmsg++;
                        mp->nummsg++;
                        if (mp->lowmsg == 0)
                                mp->lowmsg = 1;
-                       clear_msg_flags (mp, msgnum);
-                       set_exists (mp, msgnum);
-                       set_unseen (mp, msgnum);
+                       clear_msg_flags(mp, msgnum);
+                       set_exists(mp, msgnum);
+                       set_unseen(mp, msgnum);
                        mp->msgflags |= SEQMOD;
                        continue;
                }
@@ -458,57 +465,57 @@ main (int argc, char **argv)
        if (incerr < 0) {  /* error */
                if (locked) {
                        GETGROUPPRIVS();  /* Be sure we can unlock mail file */
-                       (void) lkfclose (in, newmail); in = NULL;
+                       (void) lkfclose(in, newmail); in = NULL;
                        DROPGROUPPRIVS();  /*
                                        ** And then return us to normal
                                        ** privileges
                                        */
                } else {
-                       fclose (in); in = NULL;
+                       fclose(in); in = NULL;
                }
-               adios (NULL, "failed");
+               adios(NULL, "failed");
        }
 
        if (aud)
-               fclose (aud);
+               fclose(aud);
 
 #ifdef MHE
        if (mhe)
-               fclose (mhe);
+               fclose(mhe);
 #endif /* MHE */
 
        if (noisy)
-               fflush (stdout);
+               fflush(stdout);
 
        /*
        ** truncate file we are incorporating from
        */
        if (trnflag) {
-               if (stat (newmail, &st) != NOTOK && s1.st_mtime != st.st_mtime)
-                       advise (NULL, "new messages have arrived!\007");
+               if (stat(newmail, &st) != NOTOK && s1.st_mtime != st.st_mtime)
+                       advise(NULL, "new messages have arrived!\007");
                else {
                        int newfd;
-                       if ((newfd = creat (newmail, 0600)) != NOTOK)
-                               close (newfd);
+                       if ((newfd = creat(newmail, 0600)) != NOTOK)
+                               close(newfd);
                        else
-                               admonish (newmail, "error zero'ing");
+                               admonish(newmail, "error zero'ing");
                        unlink(map_name(newmail));
                }
        } else if (noisy) {
-               printf ("%s not zero'd\n", newmail);
+               printf("%s not zero'd\n", newmail);
        }
 
        if (msgnum == hghnum) {
-               admonish (NULL, "no messages incorporated");
+               admonish(NULL, "no messages incorporated");
        } else {
-               context_replace (pfolder, folder);  /* update current folder */
+               context_replace(pfolder, folder);  /* update current folder */
                if (chgflag)
                        mp->curmsg = hghnum + 1;
                mp->hghmsg = msgnum;
                if (mp->lowmsg == 0)
                        mp->lowmsg = 1;
                if (chgflag)  /* sigh... */
-                       seq_setcur (mp, mp->curmsg);
+                       seq_setcur(mp, mp->curmsg);
        }
 
        /*
@@ -516,26 +523,26 @@ main (int argc, char **argv)
        */
        if (locked) {
                GETGROUPPRIVS();  /* Be sure we can unlock mail file */
-               (void) lkfclose (in, newmail); in = NULL;
+               (void) lkfclose(in, newmail); in = NULL;
                DROPGROUPPRIVS();  /* And then return us to normal privileges */
        } else {
-               fclose (in); in = NULL;
+               fclose(in); in = NULL;
        }
 
-       seq_setunseen (mp, 0);  /* set the Unseen-Sequence */
-       seq_save (mp);  /* synchronize sequences   */
-       context_save ();  /* save the context file   */
-       done (0);
+       seq_setunseen(mp, 0);  /* set the Unseen-Sequence */
+       seq_save(mp);  /* synchronize sequences   */
+       context_save();  /* save the context file   */
+       done(0);
        return 1;
 }
 
 static void
-inc_done (int status)
+inc_done(int status)
 {
        if (locked) {
                GETGROUPPRIVS();
                lkfclose(in, newmail);
                DROPGROUPPRIVS();
        }
-       exit (status);
+       exit(status);
 }
index ce07d5d..50854f0 100644 (file)
@@ -29,7 +29,7 @@ static char *geta(void);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int autof = 0;
        char *cp, *pathname, buf[BUFSIZ];
@@ -43,28 +43,28 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
-       arguments = getarguments (invo_name, argc, argv, 0);
+       invo_name = r1bindex(argv[0], '/');
+       arguments = getarguments(invo_name, argc, argv, 0);
        argp = arguments;
 
        check = 0;
 
        while ((dp = *argp++)) {
                if (*dp == '-') {
-                       switch (smatch (++dp, switches)) {
+                       switch (smatch(++dp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (dp, switches);
-                                       done (1);
+                                       ambigsw(dp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown\n", dp);
+                                       adios(NULL, "-%s unknown\n", dp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [switches]", invo_name);
-                                       print_help (buf, switches, 0);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [switches]", invo_name);
+                                       print_help(buf, switches, 0);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case AUTOSW:
                                        autof++;
@@ -75,7 +75,7 @@ main (int argc, char **argv)
                                        continue;
                        }
                } else {
-                       adios (NULL, "%s is invalid argument", dp);
+                       adios(NULL, "%s is invalid argument", dp);
                }
        }
 
@@ -86,7 +86,8 @@ main (int argc, char **argv)
        */
 
        if ((mypath = getenv("HOME")) == (char *)0) {
-               if ((pw = getpwuid(getuid())) == (struct passwd *)0 || *pw->pw_dir == '\0')
+               if ((pw = getpwuid(getuid())) == (struct passwd *)0 ||
+                               *pw->pw_dir == '\0')
                        adios(NULL, "cannot determine your home directory");
                else
                        mypath = pw->pw_dir;
@@ -112,19 +113,19 @@ main (int argc, char **argv)
        ** if it does.
        */
 
-       if (stat (defpath, &st) != NOTOK) {
+       if (stat(defpath, &st) != NOTOK) {
                if (check)
                        done(0);
 
                else if (autof)
-                       adios (NULL, "invocation error");
+                       adios(NULL, "invocation error");
                else
-                       adios (NULL, "You already have an nmh profile, use an editor to modify it");
+                       adios(NULL, "You already have an nmh profile, use an editor to modify it");
        } else if (check) {
                done(1);
        }
 
-       if (!autof && gans ("Do you want help? ", anoyes)) {
+       if (!autof && gans("Do you want help? ", anoyes)) {
                (void)printf(
                 "\n"
                 "Prior to using nmh, it is necessary to have a file in your login\n"
@@ -135,12 +136,12 @@ main (int argc, char **argv)
                 "\n", mypath, mh_profile, mypath);
        }
 
-       cp = concat (mypath, "/", "Mail", NULL);
-       if (stat (cp, &st) != NOTOK) {
+       cp = concat(mypath, "/", "Mail", NULL);
+       if (stat(cp, &st) != NOTOK) {
                if (S_ISDIR(st.st_mode)) {
-                       cp = concat ("You already have the standard nmh directory \"",
+                       cp = concat("You already have the standard nmh directory \"",
                                cp, "\".\nDo you want to use it for nmh? ", NULL);
-                       if (gans (cp, anoyes))
+                       if (gans(cp, anoyes))
                                pathname = "Mail";
                        else
                                goto query;
@@ -149,42 +150,42 @@ main (int argc, char **argv)
                }
        } else {
                if (autof)
-                       printf ("I'm going to create the standard nmh path for you.\n");
+                       printf("I'm going to create the standard nmh path for you.\n");
                else
-                       cp = concat ("Do you want the standard nmh path \"",
+                       cp = concat("Do you want the standard nmh path \"",
                                        mypath, "/", "Mail\"? ", NULL);
-               if (autof || gans (cp, anoyes))
+               if (autof || gans(cp, anoyes))
                        pathname = "Mail";
                else {
 query:
-                       if (gans ("Do you want a path below your login directory? ",
-                                               anoyes)) {
-                               printf ("What is the path?  %s/", mypath);
-                               pathname = geta ();
+                       if (gans("Do you want a path below your login directory? ", anoyes)) {
+                               printf("What is the path?  %s/", mypath);
+                               pathname = geta();
                        } else {
-                               printf ("What is the whole path?  /");
-                               pathname = concat ("/", geta (), NULL);
+                               printf("What is the whole path?  /");
+                               pathname = concat("/", geta(), NULL);
                        }
                }
        }
 
-       chdir (mypath);
-       if (chdir (pathname) == NOTOK) {
-               cp = concat ("\"", pathname, "\" doesn't exist; Create it? ", NULL);
-               if (autof || gans (cp, anoyes))
-                       if (makedir (pathname) == 0)
-                               adios (NULL, "unable to create %s", pathname);
+       chdir(mypath);
+       if (chdir(pathname) == NOTOK) {
+               cp = concat("\"", pathname, "\" doesn't exist; Create it? ",
+                               NULL);
+               if (autof || gans(cp, anoyes))
+                       if (makedir(pathname) == 0)
+                               adios(NULL, "unable to create %s", pathname);
        } else {
-               printf ("[Using existing directory]\n");
+               printf("[Using existing directory]\n");
        }
 
        /*
        ** Add some initial elements to the profile/context list
        */
-       m_defs = (struct node *) mh_xmalloc (sizeof *np);
+       m_defs = (struct node *) mh_xmalloc(sizeof *np);
        np = m_defs;
-       np->n_name = getcpy ("Path");
-       np->n_field = getcpy (pathname);
+       np->n_name = getcpy("Path");
+       np->n_field = getcpy(pathname);
        np->n_context = 0;
        np->n_next = NULL;
 
@@ -192,41 +193,41 @@ query:
        ** If there is a default profile file in the
        ** nmh `etc' directory, then read it also.
        */
-       if ((in = fopen (mh_defaults, "r"))) {
-               readconfig (&np->n_next, in, mh_defaults, 0);
-               fclose (in);
+       if ((in = fopen(mh_defaults, "r"))) {
+               readconfig(&np->n_next, in, mh_defaults, 0);
+               fclose(in);
        }
 
-       ctxpath = getcpy (m_maildir (context = "context"));
+       ctxpath = getcpy(m_maildir(context = "context"));
 
        /* Initialize current folder to default */
-       context_replace (pfolder, defaultfolder);
-       context_save ();
+       context_replace(pfolder, defaultfolder);
+       context_save();
 
        /*
        ** Now write out the initial .mh_profile
        */
-       if ((out = fopen (defpath, "w")) == NULL)
-               adios (defpath, "unable to write");
+       if ((out = fopen(defpath, "w")) == NULL)
+               adios(defpath, "unable to write");
        for (np = m_defs; np; np = np->n_next) {
                if (!np->n_context)
-                       fprintf (out, "%s: %s\n", np->n_name, np->n_field);
+                       fprintf(out, "%s: %s\n", np->n_name, np->n_field);
        }
-       fclose (out);
-       done (0);
+       fclose(out);
+       done(0);
        return 1;
 }
 
 
 static char *
-geta (void)
+geta(void)
 {
        char *cp;
        static char line[BUFSIZ];
 
        fflush(stdout);
        if (fgets(line, sizeof(line), stdin) == NULL)
-               done (1);
+               done(1);
        if ((cp = strchr(line, '\n')))
                *cp = 0;
        return line;
index 9cca0ad..bdd02ad 100644 (file)
@@ -40,12 +40,12 @@ static struct swit switches[] = {
 /*
 ** static prototypes
 */
-static void print_debug (struct msgs *);
-static void seq_printdebug (struct msgs *);
+static void print_debug(struct msgs *);
+static void seq_printdebug(struct msgs *);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int addsw = 0, deletesw = 0, debugsw = 0;
        int listsw = 0, publicsw = -1, zerosw = 0;
@@ -59,12 +59,12 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -72,22 +72,20 @@ main (int argc, char **argv)
        */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown\n", cp);
+                               adios(NULL, "-%s unknown\n", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf),
-                                       "%s [+folder] [msgs] [switches]",
-                                       invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case ADDSW:
                                addsw++;
@@ -104,11 +102,12 @@ main (int argc, char **argv)
 
                        case SEQSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
 
                                /* check if too many sequences specified */
                                if (seqp >= NUMATTRS)
-                                       adios (NULL, "too many sequences (more than %d) specified", NUMATTRS);
+                                       adios(NULL, "too many sequences (more than %d) specified", NUMATTRS);
                                seqs[seqp++] = cp;
                                continue;
 
@@ -133,9 +132,9 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else
                                app_msgarg(&msgs, cp);
        }
@@ -152,20 +151,20 @@ main (int argc, char **argv)
                        listsw++;
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
        if (!msgs.size)
                app_msgarg(&msgs, listsw ? "all" :"cur");
        if (!folder)
-               folder = getfolder (1);
-       maildir = m_maildir (folder);
+               folder = getfolder(1);
+       maildir = m_maildir(folder);
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /* print some general debugging info */
        if (debugsw)
@@ -173,37 +172,38 @@ main (int argc, char **argv)
 
        /* check for empty folder */
        if (mp->nummsg == 0)
-               adios (NULL, "no messages in %s", folder);
+               adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
-               if (!m_convert (mp, msgs.msgs[msgnum]))
-                       done (1);
+               if (!m_convert(mp, msgs.msgs[msgnum]))
+                       done(1);
 
        if (publicsw == 1 && is_readonly(mp))
-               adios (NULL, "folder %s is read-only, so -public not allowed", folder);
+               adios(NULL, "folder %s is read-only, so -public not allowed",
+                               folder);
 
        /*
        ** Make sure at least one sequence has been
        ** specified if we are adding or deleting.
        */
        if (seqp == 0 && (addsw || deletesw))
-               adios (NULL, "-%s requires at least one -sequence argument",
-                       addsw ? "add" : "delete");
+               adios(NULL, "-%s requires at least one -sequence argument",
+                               addsw ? "add" : "delete");
        seqs[seqp] = NULL;
 
        /* Adding messages to sequences */
        if (addsw) {
                for (seqp = 0; seqs[seqp]; seqp++)
-                       if (!seq_addsel (mp, seqs[seqp], publicsw, zerosw))
-                               done (1);
+                       if (!seq_addsel(mp, seqs[seqp], publicsw, zerosw))
+                               done(1);
        }
 
        /* Deleting messages from sequences */
        if (deletesw) {
                for (seqp = 0; seqs[seqp]; seqp++)
-                       if (!seq_delsel (mp, seqs[seqp], publicsw, zerosw))
-                               done (1);
+                       if (!seq_delsel(mp, seqs[seqp], publicsw, zerosw))
+                               done(1);
        }
 
        /* Listing messages in sequences */
@@ -211,22 +211,22 @@ main (int argc, char **argv)
                if (seqp) {
                        /* print the sequences given */
                        for (seqp = 0; seqs[seqp]; seqp++)
-                               seq_print (mp, seqs[seqp]);
+                               seq_print(mp, seqs[seqp]);
                } else {
                        /* else print them all */
-                       seq_printall (mp);
+                       seq_printall(mp);
                }
 
                /* print debugging info about SELECTED messages */
                if (debugsw)
-                       seq_printdebug (mp);
+                       seq_printdebug(mp);
        }
 
-       seq_save (mp);  /* synchronize message sequences */
-       context_replace (pfolder, folder);  /* update current folder */
-       context_save ();  /* save the context file */
-       folder_free (mp);  /* free folder/message structure */
-       done (0);
+       seq_save(mp);  /* synchronize message sequences */
+       context_replace(pfolder, folder);  /* update current folder */
+       context_save();  /* save the context file */
+       folder_free(mp);  /* free folder/message structure */
+       done(0);
        return 1;
 }
 
@@ -235,24 +235,24 @@ main (int argc, char **argv)
 ** Print general debugging info
 */
 static void
-print_debug (struct msgs *mp)
+print_debug(struct msgs *mp)
 {
        char buf[100];
 
-       printf ("invo_name = %s\n", invo_name);
-       printf ("mypath = %s\n", mypath);
-       printf ("defpath = %s\n", defpath);
-       printf ("ctxpath = %s\n", ctxpath);
-       printf ("context flags = %s\n", snprintb (buf, sizeof(buf),
-               (unsigned) ctxflags, DBITS));
-       printf ("foldpath = %s\n", mp->foldpath);
-       printf ("folder flags  = %s\n\n", snprintb(buf, sizeof(buf),
-               (unsigned) mp->msgflags, FBITS));
-       printf ("lowmsg=%d hghmsg=%d nummsg=%d curmsg=%d\n",
-               mp->lowmsg, mp->hghmsg, mp->nummsg, mp->curmsg);
-       printf ("lowsel=%d hghsel=%d numsel=%d\n",
-               mp->lowsel, mp->hghsel, mp->numsel);
-       printf ("lowoff=%d hghoff=%d\n\n", mp->lowoff, mp->hghoff);
+       printf("invo_name = %s\n", invo_name);
+       printf("mypath = %s\n", mypath);
+       printf("defpath = %s\n", defpath);
+       printf("ctxpath = %s\n", ctxpath);
+       printf("context flags = %s\n", snprintb(buf, sizeof(buf),
+                       (unsigned) ctxflags, DBITS));
+       printf("foldpath = %s\n", mp->foldpath);
+       printf("folder flags  = %s\n\n", snprintb(buf, sizeof(buf),
+                       (unsigned) mp->msgflags, FBITS));
+       printf("lowmsg=%d hghmsg=%d nummsg=%d curmsg=%d\n",
+                       mp->lowmsg, mp->hghmsg, mp->nummsg, mp->curmsg);
+       printf("lowsel=%d hghsel=%d numsel=%d\n",
+                       mp->lowsel, mp->hghsel, mp->numsel);
+       printf("lowoff=%d hghoff=%d\n\n", mp->lowoff, mp->hghoff);
 }
 
 
@@ -261,17 +261,14 @@ print_debug (struct msgs *mp)
 ** messages and the sequences they are in.
 */
 static void
-seq_printdebug (struct msgs *mp)
+seq_printdebug(struct msgs *mp)
 {
        int msgnum;
        char buf[100];
 
-       printf ("\n");
+       printf("\n");
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
-               if (is_selected (mp, msgnum))
-                       printf ("%*d: %s\n", DMAXFOLDER, msgnum,
-                               snprintb (buf, sizeof(buf),
-                               (unsigned) mp->msgstats[msgnum - mp->lowoff],
-                               seq_bits (mp)));
+               if (is_selected(mp, msgnum))
+                       printf("%*d: %s\n", DMAXFOLDER, msgnum, snprintb(buf, sizeof(buf), (unsigned) mp->msgstats[msgnum - mp->lowoff], seq_bits(mp)));
        }
 }
index cdec935..e1ca05f 100644 (file)
@@ -96,25 +96,25 @@ static int unlink_infile  = 0;
 static char outfile[BUFSIZ];
 static int unlink_outfile = 0;
 
-static void unlink_done (int) NORETURN;
+static void unlink_done(int) NORETURN;
 
 /* mhbuildsbr.c */
-CT build_mime (char *);
-int output_message (CT, char *);
-int output_message_fp (CT, FILE *, char*);
+CT build_mime(char *);
+int output_message(CT, char *);
+int output_message_fp(CT, FILE *, char*);
 
 /* mhlistsbr.c */
-int list_all_messages (CT *, int, int, int, int);
+int list_all_messages(CT *, int, int, int, int);
 
 /* mhmisc.c */
-void set_endian (void);
+void set_endian(void);
 
 /* mhfree.c */
-void free_content (CT);
+void free_content(CT);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int sizesw = 1, headsw = 1;
        int *icachesw;
@@ -130,18 +130,18 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (cp[0] == '-' && cp[1] == '\0') {
                        if (compfile)
-                               adios (NULL, "cannot specify both standard input and a file");
+                               adios(NULL, "cannot specify both standard input and a file");
                        else
                                compfile = cp;
                        listsw = 0;  /* turn off -list if using std in/out */
@@ -149,20 +149,20 @@ main (int argc, char **argv)
                        break;
                }
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf), "%s [switches] file", invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               snprintf(buf, sizeof(buf), "%s [switches] file", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case RCACHESW:
                                icachesw = &rcachesw;
@@ -171,13 +171,14 @@ main (int argc, char **argv)
                                icachesw = &wcachesw;
                        do_cache: ;
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               switch (*icachesw = smatch (cp, caches)) {
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               switch (*icachesw = smatch(cp, caches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, caches);
-                                       done (1);
+                                       ambigsw(cp, caches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "%s unknown", cp);
+                                       adios(NULL, "%s unknown", cp);
                                default:
                                        break;
                                }
@@ -244,101 +245,105 @@ main (int argc, char **argv)
                        }
                }
                if (compfile)
-                       adios (NULL, "only one composition file allowed");
+                       adios(NULL, "only one composition file allowed");
                else
                        compfile = cp;
        }
 
-       set_endian ();
+       set_endian();
 
-       if ((cp = getenv ("MM_NOASK")) && !strcmp (cp, "1"))
+       if ((cp = getenv("MM_NOASK")) && !strcmp(cp, "1"))
                listsw  = 0;
 
        /*
        ** Check if we've specified an additional profile
        */
-       if ((cp = getenv ("MHBUILD"))) {
-               if ((fp = fopen (cp, "r"))) {
-                       readconfig ((struct node **) 0, fp, cp, 0);
-                       fclose (fp);
+       if ((cp = getenv("MHBUILD"))) {
+               if ((fp = fopen(cp, "r"))) {
+                       readconfig((struct node **) 0, fp, cp, 0);
+                       fclose(fp);
                } else {
-                       admonish ("", "unable to read $MHBUILD profile (%s)", cp);
+                       admonish("", "unable to read $MHBUILD profile (%s)",
+                                       cp);
                }
        }
 
        /*
        ** Read the standard profile setup
        */
-       if ((fp = fopen (cp = etcpath ("mhn.defaults"), "r"))) {
-               readconfig ((struct node **) 0, fp, cp, 0);
-               fclose (fp);
+       if ((fp = fopen(cp = etcpath("mhn.defaults"), "r"))) {
+               readconfig((struct node **) 0, fp, cp, 0);
+               fclose(fp);
        }
 
        /* Check for public cache location */
-       if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
+       if ((cache_public = context_find(nmhcache)) && *cache_public != '/')
                cache_public = NULL;
 
        /* Check for private cache location */
-       if (!(cache_private = context_find (nmhprivcache)))
+       if (!(cache_private = context_find(nmhprivcache)))
                cache_private = ".cache";
-       cache_private = getcpy (m_maildir (cache_private));
+       cache_private = getcpy(m_maildir(cache_private));
 
        /*
        ** Check for storage directory.  If defined, we
        ** will store temporary files there.  Else we
        ** store them in standard nmh directory.
        */
-       if ((cp = context_find (nmhstorage)) && *cp)
-               tmp = concat (cp, "/", invo_name, NULL);
+       if ((cp = context_find(nmhstorage)) && *cp)
+               tmp = concat(cp, "/", invo_name, NULL);
        else
-               tmp = add (m_maildir (invo_name), NULL);
+               tmp = add(m_maildir(invo_name), NULL);
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        /* Check if we have a file to process */
        if (!compfile)
-               adios (NULL, "need to specify a %s composition file", invo_name);
+               adios(NULL, "need to specify a %s composition file",
+                               invo_name);
 
        /*
        ** Process the composition file from standard input.
        */
        if (compfile[0] == '-' && compfile[1] == '\0') {
                /* copy standard input to temporary file */
-               strncpy (infile, m_mktemp(invo_name, NULL, &fp), sizeof(infile));
-               while (fgets (buffer, BUFSIZ, stdin))
-                       fputs (buffer, fp);
-               fclose (fp);
+               strncpy(infile, m_mktemp(invo_name, NULL, &fp),
+                               sizeof(infile));
+               while (fgets(buffer, BUFSIZ, stdin))
+                       fputs(buffer, fp);
+               fclose(fp);
                unlink_infile = 1;
 
                /* build the content structures for MIME message */
-               ct = build_mime (infile);
+               ct = build_mime(infile);
                cts[0] = ct;
                cts[1] = NULL;
 
                /* output MIME message to this temporary file */
-               strncpy (outfile, m_mktemp(invo_name, NULL, &fp_out), sizeof(outfile));
+               strncpy(outfile, m_mktemp(invo_name, NULL, &fp_out),
+                               sizeof(outfile));
                unlink_outfile = 1;
 
                /* output the message */
-               output_message_fp (ct, fp_out, outfile);
+               output_message_fp(ct, fp_out, outfile);
                fclose(fp_out);
 
                /* output the temp file to standard output */
-               if ((fp = fopen (outfile, "r")) == NULL)
-                       adios (outfile, "unable to open");
-               while (fgets (buffer, BUFSIZ, fp))
-                       fputs (buffer, stdout);
-               fclose (fp);
+               if ((fp = fopen(outfile, "r")) == NULL)
+                       adios(outfile, "unable to open");
+               while (fgets(buffer, BUFSIZ, fp))
+                       fputs(buffer, stdout);
+               fclose(fp);
 
-               unlink (infile);
+               unlink(infile);
                unlink_infile = 0;
 
-               unlink (outfile);
+               unlink(outfile);
                unlink_outfile = 0;
 
-               free_content (ct);
-               done (0);
+               free_content(ct);
+               done(0);
        }
 
        /*
@@ -346,7 +351,7 @@ main (int argc, char **argv)
        */
 
        /* build the content structures for MIME message */
-       ct = build_mime (compfile);
+       ct = build_mime(compfile);
        cts[0] = ct;
        cts[1] = NULL;
 
@@ -356,45 +361,45 @@ main (int argc, char **argv)
        unlink_outfile = 1;
 
        /* output the message */
-       output_message_fp (ct, fp_out, outfile);
+       output_message_fp(ct, fp_out, outfile);
        fclose(fp_out);
 
        /*
        ** List the message info
        */
        if (listsw)
-               list_all_messages (cts, headsw, sizesw, verbosw, debugsw);
+               list_all_messages(cts, headsw, sizesw, verbosw, debugsw);
 
        /* Rename composition draft */
-       snprintf (buffer, sizeof(buffer), "%s.orig", m_backup (compfile));
-       if (rename (compfile, buffer) == NOTOK) {
-               adios (compfile, "unable to rename comp draft %s to", buffer);
+       snprintf(buffer, sizeof(buffer), "%s.orig", m_backup(compfile));
+       if (rename(compfile, buffer) == NOTOK) {
+               adios(compfile, "unable to rename comp draft %s to", buffer);
        }
 
        /* Rename output file to take its place */
-       if (rename (outfile, compfile) == NOTOK) {
-               advise (outfile, "unable to rename output %s to", compfile);
-               rename (buffer, compfile);
-               done (1);
+       if (rename(outfile, compfile) == NOTOK) {
+               advise(outfile, "unable to rename output %s to", compfile);
+               rename(buffer, compfile);
+               done(1);
        }
        unlink_outfile = 0;
 
-       free_content (ct);
-       done (0);
+       free_content(ct);
+       done(0);
        return 1;
 }
 
 
 static void
-unlink_done (int status)
+unlink_done(int status)
 {
        /*
        ** Check if we need to remove stray temporary files.
        */
        if (unlink_infile)
-               unlink (infile);
+               unlink(infile);
        if (unlink_outfile)
-               unlink (outfile);
+               unlink(outfile);
 
-       exit (status);
+       exit(status);
 }
index ca69fbe..23163f7 100644 (file)
@@ -68,36 +68,36 @@ static char prefix[] = "----- =_aaaaaaaaaa";
 
 
 /* mhmisc.c */
-int make_intermediates (char *);
-void content_error (char *, CT, char *, ...);
+int make_intermediates(char *);
+void content_error(char *, CT, char *, ...);
 
 /* mhcachesbr.c */
-int find_cache (CT, int, int *, char *, char *, int);
+int find_cache(CT, int, int *, char *, char *, int);
 
 /* ftpsbr.c */
-int ftp_get (char *, char *, char *, char *, char *, char *, int, int);
+int ftp_get(char *, char *, char *, char *, char *, char *, int, int);
 
 /* mhfree.c */
-void free_content (CT);
-void free_ctinfo (CT);
-void free_encoding (CT, int);
+void free_content(CT);
+void free_ctinfo(CT);
+void free_encoding(CT, int);
 
 /*
 ** prototypes
 */
-CT build_mime (char *);
+CT build_mime(char *);
 
 /*
 ** static prototypes
 */
-static int init_decoded_content (CT);
-static char *fgetstr (char *, int, FILE *);
-static int user_content (FILE *, char *, char *, CT *);
-static void set_id (CT, int);
-static int compose_content (CT);
-static int scan_content (CT);
-static int build_headers (CT);
-static char *calculate_digest (CT, int);
+static int init_decoded_content(CT);
+static char *fgetstr(char *, int, FILE *);
+static int user_content(FILE *, char *, char *, CT *);
+static void set_id(CT, int);
+static int compose_content(CT);
+static int scan_content(CT);
+static int build_headers(CT);
+static char *calculate_digest(CT, int);
 
 
 /*
@@ -110,7 +110,7 @@ static char *calculate_digest (CT, int);
 */
 
 CT
-build_mime (char *infile)
+build_mime(char *infile)
 {
        int compnum, state;
        char buf[BUFSIZ], name[NAMESZ];
@@ -120,24 +120,24 @@ build_mime (char *infile)
        CT ct;
        FILE *in;
 
-       umask (~m_gmprot ());
+       umask(~m_gmprot());
 
        /* open the composition draft */
-       if ((in = fopen (infile, "r")) == NULL)
-               adios (infile, "unable to open for reading");
+       if ((in = fopen(infile, "r")) == NULL)
+               adios(infile, "unable to open for reading");
 
        /*
        ** Allocate space for primary (outside) content
        */
-       if ((ct = (CT) calloc (1, sizeof(*ct))) == NULL)
-               adios (NULL, "out of memory");
+       if ((ct = (CT) calloc(1, sizeof(*ct))) == NULL)
+               adios(NULL, "out of memory");
 
        /*
        ** Allocate structure for handling decoded content
        ** for this part.  We don't really need this, but
        ** allocate it to remain consistent.
        */
-       init_decoded_content (ct);
+       init_decoded_content(ct);
 
        /*
        ** Parse some of the header fields in the composition
@@ -145,43 +145,44 @@ build_mime (char *infile)
        ** the new MIME message.
        */
        for (compnum = 1, state = FLD;;) {
-               switch (state = m_getfld (state, name, buf, sizeof(buf), in)) {
+               switch (state = m_getfld(state, name, buf, sizeof(buf), in)) {
                case FLD:
                case FLDPLUS:
                case FLDEOF:
                        compnum++;
 
                        /* abort if draft has Mime-Version header field */
-                       if (!mh_strcasecmp (name, VRSN_FIELD))
-                               adios (NULL, "draft shouldn't contain %s: field", VRSN_FIELD);
+                       if (!mh_strcasecmp(name, VRSN_FIELD))
+                               adios(NULL, "draft shouldn't contain %s: field", VRSN_FIELD);
 
                        /*
                        ** abort if draft has Content-Transfer-Encoding
                        ** header field
                        */
-                       if (!mh_strcasecmp (name, ENCODING_FIELD))
-                               adios (NULL, "draft shouldn't contain %s: field", ENCODING_FIELD);
+                       if (!mh_strcasecmp(name, ENCODING_FIELD))
+                               adios(NULL, "draft shouldn't contain %s: field", ENCODING_FIELD);
 
                        /* ignore any Content-Type fields in the header */
-                       if (!mh_strcasecmp (name, TYPE_FIELD)) {
+                       if (!mh_strcasecmp(name, TYPE_FIELD)) {
                                while (state == FLDPLUS)
-                                       state = m_getfld (state, name, buf,
+                                       state = m_getfld(state, name, buf,
                                                        sizeof(buf), in);
                                goto finish_field;
                        }
 
                        /* get copies of the buffers */
-                       np = add (name, NULL);
-                       vp = add (buf, NULL);
+                       np = add(name, NULL);
+                       vp = add(buf, NULL);
 
                        /* if necessary, get rest of field */
                        while (state == FLDPLUS) {
-                               state = m_getfld (state, name, buf, sizeof(buf), in);
-                               vp = add (buf, vp);  /* add to prev value */
+                               state = m_getfld(state, name, buf,
+                                               sizeof(buf), in);
+                               vp = add(buf, vp);  /* add to prev value */
                        }
 
                        /* Now add the header data to the list */
-                       add_header (ct, np, vp);
+                       add_header(ct, np, vp);
 
 finish_field:
                        /* if this wasn't the last hdr field, then continue */
@@ -190,21 +191,21 @@ finish_field:
                        /* else fall... */
 
                case FILEEOF:
-                       adios (NULL, "draft has empty body -- no directives!");
+                       adios(NULL, "draft has empty body -- no directives!");
                        /* NOTREACHED */
 
                case BODY:
                case BODYEOF:
-                       fseek (in, (long) (-strlen (buf)), SEEK_CUR);
+                       fseek(in, (long) (-strlen(buf)), SEEK_CUR);
                        break;
 
                case LENERR:
                case FMTERR:
-                       adios (NULL, "message format error in component #%d",
+                       adios(NULL, "message format error in component #%d",
                                        compnum);
 
                default:
-                       adios (NULL, "getfld() returned %d", state);
+                       adios(NULL, "getfld() returned %d", state);
                }
                break;
        }
@@ -213,23 +214,23 @@ finish_field:
        ** Now add the MIME-Version header field
        ** to the list of header fields.
        */
-       np = add (VRSN_FIELD, NULL);
-       vp = concat (" ", VRSN_VALUE, "\n", NULL);
-       add_header (ct, np, vp);
+       np = add(VRSN_FIELD, NULL);
+       vp = concat(" ", VRSN_VALUE, "\n", NULL);
+       add_header(ct, np, vp);
 
        /*
        ** We initally assume we will find multiple contents in the
        ** draft.  So create a multipart/mixed content to hold everything.
        ** We can remove this later, if it is not needed.
        */
-       if (get_ctinfo ("multipart/mixed", ct, 0) == NOTOK)
-               done (1);
+       if (get_ctinfo("multipart/mixed", ct, 0) == NOTOK)
+               done(1);
        ct->c_type = CT_MULTIPART;
        ct->c_subtype = MULTI_MIXED;
-       ct->c_file = add (infile, NULL);
+       ct->c_file = add(infile, NULL);
 
-       if ((m = (struct multipart *) calloc (1, sizeof(*m))) == NULL)
-               adios (NULL, "out of memory");
+       if ((m = (struct multipart *) calloc(1, sizeof(*m))) == NULL)
+               adios(NULL, "out of memory");
        ct->c_ctparams = (void *) m;
        pp = &m->mp_parts;
 
@@ -237,19 +238,19 @@ finish_field:
        ** read and parse the composition file
        ** and the directives it contains.
        */
-       while (fgetstr (buf, sizeof(buf) - 1, in)) {
+       while (fgetstr(buf, sizeof(buf) - 1, in)) {
                struct part *part;
                CT p;
 
-               if (user_content (in, infile, buf, &p) == DONE) {
-                       admonish (NULL, "ignoring spurious #end");
+               if (user_content(in, infile, buf, &p) == DONE) {
+                       admonish(NULL, "ignoring spurious #end");
                        continue;
                }
                if (!p)
                        continue;
 
-               if ((part = (struct part *) calloc (1, sizeof(*part))) == NULL)
-                       adios (NULL, "out of memory");
+               if ((part = (struct part *) calloc(1, sizeof(*part))) == NULL)
+                       adios(NULL, "out of memory");
                *pp = part;
                pp = &part->mp_next;
                part->mp_part = p;
@@ -259,11 +260,11 @@ finish_field:
        ** close the composition draft since
        ** it's not needed any longer.
        */
-       fclose (in);
+       fclose(in);
 
        /* check if any contents were found */
        if (!m->mp_parts)
-               adios (NULL, "no content directives found");
+               adios(NULL, "no content directives found");
 
        /*
        ** If only one content was found, then remove and
@@ -281,39 +282,39 @@ finish_field:
                ct->c_first_hf = NULL;
                ct->c_last_hf = NULL;
 
-               free_content (ct);
+               free_content(ct);
                ct = p;
        } else {
-               set_id (ct, 1);
+               set_id(ct, 1);
        }
 
        /*
        ** Fill out, or expand directives.  Parse and execute
        ** commands specified by profile composition strings.
        */
-       compose_content (ct);
+       compose_content(ct);
 
        if ((cp = strchr(prefix, 'a')) == NULL)
-               adios (NULL, "internal error(4)");
+               adios(NULL, "internal error(4)");
 
        /*
        ** Scan the contents.  Choose a transfer encoding, and
        ** check if prefix for multipart boundary clashes with
        ** any of the contents.
        */
-       while (scan_content (ct) == NOTOK) {
+       while (scan_content(ct) == NOTOK) {
                if (*cp < 'z') {
                        (*cp)++;
                } else {
                        if (*++cp == 0)
-                               adios (NULL, "giving up trying to find a unique delimiter string");
+                               adios(NULL, "giving up trying to find a unique delimiter string");
                                else
                                (*cp)++;
                }
        }
 
        /* Build the rest of the header field structures */
-       build_headers (ct);
+       build_headers(ct);
 
        return ct;
 }
@@ -325,12 +326,12 @@ finish_field:
 */
 
 static int
-init_decoded_content (CT ct)
+init_decoded_content(CT ct)
 {
        CE ce;
 
-       if ((ce = (CE) calloc (1, sizeof(*ce))) == NULL)
-               adios (NULL, "out of memory");
+       if ((ce = (CE) calloc(1, sizeof(*ce))) == NULL)
+               adios(NULL, "out of memory");
 
        ct->c_cefile     = ce;
        ct->c_ceopenfnx  = open7Bit;  /* since unencoded */
@@ -342,19 +343,19 @@ init_decoded_content (CT ct)
 
 
 static char *
-fgetstr (char *s, int n, FILE *stream)
+fgetstr(char *s, int n, FILE *stream)
 {
        char *cp, *ep;
 
        for (ep = (cp = s) + n; cp < ep; ) {
                int i;
 
-               if (!fgets (cp, n, stream))
+               if (!fgets(cp, n, stream))
                        return (cp != s ? s : NULL);
                if (cp == s && *cp != '#')
                        return s;
 
-               cp += (i = strlen (cp)) - 1;
+               cp += (i = strlen(cp)) - 1;
                if (i <= 1 || *cp-- != '\n' || *cp != '\\')
                        break;
                *cp = '\0';
@@ -371,7 +372,7 @@ fgetstr (char *s, int n, FILE *stream)
 */
 
 static int
-user_content (FILE *in, char *file, char *buf, CT *ctp)
+user_content(FILE *in, char *file, char *buf, CT *ctp)
 {
        int extrnal, vrsn;
        unsigned char *cp;
@@ -385,22 +386,22 @@ user_content (FILE *in, char *file, char *buf, CT *ctp)
        CT ct;
        CE ce;
 
-       if (buf[0] == '\n' || strcmp (buf, "#\n") == 0) {
+       if (buf[0] == '\n' || strcmp(buf, "#\n") == 0) {
                *ctp = NULL;
                return OK;
        }
 
        /* allocate basic Content structure */
-       if ((ct = (CT) calloc (1, sizeof(*ct))) == NULL)
-               adios (NULL, "out of memory");
+       if ((ct = (CT) calloc(1, sizeof(*ct))) == NULL)
+               adios(NULL, "out of memory");
        *ctp = ct;
 
        /* allocate basic structure for handling decoded content */
-       init_decoded_content (ct);
+       init_decoded_content(ct);
        ce = ct->c_cefile;
 
        ci = &ct->c_ctinfo;
-       set_id (ct, 0);
+       set_id(ct, 0);
 
        /*
        ** Handle inline text.  Check if line
@@ -423,11 +424,11 @@ user_content (FILE *in, char *file, char *buf, CT *ctp)
                        adios("mhbuildsbr", "unable to create temporary file");
 
                /* use a temp file to collect the plain text lines */
-               ce->ce_file = add (cp, NULL);
+               ce->ce_file = add(cp, NULL);
                ce->ce_unlink = 1;
 
                if (buf[0] == '#' && buf[1] == '<') {
-                       strncpy (content, buf + 2, sizeof(content));
+                       strncpy(content, buf + 2, sizeof(content));
                        inlineD = 1;
                        goto rock_and_roll;
                } else {
@@ -435,20 +436,20 @@ user_content (FILE *in, char *file, char *buf, CT *ctp)
                }
 
                /* the directive is implicit */
-               strncpy (content, "text/plain", sizeof(content));
+               strncpy(content, "text/plain", sizeof(content));
                headers = 0;
-               strncpy (buffer, buf[0] != '#' ? buf : buf + 1, sizeof(buffer));
+               strncpy(buffer, buf[0] != '#' ? buf : buf + 1, sizeof(buffer));
                for (;;) {
                        int i;
 
-                       if (headers >= 0 && uprf (buffer, DESCR_FIELD)
-                                       && buffer[i = strlen (DESCR_FIELD)] == ':') {
+                       if (headers >= 0 && uprf(buffer, DESCR_FIELD) &&
+                                       buffer[i=strlen(DESCR_FIELD)] == ':') {
                                headers = 1;
 
 again_descr:
-                               ct->c_descr = add (buffer + i + 1, ct->c_descr);
-                               if (!fgetstr (buffer, sizeof(buffer) - 1, in))
-                                       adios (NULL, "end-of-file after %s: field in plaintext", DESCR_FIELD);
+                               ct->c_descr = add(buffer + i + 1, ct->c_descr);
+                               if (!fgetstr(buffer, sizeof(buffer) - 1, in))
+                                       adios(NULL, "end-of-file after %s: field in plaintext", DESCR_FIELD);
                                switch (buffer[0]) {
                                case ' ':
                                case '\t':
@@ -456,7 +457,7 @@ again_descr:
                                        goto again_descr;
 
                                case '#':
-                                       adios (NULL, "#-directive after %s: field in plaintext", DESCR_FIELD);
+                                       adios(NULL, "#-directive after %s: field in plaintext", DESCR_FIELD);
                                        /* NOTREACHED */
 
                                default:
@@ -464,14 +465,14 @@ again_descr:
                                }
                        }
 
-                       if (headers >= 0 && uprf (buffer, DISPO_FIELD)
-                               && buffer[i = strlen (DISPO_FIELD)] == ':') {
+                       if (headers >= 0 && uprf(buffer, DISPO_FIELD)
+                               && buffer[i = strlen(DISPO_FIELD)] == ':') {
                                headers = 1;
 
 again_dispo:
-                               ct->c_dispo = add (buffer + i + 1, ct->c_dispo);
-                               if (!fgetstr (buffer, sizeof(buffer) - 1, in))
-                                       adios (NULL, "end-of-file after %s: field in plaintext", DISPO_FIELD);
+                               ct->c_dispo = add(buffer + i + 1, ct->c_dispo);
+                               if (!fgetstr(buffer, sizeof(buffer) - 1, in))
+                                       adios(NULL, "end-of-file after %s: field in plaintext", DISPO_FIELD);
                                switch (buffer[0]) {
                                case ' ':
                                case '\t':
@@ -479,7 +480,7 @@ again_dispo:
                                        goto again_dispo;
 
                                case '#':
-                                       adios (NULL, "#-directive after %s: field in plaintext", DISPO_FIELD);
+                                       adios(NULL, "#-directive after %s: field in plaintext", DISPO_FIELD);
                                        /* NOTREACHED */
 
                                default:
@@ -488,12 +489,13 @@ again_dispo:
                        }
 
                        if (headers != 1 || buffer[0] != '\n')
-                               fputs (buffer, out);
+                               fputs(buffer, out);
 
 rock_and_roll:
                        headers = -1;
-                       pos = ftell (in);
-                       if ((cp = fgetstr (buffer, sizeof(buffer) - 1, in)) == NULL)
+                       pos = ftell(in);
+                       if ((cp = fgetstr(buffer, sizeof(buffer) - 1, in))
+                                       == NULL)
                                break;
                        if (buffer[0] == '#') {
                                char *bp;
@@ -507,17 +509,17 @@ rock_and_roll:
                }
 
                if (listsw)
-                       ct->c_end = ftell (out);
-               fclose (out);
+                       ct->c_end = ftell(out);
+               fclose(out);
 
                /* parse content type */
-               if (get_ctinfo (content, ct, inlineD) == NOTOK)
-                       done (1);
+               if (get_ctinfo(content, ct, inlineD) == NOTOK)
+                       done(1);
 
                for (s2i = str2cts; s2i->si_key; s2i++)
-                       if (!mh_strcasecmp (ci->ci_type, s2i->si_key))
+                       if (!mh_strcasecmp(ci->ci_type, s2i->si_key))
                                break;
-               if (!s2i->si_key && !uprf (ci->ci_type, "X-"))
+               if (!s2i->si_key && !uprf(ci->ci_type, "X-"))
                        s2i++;
 
                /*
@@ -525,13 +527,13 @@ rock_and_roll:
                */
                switch (ct->c_type = s2i->si_val) {
                case CT_MESSAGE:
-                       if (!mh_strcasecmp (ci->ci_subtype, "rfc822")) {
+                       if (!mh_strcasecmp(ci->ci_subtype, "rfc822")) {
                                ct->c_encoding = CE_7BIT;
                                goto call_init;
                        }
                        /* else fall... */
                case CT_MULTIPART:
-                       adios (NULL, "it doesn't make sense to define an in-line %s content",
+                       adios(NULL, "it doesn't make sense to define an in-line %s content",
                                        ct->c_type == CT_MESSAGE ? "message" :
                                        "multipart");
                        /* NOTREACHED */
@@ -544,7 +546,7 @@ call_init:
                }
 
                if (cp)
-                       fseek (in, pos, SEEK_SET);
+                       fseek(in, pos, SEEK_SET);
                return OK;
        }
 
@@ -557,12 +559,12 @@ call_init:
        extrnal = (buf[1] == '@');
 
        /* parse directive */
-       if (get_ctinfo (buf + (extrnal ? 2 : 1), ct, 1) == NOTOK)
-               done (1);
+       if (get_ctinfo(buf + (extrnal ? 2 : 1), ct, 1) == NOTOK)
+               done(1);
 
        /* check directive against the list of MIME types */
        for (s2i = str2cts; s2i->si_key; s2i++)
-               if (!mh_strcasecmp (ci->ci_type, s2i->si_key))
+               if (!mh_strcasecmp(ci->ci_type, s2i->si_key))
                        break;
 
        /*
@@ -574,25 +576,20 @@ call_init:
        */
        if (s2i->si_key) {
                if (!ci->ci_subtype)
-                       adios (NULL, "missing subtype in \"#%s\"", ci->ci_type);
+                       adios(NULL, "missing subtype in \"#%s\"", ci->ci_type);
 
                switch (ct->c_type = s2i->si_val) {
                case CT_MULTIPART:
-                       adios (NULL, "use \"#begin ... #end\" instead of \"#%s/%s\"",
-                                  ci->ci_type, ci->ci_subtype);
+                       adios(NULL, "use \"#begin ... #end\" instead of \"#%s/%s\"", ci->ci_type, ci->ci_subtype);
                        /* NOTREACHED */
 
                case CT_MESSAGE:
-                       if (!mh_strcasecmp (ci->ci_subtype, "partial"))
-                               adios (NULL, "sorry, \"#%s/%s\" isn't supported",
-                                          ci->ci_type, ci->ci_subtype);
-                       if (!mh_strcasecmp (ci->ci_subtype, "external-body"))
-                               adios (NULL, "use \"#@type/subtype ... [] ...\" instead of \"#%s/%s\"",
-                                          ci->ci_type, ci->ci_subtype);
+                       if (!mh_strcasecmp(ci->ci_subtype, "partial"))
+                               adios(NULL, "sorry, \"#%s/%s\" isn't supported", ci->ci_type, ci->ci_subtype);
+                       if (!mh_strcasecmp(ci->ci_subtype, "external-body"))
+                               adios(NULL, "use \"#@type/subtype ... [] ...\" instead of \"#%s/%s\"", ci->ci_type, ci->ci_subtype);
 use_forw:
-                       adios (NULL,
-                                  "use \"#forw [+folder] [msgs]\" instead of \"#%s/%s\"",
-                                  ci->ci_type, ci->ci_subtype);
+                       adios(NULL, "use \"#forw [+folder] [msgs]\" instead of \"#%s/%s\"", ci->ci_type, ci->ci_subtype);
                        /* NOTREACHED */
 
                default:
@@ -609,12 +606,11 @@ use_forw:
                        CT p;
 
                        if (!ci->ci_magic)
-                               adios (NULL, "need external information for \"#@%s/%s\"",
-                                          ci->ci_type, ci->ci_subtype);
+                               adios(NULL, "need external information for \"#@%s/%s\"", ci->ci_type, ci->ci_subtype);
                        p = ct;
 
-                       snprintf (buffer, sizeof(buffer), "message/external-body; %s", ci->ci_magic);
-                       free (ci->ci_magic);
+                       snprintf(buffer, sizeof(buffer), "message/external-body; %s", ci->ci_magic);
+                       free(ci->ci_magic);
                        ci->ci_magic = NULL;
 
                        /*
@@ -624,25 +620,26 @@ use_forw:
                        ** structure for the message/external-body to wrap
                        ** it in.
                        */
-                       if ((ct = (CT) calloc (1, sizeof(*ct))) == NULL)
-                               adios (NULL, "out of memory");
+                       if ((ct = (CT) calloc(1, sizeof(*ct))) == NULL)
+                               adios(NULL, "out of memory");
                        *ctp = ct;
                        ci = &ct->c_ctinfo;
-                       if (get_ctinfo (buffer, ct, 0) == NOTOK)
-                               done (1);
+                       if (get_ctinfo(buffer, ct, 0) == NOTOK)
+                               done(1);
                        ct->c_type = CT_MESSAGE;
                        ct->c_subtype = MESSAGE_EXTERNAL;
 
-                       if ((e = (struct exbody *) calloc (1, sizeof(*e))) == NULL)
-                               adios (NULL, "out of memory");
+                       if ((e = (struct exbody *)
+                                       calloc(1, sizeof(*e))) == NULL)
+                               adios(NULL, "out of memory");
                        ct->c_ctparams = (void *) e;
 
                        e->eb_parent = ct;
                        e->eb_content = p;
                        p->c_ctexbody = e;
 
-                       if (params_external (ct, 1) == NOTOK)
-                               done (1);
+                       if (params_external(ct, 1) == NOTOK)
+                               done(1);
 
                        return OK;
                }
@@ -651,19 +648,19 @@ use_forw:
                if (ci->ci_magic) {
                        /* check if specifies command to execute */
                        if (*ci->ci_magic == '|' || *ci->ci_magic == '!') {
-                               for (cp = ci->ci_magic + 1; isspace (*cp); cp++)
+                               for (cp = ci->ci_magic + 1; isspace(*cp); cp++)
                                        continue;
                                if (!*cp)
-                                       adios (NULL, "empty pipe command for #%s directive", ci->ci_type);
-                               cp = add (cp, NULL);
-                               free (ci->ci_magic);
+                                       adios(NULL, "empty pipe command for #%s directive", ci->ci_type);
+                               cp = add(cp, NULL);
+                               free(ci->ci_magic);
                                ci->ci_magic = cp;
                        } else {
                                /* record filename of decoded contents */
                                ce->ce_file = ci->ci_magic;
-                               if (access (ce->ce_file, R_OK) == NOTOK)
-                                       adios ("reading", "unable to access %s for", ce->ce_file);
-                               if (listsw && stat (ce->ce_file, &st) != NOTOK)
+                               if (access(ce->ce_file, R_OK) == NOTOK)
+                                       adios("reading", "unable to access %s for", ce->ce_file);
+                               if (listsw && stat(ce->ce_file, &st) != NOTOK)
                                        ct->c_end = (long) st.st_size;
                                ci->ci_magic = NULL;
                        }
@@ -674,36 +671,37 @@ use_forw:
                ** No [file] argument, so check profile for
                ** method to compose content.
                */
-               snprintf (buffer, sizeof(buffer), "%s-compose-%s/%s",
+               snprintf(buffer, sizeof(buffer), "%s-compose-%s/%s",
                                invo_name, ci->ci_type, ci->ci_subtype);
-               if ((cp = context_find (buffer)) == NULL || *cp == '\0') {
-                       snprintf (buffer, sizeof(buffer), "%s-compose-%s",
+               if ((cp = context_find(buffer)) == NULL || *cp == '\0') {
+                       snprintf(buffer, sizeof(buffer), "%s-compose-%s",
                                        invo_name, ci->ci_type);
-                       if ((cp = context_find (buffer)) == NULL || *cp == '\0') {
-                               content_error (NULL, ct, "don't know how to compose content");
-                               done (1);
+                       if ((cp = context_find(buffer)) == NULL ||
+                                       *cp == '\0') {
+                               content_error(NULL, ct, "don't know how to compose content");
+                               done(1);
                        }
                }
-               ci->ci_magic = add (cp, NULL);
+               ci->ci_magic = add(cp, NULL);
                return OK;
        }
 
        if (extrnal)
-               adios (NULL, "external definition not allowed for \"#%s\"",
+               adios(NULL, "external definition not allowed for \"#%s\"",
                                ci->ci_type);
 
        /*
        ** Message directive
        ** #forw [+folder] [msgs]
        */
-       if (!mh_strcasecmp (ci->ci_type, "forw")) {
+       if (!mh_strcasecmp(ci->ci_type, "forw")) {
                int msgnum;
                char *folder, *arguments[MAXARGS];
                struct msgs *mp;
 
                if (ci->ci_magic) {
-                       ap = brkstring (ci->ci_magic, " ", "\n");
-                       copyip (ap, arguments, MAXARGS);
+                       ap = brkstring(ci->ci_magic, " ", "\n");
+                       copyip(ap, arguments, MAXARGS);
                } else {
                        arguments[0] = "cur";
                        arguments[1] = NULL;
@@ -715,26 +713,26 @@ use_forw:
                        cp = *ap;
                        if (*cp == '+' || *cp == '@') {
                                if (folder)
-                                       adios (NULL, "only one folder per #forw directive");
+                                       adios(NULL, "only one folder per #forw directive");
                                else
-                                       folder = pluspath (cp);
+                                       folder = pluspath(cp);
                        }
                }
 
                /* else, use the current folder */
                if (!folder)
-                       folder = add (getfolder (1), NULL);
+                       folder = add(getfolder(1), NULL);
 
-               if (!(mp = folder_read (folder)))
-                       adios (NULL, "unable to read folder %s", folder);
+               if (!(mp = folder_read(folder)))
+                       adios(NULL, "unable to read folder %s", folder);
                for (ap = arguments; *ap; ap++) {
                        cp = *ap;
                        if (*cp != '+' && *cp != '@')
-                               if (!m_convert (mp, cp))
-                                       done (1);
+                               if (!m_convert(mp, cp))
+                                       done(1);
                }
-               free (folder);
-               free_ctinfo (ct);
+               free(folder);
+               free_ctinfo(ct);
 
                /*
                ** If there is more than one message to include, make this
@@ -744,13 +742,14 @@ use_forw:
                */
                if (mp->numsel > 1) {
                        /* we are forwarding multiple messages */
-                       if (get_ctinfo ("multipart/digest", ct, 0) == NOTOK)
-                               done (1);
+                       if (get_ctinfo("multipart/digest", ct, 0) == NOTOK)
+                               done(1);
                        ct->c_type = CT_MULTIPART;
                        ct->c_subtype = MULTI_DIGEST;
 
-                       if ((m = (struct multipart *) calloc (1, sizeof(*m))) == NULL)
-                               adios (NULL, "out of memory");
+                       if ((m = (struct multipart *)
+                                       calloc(1, sizeof(*m))) == NULL)
+                               adios(NULL, "out of memory");
                        ct->c_ctparams = (void *) m;
                        pp = &m->mp_parts;
 
@@ -760,22 +759,27 @@ use_forw:
                                        CT p;
                                        CE pe;
 
-                                       if ((p = (CT) calloc (1, sizeof(*p))) == NULL)
-                                               adios (NULL, "out of memory");
-                                       init_decoded_content (p);
+                                       if ((p = (CT) calloc(1, sizeof(*p)))
+                                                       == NULL)
+                                               adios(NULL, "out of memory");
+                                       init_decoded_content(p);
                                        pe = p->c_cefile;
-                                       if (get_ctinfo ("message/rfc822", p, 0) == NOTOK)
-                                               done (1);
+                                       if (get_ctinfo("message/rfc822", p, 0)
+                                                       == NOTOK)
+                                               done(1);
                                        p->c_type = CT_MESSAGE;
                                        p->c_subtype = MESSAGE_RFC822;
 
-                                       snprintf (buffer, sizeof(buffer), "%s/%d", mp->foldpath, msgnum);
-                                       pe->ce_file = add (buffer, NULL);
-                                       if (listsw && stat (pe->ce_file, &st) != NOTOK)
+                                       snprintf(buffer, sizeof(buffer),
+                                                       "%s/%d", mp->foldpath,
+                                                       msgnum);
+                                       pe->ce_file = add(buffer, NULL);
+                                       if (listsw && stat(pe->ce_file, &st)
+                                                       != NOTOK)
                                                p->c_end = (long) st.st_size;
 
-                                       if ((part = (struct part *) calloc (1, sizeof(*part))) == NULL)
-                                               adios (NULL, "out of memory");
+                                       if ((part = (struct part *) calloc(1, sizeof(*part))) == NULL)
+                                               adios(NULL, "out of memory");
                                        *pp = part;
                                        pp = &part->mp_next;
                                        part->mp_part = p;
@@ -783,27 +787,28 @@ use_forw:
                        }
                } else {
                        /* we are forwarding one message */
-                       if (get_ctinfo ("message/rfc822", ct, 0) == NOTOK)
-                               done (1);
+                       if (get_ctinfo("message/rfc822", ct, 0) == NOTOK)
+                               done(1);
                        ct->c_type = CT_MESSAGE;
                        ct->c_subtype = MESSAGE_RFC822;
 
                        msgnum = mp->lowsel;
-                       snprintf (buffer, sizeof(buffer), "%s/%d", mp->foldpath, msgnum);
-                       ce->ce_file = add (buffer, NULL);
-                       if (listsw && stat (ce->ce_file, &st) != NOTOK)
+                       snprintf(buffer, sizeof(buffer), "%s/%d",
+                                       mp->foldpath, msgnum);
+                       ce->ce_file = add(buffer, NULL);
+                       if (listsw && stat(ce->ce_file, &st) != NOTOK)
                                ct->c_end = (long) st.st_size;
                }
 
-               folder_free (mp);  /* free folder/message structure */
+               folder_free(mp);  /* free folder/message structure */
                return OK;
        }
 
        /*
        ** #end
        */
-       if (!mh_strcasecmp (ci->ci_type, "end")) {
-               free_content (ct);
+       if (!mh_strcasecmp(ci->ci_type, "end")) {
+               free_content(ct);
                *ctp = NULL;
                return DONE;
        }
@@ -811,67 +816,68 @@ use_forw:
        /*
        ** #begin [ alternative | parallel ]
        */
-       if (!mh_strcasecmp (ci->ci_type, "begin")) {
+       if (!mh_strcasecmp(ci->ci_type, "begin")) {
                if (!ci->ci_magic) {
                        vrsn = MULTI_MIXED;
                        cp = SubMultiPart[vrsn - 1].kv_key;
-               } else if (!mh_strcasecmp (ci->ci_magic, "alternative")) {
+               } else if (!mh_strcasecmp(ci->ci_magic, "alternative")) {
                        vrsn = MULTI_ALTERNATE;
                        cp = SubMultiPart[vrsn - 1].kv_key;
-               } else if (!mh_strcasecmp (ci->ci_magic, "parallel")) {
+               } else if (!mh_strcasecmp(ci->ci_magic, "parallel")) {
                        vrsn = MULTI_PARALLEL;
                        cp = SubMultiPart[vrsn - 1].kv_key;
-               } else if (uprf (ci->ci_magic, "digest")) {
+               } else if (uprf(ci->ci_magic, "digest")) {
                        goto use_forw;
                } else {
                        vrsn = MULTI_UNKNOWN;
                        cp = ci->ci_magic;
                }
 
-               free_ctinfo (ct);
-               snprintf (buffer, sizeof(buffer), "multipart/%s", cp);
-               if (get_ctinfo (buffer, ct, 0) == NOTOK)
-                       done (1);
+               free_ctinfo(ct);
+               snprintf(buffer, sizeof(buffer), "multipart/%s", cp);
+               if (get_ctinfo(buffer, ct, 0) == NOTOK)
+                       done(1);
                ct->c_type = CT_MULTIPART;
                ct->c_subtype = vrsn;
 
-               if ((m = (struct multipart *) calloc (1, sizeof(*m))) == NULL)
-                       adios (NULL, "out of memory");
+               if ((m = (struct multipart *) calloc(1, sizeof(*m))) == NULL)
+                       adios(NULL, "out of memory");
                ct->c_ctparams = (void *) m;
 
                pp = &m->mp_parts;
-               while (fgetstr (buffer, sizeof(buffer) - 1, in)) {
+               while (fgetstr(buffer, sizeof(buffer) - 1, in)) {
                        struct part *part;
                        CT p;
 
-                       if (user_content (in, file, buffer, &p) == DONE) {
+                       if (user_content(in, file, buffer, &p) == DONE) {
                                if (!m->mp_parts)
-                                       adios (NULL, "empty \"#begin ... #end\" sequence");
+                                       adios(NULL, "empty \"#begin ... #end\" sequence");
                                return OK;
                        }
                        if (!p)
                                continue;
 
-                       if ((part = (struct part *) calloc (1, sizeof(*part))) == NULL)
-                               adios (NULL, "out of memory");
+                       if ((part = (struct part *)
+                                       calloc(1, sizeof(*part))) == NULL)
+                               adios(NULL, "out of memory");
                        *pp = part;
                        pp = &part->mp_next;
                        part->mp_part = p;
                }
-               admonish (NULL, "premature end-of-file, missing #end");
+               admonish(NULL, "premature end-of-file, missing #end");
                return OK;
        }
 
        /*
        ** Unknown directive
        */
-       adios (NULL, "unknown directive \"#%s\"", ci->ci_type);
+       adios(NULL, "unknown directive \"#%s\"", ci->ci_type);
        return NOTOK;  /* NOT REACHED */
 }
 
 
 static void
-set_id (CT ct, int top)
+set_id(CT ct, int top)
 {
        char msgid[BUFSIZ];
        static int partno;
@@ -879,14 +885,14 @@ set_id (CT ct, int top)
        static char *msgfmt;
 
        if (clock == 0) {
-               time (&clock);
-               snprintf (msgid, sizeof(msgid), "<%d.%ld.%%d@%s>\n",
+               time(&clock);
+               snprintf(msgid, sizeof(msgid), "<%d.%ld.%%d@%s>\n",
                                (int) getpid(), (long) clock, LocalName());
                partno = 0;
                msgfmt = getcpy(msgid);
        }
-       snprintf (msgid, sizeof(msgid), msgfmt, top ? 0 : ++partno);
-       ct->c_id = getcpy (msgid);
+       snprintf(msgid, sizeof(msgid), msgfmt, top ? 0 : ++partno);
+       ct->c_id = getcpy(msgid);
 }
 
 
@@ -933,7 +939,7 @@ static char ebcdicsafe[0x100] = {
 */
 
 static int
-compose_content (CT ct)
+compose_content(CT ct)
 {
        CE ce = ct->c_cefile;
 
@@ -947,8 +953,9 @@ compose_content (CT ct)
                struct part *part;
 
                if (ct->c_partno) {
-                       snprintf (partnam, sizeof(partnam), "%s.", ct->c_partno);
-                       pp = partnam + strlen (partnam);
+                       snprintf(partnam, sizeof(partnam), "%s.",
+                                       ct->c_partno);
+                       pp = partnam + strlen(partnam);
                } else {
                        pp = partnam;
                }
@@ -958,9 +965,9 @@ compose_content (CT ct)
                                part = part->mp_next, partnum++) {
                        CT p = part->mp_part;
 
-                       sprintf (pp, "%d", partnum);
-                       p->c_partno = add (partnam, NULL);
-                       if (compose_content (p) == NOTOK)
+                       sprintf(pp, "%d", partnum);
+                       p->c_partno = add(partnam, NULL);
+                       if (compose_content(p) == NOTOK)
                                return NOTOK;
                }
 
@@ -991,7 +998,7 @@ compose_content (CT ct)
                }
 
                if (listsw) {
-                       ct->c_end = (partnum = strlen (prefix) + 2) + 2;
+                       ct->c_end = (partnum = strlen(prefix) + 2) + 2;
                        if (ct->c_rfc934)
                                ct->c_end += 1;
 
@@ -1019,13 +1026,13 @@ compose_content (CT ct)
                        char *tfile = NULL;
 
                        if (!(cp = ci->ci_magic))
-                               adios (NULL, "internal error(5)");
+                               adios(NULL, "internal error(5)");
 
                        tfile = m_mktemp2(NULL, invo_name, NULL, NULL);
                        if (tfile == NULL) {
                                adios("mhbuildsbr", "unable to create temporary file");
                        }
-                       ce->ce_file = add (tfile, NULL);
+                       ce->ce_file = add(tfile, NULL);
                        ce->ce_unlink = 1;
 
                        xstdout = 0;
@@ -1051,8 +1058,8 @@ compose_content (CT ct)
                                                char *s = "";
 
                                                for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
-                                                       snprintf (bp, buflen, "%s%s=\"%s\"", s, *ap, *ep);
-                                                       len = strlen (bp);
+                                                       snprintf(bp, buflen, "%s%s=\"%s\"", s, *ap, *ep);
+                                                       len = strlen(bp);
                                                        bp += len;
                                                        buflen -= len;
                                                        s = " ";
@@ -1071,12 +1078,12 @@ compose_content (CT ct)
                                                ** where content should be
                                                ** written
                                                */
-                                               snprintf (bp, buflen, "%s", ce->ce_file);
+                                               snprintf(bp, buflen, "%s", ce->ce_file);
                                                break;
 
                                        case 's':
                                                /* insert content subtype */
-                                               strncpy (bp, ci->ci_subtype, buflen);
+                                               strncpy(bp, ci->ci_subtype, buflen);
                                                break;
 
                                        case '%':
@@ -1089,7 +1096,7 @@ compose_content (CT ct)
                                                buflen--;
                                                continue;
                                        }
-                                       len = strlen (bp);
+                                       len = strlen(bp);
                                        bp += len;
                                        buflen -= len;
                                } else {
@@ -1101,40 +1108,39 @@ raw:
                        }
 
                        if (verbosw)
-                               printf ("composing content %s/%s from command\n\t%s\n",
-                                               ci->ci_type, ci->ci_subtype, buffer);
+                               printf("composing content %s/%s from command\n\t%s\n", ci->ci_type, ci->ci_subtype, buffer);
 
-                       fflush (stdout);  /* not sure if need for -noverbose */
+                       fflush(stdout);  /* not sure if need for -noverbose */
 
                        vec[0] = "/bin/sh";
                        vec[1] = "-c";
                        vec[2] = buffer;
                        vec[3] = NULL;
 
-                       if ((out = fopen (ce->ce_file, "w")) == NULL)
-                               adios (ce->ce_file, "unable to open for writing");
+                       if ((out = fopen(ce->ce_file, "w")) == NULL)
+                               adios(ce->ce_file, "unable to open for writing");
 
                        for (i = 0; (child_id = vfork()) == NOTOK && i > 5; i++)
-                               sleep (5);
+                               sleep(5);
                        switch (child_id) {
                        case NOTOK:
-                               adios ("fork", "unable to fork");
+                               adios("fork", "unable to fork");
                                /* NOTREACHED */
 
                        case OK:
                                if (!xstdout)
-                                       dup2 (fileno (out), 1);
-                               close (fileno (out));
-                               execvp ("/bin/sh", vec);
-                               fprintf (stderr, "unable to exec ");
-                               perror ("/bin/sh");
-                               _exit (-1);
+                                       dup2(fileno(out), 1);
+                               close(fileno(out));
+                               execvp("/bin/sh", vec);
+                               fprintf(stderr, "unable to exec ");
+                               perror("/bin/sh");
+                               _exit(-1);
                                /* NOTREACHED */
 
                        default:
-                               fclose (out);
+                               fclose(out);
                                if (pidXwait(child_id, NULL))
-                                       done (1);
+                                       done(1);
                                break;
                        }
                }
@@ -1143,7 +1149,7 @@ raw:
                if (listsw && ct->c_end == 0L) {
                        struct stat st;
 
-                       if (stat (ce->ce_file, &st) != NOTOK)
+                       if (stat(ce->ce_file, &st) != NOTOK)
                                ct->c_end = (long) st.st_size;
                }
                break;
@@ -1167,7 +1173,7 @@ raw:
 */
 
 static int
-scan_content (CT ct)
+scan_content(CT ct)
 {
        int len;
        int check8bit = 0, contains8bit = 0;  /* check if contains 8bit data */
@@ -1194,8 +1200,10 @@ scan_content (CT ct)
                for (part = m->mp_parts; part; part = part->mp_next) {
                        CT p = part->mp_part;
 
-                       if (scan_content (p) == NOTOK)  /* choose encoding for subpart */
+                       if (scan_content(p) == NOTOK) {
+                               /* choose encoding for subpart */
                                return NOTOK;
+                       }
 
                        /*
                        ** if necessary, enlarge encoding for enclosing
@@ -1203,7 +1211,8 @@ scan_content (CT ct)
                        */
                        if (p->c_encoding == CE_BINARY)
                                ct->c_encoding = CE_BINARY;
-                       if (p->c_encoding == CE_8BIT && ct->c_encoding != CE_BINARY)
+                       if (p->c_encoding == CE_8BIT &&
+                                       ct->c_encoding != CE_BINARY)
                                ct->c_encoding = CE_8BIT;
                }
 
@@ -1268,17 +1277,17 @@ scan_content (CT ct)
        ** Scan the unencoded content
        */
        if (check8bit || checklinelen || checklinespace || checkboundary) {
-               if ((in = fopen (ce->ce_file, "r")) == NULL)
-                       adios (ce->ce_file, "unable to open for reading");
-               len = strlen (prefix);
+               if ((in = fopen(ce->ce_file, "r")) == NULL)
+                       adios(ce->ce_file, "unable to open for reading");
+               len = strlen(prefix);
 
-               while (fgets (buffer, sizeof(buffer) - 1, in)) {
+               while (fgets(buffer, sizeof(buffer) - 1, in)) {
                        /*
                        ** Check for 8bit data.
                        */
                        if (check8bit) {
                                for (cp = buffer; *cp; cp++) {
-                                       if (!isascii (*cp)) {
+                                       if (!isascii(*cp)) {
                                                contains8bit = 1;
                                                /* no need to keep checking */
                                                check8bit = 0;
@@ -1299,7 +1308,7 @@ scan_content (CT ct)
                        /*
                        ** Check line length.
                        */
-                       if (checklinelen && (strlen (buffer) > CPERLIN + 1)) {
+                       if (checklinelen && (strlen(buffer) > CPERLIN + 1)) {
                                linelen = 1;
                                checklinelen = 0;  /* no need to keep checking */
                        }
@@ -1308,8 +1317,8 @@ scan_content (CT ct)
                        ** Check if line ends with a space.
                        */
                        if (checklinespace &&
-                                       (cp = buffer + strlen (buffer) - 2) >
-                                       buffer && isspace (*cp)) {
+                                       (cp = buffer + strlen(buffer) - 2) >
+                                       buffer && isspace(*cp)) {
                                linespace = 1;
                                /* no need to keep checking */
                                checklinespace = 0;
@@ -1319,19 +1328,22 @@ scan_content (CT ct)
                        ** Check if content contains a line that clashes
                        ** with our standard boundary for multipart messages.
                        */
-                       if (checkboundary && buffer[0] == '-' && buffer[1] == '-') {
-                               for (cp = buffer + strlen (buffer) - 1; cp >= buffer; cp--)
-                                       if (!isspace (*cp))
+                       if (checkboundary && buffer[0] == '-' &&
+                                       buffer[1] == '-') {
+                               for (cp = buffer + strlen(buffer) - 1;
+                                               cp >= buffer; cp--)
+                                       if (!isspace(*cp))
                                                break;
                                *++cp = '\0';
-                               if (!strncmp(buffer + 2, prefix, len) && isdigit(buffer[2 + len])) {
+                               if (!strncmp(buffer + 2, prefix, len) &&
+                                               isdigit(buffer[2 + len])) {
                                        boundaryclash = 1;
                                        /* no need to keep checking */
                                        checkboundary = 0;
                                }
                        }
                }
-               fclose (in);
+               fclose(in);
        }
 
        /*
@@ -1353,10 +1365,11 @@ scan_content (CT ct)
 
                        if (contains8bit) {
                                t->tx_charset = CHARSET_UNKNOWN;
-                               *ap = concat ("charset=", write_charset_8bit(), NULL);
+                               *ap = concat("charset=", write_charset_8bit(),
+                                               NULL);
                        } else {
                                t->tx_charset = CHARSET_USASCII;
-                               *ap = add ("charset=us-ascii", NULL);
+                               *ap = add("charset=us-ascii", NULL);
                        }
 
                        cp = strchr(*ap++, '=');
@@ -1365,7 +1378,8 @@ scan_content (CT ct)
                        *ep = cp;
                }
 
-               if (contains8bit || ebcdicunsafe || linelen || linespace || checksw)
+               if (contains8bit || ebcdicunsafe || linelen || linespace ||
+                               checksw)
                        ct->c_encoding = CE_QUOTED;
                else
                        ct->c_encoding = CE_7BIT;
@@ -1373,9 +1387,11 @@ scan_content (CT ct)
 
        case CT_APPLICATION:
                /* For application type, use base64, except when postscript */
-               if (contains8bit || ebcdicunsafe || linelen || linespace || checksw)
-                       ct->c_encoding = (ct->c_subtype == APPLICATION_POSTSCRIPT)
-                               ? CE_QUOTED : CE_BASE64;
+               if (contains8bit || ebcdicunsafe || linelen || linespace ||
+                               checksw)
+                       ct->c_encoding = (ct->c_subtype ==
+                                       APPLICATION_POSTSCRIPT) ?
+                                       CE_QUOTED : CE_BASE64;
                else
                        ct->c_encoding = CE_7BIT;
                break;
@@ -1403,7 +1419,7 @@ scan_content (CT ct)
 */
 
 static int
-build_headers (CT ct)
+build_headers(CT ct)
 {
        int cc, mailbody, len;
        char **ap, **ep;
@@ -1420,8 +1436,9 @@ build_headers (CT ct)
 
                ap = ci->ci_attrs;
                ep = ci->ci_values;
-               snprintf (buffer, sizeof(buffer), "boundary=%s%d", prefix, level++);
-               cp = strchr(*ap++ = add (buffer, NULL), '=');
+               snprintf(buffer, sizeof(buffer), "boundary=%s%d",
+                               prefix, level++);
+               cp = strchr(*ap++ = add(buffer, NULL), '=');
                *ap = NULL;
                *cp++ = '\0';
                *ep = cp;
@@ -1440,37 +1457,37 @@ build_headers (CT ct)
        /*
        ** output the content type and subtype
        */
-       np = add (TYPE_FIELD, NULL);
-       vp = concat (" ", ci->ci_type, "/", ci->ci_subtype, NULL);
+       np = add(TYPE_FIELD, NULL);
+       vp = concat(" ", ci->ci_type, "/", ci->ci_subtype, NULL);
 
        /* keep track of length of line */
-       len = strlen (TYPE_FIELD) + strlen (ci->ci_type)
-               + strlen (ci->ci_subtype) + 3;
+       len = strlen(TYPE_FIELD) + strlen(ci->ci_type) +
+                       strlen(ci->ci_subtype) + 3;
 
-       mailbody = ct->c_type == CT_MESSAGE
-               && ct->c_subtype == MESSAGE_EXTERNAL
-               && ((struct exbody *) ct->c_ctparams)->eb_body;
+       mailbody = ct->c_type == CT_MESSAGE &&
+                       ct->c_subtype == MESSAGE_EXTERNAL &&
+                       ((struct exbody *) ct->c_ctparams)->eb_body;
 
        /*
        ** Append the attribute/value pairs to
        ** the end of the Content-Type line.
        */
        for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
-               if (mailbody && !mh_strcasecmp (*ap, "body"))
+               if (mailbody && !mh_strcasecmp(*ap, "body"))
                        continue;
 
-               vp = add (";", vp);
+               vp = add(";", vp);
                len++;
 
-               snprintf (buffer, sizeof(buffer), "%s=\"%s\"", *ap, *ep);
-               if (len + 1 + (cc = strlen (buffer)) >= CPERLIN) {
-                       vp = add ("\n\t", vp);
+               snprintf(buffer, sizeof(buffer), "%s=\"%s\"", *ap, *ep);
+               if (len + 1 + (cc = strlen(buffer)) >= CPERLIN) {
+                       vp = add("\n\t", vp);
                        len = 8;
                } else {
-                       vp = add (" ", vp);
+                       vp = add(" ", vp);
                        len++;
                }
-               vp = add (buffer, vp);
+               vp = add(buffer, vp);
                len += cc;
        }
 
@@ -1479,45 +1496,45 @@ build_headers (CT ct)
        ** the Content-Type line.
        */
        if (ci->ci_comment) {
-               snprintf (buffer, sizeof(buffer), "(%s)", ci->ci_comment);
-               if (len + 1 + (cc = 2 + strlen (ci->ci_comment)) >= CPERLIN) {
-                       vp = add ("\n\t", vp);
+               snprintf(buffer, sizeof(buffer), "(%s)", ci->ci_comment);
+               if (len + 1 + (cc = 2 + strlen(ci->ci_comment)) >= CPERLIN) {
+                       vp = add("\n\t", vp);
                        len = 8;
                } else {
-                       vp = add (" ", vp);
+                       vp = add(" ", vp);
                        len++;
                }
-               vp = add (buffer, vp);
+               vp = add(buffer, vp);
                len += cc;
        }
-       vp = add ("\n", vp);
-       add_header (ct, np, vp);
+       vp = add("\n", vp);
+       add_header(ct, np, vp);
 
        /*
        ** output the Content-ID, unless disabled by -nocontentid
        */
        if (contentidsw && ct->c_id) {
-               np = add (ID_FIELD, NULL);
-               vp = concat (" ", ct->c_id, NULL);
-               add_header (ct, np, vp);
+               np = add(ID_FIELD, NULL);
+               vp = concat(" ", ct->c_id, NULL);
+               add_header(ct, np, vp);
        }
 
        /*
        ** output the Content-Description
        */
        if (ct->c_descr) {
-               np = add (DESCR_FIELD, NULL);
-               vp = concat (" ", ct->c_descr, NULL);
-               add_header (ct, np, vp);
+               np = add(DESCR_FIELD, NULL);
+               vp = concat(" ", ct->c_descr, NULL);
+               add_header(ct, np, vp);
        }
 
        /*
        ** output the Content-Disposition
        */
        if (ct->c_dispo) {
-               np = add (DISPO_FIELD, NULL);
-               vp = concat (" ", ct->c_dispo, NULL);
-               add_header (ct, np, vp);
+               np = add(DISPO_FIELD, NULL);
+               vp = concat(" ", ct->c_dispo, NULL);
+               add_header(ct, np, vp);
        }
 
 skip_headers:
@@ -1533,9 +1550,10 @@ skip_headers:
        ** output the Content-MD5
        */
        if (checksw) {
-               np = add (MD5_FIELD, NULL);
-               vp = calculate_digest (ct, (ct->c_encoding == CE_QUOTED) ? 1 : 0);
-               add_header (ct, np, vp);
+               np = add(MD5_FIELD, NULL);
+               vp = calculate_digest(ct, (ct->c_encoding == CE_QUOTED) ?
+                               1 : 0);
+               add_header(ct, np, vp);
        }
 
        /*
@@ -1545,50 +1563,50 @@ skip_headers:
        case CE_7BIT:
                /* Nothing to output */
 #if 0
-               np = add (ENCODING_FIELD, NULL);
-               vp = concat (" ", "7bit", "\n", NULL);
-               add_header (ct, np, vp);
+               np = add(ENCODING_FIELD, NULL);
+               vp = concat(" ", "7bit", "\n", NULL);
+               add_header(ct, np, vp);
 #endif
                break;
 
        case CE_8BIT:
                if (ct->c_type == CT_MESSAGE)
-                       adios (NULL, "internal error, invalid encoding");
+                       adios(NULL, "internal error, invalid encoding");
 
-               np = add (ENCODING_FIELD, NULL);
-               vp = concat (" ", "8bit", "\n", NULL);
-               add_header (ct, np, vp);
+               np = add(ENCODING_FIELD, NULL);
+               vp = concat(" ", "8bit", "\n", NULL);
+               add_header(ct, np, vp);
                break;
 
        case CE_QUOTED:
                if (ct->c_type == CT_MESSAGE || ct->c_type == CT_MULTIPART)
-                       adios (NULL, "internal error, invalid encoding");
+                       adios(NULL, "internal error, invalid encoding");
 
-               np = add (ENCODING_FIELD, NULL);
-               vp = concat (" ", "quoted-printable", "\n", NULL);
-               add_header (ct, np, vp);
+               np = add(ENCODING_FIELD, NULL);
+               vp = concat(" ", "quoted-printable", "\n", NULL);
+               add_header(ct, np, vp);
                break;
 
        case CE_BASE64:
                if (ct->c_type == CT_MESSAGE || ct->c_type == CT_MULTIPART)
-                       adios (NULL, "internal error, invalid encoding");
+                       adios(NULL, "internal error, invalid encoding");
 
-               np = add (ENCODING_FIELD, NULL);
-               vp = concat (" ", "base64", "\n", NULL);
-               add_header (ct, np, vp);
+               np = add(ENCODING_FIELD, NULL);
+               vp = concat(" ", "base64", "\n", NULL);
+               add_header(ct, np, vp);
                break;
 
        case CE_BINARY:
                if (ct->c_type == CT_MESSAGE)
-                       adios (NULL, "internal error, invalid encoding");
+                       adios(NULL, "internal error, invalid encoding");
 
-               np = add (ENCODING_FIELD, NULL);
-               vp = concat (" ", "binary", "\n", NULL);
-               add_header (ct, np, vp);
+               np = add(ENCODING_FIELD, NULL);
+               vp = concat(" ", "binary", "\n", NULL);
+               add_header(ct, np, vp);
                break;
 
        default:
-               adios (NULL, "unknown transfer encoding in content");
+               adios(NULL, "unknown transfer encoding in content");
                break;
        }
 
@@ -1606,7 +1624,7 @@ skip_headers:
                        CT p;
 
                        p = part->mp_part;
-                       build_headers (p);
+                       build_headers(p);
                }
        }
                break;
@@ -1616,7 +1634,7 @@ skip_headers:
                        struct exbody *e;
 
                        e = (struct exbody *) ct->c_ctparams;
-                       build_headers (e->eb_content);
+                       build_headers(e->eb_content);
                }
                break;
 
@@ -1633,7 +1651,7 @@ static char nib2b64[0x40+1] =
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 static char *
-calculate_digest (CT ct, int asciiP)
+calculate_digest(CT ct, int asciiP)
 {
        int cc;
        char buffer[BUFSIZ], *vp, *op;
@@ -1645,48 +1663,50 @@ calculate_digest (CT ct, int asciiP)
        CE ce = ct->c_cefile;
 
        /* open content */
-       if ((in = fopen (ce->ce_file, "r")) == NULL)
-               adios (ce->ce_file, "unable to open for reading");
+       if ((in = fopen(ce->ce_file, "r")) == NULL)
+               adios(ce->ce_file, "unable to open for reading");
 
        /* Initialize md5 context */
-       MD5Init (&mdContext);
+       MD5Init(&mdContext);
 
        /* calculate md5 message digest */
        if (asciiP) {
-               while (fgets (buffer, sizeof(buffer) - 1, in)) {
+               while (fgets(buffer, sizeof(buffer) - 1, in)) {
                        char c, *cp;
 
-                       cp = buffer + strlen (buffer) - 1;
+                       cp = buffer + strlen(buffer) - 1;
                        if ((c = *cp) == '\n')
                                *cp = '\0';
 
-                       MD5Update (&mdContext, (unsigned char *) buffer,
-                                          (unsigned int) strlen (buffer));
+                       MD5Update(&mdContext, (unsigned char *) buffer,
+                                       (unsigned int) strlen(buffer));
 
                        if (c == '\n')
-                               MD5Update (&mdContext, (unsigned char *) "\r\n", 2);
+                               MD5Update(&mdContext, (unsigned char *) "\r\n",
+                                                2);
                }
        } else {
-               while ((cc = fread (buffer, sizeof(*buffer), sizeof(buffer), in)) > 0)
-                       MD5Update (&mdContext, (unsigned char *) buffer,
+               while ((cc = fread(buffer, sizeof(*buffer), sizeof(buffer),
+                               in)) > 0)
+                       MD5Update(&mdContext, (unsigned char *) buffer,
                                        (unsigned int) cc);
        }
 
        /* md5 finalization.  Write digest and zero md5 context */
-       MD5Final (digest, &mdContext);
+       MD5Final(digest, &mdContext);
 
        /* close content */
-       fclose (in);
+       fclose(in);
 
        /* print debugging info */
        if (debugsw) {
                unsigned char *ep;
 
-               fprintf (stderr, "MD5 digest=");
+               fprintf(stderr, "MD5 digest=");
                for (ep = (dp = digest) + sizeof(digest) / sizeof(digest[0]);
                        dp < ep; dp++)
-                       fprintf (stderr, "%02x", *dp & 0xff);
-               fprintf (stderr, "\n");
+                       fprintf(stderr, "%02x", *dp & 0xff);
+               fprintf(stderr, "\n");
        }
 
        /* encode the digest using base64 */
@@ -1715,6 +1735,6 @@ calculate_digest (CT ct, int asciiP)
        outbuf[24] = '\0';
 
        /* now make copy and return string */
-       vp = concat (" ", outbuf, "\n", NULL);
+       vp = concat(" ", outbuf, "\n", NULL);
        return vp;
 }
index 100f972..91affaa 100644 (file)
@@ -55,24 +55,24 @@ char *cache_private;
 int pidcheck (int);
 
 /* mhmisc.c */
-int part_ok (CT, int);
-int type_ok (CT, int);
-int make_intermediates (char *);
-void content_error (char *, CT, char *, ...);
-void flush_errors (void);
+int part_ok(CT, int);
+int type_ok(CT, int);
+int make_intermediates(char *);
+void content_error(char *, CT, char *, ...);
+void flush_errors(void);
 
 /*
 ** prototypes
 */
-void cache_all_messages (CT *);
-int find_cache (CT, int, int *, char *, char *, int);
+void cache_all_messages(CT *);
+int find_cache(CT, int, int *, char *, char *, int);
 
 /*
 ** static prototypes
 */
-static void cache_content (CT);
-static int find_cache_aux (int, char *, char *, char *, int);
-static int find_cache_aux2 (char *, char *, char *, int);
+static void cache_content(CT);
+static int find_cache_aux(int, char *, char *, char *, int);
+static int find_cache_aux2(char *, char *, char *, int);
 
 
 /*
@@ -81,23 +81,23 @@ static int find_cache_aux2 (char *, char *, char *, int);
 */
 
 void
-cache_all_messages (CT *cts)
+cache_all_messages(CT *cts)
 {
        CT ct, *ctp;
 
        for (ctp = cts; *ctp; ctp++) {
                ct = *ctp;
-               if (type_ok (ct, 1)) {
-                       cache_content (ct);
+               if (type_ok(ct, 1)) {
+                       cache_content(ct);
                        if (ct->c_fp) {
-                               fclose (ct->c_fp);
+                               fclose(ct->c_fp);
                                ct->c_fp = NULL;
                        }
                        if (ct->c_ceclosefnx)
                                (*ct->c_ceclosefnx) (ct);
                }
        }
-       flush_errors ();
+       flush_errors();
 }
 
 
@@ -106,106 +106,105 @@ cache_all_messages (CT *cts)
 */
 
 static void
-cache_content (CT ct)
+cache_content(CT ct)
 {
        int cachetype;
        char *file, cachefile[BUFSIZ];
        CE ce = ct->c_cefile;
 
        if (!ct->c_id) {
-               advise (NULL, "no %s: field in %s", ID_FIELD, ct->c_file);
+               advise(NULL, "no %s: field in %s", ID_FIELD, ct->c_file);
                return;
        }
 
        if (!ce) {
-               advise (NULL, "unable to decode %s", ct->c_file);
+               advise(NULL, "unable to decode %s", ct->c_file);
                return;
        }
 
 /* THIS NEEDS TO BE FIXED */
 #if 0
        if (ct->c_ceopenfnx == openMail) {
-               advise (NULL, "a radish may no know Greek, but I do...");
+               advise(NULL, "a radish may no know Greek, but I do...");
                return;
        }
 #endif
 
-       if (find_cache (NULL, wcachesw != CACHE_NEVER ? wcachesw : CACHE_ASK,
+       if (find_cache(NULL, wcachesw != CACHE_NEVER ? wcachesw : CACHE_ASK,
                        &cachetype, ct->c_id, cachefile, sizeof(cachefile))
                        == NOTOK) {
-               advise (NULL, "unable to cache %s's contents", ct->c_file);
+               advise(NULL, "unable to cache %s's contents", ct->c_file);
                return;
        }
        if (wcachesw != CACHE_NEVER && wcachesw != CACHE_ASK) {
-               fflush (stdout);
-               fprintf (stderr, "caching message %s as file %s\n", ct->c_file,
-                       cachefile);
+               fflush(stdout);
+               fprintf(stderr, "caching message %s as file %s\n", ct->c_file,
+                               cachefile);
        }
 
        if (ce->ce_file) {
-               int mask = umask (cachetype ? ~m_gmprot () : 0222);
+               int mask = umask(cachetype ? ~m_gmprot() : 0222);
                FILE *fp;
 
                if (debugsw)
-                       fprintf (stderr, "caching by copying %s...\n",
+                       fprintf(stderr, "caching by copying %s...\n",
                                        ce->ce_file);
 
                file = NULL;
                if ((*ct->c_ceopenfnx) (ct, &file) == NOTOK)
                        goto reset_umask;
 
-               if ((fp = fopen (cachefile, "w"))) {
+               if ((fp = fopen(cachefile, "w"))) {
                        int cc;
                        char buffer[BUFSIZ];
                        FILE *gp = ce->ce_fp;
 
-                       fseek (gp, 0L, SEEK_SET);
+                       fseek(gp, 0L, SEEK_SET);
 
-                       while ((cc = fread (buffer, sizeof(*buffer),
+                       while ((cc = fread(buffer, sizeof(*buffer),
                                sizeof(buffer), gp)) > 0)
-                               fwrite (buffer, sizeof(*buffer), cc, fp);
-                       fflush (fp);
+                               fwrite(buffer, sizeof(*buffer), cc, fp);
+                       fflush(fp);
 
-                       if (ferror (gp)) {
-                               admonish (ce->ce_file, "error reading");
-                               unlink (cachefile);
+                       if (ferror(gp)) {
+                               admonish(ce->ce_file, "error reading");
+                               unlink(cachefile);
                        } else {
-                               if (ferror (fp)) {
-                                       admonish (cachefile, "error writing");
-                                       unlink (cachefile);
+                               if (ferror(fp)) {
+                                       admonish(cachefile, "error writing");
+                                       unlink(cachefile);
                                }
                        }
-                       fclose (fp);
+                       fclose(fp);
                } else
-                       content_error (cachefile, ct,
+                       content_error(cachefile, ct,
                                        "unable to fopen for writing");
 reset_umask:
-               umask (mask);
+               umask(mask);
        } else {
                if (debugsw)
-                       fprintf (stderr, "in place caching...\n");
+                       fprintf(stderr, "in place caching...\n");
 
                file = cachefile;
                if ((*ct->c_ceopenfnx) (ct, &file) != NOTOK)
-                       chmod (cachefile, cachetype ? m_gmprot () : 0444);
+                       chmod(cachefile, cachetype ? m_gmprot() : 0444);
        }
 }
 
 
 int
-find_cache (CT ct, int policy, int *writing, char *id,
-       char *buffer, int buflen)
+find_cache(CT ct, int policy, int *writing, char *id, char *buffer, int buflen)
 {
        int status = NOTOK;
 
        if (id == NULL)
                return NOTOK;
-       id = trimcpy (id);
+       id = trimcpy(id);
 
        if (debugsw)
-               fprintf (stderr, "find_cache %s(%d) %s %s\n",
-                       caches[policy].sw, policy,
-                       writing ? "writing" : "reading", id);
+               fprintf(stderr, "find_cache %s(%d) %s %s\n",
+                               caches[policy].sw, policy,
+                               writing ? "writing" : "reading", id);
 
        switch (policy) {
                case CACHE_NEVER:
@@ -214,10 +213,11 @@ find_cache (CT ct, int policy, int *writing, char *id,
 
                case CACHE_ASK:
                case CACHE_PUBLIC:
-                       if (cache_private && !writing
-                               && find_cache_aux (writing ? 2 : 0,
-                               cache_private, id, buffer, buflen) == OK) {
-                               if (access (buffer, R_OK) != NOTOK) {
+                       if (cache_private && !writing &&
+                                       find_cache_aux(writing ? 2 : 0,
+                                       cache_private, id, buffer, buflen)
+                                       == OK) {
+                               if (access(buffer, R_OK) != NOTOK) {
 got_private:
                                        if (writing)
                                                *writing = 1;
@@ -226,9 +226,10 @@ got_it:
                                        break;
                                }
                        }
-                       if (cache_public && find_cache_aux (writing ? 1 : 0,
-                               cache_public, id, buffer, buflen) == OK) {
-                               if (writing || access (buffer, R_OK) != NOTOK) {
+                       if (cache_public && find_cache_aux(writing ? 1 : 0,
+                                       cache_public, id, buffer, buflen)
+                                       == OK) {
+                               if (writing || access(buffer, R_OK) != NOTOK) {
                                        if (writing)
                                                *writing = 0;
                                        goto got_it;
@@ -237,9 +238,10 @@ got_it:
                        break;
 
                case CACHE_PRIVATE:
-                       if (cache_private && find_cache_aux (writing ? 2 : 0,
-                               cache_private, id, buffer, buflen) == OK) {
-                               if (writing || access (buffer, R_OK) != NOTOK)
+                       if (cache_private && find_cache_aux(writing ? 2 : 0,
+                                       cache_private, id, buffer, buflen)
+                                       == OK) {
+                               if (writing || access(buffer, R_OK) != NOTOK)
                                        goto got_private;
                        }
                        break;
@@ -253,7 +255,7 @@ got_it:
                if (xpid) {
                        if (xpid < 0)
                                xpid = -xpid;
-                       pidcheck (pidwait (xpid, NOTOK));
+                       pidcheck(pidwait(xpid, NOTOK));
                        xpid = 0;
                }
 
@@ -263,51 +265,52 @@ got_it:
 
                /* Now, construct query */
                if (writing) {
-                       snprintf (bp, buflen, "Make cached, publically-accessible copy");
+                       snprintf(bp, buflen, "Make cached, publically-accessible copy");
                } else {
                        struct stat st;
 
-                       snprintf (bp, buflen, "Use cached copy");
-                       len = strlen (bp);
+                       snprintf(bp, buflen, "Use cached copy");
+                       len = strlen(bp);
                        bp += len;
                        buflen -= len;
 
                        if (ct->c_partno) {
-                               snprintf (bp, buflen, " of content %s", ct->c_partno);
-                               len = strlen (bp);
+                               snprintf(bp, buflen, " of content %s",
+                                               ct->c_partno);
+                               len = strlen(bp);
                                bp += len;
                                buflen -= len;
                        }
 
-                       stat (buffer, &st);
-                       snprintf (bp, buflen, " (size %lu octets)",
+                       stat(buffer, &st);
+                       snprintf(bp, buflen, " (size %lu octets)",
                                (unsigned long) st.st_size);
                }
-               len = strlen (bp);
+               len = strlen(bp);
                bp += len;
                buflen -= len;
 
-               snprintf (bp, buflen, "\n    in file %s? ", buffer);
+               snprintf(bp, buflen, "\n    in file %s? ", buffer);
 
                /* Now, check answer */
-               if (!getanswer (query))
+               if (!getanswer(query))
                        status = NOTOK;
        }
 
        if (status == OK && writing) {
                if (*writing && strchr(buffer, '/'))
-                       make_intermediates (buffer);
-               unlink (buffer);
+                       make_intermediates(buffer);
+               unlink(buffer);
        }
 
-       free (id);
+       free(id);
        return status;
 }
 
 
 static int
-find_cache_aux (int writing, char *directory, char *id,
-       char *buffer, int buflen)
+find_cache_aux(int writing, char *directory, char *id, char *buffer,
+               int buflen)
 {
        int mask, usemap;
        char mapfile[BUFSIZ], mapname[BUFSIZ];
@@ -316,16 +319,17 @@ find_cache_aux (int writing, char *directory, char *id,
        static time_t clock = 0;
 
 #ifdef BSD42
-       usemap = strchr (id, '/') ? 1 : 0;
+       usemap = strchr(id, '/') ? 1 : 0;
 #else
        usemap = 1;
 #endif
 
        if (debugsw)
-               fprintf (stderr, "find_cache_aux %s usemap=%d\n", directory, usemap);
+               fprintf(stderr, "find_cache_aux %s usemap=%d\n",
+                               directory, usemap);
 
-       snprintf (mapfile, sizeof(mapfile), "%s/cache.map", directory);
-       if (find_cache_aux2 (mapfile, id, mapname, sizeof(mapname)) == OK)
+       snprintf(mapfile, sizeof(mapfile), "%s/cache.map", directory);
+       if (find_cache_aux2(mapfile, id, mapname, sizeof(mapname)) == OK)
                goto done_map;
 
        if (!writing) {
@@ -333,25 +337,25 @@ find_cache_aux (int writing, char *directory, char *id,
                        return NOTOK;
 
 use_raw:
-               snprintf (buffer, buflen, "%s/%s", directory, id);
+               snprintf(buffer, buflen, "%s/%s", directory, id);
                return OK;
        }
 
-       if (!usemap && access (mapfile, W_OK) == NOTOK)
+       if (!usemap && access(mapfile, W_OK) == NOTOK)
                goto use_raw;
 
        if (clock != 0) {
                time_t now;
 
-               time (&now);
+               time(&now);
                if (now > clock)
                        clock = 0;
        } else {
-               pid = getpid ();
+               pid = getpid();
        }
 
        if (clock == 0) {
-               time (&clock);
+               time(&clock);
                partno = 0;
        } else {
                if (partno > 0xff) {
@@ -360,80 +364,79 @@ use_raw:
                }
        }
 
-       snprintf (mapname, sizeof(mapname), "%08x%04x%02x",
-               (unsigned int) (clock & 0xffffffff),
-               (unsigned int) (pid & 0xffff),
-               (unsigned int) (partno++ & 0xff));
+       snprintf(mapname, sizeof(mapname), "%08x%04x%02x",
+                       (unsigned int) (clock & 0xffffffff),
+                       (unsigned int) (pid & 0xffff),
+                       (unsigned int) (partno++ & 0xff));
 
        if (debugsw)
-               fprintf (stderr, "creating mapping %s->%s\n", mapname, id);
+               fprintf(stderr, "creating mapping %s->%s\n", mapname, id);
 
-       make_intermediates (mapfile);
-       mask = umask (writing == 2 ? 0077 : 0);
-       if (!(fp = lkfopen (mapfile, "a")) && errno == ENOENT) {
+       make_intermediates(mapfile);
+       mask = umask(writing == 2 ? 0077 : 0);
+       if (!(fp = lkfopen(mapfile, "a")) && errno == ENOENT) {
                int fd;
 
-               if ((fd = creat (mapfile, 0666)) != NOTOK) {
-                       close (fd);
-                       fp = lkfopen (mapfile, "a");
+               if ((fd = creat(mapfile, 0666)) != NOTOK) {
+                       close(fd);
+                       fp = lkfopen(mapfile, "a");
                }
        }
-       umask (mask);
+       umask(mask);
        if (!fp)
                return NOTOK;
-       fprintf (fp, "%s: %s\n", mapname, id);
-       lkfclose (fp, mapfile);
+       fprintf(fp, "%s: %s\n", mapname, id);
+       lkfclose(fp, mapfile);
 
 done_map:
        if (*mapname == '/')
-               strncpy (buffer, mapname, buflen);
+               strncpy(buffer, mapname, buflen);
        else
-               snprintf (buffer, buflen, "%s/%s", directory, mapname);
+               snprintf(buffer, buflen, "%s/%s", directory, mapname);
        if (debugsw)
-               fprintf (stderr, "use %s\n", buffer);
+               fprintf(stderr, "use %s\n", buffer);
 
        return OK;
 }
 
 
 static int
-find_cache_aux2 (char *mapfile, char *id, char *mapname, int namelen)
+find_cache_aux2(char *mapfile, char *id, char *mapname, int namelen)
 {
        int state;
        char buf[BUFSIZ], name[NAMESZ];
        FILE *fp;
 
-       if (!(fp = lkfopen (mapfile, "r")))
+       if (!(fp = lkfopen(mapfile, "r")))
                return NOTOK;
 
        for (state = FLD;;) {
                int result;
                char *cp, *dp;
 
-               switch (state = m_getfld (state, name, buf, sizeof(buf), fp)) {
+               switch (state = m_getfld(state, name, buf, sizeof(buf), fp)) {
                        case FLD:
                        case FLDPLUS:
                        case FLDEOF:
-                               strncpy (mapname, name, namelen);
+                               strncpy(mapname, name, namelen);
                                if (state != FLDPLUS)
                                        cp = buf;
                                else {
-                                       cp = add (buf, NULL);
+                                       cp = add(buf, NULL);
                                        while (state == FLDPLUS) {
-                                               state = m_getfld (state, name, buf, sizeof(buf), fp);
-                                               cp = add (buf, cp);
+                                               state = m_getfld(state, name, buf, sizeof(buf), fp);
+                                               cp = add(buf, cp);
                                        }
                                }
-                               dp = trimcpy (cp);
+                               dp = trimcpy(cp);
                                if (cp != buf)
-                                       free (cp);
+                                       free(cp);
                                if (debugsw)
-                                       fprintf (stderr, "compare %s to %s <- %s\n", id, dp,
-                                                        mapname);
-                               result = strcmp (id, dp);
-                               free (dp);
+                                       fprintf(stderr, "compare %s to %s <- %s\n", id, dp, mapname);
+                               result = strcmp(id, dp);
+                               free(dp);
                                if (result == 0) {
-                                       lkfclose (fp, mapfile);
+                                       lkfclose(fp, mapfile);
                                        return OK;
                                }
                                if (state != FLDEOF)
@@ -449,6 +452,6 @@ find_cache_aux2 (char *mapfile, char *id, char *mapname, int namelen)
                break;
        }
 
-       lkfclose (fp, mapfile);
+       lkfclose(fp, mapfile);
        return NOTOK;
 }
index 356a4d7..6918e0e 100644 (file)
@@ -18,19 +18,19 @@ CT *cts = NULL;
 /*
 ** prototypes
 */
-void free_content (CT);
-void free_header (CT);
-void free_ctinfo (CT);
-void free_encoding (CT, int);
-void freects_done (int);
+void free_content(CT);
+void free_header(CT);
+void free_ctinfo(CT);
+void free_encoding(CT, int);
+void freects_done(int);
 
 /*
 ** static prototypes
 */
-static void free_text (CT);
-static void free_multi (CT);
-static void free_partial (CT);
-static void free_external (CT);
+static void free_text(CT);
+static void free_multi(CT);
+static void free_partial(CT);
+static void free_external(CT);
 
 
 /*
@@ -38,7 +38,7 @@ static void free_external (CT);
 */
 
 void
-free_content (CT ct)
+free_content(CT ct)
 {
        if (!ct)
                return;
@@ -46,18 +46,18 @@ free_content (CT ct)
        /*
        ** free all the header fields
        */
-       free_header (ct);
+       free_header(ct);
 
        if (ct->c_partno)
-               free (ct->c_partno);
+               free(ct->c_partno);
 
        if (ct->c_vrsn)
-               free (ct->c_vrsn);
+               free(ct->c_vrsn);
 
        if (ct->c_ctline)
-               free (ct->c_ctline);
+               free(ct->c_ctline);
 
-       free_ctinfo (ct);
+       free_ctinfo(ct);
 
        /*
        ** some of the content types have extra
@@ -65,60 +65,60 @@ free_content (CT ct)
        */
        switch (ct->c_type) {
                case CT_MULTIPART:
-                       free_multi (ct);
+                       free_multi(ct);
                        break;
 
                case CT_MESSAGE:
                        switch (ct->c_subtype) {
                                case MESSAGE_PARTIAL:
-                                       free_partial (ct);
+                                       free_partial(ct);
                                        break;
 
                                case MESSAGE_EXTERNAL:
-                                       free_external (ct);
+                                       free_external(ct);
                                        break;
                        }
                        break;
 
                case CT_TEXT:
-                       free_text (ct);
+                       free_text(ct);
                        break;
        }
 
        if (ct->c_showproc)
-               free (ct->c_showproc);
+               free(ct->c_showproc);
        if (ct->c_termproc)
-               free (ct->c_termproc);
+               free(ct->c_termproc);
        if (ct->c_storeproc)
-               free (ct->c_storeproc);
+               free(ct->c_storeproc);
 
        if (ct->c_celine)
-               free (ct->c_celine);
+               free(ct->c_celine);
 
        /* free structures for content encodings */
-       free_encoding (ct, 1);
+       free_encoding(ct, 1);
 
        if (ct->c_id)
-               free (ct->c_id);
+               free(ct->c_id);
        if (ct->c_descr)
-               free (ct->c_descr);
+               free(ct->c_descr);
        if (ct->c_dispo)
-               free (ct->c_dispo);
+               free(ct->c_dispo);
 
        if (ct->c_file) {
                if (ct->c_unlink)
-                       unlink (ct->c_file);
-               free (ct->c_file);
+                       unlink(ct->c_file);
+               free(ct->c_file);
        }
        if (ct->c_fp)
-               fclose (ct->c_fp);
+               fclose(ct->c_fp);
 
        if (ct->c_storage)
-               free (ct->c_storage);
+               free(ct->c_storage);
        if (ct->c_folder)
-               free (ct->c_folder);
+               free(ct->c_folder);
 
-       free (ct);
+       free(ct);
 }
 
 
@@ -128,7 +128,7 @@ free_content (CT ct)
 */
 
 void
-free_header (CT ct)
+free_header(CT ct)
 {
        HF hp1, hp2;
 
@@ -136,9 +136,9 @@ free_header (CT ct)
        while (hp1) {
                hp2 = hp1->next;
 
-               free (hp1->name);
-               free (hp1->value);
-               free (hp1);
+               free(hp1->name);
+               free(hp1->value);
+               free(hp1);
 
                hp1 = hp2;
        }
@@ -149,50 +149,50 @@ free_header (CT ct)
 
 
 void
-free_ctinfo (CT ct)
+free_ctinfo(CT ct)
 {
        char **ap;
        CI ci;
 
        ci = &ct->c_ctinfo;
        if (ci->ci_type) {
-               free (ci->ci_type);
+               free(ci->ci_type);
                ci->ci_type = NULL;
        }
        if (ci->ci_subtype) {
-               free (ci->ci_subtype);
+               free(ci->ci_subtype);
                ci->ci_subtype = NULL;
        }
        for (ap = ci->ci_attrs; *ap; ap++) {
-               free (*ap);
+               free(*ap);
                *ap = NULL;
        }
        if (ci->ci_comment) {
-               free (ci->ci_comment);
+               free(ci->ci_comment);
                ci->ci_comment = NULL;
        }
        if (ci->ci_magic) {
-               free (ci->ci_magic);
+               free(ci->ci_magic);
                ci->ci_magic = NULL;
        }
 }
 
 
 static void
-free_text (CT ct)
+free_text(CT ct)
 {
        struct text *t;
 
        if (!(t = (struct text *) ct->c_ctparams))
                return;
 
-       free ((char *) t);
+       free((char *) t);
        ct->c_ctparams = NULL;
 }
 
 
 static void
-free_multi (CT ct)
+free_multi(CT ct)
 {
        struct multipart *m;
        struct part *part, *next;
@@ -201,24 +201,24 @@ free_multi (CT ct)
                return;
 
        if (m->mp_start)
-               free (m->mp_start);
+               free(m->mp_start);
        if (m->mp_stop)
-               free (m->mp_stop);
+               free(m->mp_stop);
 
        for (part = m->mp_parts; part; part = next) {
                next = part->mp_next;
-               free_content (part->mp_part);
-               free ((char *) part);
+               free_content(part->mp_part);
+               free((char *) part);
        }
        m->mp_parts = NULL;
 
-       free ((char *) m);
+       free((char *) m);
        ct->c_ctparams = NULL;
 }
 
 
 static void
-free_partial (CT ct)
+free_partial(CT ct)
 {
        struct partial *p;
 
@@ -226,26 +226,26 @@ free_partial (CT ct)
                return;
 
        if (p->pm_partid)
-               free (p->pm_partid);
+               free(p->pm_partid);
 
-       free ((char *) p);
+       free((char *) p);
        ct->c_ctparams = NULL;
 }
 
 
 static void
-free_external (CT ct)
+free_external(CT ct)
 {
        struct exbody *e;
 
        if (!(e = (struct exbody *) ct->c_ctparams))
                return;
 
-       free_content (e->eb_content);
+       free_content(e->eb_content);
        if (e->eb_body)
-               free (e->eb_body);
+               free(e->eb_body);
 
-       free ((char *) e);
+       free((char *) e);
        ct->c_ctparams = NULL;
 }
 
@@ -256,7 +256,7 @@ free_external (CT ct)
 */
 
 void
-free_encoding (CT ct, int toplevel)
+free_encoding(CT ct, int toplevel)
 {
        CE ce;
 
@@ -264,19 +264,19 @@ free_encoding (CT ct, int toplevel)
                return;
 
        if (ce->ce_fp) {
-               fclose (ce->ce_fp);
+               fclose(ce->ce_fp);
                ce->ce_fp = NULL;
        }
 
        if (ce->ce_file) {
                if (ce->ce_unlink)
-                       unlink (ce->ce_file);
-               free (ce->ce_file);
+                       unlink(ce->ce_file);
+               free(ce->ce_file);
                ce->ce_file = NULL;
        }
 
        if (toplevel) {
-               free ((char *) ce);
+               free((char *) ce);
                ct->c_cefile = NULL;
        } else {
                ct->c_ceopenfnx = NULL;
@@ -285,13 +285,13 @@ free_encoding (CT ct, int toplevel)
 
 
 void
-freects_done (int status)
+freects_done(int status)
 {
        CT *ctp;
 
        if ((ctp = cts))
                for (; *ctp; ctp++)
-                       free_content (*ctp);
+                       free_content(*ctp);
 
-       exit (status);
+       exit(status);
 }
index 743f22b..48b8f1d 100644 (file)
--- a/uip/mhl.c
+++ b/uip/mhl.c
@@ -9,15 +9,15 @@
 #include <h/mh.h>
 
 /* prototype from mhlsbr.c */
-int mhl (int, char **);
+int mhl(int, char **);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       done (mhl (argc, argv));
+       done(mhl(argc, argv));
        return 1;
 }
index 91b11e7..9ec8f5d 100644 (file)
@@ -92,30 +92,30 @@ int verbosw = 0;
 #define quitser pipeser
 
 /* mhparse.c */
-CT parse_mime (char *);
+CT parse_mime(char *);
 
 /* mhmisc.c */
-int part_ok (CT, int);
-int type_ok (CT, int);
-void set_endian (void);
-void flush_errors (void);
+int part_ok(CT, int);
+int type_ok(CT, int);
+void set_endian(void);
+void flush_errors(void);
 
 /* mhlistsbr.c */
-void list_all_messages (CT *, int, int, int, int);
+void list_all_messages(CT *, int, int, int, int);
 
 /* mhfree.c */
-void free_content (CT);
+void free_content(CT);
 extern CT *cts;
-void freects_done (int) NORETURN;
+void freects_done(int) NORETURN;
 
 /*
 ** static prototypes
 */
-static RETSIGTYPE pipeser (int);
+static RETSIGTYPE pipeser(int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int sizesw = 1, headsw = 1;
        int msgnum, *icachesw;
@@ -131,12 +131,12 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -144,21 +144,20 @@ main (int argc, char **argv)
        */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
-                                               invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case RCACHESW:
                                icachesw = &rcachesw;
@@ -167,13 +166,13 @@ main (int argc, char **argv)
                                icachesw = &wcachesw;
 do_cache:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               switch (*icachesw = smatch (cp, caches)) {
+                                       adios(NULL, "missing argument to %s", argp[-2]);
+                               switch (*icachesw = smatch(cp, caches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, caches);
-                                       done (1);
+                                       ambigsw(cp, caches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "%s unknown", cp);
+                                       adios(NULL, "%s unknown", cp);
                                default:
                                        break;
                                }
@@ -202,26 +201,26 @@ do_cache:
 
                        case PARTSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
                                if (npart >= NPARTS)
-                                       adios (NULL, "too many parts (starting with %s), %d max",
-                                                  cp, NPARTS);
+                                       adios(NULL, "too many parts (starting with %s), %d max", cp, NPARTS);
                                parts[npart++] = cp;
                                continue;
 
                        case TYPESW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
                                if (ntype >= NTYPES)
-                                       adios (NULL, "too many types (starting with %s), %d max",
-                                                  cp, NTYPES);
+                                       adios(NULL, "too many types (starting with %s), %d max", cp, NTYPES);
                                types[ntype++] = cp;
                                continue;
 
                        case FILESW:
                                if (!(cp = *argp++) || (*cp == '-' && cp[1]))
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               file = *cp == '-' ? cp : path (cp, TFILE);
+                                       adios(NULL, "missing argument to %s", argp[-2]);
+                               file = *cp == '-' ? cp : path(cp, TFILE);
                                continue;
 
                        case VERBSW:
@@ -237,53 +236,53 @@ do_cache:
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else
-                               app_msgarg(&msgs, cp);
+                       app_msgarg(&msgs, cp);
        }
 
        /* null terminate the list of acceptable parts/types */
        parts[npart] = NULL;
        types[ntype] = NULL;
 
-       set_endian ();
+       set_endian();
 
        /* Check for public cache location */
-       if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
+       if ((cache_public = context_find(nmhcache)) && *cache_public != '/')
                cache_public = NULL;
 
        /* Check for private cache location */
-       if (!(cache_private = context_find (nmhprivcache)))
+       if (!(cache_private = context_find(nmhprivcache)))
                cache_private = ".cache";
-       cache_private = getcpy (m_maildir (cache_private));
+       cache_private = getcpy(m_maildir(cache_private));
 
        /*
        ** Check for storage directory.  If specified,
        ** then store temporary files there.  Else we
        ** store them in standard nmh directory.
        */
-       if ((cp = context_find (nmhstorage)) && *cp)
-               tmp = concat (cp, "/", invo_name, NULL);
+       if ((cp = context_find(nmhstorage)) && *cp)
+               tmp = concat(cp, "/", invo_name, NULL);
        else
-               tmp = add (m_maildir (invo_name), NULL);
+               tmp = add(m_maildir(invo_name), NULL);
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        if (file && msgs.size)
-               adios (NULL, "cannot specify msg and file at same time!");
+               adios(NULL, "cannot specify msg and file at same time!");
 
        /*
        ** check if message is coming from file
        */
        if (file) {
-               if (!(cts = (CT *) calloc ((size_t) 2, sizeof(*cts))))
-                       adios (NULL, "out of memory");
+               if (!(cts = (CT *) calloc((size_t) 2, sizeof(*cts))))
+                       adios(NULL, "out of memory");
                ctp = cts;
 
-               if ((ct = parse_mime (file)));
+               if ((ct = parse_mime(file)));
                        *ctp++ = ct;
        } else {
                /*
@@ -292,48 +291,48 @@ do_cache:
                if (!msgs.size)
                        app_msgarg(&msgs, "cur");
                if (!folder)
-                       folder = getfolder (1);
-               maildir = m_maildir (folder);
+                       folder = getfolder(1);
+               maildir = m_maildir(folder);
 
-               if (chdir (maildir) == NOTOK)
-                       adios (maildir, "unable to change directory to");
+               if (chdir(maildir) == NOTOK)
+                       adios(maildir, "unable to change directory to");
 
                /* read folder and create message structure */
-               if (!(mp = folder_read (folder)))
-                       adios (NULL, "unable to read folder %s", folder);
+               if (!(mp = folder_read(folder)))
+                       adios(NULL, "unable to read folder %s", folder);
 
                /* check for empty folder */
                if (mp->nummsg == 0)
-                       adios (NULL, "no messages in %s", folder);
+                       adios(NULL, "no messages in %s", folder);
 
                /* parse all the message ranges/sequences and set SELECTED */
                for (msgnum = 0; msgnum < msgs.size; msgnum++)
-                       if (!m_convert (mp, msgs.msgs[msgnum]))
+                       if (!m_convert(mp, msgs.msgs[msgnum]))
                                done (1);
-               seq_setprev (mp);  /* set the previous-sequence */
+               seq_setprev(mp);  /* set the previous-sequence */
 
-               if (!(cts = (CT *) calloc ((size_t) (mp->numsel + 1),
+               if (!(cts = (CT *) calloc((size_t) (mp->numsel + 1),
                                sizeof(*cts))))
-                       adios (NULL, "out of memory");
+                       adios(NULL, "out of memory");
                ctp = cts;
 
                for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
                        if (is_selected(mp, msgnum)) {
                                char *msgnam;
 
-                               msgnam = m_name (msgnum);
-                               if ((ct = parse_mime (msgnam)))
+                               msgnam = m_name(msgnum);
+                               if ((ct = parse_mime(msgnam)))
                                        *ctp++ = ct;
                        }
                }
        }
 
        if (!*cts)
-               done (1);
+               done(1);
 
        userrs = 1;
-       SIGNAL (SIGQUIT, quitser);
-       SIGNAL (SIGPIPE, pipeser);
+       SIGNAL(SIGQUIT, quitser);
+       SIGNAL(SIGPIPE, pipeser);
 
        /*
        ** Get the associated umask for the relevant contents.
@@ -342,8 +341,8 @@ do_cache:
                struct stat st;
 
                ct = *ctp;
-               if (type_ok (ct, 1) && !ct->c_umask) {
-                       if (stat (ct->c_file, &st) != NOTOK)
+               if (type_ok(ct, 1) && !ct->c_umask) {
+                       if (stat(ct->c_file, &st) != NOTOK)
                                ct->c_umask = ~(st.st_mode & 0777);
                        else
                                ct->c_umask = ~m_gmprot();
@@ -353,38 +352,38 @@ do_cache:
        /*
        ** List the message content
        */
-       list_all_messages (cts, headsw, sizesw, verbosw, debugsw);
+       list_all_messages(cts, headsw, sizesw, verbosw, debugsw);
 
        /* Now free all the structures for the content */
        for (ctp = cts; *ctp; ctp++)
-               free_content (*ctp);
+               free_content(*ctp);
 
-       free ((char *) cts);
+       free((char *) cts);
        cts = NULL;
 
        /* If reading from a folder, do some updating */
        if (mp) {
-               context_replace (pfolder, folder);  /* update current folder */
-               seq_setcur (mp, mp->hghsel);  /* update current message */
-               seq_save (mp);  /* synchronize sequences  */
-               context_save ();  /* save the context file  */
+               context_replace(pfolder, folder);  /* update current folder */
+               seq_setcur(mp, mp->hghsel);  /* update current message */
+               seq_save(mp);  /* synchronize sequences  */
+               context_save();  /* save the context file  */
        }
 
-       done (0);
+       done(0);
        return 1;
 }
 
 
 static RETSIGTYPE
-pipeser (int i)
+pipeser(int i)
 {
        if (i == SIGQUIT) {
-               unlink ("core");
-               fflush (stdout);
-               fprintf (stderr, "\n");
-               fflush (stderr);
+               unlink("core");
+               fflush(stdout);
+               fprintf(stderr, "\n");
+               fflush(stderr);
        }
 
-       done (1);
+       done(1);
        /* NOTREACHED */
 }
index 80c9ad6..2b32b64 100644 (file)
 #include <h/utils.h>
 
 /* mhmisc.c */
-int part_ok (CT, int);
-int type_ok (CT, int);
-void flush_errors (void);
+int part_ok(CT, int);
+int type_ok(CT, int);
+void flush_errors(void);
 
 /*
 ** prototypes
 */
-void list_all_messages (CT *, int, int, int, int);
-int list_switch (CT, int, int, int, int);
-int list_content (CT, int, int, int, int);
+void list_all_messages(CT *, int, int, int, int);
+int list_switch(CT, int, int, int, int);
+int list_content(CT, int, int, int, int);
 
 /*
 ** static prototypes
 */
-static void list_single_message (CT, int, int, int);
-static int list_debug (CT);
-static int list_multi (CT, int, int, int, int);
-static int list_partial (CT, int, int, int, int);
-static int list_external (CT, int, int, int, int);
-static int list_application (CT, int, int, int, int);
-static int list_encoding (CT);
+static void list_single_message(CT, int, int, int);
+static int list_debug(CT);
+static int list_multi(CT, int, int, int, int);
+static int list_partial(CT, int, int, int, int);
+static int list_external(CT, int, int, int, int);
+static int list_application(CT, int, int, int, int);
+static int list_encoding(CT);
 
 
 /*
@@ -61,19 +61,20 @@ static int list_encoding (CT);
 */
 
 void
-list_all_messages (CT *cts, int headers, int realsize, int verbose, int debug)
+list_all_messages(CT *cts, int headers, int realsize, int verbose, int debug)
 {
        CT ct, *ctp;
 
        if (headers)
-               printf (LSTFMT1, "msg", "part", "type/subtype", "size", "description");
+               printf(LSTFMT1, "msg", "part", "type/subtype", "size",
+                               "description");
 
        for (ctp = cts; *ctp; ctp++) {
                ct = *ctp;
-               list_single_message (ct, realsize, verbose, debug);
+               list_single_message(ct, realsize, verbose, debug);
        }
 
-       flush_errors ();
+       flush_errors();
 }
 
 
@@ -82,13 +83,13 @@ list_all_messages (CT *cts, int headers, int realsize, int verbose, int debug)
 */
 
 static void
-list_single_message (CT ct, int realsize, int verbose, int debug)
+list_single_message(CT ct, int realsize, int verbose, int debug)
 {
-       if (type_ok (ct, 1)) {
-               umask (ct->c_umask);
-               list_switch (ct, 1, realsize, verbose, debug);
+       if (type_ok(ct, 1)) {
+               umask(ct->c_umask);
+               list_switch(ct, 1, realsize, verbose, debug);
                if (ct->c_fp) {
-                       fclose (ct->c_fp);
+                       fclose(ct->c_fp);
                        ct->c_fp = NULL;
                }
                if (ct->c_ceclosefnx)
@@ -102,26 +103,33 @@ list_single_message (CT ct, int realsize, int verbose, int debug)
 */
 
 int
-list_switch (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_switch(CT ct, int toplevel, int realsize, int verbose, int debug)
 {
        switch (ct->c_type) {
                case CT_MULTIPART:
-                       return list_multi (ct, toplevel, realsize, verbose, debug);
+                       return list_multi(ct, toplevel, realsize, verbose,
+                                       debug);
                        break;
 
                case CT_MESSAGE:
                        switch (ct->c_subtype) {
                                case MESSAGE_PARTIAL:
-                                       return list_partial (ct, toplevel, realsize, verbose, debug);
+                                       return list_partial(ct, toplevel,
+                                                       realsize, verbose,
+                                                       debug);
                                        break;
 
                                case MESSAGE_EXTERNAL:
-                                       return list_external (ct, toplevel, realsize, verbose, debug);
+                                       return list_external(ct, toplevel,
+                                                       realsize, verbose,
+                                                       debug);
                                        break;
 
                                case MESSAGE_RFC822:
                                default:
-                                       return list_content (ct, toplevel, realsize, verbose, debug);
+                                       return list_content(ct, toplevel,
+                                                       realsize, verbose,
+                                                       debug);
                                        break;
                        }
                        break;
@@ -130,16 +138,18 @@ list_switch (CT ct, int toplevel, int realsize, int verbose, int debug)
                case CT_AUDIO:
                case CT_IMAGE:
                case CT_VIDEO:
-                       return list_content (ct, toplevel, realsize, verbose, debug);
+                       return list_content(ct, toplevel, realsize, verbose,
+                                       debug);
                        break;
 
                case CT_APPLICATION:
-                       return list_application (ct, toplevel, realsize, verbose, debug);
+                       return list_application(ct, toplevel, realsize,
+                                       verbose, debug);
                        break;
 
                default:
                        /* list_debug (ct); */
-                       adios (NULL, "unknown content type %d", ct->c_type);
+                       adios(NULL, "unknown content type %d", ct->c_type);
                        break;
        }
 
@@ -154,17 +164,17 @@ list_switch (CT ct, int toplevel, int realsize, int verbose, int debug)
 */
 
 int
-list_content (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_content(CT ct, int toplevel, int realsize, int verbose, int debug)
 {
        unsigned long size;
        char *cp, buffer[BUFSIZ];
        CI ci = &ct->c_ctinfo;
 
-       printf (toplevel > 0 ? LSTFMT2a : toplevel < 0 ? "part " : "     ",
-               atoi (r1bindex (empty (ct->c_file), '/')));
-       snprintf (buffer, sizeof(buffer), "%s/%s", empty (ci->ci_type),
-               empty (ci->ci_subtype));
-       printf (LSTFMT2b, empty (ct->c_partno), buffer);
+       printf(toplevel > 0 ? LSTFMT2a : toplevel < 0 ? "part " : "     ",
+                       atoi(r1bindex(empty(ct->c_file), '/')));
+       snprintf(buffer, sizeof(buffer), "%s/%s", empty(ci->ci_type),
+                       empty(ci->ci_subtype));
+       printf(LSTFMT2b, empty(ct->c_partno), buffer);
 
        if (ct->c_cesizefnx && realsize)
                size = (*ct->c_cesizefnx) (ct);
@@ -180,30 +190,30 @@ list_content (CT ct, int toplevel, int realsize, int verbose, int debug)
        switch (*cp) {
                case ' ':
                        if (size > 0 || ct->c_encoding != CE_EXTERNAL)
-                               printf (LSTFMT2c1, size);
+                               printf(LSTFMT2c1, size);
                        else
-                               printf (LSTFMT2c4);
+                               printf(LSTFMT2c4);
                        break;
 
                default:
-                       printf (LSTFMT2c2, size, *cp);
+                       printf(LSTFMT2c2, size, *cp);
                        break;
 
                case '\0':
-                       printf (LSTFMT2c3);
+                       printf(LSTFMT2c3);
        }
 
        /* print Content-Description */
        if (ct->c_descr) {
                char *dp;
 
-               dp = trimcpy (cp = add (ct->c_descr, NULL));
-               free (cp);
-               printf (LSTFMT2d1, dp);
-               free (dp);
+               dp = trimcpy(cp = add(ct->c_descr, NULL));
+               free(cp);
+               printf(LSTFMT2d1, dp);
+               free(dp);
        }
 
-       printf ("\n");
+       printf("\n");
 
        /*
        ** If verbose, print any RFC-822 comments in the
@@ -212,15 +222,15 @@ list_content (CT ct, int toplevel, int realsize, int verbose, int debug)
        if (verbose && ci->ci_comment) {
                char *dp;
 
-               dp = trimcpy (cp = add (ci->ci_comment, NULL));
-               free (cp);
-               snprintf (buffer, sizeof(buffer), "(%s)", dp);
-               free (dp);
-               printf (LSTFMT2d2, buffer);
+               dp = trimcpy(cp = add(ci->ci_comment, NULL));
+               free(cp);
+               snprintf(buffer, sizeof(buffer), "(%s)", dp);
+               free(dp);
+               printf(LSTFMT2d2, buffer);
        }
 
        if (debug)
-               list_debug (ct);
+               list_debug(ct);
 
        return OK;
 }
@@ -231,64 +241,65 @@ list_content (CT ct, int toplevel, int realsize, int verbose, int debug)
 */
 
 static int
-list_debug (CT ct)
+list_debug(CT ct)
 {
        char **ap, **ep;
        CI ci = &ct->c_ctinfo;
 
-       fflush (stdout);
-       fprintf (stderr, "  partno \"%s\"\n", empty (ct->c_partno));
+       fflush(stdout);
+       fprintf(stderr, "  partno \"%s\"\n", empty(ct->c_partno));
 
        /* print MIME-Version line */
        if (ct->c_vrsn)
-               fprintf (stderr, "  %s:%s\n", VRSN_FIELD, ct->c_vrsn);
+               fprintf(stderr, "  %s:%s\n", VRSN_FIELD, ct->c_vrsn);
 
        /* print Content-Type line */
        if (ct->c_ctline)
-               fprintf (stderr, "  %s:%s\n", TYPE_FIELD, ct->c_ctline);
+               fprintf(stderr, "  %s:%s\n", TYPE_FIELD, ct->c_ctline);
 
        /* print parsed elements of content type */
-       fprintf (stderr, "    type    \"%s\"\n", empty (ci->ci_type));
-       fprintf (stderr, "    subtype \"%s\"\n", empty (ci->ci_subtype));
-       fprintf (stderr, "    comment \"%s\"\n", empty (ci->ci_comment));
-       fprintf (stderr, "    magic   \"%s\"\n", empty (ci->ci_magic));
+       fprintf(stderr, "    type    \"%s\"\n", empty(ci->ci_type));
+       fprintf(stderr, "    subtype \"%s\"\n", empty(ci->ci_subtype));
+       fprintf(stderr, "    comment \"%s\"\n", empty(ci->ci_comment));
+       fprintf(stderr, "    magic   \"%s\"\n", empty(ci->ci_magic));
 
        /* print parsed parameters attached to content type */
-       fprintf (stderr, "    parameters\n");
+       fprintf(stderr, "    parameters\n");
        for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++)
-               fprintf (stderr, "      %s=\"%s\"\n", *ap, *ep);
+               fprintf(stderr, "      %s=\"%s\"\n", *ap, *ep);
 
        /* print internal flags for type/subtype */
-       fprintf (stderr, "    type 0x%x subtype 0x%x params 0x%x\n",
-                ct->c_type, ct->c_subtype,
-                (unsigned int)(unsigned long) ct->c_ctparams);
+       fprintf(stderr, "    type 0x%x subtype 0x%x params 0x%x\n",
+                        ct->c_type, ct->c_subtype,
+                        (unsigned int)(unsigned long) ct->c_ctparams);
 
-       fprintf (stderr, "    showproc  \"%s\"\n", empty (ct->c_showproc));
-       fprintf (stderr, "    termproc  \"%s\"\n", empty (ct->c_termproc));
-       fprintf (stderr, "    storeproc \"%s\"\n", empty (ct->c_storeproc));
+       fprintf(stderr, "    showproc  \"%s\"\n", empty(ct->c_showproc));
+       fprintf(stderr, "    termproc  \"%s\"\n", empty(ct->c_termproc));
+       fprintf(stderr, "    storeproc \"%s\"\n", empty(ct->c_storeproc));
 
        /* print transfer encoding information */
        if (ct->c_celine)
-               fprintf (stderr, "  %s:%s", ENCODING_FIELD, ct->c_celine);
+               fprintf(stderr, "  %s:%s", ENCODING_FIELD, ct->c_celine);
 
        /* print internal flags for transfer encoding */
-       fprintf (stderr, "    transfer encoding 0x%x params 0x%x\n",
-                ct->c_encoding, (unsigned int)(unsigned long) ct->c_cefile);
+       fprintf(stderr, "    transfer encoding 0x%x params 0x%x\n",
+                       ct->c_encoding,
+                       (unsigned int)(unsigned long) ct->c_cefile);
 
        /* print Content-ID */
        if (ct->c_id)
-               fprintf (stderr, "  %s:%s", ID_FIELD, ct->c_id);
+               fprintf(stderr, "  %s:%s", ID_FIELD, ct->c_id);
 
        /* print Content-Description */
        if (ct->c_descr)
-               fprintf (stderr, "  %s:%s", DESCR_FIELD, ct->c_descr);
+               fprintf(stderr, "  %s:%s", DESCR_FIELD, ct->c_descr);
 
-       fprintf (stderr, "    read fp 0x%x file \"%s\" begin %ld end %ld\n",
-               (unsigned int)(unsigned long) ct->c_fp, empty (ct->c_file),
-               ct->c_begin, ct->c_end);
+       fprintf(stderr, "    read fp 0x%x file \"%s\" begin %ld end %ld\n",
+                       (unsigned int)(unsigned long) ct->c_fp,
+                       empty(ct->c_file), ct->c_begin, ct->c_end);
 
        /* print more information about transfer encoding */
-       list_encoding (ct);
+       list_encoding(ct);
 
        return OK;
 }
@@ -301,20 +312,20 @@ list_debug (CT ct)
 */
 
 static int
-list_multi (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_multi(CT ct, int toplevel, int realsize, int verbose, int debug)
 {
        struct multipart *m = (struct multipart *) ct->c_ctparams;
        struct part *part;
 
        /* list the content for toplevel of this multipart */
-       list_content (ct, toplevel, realsize, verbose, debug);
+       list_content(ct, toplevel, realsize, verbose, debug);
 
        /* now list for all the subparts */
        for (part = m->mp_parts; part; part = part->mp_next) {
                CT p = part->mp_part;
 
-               if (part_ok (p, 1) && type_ok (p, 1))
-                       list_switch (p, 0, realsize, verbose, debug);
+               if (part_ok(p, 1) && type_ok(p, 1))
+                       list_switch(p, 0, realsize, verbose, debug);
        }
 
        return OK;
@@ -326,17 +337,17 @@ list_multi (CT ct, int toplevel, int realsize, int verbose, int debug)
 */
 
 static int
-list_partial (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_partial(CT ct, int toplevel, int realsize, int verbose, int debug)
 {
        struct partial *p = (struct partial *) ct->c_ctparams;
 
-       list_content (ct, toplevel, realsize, verbose, debug);
+       list_content(ct, toplevel, realsize, verbose, debug);
        if (verbose) {
-               printf ("\t     [message %s, part %d",
+               printf("\t     [message %s, part %d",
                                p->pm_partid, p->pm_partno);
                if (p->pm_maxno)
-                       printf (" of %d", p->pm_maxno);
-               printf ("]\n");
+                       printf(" of %d", p->pm_maxno);
+               printf("]\n");
        }
 
        return OK;
@@ -348,7 +359,7 @@ list_partial (CT ct, int toplevel, int realsize, int verbose, int debug)
 */
 
 static int
-list_external (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_external(CT ct, int toplevel, int realsize, int verbose, int debug)
 {
        struct exbody *e = (struct exbody *) ct->c_ctparams;
 
@@ -356,37 +367,37 @@ list_external (CT ct, int toplevel, int realsize, int verbose, int debug)
         * First list the information for the
         * message/external content itself.
         */
-       list_content (ct, toplevel, realsize, verbose, debug);
+       list_content(ct, toplevel, realsize, verbose, debug);
 
        if (verbose) {
                if (e->eb_name)
-                       printf ("\t     name=\"%s\"\n", e->eb_name);
+                       printf("\t     name=\"%s\"\n", e->eb_name);
                if (e->eb_dir)
-                       printf ("\t     directory=\"%s\"\n", e->eb_dir);
+                       printf("\t     directory=\"%s\"\n", e->eb_dir);
                if (e->eb_site)
-                       printf ("\t     site=\"%s\"\n", e->eb_site);
+                       printf("\t     site=\"%s\"\n", e->eb_site);
                if (e->eb_server)
-                       printf ("\t     server=\"%s\"\n", e->eb_server);
+                       printf("\t     server=\"%s\"\n", e->eb_server);
                if (e->eb_subject)
-                       printf ("\t     subject=\"%s\"\n", e->eb_subject);
+                       printf("\t     subject=\"%s\"\n", e->eb_subject);
 
                /* This must be defined */
                printf("\t     access-type=\"%s\"\n", e->eb_access);
 
                if (e->eb_mode)
-                       printf ("\t     mode=\"%s\"\n", e->eb_mode);
+                       printf("\t     mode=\"%s\"\n", e->eb_mode);
                if (e->eb_permission)
-                       printf ("\t     permission=\"%s\"\n", e->eb_permission);
+                       printf("\t     permission=\"%s\"\n", e->eb_permission);
 
                if (e->eb_flags == NOTOK)
-                       printf ("\t     [service unavailable]\n");
+                       printf("\t     [service unavailable]\n");
        }
 
        /*
        ** Now list the information for the external content
        ** to which this content points.
        */
-       list_content (e->eb_content, 0, realsize, verbose, debug);
+       list_content(e->eb_content, 0, realsize, verbose, debug);
 
        return OK;
 }
@@ -397,15 +408,15 @@ list_external (CT ct, int toplevel, int realsize, int verbose, int debug)
 */
 
 static int
-list_application (CT ct, int toplevel, int realsize, int verbose, int debug)
+list_application(CT ct, int toplevel, int realsize, int verbose, int debug)
 {
-       list_content (ct, toplevel, realsize, verbose, debug);
+       list_content(ct, toplevel, realsize, verbose, debug);
        if (verbose) {
                char **ap, **ep;
                CI ci = &ct->c_ctinfo;
 
                for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++)
-                       printf ("\t     %s=\"%s\"\n", *ap, *ep);
+                       printf("\t     %s=\"%s\"\n", *ap, *ep);
        }
 
        return OK;
@@ -418,12 +429,12 @@ list_application (CT ct, int toplevel, int realsize, int verbose, int debug)
 */
 
 static int
-list_encoding (CT ct)
+list_encoding(CT ct)
 {
        CE ce;
 
        if ((ce = ct->c_cefile))
-               fprintf (stderr, "    decoded fp 0x%x file \"%s\"\n",
+               fprintf(stderr, "    decoded fp 0x%x file \"%s\"\n",
                        (unsigned int)(unsigned long) ce->ce_fp,
                        ce->ce_file ? ce->ce_file : "");
 
index fbd2503..c4e822b 100644 (file)
@@ -254,45 +254,45 @@ static FILE *(*mhl_action) () = (FILE *(*) ()) 0;
 /*
 ** prototypes
 */
-static void mhl_format (char *, int, int);
-static int evalvar (struct mcomp *);
-static int ptoi (char *, int *);
-static int ptos (char *, char **);
-static char *parse (void);
-static void process (char *, char *, int, int);
-static void mhlfile (FILE *, char *, int, int);
-static int mcomp_flags (char *);
-static char *mcomp_add (long, char *, char *);
-static void mcomp_format (struct mcomp *, struct mcomp *);
-static struct mcomp *add_queue (struct mcomp **, struct mcomp **,
+static void mhl_format(char *, int, int);
+static int evalvar(struct mcomp *);
+static int ptoi(char *, int *);
+static int ptos(char *, char **);
+static char *parse(void);
+static void process(char *, char *, int, int);
+static void mhlfile(FILE *, char *, int, int);
+static int mcomp_flags(char *);
+static char *mcomp_add(long, char *, char *);
+static void mcomp_format(struct mcomp *, struct mcomp *);
+static struct mcomp *add_queue(struct mcomp **, struct mcomp **,
                char *, char *, int);
-static void free_queue (struct mcomp **, struct mcomp **);
-static void putcomp (struct mcomp *, struct mcomp *, int);
-static char *oneline (char *, long);
-static void putstr (char *);
-static void putch (char);
-static RETSIGTYPE intrser (int);
-static RETSIGTYPE pipeser (int);
-static RETSIGTYPE quitser (int);
-static void face_format (struct mcomp *);
-static int doface (struct mcomp *);
-static void mhladios (char *, char *, ...);
-static void mhldone (int);
-static void m_popen (char *);
-
-int mhl (int, char **);
-int mhlsbr (int, char **, FILE *(*)());
-void m_pclose (void);
-
-void clear_screen (void);  /* from termsbr.c */
-int SOprintf (char *, ...);  /* from termsbr.c */
-int sc_width (void);  /* from termsbr.c */
-int sc_length (void);  /* from termsbr.c */
-int sc_hardcopy (void);  /* from termsbr.c */
+static void free_queue(struct mcomp **, struct mcomp **);
+static void putcomp(struct mcomp *, struct mcomp *, int);
+static char *oneline(char *, long);
+static void putstr(char *);
+static void putch(char);
+static RETSIGTYPE intrser(int);
+static RETSIGTYPE pipeser(int);
+static RETSIGTYPE quitser(int);
+static void face_format(struct mcomp *);
+static int doface(struct mcomp *);
+static void mhladios(char *, char *, ...);
+static void mhldone(int);
+static void m_popen(char *);
+
+int mhl(int, char **);
+int mhlsbr(int, char **, FILE *(*)());
+void m_pclose(void);
+
+void clear_screen(void);  /* from termsbr.c */
+int SOprintf(char *, ...);  /* from termsbr.c */
+int sc_width(void);  /* from termsbr.c */
+int sc_length(void);  /* from termsbr.c */
+int sc_hardcopy(void);  /* from termsbr.c */
 
 
 int
-mhl (int argc, char **argv)
+mhl(int argc, char **argv)
 {
        int length = 0, nomore = 0;
        int i, width = 0, vecp = 0;
@@ -300,36 +300,36 @@ mhl (int argc, char **argv)
        char buf[BUFSIZ], *files[MAXARGS];
        char **argp, **arguments;
 
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
-       if ((cp = getenv ("MHLDEBUG")) && *cp)
+       if ((cp = getenv("MHLDEBUG")) && *cp)
                mhldebug++;
 
-       if ((cp = getenv ("FACEPROC")))
+       if ((cp = getenv("FACEPROC")))
                faceproc = cp;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, mhlswitches)) {
+                       switch (smatch(++cp, mhlswitches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, mhlswitches);
-                                       done (1);
+                                       ambigsw(cp, mhlswitches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown\n", cp);
+                                       adios(NULL, "-%s unknown\n", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [switches] [files ...]", invo_name);
-                                       print_help (buf, mhlswitches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [switches] [files ...]", invo_name);
+                                       print_help(buf, mhlswitches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case BELLSW:
                                        bellflg = 1;
@@ -346,30 +346,31 @@ mhl (int argc, char **argv)
                                        continue;
 
                                case FOLDSW:
-                                       if (!(folder = *argp++) || *folder == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                       if (!(folder = *argp++) ||
+                                                       *folder == '-')
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case FORMSW:
                                        if (!(form = *argp++) || *form == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case FACESW:
                                        if (!(faceproc = *argp++) || *faceproc == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case NFACESW:
                                        faceproc = NULL;
                                        continue;
                                case SLEEPSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       sleepsw = atoi (cp);/* ZERO ok! */
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       sleepsw = atoi(cp);  /* ZERO ok! */
                                        continue;
 
                                case PROGSW:
                                        if (!(moreproc = *argp++) || *moreproc == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case NPROGSW:
                                        nomore++;
@@ -377,32 +378,33 @@ mhl (int argc, char **argv)
 
                                case LENSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       if ((length = atoi (cp)) < 1)
-                                               adios (NULL, "bad argument %s %s", argp[-2], cp);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       if ((length = atoi(cp)) < 1)
+                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
                                        continue;
                                case WIDTHSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       if ((width = atoi (cp)) < 1)
-                                               adios (NULL, "bad argument %s %s", argp[-2], cp);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       if ((width = atoi(cp)) < 1)
+                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
                                        continue;
 
                                case DGSTSW:
-                                       if (!(digest = *argp++) || *digest == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                       if (!(digest = *argp++) ||
+                                                       *digest == '-')
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case ISSUESW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       if ((issue = atoi (cp)) < 1)
-                                               adios (NULL, "bad argument %s %s", argp[-2], cp);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       if ((issue = atoi(cp)) < 1)
+                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
                                        continue;
                                case VOLUMSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       if ((volume = atoi (cp)) < 1)
-                                               adios (NULL, "bad argument %s %s", argp[-2], cp);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       if ((volume = atoi(cp)) < 1)
+                                               adios(NULL, "bad argument %s %s", argp[-2], cp);
                                        continue;
 
                                case FORW2SW:
@@ -428,54 +430,52 @@ mhl (int argc, char **argv)
        }
 
        if (!folder)
-               folder = getenv ("mhfolder");
+               folder = getenv("mhfolder");
 
-       if (isatty (fileno (stdout))) {
+       if (isatty(fileno(stdout))) {
                if (!nomore && !sc_hardcopy() && moreproc && *moreproc != '\0') {
                        if (mhl_action) {
-                               SIGNAL (SIGINT, SIG_IGN);
-                               SIGNAL2 (SIGQUIT, quitser);
+                               SIGNAL(SIGINT, SIG_IGN);
+                               SIGNAL2(SIGQUIT, quitser);
                        }
-                       SIGNAL2 (SIGPIPE, pipeser);
-                       m_popen (moreproc);
+                       SIGNAL2(SIGPIPE, pipeser);
+                       m_popen(moreproc);
                        ontty = PITTY;
                } else {
-                       SIGNAL (SIGINT, SIG_IGN);
-                       SIGNAL2 (SIGQUIT, quitser);
+                       SIGNAL(SIGINT, SIG_IGN);
+                       SIGNAL2(SIGQUIT, quitser);
                        ontty = ISTTY;
                }
        } else {
                ontty = NOTTY;
        }
 
-       mhl_format (form ? form : mhlformat, length, width);
+       mhl_format(form ? form : mhlformat, length, width);
 
        if (vecp == 0) {
-               process (folder, NULL, 1, vecp = 1);
+               process(folder, NULL, 1, vecp = 1);
        } else {
                for (i = 0; i < vecp; i++)
-                       process (folder, files[i], i + 1, vecp);
+                       process(folder, files[i], i + 1, vecp);
        }
 
        if (forwall) {
                if (digest) {
-                       printf ("%s", delim4);
+                       printf("%s", delim4);
                        if (volume == 0) {
-                               snprintf (buf, sizeof(buf),
+                               snprintf(buf, sizeof(buf),
                                        "End of %s Digest\n", digest);
                        } else {
-                               snprintf (buf, sizeof(buf),
-                                       "End of %s Digest [Volume %d Issue %d]\n",
-                                       digest, volume, issue);
+                               snprintf(buf, sizeof(buf), "End of %s Digest [Volume %d Issue %d]\n", digest, volume, issue);
                        }
-                       i = strlen (buf);
+                       i = strlen(buf);
                        for (cp = buf + i; i > 1; i--)
                                *cp++ = '*';
                        *cp++ = '\n';
                        *cp = 0;
-                       printf ("%s", buf);
+                       printf("%s", buf);
                } else
-                       printf ("\n------- End of Forwarded Message%s\n\n",
+                       printf("\n------- End of Forwarded Message%s\n\n",
                                vecp > 1 ? "s" : "");
        }
 
@@ -485,17 +485,17 @@ mhl (int argc, char **argv)
        }
 
        if (clearflg > 0 && ontty == NOTTY)
-               clear_screen ();
+               clear_screen();
 
        if (ontty == PITTY)
-               m_pclose ();
+               m_pclose();
 
        return exitstat;
 }
 
 
 static void
-mhl_format (char *file, int length, int width)
+mhl_format(char *file, int length, int width)
 {
        int i;
        char *bp, *cp, **ip;
@@ -508,19 +508,19 @@ mhl_format (char *file, int length, int width)
        static time_t mtime = 0;
 
        if (fmthd != NULL) {
-               if (stat (etcpath (file), &st) != NOTOK
+               if (stat(etcpath(file), &st) != NOTOK
                        && mtime == st.st_mtime
                        && dev == st.st_dev
                        && ino == st.st_ino)
                        goto out;
                else
-                       free_queue (&fmthd, &fmttl);
+                       free_queue(&fmthd, &fmttl);
        }
 
-       if ((fp = fopen (etcpath (file), "r")) == NULL)
-               adios (file, "unable to open format file");
+       if ((fp = fopen(etcpath(file), "r")) == NULL)
+               adios(file, "unable to open format file");
 
-       if (fstat (fileno (fp), &st) != NOTOK) {
+       if (fstat(fileno(fp), &st) != NOTOK) {
                mtime = st.st_mtime;
                dev = st.st_dev;
                ino = st.st_ino;
@@ -530,15 +530,15 @@ mhl_format (char *file, int length, int width)
        global.c_fmt = NULL;
        global.c_offset = 0;
        global.c_ovoff = -1;
-       if ((i = sc_width ()) > 5)
+       if ((i = sc_width()) > 5)
                global.c_width = i;
        global.c_cwidth = -1;
-       if ((i = sc_length ()) > 5)
+       if ((i = sc_length()) > 5)
                global.c_length = i - 1;
        global.c_flags = BELL;  /* BELL is default */
        *(ip = ignores) = NULL;
 
-       while (vfgets (fp, &ap) == OK) {
+       while (vfgets(fp, &ap) == OK) {
                bp = ap;
                if (*bp == ';')
                        continue;
@@ -547,13 +547,14 @@ mhl_format (char *file, int length, int width)
                        *cp = 0;
 
                if (*bp == ':') {
-                       c1 = add_queue (&fmthd, &fmttl, NULL, bp + 1, CLEARTEXT);
+                       c1 = add_queue(&fmthd, &fmttl, NULL, bp + 1,
+                                       CLEARTEXT);
                        continue;
                }
 
                parptr = bp;
-               strncpy (name, parse(), sizeof(name));
-               switch (*parptr) {
+               strncpy(name, parse(), sizeof(name));
+               switch(*parptr) {
                        case '\0':
                        case ',':
                        case '=':
@@ -562,12 +563,13 @@ mhl_format (char *file, int length, int width)
                                ** and copy it to the end of the current
                                ** "ignores" list.
                                */
-                               if (!mh_strcasecmp (name, "ignores")) {
+                               if (!mh_strcasecmp(name, "ignores")) {
                                        char **tmparray, **p;
                                        int n = 0;
 
                                        /* split the fields */
-                                       tmparray = brkstring (getcpy (++parptr), ",", NULL);
+                                       tmparray = brkstring(getcpy(++parptr),
+                                                       ",", NULL);
 
                                        /* count number of fields split */
                                        p = tmparray;
@@ -578,57 +580,54 @@ mhl_format (char *file, int length, int width)
                                        ** copy pointers to split fields
                                        ** to ignores array
                                        */
-                                       ip = copyip (tmparray, ip, MAXARGS - num_ignores);
+                                       ip = copyip(tmparray, ip,
+                                                       MAXARGS - num_ignores);
                                        num_ignores += n;
                                        continue;
                                }
                                parptr = bp;
                                while (*parptr) {
-                                       if (evalvar (&global))
-                                               adios (NULL, "format file syntax error: %s", bp);
+                                       if (evalvar(&global))
+                                               adios(NULL, "format file syntax error: %s", bp);
                                        if (*parptr)
                                                parptr++;
                                }
                                continue;
 
                        case ':':
-                               c1 = add_queue (&fmthd, &fmttl, name, NULL, INIT);
+                               c1 = add_queue(&fmthd, &fmttl, name, NULL,
+                                               INIT);
                                while (*parptr == ':' || *parptr == ',') {
                                        parptr++;
-                                       if (evalvar (c1))
-                                               adios (NULL, "format file syntax error: %s", bp);
+                                       if (evalvar(c1))
+                                               adios(NULL, "format file syntax error: %s", bp);
                                }
                                if (!c1->c_nfs && global.c_nfs) {
                                        if (c1->c_flags & DATEFMT) {
                                                if (global.c_flags & DATEFMT)
-                                                       c1->c_nfs = getcpy (global.c_nfs);
+                                                       c1->c_nfs = getcpy(global.c_nfs);
                                        }
                                        else
                                                if (c1->c_flags & ADDRFMT) {
                                                        if (global.c_flags & ADDRFMT)
-                                                               c1->c_nfs = getcpy (global.c_nfs);
+                                                               c1->c_nfs = getcpy(global.c_nfs);
                                                }
                                }
                                continue;
 
                        default:
-                               adios (NULL, "format file syntax error: %s", bp);
+                               adios(NULL, "format file syntax error: %s",
+                                               bp);
                }
        }
-       fclose (fp);
+       fclose(fp);
 
        if (mhldebug) {
                for (c1 = fmthd; c1; c1 = c1->c_next) {
-                       fprintf (stderr, "c1: name=\"%s\" text=\"%s\" ovtxt=\"%s\"\n",
-                                       c1->c_name, c1->c_text, c1->c_ovtxt);
-                       fprintf (stderr, "\tnfs=0x%x fmt=0x%x\n",
-                                        (unsigned int)(unsigned long) c1->c_nfs,
-                                        (unsigned int)(unsigned long) c1->c_fmt);
-                       fprintf (stderr, "\toffset=%d ovoff=%d width=%d cwidth=%d length=%d\n",
-                                       c1->c_offset, c1->c_ovoff, c1->c_width,
-                                       c1->c_cwidth, c1->c_length);
-                       fprintf (stderr, "\tflags=%s\n",
-                                       snprintb (buffer, sizeof(buffer), (unsigned) c1->c_flags, LBITS));
+                       fprintf(stderr, "c1: name=\"%s\" text=\"%s\" ovtxt=\"%s\"\n", c1->c_name, c1->c_text, c1->c_ovtxt);
+                       fprintf(stderr, "\tnfs=0x%x fmt=0x%x\n", (unsigned int)(unsigned long) c1->c_nfs, (unsigned int)(unsigned long) c1->c_fmt);
+                       fprintf(stderr, "\toffset=%d ovoff=%d width=%d cwidth=%d length=%d\n", c1->c_offset, c1->c_ovoff, c1->c_width, c1->c_cwidth, c1->c_length);
+                       fprintf (stderr, "\tflags=%s\n", snprintb(buffer, sizeof(buffer), (unsigned) c1->c_flags, LBITS));
                }
        }
 
@@ -661,60 +660,60 @@ out:
 
 
 static int
-evalvar (struct mcomp *c1)
+evalvar(struct mcomp *c1)
 {
        char *cp, name[NAMESZ];
        struct triple *ap;
 
        if (!*parptr)
                return 0;
-       strncpy (name, parse(), sizeof(name));
+       strncpy(name, parse(), sizeof(name));
 
-       if (!mh_strcasecmp (name, "component")) {
-               if (ptos (name, &c1->c_text))
+       if (!mh_strcasecmp(name, "component")) {
+               if (ptos(name, &c1->c_text))
                        return 1;
                c1->c_flags &= ~NOCOMPONENT;
                return 0;
        }
 
-       if (!mh_strcasecmp (name, "overflowtext"))
-               return ptos (name, &c1->c_ovtxt);
+       if (!mh_strcasecmp(name, "overflowtext"))
+               return ptos(name, &c1->c_ovtxt);
 
-       if (!mh_strcasecmp (name, "formatfield")) {
+       if (!mh_strcasecmp(name, "formatfield")) {
                char *nfs;
 
-               if (ptos (name, &cp))
+               if (ptos(name, &cp))
                        return 1;
-               nfs = new_fs (NULL, NULL, cp);
-               c1->c_nfs = getcpy (nfs);
+               nfs = new_fs(NULL, NULL, cp);
+               c1->c_nfs = getcpy(nfs);
                c1->c_flags |= FORMAT;
                return 0;
        }
 
-       if (!mh_strcasecmp (name, "decode")) {
+       if (!mh_strcasecmp(name, "decode")) {
                char *nfs;
 
-               nfs = new_fs (NULL, NULL, "%(decode{text})");
-               c1->c_nfs = getcpy (nfs);
+               nfs = new_fs(NULL, NULL, "%(decode{text})");
+               c1->c_nfs = getcpy(nfs);
                c1->c_flags |= FORMAT;
                return 0;
        }
 
-       if (!mh_strcasecmp (name, "offset"))
-               return ptoi (name, &c1->c_offset);
-       if (!mh_strcasecmp (name, "overflowoffset"))
-               return ptoi (name, &c1->c_ovoff);
-       if (!mh_strcasecmp (name, "width"))
-               return ptoi (name, &c1->c_width);
-       if (!mh_strcasecmp (name, "compwidth"))
-               return ptoi (name, &c1->c_cwidth);
-       if (!mh_strcasecmp (name, "length"))
-               return ptoi (name, &c1->c_length);
-       if (!mh_strcasecmp (name, "nodashstuffing"))
+       if (!mh_strcasecmp(name, "offset"))
+               return ptoi(name, &c1->c_offset);
+       if (!mh_strcasecmp(name, "overflowoffset"))
+               return ptoi(name, &c1->c_ovoff);
+       if (!mh_strcasecmp(name, "width"))
+               return ptoi(name, &c1->c_width);
+       if (!mh_strcasecmp(name, "compwidth"))
+               return ptoi(name, &c1->c_cwidth);
+       if (!mh_strcasecmp(name, "length"))
+               return ptoi(name, &c1->c_length);
+       if (!mh_strcasecmp(name, "nodashstuffing"))
                return (dashstuff = -1);
 
        for (ap = triples; ap->t_name; ap++)
-               if (!mh_strcasecmp (ap->t_name, name)) {
+               if (!mh_strcasecmp(ap->t_name, name)) {
                        c1->c_flags |= ap->t_on;
                        c1->c_flags &= ~ap->t_off;
                        return 0;
@@ -725,33 +724,32 @@ evalvar (struct mcomp *c1)
 
 
 static int
-ptoi (char *name, int *i)
+ptoi(char *name, int *i)
 {
        char *cp;
 
-       if (*parptr++ != '=' || !*(cp = parse ())) {
-               advise (NULL, "missing argument to variable %s", name);
+       if (*parptr++ != '=' || !*(cp = parse())) {
+               advise(NULL, "missing argument to variable %s", name);
                return 1;
        }
 
-       *i = atoi (cp);
+       *i = atoi(cp);
        return 0;
 }
 
 
 static int
-ptos (char *name, char **s)
+ptos(char *name, char **s)
 {
        char c, *cp;
 
        if (*parptr++ != '=') {
-               advise (NULL, "missing argument to variable %s", name);
+               advise(NULL, "missing argument to variable %s", name);
                return 1;
        }
 
        if (*parptr != '"') {
-               for (cp = parptr;
-                               *parptr && *parptr != ':' && *parptr != ',';
+               for (cp = parptr; *parptr && *parptr != ':' && *parptr != ',';
                                parptr++)
                        continue;
        } else {
@@ -762,7 +760,7 @@ ptos (char *name, char **s)
        }
        c = *parptr;
        *parptr = 0;
-       *s = getcpy (cp);
+       *s = getcpy(cp);
        if ((*parptr = c) == '"')
                parptr++;
        return 0;
@@ -770,7 +768,7 @@ ptos (char *name, char **s)
 
 
 static char *
-parse (void)
+parse(void)
 {
        int c;
        char *cp;
@@ -778,11 +776,11 @@ parse (void)
 
        for (cp = result; *parptr && (cp - result < NAMESZ); parptr++) {
                c = *parptr;
-               if (isalnum (c)
+               if (isalnum(c)
                                || c == '.'
                                || c == '-'
                                || c == '_'
-                               || c =='['
+                               || c == '['
                                || c == ']')
                        *cp++ = c;
                else
@@ -795,18 +793,19 @@ parse (void)
 
 
 static void
-process (char *folder, char *fname, int ofilen, int ofilec)
+process(char *folder, char *fname, int ofilen, int ofilec)
 {
        char *cp = NULL;
        FILE *fp = NULL;
        struct mcomp *c1;
 
-       switch (setjmp (env)) {
+       switch (setjmp(env)) {
                case OK:
                        if (fname) {
-                               fp = mhl_action ? (*mhl_action) (fname) : fopen (fname, "r");
+                               fp = mhl_action ? (*mhl_action) (fname) :
+                                               fopen(fname, "r");
                                if (fp == NULL) {
-                                       advise (fname, "unable to open");
+                                       advise(fname, "unable to open");
                                        exitstat++;
                                        return;
                                }
@@ -814,22 +813,23 @@ process (char *folder, char *fname, int ofilen, int ofilec)
                                fname = "(stdin)";
                                fp = stdin;
                        }
-                       cp = folder ? concat (folder, ":", fname, NULL) : getcpy (fname);
+                       cp = folder ? concat(folder, ":", fname, NULL) :
+                                       getcpy(fname);
                        if (ontty != PITTY)
-                               SIGNAL (SIGINT, intrser);
-                       mhlfile (fp, cp, ofilen, ofilec);  /* FALL THROUGH! */
+                               SIGNAL(SIGINT, intrser);
+                       mhlfile(fp, cp, ofilen, ofilec);  /* FALL THROUGH! */
 
                default:
                        if (ontty != PITTY)
-                               SIGNAL (SIGINT, SIG_IGN);
+                               SIGNAL(SIGINT, SIG_IGN);
                        if (mhl_action == NULL && fp != stdin)
-                               fclose (fp);
-                       free (cp);
+                               fclose(fp);
+                       free(cp);
                        if (holder.c_text) {
-                               free (holder.c_text);
+                               free(holder.c_text);
                                holder.c_text = NULL;
                        }
-                       free_queue (&msghd, &msgtl);
+                       free_queue(&msghd, &msgtl);
                        for (c1 = fmthd; c1; c1 = c1->c_next)
                                c1->c_flags &= ~HDROUTPUT;
                        break;
@@ -838,7 +838,7 @@ process (char *folder, char *fname, int ofilen, int ofilec)
 
 
 static void
-mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
+mhlfile(FILE *fp, char *mname, int ofilen, int ofilec)
 {
        int state;
        struct mcomp *c1, *c2, *c3;
@@ -846,14 +846,15 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
 
        if (forwall) {
                if (digest)
-                       printf ("%s", ofilen == 1 ? delim3 : delim4);
+                       printf("%s", ofilen == 1 ? delim3 : delim4);
                else {
-                       printf ("\n-------");
+                       printf("\n-------");
                        if (ofilen == 1)
-                               printf (" Forwarded Message%s", ofilec > 1 ? "s" : "");
+                               printf(" Forwarded Message%s",
+                                               ofilec > 1 ? "s" : "");
                        else
-                               printf (" Message %d", ofilen);
-                       printf ("\n\n");
+                               printf(" Message %d", ofilen);
+                       printf("\n\n");
                }
        } else {
                switch (ontty) {
@@ -861,76 +862,75 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
                                if (ofilec > 1) {
                                        if (ofilen > 1) {
                                                if ((global.c_flags & CLEARSCR))
-                                                       clear_screen ();
+                                                       clear_screen();
                                                else
-                                                       printf ("\n\n\n");
+                                                       printf("\n\n\n");
                                        }
-                                       printf (">>> %s\n\n", mname);
+                                       printf(">>> %s\n\n", mname);
                                }
                                break;
 
                        case ISTTY:
-                               strncpy (buf, "\n", sizeof(buf));
+                               strncpy(buf, "\n", sizeof(buf));
                                if (ofilec > 1) {
-                                       if (SOprintf ("Press <return> to list \"%s\"...", mname)) {
+                                       if (SOprintf("Press <return> to list \"%s\"...", mname)) {
                                                if (ofilen > 1)
-                                                       printf ("\n\n\n");
-                                               printf ("Press <return> to list \"%s\"...", mname);
+                                                       printf("\n\n\n");
+                                               printf("Press <return> to list \"%s\"...", mname);
                                        }
-                                       fflush (stdout);
+                                       fflush(stdout);
                                        buf[0] = 0;
-                                       read (fileno (stdout), buf, sizeof(buf));
+                                       read(fileno(stdout), buf, sizeof(buf));
                                }
                                if (strchr(buf, '\n')) {
                                        if ((global.c_flags & CLEARSCR))
-                                               clear_screen ();
+                                               clear_screen();
                                }
                                else
-                                       printf ("\n");
+                                       printf("\n");
                                break;
 
                        default:
                                if (ofilec > 1) {
                                        if (ofilen > 1) {
-                                               printf ("\n\n\n");
+                                               printf("\n\n\n");
                                                if (clearflg > 0)
-                                                       clear_screen ();
+                                                       clear_screen();
                                        }
-                                       printf (">>> %s\n\n", mname);
+                                       printf(">>> %s\n\n", mname);
                                }
                                break;
                }
        }
 
        for (state = FLD;;) {
-               switch (state = m_getfld (state, name, buf, sizeof(buf), fp)) {
+               switch (state = m_getfld(state, name, buf, sizeof(buf), fp)) {
                        case FLD:
                        case FLDPLUS:
                                for (ip = ignores; *ip; ip++)
-                                       if (!mh_strcasecmp (name, *ip)) {
+                                       if (!mh_strcasecmp(name, *ip)) {
                                                while (state == FLDPLUS)
-                                                       state = m_getfld (state, name, buf, sizeof(buf), fp);
+                                                       state = m_getfld(state, name, buf, sizeof(buf), fp);
                                                break;
                                        }
                                if (*ip)
                                        continue;
 
                                for (c2 = fmthd; c2; c2 = c2->c_next)
-                                       if (!mh_strcasecmp (c2->c_name, name))
+                                       if (!mh_strcasecmp(c2->c_name, name))
                                                break;
                                c1 = NULL;
                                if (!((c3 = c2 ? c2 : &global)->c_flags & SPLIT))
                                        for (c1 = msghd; c1; c1 = c1->c_next)
-                                               if (!mh_strcasecmp (c1->c_name, c3->c_name)) {
-                                                       c1->c_text =
-                                                               mcomp_add (c1->c_flags, buf, c1->c_text);
+                                               if (!mh_strcasecmp(c1->c_name, c3->c_name)) {
+                                                       c1->c_text = mcomp_add (c1->c_flags, buf, c1->c_text);
                                                        break;
                                                }
                                if (c1 == NULL)
-                                       c1 = add_queue (&msghd, &msgtl, name, buf, 0);
+                                       c1 = add_queue(&msghd, &msgtl, name, buf, 0);
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, name, buf, sizeof(buf), fp);
-                                       c1->c_text = add (buf, c1->c_text);
+                                       state = m_getfld(state, name, buf, sizeof(buf), fp);
+                                       c1->c_text = add(buf, c1->c_text);
                                }
                                if (c2 == NULL)
                                        c1->c_flags |= EXTRA;
@@ -941,38 +941,37 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
                                row = column = 0;
                                for (c1 = fmthd; c1; c1 = c1->c_next) {
                                        if (c1->c_flags & CLEARTEXT) {
-                                               putcomp (c1, c1, ONECOMP);
+                                               putcomp(c1, c1, ONECOMP);
                                                continue;
                                        }
-                                       if (!mh_strcasecmp (c1->c_name, "messagename")) {
-                                               holder.c_text = concat ("(Message ", mname, ")\n",
+                                       if (!mh_strcasecmp(c1->c_name, "messagename")) {
+                                               holder.c_text = concat("(Message ", mname, ")\n",
                                                                                        NULL);
-                                               putcomp (c1, &holder, ONECOMP);
-                                               free (holder.c_text);
+                                               putcomp(c1, &holder, ONECOMP);
+                                               free(holder.c_text);
                                                holder.c_text = NULL;
                                                continue;
                                        }
-                                       if (!mh_strcasecmp (c1->c_name, "extras")) {
+                                       if (!mh_strcasecmp(c1->c_name, "extras")) {
                                                for (c2 = msghd; c2; c2 = c2->c_next)
                                                        if (c2->c_flags & EXTRA)
-                                                               putcomp (c1, c2, TWOCOMP);
+                                                               putcomp(c1, c2, TWOCOMP);
                                                continue;
                                        }
-                                       if (dobody && !mh_strcasecmp (c1->c_name, "body")) {
-                                               holder.c_text = mh_xmalloc (sizeof(buf));
-                                               strncpy (holder.c_text, buf, sizeof(buf));
+                                       if (dobody && !mh_strcasecmp(c1->c_name, "body")) {
+                                               holder.c_text = mh_xmalloc(sizeof(buf));
+                                               strncpy(holder.c_text, buf, sizeof(buf));
                                                while (state == BODY) {
-                                                       putcomp (c1, &holder, BODYCOMP);
-                                                       state = m_getfld (state, name, holder.c_text,
-                                                                               sizeof(buf), fp);
+                                                       putcomp(c1, &holder, BODYCOMP);
+                                                       state = m_getfld(state, name, holder.c_text, sizeof(buf), fp);
                                                }
-                                               free (holder.c_text);
+                                               free(holder.c_text);
                                                holder.c_text = NULL;
                                                continue;
                                        }
                                        for (c2 = msghd; c2; c2 = c2->c_next)
-                                               if (!mh_strcasecmp (c2->c_name, c1->c_name)) {
-                                                       putcomp (c1, c2, ONECOMP);
+                                               if (!mh_strcasecmp(c2->c_name, c1->c_name)) {
+                                                       putcomp(c1, c2, ONECOMP);
                                                        if (!(c1->c_flags & SPLIT))
                                                                break;
                                                }
@@ -980,9 +979,9 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
                                                for (c2 = msghd; c2; c2 = c2->c_next)
                                                        if (c2->c_flags & FACEDFLT) {
                                                                if (c2->c_face == NULL)
-                                                                       face_format (c2);
+                                                                       face_format(c2);
                                                                if ((holder.c_text = c2->c_face)) {
-                                                                       putcomp (c1, &holder, ONECOMP);
+                                                                       putcomp(c1, &holder, ONECOMP);
                                                                        holder.c_text = NULL;
                                                                }
                                                                break;
@@ -992,24 +991,25 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
 
                        case LENERR:
                        case FMTERR:
-                               advise (NULL, "format error in message %s", mname);
+                               advise(NULL, "format error in message %s",
+                                               mname);
                                exitstat++;
                                return;
 
                        default:
-                               adios (NULL, "getfld() returned %d", state);
+                               adios(NULL, "getfld() returned %d", state);
                }
        }
 }
 
 
 static int
-mcomp_flags (char *name)
+mcomp_flags(char *name)
 {
        struct pair *ap;
 
        for (ap = pairs; ap->p_name; ap++)
-               if (!mh_strcasecmp (ap->p_name, name))
+               if (!mh_strcasecmp(ap->p_name, name))
                        return (ap->p_flags);
 
        return 0;
@@ -1017,17 +1017,17 @@ mcomp_flags (char *name)
 
 
 static char *
-mcomp_add (long flags, char *s1, char *s2)
+mcomp_add(long flags, char *s1, char *s2)
 {
        char *dp;
 
        if (!(flags & ADDRFMT))
-               return add (s1, s2);
+               return add(s1, s2);
 
-       if (s2 && *(dp = s2 + strlen (s2) - 1) == '\n')
+       if (s2 && *(dp = s2 + strlen(s2) - 1) == '\n')
                *dp = 0;
 
-       return add (s1, add (",\n", s2));
+       return add(s1, add(",\n", s2));
 }
 
 
@@ -1039,7 +1039,7 @@ struct pqpair {
 
 
 static void
-mcomp_format (struct mcomp *c1, struct mcomp *c2)
+mcomp_format(struct mcomp *c1, struct mcomp *c2)
 {
        int dat[5];
        char *ap, *cp;
@@ -1056,93 +1056,94 @@ mcomp_format (struct mcomp *c1, struct mcomp *c2)
        dat[2] = 0;
        dat[3] = sizeof(buffer) - 1;
        dat[4] = 0;
-       fmt_compile (c1->c_nfs, &c1->c_fmt);
+       fmt_compile(c1->c_nfs, &c1->c_fmt);
 
        if (!(c1->c_flags & ADDRFMT)) {
-               FINDCOMP (cptr, "text");
+               FINDCOMP(cptr, "text");
                if (cptr)
                        cptr->c_text = ap;
                if ((cp = strrchr(ap, '\n')))  /* drop ending newline */
                        if (!cp[1])
                                *cp = 0;
 
-               fmt_scan (c1->c_fmt, buffer, sizeof(buffer) - 1, dat);
+               fmt_scan(c1->c_fmt, buffer, sizeof(buffer) - 1, dat);
                /* Don't need to append a newline, dctime() already did */
-               c2->c_text = getcpy (buffer);
+               c2->c_text = getcpy(buffer);
 
-               free (ap);
+               free(ap);
                return;
        }
 
        (q = &pq)->pq_next = NULL;
-       while ((cp = getname (ap))) {
-               if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
-                       adios (NULL, "unable to allocate pqpair memory");
-
-               if ((mp = getm (cp, NULL, 0, AD_NAME, error)) == NULL) {
-                       p->pq_text = getcpy (cp);
-                       p->pq_error = getcpy (error);
+       while ((cp = getname(ap))) {
+               if ((p = (struct pqpair *)
+                               calloc((size_t) 1, sizeof(*p))) == NULL)
+                       adios(NULL, "unable to allocate pqpair memory");
+
+               if ((mp = getm(cp, NULL, 0, AD_NAME, error)) == NULL) {
+                       p->pq_text = getcpy(cp);
+                       p->pq_error = getcpy(error);
                } else {
                        if ((c1->c_flags & FACEDFLT) && c2->c_face == NULL) {
                                char   *h, *o;
                                if ((h = mp->m_host) == NULL)
-                                       h = LocalName ();
-                               if ((o = OfficialName (h)))
+                                       h = LocalName();
+                               if ((o = OfficialName(h)))
                                        h = o;
-                               c2->c_face = concat ("address ", h, " ",
-                                       mp->m_mbox, NULL);
+                               c2->c_face = concat("address ", h, " ",
+                                               mp->m_mbox, NULL);
                        }
-                       p->pq_text = getcpy (mp->m_text);
-                       mnfree (mp);
+                       p->pq_text = getcpy(mp->m_text);
+                       mnfree(mp);
                }
                q = (q->pq_next = p);
        }
 
        for (p = pq.pq_next; p; p = q) {
-               FINDCOMP (cptr, "text");
+               FINDCOMP(cptr, "text");
                if (cptr)
                        cptr->c_text = p->pq_text;
-               FINDCOMP (cptr, "error");
+               FINDCOMP(cptr, "error");
                if (cptr)
                        cptr->c_text = p->pq_error;
 
-               fmt_scan (c1->c_fmt, buffer, sizeof(buffer) - 1, dat);
+               fmt_scan(c1->c_fmt, buffer, sizeof(buffer) - 1, dat);
                if (*buffer) {
                        if (c2->c_text)
-                               c2->c_text = add (",\n", c2->c_text);
-                       if (*(cp = buffer + strlen (buffer) - 1) == '\n')
+                               c2->c_text = add(",\n", c2->c_text);
+                       if (*(cp = buffer + strlen(buffer) - 1) == '\n')
                                *cp = 0;
-                       c2->c_text = add (buffer, c2->c_text);
+                       c2->c_text = add(buffer, c2->c_text);
                }
 
-               free (p->pq_text);
+               free(p->pq_text);
                if (p->pq_error)
-                       free (p->pq_error);
+                       free(p->pq_error);
                q = p->pq_next;
-               free ((char *) p);
+               free((char *) p);
        }
 
-       c2->c_text = add ("\n", c2->c_text);
+       c2->c_text = add("\n", c2->c_text);
        free (ap);
 }
 
 
 static struct mcomp *
-add_queue (struct mcomp **head, struct mcomp **tail, char *name,
-       char *text, int flags)
+add_queue(struct mcomp **head, struct mcomp **tail, char *name,
+               char *text, int flags)
 {
        struct mcomp *c1;
 
-       if ((c1 = (struct mcomp *) calloc ((size_t) 1, sizeof(*c1))) == NULL)
-               adios (NULL, "unable to allocate comp memory");
+       if ((c1 = (struct mcomp *) calloc((size_t) 1, sizeof(*c1))) == NULL)
+               adios(NULL, "unable to allocate comp memory");
 
        c1->c_flags = flags & ~INIT;
-       if ((c1->c_name = name ? getcpy (name) : NULL))
-               c1->c_flags |= mcomp_flags (c1->c_name);
-       c1->c_text = text ? getcpy (text) : NULL;
+       if ((c1->c_name = name ? getcpy(name) : NULL))
+               c1->c_flags |= mcomp_flags(c1->c_name);
+       c1->c_text = text ? getcpy(text) : NULL;
        if (flags & INIT) {
                if (global.c_ovtxt)
-                       c1->c_ovtxt = getcpy (global.c_ovtxt);
+                       c1->c_ovtxt = getcpy(global.c_ovtxt);
                c1->c_offset = global.c_offset;
                c1->c_ovoff = global. c_ovoff;
                c1->c_width = c1->c_length = 0;
@@ -1160,25 +1161,25 @@ add_queue (struct mcomp **head, struct mcomp **tail, char *name,
 
 
 static void
-free_queue (struct mcomp **head, struct mcomp **tail)
+free_queue(struct mcomp **head, struct mcomp **tail)
 {
        struct mcomp *c1, *c2;
 
        for (c1 = *head; c1; c1 = c2) {
                c2 = c1->c_next;
                if (c1->c_name)
-                       free (c1->c_name);
+                       free(c1->c_name);
                if (c1->c_text)
-                       free (c1->c_text);
+                       free(c1->c_text);
                if (c1->c_ovtxt)
-                       free (c1->c_ovtxt);
+                       free(c1->c_ovtxt);
                if (c1->c_nfs)
-                       free (c1->c_nfs);
+                       free(c1->c_nfs);
                if (c1->c_fmt)
-                       free ((char *) c1->c_fmt);
+                       free((char *) c1->c_fmt);
                if (c1->c_face)
-                       free (c1->c_face);
-               free ((char *) c1);
+                       free(c1->c_face);
+               free((char *) c1);
        }
 
        *head = *tail = NULL;
@@ -1186,7 +1187,7 @@ free_queue (struct mcomp **head, struct mcomp **tail)
 
 
 static void
-putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
+putcomp(struct mcomp *c1, struct mcomp *c2, int flag)
 {
        int count, cchdr;
        unsigned char *cp;
@@ -1196,22 +1197,21 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
        llim = c1->c_length ? c1->c_length : -1;
        wid = c1->c_width ? c1->c_width : global.c_width;
        ovoff = (c1->c_ovoff >= 0 ? c1->c_ovoff : global.c_ovoff)
-               + c1->c_offset;
+                       + c1->c_offset;
        if ((ovtxt = c1->c_ovtxt ? c1->c_ovtxt : global.c_ovtxt) == NULL)
                ovtxt = "";
-       if (wid < ovoff + strlen (ovtxt) + 5)
-               adios (NULL, "component: %s width(%d) too small for overflow(%d)",
-                       c1->c_name, wid, ovoff + strlen (ovtxt) + 5);
+       if (wid < ovoff + strlen(ovtxt) + 5)
+               adios(NULL, "component: %s width(%d) too small for overflow(%d)", c1->c_name, wid, ovoff + strlen(ovtxt) + 5);
        onelp = NULL;
 
        if (c1->c_flags & CLEARTEXT) {
-               putstr (c1->c_text);
-               putstr ("\n");
+               putstr(c1->c_text);
+               putstr("\n");
                return;
        }
 
        if (c1->c_flags & FACEFMT)
-               switch (doface (c2)) {
+               switch (doface(c2)) {
                        case NOTOK:  /* error */
                        case OK:  /* async faceproc */
                                return;
@@ -1221,13 +1221,14 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
                }
 
        if (c1->c_nfs && (c1->c_flags & (ADDRFMT | DATEFMT | FORMAT)))
-               mcomp_format (c1, c2);
+               mcomp_format(c1, c2);
 
        if (c1->c_flags & CENTER) {
                count = (c1->c_width ? c1->c_width : global.c_width)
-                       - c1->c_offset - strlen (c2->c_text);
+                               - c1->c_offset - strlen(c2->c_text);
                if (!(c1->c_flags & HDROUTPUT) && !(c1->c_flags & NOCOMPONENT))
-                       count -= strlen (c1->c_text ? c1->c_text : c1->c_name) + 2;
+                       count -= strlen(c1->c_text ? c1->c_text : c1->c_name)
+                                       + 2;
                lm = c1->c_offset + (count / 2);
        } else {
                if (c1->c_offset)
@@ -1237,19 +1238,19 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
        if (!(c1->c_flags & HDROUTPUT) && !(c1->c_flags & NOCOMPONENT)) {
                if (c1->c_flags & UPPERCASE)  /* uppercase component also */
                        for (cp = (c1->c_text ? c1->c_text : c1->c_name); *cp; cp++)
-                               if (islower (*cp))
-                                       *cp = toupper (*cp);
-               putstr (c1->c_text ? c1->c_text : c1->c_name);
+                               if (islower(*cp))
+                                       *cp = toupper(*cp);
+               putstr(c1->c_text ? c1->c_text : c1->c_name);
                if (flag != BODYCOMP) {
-                       putstr (": ");
+                       putstr(": ");
                        if (!(c1->c_flags & SPLIT))
                                c1->c_flags |= HDROUTPUT;
 
                cchdr++;
                if ((count = c1->c_cwidth -
-                       strlen (c1->c_text ? c1->c_text : c1->c_name) - 2) > 0)
+                       strlen(c1->c_text ? c1->c_text : c1->c_name) - 2) > 0)
                        while (count--)
-                               putstr (" ");
+                               putstr(" ");
                } else
                        c1->c_flags |= HDROUTPUT;  /* for BODYCOMP */
        }
@@ -1258,46 +1259,47 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
                && !(c2->c_flags & NOCOMPONENT)) {
                if (c1->c_flags & UPPERCASE)
                        for (cp = c2->c_name; *cp; cp++)
-                               if (islower (*cp))
-                                       *cp = toupper (*cp);
-               putstr (c2->c_name);
-               putstr (": ");
+                               if (islower(*cp))
+                                       *cp = toupper(*cp);
+               putstr(c2->c_name);
+               putstr(": ");
                if (!(c1->c_flags & SPLIT))
                        c2->c_flags |= HDROUTPUT;
 
                cchdr++;
-               if ((count = c1->c_cwidth - strlen (c2->c_name) - 2) > 0)
+               if ((count = c1->c_cwidth - strlen(c2->c_name) - 2) > 0)
                        while (count--)
-                               putstr (" ");
+                               putstr(" ");
        }
        if (c1->c_flags & UPPERCASE)
                for (cp = c2->c_text; *cp; cp++)
-                       if (islower (*cp))
-                               *cp = toupper (*cp);
+                       if (islower(*cp))
+                               *cp = toupper(*cp);
 
        count = 0;
        if (cchdr) {
                if (flag == TWOCOMP)
-                       count = (c1->c_cwidth >= 0) ? c1->c_cwidth
-                               : strlen (c2->c_name) + 2;
+                       count = (c1->c_cwidth >= 0) ?
+                                       c1->c_cwidth : strlen(c2->c_name) + 2;
                else
-                       count = (c1->c_cwidth >= 0) ? c1->c_cwidth
-                               : strlen (c1->c_text ? c1->c_text : c1->c_name) + 2;
+                       count = (c1->c_cwidth >= 0) ?
+                                       c1->c_cwidth : strlen(c1->c_text ?
+                                       c1->c_text : c1->c_name) + 2;
        }
        count += c1->c_offset;
 
-       if ((cp = oneline (c2->c_text, c1->c_flags)))
+       if ((cp = oneline(c2->c_text, c1->c_flags)))
           putstr(cp);
        if (term == '\n')
-               putstr ("\n");
-       while ((cp = oneline (c2->c_text, c1->c_flags))) {
+               putstr("\n");
+       while ((cp = oneline(c2->c_text, c1->c_flags))) {
                lm = count;
                if (flag == BODYCOMP && !(c1->c_flags & NOCOMPONENT))
-                       putstr (c1->c_text ? c1->c_text : c1->c_name);
+                       putstr(c1->c_text ? c1->c_text : c1->c_name);
                if (*cp)
-                       putstr (cp);
+                       putstr(cp);
                if (term == '\n')
-                       putstr ("\n");
+                       putstr("\n");
        }
        if (flag == BODYCOMP && term == '\n')
                c1->c_flags &= ~HDROUTPUT;  /* Buffer ended on a newline */
@@ -1305,7 +1307,7 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
 
 
 static char *
-oneline (char *stuff, long flags)
+oneline(char *stuff, long flags)
 {
        int spc;
        char *cp, *ret;
@@ -1319,8 +1321,10 @@ oneline (char *stuff, long flags)
        term = 0;
        if (flags & COMPRESS) {
                for (spc = 1, cp = ret; *onelp; onelp++)
-                       if (isspace (*onelp)) {
-                               if (*onelp == '\n' && (!onelp[1] || (flags & ADDRFMT))) {
+                       if (isspace(*onelp)) {
+                               if (*onelp == '\n' &&
+                                               (!onelp[1] ||
+                                               (flags & ADDRFMT))) {
                                        term = '\n';
                                        *onelp++ = 0;
                                        break;
@@ -1353,26 +1357,26 @@ oneline (char *stuff, long flags)
 
 
 static void
-putstr (char *string)
+putstr(char *string)
 {
        if (!column && lm > 0) {
                while (lm > 0)
                        if (lm >= 8) {
-                               putch ('\t');
+                               putch('\t');
                                lm -= 8;
                        } else {
-                               putch (' ');
+                               putch(' ');
                                lm--;
                        }
        }
        lm = 0;
        while (*string)
-               putch (*string++);
+               putch(*string++);
 }
 
 
 static void
-putch (char ch)
+putch(char ch)
 {
        char buf[BUFSIZ];
 
@@ -1388,16 +1392,16 @@ putch (char ch)
                        if (ontty != ISTTY || row != global.c_length)
                                break;
                        if (global.c_flags & BELL)
-                               putchar ('\007');
-                       fflush (stdout);
+                               putchar('\007');
+                       fflush(stdout);
                        buf[0] = 0;
-                       read (fileno (stdout), buf, sizeof(buf));
+                       read(fileno(stdout), buf, sizeof(buf));
                        if (strchr(buf, '\n')) {
                                if (global.c_flags & CLEARSCR)
-                                       clear_screen ();
+                                       clear_screen();
                                row = 0;
                        } else {
-                               putchar ('\n');
+                               putchar('\n');
                                row = global.c_length / 3;
                        }
                        return;
@@ -1421,8 +1425,8 @@ putch (char ch)
                        ** column contains a dash, then add a dash and a space.
                        */
                        if (column == 0 && forwflg && (dashstuff >= 0) && ch == '-') {
-                               putchar ('-');
-                               putchar (' ');
+                               putchar('-');
+                               putchar(' ');
                        }
                        if (ch >= ' ')
                                column++;
@@ -1430,57 +1434,57 @@ putch (char ch)
        }
 
        if (column >= wid) {
-               putch ('\n');
+               putch('\n');
                if (ovoff > 0)
                        lm = ovoff;
-               putstr (ovtxt ? ovtxt : "");
-               putch (ch);
+               putstr(ovtxt ? ovtxt : "");
+               putch(ch);
                return;
        }
 
-       putchar (ch);
+       putchar(ch);
 }
 
 
 static RETSIGTYPE
-intrser (int i)
+intrser(int i)
 {
 #ifndef RELIABLE_SIGNALS
-       SIGNAL (SIGINT, intrser);
+       SIGNAL(SIGINT, intrser);
 #endif
 
-       discard (stdout);
-       putchar ('\n');
-       longjmp (env, DONE);
+       discard(stdout);
+       putchar('\n');
+       longjmp(env, DONE);
 }
 
 
 static RETSIGTYPE
-pipeser (int i)
+pipeser(int i)
 {
 #ifndef RELIABLE_SIGNALS
-       SIGNAL (SIGPIPE, pipeser);
+       SIGNAL(SIGPIPE, pipeser);
 #endif
 
-       done (NOTOK);
+       done(NOTOK);
 }
 
 
 static RETSIGTYPE
-quitser (int i)
+quitser(int i)
 {
 #ifndef RELIABLE_SIGNALS
-       SIGNAL (SIGQUIT, quitser);
+       SIGNAL(SIGQUIT, quitser);
 #endif
 
-       putchar ('\n');
-       fflush (stdout);
-       done (NOTOK);
+       putchar('\n');
+       fflush(stdout);
+       done(NOTOK);
 }
 
 
 static void
-face_format (struct mcomp *c1)
+face_format(struct mcomp *c1)
 {
        char *cp;
        struct mailname *mp;
@@ -1488,17 +1492,18 @@ face_format (struct mcomp *c1)
        if ((cp = c1->c_text) == NULL)
                return;
 
-       if ((cp = getname (cp))) {
-               if ((mp = getm (cp, NULL, 0, AD_NAME, NULL))) {
+       if ((cp = getname(cp))) {
+               if ((mp = getm(cp, NULL, 0, AD_NAME, NULL))) {
                        char *h, *o;
                        if ((h = mp->m_host) == NULL)
-                               h = LocalName ();
-                       if ((o = OfficialName (h)))
+                               h = LocalName();
+                       if ((o = OfficialName(h)))
                                h = o;
-                       c1->c_face = concat ("address ", h, " ", mp->m_mbox, NULL);
+                       c1->c_face = concat("address ", h, " ", mp->m_mbox,
+                                       NULL);
                }
 
-               while ((cp = getname (cp)))
+               while ((cp = getname(cp)))
                        continue;
        }
 }
@@ -1519,7 +1524,7 @@ face_format (struct mcomp *c1)
 #endif
 
 static int
-doface (struct mcomp *c1)
+doface(struct mcomp *c1)
 {
        int result, sd;
        static int inited = OK;
@@ -1530,12 +1535,12 @@ doface (struct mcomp *c1)
 
        if (inited == OK) {
                char *cp;
-               char **ap = brkstring (cp = getcpy (faceproc), " ", "\n");
+               char **ap = brkstring(cp = getcpy(faceproc), " ", "\n");
                struct addrinfo hints, *res;
 
                if (ap[0] == NULL || ap[1] == NULL) {
 bad_faceproc: ;
-                       free (cp);
+                       free(cp);
                        return (inited = NOTOK);
                }
 
@@ -1560,13 +1565,13 @@ bad_faceproc: ;
        if (inited == NOTOK)
                return NOTOK;
 
-       if ((sd = socket (ss.ss_family, socktype, protocol)) == NOTOK)
+       if ((sd = socket(ss.ss_family, socktype, protocol)) == NOTOK)
                return NOTOK;
 
-       result = sendto (sd, c1->c_text, strlen (c1->c_text), 0,
-               (struct sockaddr *) &ss, socklen);
+       result = sendto(sd, c1->c_text, strlen(c1->c_text), 0,
+                       (struct sockaddr *) &ss, socklen);
 
-       close (sd);
+       close(sd);
 
        return (result != NOTOK ? OK : NOTOK);
 }
@@ -1578,7 +1583,7 @@ bad_faceproc: ;
 #if 0
 
 static int
-doface (struct mcomp *c1)
+doface(struct mcomp *c1)
 {
        int i, len, vecp;
        pid_t child_id;
@@ -1586,16 +1591,16 @@ doface (struct mcomp *c1)
        char *bp, *cp;
        char buffer[BUFSIZ], *vec[10];
 
-       if (pipe (pdi) == NOTOK)
+       if (pipe(pdi) == NOTOK)
                return NOTOK;
-       if (pipe (pdo) == NOTOK) {
-               close (pdi[0]);
-               close (pdi[1]);
+       if (pipe(pdo) == NOTOK) {
+               close(pdi[0]);
+               close(pdi[1]);
                return NOTOK;
        }
 
        for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
-               sleep (5);
+               sleep(5);
 
        switch (child_id) {
                case NOTOK:
@@ -1604,71 +1609,73 @@ doface (struct mcomp *c1)
 
                case OK:
                        /* child process */
-                       SIGNAL (SIGINT, SIG_IGN);
-                       SIGNAL (SIGQUIT, SIG_IGN);
-                       if (pdi[0] != fileno (stdin)) {
-                               dup2 (pdi[0], fileno (stdin));
-                               close (pdi[0]);
+                       SIGNAL(SIGINT, SIG_IGN);
+                       SIGNAL(SIGQUIT, SIG_IGN);
+                       if (pdi[0] != fileno(stdin)) {
+                               dup2(pdi[0], fileno(stdin));
+                               close(pdi[0]);
                        }
-                       close (pdi[1]);
-                       close (pdo[0]);
-                       if (pdo[1] != fileno (stdout)) {
-                               dup2 (pdo[1], fileno (stdout));
-                               close (pdo[1]);
+                       close(pdi[1]);
+                       close(pdo[0]);
+                       if (pdo[1] != fileno(stdout)) {
+                               dup2(pdo[1], fileno(stdout));
+                               close(pdo[1]);
                        }
                        vecp = 0;
-                       vec[vecp++] = r1bindex (faceproc, '/');
+                       vec[vecp++] = r1bindex(faceproc, '/');
                        vec[vecp++] = "-e";
                        if (sleepsw != NOTOK) {
                                vec[vecp++] = "-s";
-                               snprintf (buffer, sizeof(buffer), "%d", sleepsw);
+                               snprintf(buffer, sizeof(buffer), "%d",
+                                               sleepsw);
                                vec[vecp++] = buffer;
                        }
                        vec[vecp] = NULL;
-                       execvp (faceproc, vec);
-                       fprintf (stderr, "unable to exec ");
-                       perror (faceproc);
-                       _exit (-1);  /* NOTREACHED */
+                       execvp(faceproc, vec);
+                       fprintf(stderr, "unable to exec ");
+                       perror(faceproc);
+                       _exit(-1);  /* NOTREACHED */
 
                default:
                        /* parent process */
-                       close (pdi[0]);
-                       i = strlen (c1->c_text);
-                       if (write (pdi[1], c1->c_text, i) != i)
-                               adios ("pipe", "error writing to");
-                       free (c1->c_text), c1->c_text = NULL;
-                       close (pdi[1]);
-
-                       close (pdo[1]);
+                       close(pdi[0]);
+                       i = strlen(c1->c_text);
+                       if (write(pdi[1], c1->c_text, i) != i)
+                               adios("pipe", "error writing to");
+                       free(c1->c_text), c1->c_text = NULL;
+                       close(pdi[1]);
+
+                       close(pdo[1]);
                        cp = NULL, len = 0;
                        result = DONE;
-                       while ((i = read (pdo[0], buffer, strlen (buffer))) > 0) {
+                       while ((i=read(pdo[0], buffer, strlen(buffer))) > 0) {
                                if (cp) {
                                        int j;
                                        char *dp;
-                                       dp = mh_xrealloc (cp, (unsigned) (j = len + i));
+                                       dp = mh_xrealloc(cp, (unsigned) (j = len + i));
                                        memcpy(dp + len, buffer, i);
                                        cp = dp, len = j;
                                } else {
-                                       cp = mh_xmalloc ((unsigned) i);
+                                       cp = mh_xmalloc((unsigned) i);
                                        memcpy(cp, buffer, i);
                                        len = i;
                                }
                                if (result == DONE)
                                        for (bp = buffer + i - 1; bp >= buffer; bp--)
-                                               if (!isascii (*bp) || iscntrl (*bp)) {
+                                               if (!isascii(*bp) ||
+                                                               iscntrl(*bp)) {
                                                        result = OK;
                                                        break;
                                                }
                        }
-                       close (pdo[0]);
+                       close(pdo[0]);
 
 /* no waiting for child... */
 
                        if (result == OK) {  /* binary */
-                               if (write (1, cp, len) != len)
-                                       adios ("writing", "error");
-                               free (cp);
+                               if (write(1, cp, len) != len)
+                                       adios("writing", "error");
+                               free(cp);
                        }
                        else  /* empty */
                                if ((c1->c_text = cp) == NULL)
@@ -1682,13 +1689,13 @@ doface (struct mcomp *c1)
 
 
 int
-mhlsbr (int argc, char **argv, FILE *(*action)())
+mhlsbr(int argc, char **argv, FILE *(*action)())
 {
        SIGNAL_HANDLER istat = NULL, pstat = NULL, qstat = NULL;
        char *cp = NULL;
        struct mcomp *c1;
 
-       switch (setjmp (mhlenv)) {
+       switch (setjmp(mhlenv)) {
                case OK:
                        cp = invo_name;
                        sleepsw = 0;  /* XXX */
@@ -1701,29 +1708,29 @@ mhlsbr (int argc, char **argv, FILE *(*action)())
                        ** If signal is at default action, then start ignoring
                        ** it, else let it set to its current action.
                        */
-                       if ((istat = SIGNAL (SIGINT, SIG_IGN)) != SIG_DFL)
-                               SIGNAL (SIGINT, istat);
-                       if ((qstat = SIGNAL (SIGQUIT, SIG_IGN)) != SIG_DFL)
-                               SIGNAL (SIGQUIT, qstat);
-                       pstat = SIGNAL (SIGPIPE, pipeser);
-                       mhl (argc, argv);  /* FALL THROUGH! */
+                       if ((istat = SIGNAL(SIGINT, SIG_IGN)) != SIG_DFL)
+                               SIGNAL(SIGINT, istat);
+                       if ((qstat = SIGNAL(SIGQUIT, SIG_IGN)) != SIG_DFL)
+                               SIGNAL(SIGQUIT, qstat);
+                       pstat = SIGNAL(SIGPIPE, pipeser);
+                       mhl(argc, argv);  /* FALL THROUGH! */
 
                default:
-                       SIGNAL (SIGINT, istat);
-                       SIGNAL (SIGQUIT, qstat);
-                       SIGNAL (SIGPIPE, SIG_IGN);  /*
+                       SIGNAL(SIGINT, istat);
+                       SIGNAL(SIGQUIT, qstat);
+                       SIGNAL(SIGPIPE, SIG_IGN);  /*
                                        ** should probably change to block
                                        ** instead
                                        */
                        if (ontty == PITTY)
-                               m_pclose ();
-                       SIGNAL (SIGPIPE, pstat);
+                               m_pclose();
+                       SIGNAL(SIGPIPE, pstat);
                        invo_name = cp;
                        if (holder.c_text) {
-                               free (holder.c_text);
+                               free(holder.c_text);
                                holder.c_text = NULL;
                        }
-                       free_queue (&msghd, &msgtl);
+                       free_queue(&msghd, &msgtl);
                        for (c1 = fmthd; c1; c1 = c1->c_next)
                                c1->c_flags &= ~HDROUTPUT;
                        return exitstat;
@@ -1734,25 +1741,25 @@ mhlsbr (int argc, char **argv, FILE *(*action)())
 #undef done
 
 static void
-mhladios (char *what, char *fmt, ...)
+mhladios(char *what, char *fmt, ...)
 {
        va_list ap;
 
        va_start(ap, fmt);
-       advertise (what, NULL, fmt, ap);
+       advertise(what, NULL, fmt, ap);
        va_end(ap);
-       mhldone (1);
+       mhldone(1);
 }
 
 
 static void
-mhldone (int status)
+mhldone(int status)
 {
        exitstat = status;
        if (mhl_action)
-               longjmp (mhlenv, DONE);
+               longjmp(mhlenv, DONE);
        else
-               done (exitstat);
+               done(exitstat);
 }
 
 
@@ -1760,62 +1767,62 @@ static int m_pid = NOTOK;
 static int sd = NOTOK;
 
 static void
-m_popen (char *name)
+m_popen(char *name)
 {
        int pd[2];
 
-       if (mhl_action && (sd = dup (fileno (stdout))) == NOTOK)
-               adios ("standard output", "unable to dup()");
+       if (mhl_action && (sd = dup(fileno(stdout))) == NOTOK)
+               adios("standard output", "unable to dup()");
 
-       if (pipe (pd) == NOTOK)
-               adios ("pipe", "unable to");
+       if (pipe(pd) == NOTOK)
+               adios("pipe", "unable to");
 
-       switch (m_pid = vfork ()) {
+       switch (m_pid = vfork()) {
                case NOTOK:
-                       adios ("fork", "unable to");
+                       adios("fork", "unable to");
 
                case OK:
-                       SIGNAL (SIGINT, SIG_DFL);
-                       SIGNAL (SIGQUIT, SIG_DFL);
+                       SIGNAL(SIGINT, SIG_DFL);
+                       SIGNAL(SIGQUIT, SIG_DFL);
 
-                       close (pd[1]);
-                       if (pd[0] != fileno (stdin)) {
-                               dup2 (pd[0], fileno (stdin));
-                               close (pd[0]);
+                       close(pd[1]);
+                       if (pd[0] != fileno(stdin)) {
+                               dup2(pd[0], fileno(stdin));
+                               close(pd[0]);
                        }
-                       execlp (name, r1bindex (name, '/'), NULL);
-                       fprintf (stderr, "unable to exec ");
-                       perror (name);
-                       _exit (-1);
+                       execlp(name, r1bindex(name, '/'), NULL);
+                       fprintf(stderr, "unable to exec ");
+                       perror(name);
+                       _exit(-1);
 
                default:
-                       close (pd[0]);
-                       if (pd[1] != fileno (stdout)) {
-                               dup2 (pd[1], fileno (stdout));
-                               close (pd[1]);
+                       close(pd[0]);
+                       if (pd[1] != fileno(stdout)) {
+                               dup2(pd[1], fileno(stdout));
+                               close(pd[1]);
                        }
        }
 }
 
 
 void
-m_pclose (void)
+m_pclose(void)
 {
        if (m_pid == NOTOK)
                return;
 
        if (sd != NOTOK) {
-               fflush (stdout);
-               if (dup2 (sd, fileno (stdout)) == NOTOK)
-                       adios ("standard output", "unable to dup2()");
+               fflush(stdout);
+               if (dup2(sd, fileno(stdout)) == NOTOK)
+                       adios("standard output", "unable to dup2()");
 
-               clearerr (stdout);
-               close (sd);
+               clearerr(stdout);
+               close(sd);
                sd = NOTOK;
        }
        else
-               fclose (stdout);
+               fclose(stdout);
 
-       pidwait (m_pid, OK);
+       pidwait(m_pid, OK);
        m_pid = NOTOK;
 }
index 12a0bb5..c7a7afa 100644 (file)
@@ -36,11 +36,11 @@ static char tmpfil[BUFSIZ];
 /*
 ** static prototypes
 */
-static RETSIGTYPE intrser (int);
+static RETSIGTYPE intrser(int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        pid_t child_id;
        int status, i, iscc = 0, nvec;
@@ -54,47 +54,46 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* foil search of user profile/context */
-       if (context_foil (NULL) == -1)
-               done (1);
+       if (context_foil(NULL) == -1)
+               done(1);
 
        /* If no arguments, just incorporate new mail */
        if (argc == 1) {
-               execlp (incproc, r1bindex (incproc, '/'), NULL);
-               adios (incproc, "unable to exec");
+               execlp(incproc, r1bindex(incproc, '/'), NULL);
+               adios(incproc, "unable to exec");
        }
 
-       arguments = getarguments (invo_name, argc, argv, 0);
+       arguments = getarguments(invo_name, argc, argv, 0);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [addrs ... [switches]]",
-                                               invo_name);
-                                       print_help (buf, switches, 0);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [addrs ... [switches]]", invo_name);
+                                       print_help(buf, switches, 0);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case FROMSW:
                                        if (!(from = *argp++) || *from == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case BODYSW:
                                        if (!(body = *argp++) || *body == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case CCSW:
@@ -103,7 +102,7 @@ main (int argc, char **argv)
 
                                case SUBJSW:
                                        if (!(subject = *argp++) || *subject == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case RESNDSW:
@@ -116,51 +115,52 @@ main (int argc, char **argv)
                        }
                }
                if (iscc)
-                       cclist = cclist ? add (cp, add (", ", cclist)) : getcpy (cp);
+                       cclist = cclist ? add(cp, add(", ", cclist)) :
+                                       getcpy(cp);
                else
-                       tolist = tolist ? add (cp, add (", ", tolist)) : getcpy (cp);
+                       tolist = tolist ? add(cp, add(", ", tolist)) :
+                                       getcpy(cp);
        }
 
        if (tolist == NULL)
-               adios (NULL, "usage: %s addrs ... [switches]", invo_name);
+               adios(NULL, "usage: %s addrs ... [switches]", invo_name);
 
        tfile = m_mktemp2(NULL, invo_name, NULL, &out);
-       if (tfile == NULL) adios("mhmail", "unable to create temporary file");
+       if (tfile == NULL)
+               adios("mhmail", "unable to create temporary file");
        chmod(tfile, 0600);
-       strncpy (tmpfil, tfile, sizeof(tmpfil));
+       strncpy(tmpfil, tfile, sizeof(tmpfil));
 
-       SIGNAL2 (SIGINT, intrser);
+       SIGNAL2(SIGINT, intrser);
 
-       fprintf (out, "%sTo: %s\n", resent ? "Resent-" : "", tolist);
+       fprintf(out, "%sTo: %s\n", resent ? "Resent-" : "", tolist);
        if (cclist)
-               fprintf (out, "%scc: %s\n", resent ? "Resent-" : "", cclist);
+               fprintf(out, "%scc: %s\n", resent ? "Resent-" : "", cclist);
        if (subject)
-               fprintf (out, "%sSubject: %s\n", resent ? "Resent-" : "", subject);
+               fprintf(out, "%sSubject: %s\n", resent ? "Resent-" : "", subject);
        if (from)
-               fprintf (out, "%sFrom: %s\n", resent ? "Resent-" : "", from);
+               fprintf(out, "%sFrom: %s\n", resent ? "Resent-" : "", from);
        if (!resent)
-               fputs ("\n", out);
+               fputs("\n", out);
 
        if (body) {
-               fprintf (out, "%s", body);
-               if (*body && *(body + strlen (body) - 1) != '\n')
-                       fputs ("\n", out);
+               fprintf(out, "%s", body);
+               if (*body && *(body + strlen(body) - 1) != '\n')
+                       fputs("\n", out);
        } else {
-               for (somebody = 0;
-                               (i = fread (buf, sizeof(*buf), sizeof(buf),
-                               stdin)) > 0;
-                               somebody++)
-                       if (fwrite (buf, sizeof(*buf), i, out) != i)
-                               adios (tmpfil, "error writing");
+               for (somebody = 0; (i = fread(buf, sizeof(*buf), sizeof(buf),
+                               stdin)) > 0; somebody++)
+                       if (fwrite(buf, sizeof(*buf), i, out) != i)
+                               adios(tmpfil, "error writing");
                if (!somebody) {
-                       unlink (tmpfil);
-                       done (1);
+                       unlink(tmpfil);
+                       done(1);
                }
        }
-       fclose (out);
+       fclose(out);
 
        nvec = 0;
-       vec[nvec++] = r1bindex (postproc, '/');
+       vec[nvec++] = r1bindex(postproc, '/');
        vec[nvec++] = tmpfil;
        if (resent)
                vec[nvec++] = "-dist";
@@ -169,28 +169,29 @@ main (int argc, char **argv)
        vec[nvec] = NULL;
 
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
-               sleep (5);
+               sleep(5);
 
        if (child_id == NOTOK) {
                /* report failure and then send it */
-               adios (NULL, "unable to fork");
+               adios(NULL, "unable to fork");
        } else if (child_id) {
                /* parent process */
                if ((status = pidXwait(child_id, postproc))) {
-                       fprintf (stderr, "Letter saved in dead.letter\n");
-                       execl ("/bin/mv", "mv", tmpfil, "dead.letter", NULL);
-                       execl ("/usr/bin/mv", "mv", tmpfil, "dead.letter", NULL);
-                       perror ("mv");
-                       _exit (-1);
+                       fprintf(stderr, "Letter saved in dead.letter\n");
+                       execl("/bin/mv", "mv", tmpfil, "dead.letter", NULL);
+                       execl("/usr/bin/mv", "mv", tmpfil, "dead.letter",
+                                       NULL);
+                       perror("mv");
+                       _exit(-1);
                }
-               unlink (tmpfil);
-               done (status ? 1 : 0);
+               unlink(tmpfil);
+               done(status ? 1 : 0);
        } else {
                /* child process */
-               execvp (postproc, vec);
-               fprintf (stderr, "unable to exec ");
-               perror (postproc);
-               _exit (-1);
+               execvp(postproc, vec);
+               fprintf(stderr, "unable to exec ");
+               perror(postproc);
+               _exit(-1);
        }
 
        return 0;  /* dead code to satisfy the compiler */
@@ -198,14 +199,14 @@ main (int argc, char **argv)
 
 
 static RETSIGTYPE
-intrser (int i)
+intrser(int i)
 {
 #ifndef RELIABLE_SIGNALS
        if (i)
-               SIGNAL (i, SIG_IGN);
+               SIGNAL(i, SIG_IGN);
 #endif
 
-       unlink (tmpfil);
-       done (i != 0 ? 1 : 0);
+       unlink(tmpfil);
+       done(i != 0 ? 1 : 0);
 }
 
index 869fe1c..313719f 100644 (file)
@@ -31,27 +31,29 @@ static char *errs = NULL;
 /*
 ** prototypes
 */
-int part_ok (CT, int);
-int type_ok (CT, int);
-void set_endian (void);
-int make_intermediates (char *);
-void content_error (char *, CT, char *, ...);
-void flush_errors (void);
+int part_ok(CT, int);
+int type_ok(CT, int);
+void set_endian(void);
+int make_intermediates(char *);
+void content_error(char *, CT, char *, ...);
+void flush_errors(void);
 
 
 int
-part_ok (CT ct, int sP)
+part_ok(CT ct, int sP)
 {
        char **ap;
        int len;
 
-       if (npart == 0 || (ct->c_type == CT_MULTIPART && (sP || ct->c_subtype)))
+       if (npart == 0 || (ct->c_type == CT_MULTIPART &&
+                       (sP || ct->c_subtype)))
                return 1;
 
        for (ap = parts; *ap; ap++) {
                len = strlen(*ap);
-               if (!strncmp (*ap, ct->c_partno, len) &&
-                               (!ct->c_partno[len] || ct->c_partno[len] == '.' ))
+               if (!strncmp(*ap, ct->c_partno, len) &&
+                               (!ct->c_partno[len] ||
+                               ct->c_partno[len] == '.' ))
                        return 1;
        }
 
@@ -60,18 +62,20 @@ part_ok (CT ct, int sP)
 
 
 int
-type_ok (CT ct, int sP)
+type_ok(CT ct, int sP)
 {
        char **ap;
        char buffer[BUFSIZ];
        CI ci = &ct->c_ctinfo;
 
-       if (ntype == 0 || (ct->c_type == CT_MULTIPART && (sP || ct->c_subtype)))
+       if (ntype == 0 || (ct->c_type == CT_MULTIPART &&
+                       (sP || ct->c_subtype)))
                return 1;
 
-       snprintf (buffer, sizeof(buffer), "%s/%s", ci->ci_type, ci->ci_subtype);
+       snprintf(buffer, sizeof(buffer), "%s/%s", ci->ci_type, ci->ci_subtype);
        for (ap = types; *ap; ap++)
-               if (!mh_strcasecmp (*ap, ci->ci_type) || !mh_strcasecmp (*ap, buffer))
+               if (!mh_strcasecmp(*ap, ci->ci_type) ||
+                               !mh_strcasecmp(*ap, buffer))
                        return 1;
 
        return 0;
@@ -79,7 +83,7 @@ type_ok (CT ct, int sP)
 
 
 void
-set_endian (void)
+set_endian(void)
 {
        union {
                long l;
@@ -89,13 +93,13 @@ set_endian (void)
        un.l = 1;
        endian = un.c[0] ? -1 : 1;
        if (debugsw)
-               fprintf (stderr, "%s endian architecture\n",
+               fprintf(stderr, "%s endian architecture\n",
                                endian > 0 ? "big" : "little");
 }
 
 
 int
-make_intermediates (char *file)
+make_intermediates(char *file)
 {
        char *cp;
 
@@ -103,24 +107,25 @@ make_intermediates (char *file)
                struct stat st;
 
                *cp = '\0';
-               if (stat (file, &st) == NOTOK) {
+               if (stat(file, &st) == NOTOK) {
                        int answer;
                        char *ep;
                        if (errno != ENOENT) {
-                               advise (file, "error on directory");
+                               advise(file, "error on directory");
 losing_directory:
                                *cp = '/';
                                return NOTOK;
                        }
 
-                       ep = concat ("Create directory \"", file, "\"? ", NULL);
-                       answer = getanswer (ep);
-                       free (ep);
+                       ep = concat("Create directory \"", file, "\"? ", NULL);
+                       answer = getanswer(ep);
+                       free(ep);
 
                        if (!answer)
                                goto losing_directory;
-                       if (!makedir (file)) {
-                               advise (NULL, "unable to create directory %s", file);
+                       if (!makedir(file)) {
+                               advise(NULL, "unable to create directory %s",
+                                               file);
                                goto losing_directory;
                        }
                }
@@ -137,7 +142,7 @@ losing_directory:
 */
 
 void
-content_error (char *what, CT ct, char *fmt, ...)
+content_error(char *what, CT ct, char *fmt, ...)
 {
        va_list arglist;
        int i, len, buflen;
@@ -148,16 +153,16 @@ content_error (char *what, CT ct, char *fmt, ...)
        buflen = sizeof(buffer);
 
        if (userrs && invo_name && *invo_name) {
-               snprintf (bp, buflen, "%s: ", invo_name);
-               len = strlen (bp);
+               snprintf(bp, buflen, "%s: ", invo_name);
+               len = strlen(bp);
                bp += len;
                buflen -= len;
        }
 
-       va_start (arglist, fmt);
+       va_start(arglist, fmt);
 
-       vsnprintf (bp, buflen, fmt, arglist);
-       len = strlen (bp);
+       vsnprintf(bp, buflen, fmt, arglist);
+       len = strlen(bp);
        bp += len;
        buflen -= len;
 
@@ -167,48 +172,48 @@ content_error (char *what, CT ct, char *fmt, ...)
                char *s;
 
                if (*what) {
-                       snprintf (bp, buflen, " %s: ", what);
-                       len = strlen (bp);
+                       snprintf(bp, buflen, " %s: ", what);
+                       len = strlen(bp);
                        bp += len;
                        buflen -= len;
                }
 
-               if ((s = strerror (errno)))
-                       snprintf (bp, buflen, "%s", s);
+               if ((s = strerror(errno)))
+                       snprintf(bp, buflen, "%s", s);
                else
-                       snprintf (bp, buflen, "Error %d", errno);
+                       snprintf(bp, buflen, "Error %d", errno);
 
-               len = strlen (bp);
+               len = strlen(bp);
                bp += len;
                buflen -= len;
        }
 
-       i = strlen (invo_name) + 2;
+       i = strlen(invo_name) + 2;
 
        /* Now add content type and subtype */
-       snprintf (bp, buflen, "\n%*.*s(content %s/%s", i, i, "",
-               ci->ci_type, ci->ci_subtype);
-       len = strlen (bp);
+       snprintf(bp, buflen, "\n%*.*s(content %s/%s", i, i, "",
+                       ci->ci_type, ci->ci_subtype);
+       len = strlen(bp);
        bp += len;
        buflen -= len;
 
        /* Now add the message/part number */
        if (ct->c_file) {
-               snprintf (bp, buflen, " in message %s", ct->c_file);
-               len = strlen (bp);
+               snprintf(bp, buflen, " in message %s", ct->c_file);
+               len = strlen(bp);
                bp += len;
                buflen -= len;
 
                if (ct->c_partno) {
-                       snprintf (bp, buflen, ", part %s", ct->c_partno);
-                       len = strlen (bp);
+                       snprintf(bp, buflen, ", part %s", ct->c_partno);
+                       len = strlen(bp);
                        bp += len;
                        buflen -= len;
                }
        }
 
-       snprintf (bp, buflen, ")");
-       len = strlen (bp);
+       snprintf(bp, buflen, ")");
+       len = strlen(bp);
        bp += len;
        buflen -= len;
 
@@ -217,20 +222,20 @@ content_error (char *what, CT ct, char *fmt, ...)
                *bp = '\0';
                buflen--;
 
-               errs = add (buffer, errs);
+               errs = add(buffer, errs);
        } else {
-               advise (NULL, "%s", buffer);
+               advise(NULL, "%s", buffer);
        }
 }
 
 
 void
-flush_errors (void)
+flush_errors(void)
 {
        if (errs) {
-               fflush (stdout);
-               fprintf (stderr, "%s", errs);
-               free (errs);
+               fflush(stdout);
+               fprintf(stderr, "%s", errs);
+               free(errs);
                errs = NULL;
        }
 }
index e0a8cfa..8517781 100644 (file)
@@ -66,19 +66,19 @@ static char nib2b64[0x40+1] =
 /*
 ** prototypes
 */
-int output_message (CT, char *);
-int output_message_fp (CT, FILE *, char *);
-int writeBase64aux (FILE *, FILE *);
+int output_message(CT, char *);
+int output_message_fp(CT, FILE *, char *);
+int writeBase64aux(FILE *, FILE *);
 
 /*
 ** static prototypes
 */
-static int output_content (CT, FILE *);
-static void output_headers (CT, FILE *);
-static int writeExternalBody (CT, FILE *);
-static int write8Bit (CT, FILE *);
-static int writeQuoted (CT, FILE *);
-static int writeBase64 (CT, FILE *);
+static int output_content(CT, FILE *);
+static void output_headers(CT, FILE *);
+static int writeExternalBody(CT, FILE *);
+static int write8Bit(CT, FILE *);
+static int writeQuoted(CT, FILE *);
+static int writeBase64(CT, FILE *);
 
 
 /*
@@ -88,26 +88,26 @@ static int writeBase64 (CT, FILE *);
 */
 
 int
-output_message_fp (CT ct, FILE *fp, char *file)
+output_message_fp(CT ct, FILE *fp, char *file)
 {
-       if (output_content (ct, fp) == NOTOK)
+       if (output_content(ct, fp) == NOTOK)
                return NOTOK;
 
-       if (fflush (fp)) {
-               advise ((file?file:"<FILE*>"), "error writing to");
+       if (fflush(fp)) {
+               advise((file?file:"<FILE*>"), "error writing to");
                return NOTOK;
        }
        return OK;
 }
 
 int
-output_message (CT ct, char *file)
+output_message(CT ct, char *file)
 {
        FILE *fp;
        int status;
 
-       if ((fp = fopen (file, "w")) == NULL) {
-               advise (file, "unable to open for writing");
+       if ((fp = fopen(file, "w")) == NULL) {
+               advise(file, "unable to open for writing");
                return NOTOK;
        }
        status = output_message_fp(ct, fp, file);
@@ -121,7 +121,7 @@ output_message (CT ct, char *file)
 */
 
 static int
-output_content (CT ct, FILE *out)
+output_content(CT ct, FILE *out)
 {
        int result = 0;
        CI ci = &ct->c_ctinfo;
@@ -129,7 +129,7 @@ output_content (CT ct, FILE *out)
        /*
        ** Output all header fields for this content
        */
-       output_headers (ct, out);
+       output_headers(ct, out);
 
        /*
        ** If this is the internal content structure for a
@@ -149,34 +149,34 @@ output_content (CT ct, FILE *out)
                struct part *part;
 
                if (ct->c_rfc934)
-                       putc ('\n', out);
+                       putc('\n', out);
 
                m = (struct multipart *) ct->c_ctparams;
                for (part = m->mp_parts; part; part = part->mp_next) {
                        CT p = part->mp_part;
 
-                       fprintf (out, "\n--%s\n", ci->ci_values[0]);
-                       if (output_content (p, out) == NOTOK)
+                       fprintf(out, "\n--%s\n", ci->ci_values[0]);
+                       if (output_content(p, out) == NOTOK)
                                return NOTOK;
                }
-               fprintf (out, "\n--%s--\n", ci->ci_values[0]);
+               fprintf(out, "\n--%s--\n", ci->ci_values[0]);
        }
        break;
 
        case CT_MESSAGE:
-               putc ('\n', out);
+               putc('\n', out);
                if (ct->c_subtype == MESSAGE_EXTERNAL) {
                        struct exbody *e;
 
                        e = (struct exbody *) ct->c_ctparams;
-                       if (output_content (e->eb_content, out) == NOTOK)
+                       if (output_content(e->eb_content, out) == NOTOK)
                                return NOTOK;
 
                        /* output phantom body for access-type "mail-server" */
                        if (e->eb_body)
-                               writeExternalBody (ct, out);
+                               writeExternalBody(ct, out);
                } else {
-                       result = write8Bit (ct, out);
+                       result = write8Bit(ct, out);
                }
                break;
 
@@ -186,32 +186,32 @@ output_content (CT ct, FILE *out)
        default:
                switch (ct->c_encoding) {
                case CE_7BIT:
-                       putc ('\n', out);
-                       result = write8Bit (ct, out);
+                       putc('\n', out);
+                       result = write8Bit(ct, out);
                        break;
 
                case CE_8BIT:
-                       putc ('\n', out);
-                       result = write8Bit (ct, out);
+                       putc('\n', out);
+                       result = write8Bit(ct, out);
                        break;
 
                case CE_QUOTED:
-                       putc ('\n', out);
-                       result = writeQuoted (ct, out);
+                       putc('\n', out);
+                       result = writeQuoted(ct, out);
                        break;
 
                case CE_BASE64:
-                       putc ('\n', out);
-                       result = writeBase64 (ct, out);
+                       putc('\n', out);
+                       result = writeBase64(ct, out);
                        break;
 
                case CE_BINARY:
-                       advise (NULL, "can't handle binary transfer encoding in content");
+                       advise(NULL, "can't handle binary transfer encoding in content");
                        result = NOTOK;
                        break;
 
                default:
-                       advise (NULL, "unknown transfer encoding in content");
+                       advise(NULL, "unknown transfer encoding in content");
                        result = NOTOK;
                        break;
                }
@@ -227,13 +227,13 @@ output_content (CT ct, FILE *out)
 */
 
 static void
-output_headers (CT ct, FILE *out)
+output_headers(CT ct, FILE *out)
 {
        HF hp;
 
        hp = ct->c_first_hf;
        while (hp) {
-               fprintf (out, "%s:%s", hp->name, hp->value);
+               fprintf(out, "%s:%s", hp->name, hp->value);
                hp = hp->next;
        }
 }
@@ -244,12 +244,12 @@ output_headers (CT ct, FILE *out)
 */
 
 static int
-writeExternalBody (CT ct, FILE *out)
+writeExternalBody(CT ct, FILE *out)
 {
        char **ap, **ep, *cp;
        struct exbody *e = (struct exbody *) ct->c_ctparams;
 
-       putc ('\n', out);
+       putc('\n', out);
        for (cp = e->eb_body; *cp; cp++) {
                CT ct2 = e->eb_content;
                CI ci2 = &ct2->c_ctinfo;
@@ -258,33 +258,36 @@ writeExternalBody (CT ct, FILE *out)
                        switch (*++cp) {
                        case 'I':
                                if (ct2->c_id) {
-                                       char *dp = trimcpy (ct2->c_id);
+                                       char *dp = trimcpy(ct2->c_id);
 
-                                       fputs (dp, out);
-                                       free (dp);
+                                       fputs(dp, out);
+                                       free(dp);
                                }
                                continue;
 
                        case 'N':
-                               for (ap = ci2->ci_attrs, ep = ci2->ci_values; *ap; ap++, ep++)
-                                       if (!mh_strcasecmp (*ap, "name")) {
-                                               fprintf (out, "%s", *ep);
+                               for (ap = ci2->ci_attrs, ep = ci2->ci_values;
+                                               *ap; ap++, ep++)
+                                       if (!mh_strcasecmp(*ap, "name")) {
+                                               fprintf(out, "%s", *ep);
                                                break;
                                        }
                                continue;
 
                        case 'T':
-                               fprintf (out, "%s/%s", ci2->ci_type, ci2->ci_subtype);
-                               for (ap = ci2->ci_attrs, ep = ci2->ci_values; *ap; ap++, ep++)
-                                       fprintf (out, "; %s=\"%s\"", *ap, *ep);
+                               fprintf(out, "%s/%s", ci2->ci_type,
+                                               ci2->ci_subtype);
+                               for (ap = ci2->ci_attrs, ep = ci2->ci_values;
+                                               *ap; ap++, ep++)
+                                       fprintf(out, "; %s=\"%s\"", *ap, *ep);
                                continue;
 
                        case 'n':
-                               putc ('\n', out);
+                               putc('\n', out);
                                continue;
 
                        case 't':
-                               putc ('\t', out);
+                               putc('\t', out);
                                continue;
 
                        case '\0':
@@ -296,13 +299,13 @@ writeExternalBody (CT ct, FILE *out)
                                break;
 
                        default:
-                               putc ('\\', out);
+                               putc('\\', out);
                                break;
                        }
                }
-               putc (*cp, out);
+               putc(*cp, out);
        }
-       putc ('\n', out);
+       putc('\n', out);
 
        return OK;
 }
@@ -313,7 +316,7 @@ writeExternalBody (CT ct, FILE *out)
 */
 
 static int
-write8Bit (CT ct, FILE *out)
+write8Bit(CT ct, FILE *out)
 {
        int fd;
        char c, *file, buffer[BUFSIZ];
@@ -324,12 +327,12 @@ write8Bit (CT ct, FILE *out)
                return NOTOK;
 
        c = '\n';
-       while (fgets (buffer, sizeof(buffer) - 1, ce->ce_fp)) {
-               c = buffer[strlen (buffer) - 1];
-               fputs (buffer, out);
+       while (fgets(buffer, sizeof(buffer) - 1, ce->ce_fp)) {
+               c = buffer[strlen(buffer) - 1];
+               fputs(buffer, out);
        }
        if (c != '\n')
-               putc ('\n', out);
+               putc('\n', out);
 
        (*ct->c_ceclosefnx) (ct);
        return OK;
@@ -341,7 +344,7 @@ write8Bit (CT ct, FILE *out)
 */
 
 static int
-writeQuoted (CT ct, FILE *out)
+writeQuoted(CT ct, FILE *out)
 {
        int fd;
        char *cp, *file;
@@ -352,43 +355,42 @@ writeQuoted (CT ct, FILE *out)
        if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
                return NOTOK;
 
-       while (fgets (buffer, sizeof(buffer) - 1, ce->ce_fp)) {
+       while (fgets(buffer, sizeof(buffer) - 1, ce->ce_fp)) {
                int n;
 
-               cp = buffer + strlen (buffer) - 1;
+               cp = buffer + strlen(buffer) - 1;
                if ((c = *cp) == '\n')
                        *cp = '\0';
 
-               if (strncmp (cp = buffer, "From ", sizeof("From ") - 1) == 0) {
-                       fprintf (out, "=%02X", *cp++ & 0xff);
+               if (strncmp(cp = buffer, "From ", sizeof("From ") - 1) == 0) {
+                       fprintf(out, "=%02X", *cp++ & 0xff);
                        n = 3;
                } else {
                        n = 0;
                }
                for (; *cp; cp++) {
                        if (n > CPERLIN - 3) {
-                               fputs ("=\n", out);
+                               fputs("=\n", out);
                                n = 0;
                        }
 
                        switch (*cp) {
                                case ' ':
                                case '\t':
-                                       putc (*cp, out);
+                                       putc(*cp, out);
                                        n++;
                                        break;
 
                                default:
-                                       if (*cp < '!' || *cp > '~'
-                                                       || (ebcdicsw && !ebcdicsafe[*cp & 0xff]))
+                                       if (*cp < '!' || *cp > '~' || (ebcdicsw && !ebcdicsafe[*cp & 0xff]))
                                                goto three_print;
-                                       putc (*cp, out);
+                                       putc(*cp, out);
                                        n++;
                                        break;
 
                                case '=':
 three_print:
-                                       fprintf (out, "=%02X", *cp & 0xff);
+                                       fprintf(out, "=%02X", *cp & 0xff);
                                        n += 3;
                                        break;
                        }
@@ -396,11 +398,11 @@ three_print:
 
                if (c == '\n') {
                        if (cp > buffer && (*--cp == ' ' || *cp == '\t'))
-                               fputs ("=\n", out);
+                               fputs("=\n", out);
 
-                       putc ('\n', out);
+                       putc('\n', out);
                } else {
-                       fputs ("=\n", out);
+                       fputs("=\n", out);
                }
        }
 
@@ -414,7 +416,7 @@ three_print:
 */
 
 static int
-writeBase64 (CT ct, FILE *out)
+writeBase64(CT ct, FILE *out)
 {
        int fd, result;
        char *file;
@@ -424,20 +426,20 @@ writeBase64 (CT ct, FILE *out)
        if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
                return NOTOK;
 
-       result = writeBase64aux (ce->ce_fp, out);
+       result = writeBase64aux(ce->ce_fp, out);
        (*ct->c_ceclosefnx) (ct);
        return result;
 }
 
 
 int
-writeBase64aux (FILE *in, FILE *out)
+writeBase64aux(FILE *in, FILE *out)
 {
        int cc, n;
        char inbuf[3];
 
        n = BPERLIN;
-       while ((cc = fread (inbuf, sizeof(*inbuf), sizeof(inbuf), in)) > 0) {
+       while ((cc = fread(inbuf, sizeof(*inbuf), sizeof(inbuf), in)) > 0) {
                unsigned long bits;
                char *bp;
                char outbuf[4];
@@ -459,20 +461,20 @@ writeBase64aux (FILE *in, FILE *out)
                                outbuf[2] = '=';
                }
 
-               fwrite (outbuf, sizeof(*outbuf), sizeof(outbuf), out);
+               fwrite(outbuf, sizeof(*outbuf), sizeof(outbuf), out);
 
                if (cc < sizeof(inbuf)) {
-                       putc ('\n', out);
+                       putc('\n', out);
                        return OK;
                }
 
                if (--n <= 0) {
                        n = BPERLIN;
-                       putc ('\n', out);
+                       putc('\n', out);
                }
        }
        if (n != BPERLIN)
-               putc ('\n', out);
+               putc('\n', out);
 
        return OK;
 }
index f92a3ec..575c7a7 100644 (file)
@@ -84,31 +84,30 @@ main(int argc, char **argv)
        char *cp, buf[BUFSIZ], **argp;
        char **arguments, *comps[MAXARGS];
 
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [profile-components] [switches]",
-                                               invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case COMPSW:
                                        components = 1;
@@ -138,7 +137,7 @@ main(int argc, char **argv)
 
                if (components >= 0)
                        advise(NULL, "-%scomponents ignored with -all",
-                                  components ? "" : "no");
+                                       components ? "" : "no");
 
                /* print all entries in context/profile list */
                for (np = m_defs; np; np = np->n_next)
@@ -153,7 +152,7 @@ main(int argc, char **argv)
                ** value (as determined after context is read).
                */
                for (ps = procs; ps->p_name; ps++)
-                       printf ("%s: %s\n", ps->p_name,
+                       printf("%s: %s\n", ps->p_name,
                                        *ps->p_field ? *ps->p_field : "");
 
        } else {
@@ -163,9 +162,9 @@ main(int argc, char **argv)
                for (i = 0; i < compp; i++)  {
                        register char *value;
 
-                       value = context_find (comps[i]);
+                       value = context_find(comps[i]);
                        if (!value)
-                               value = p_find (comps[i]);
+                               value = p_find(comps[i]);
                        if (value) {
                                if (components)
                                        printf("%s: ", comps[i]);
@@ -176,7 +175,7 @@ main(int argc, char **argv)
                }
        }
 
-       done (missed);
+       done(missed);
        return 1;
 }
 
@@ -187,7 +186,7 @@ p_find(char *str)
        struct proc *ps;
 
        for (ps = procs; ps->p_name; ps++)
-               if (!mh_strcasecmp (ps->p_name, str))
+               if (!mh_strcasecmp(ps->p_name, str))
                        return (*ps->p_field);
 
        return NULL;
index 62fc765..db6f0ad 100644 (file)
@@ -90,48 +90,48 @@ struct k2v SubApplication[] = {
 
 
 /* ftpsbr.c */
-int ftp_get (char *, char *, char *, char *, char *, char *, int, int);
+int ftp_get(char *, char *, char *, char *, char *, char *, int, int);
 
 /* mhcachesbr.c */
-int find_cache (CT, int, int *, char *, char *, int);
+int find_cache(CT, int, int *, char *, char *, int);
 
 /* mhmisc.c */
-int part_ok (CT, int);
-int type_ok (CT, int);
-int make_intermediates (char *);
-void content_error (char *, CT, char *, ...);
+int part_ok(CT, int);
+int type_ok(CT, int);
+int make_intermediates(char *);
+void content_error(char *, CT, char *, ...);
 
 /* mhfree.c */
-void free_content (CT);
-void free_encoding (CT, int);
+void free_content(CT);
+void free_encoding(CT, int);
 
 /*
 ** static prototypes
 */
-static CT get_content (FILE *, char *, int);
-static int get_comment (CT, unsigned char **, int);
-
-static int InitGeneric (CT);
-static int InitText (CT);
-static int InitMultiPart (CT);
-static void reverse_parts (CT);
-static int InitMessage (CT);
-static int InitApplication (CT);
-static int init_encoding (CT, OpenCEFunc);
-static unsigned long size_encoding (CT);
-static int InitBase64 (CT);
-static int openBase64 (CT, char **);
-static int InitQuoted (CT);
-static int openQuoted (CT, char **);
-static int Init7Bit (CT);
-static int openExternal (CT, CT, CE, char **, int *);
-static int InitFile (CT);
-static int openFile (CT, char **);
-static int InitFTP (CT);
-static int openFTP (CT, char **);
-static int InitMail (CT);
-static int openMail (CT, char **);
-static int readDigest (CT, char *);
+static CT get_content(FILE *, char *, int);
+static int get_comment(CT, unsigned char **, int);
+
+static int InitGeneric(CT);
+static int InitText(CT);
+static int InitMultiPart(CT);
+static void reverse_parts(CT);
+static int InitMessage(CT);
+static int InitApplication(CT);
+static int init_encoding(CT, OpenCEFunc);
+static unsigned long size_encoding(CT);
+static int InitBase64(CT);
+static int openBase64(CT, char **);
+static int InitQuoted(CT);
+static int openQuoted(CT, char **);
+static int Init7Bit(CT);
+static int openExternal(CT, CT, CE, char **, int *);
+static int InitFile(CT);
+static int openFile(CT, char **);
+static int InitFTP(CT);
+static int openFTP(CT, char **);
+static int InitMail(CT);
+static int openMail(CT, char **);
+static int readDigest(CT, char *);
 
 struct str2init str2cts[] = {
        { "application", CT_APPLICATION, InitApplication },
@@ -171,14 +171,14 @@ struct str2init str2methods[] = {
 
 
 int
-pidcheck (int status)
+pidcheck(int status)
 {
        if ((status & 0xff00) == 0xff00 || (status & 0x007f) != SIGQUIT)
                return status;
 
-       fflush (stdout);
-       fflush (stderr);
-       done (1);
+       fflush(stdout);
+       fflush(stderr);
+       done(1);
        return 1;
 }
 
@@ -189,7 +189,7 @@ pidcheck (int status)
 ** entity in the file.
 */
 CT
-parse_mime (char *file)
+parse_mime(char *file)
 {
        int is_stdin;
        char buffer[BUFSIZ];
@@ -199,39 +199,39 @@ parse_mime (char *file)
        /*
        ** Check if file is actually standard input
        */
-       if ((is_stdin = !(strcmp (file, "-")))) {
+       if ((is_stdin = !(strcmp(file, "-")))) {
                char *tfile = m_mktemp2(NULL, invo_name, NULL, &fp);
                if (tfile == NULL) {
                        advise("mhparse", "unable to create temporary file");
                        return NULL;
                }
-               file = add (tfile, NULL);
-               chmod (file, 0600);
+               file = add(tfile, NULL);
+               chmod(file, 0600);
 
-               while (fgets (buffer, sizeof(buffer), stdin))
-                       fputs (buffer, fp);
-               fflush (fp);
+               while (fgets(buffer, sizeof(buffer), stdin))
+                       fputs(buffer, fp);
+               fflush(fp);
 
-               if (ferror (stdin)) {
-                       unlink (file);
-                       advise ("stdin", "error reading");
+               if (ferror(stdin)) {
+                       unlink(file);
+                       advise("stdin", "error reading");
                        return NULL;
                }
-               if (ferror (fp)) {
-                       unlink (file);
-                       advise (file, "error writing");
+               if (ferror(fp)) {
+                       unlink(file);
+                       advise(file, "error writing");
                        return NULL;
                }
-               fseek (fp, 0L, SEEK_SET);
-       } else if ((fp = fopen (file, "r")) == NULL) {
-               advise (file, "unable to read");
+               fseek(fp, 0L, SEEK_SET);
+       } else if ((fp = fopen(file, "r")) == NULL) {
+               advise(file, "unable to read");
                return NULL;
        }
 
-       if (!(ct = get_content (fp, file, 1))) {
+       if (!(ct = get_content(fp, file, 1))) {
                if (is_stdin)
-                       unlink (file);
-               advise (NULL, "unable to decode %s", file);
+                       unlink(file);
+               advise(NULL, "unable to decode %s", file);
                return NULL;
        }
 
@@ -241,17 +241,17 @@ parse_mime (char *file)
        ct->c_fp = NULL;
 
        if (ct->c_end == 0L) {
-               fseek (fp, 0L, SEEK_END);
-               ct->c_end = ftell (fp);
+               fseek(fp, 0L, SEEK_END);
+               ct->c_end = ftell(fp);
        }
 
        if (ct->c_ctinitfnx && (*ct->c_ctinitfnx) (ct) == NOTOK) {
-               fclose (fp);
-               free_content (ct);
+               fclose(fp);
+               free_content(ct);
                return NULL;
        }
 
-       fclose (fp);
+       fclose(fp);
        return ct;
 }
 
@@ -268,7 +268,7 @@ parse_mime (char *file)
 */
 
 static CT
-get_content (FILE *in, char *file, int toplevel)
+get_content(FILE *in, char *file, int toplevel)
 {
        int compnum, state;
        char buf[BUFSIZ], name[NAMESZ];
@@ -277,59 +277,61 @@ get_content (FILE *in, char *file, int toplevel)
        HF hp;
 
        /* allocate the content structure */
-       if (!(ct = (CT) calloc (1, sizeof(*ct))))
-               adios (NULL, "out of memory");
+       if (!(ct = (CT) calloc(1, sizeof(*ct))))
+               adios(NULL, "out of memory");
 
        ct->c_fp = in;
-       ct->c_file = add (file, NULL);
-       ct->c_begin = ftell (ct->c_fp) + 1;
+       ct->c_file = add(file, NULL);
+       ct->c_begin = ftell(ct->c_fp) + 1;
 
        /*
        ** Parse the header fields for this
        ** content into a linked list.
        */
        for (compnum = 1, state = FLD;;) {
-               switch (state = m_getfld (state, name, buf, sizeof(buf), in)) {
+               switch (state = m_getfld(state, name, buf, sizeof(buf), in)) {
                case FLD:
                case FLDPLUS:
                case FLDEOF:
                        compnum++;
 
                        /* get copies of the buffers */
-                       np = add (name, NULL);
-                       vp = add (buf, NULL);
+                       np = add(name, NULL);
+                       vp = add(buf, NULL);
 
                        /* if necessary, get rest of field */
                        while (state == FLDPLUS) {
-                               state = m_getfld (state, name, buf, sizeof(buf), in);
-                               vp = add (buf, vp);  /* add to previous value */
+                               state = m_getfld(state, name, buf,
+                                               sizeof(buf), in);
+                               vp = add(buf, vp);  /* add to previous value */
                        }
 
                        /* Now add the header data to the list */
-                       add_header (ct, np, vp);
+                       add_header(ct, np, vp);
 
                        /* continue, if this isn't the last header field */
                        if (state != FLDEOF) {
-                               ct->c_begin = ftell (in) + 1;
+                               ct->c_begin = ftell(in) + 1;
                                continue;
                        }
                        /* else fall... */
 
                case BODY:
                case BODYEOF:
-                       ct->c_begin = ftell (in) - strlen (buf);
+                       ct->c_begin = ftell(in) - strlen(buf);
                        break;
 
                case FILEEOF:
-                       ct->c_begin = ftell (in);
+                       ct->c_begin = ftell(in);
                        break;
 
                case LENERR:
                case FMTERR:
-                       adios (NULL, "message format error in component #%d", compnum);
+                       adios(NULL, "message format error in component #%d",
+                                       compnum);
 
                default:
-                       adios (NULL, "getfld() returned %d", state);
+                       adios(NULL, "getfld() returned %d", state);
                }
 
                /* break out of the loop */
@@ -346,60 +348,57 @@ get_content (FILE *in, char *file, int toplevel)
        hp = ct->c_first_hf;  /* start at first header field */
        while (hp) {
                /* Get MIME-Version field */
-               if (!mh_strcasecmp (hp->name, VRSN_FIELD)) {
+               if (!mh_strcasecmp(hp->name, VRSN_FIELD)) {
                        int ucmp;
                        char c;
                        unsigned char *cp, *dp;
 
                        if (ct->c_vrsn) {
-                               advise (NULL, "message %s has multiple %s: fields",
-                                       ct->c_file, VRSN_FIELD);
+                               advise(NULL, "message %s has multiple %s: fields", ct->c_file, VRSN_FIELD);
                                goto next_header;
                        }
-                       ct->c_vrsn = add (hp->value, NULL);
+                       ct->c_vrsn = add(hp->value, NULL);
 
                        /* Now, cleanup this field */
                        cp = ct->c_vrsn;
 
-                       while (isspace (*cp))
+                       while (isspace(*cp))
                                cp++;
                        for (dp = strchr(cp, '\n'); dp; dp = strchr(dp, '\n'))
                                *dp++ = ' ';
-                       for (dp = cp + strlen (cp) - 1; dp >= cp; dp--)
-                               if (!isspace (*dp))
+                       for (dp = cp + strlen(cp) - 1; dp >= cp; dp--)
+                               if (!isspace(*dp))
                                        break;
                        *++dp = '\0';
                        if (debugsw)
-                               fprintf (stderr, "%s: %s\n", VRSN_FIELD, cp);
+                               fprintf(stderr, "%s: %s\n", VRSN_FIELD, cp);
 
-                       if (*cp == '(' && get_comment (ct, &cp, 0) == NOTOK)
+                       if (*cp == '(' && get_comment(ct, &cp, 0) == NOTOK)
                                goto out;
 
-                       for (dp = cp; istoken (*dp); dp++)
+                       for (dp = cp; istoken(*dp); dp++)
                                continue;
                        c = *dp;
                        *dp = '\0';
-                       ucmp = !mh_strcasecmp (cp, VRSN_VALUE);
+                       ucmp = !mh_strcasecmp(cp, VRSN_VALUE);
                        *dp = c;
                        if (!ucmp) {
-                               admonish (NULL, "message %s has unknown value for %s: field (%s)",
-                               ct->c_file, VRSN_FIELD, cp);
+                               admonish(NULL, "message %s has unknown value for %s: field (%s)", ct->c_file, VRSN_FIELD, cp);
                        }
 
-               } else if (!mh_strcasecmp (hp->name, TYPE_FIELD)) {
+               } else if (!mh_strcasecmp(hp->name, TYPE_FIELD)) {
                        /* Get Content-Type field */
                        struct str2init *s2i;
                        CI ci = &ct->c_ctinfo;
 
                        /* Check if we've already seen a Content-Type header */
                        if (ct->c_ctline) {
-                               advise (NULL, "message %s has multiple %s: fields",
-                                       ct->c_file, TYPE_FIELD);
+                               advise(NULL, "message %s has multiple %s: fields", ct->c_file, TYPE_FIELD);
                                goto next_header;
                        }
 
                        /* Parse the Content-Type field */
-                       if (get_ctinfo (hp->value, ct, 0) == NOTOK)
+                       if (get_ctinfo(hp->value, ct, 0) == NOTOK)
                                goto out;
 
                        /*
@@ -407,14 +406,14 @@ get_content (FILE *in, char *file, int toplevel)
                        ** flag for this content type.
                        */
                        for (s2i = str2cts; s2i->si_key; s2i++)
-                               if (!mh_strcasecmp (ci->ci_type, s2i->si_key))
+                               if (!mh_strcasecmp(ci->ci_type, s2i->si_key))
                                        break;
-                       if (!s2i->si_key && !uprf (ci->ci_type, "X-"))
+                       if (!s2i->si_key && !uprf(ci->ci_type, "X-"))
                                s2i++;
                        ct->c_type = s2i->si_val;
                        ct->c_ctinitfnx = s2i->si_init;
 
-               } else if (!mh_strcasecmp (hp->name, ENCODING_FIELD)) {
+               } else if (!mh_strcasecmp(hp->name, ENCODING_FIELD)) {
                        /* Get Content-Transfer-Encoding field */
                        char c;
                        unsigned char *cp, *dp;
@@ -425,17 +424,16 @@ get_content (FILE *in, char *file, int toplevel)
                        ** Content-Transfer-Encoding field
                        */
                        if (ct->c_celine) {
-                               advise (NULL, "message %s has multiple %s: fields",
-                                       ct->c_file, ENCODING_FIELD);
+                               advise(NULL, "message %s has multiple %s: fields", ct->c_file, ENCODING_FIELD);
                                goto next_header;
                        }
 
                        /* get copy of this field */
-                       ct->c_celine = cp = add (hp->value, NULL);
+                       ct->c_celine = cp = add(hp->value, NULL);
 
-                       while (isspace (*cp))
+                       while (isspace(*cp))
                                cp++;
-                       for (dp = cp; istoken (*dp); dp++)
+                       for (dp = cp; istoken(*dp); dp++)
                                continue;
                        c = *dp;
                        *dp = '\0';
@@ -445,9 +443,9 @@ get_content (FILE *in, char *file, int toplevel)
                        ** for this transfer encoding.
                        */
                        for (s2i = str2ces; s2i->si_key; s2i++)
-                               if (!mh_strcasecmp (cp, s2i->si_key))
+                               if (!mh_strcasecmp(cp, s2i->si_key))
                                        break;
-                       if (!s2i->si_key && !uprf (cp, "X-"))
+                       if (!s2i->si_key && !uprf(cp, "X-"))
                                s2i++;
                        *dp = c;
                        ct->c_encoding = s2i->si_val;
@@ -456,7 +454,7 @@ get_content (FILE *in, char *file, int toplevel)
                        if (s2i->si_init && (*s2i->si_init) (ct) == NOTOK)
                                goto out;
 
-               } else if (!mh_strcasecmp (hp->name, MD5_FIELD)) {
+               } else if (!mh_strcasecmp(hp->name, MD5_FIELD)) {
                        /* Get Content-MD5 field */
                        unsigned char *cp, *dp;
                        char *ep;
@@ -465,48 +463,47 @@ get_content (FILE *in, char *file, int toplevel)
                                goto next_header;
 
                        if (ct->c_digested) {
-                               advise (NULL, "message %s has multiple %s: fields",
-                                       ct->c_file, MD5_FIELD);
+                               advise(NULL, "message %s has multiple %s: fields", ct->c_file, MD5_FIELD);
                                goto next_header;
                        }
 
-                       ep = cp = add (hp->value, NULL);  /* get a copy */
+                       ep = cp = add(hp->value, NULL);  /* get a copy */
 
-                       while (isspace (*cp))
+                       while (isspace(*cp))
                                cp++;
                        for (dp = strchr(cp, '\n'); dp; dp = strchr(dp, '\n'))
                                *dp++ = ' ';
-                       for (dp = cp + strlen (cp) - 1; dp >= cp; dp--)
-                               if (!isspace (*dp))
+                       for (dp = cp + strlen(cp) - 1; dp >= cp; dp--)
+                               if (!isspace(*dp))
                                        break;
                        *++dp = '\0';
                        if (debugsw)
-                               fprintf (stderr, "%s: %s\n", MD5_FIELD, cp);
+                               fprintf(stderr, "%s: %s\n", MD5_FIELD, cp);
 
-                       if (*cp == '(' && get_comment (ct, &cp, 0) == NOTOK) {
-                               free (ep);
+                       if (*cp == '(' && get_comment(ct, &cp, 0) == NOTOK) {
+                               free(ep);
                                goto out;
                        }
 
-                       for (dp = cp; *dp && !isspace (*dp); dp++)
+                       for (dp = cp; *dp && !isspace(*dp); dp++)
                                continue;
                        *dp = '\0';
 
-                       readDigest (ct, cp);
-                       free (ep);
+                       readDigest(ct, cp);
+                       free(ep);
                        ct->c_digested++;
 
-               } else if (!mh_strcasecmp (hp->name, ID_FIELD)) {
+               } else if (!mh_strcasecmp(hp->name, ID_FIELD)) {
                        /* Get Content-ID field */
-                       ct->c_id = add (hp->value, ct->c_id);
+                       ct->c_id = add(hp->value, ct->c_id);
 
-               } else if (!mh_strcasecmp (hp->name, DESCR_FIELD)) {
+               } else if (!mh_strcasecmp(hp->name, DESCR_FIELD)) {
                        /* Get Content-Description field */
-                       ct->c_descr = add (hp->value, ct->c_descr);
+                       ct->c_descr = add(hp->value, ct->c_descr);
 
-               } else if (!mh_strcasecmp (hp->name, DISPO_FIELD)) {
+               } else if (!mh_strcasecmp(hp->name, DISPO_FIELD)) {
                        /* Get Content-Disposition field */
-                       ct->c_dispo = add (hp->value, ct->c_dispo);
+                       ct->c_dispo = add(hp->value, ct->c_dispo);
                }
 
 next_header:
@@ -524,7 +521,7 @@ next_header:
                ** so default type is message/rfc822
                */
                if (toplevel < 0) {
-                       if (get_ctinfo ("message/rfc822", ct, 0) == NOTOK)
+                       if (get_ctinfo("message/rfc822", ct, 0) == NOTOK)
                                goto out;
                        ct->c_type = CT_MESSAGE;
                        ct->c_ctinitfnx = InitMessage;
@@ -532,7 +529,7 @@ next_header:
                        /*
                        ** Else default type is text/plain
                        */
-                       if (get_ctinfo ("text/plain", ct, 0) == NOTOK)
+                       if (get_ctinfo("text/plain", ct, 0) == NOTOK)
                                goto out;
                        ct->c_type = CT_TEXT;
                        ct->c_ctinitfnx = InitText;
@@ -542,13 +539,13 @@ next_header:
        /* Use default Transfer-Encoding, if necessary */
        if (!ct->c_celine) {
                ct->c_encoding = CE_7BIT;
-               Init7Bit (ct);
+               Init7Bit(ct);
        }
 
        return ct;
 
 out:
-       free_content (ct);
+       free_content(ct);
        return NULL;
 }
 
@@ -558,12 +555,12 @@ out:
 */
 
 int
-add_header (CT ct, char *name, char *value)
+add_header(CT ct, char *name, char *value)
 {
        HF hp;
 
        /* allocate header field structure */
-       hp = mh_xmalloc (sizeof(*hp));
+       hp = mh_xmalloc(sizeof(*hp));
 
        /* link data into header structure */
        hp->name = name;
@@ -593,50 +590,49 @@ add_header (CT ct, char *name, char *value)
 ** that.
 */
 static char *
-incl_name_value (unsigned char *buf, char *name, char *value) {
+incl_name_value(unsigned char *buf, char *name, char *value) {
        char *newbuf = buf;
 
        /* Assume that name is non-null. */
        if (buf && value) {
-               char *name_plus_equal = concat (name, "=", NULL);
+               char *name_plus_equal = concat(name, "=", NULL);
 
-               if (! strstr (buf, name_plus_equal)) {
+               if (!strstr(buf, name_plus_equal)) {
                        char *insertion;
                        unsigned char *cp;
                        char *prefix, *suffix;
 
                        /* Trim trailing space, esp. newline. */
-                       for (cp = &buf[strlen (buf) - 1];
-                                cp >= buf && isspace (*cp);
-                                --cp) {
+                       for (cp = &buf[strlen(buf) - 1];
+                                        cp >= buf && isspace(*cp); --cp) {
                                *cp = '\0';
                        }
 
-                       insertion = concat ("; ", name, "=", "\"", value, "\"",
+                       insertion = concat("; ", name, "=", "\"", value, "\"",
                                        NULL);
 
                        /*
                        ** Insert at first semicolon, if any.
                        ** If none, append to end.
                        */
-                       prefix = add (buf, NULL);
-                       if ((cp = strchr (prefix, ';'))) {
-                               suffix = concat (cp, NULL);
+                       prefix = add(buf, NULL);
+                       if ((cp = strchr(prefix, ';'))) {
+                               suffix = concat(cp, NULL);
                                *cp = '\0';
-                               newbuf = concat (prefix, insertion, suffix,
+                               newbuf = concat(prefix, insertion, suffix,
                                                "\n", NULL);
-                               free (suffix);
+                               free(suffix);
                        } else {
                                /* Append to end. */
-                               newbuf = concat (buf, insertion, "\n", NULL);
+                               newbuf = concat(buf, insertion, "\n", NULL);
                        }
 
-                       free (prefix);
-                       free (insertion);
-                       free (buf);
+                       free(prefix);
+                       free(insertion);
+                       free(buf);
                }
 
-               free (name_plus_equal);
+               free(name_plus_equal);
        }
 
        return newbuf;
@@ -648,25 +644,27 @@ incl_name_value (unsigned char *buf, char *name, char *value) {
 ** of name will match filename="foo", and return foo.
 */
 static char *
-extract_name_value (char *name_suffix, char *value) {
+extract_name_value(char *name_suffix, char *value) {
        char *extracted_name_value = value;
-       char *name_suffix_plus_quote = concat (name_suffix, "=\"", NULL);
-       char *name_suffix_equals = strstr (value, name_suffix_plus_quote);
+       char *name_suffix_plus_quote = concat(name_suffix, "=\"", NULL);
+       char *name_suffix_equals = strstr(value, name_suffix_plus_quote);
        char *cp;
 
-       free (name_suffix_plus_quote);
+       free(name_suffix_plus_quote);
        if (name_suffix_equals) {
                char *name_suffix_begin;
 
                /* Find first \". */
-               for (cp = name_suffix_equals; *cp != '"'; ++cp) /* empty */;
+               for (cp = name_suffix_equals; *cp != '"'; ++cp)
+                       ;
                name_suffix_begin = ++cp;
                /* Find second \". */
-               for (; *cp != '"'; ++cp) /* empty */;
+               for (; *cp != '"'; ++cp)
+                       ;
 
-               extracted_name_value = mh_xmalloc (cp - name_suffix_begin + 1);
-               memcpy (extracted_name_value, name_suffix_begin,
-                       cp - name_suffix_begin);
+               extracted_name_value = mh_xmalloc(cp - name_suffix_begin + 1);
+               memcpy(extracted_name_value, name_suffix_begin,
+                               cp - name_suffix_begin);
                extracted_name_value[cp - name_suffix_begin] = '\0';
        }
 
@@ -678,7 +676,7 @@ extract_name_value (char *name_suffix, char *value) {
 ** directives.  Fills in the information of the CTinfo structure.
 */
 int
-get_ctinfo (unsigned char *cp, CT ct, int magic)
+get_ctinfo(unsigned char *cp, CT ct, int magic)
 {
        int i;
        unsigned char *dp;
@@ -687,12 +685,12 @@ get_ctinfo (unsigned char *cp, CT ct, int magic)
        CI ci;
 
        ci = &ct->c_ctinfo;
-       i = strlen (invo_name) + 2;
+       i = strlen(invo_name) + 2;
 
        /* store copy of Content-Type line */
-       cp = ct->c_ctline = add (cp, NULL);
+       cp = ct->c_ctline = add(cp, NULL);
 
-       while (isspace (*cp))  /* trim leading spaces */
+       while (isspace(*cp))  /* trim leading spaces */
                cp++;
 
        /* change newlines to spaces */
@@ -700,76 +698,74 @@ get_ctinfo (unsigned char *cp, CT ct, int magic)
                *dp++ = ' ';
 
        /* trim trailing spaces */
-       for (dp = cp + strlen (cp) - 1; dp >= cp; dp--)
-               if (!isspace (*dp))
+       for (dp = cp + strlen(cp) - 1; dp >= cp; dp--)
+               if (!isspace(*dp))
                        break;
        *++dp = '\0';
 
        if (debugsw)
-               fprintf (stderr, "%s: %s\n", TYPE_FIELD, cp);
+               fprintf(stderr, "%s: %s\n", TYPE_FIELD, cp);
 
-       if (*cp == '(' && get_comment (ct, &cp, 1) == NOTOK)
+       if (*cp == '(' && get_comment(ct, &cp, 1) == NOTOK)
                return NOTOK;
 
-       for (dp = cp; istoken (*dp); dp++)
+       for (dp = cp; istoken(*dp); dp++)
                continue;
        c = *dp, *dp = '\0';
-       ci->ci_type = add (cp, NULL);  /* store content type */
+       ci->ci_type = add(cp, NULL);  /* store content type */
        *dp = c, cp = dp;
 
        if (!*ci->ci_type) {
-               advise (NULL, "invalid %s: field in message %s (empty type)",
+               advise(NULL, "invalid %s: field in message %s (empty type)",
                                TYPE_FIELD, ct->c_file);
                return NOTOK;
        }
 
        /* down case the content type string */
        for (dp = ci->ci_type; *dp; dp++)
-               if (isalpha(*dp) && isupper (*dp))
-                       *dp = tolower (*dp);
+               if (isalpha(*dp) && isupper(*dp))
+                       *dp = tolower(*dp);
 
-       while (isspace (*cp))
+       while (isspace(*cp))
                cp++;
 
-       if (*cp == '(' && get_comment (ct, &cp, 1) == NOTOK)
+       if (*cp == '(' && get_comment(ct, &cp, 1) == NOTOK)
                return NOTOK;
 
        if (*cp != '/') {
                if (!magic)
-                       ci->ci_subtype = add ("", NULL);
+                       ci->ci_subtype = add("", NULL);
                goto magic_skip;
        }
 
        cp++;
-       while (isspace (*cp))
+       while (isspace(*cp))
                cp++;
 
-       if (*cp == '(' && get_comment (ct, &cp, 1) == NOTOK)
+       if (*cp == '(' && get_comment(ct, &cp, 1) == NOTOK)
                return NOTOK;
 
-       for (dp = cp; istoken (*dp); dp++)
+       for (dp = cp; istoken(*dp); dp++)
                continue;
        c = *dp, *dp = '\0';
-       ci->ci_subtype = add (cp, NULL);  /* store the content subtype */
+       ci->ci_subtype = add(cp, NULL);  /* store the content subtype */
        *dp = c, cp = dp;
 
        if (!*ci->ci_subtype) {
-               advise (NULL,
-                       "invalid %s: field in message %s (empty subtype for \"%s\")",
-                       TYPE_FIELD, ct->c_file, ci->ci_type);
+               advise(NULL, "invalid %s: field in message %s (empty subtype for \"%s\")", TYPE_FIELD, ct->c_file, ci->ci_type);
                return NOTOK;
        }
 
        /* down case the content subtype string */
        for (dp = ci->ci_subtype; *dp; dp++)
-               if (isalpha(*dp) && isupper (*dp))
-                       *dp = tolower (*dp);
+               if (isalpha(*dp) && isupper(*dp))
+                       *dp = tolower(*dp);
 
 magic_skip:
-       while (isspace (*cp))
+       while (isspace(*cp))
                cp++;
 
-       if (*cp == '(' && get_comment (ct, &cp, 1) == NOTOK)
+       if (*cp == '(' && get_comment(ct, &cp, 1) == NOTOK)
                return NOTOK;
 
        /*
@@ -781,43 +777,37 @@ magic_skip:
                unsigned char *up;
 
                if (ap >= ep) {
-                       advise (NULL,
-                               "too many parameters in message %s's %s: field (%d max)",
-                               ct->c_file, TYPE_FIELD, NPARMS);
+                       advise(NULL, "too many parameters in message %s's %s: field (%d max)", ct->c_file, TYPE_FIELD, NPARMS);
                        return NOTOK;
                }
 
                cp++;
-               while (isspace (*cp))
+               while (isspace(*cp))
                        cp++;
 
-               if (*cp == '(' && get_comment (ct, &cp, 1) == NOTOK)
+               if (*cp == '(' && get_comment(ct, &cp, 1) == NOTOK)
                        return NOTOK;
 
                if (*cp == 0) {
-                       advise (NULL,
-                               "extraneous trailing ';' in message %s's %s: parameter list",
-                               ct->c_file, TYPE_FIELD);
+                       advise (NULL, "extraneous trailing ';' in message %s's %s: parameter list", ct->c_file, TYPE_FIELD);
                        return OK;
                }
 
                /* down case the attribute name */
-               for (dp = cp; istoken (*dp); dp++)
-                       if (isalpha(*dp) && isupper (*dp))
-                               *dp = tolower (*dp);
+               for (dp = cp; istoken(*dp); dp++)
+                       if (isalpha(*dp) && isupper(*dp))
+                               *dp = tolower(*dp);
 
-               for (up = dp; isspace (*dp);)
+               for (up = dp; isspace(*dp);)
                        dp++;
                if (dp == cp || *dp != '=') {
-                       advise (NULL,
-                               "invalid parameter in message %s's %s: field\n%*.*sparameter %s (error detected at offset %d)",
-                               ct->c_file, TYPE_FIELD, i, i, "", cp, dp - cp);
+                       advise(NULL, "invalid parameter in message %s's %s: field\n%*.*sparameter %s (error detected at offset %d)", ct->c_file, TYPE_FIELD, i, i, "", cp, dp - cp);
                        return NOTOK;
                }
 
-               vp = (*ap = add (cp, NULL)) + (up - cp);
+               vp = (*ap = add(cp, NULL)) + (up - cp);
                *vp = '\0';
-               for (dp++; isspace (*dp);)
+               for (dp++; isspace(*dp);)
                        dp++;
 
                /* now add the attribute value */
@@ -828,9 +818,7 @@ magic_skip:
                                switch (c = *cp++) {
                                        case '\0':
 bad_quote:
-                                               advise (NULL,
-                                                       "invalid quoted-string in message %s's %s: field\n%*.*s(parameter %s)",
-                                                       ct->c_file, TYPE_FIELD, i, i, "", *ap);
+                                               advise(NULL, "invalid quoted-string in message %s's %s: field\n%*.*s(parameter %s)", ct->c_file, TYPE_FIELD, i, i, "", *ap);
                                                return NOTOK;
 
                                        case '\\':
@@ -850,22 +838,20 @@ bad_quote:
                                break;
                        }
                } else {
-                       for (cp = dp, dp = vp; istoken (*cp); cp++, dp++)
+                       for (cp = dp, dp = vp; istoken(*cp); cp++, dp++)
                                continue;
                        *dp = '\0';
                }
                if (!*vp) {
-                       advise (NULL,
-                               "invalid parameter in message %s's %s: field\n%*.*s(parameter %s)",
-                               ct->c_file, TYPE_FIELD, i, i, "", *ap);
+                       advise(NULL, "invalid parameter in message %s's %s: field\n%*.*s(parameter %s)", ct->c_file, TYPE_FIELD, i, i, "", *ap);
                        return NOTOK;
                }
                ap++;
 
-               while (isspace (*cp))
+               while (isspace(*cp))
                        cp++;
 
-               if (*cp == '(' && get_comment (ct, &cp, 1) == NOTOK)
+               if (*cp == '(' && get_comment(ct, &cp, 1) == NOTOK)
                        return NOTOK;
        }
 
@@ -874,23 +860,23 @@ bad_quote:
        */
        if (magic && *cp == '<') {
                if (ct->c_id) {
-                       free (ct->c_id);
+                       free(ct->c_id);
                        ct->c_id = NULL;
                }
                if (!(dp = strchr(ct->c_id = ++cp, '>'))) {
-                       advise (NULL, "invalid ID in message %s", ct->c_file);
+                       advise(NULL, "invalid ID in message %s", ct->c_file);
                        return NOTOK;
                }
                c = *dp;
                *dp = '\0';
                if (*ct->c_id)
-                       ct->c_id = concat ("<", ct->c_id, ">\n", NULL);
+                       ct->c_id = concat("<", ct->c_id, ">\n", NULL);
                else
                        ct->c_id = NULL;
                *dp++ = c;
                cp = dp;
 
-               while (isspace (*cp))
+               while (isspace(*cp))
                        cp++;
        }
 
@@ -899,11 +885,12 @@ bad_quote:
        */
        if (magic && *cp == '[') {
                ct->c_descr = ++cp;
-               for (dp = cp + strlen (cp) - 1; dp >= cp; dp--)
+               for (dp = cp + strlen(cp) - 1; dp >= cp; dp--)
                        if (*dp == ']')
                                break;
                if (dp < cp) {
-                       advise (NULL, "invalid description in message %s", ct->c_file);
+                       advise(NULL, "invalid description in message %s",
+                                       ct->c_file);
                        ct->c_descr = NULL;
                        return NOTOK;
                }
@@ -911,13 +898,13 @@ bad_quote:
                c = *dp;
                *dp = '\0';
                if (*ct->c_descr)
-                       ct->c_descr = concat (ct->c_descr, "\n", NULL);
+                       ct->c_descr = concat(ct->c_descr, "\n", NULL);
                else
                        ct->c_descr = NULL;
                *dp++ = c;
                cp = dp;
 
-               while (isspace (*cp))
+               while (isspace(*cp))
                        cp++;
        }
 
@@ -926,11 +913,12 @@ bad_quote:
        */
        if (magic && *cp == '{') {
                ct->c_dispo = ++cp;
-               for (dp = cp + strlen (cp) - 1; dp >= cp; dp--)
+               for (dp = cp + strlen(cp) - 1; dp >= cp; dp--)
                        if (*dp == '}')
                                break;
                if (dp < cp) {
-                       advise (NULL, "invalid disposition in message %s", ct->c_file);
+                       advise(NULL, "invalid disposition in message %s",
+                                       ct->c_file);
                        ct->c_dispo = NULL;
                        return NOTOK;
                }
@@ -938,13 +926,13 @@ bad_quote:
                c = *dp;
                *dp = '\0';
                if (*ct->c_dispo)
-                       ct->c_dispo = concat (ct->c_dispo, "\n", NULL);
+                       ct->c_dispo = concat(ct->c_dispo, "\n", NULL);
                else
                        ct->c_dispo = NULL;
                *dp++ = c;
                cp = dp;
 
-               while (isspace (*cp))
+               while (isspace(*cp))
                        cp++;
        }
 
@@ -953,7 +941,7 @@ bad_quote:
        */
        if (*cp) {
                if (magic) {
-                       ci->ci_magic = add (cp, NULL);
+                       ci->ci_magic = add(cp, NULL);
 
                        /*
                        ** If there is a Content-Disposition header and
@@ -962,11 +950,9 @@ bad_quote:
                        ** any leading directory components.
                        */
                        if (ct->c_dispo)
-                               ct->c_dispo = incl_name_value (ct->c_dispo, "filename", r1bindex (extract_name_value ("name", ci->ci_magic), '/'));
+                               ct->c_dispo = incl_name_value(ct->c_dispo, "filename", r1bindex(extract_name_value("name", ci->ci_magic), '/'));
                        } else
-                               advise (NULL,
-                                       "extraneous information in message %s's %s: field\n%*.*s(%s)",
-                                       ct->c_file, TYPE_FIELD, i, i, "", cp);
+                               advise(NULL, "extraneous information in message %s's %s: field\n%*.*s(%s)", ct->c_file, TYPE_FIELD, i, i, "", cp);
        }
 
        return OK;
@@ -974,7 +960,7 @@ bad_quote:
 
 
 static int
-get_comment (CT ct, unsigned char **ap, int istype)
+get_comment(CT ct, unsigned char **ap, int istype)
 {
        int i;
        char *bp;
@@ -991,7 +977,7 @@ get_comment (CT ct, unsigned char **ap, int istype)
                switch (c = *cp++) {
                case '\0':
 invalid:
-               advise (NULL, "invalid comment in message %s's %s: field",
+               advise(NULL, "invalid comment in message %s's %s: field",
                                ct->c_file, istype ? TYPE_FIELD : VRSN_FIELD);
                return NOTOK;
 
@@ -1021,14 +1007,14 @@ invalid:
 
        if (istype) {
                if ((dp = ci->ci_comment)) {
-                       ci->ci_comment = concat (dp, " ", buffer, NULL);
-                       free (dp);
+                       ci->ci_comment = concat(dp, " ", buffer, NULL);
+                       free(dp);
                } else {
-                       ci->ci_comment = add (buffer, NULL);
+                       ci->ci_comment = add(buffer, NULL);
                }
        }
 
-       while (isspace (*cp))
+       while (isspace(*cp))
                cp++;
 
        *ap = cp;
@@ -1044,7 +1030,7 @@ invalid:
 */
 
 static int
-InitGeneric (CT ct)
+InitGeneric(CT ct)
 {
        return OK;  /* not much to do here */
 }
@@ -1055,7 +1041,7 @@ InitGeneric (CT ct)
 */
 
 static int
-InitText (CT ct)
+InitText(CT ct)
 {
        char buffer[BUFSIZ];
        char *chset = NULL;
@@ -1066,29 +1052,29 @@ InitText (CT ct)
 
        /* check for missing subtype */
        if (!*ci->ci_subtype)
-               ci->ci_subtype = add ("plain", ci->ci_subtype);
+               ci->ci_subtype = add("plain", ci->ci_subtype);
 
        /* match subtype */
        for (kv = SubText; kv->kv_key; kv++)
-               if (!mh_strcasecmp (ci->ci_subtype, kv->kv_key))
+               if (!mh_strcasecmp(ci->ci_subtype, kv->kv_key))
                        break;
        ct->c_subtype = kv->kv_value;
 
        /* allocate text character set structure */
-       if ((t = (struct text *) calloc (1, sizeof(*t))) == NULL)
-               adios (NULL, "out of memory");
+       if ((t = (struct text *) calloc(1, sizeof(*t))) == NULL)
+               adios(NULL, "out of memory");
        ct->c_ctparams = (void *) t;
 
        /* scan for charset parameter */
        for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++)
-               if (!mh_strcasecmp (*ap, "charset"))
+               if (!mh_strcasecmp(*ap, "charset"))
                        break;
 
        /* check if content specified a character set */
        if (*ap) {
                /* match character set or set to CHARSET_UNKNOWN */
                for (kv = Charset; kv->kv_key; kv++) {
-                       if (!mh_strcasecmp (*ep, kv->kv_key)) {
+                       if (!mh_strcasecmp(*ep, kv->kv_key)) {
                                chset = *ep;
                                break;
                        }
@@ -1105,10 +1091,11 @@ InitText (CT ct)
        **
        ** termproc is for mhshow, though mhlist -debug prints it, too.
        */
-       if (chset != NULL && !check_charset (chset, strlen (chset))) {
-               snprintf (buffer, sizeof(buffer), "%s-charset-%s", invo_name, chset);
-               if ((cp = context_find (buffer)))
-                       ct->c_termproc = getcpy (cp);
+       if (chset != NULL && !check_charset(chset, strlen(chset))) {
+               snprintf(buffer, sizeof(buffer), "%s-charset-%s",
+                               invo_name, chset);
+               if ((cp = context_find(buffer)))
+                       ct->c_termproc = getcpy(cp);
        }
 
        return OK;
@@ -1120,7 +1107,7 @@ InitText (CT ct)
 */
 
 static int
-InitMultiPart (CT ct)
+InitMultiPart(CT ct)
 {
        int inout;
        long last, pos;
@@ -1140,15 +1127,13 @@ InitMultiPart (CT ct)
        */
        if (ct->c_encoding != CE_7BIT && ct->c_encoding != CE_8BIT
                && ct->c_encoding != CE_BINARY) {
-               admonish (NULL,
-                         "\"%s/%s\" type in message %s must be encoded in 7bit, 8bit, or binary",
-                         ci->ci_type, ci->ci_subtype, ct->c_file);
+               admonish(NULL, "\"%s/%s\" type in message %s must be encoded in 7bit, 8bit, or binary", ci->ci_type, ci->ci_subtype, ct->c_file);
                return NOTOK;
        }
 
        /* match subtype */
        for (kv = SubMultiPart; kv->kv_key; kv++)
-               if (!mh_strcasecmp (ci->ci_subtype, kv->kv_key))
+               if (!mh_strcasecmp(ci->ci_subtype, kv->kv_key))
                        break;
        ct->c_subtype = kv->kv_value;
 
@@ -1158,7 +1143,7 @@ InitMultiPart (CT ct)
        */
        bp = 0;
        for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
-               if (!mh_strcasecmp (*ap, "boundary")) {
+               if (!mh_strcasecmp(*ap, "boundary")) {
                        bp = *ep;
                        break;
                }
@@ -1166,64 +1151,62 @@ InitMultiPart (CT ct)
 
        /* complain if boundary parameter is missing */
        if (!*ap) {
-               advise (NULL,
-                       "a \"boundary\" parameter is mandatory for \"%s/%s\" type in message %s's %s: field",
-                       ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
+               advise (NULL, "a \"boundary\" parameter is mandatory for \"%s/%s\" type in message %s's %s: field", ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
                return NOTOK;
        }
 
        /* allocate primary structure for multipart info */
-       if ((m = (struct multipart *) calloc (1, sizeof(*m))) == NULL)
-               adios (NULL, "out of memory");
+       if ((m = (struct multipart *) calloc(1, sizeof(*m))) == NULL)
+               adios(NULL, "out of memory");
        ct->c_ctparams = (void *) m;
 
        /* check if boundary parameter contains only whitespace characters */
-       for (cp = bp; isspace (*cp); cp++)
+       for (cp = bp; isspace(*cp); cp++)
                continue;
        if (!*cp) {
-               advise (NULL, "invalid \"boundary\" parameter for \"%s/%s\" type in message %s's %s: field",
-                       ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
+               advise(NULL, "invalid \"boundary\" parameter for \"%s/%s\" type in message %s's %s: field", ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
                return NOTOK;
        }
 
        /* remove trailing whitespace from boundary parameter */
-       for (cp = bp, dp = cp + strlen (cp) - 1; dp > cp; dp--)
-               if (!isspace (*dp))
+       for (cp = bp, dp = cp + strlen(cp) - 1; dp > cp; dp--)
+               if (!isspace(*dp))
                        break;
        *++dp = '\0';
 
        /* record boundary separators */
-       m->mp_start = concat (bp, "\n", NULL);
-       m->mp_stop = concat (bp, "--\n", NULL);
+       m->mp_start = concat(bp, "\n", NULL);
+       m->mp_stop = concat(bp, "--\n", NULL);
 
-       if (!ct->c_fp && (ct->c_fp = fopen (ct->c_file, "r")) == NULL) {
-               advise (ct->c_file, "unable to open for reading");
+       if (!ct->c_fp && (ct->c_fp = fopen(ct->c_file, "r")) == NULL) {
+               advise(ct->c_file, "unable to open for reading");
                return NOTOK;
        }
 
-       fseek (fp = ct->c_fp, pos = ct->c_begin, SEEK_SET);
+       fseek(fp = ct->c_fp, pos = ct->c_begin, SEEK_SET);
        last = ct->c_end;
        next = &m->mp_parts;
        part = NULL;
        inout = 1;
 
-       while (fgets (buffer, sizeof(buffer) - 1, fp)) {
+       while (fgets(buffer, sizeof(buffer) - 1, fp)) {
                if (pos > last)
                        break;
 
-               pos += strlen (buffer);
+               pos += strlen(buffer);
                if (buffer[0] != '-' || buffer[1] != '-')
                        continue;
                if (inout) {
-                       if (strcmp (buffer + 2, m->mp_start))
+                       if (strcmp(buffer + 2, m->mp_start))
                                continue;
 next_part:
-                       if ((part = (struct part *) calloc (1, sizeof(*part))) == NULL)
-                               adios (NULL, "out of memory");
+                       if ((part = (struct part *) calloc(1, sizeof(*part)))
+                                       == NULL)
+                               adios(NULL, "out of memory");
                        *next = part;
                        next = &part->mp_next;
 
-                       if (!(p = get_content (fp, ct->c_file,
+                       if (!(p = get_content(fp, ct->c_file,
                                ct->c_subtype == MULTI_DIGEST ? -1 : 0))) {
                                ct->c_fp = NULL;
                                return NOTOK;
@@ -1231,10 +1214,10 @@ next_part:
                        p->c_fp = NULL;
                        part->mp_part = p;
                        pos = p->c_begin;
-                       fseek (fp, pos, SEEK_SET);
+                       fseek(fp, pos, SEEK_SET);
                        inout = 0;
                } else {
-                       if (strcmp (buffer + 2, m->mp_start) == 0) {
+                       if (strcmp(buffer + 2, m->mp_start) == 0) {
                                inout = 1;
 end_part:
                                p = part->mp_part;
@@ -1245,13 +1228,13 @@ end_part:
                                        goto next_part;
                                goto last_part;
                        } else {
-                               if (strcmp (buffer + 2, m->mp_stop) == 0)
+                               if (strcmp(buffer + 2, m->mp_stop) == 0)
                                        goto end_part;
                        }
                }
        }
 
-       advise (NULL, "bogus multipart content in message %s", ct->c_file);
+       advise(NULL, "bogus multipart content in message %s", ct->c_file);
        if (!inout && part) {
                p = part->mp_part;
                p->c_end = ct->c_end;
@@ -1261,15 +1244,15 @@ end_part:
                                next = &((*next)->mp_next))
                                continue;
                        *next = NULL;
-                       free_content (p);
-                       free ((char *) part);
+                       free_content(p);
+                       free((char *) part);
                }
        }
 
 last_part:
        /* reverse the order of the parts for multipart/alternative */
        if (ct->c_subtype == MULTI_ALTERNATE)
-               reverse_parts (ct);
+               reverse_parts(ct);
 
        /*
        ** label all subparts with part number, and
@@ -1281,8 +1264,9 @@ last_part:
                char partnam[BUFSIZ];
 
                if (ct->c_partno) {
-                       snprintf (partnam, sizeof(partnam), "%s.", ct->c_partno);
-                       pp = partnam + strlen (partnam);
+                       snprintf(partnam, sizeof(partnam), "%s.",
+                                       ct->c_partno);
+                       pp = partnam + strlen(partnam);
                } else {
                        pp = partnam;
                }
@@ -1291,19 +1275,19 @@ last_part:
                        part = part->mp_next, partnum++) {
                        p = part->mp_part;
 
-                       sprintf (pp, "%d", partnum);
-                       p->c_partno = add (partnam, NULL);
+                       sprintf(pp, "%d", partnum);
+                       p->c_partno = add(partnam, NULL);
 
                        /* initialize the content of the subparts */
                        if (p->c_ctinitfnx && (*p->c_ctinitfnx) (p) == NOTOK) {
-                               fclose (ct->c_fp);
+                               fclose(ct->c_fp);
                                ct->c_fp = NULL;
                                return NOTOK;
                        }
                }
        }
 
-       fclose (ct->c_fp);
+       fclose(ct->c_fp);
        ct->c_fp = NULL;
        return OK;
 }
@@ -1314,7 +1298,7 @@ last_part:
 */
 
 static void
-reverse_parts (CT ct)
+reverse_parts(CT ct)
 {
        int i;
        struct multipart *m;
@@ -1332,8 +1316,8 @@ reverse_parts (CT ct)
                i++;
 
        /* allocate array of pointers to the parts */
-       if (!(base = (struct part **) calloc ((size_t) (i + 1), sizeof(*base))))
-               adios (NULL, "out of memory");
+       if (!(base = (struct part **) calloc((size_t) (i + 1), sizeof(*base))))
+               adios(NULL, "out of memory");
        bmp = base;
 
        /* point at all the parts */
@@ -1351,7 +1335,7 @@ reverse_parts (CT ct)
        *next = NULL;
 
        /* free array of pointers */
-       free ((char *) base);
+       free((char *) base);
 }
 
 
@@ -1360,25 +1344,23 @@ reverse_parts (CT ct)
 */
 
 static int
-InitMessage (CT ct)
+InitMessage(CT ct)
 {
        struct k2v *kv;
        CI ci = &ct->c_ctinfo;
 
        if ((ct->c_encoding != CE_7BIT) && (ct->c_encoding != CE_8BIT)) {
-               admonish (NULL,
-                       "\"%s/%s\" type in message %s should be encoded in 7bit or 8bit",
-                       ci->ci_type, ci->ci_subtype, ct->c_file);
+               admonish(NULL, "\"%s/%s\" type in message %s should be encoded in 7bit or 8bit", ci->ci_type, ci->ci_subtype, ct->c_file);
                return NOTOK;
        }
 
        /* check for missing subtype */
        if (!*ci->ci_subtype)
-               ci->ci_subtype = add ("rfc822", ci->ci_subtype);
+               ci->ci_subtype = add("rfc822", ci->ci_subtype);
 
        /* match subtype */
        for (kv = SubMessage; kv->kv_key; kv++)
-               if (!mh_strcasecmp (ci->ci_subtype, kv->kv_key))
+               if (!mh_strcasecmp(ci->ci_subtype, kv->kv_key))
                        break;
        ct->c_subtype = kv->kv_value;
 
@@ -1391,8 +1373,9 @@ InitMessage (CT ct)
                                char **ap, **ep;
                                struct partial *p;
 
-                               if ((p = (struct partial *) calloc (1, sizeof(*p))) == NULL)
-                                       adios (NULL, "out of memory");
+                               if ((p = (struct partial *)
+                                               calloc(1, sizeof(*p))) == NULL)
+                                       adios(NULL, "out of memory");
                                ct->c_ctparams = (void *) p;
 
                                /*
@@ -1400,25 +1383,20 @@ InitMessage (CT ct)
                                ** and "total"
                                */
                                for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
-                                       if (!mh_strcasecmp (*ap, "id")) {
-                                               p->pm_partid = add (*ep, NULL);
+                                       if (!mh_strcasecmp(*ap, "id")) {
+                                               p->pm_partid = add(*ep, NULL);
                                                continue;
                                        }
-                                       if (!mh_strcasecmp (*ap, "number")) {
-                                               if (sscanf (*ep, "%d", &p->pm_partno) != 1
-                                                       || p->pm_partno < 1) {
+                                       if (!mh_strcasecmp(*ap, "number")) {
+                                               if (sscanf(*ep, "%d", &p->pm_partno) != 1 || p->pm_partno < 1) {
 invalid_param:
-                                                       advise (NULL,
-                                                               "invalid %s parameter for \"%s/%s\" type in message %s's %s field",
-                                                               *ap, ci->ci_type, ci->ci_subtype,
-                                                               ct->c_file, TYPE_FIELD);
+                                                       advise(NULL, "invalid %s parameter for \"%s/%s\" type in message %s's %s field", *ap, ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
                                                        return NOTOK;
                                                }
                                                continue;
                                        }
-                                       if (!mh_strcasecmp (*ap, "total")) {
-                                               if (sscanf (*ep, "%d", &p->pm_maxno) != 1
-                                                       || p->pm_maxno < 1)
+                                       if (!mh_strcasecmp(*ap, "total")) {
+                                               if (sscanf(*ep, "%d", &p->pm_maxno) != 1 || p->pm_maxno < 1)
                                                        goto invalid_param;
                                                continue;
                                        }
@@ -1426,10 +1404,7 @@ invalid_param:
 
                                if (!p->pm_partid || !p->pm_partno
                                        || (p->pm_maxno && p->pm_partno > p->pm_maxno)) {
-                                       advise (NULL,
-                                               "invalid parameters for \"%s/%s\" type in message %s's %s field",
-                                               ci->ci_type, ci->ci_subtype,
-                                               ct->c_file, TYPE_FIELD);
+                                       advise(NULL, "invalid parameters for \"%s/%s\" type in message %s's %s field", ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
                                        return NOTOK;
                                }
                        }
@@ -1442,18 +1417,19 @@ invalid_param:
                                CT p;
                                FILE *fp;
 
-                               if ((e = (struct exbody *) calloc (1, sizeof(*e))) == NULL)
-                                       adios (NULL, "out of memory");
+                               if ((e = (struct exbody *)
+                                               calloc(1, sizeof(*e))) == NULL)
+                                       adios(NULL, "out of memory");
                                ct->c_ctparams = (void *) e;
 
-                               if (!ct->c_fp && (ct->c_fp = fopen (ct->c_file, "r")) == NULL) {
-                                       advise (ct->c_file, "unable to open for reading");
+                               if (!ct->c_fp && (ct->c_fp = fopen(ct->c_file, "r")) == NULL) {
+                                       advise(ct->c_file, "unable to open for reading");
                                        return NOTOK;
                                }
 
-                               fseek (fp = ct->c_fp, ct->c_begin, SEEK_SET);
+                               fseek(fp = ct->c_fp, ct->c_begin, SEEK_SET);
 
-                               if (!(p = get_content (fp, ct->c_file, 0))) {
+                               if (!(p = get_content(fp, ct->c_file, 0))) {
                                        ct->c_fp = NULL;
                                        return NOTOK;
                                }
@@ -1461,26 +1437,27 @@ invalid_param:
                                e->eb_parent = ct;
                                e->eb_content = p;
                                p->c_ctexbody = e;
-                               if ((exresult = params_external (ct, 0)) != NOTOK
-                                       && p->c_ceopenfnx == openMail) {
+                               if ((exresult = params_external(ct, 0))
+                                               != NOTOK &&
+                                               p->c_ceopenfnx == openMail) {
                                        int cc, size;
                                        char *bp;
 
                                        if ((size = ct->c_end - p->c_begin) <= 0) {
                                                if (!e->eb_subject)
-                                                       content_error (NULL, ct, "empty body for access-type=mail-server");
+                                                       content_error(NULL, ct, "empty body for access-type=mail-server");
                                                goto no_body;
                                        }
 
-                                       e->eb_body = bp = mh_xmalloc ((unsigned) size);
-                                       fseek (p->c_fp, p->c_begin, SEEK_SET);
+                                       e->eb_body = bp = mh_xmalloc((unsigned) size);
+                                       fseek(p->c_fp, p->c_begin, SEEK_SET);
                                        while (size > 0)
-                                               switch (cc = fread (bp, sizeof(*bp), size, p->c_fp)) {
+                                               switch (cc = fread(bp, sizeof(*bp), size, p->c_fp)) {
                                                        case NOTOK:
-                                                               adios ("failed", "fread");
+                                                               adios("failed", "fread");
 
                                                        case OK:
-                                                               adios (NULL, "unexpected EOF from fread");
+                                                               adios(NULL, "unexpected EOF from fread");
 
                                                        default:
                                                                bp += cc, size -= cc;
@@ -1492,7 +1469,7 @@ no_body:
                                p->c_fp = NULL;
                                p->c_end = p->c_begin;
 
-                               fclose (ct->c_fp);
+                               fclose(ct->c_fp);
                                ct->c_fp = NULL;
 
                                if (exresult == NOTOK)
@@ -1526,19 +1503,19 @@ no_body:
 
 
 int
-params_external (CT ct, int composing)
+params_external(CT ct, int composing)
 {
        char **ap, **ep;
        struct exbody *e = (struct exbody *) ct->c_ctparams;
        CI ci = &ct->c_ctinfo;
 
        for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
-               if (!mh_strcasecmp (*ap, "access-type")) {
+               if (!mh_strcasecmp(*ap, "access-type")) {
                        struct str2init *s2i;
                        CT p = e->eb_content;
 
                        for (s2i = str2methods; s2i->si_key; s2i++)
-                               if (!mh_strcasecmp (*ep, s2i->si_key))
+                               if (!mh_strcasecmp(*ep, s2i->si_key))
                                        break;
                        if (!s2i->si_key) {
                                e->eb_access = *ep;
@@ -1555,48 +1532,46 @@ params_external (CT ct, int composing)
                                return NOTOK;
                        continue;
                }
-               if (!mh_strcasecmp (*ap, "name")) {
+               if (!mh_strcasecmp(*ap, "name")) {
                        e->eb_name = *ep;
                        continue;
                }
-               if (!mh_strcasecmp (*ap, "permission")) {
+               if (!mh_strcasecmp(*ap, "permission")) {
                        e->eb_permission = *ep;
                        continue;
                }
-               if (!mh_strcasecmp (*ap, "site")) {
+               if (!mh_strcasecmp(*ap, "site")) {
                        e->eb_site = *ep;
                        continue;
                }
-               if (!mh_strcasecmp (*ap, "directory")) {
+               if (!mh_strcasecmp(*ap, "directory")) {
                        e->eb_dir = *ep;
                        continue;
                }
-               if (!mh_strcasecmp (*ap, "mode")) {
+               if (!mh_strcasecmp(*ap, "mode")) {
                        e->eb_mode = *ep;
                        continue;
                }
-               if (!mh_strcasecmp (*ap, "size")) {
-                       sscanf (*ep, "%lu", &e->eb_size);
+               if (!mh_strcasecmp(*ap, "size")) {
+                       sscanf(*ep, "%lu", &e->eb_size);
                        continue;
                }
-               if (!mh_strcasecmp (*ap, "server")) {
+               if (!mh_strcasecmp(*ap, "server")) {
                        e->eb_server = *ep;
                        continue;
                }
-               if (!mh_strcasecmp (*ap, "subject")) {
+               if (!mh_strcasecmp(*ap, "subject")) {
                        e->eb_subject = *ep;
                        continue;
                }
-               if (composing && !mh_strcasecmp (*ap, "body")) {
-                       e->eb_body = getcpy (*ep);
+               if (composing && !mh_strcasecmp(*ap, "body")) {
+                       e->eb_body = getcpy(*ep);
                        continue;
                }
        }
 
        if (!e->eb_access) {
-               advise (NULL,
-                       "invalid parameters for \"%s/%s\" type in message %s's %s field",
-                       ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
+               advise(NULL, "invalid parameters for \"%s/%s\" type in message %s's %s field", ci->ci_type, ci->ci_subtype, ct->c_file, TYPE_FIELD);
                return NOTOK;
        }
 
@@ -1609,14 +1584,14 @@ params_external (CT ct, int composing)
 */
 
 static int
-InitApplication (CT ct)
+InitApplication(CT ct)
 {
        struct k2v *kv;
        CI ci = &ct->c_ctinfo;
 
        /* match subtype */
        for (kv = SubApplication; kv->kv_key; kv++)
-               if (!mh_strcasecmp (ci->ci_subtype, kv->kv_key))
+               if (!mh_strcasecmp(ci->ci_subtype, kv->kv_key))
                        break;
        ct->c_subtype = kv->kv_value;
 
@@ -1629,12 +1604,12 @@ InitApplication (CT ct)
 */
 
 static int
-init_encoding (CT ct, OpenCEFunc openfnx)
+init_encoding(CT ct, OpenCEFunc openfnx)
 {
        CE ce;
 
-       if ((ce = (CE) calloc (1, sizeof(*ce))) == NULL)
-               adios (NULL, "out of memory");
+       if ((ce = (CE) calloc(1, sizeof(*ce))) == NULL)
+               adios(NULL, "out of memory");
 
        ct->c_cefile     = ce;
        ct->c_ceopenfnx  = openfnx;
@@ -1646,7 +1621,7 @@ init_encoding (CT ct, OpenCEFunc openfnx)
 
 
 void
-close_encoding (CT ct)
+close_encoding(CT ct)
 {
        CE ce;
 
@@ -1654,14 +1629,14 @@ close_encoding (CT ct)
                return;
 
        if (ce->ce_fp) {
-               fclose (ce->ce_fp);
+               fclose(ce->ce_fp);
                ce->ce_fp = NULL;
        }
 }
 
 
 static unsigned long
-size_encoding (CT ct)
+size_encoding(CT ct)
 {
        int fd;
        unsigned long size;
@@ -1672,11 +1647,11 @@ size_encoding (CT ct)
        if (!(ce = ct->c_cefile))
                return (ct->c_end - ct->c_begin);
 
-       if (ce->ce_fp && fstat (fileno (ce->ce_fp), &st) != NOTOK)
+       if (ce->ce_fp && fstat(fileno(ce->ce_fp), &st) != NOTOK)
                return (long) st.st_size;
 
        if (ce->ce_file) {
-               if (stat (ce->ce_file, &st) != NOTOK)
+               if (stat(ce->ce_file, &st) != NOTOK)
                        return (long) st.st_size;
                else
                        return 0L;
@@ -1689,7 +1664,7 @@ size_encoding (CT ct)
        if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
                return (ct->c_end - ct->c_begin);
 
-       if (fstat (fd, &st) != NOTOK)
+       if (fstat(fd, &st) != NOTOK)
                size = (long) st.st_size;
        else
                size = 0L;
@@ -1724,14 +1699,14 @@ static unsigned char b642nib[0x80] = {
 
 
 static int
-InitBase64 (CT ct)
+InitBase64(CT ct)
 {
-       return init_encoding (ct, openBase64);
+       return init_encoding(ct, openBase64);
 }
 
 
 static int
-openBase64 (CT ct, char **file)
+openBase64(CT ct, char **file)
 {
        int bitno, cc, digested;
        int fd, len, skip;
@@ -1751,35 +1726,36 @@ openBase64 (CT ct, char **file)
 
        ce = ct->c_cefile;
        if (ce->ce_fp) {
-               fseek (ce->ce_fp, 0L, SEEK_SET);
+               fseek(ce->ce_fp, 0L, SEEK_SET);
                goto ready_to_go;
        }
 
        if (ce->ce_file) {
-               if ((ce->ce_fp = fopen (ce->ce_file, "r")) == NULL) {
-                       content_error (ce->ce_file, ct, "unable to fopen for reading");
+               if ((ce->ce_fp = fopen(ce->ce_file, "r")) == NULL) {
+                       content_error(ce->ce_file, ct,
+                                       "unable to fopen for reading");
                        return NOTOK;
                }
                goto ready_to_go;
        }
 
        if (*file == NULL) {
-               ce->ce_file = add (m_mktemp(tmp, NULL, NULL), NULL);
+               ce->ce_file = add(m_mktemp(tmp, NULL, NULL), NULL);
                ce->ce_unlink = 1;
        } else {
-               ce->ce_file = add (*file, NULL);
+               ce->ce_file = add(*file, NULL);
                ce->ce_unlink = 0;
        }
 
        /* sbeck@cise.ufl.edu -- handle suffixes */
        ci = &ct->c_ctinfo;
-       snprintf (buffer, sizeof(buffer), "%s-suffix-%s/%s",
-                 invo_name, ci->ci_type, ci->ci_subtype);
-       cp = context_find (buffer);
+       snprintf(buffer, sizeof(buffer), "%s-suffix-%s/%s",
+                       invo_name, ci->ci_type, ci->ci_subtype);
+       cp = context_find(buffer);
        if (cp == NULL || *cp == '\0') {
-               snprintf (buffer, sizeof(buffer), "%s-suffix-%s", invo_name,
+               snprintf(buffer, sizeof(buffer), "%s-suffix-%s", invo_name,
                          ci->ci_type);
-               cp = context_find (buffer);
+               cp = context_find(buffer);
        }
        if (cp != NULL && *cp != '\0') {
                if (ce->ce_unlink) {
@@ -1788,46 +1764,48 @@ openBase64 (CT ct, char **file)
                        ** version with extension.
                        */
                        char *file_org = strdup(ce->ce_file);
-                       ce->ce_file = add (cp, ce->ce_file);
+                       ce->ce_file = add(cp, ce->ce_file);
                        if (rename(file_org, ce->ce_file)) {
-                               adios (ce->ce_file, "unable to rename %s to ", file_org);
+                               adios(ce->ce_file, "unable to rename %s to ",
+                                               file_org);
                        }
                        free(file_org);
 
                } else {
-                       ce->ce_file = add (cp, ce->ce_file);
+                       ce->ce_file = add(cp, ce->ce_file);
                }
        }
 
-       if ((ce->ce_fp = fopen (ce->ce_file, "w+")) == NULL) {
-               content_error (ce->ce_file, ct, "unable to fopen for reading/writing");
+       if ((ce->ce_fp = fopen(ce->ce_file, "w+")) == NULL) {
+               content_error(ce->ce_file, ct,
+                               "unable to fopen for reading/writing");
                return NOTOK;
        }
 
        if ((len = ct->c_end - ct->c_begin) < 0)
-               adios (NULL, "internal error(1)");
+               adios(NULL, "internal error(1)");
 
-       if (!ct->c_fp && (ct->c_fp = fopen (ct->c_file, "r")) == NULL) {
-               content_error (ct->c_file, ct, "unable to open for reading");
+       if (!ct->c_fp && (ct->c_fp = fopen(ct->c_file, "r")) == NULL) {
+               content_error(ct->c_file, ct, "unable to open for reading");
                return NOTOK;
        }
 
        if ((digested = ct->c_digested))
-               MD5Init (&mdContext);
+               MD5Init(&mdContext);
 
        bitno = 18;
        bits = 0L;
        skip = 0;
 
-       lseek (fd = fileno (ct->c_fp), (off_t) ct->c_begin, SEEK_SET);
+       lseek(fd = fileno(ct->c_fp), (off_t) ct->c_begin, SEEK_SET);
        while (len > 0) {
-               switch (cc = read (fd, buffer, sizeof(buffer) - 1)) {
+               switch (cc = read(fd, buffer, sizeof(buffer) - 1)) {
                case NOTOK:
-                       content_error (ct->c_file, ct, "error reading from");
+                       content_error(ct->c_file, ct, "error reading from");
                        goto clean_up;
 
                case OK:
-                       content_error (NULL, ct, "premature eof");
+                       content_error(NULL, ct, "premature eof");
                        goto clean_up;
 
                default:
@@ -1838,37 +1816,35 @@ openBase64 (CT ct, char **file)
                        for (ep = (cp = buffer) + cc; cp < ep; cp++) {
                                switch (*cp) {
                                default:
-                                       if (isspace (*cp))
+                                       if (isspace(*cp))
                                                break;
-                                       if (skip || (*cp & 0x80)
-                                               || (value = b642nib[*cp & 0x7f]) > 0x3f) {
+                                       if (skip || (*cp & 0x80) || (value = b642nib[*cp & 0x7f]) > 0x3f) {
                                                if (debugsw) {
-                                                       fprintf (stderr, "*cp=0x%x pos=%ld skip=%d\n", *cp, (long) (lseek (fd, (off_t) 0, SEEK_CUR) - (ep - cp)), skip);
+                                                       fprintf(stderr, "*cp=0x%x pos=%ld skip=%d\n", *cp, (long) (lseek(fd, (off_t) 0, SEEK_CUR) - (ep - cp)), skip);
                                                }
-                                               content_error (NULL, ct,
-                                                                          "invalid BASE64 encoding -- continuing");
+                                               content_error(NULL, ct, "invalid BASE64 encoding -- continuing");
                                                continue;
                                        }
 
                                        bits |= value << bitno;
 test_end:
                                        if ((bitno -= 6) < 0) {
-                                               putc ((char) *b1, ce->ce_fp);
+                                               putc((char) *b1, ce->ce_fp);
                                                if (digested)
-                                                       MD5Update (&mdContext, b1, 1);
+                                                       MD5Update(&mdContext, b1, 1);
                                                if (skip < 2) {
-                                                       putc ((char) *b2, ce->ce_fp);
+                                                       putc((char) *b2, ce->ce_fp);
                                                        if (digested)
-                                                               MD5Update (&mdContext, b2, 1);
+                                                               MD5Update(&mdContext, b2, 1);
                                                        if (skip < 1) {
-                                                               putc ((char) *b3, ce->ce_fp);
+                                                               putc((char) *b3, ce->ce_fp);
                                                                if (digested)
-                                                                       MD5Update (&mdContext, b3, 1);
+                                                                       MD5Update(&mdContext, b3, 1);
                                                        }
                                                }
 
-                                               if (ferror (ce->ce_fp)) {
-                                                       content_error (ce->ce_file, ct,
+                                               if (ferror(ce->ce_fp)) {
+                                                       content_error(ce->ce_file, ct,
                                                                                   "error writing to");
                                                        goto clean_up;
                                                }
@@ -1887,39 +1863,40 @@ test_end:
 
        if (bitno != 18) {
                if (debugsw)
-                       fprintf (stderr, "premature ending (bitno %d)\n", bitno);
+                       fprintf(stderr, "premature ending (bitno %d)\n",
+                                       bitno);
 
-               content_error (NULL, ct, "invalid BASE64 encoding");
+               content_error(NULL, ct, "invalid BASE64 encoding");
                goto clean_up;
        }
 
 self_delimiting:
-       fseek (ct->c_fp, 0L, SEEK_SET);
+       fseek(ct->c_fp, 0L, SEEK_SET);
 
-       if (fflush (ce->ce_fp)) {
-               content_error (ce->ce_file, ct, "error writing to");
+       if (fflush(ce->ce_fp)) {
+               content_error(ce->ce_file, ct, "error writing to");
                goto clean_up;
        }
 
        if (digested) {
                unsigned char digest[16];
 
-               MD5Final (digest, &mdContext);
+               MD5Final(digest, &mdContext);
                if (memcmp((char *) digest, (char *) ct->c_digest,
                        sizeof(digest) / sizeof(digest[0])))
-                       content_error (NULL, ct, "content integrity suspect (digest mismatch) -- continuing");
+                       content_error(NULL, ct, "content integrity suspect (digest mismatch) -- continuing");
                else if (debugsw)
-                       fprintf (stderr, "content integrity confirmed\n");
+                       fprintf(stderr, "content integrity confirmed\n");
        }
 
-       fseek (ce->ce_fp, 0L, SEEK_SET);
+       fseek(ce->ce_fp, 0L, SEEK_SET);
 
 ready_to_go:
        *file = ce->ce_file;
-       return fileno (ce->ce_fp);
+       return fileno(ce->ce_fp);
 
 clean_up:
-       free_encoding (ct, 0);
+       free_encoding(ct, 0);
        return NOTOK;
 }
 
@@ -1949,14 +1926,14 @@ static char hex2nib[0x80] = {
 
 
 static int
-InitQuoted (CT ct)
+InitQuoted(CT ct)
 {
-       return init_encoding (ct, openQuoted);
+       return init_encoding(ct, openQuoted);
 }
 
 
 static int
-openQuoted (CT ct, char **file)
+openQuoted(CT ct, char **file)
 {
        int cc, digested, len, quoted;
        unsigned char *cp, *ep;
@@ -1969,13 +1946,13 @@ openQuoted (CT ct, char **file)
 
        ce = ct->c_cefile;
        if (ce->ce_fp) {
-               fseek (ce->ce_fp, 0L, SEEK_SET);
+               fseek(ce->ce_fp, 0L, SEEK_SET);
                goto ready_to_go;
        }
 
        if (ce->ce_file) {
-               if ((ce->ce_fp = fopen (ce->ce_file, "r")) == NULL) {
-                       content_error (ce->ce_file, ct,
+               if ((ce->ce_fp = fopen(ce->ce_file, "r")) == NULL) {
+                       content_error(ce->ce_file, ct,
                                        "unable to fopen for reading");
                        return NOTOK;
                }
@@ -1983,81 +1960,81 @@ openQuoted (CT ct, char **file)
        }
 
        if (*file == NULL) {
-               ce->ce_file = add (m_mktemp(tmp, NULL, NULL), NULL);
+               ce->ce_file = add(m_mktemp(tmp, NULL, NULL), NULL);
                ce->ce_unlink = 1;
        } else {
-               ce->ce_file = add (*file, NULL);
+               ce->ce_file = add(*file, NULL);
                ce->ce_unlink = 0;
        }
 
        /* sbeck@cise.ufl.edu -- handle suffixes */
        ci = &ct->c_ctinfo;
-       snprintf (buffer, sizeof(buffer), "%s-suffix-%s/%s",
-                         invo_name, ci->ci_type, ci->ci_subtype);
-       cp = context_find (buffer);
+       snprintf(buffer, sizeof(buffer), "%s-suffix-%s/%s",
+                       invo_name, ci->ci_type, ci->ci_subtype);
+       cp = context_find(buffer);
        if (cp == NULL || *cp == '\0') {
-               snprintf (buffer, sizeof(buffer), "%s-suffix-%s", invo_name,
-                                 ci->ci_type);
-               cp = context_find (buffer);
+               snprintf(buffer, sizeof(buffer), "%s-suffix-%s", invo_name,
+                               ci->ci_type);
+               cp = context_find(buffer);
        }
        if (cp != NULL && *cp != '\0') {
                if (ce->ce_unlink) {
                        // Temporary file already exists, so we rename to
                        // version with extension.
                        char *file_org = strdup(ce->ce_file);
-                       ce->ce_file = add (cp, ce->ce_file);
+                       ce->ce_file = add(cp, ce->ce_file);
                        if (rename(file_org, ce->ce_file)) {
-                               adios (ce->ce_file, "unable to rename %s to ",
+                               adios(ce->ce_file, "unable to rename %s to ",
                                                file_org);
                        }
                        free(file_org);
 
                } else {
-                       ce->ce_file = add (cp, ce->ce_file);
+                       ce->ce_file = add(cp, ce->ce_file);
                }
        }
 
-       if ((ce->ce_fp = fopen (ce->ce_file, "w+")) == NULL) {
-               content_error (ce->ce_file, ct,
+       if ((ce->ce_fp = fopen(ce->ce_file, "w+")) == NULL) {
+               content_error(ce->ce_file, ct,
                                "unable to fopen for reading/writing");
                return NOTOK;
        }
 
-       if ((ce->ce_fp = fopen (ce->ce_file, "w+")) == NULL) {
-               content_error (ce->ce_file, ct,
+       if ((ce->ce_fp = fopen(ce->ce_file, "w+")) == NULL) {
+               content_error(ce->ce_file, ct,
                                "unable to fopen for reading/writing");
                return NOTOK;
        }
 
        if ((len = ct->c_end - ct->c_begin) < 0)
-               adios (NULL, "internal error(2)");
+               adios(NULL, "internal error(2)");
 
-       if (!ct->c_fp && (ct->c_fp = fopen (ct->c_file, "r")) == NULL) {
-               content_error (ct->c_file, ct, "unable to open for reading");
+       if (!ct->c_fp && (ct->c_fp = fopen(ct->c_file, "r")) == NULL) {
+               content_error(ct->c_file, ct, "unable to open for reading");
                return NOTOK;
        }
 
        if ((digested = ct->c_digested))
-               MD5Init (&mdContext);
+               MD5Init(&mdContext);
 
        quoted = 0;
 #ifdef lint
        mask = 0;
 #endif
 
-       fseek (ct->c_fp, ct->c_begin, SEEK_SET);
+       fseek(ct->c_fp, ct->c_begin, SEEK_SET);
        while (len > 0) {
-               if (fgets (buffer, sizeof(buffer) - 1, ct->c_fp) == NULL) {
-                       content_error (NULL, ct, "premature eof");
+               if (fgets(buffer, sizeof(buffer) - 1, ct->c_fp) == NULL) {
+                       content_error(NULL, ct, "premature eof");
                        goto clean_up;
                }
 
-               if ((cc = strlen (buffer)) > len)
+               if ((cc = strlen(buffer)) > len)
                        cc = len;
                len -= cc;
 
                for (ep = (cp = buffer) + cc - 1; cp <= ep; ep--)
-                       if (!isspace (*ep))
+                       if (!isspace(*ep))
                                break;
                *++ep = '\n', ep++;
 
@@ -2073,11 +2050,11 @@ openQuoted (CT ct, char **file)
                                        /* at byte 2 of an escape sequence */
                                        mask <<= 4;
                                        mask |= hex2nib[*cp & 0x7f];
-                                       putc (mask, ce->ce_fp);
+                                       putc(mask, ce->ce_fp);
                                        if (digested)
-                                               MD5Update (&mdContext, &mask, 1);
-                                       if (ferror (ce->ce_fp)) {
-                                               content_error (ce->ce_file, ct, "error writing to");
+                                               MD5Update(&mdContext, &mask, 1);
+                                       if (ferror(ce->ce_fp)) {
+                                               content_error(ce->ce_file, ct, "error writing to");
                                                goto clean_up;
                                        }
                                        /*
@@ -2108,7 +2085,7 @@ openQuoted (CT ct, char **file)
                                        ** sequence; just show the raw bytes
                                        ** (below).
                                        */
-                               } else if (isxdigit (cp[1]) && isxdigit (cp[2])) {
+                               } else if (isxdigit(cp[1]) && isxdigit(cp[2])) {
                                        /*
                                        ** Next 2 bytes are hex digits,
                                        ** making this a valid escape
@@ -2127,53 +2104,52 @@ openQuoted (CT ct, char **file)
                        }
 
                        /* Just show the raw byte. */
-                       putc (*cp, ce->ce_fp);
+                       putc(*cp, ce->ce_fp);
                        if (digested) {
                                if (*cp == '\n') {
-                                       MD5Update (&mdContext, (unsigned char *) "\r\n",2);
+                                       MD5Update(&mdContext, (unsigned char *) "\r\n",2);
                                } else {
-                                       MD5Update (&mdContext, (unsigned char *) cp, 1);
+                                       MD5Update(&mdContext, (unsigned char *) cp, 1);
                                }
                        }
-                       if (ferror (ce->ce_fp)) {
-                               content_error (ce->ce_file, ct, "error writing to");
+                       if (ferror(ce->ce_fp)) {
+                               content_error(ce->ce_file, ct,
+                                               "error writing to");
                                goto clean_up;
                        }
                }
        }
        if (quoted) {
-               content_error (NULL, ct,
-                       "invalid QUOTED-PRINTABLE encoding -- end-of-content while still quoting");
+               content_error(NULL, ct, "invalid QUOTED-PRINTABLE encoding -- end-of-content while still quoting");
                goto clean_up;
        }
 
-       fseek (ct->c_fp, 0L, SEEK_SET);
+       fseek(ct->c_fp, 0L, SEEK_SET);
 
-       if (fflush (ce->ce_fp)) {
-               content_error (ce->ce_file, ct, "error writing to");
+       if (fflush(ce->ce_fp)) {
+               content_error(ce->ce_file, ct, "error writing to");
                goto clean_up;
        }
 
        if (digested) {
                unsigned char digest[16];
 
-               MD5Final (digest, &mdContext);
+               MD5Final(digest, &mdContext);
                if (memcmp((char *) digest, (char *) ct->c_digest,
                        sizeof(digest) / sizeof(digest[0])))
-                       content_error (NULL, ct,
-                               "content integrity suspect (digest mismatch) -- continuing");
+                       content_error(NULL, ct, "content integrity suspect (digest mismatch) -- continuing");
                else if (debugsw)
-                       fprintf (stderr, "content integrity confirmed\n");
+                       fprintf(stderr, "content integrity confirmed\n");
        }
 
-       fseek (ce->ce_fp, 0L, SEEK_SET);
+       fseek(ce->ce_fp, 0L, SEEK_SET);
 
 ready_to_go:
        *file = ce->ce_file;
-       return fileno (ce->ce_fp);
+       return fileno(ce->ce_fp);
 
 clean_up:
-       free_encoding (ct, 0);
+       free_encoding(ct, 0);
        return NOTOK;
 }
 
@@ -2183,9 +2159,9 @@ clean_up:
 */
 
 static int
-Init7Bit (CT ct)
+Init7Bit(CT ct)
 {
-       if (init_encoding (ct, open7Bit) == NOTOK)
+       if (init_encoding(ct, open7Bit) == NOTOK)
                return NOTOK;
 
        ct->c_cesizefnx = NULL;  /* no need to decode for real size */
@@ -2194,7 +2170,7 @@ Init7Bit (CT ct)
 
 
 int
-open7Bit (CT ct, char **file)
+open7Bit(CT ct, char **file)
 {
        int cc, fd, len;
        char buffer[BUFSIZ];
@@ -2205,13 +2181,13 @@ open7Bit (CT ct, char **file)
 
        ce = ct->c_cefile;
        if (ce->ce_fp) {
-               fseek (ce->ce_fp, 0L, SEEK_SET);
+               fseek(ce->ce_fp, 0L, SEEK_SET);
                goto ready_to_go;
        }
 
        if (ce->ce_file) {
-               if ((ce->ce_fp = fopen (ce->ce_file, "r")) == NULL) {
-                       content_error (ce->ce_file, ct,
+               if ((ce->ce_fp = fopen(ce->ce_file, "r")) == NULL) {
+                       content_error(ce->ce_file, ct,
                                        "unable to fopen for reading");
                        return NOTOK;
                }
@@ -2219,22 +2195,22 @@ open7Bit (CT ct, char **file)
        }
 
        if (*file == NULL) {
-               ce->ce_file = add (m_mktemp(tmp, NULL, NULL), NULL);
+               ce->ce_file = add(m_mktemp(tmp, NULL, NULL), NULL);
                ce->ce_unlink = 1;
        } else {
-               ce->ce_file = add (*file, NULL);
+               ce->ce_file = add(*file, NULL);
                ce->ce_unlink = 0;
        }
 
        /* sbeck@cise.ufl.edu -- handle suffixes */
        ci = &ct->c_ctinfo;
-       snprintf (buffer, sizeof(buffer), "%s-suffix-%s/%s",
-               invo_name, ci->ci_type, ci->ci_subtype);
-       cp = context_find (buffer);
+       snprintf(buffer, sizeof(buffer), "%s-suffix-%s/%s",
+                       invo_name, ci->ci_type, ci->ci_subtype);
+       cp = context_find(buffer);
        if (cp == NULL || *cp == '\0') {
-               snprintf (buffer, sizeof(buffer), "%s-suffix-%s", invo_name,
+               snprintf(buffer, sizeof(buffer), "%s-suffix-%s", invo_name,
                        ci->ci_type);
-               cp = context_find (buffer);
+               cp = context_find(buffer);
        }
        if (cp != NULL && *cp != '\0') {
                if (ce->ce_unlink) {
@@ -2243,20 +2219,20 @@ open7Bit (CT ct, char **file)
                        ** version with extension.
                        */
                        char *file_org = strdup(ce->ce_file);
-                       ce->ce_file = add (cp, ce->ce_file);
+                       ce->ce_file = add(cp, ce->ce_file);
                        if (rename(file_org, ce->ce_file)) {
-                               adios (ce->ce_file, "unable to rename %s to ",
+                               adios(ce->ce_file, "unable to rename %s to ",
                                                file_org);
                        }
                        free(file_org);
 
                } else {
-                       ce->ce_file = add (cp, ce->ce_file);
+                       ce->ce_file = add(cp, ce->ce_file);
                }
        }
 
-       if ((ce->ce_fp = fopen (ce->ce_file, "w+")) == NULL) {
-               content_error (ce->ce_file, ct,
+       if ((ce->ce_fp = fopen(ce->ce_file, "w+")) == NULL) {
+               content_error(ce->ce_file, ct,
                                "unable to fopen for reading/writing");
                return NOTOK;
        }
@@ -2266,67 +2242,67 @@ open7Bit (CT ct, char **file)
                CI ci = &ct->c_ctinfo;
 
                len = 0;
-               fprintf (ce->ce_fp, "%s: %s/%s", TYPE_FIELD, ci->ci_type,
+               fprintf(ce->ce_fp, "%s: %s/%s", TYPE_FIELD, ci->ci_type,
                                ci->ci_subtype);
-               len += strlen (TYPE_FIELD) + 2 + strlen (ci->ci_type)
-                       + 1 + strlen (ci->ci_subtype);
+               len += strlen(TYPE_FIELD) + 2 + strlen(ci->ci_type) + 1 +
+                               strlen(ci->ci_subtype);
                for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
-                       putc (';', ce->ce_fp);
+                       putc(';', ce->ce_fp);
                        len++;
 
-                       snprintf (buffer, sizeof(buffer), "%s=\"%s\"",
+                       snprintf(buffer, sizeof(buffer), "%s=\"%s\"",
                                        *ap, *ep);
 
-                       if (len + 1 + (cc = strlen (buffer)) >= CPERLIN) {
-                               fputs ("\n\t", ce->ce_fp);
+                       if (len + 1 + (cc = strlen(buffer)) >= CPERLIN) {
+                               fputs("\n\t", ce->ce_fp);
                                len = 8;
                        } else {
-                               putc (' ', ce->ce_fp);
+                               putc(' ', ce->ce_fp);
                                len++;
                        }
-                       fprintf (ce->ce_fp, "%s", buffer);
+                       fprintf(ce->ce_fp, "%s", buffer);
                        len += cc;
                }
 
                if (ci->ci_comment) {
-                       if (len + 1 + (cc = 2 + strlen (ci->ci_comment)) >= CPERLIN) {
-                               fputs ("\n\t", ce->ce_fp);
+                       if (len + 1 + (cc = 2 + strlen(ci->ci_comment))
+                                               >= CPERLIN) {
+                               fputs("\n\t", ce->ce_fp);
                                len = 8;
-                       }
-                       else {
-                               putc (' ', ce->ce_fp);
+                       } else {
+                               putc(' ', ce->ce_fp);
                                len++;
                        }
-                       fprintf (ce->ce_fp, "(%s)", ci->ci_comment);
+                       fprintf(ce->ce_fp, "(%s)", ci->ci_comment);
                        len += cc;
                }
-               fprintf (ce->ce_fp, "\n");
+               fprintf(ce->ce_fp, "\n");
                if (ct->c_id)
-                       fprintf (ce->ce_fp, "%s:%s", ID_FIELD, ct->c_id);
+                       fprintf(ce->ce_fp, "%s:%s", ID_FIELD, ct->c_id);
                if (ct->c_descr)
-                       fprintf (ce->ce_fp, "%s:%s", DESCR_FIELD, ct->c_descr);
+                       fprintf(ce->ce_fp, "%s:%s", DESCR_FIELD, ct->c_descr);
                if (ct->c_dispo)
-                       fprintf (ce->ce_fp, "%s:%s", DISPO_FIELD, ct->c_dispo);
-               fprintf (ce->ce_fp, "\n");
+                       fprintf(ce->ce_fp, "%s:%s", DISPO_FIELD, ct->c_dispo);
+               fprintf(ce->ce_fp, "\n");
        }
 
        if ((len = ct->c_end - ct->c_begin) < 0)
-               adios (NULL, "internal error(3)");
+               adios(NULL, "internal error(3)");
 
-       if (!ct->c_fp && (ct->c_fp = fopen (ct->c_file, "r")) == NULL) {
-               content_error (ct->c_file, ct, "unable to open for reading");
+       if (!ct->c_fp && (ct->c_fp = fopen(ct->c_file, "r")) == NULL) {
+               content_error(ct->c_file, ct, "unable to open for reading");
                return NOTOK;
        }
 
-       lseek (fd = fileno (ct->c_fp), (off_t) ct->c_begin, SEEK_SET);
+       lseek(fd = fileno(ct->c_fp), (off_t) ct->c_begin, SEEK_SET);
        while (len > 0)
-               switch (cc = read (fd, buffer, sizeof(buffer) - 1)) {
+               switch (cc = read(fd, buffer, sizeof(buffer) - 1)) {
                case NOTOK:
-                       content_error (ct->c_file, ct, "error reading from");
+                       content_error(ct->c_file, ct, "error reading from");
                        goto clean_up;
 
                case OK:
-                       content_error (NULL, ct, "premature eof");
+                       content_error(NULL, ct, "premature eof");
                        goto clean_up;
 
                default:
@@ -2334,28 +2310,29 @@ open7Bit (CT ct, char **file)
                                cc = len;
                        len -= cc;
 
-                       fwrite (buffer, sizeof(*buffer), cc, ce->ce_fp);
-                       if (ferror (ce->ce_fp)) {
-                               content_error (ce->ce_file, ct, "error writing to");
+                       fwrite(buffer, sizeof(*buffer), cc, ce->ce_fp);
+                       if (ferror(ce->ce_fp)) {
+                               content_error(ce->ce_file, ct,
+                                               "error writing to");
                                goto clean_up;
                        }
                }
 
-       fseek (ct->c_fp, 0L, SEEK_SET);
+       fseek(ct->c_fp, 0L, SEEK_SET);
 
-       if (fflush (ce->ce_fp)) {
-               content_error (ce->ce_file, ct, "error writing to");
+       if (fflush(ce->ce_fp)) {
+               content_error(ce->ce_file, ct, "error writing to");
                goto clean_up;
        }
 
-       fseek (ce->ce_fp, 0L, SEEK_SET);
+       fseek(ce->ce_fp, 0L, SEEK_SET);
 
 ready_to_go:
        *file = ce->ce_file;
-       return fileno (ce->ce_fp);
+       return fileno(ce->ce_fp);
 
 clean_up:
-       free_encoding (ct, 0);
+       free_encoding(ct, 0);
        return NOTOK;
 }
 
@@ -2365,32 +2342,32 @@ clean_up:
 */
 
 static int
-openExternal (CT ct, CT cb, CE ce, char **file, int *fd)
+openExternal(CT ct, CT cb, CE ce, char **file, int *fd)
 {
        char cachefile[BUFSIZ];
 
        if (ce->ce_fp) {
-               fseek (ce->ce_fp, 0L, SEEK_SET);
+               fseek(ce->ce_fp, 0L, SEEK_SET);
                goto ready_already;
        }
 
        if (ce->ce_file) {
-               if ((ce->ce_fp = fopen (ce->ce_file, "r")) == NULL) {
-                       content_error (ce->ce_file, ct,
+               if ((ce->ce_fp = fopen(ce->ce_file, "r")) == NULL) {
+                       content_error(ce->ce_file, ct,
                                        "unable to fopen for reading");
                        return NOTOK;
                }
                goto ready_already;
        }
 
-       if (find_cache (ct, rcachesw, (int *) 0, cb->c_id,
-                               cachefile, sizeof(cachefile)) != NOTOK) {
-               if ((ce->ce_fp = fopen (cachefile, "r"))) {
-                       ce->ce_file = getcpy (cachefile);
+       if (find_cache(ct, rcachesw, (int *) 0, cb->c_id,
+                       cachefile, sizeof(cachefile)) != NOTOK) {
+               if ((ce->ce_fp = fopen(cachefile, "r"))) {
+                       ce->ce_file = getcpy(cachefile);
                        ce->ce_unlink = 0;
                        goto ready_already;
                } else {
-                       admonish (cachefile, "unable to fopen for reading");
+                       admonish(cachefile, "unable to fopen for reading");
                }
        }
 
@@ -2398,7 +2375,7 @@ openExternal (CT ct, CT cb, CE ce, char **file, int *fd)
 
 ready_already:
        *file = ce->ce_file;
-       *fd = fileno (ce->ce_fp);
+       *fd = fileno(ce->ce_fp);
        return DONE;
 }
 
@@ -2407,21 +2384,21 @@ ready_already:
 */
 
 static int
-InitFile (CT ct)
+InitFile(CT ct)
 {
-       return init_encoding (ct, openFile);
+       return init_encoding(ct, openFile);
 }
 
 
 static int
-openFile (CT ct, char **file)
+openFile(CT ct, char **file)
 {
        int fd, cachetype;
        char cachefile[BUFSIZ];
        struct exbody *e = ct->c_ctexbody;
        CE ce = ct->c_cefile;
 
-       switch (openExternal (e->eb_parent, e->eb_content, ce, file, &fd)) {
+       switch (openExternal(e->eb_parent, e->eb_content, ce, file, &fd)) {
                case NOTOK:
                        return NOTOK;
 
@@ -2433,51 +2410,54 @@ openFile (CT ct, char **file)
        }
 
        if (!e->eb_name) {
-               content_error (NULL, ct, "missing name parameter");
+               content_error(NULL, ct, "missing name parameter");
                return NOTOK;
        }
 
-       ce->ce_file = getcpy (e->eb_name);
+       ce->ce_file = getcpy(e->eb_name);
        ce->ce_unlink = 0;
 
-       if ((ce->ce_fp = fopen (ce->ce_file, "r")) == NULL) {
-               content_error (ce->ce_file, ct, "unable to fopen for reading");
+       if ((ce->ce_fp = fopen(ce->ce_file, "r")) == NULL) {
+               content_error(ce->ce_file, ct, "unable to fopen for reading");
                return NOTOK;
        }
 
-       if ((!e->eb_permission || mh_strcasecmp (e->eb_permission, "read-write"))
-               && find_cache (NULL, wcachesw, &cachetype, e->eb_content->c_id,
-                       cachefile, sizeof(cachefile)) != NOTOK) {
+       if ((!e->eb_permission ||
+                       mh_strcasecmp(e->eb_permission, "read-write")) &&
+                       find_cache(NULL, wcachesw, &cachetype,
+                       e->eb_content->c_id, cachefile, sizeof(cachefile))
+                       != NOTOK) {
                int mask;
                FILE *fp;
 
-               mask = umask (cachetype ? ~m_gmprot () : 0222);
-               if ((fp = fopen (cachefile, "w"))) {
+               mask = umask(cachetype ? ~m_gmprot() : 0222);
+               if ((fp = fopen(cachefile, "w"))) {
                        int cc;
                        char buffer[BUFSIZ];
                        FILE *gp = ce->ce_fp;
 
-                       fseek (gp, 0L, SEEK_SET);
+                       fseek(gp, 0L, SEEK_SET);
 
-                       while ((cc = fread (buffer, sizeof(*buffer), sizeof(buffer), gp)) > 0)
-                               fwrite (buffer, sizeof(*buffer), cc, fp);
-                       fflush (fp);
+                       while ((cc = fread(buffer, sizeof(*buffer),
+                                       sizeof(buffer), gp)) > 0)
+                               fwrite(buffer, sizeof(*buffer), cc, fp);
+                       fflush(fp);
 
-                       if (ferror (gp)) {
-                               admonish (ce->ce_file, "error reading");
-                               unlink (cachefile);
-                       } else if (ferror (fp)) {
-                               admonish (cachefile, "error writing");
-                               unlink (cachefile);
+                       if (ferror(gp)) {
+                               admonish(ce->ce_file, "error reading");
+                               unlink(cachefile);
+                       } else if (ferror(fp)) {
+                               admonish(cachefile, "error writing");
+                               unlink(cachefile);
                        }
-                       fclose (fp);
+                       fclose(fp);
                }
-               umask (mask);
+               umask(mask);
        }
 
-       fseek (ce->ce_fp, 0L, SEEK_SET);
+       fseek(ce->ce_fp, 0L, SEEK_SET);
        *file = ce->ce_file;
-       return fileno (ce->ce_fp);
+       return fileno(ce->ce_fp);
 }
 
 /*
@@ -2485,14 +2465,14 @@ openFile (CT ct, char **file)
 */
 
 static int
-InitFTP (CT ct)
+InitFTP(CT ct)
 {
-       return init_encoding (ct, openFTP);
+       return init_encoding(ct, openFTP);
 }
 
 
 static int
-openFTP (CT ct, char **file)
+openFTP(CT ct, char **file)
 {
        int cachetype, caching, fd;
        int len, buflen;
@@ -2506,7 +2486,7 @@ openFTP (CT ct, char **file)
        e  = ct->c_ctexbody;
        ce = ct->c_cefile;
 
-       if ((ftp = context_find (nmhaccessftp)) && !*ftp)
+       if ((ftp = context_find(nmhaccessftp)) && !*ftp)
                ftp = NULL;
 
 #ifndef BUILTIN_FTP
@@ -2514,7 +2494,7 @@ openFTP (CT ct, char **file)
                return NOTOK;
 #endif
 
-       switch (openExternal (e->eb_parent, e->eb_content, ce, file, &fd)) {
+       switch (openExternal(e->eb_parent, e->eb_content, ce, file, &fd)) {
                case NOTOK:
                        return NOTOK;
 
@@ -2526,15 +2506,15 @@ openFTP (CT ct, char **file)
        }
 
        if (!e->eb_name || !e->eb_site) {
-               content_error (NULL, ct, "missing %s parameter",
-                       e->eb_name ? "site": "name");
+               content_error(NULL, ct, "missing %s parameter",
+                               e->eb_name ? "site": "name");
                return NOTOK;
        }
 
        if (xpid) {
                if (xpid < 0)
                        xpid = -xpid;
-               pidcheck (pidwait (xpid, NOTOK));
+               pidcheck(pidwait(xpid, NOTOK));
                xpid = 0;
        }
 
@@ -2545,45 +2525,45 @@ openFTP (CT ct, char **file)
        /*
        ** Construct the query message for user
        */
-       snprintf (bp, buflen, "Retrieve %s", e->eb_name);
-       len = strlen (bp);
+       snprintf(bp, buflen, "Retrieve %s", e->eb_name);
+       len = strlen(bp);
        bp += len;
        buflen -= len;
 
        if (e->eb_partno) {
-               snprintf (bp, buflen, " (content %s)", e->eb_partno);
-               len = strlen (bp);
+               snprintf(bp, buflen, " (content %s)", e->eb_partno);
+               len = strlen(bp);
                bp += len;
                buflen -= len;
        }
 
-       snprintf (bp, buflen, "\n    using %sFTP from site %s",
-               e->eb_flags ? "anonymous " : "", e->eb_site);
-       len = strlen (bp);
+       snprintf(bp, buflen, "\n    using %sFTP from site %s",
+                       e->eb_flags ? "anonymous " : "", e->eb_site);
+       len = strlen(bp);
        bp += len;
        buflen -= len;
 
        if (e->eb_size > 0) {
-               snprintf (bp, buflen, " (%lu octets)", e->eb_size);
-               len = strlen (bp);
+               snprintf(bp, buflen, " (%lu octets)", e->eb_size);
+               len = strlen(bp);
                bp += len;
                buflen -= len;
        }
-       snprintf (bp, buflen, "? ");
+       snprintf(bp, buflen, "? ");
 
        /*
        ** Now, check the answer
        */
-       if (!getanswer (buffer))
+       if (!getanswer(buffer))
                return NOTOK;
 
        if (e->eb_flags) {
                user = "anonymous";
-               snprintf (buffer, sizeof(buffer), "%s@%s", getusername (),
-                               LocalName ());
+               snprintf(buffer, sizeof(buffer), "%s@%s", getusername(),
+                               LocalName());
                pass = buffer;
        } else {
-               ruserpass (e->eb_site, &username, &password);
+               ruserpass(e->eb_site, &username, &password);
                user = username;
                pass = password;
        }
@@ -2591,9 +2571,11 @@ openFTP (CT ct, char **file)
        ce->ce_unlink = (*file == NULL);
        caching = 0;
        cachefile[0] = '\0';
-       if ((!e->eb_permission || mh_strcasecmp (e->eb_permission, "read-write"))
-                       && find_cache (NULL, wcachesw, &cachetype, e->eb_content->c_id,
-                       cachefile, sizeof(cachefile)) != NOTOK) {
+       if ((!e->eb_permission ||
+                       mh_strcasecmp(e->eb_permission, "read-write")) &&
+                       find_cache(NULL, wcachesw, &cachetype,
+                       e->eb_content->c_id, cachefile, sizeof(cachefile))
+                       != NOTOK) {
                if (*file == NULL) {
                        ce->ce_unlink = 0;
                        caching = 1;
@@ -2601,14 +2583,15 @@ openFTP (CT ct, char **file)
        }
 
        if (*file)
-               ce->ce_file = add (*file, NULL);
+               ce->ce_file = add(*file, NULL);
        else if (caching)
-               ce->ce_file = add (cachefile, NULL);
+               ce->ce_file = add(cachefile, NULL);
        else
-               ce->ce_file = add (m_mktemp(tmp, NULL, NULL), NULL);
+               ce->ce_file = add(m_mktemp(tmp, NULL, NULL), NULL);
 
-       if ((ce->ce_fp = fopen (ce->ce_file, "w+")) == NULL) {
-               content_error (ce->ce_file, ct, "unable to fopen for reading/writing");
+       if ((ce->ce_fp = fopen(ce->ce_file, "w+")) == NULL) {
+               content_error (ce->ce_file, ct,
+                               "unable to fopen for reading/writing");
                return NOTOK;
        }
 
@@ -2620,36 +2603,37 @@ openFTP (CT ct, char **file)
                char *vec[9];
 
                vecp = 0;
-               vec[vecp++] = r1bindex (ftp, '/');
+               vec[vecp++] = r1bindex(ftp, '/');
                vec[vecp++] = e->eb_site;
                vec[vecp++] = user;
                vec[vecp++] = pass;
                vec[vecp++] = e->eb_dir;
                vec[vecp++] = e->eb_name;
                vec[vecp++] = ce->ce_file,
-               vec[vecp++] = e->eb_mode && !mh_strcasecmp (e->eb_mode, "ascii")
-                       ? "ascii" : "binary";
+               vec[vecp++] = e->eb_mode &&
+                               !mh_strcasecmp(e->eb_mode, "ascii") ?
+                               "ascii" : "binary";
                vec[vecp] = NULL;
 
-               fflush (stdout);
+               fflush(stdout);
 
-               for (i = 0; (child_id = vfork ()) == NOTOK && i < 5; i++)
-                       sleep (5);
+               for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+                       sleep(5);
                switch (child_id) {
                        case NOTOK:
-                               adios ("fork", "unable to");
+                               adios("fork", "unable to");
                                /* NOTREACHED */
 
                        case OK:
-                               close (fileno (ce->ce_fp));
-                               execvp (ftp, vec);
-                               fprintf (stderr, "unable to exec ");
-                               perror (ftp);
-                               _exit (-1);
+                               close(fileno(ce->ce_fp));
+                               execvp(ftp, vec);
+                               fprintf(stderr, "unable to exec ");
+                               perror(ftp);
+                               _exit(-1);
                                /* NOTREACHED */
 
                        default:
-                               if (pidXwait (child_id, NULL)) {
+                               if (pidXwait(child_id, NULL)) {
 #ifdef BUILTIN_FTP
 losing_ftp:
 #endif
@@ -2661,46 +2645,47 @@ losing_ftp:
                }
        }
 #ifdef BUILTIN_FTP
-       else if (ftp_get (e->eb_site, user, pass, e->eb_dir, e->eb_name,
-                       ce->ce_file, e->eb_mode && !mh_strcasecmp (e->eb_mode, "ascii"), 0)
-                       == NOTOK)
-                       goto losing_ftp;
+       else if (ftp_get(e->eb_site, user, pass, e->eb_dir, e->eb_name,
+                       ce->ce_file, e->eb_mode && !mh_strcasecmp(e->eb_mode,
+                       "ascii"), 0) == NOTOK)
+               goto losing_ftp;
 #endif
 
        if (cachefile[0]) {
                if (caching)
-                       chmod (cachefile, cachetype ? m_gmprot () : 0444);
+                       chmod(cachefile, cachetype ? m_gmprot() : 0444);
                else {
                        int mask;
                        FILE *fp;
 
-                       mask = umask (cachetype ? ~m_gmprot () : 0222);
-                       if ((fp = fopen (cachefile, "w"))) {
+                       mask = umask(cachetype ? ~m_gmprot() : 0222);
+                       if ((fp = fopen(cachefile, "w"))) {
                                int cc;
                                FILE *gp = ce->ce_fp;
 
-                               fseek (gp, 0L, SEEK_SET);
+                               fseek(gp, 0L, SEEK_SET);
 
-                               while ((cc= fread (buffer, sizeof(*buffer), sizeof(buffer), gp)) > 0)
-                                       fwrite (buffer, sizeof(*buffer), cc, fp);
-                               fflush (fp);
+                               while ((cc= fread(buffer, sizeof(*buffer),
+                                               sizeof(buffer), gp)) > 0)
+                                       fwrite(buffer, sizeof(*buffer), cc, fp);
+                               fflush(fp);
 
-                               if (ferror (gp)) {
-                                       admonish (ce->ce_file, "error reading");
-                                       unlink (cachefile);
-                               } else if (ferror (fp)) {
-                                       admonish (cachefile, "error writing");
-                                       unlink (cachefile);
+                               if (ferror(gp)) {
+                                       admonish(ce->ce_file, "error reading");
+                                       unlink(cachefile);
+                               } else if (ferror(fp)) {
+                                       admonish(cachefile, "error writing");
+                                       unlink(cachefile);
                                }
-                               fclose (fp);
+                               fclose(fp);
                        }
-                       umask (mask);
+                       umask(mask);
                }
        }
 
-       fseek (ce->ce_fp, 0L, SEEK_SET);
+       fseek(ce->ce_fp, 0L, SEEK_SET);
        *file = ce->ce_file;
-       return fileno (ce->ce_fp);
+       return fileno(ce->ce_fp);
 }
 
 
@@ -2709,14 +2694,14 @@ losing_ftp:
 */
 
 static int
-InitMail (CT ct)
+InitMail(CT ct)
 {
-       return init_encoding (ct, openMail);
+       return init_encoding(ct, openMail);
 }
 
 
 static int
-openMail (CT ct, char **file)
+openMail(CT ct, char **file)
 {
        int child_id, fd, i, vecp;
        int len, buflen;
@@ -2724,7 +2709,7 @@ openMail (CT ct, char **file)
        struct exbody *e = ct->c_ctexbody;
        CE ce = ct->c_cefile;
 
-       switch (openExternal (e->eb_parent, e->eb_content, ce, file, &fd)) {
+       switch (openExternal(e->eb_parent, e->eb_content, ce, file, &fd)) {
                case NOTOK:
                        return NOTOK;
 
@@ -2736,14 +2721,14 @@ openMail (CT ct, char **file)
        }
 
        if (!e->eb_server) {
-               content_error (NULL, ct, "missing server parameter");
+               content_error(NULL, ct, "missing server parameter");
                return NOTOK;
        }
 
        if (xpid) {
                if (xpid < 0)
                        xpid = -xpid;
-               pidcheck (pidwait (xpid, NOTOK));
+               pidcheck(pidwait(xpid, NOTOK));
                xpid = 0;
        }
 
@@ -2752,27 +2737,27 @@ openMail (CT ct, char **file)
        buflen = sizeof(buffer);
 
        /* Now, construct query message */
-       snprintf (bp, buflen, "Retrieve content");
-       len = strlen (bp);
+       snprintf(bp, buflen, "Retrieve content");
+       len = strlen(bp);
        bp += len;
        buflen -= len;
 
        if (e->eb_partno) {
-               snprintf (bp, buflen, " %s", e->eb_partno);
-               len = strlen (bp);
+               snprintf(bp, buflen, " %s", e->eb_partno);
+               len = strlen(bp);
                bp += len;
                buflen -= len;
        }
 
-       snprintf (bp, buflen, " by asking %s\n\n%s\n? ", e->eb_server,
-               e->eb_subject ? e->eb_subject : e->eb_body);
+       snprintf(bp, buflen, " by asking %s\n\n%s\n? ", e->eb_server,
+                       e->eb_subject ? e->eb_subject : e->eb_body);
 
        /* Now, check answer */
-       if (!getanswer (buffer))
+       if (!getanswer(buffer))
                return NOTOK;
 
        vecp = 0;
-       vec[vecp++] = r1bindex (mailproc, '/');
+       vec[vecp++] = r1bindex(mailproc, '/');
        vec[vecp++] = e->eb_server;
        vec[vecp++] = "-subject";
        vec[vecp++] = e->eb_subject ? e->eb_subject : "mail-server request";
@@ -2780,36 +2765,37 @@ openMail (CT ct, char **file)
        vec[vecp++] = e->eb_body;
        vec[vecp] = NULL;
 
-       for (i = 0; (child_id = vfork ()) == NOTOK && i < 5; i++)
-               sleep (5);
+       for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+               sleep(5);
        switch (child_id) {
                case NOTOK:
-                       advise ("fork", "unable to");
+                       advise("fork", "unable to");
                        return NOTOK;
 
                case OK:
-                       execvp (mailproc, vec);
-                       fprintf (stderr, "unable to exec ");
-                       perror (mailproc);
-                       _exit (-1);
+                       execvp(mailproc, vec);
+                       fprintf(stderr, "unable to exec ");
+                       perror(mailproc);
+                       _exit(-1);
                        /* NOTREACHED */
 
                default:
-                       if (pidXwait (child_id, NULL) == OK)
-                               advise (NULL, "request sent");
+                       if (pidXwait(child_id, NULL) == OK)
+                               advise(NULL, "request sent");
                        break;
        }
 
        if (*file == NULL) {
-               ce->ce_file = add (m_mktemp(tmp, NULL, NULL), NULL);
+               ce->ce_file = add(m_mktemp(tmp, NULL, NULL), NULL);
                ce->ce_unlink = 1;
        } else {
-               ce->ce_file = add (*file, NULL);
+               ce->ce_file = add(*file, NULL);
                ce->ce_unlink = 0;
        }
 
-       if ((ce->ce_fp = fopen (ce->ce_file, "w+")) == NULL) {
-               content_error (ce->ce_file, ct, "unable to fopen for reading/writing");
+       if ((ce->ce_fp = fopen(ce->ce_file, "w+")) == NULL) {
+               content_error(ce->ce_file, ct,
+                               "unable to fopen for reading/writing");
                return NOTOK;
        }
 
@@ -2818,17 +2804,17 @@ openMail (CT ct, char **file)
        ** prints it, too.
        */
        if (ct->c_showproc)
-               free (ct->c_showproc);
-       ct->c_showproc = add ("true", NULL);
+               free(ct->c_showproc);
+       ct->c_showproc = add("true", NULL);
 
-       fseek (ce->ce_fp, 0L, SEEK_SET);
+       fseek(ce->ce_fp, 0L, SEEK_SET);
        *file = ce->ce_file;
-       return fileno (ce->ce_fp);
+       return fileno(ce->ce_fp);
 }
 
 
 static int
-readDigest (CT ct, char *cp)
+readDigest(CT ct, char *cp)
 {
        int bitno, skip;
        unsigned long bits;
@@ -2848,10 +2834,11 @@ readDigest (CT ct, char *cp)
                + sizeof(ct->c_digest) / sizeof(ct->c_digest[0]); *cp; cp++)
                switch (*cp) {
                        default:
-                               if (skip || (*cp & 0x80)
-                                       || (value = b642nib[*cp & 0x7f]) > 0x3f) {
+                               if (skip || (*cp & 0x80) ||
+                                               (value = b642nib[*cp & 0x7f])
+                                               > 0x3f) {
                                        if (debugsw)
-                                               fprintf (stderr, "invalid BASE64 encoding\n");
+                                               fprintf(stderr, "invalid BASE64 encoding\n");
                                        return NOTOK;
                                }
 
@@ -2879,7 +2866,7 @@ test_end:
                }
        if (bitno != 18) {
                if (debugsw)
-                       fprintf (stderr, "premature ending (bitno %d)\n",
+                       fprintf(stderr, "premature ending (bitno %d)\n",
                                        bitno);
 
                return NOTOK;
@@ -2890,7 +2877,7 @@ invalid_digest:
                if (debugsw) {
                        while (*cp)
                                cp++;
-                       fprintf (stderr, "invalid MD5 digest (got %d octets)\n",
+                       fprintf(stderr, "invalid MD5 digest (got %d octets)\n",
                                (int)(cp - bp));
                }
 
@@ -2898,10 +2885,10 @@ invalid_digest:
        }
 
        if (debugsw) {
-               fprintf (stderr, "MD5 digest=");
+               fprintf(stderr, "MD5 digest=");
                for (dp = ct->c_digest; dp < ep; dp++)
-                       fprintf (stderr, "%02x", *dp & 0xff);
-               fprintf (stderr, "\n");
+                       fprintf(stderr, "%02x", *dp & 0xff);
+               fprintf(stderr, "\n");
        }
 
        return OK;
index b658f29..6f53aba 100644 (file)
@@ -30,12 +30,12 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -43,51 +43,50 @@ main(int argc, char **argv)
        */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
-                                               invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
                        }
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else
-                               app_msgarg(&msgs, cp);
+                       app_msgarg(&msgs, cp);
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        if (!folder)
-               folder = getfolder (1);
-       maildir = m_maildir (folder);
+               folder = getfolder(1);
+       maildir = m_maildir(folder);
 
        /* If no messages are given, print folder pathname */
        if (!msgs.size) {
-               printf ("%s\n", maildir);
-               done (0);
+               printf("%s\n", maildir);
+               done(0);
        }
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /*
        ** We need to make sure there is message status space
@@ -96,30 +95,30 @@ main(int argc, char **argv)
        ** space at the end, we go ahead and add 10 slots.
        */
        if (mp->hghmsg >= mp->hghoff) {
-               if (!(mp = folder_realloc (mp, 1, mp->hghmsg + 10)))
-                       adios (NULL, "unable to allocate folder storage");
+               if (!(mp = folder_realloc(mp, 1, mp->hghmsg + 10)))
+                       adios(NULL, "unable to allocate folder storage");
        } else if (mp->lowoff > 1) {
-               if (!(mp = folder_realloc (mp, 1, mp->hghoff)))
-                       adios (NULL, "unable to allocate folder storage");
+               if (!(mp = folder_realloc(mp, 1, mp->hghoff)))
+                       adios(NULL, "unable to allocate folder storage");
        }
 
        mp->msgflags |= ALLOW_NEW;  /* allow the "new" sequence */
 
        /* parse all the message ranges/sequences and set SELECTED */
        for (i = 0; i < msgs.size; i++)
-               if (!m_convert (mp, msgs.msgs[i]))
-                       done (1);
+               if (!m_convert(mp, msgs.msgs[i]))
+                       done(1);
 
-       seq_setprev (mp);  /* set the previous-sequence */
+       seq_setprev(mp);  /* set the previous-sequence */
 
        /* print the path of all selected messages */
        for (i = mp->lowsel; i <= mp->hghsel; i++)
-               if (is_selected (mp, i))
-                       printf ("%s/%s\n", mp->foldpath, m_name (i));
+               if (is_selected(mp, i))
+                       printf("%s/%s\n", mp->foldpath, m_name(i));
 
-       seq_save (mp);  /* synchronize message sequences */
-       context_save ();  /* save the context file */
-       folder_free (mp);  /* free folder/message structure */
-       done (0);
+       seq_save(mp);  /* synchronize message sequences */
+       context_save();  /* save the context file */
+       folder_free(mp);  /* free folder/message structure */
+       done(0);
        return 1;
 }
index d55f2c6..ea66f32 100644 (file)
@@ -108,30 +108,30 @@ int verbosw = 0;
 #define quitser pipeser
 
 /* mhparse.c */
-CT parse_mime (char *);
+CT parse_mime(char *);
 
 /* mhmisc.c */
-int part_ok (CT, int);
-int type_ok (CT, int);
-void set_endian (void);
-void flush_errors (void);
+int part_ok(CT, int);
+int type_ok(CT, int);
+void set_endian(void);
+void flush_errors(void);
 
 /* mhshowsbr.c */
-void show_all_messages (CT *);
+void show_all_messages(CT *);
 
 /* mhfree.c */
-void free_content (CT);
+void free_content(CT);
 extern CT *cts;
-void freects_done (int) NORETURN;
+void freects_done(int) NORETURN;
 
 /*
 ** static prototypes
 */
-static RETSIGTYPE pipeser (int);
+static RETSIGTYPE pipeser(int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int msgnum, *icachesw;
        char *cp, *file = NULL, *folder = NULL;
@@ -147,12 +147,12 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -160,21 +160,20 @@ main (int argc, char **argv)
        */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
-                                               invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case RCACHESW:
                                icachesw = &rcachesw;
@@ -183,14 +182,14 @@ main (int argc, char **argv)
                                icachesw = &wcachesw;
 do_cache:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
-                               switch (*icachesw = smatch (cp, caches)) {
+                               switch (*icachesw = smatch(cp, caches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, caches);
-                                       done (1);
+                                       ambigsw(cp, caches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "%s unknown", cp);
+                                       adios(NULL, "%s unknown", cp);
                                default:
                                        break;
                                }
@@ -219,38 +218,36 @@ do_cache:
 
                        case PARTSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                if (npart >= NPARTS)
-                                       adios (NULL, "too many parts (starting with %s), %d max",
-                                                  cp, NPARTS);
+                                       adios(NULL, "too many parts (starting with %s), %d max", cp, NPARTS);
                                parts[npart++] = cp;
                                continue;
 
                        case TYPESW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                if (ntype >= NTYPES)
-                                       adios (NULL, "too many types (starting with %s), %d max",
-                                                  cp, NTYPES);
+                                       adios(NULL, "too many types (starting with %s), %d max", cp, NTYPES);
                                types[ntype++] = cp;
                                continue;
 
                        case FILESW:
                                if (!(cp = *argp++) || (*cp == '-' && cp[1]))
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
-                               file = *cp == '-' ? cp : path (cp, TFILE);
+                               file = *cp == '-' ? cp : path(cp, TFILE);
                                continue;
 
                        case FORMSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                if (formsw)
-                                       free (formsw);
-                               formsw = getcpy (etcpath (cp));
+                                       free(formsw);
+                               formsw = getcpy(etcpath(cp));
                                continue;
 
                        /*
@@ -258,7 +255,7 @@ do_cache:
                        */
                        case PROGSW:
                                if (!(progsw = *argp++) || *progsw == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                continue;
                        case NPROGSW:
@@ -268,7 +265,7 @@ do_cache:
                        case LENSW:
                        case WIDTHSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                continue;
 
@@ -285,20 +282,20 @@ do_cache:
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else
-                               app_msgarg(&msgs, cp);
+                       app_msgarg(&msgs, cp);
        }
 
        /* null terminate the list of acceptable parts/types */
        parts[npart] = NULL;
        types[ntype] = NULL;
 
-       set_endian ();
+       set_endian();
 
-       if ((cp = getenv ("MM_NOASK")) && !strcmp (cp, "1")) {
+       if ((cp = getenv("MM_NOASK")) && !strcmp(cp, "1")) {
                nolist  = 1;
                pausesw = 0;
        }
@@ -306,12 +303,12 @@ do_cache:
        /*
        ** Check if we've specified an additional profile
        */
-       if ((cp = getenv ("MHSHOW"))) {
-               if ((fp = fopen (cp, "r"))) {
-                       readconfig ((struct node **) 0, fp, cp, 0);
-                       fclose (fp);
+       if ((cp = getenv("MHSHOW"))) {
+               if ((fp = fopen(cp, "r"))) {
+                       readconfig((struct node **) 0, fp, cp, 0);
+                       fclose(fp);
                } else {
-                       admonish ("", "unable to read $MHSHOW profile (%s)",
+                       admonish("", "unable to read $MHSHOW profile (%s)",
                                        cp);
                }
        }
@@ -319,45 +316,45 @@ do_cache:
        /*
        ** Read the standard profile setup
        */
-       if ((fp = fopen (cp = etcpath ("mhn.defaults"), "r"))) {
-               readconfig ((struct node **) 0, fp, cp, 0);
-               fclose (fp);
+       if ((fp = fopen(cp = etcpath("mhn.defaults"), "r"))) {
+               readconfig((struct node **) 0, fp, cp, 0);
+               fclose(fp);
        }
 
        /* Check for public cache location */
-       if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
+       if ((cache_public = context_find(nmhcache)) && *cache_public != '/')
                cache_public = NULL;
 
        /* Check for private cache location */
-       if (!(cache_private = context_find (nmhprivcache)))
+       if (!(cache_private = context_find(nmhprivcache)))
                cache_private = ".cache";
-       cache_private = getcpy (m_maildir (cache_private));
+       cache_private = getcpy(m_maildir(cache_private));
 
        /*
        ** Check for storage directory.  If specified,
        ** then store temporary files there.  Else we
        ** store them in standard nmh directory.
        */
-       if ((cp = context_find (nmhstorage)) && *cp)
-               tmp = concat (cp, "/", invo_name, NULL);
+       if ((cp = context_find(nmhstorage)) && *cp)
+               tmp = concat(cp, "/", invo_name, NULL);
        else
-               tmp = add (m_maildir (invo_name), NULL);
+               tmp = add(m_maildir(invo_name), NULL);
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        if (file && msgs.size)
-               adios (NULL, "cannot specify msg and file at same time!");
+               adios(NULL, "cannot specify msg and file at same time!");
 
        /*
        ** check if message is coming from file
        */
        if (file) {
-               if (!(cts = (CT *) calloc ((size_t) 2, sizeof(*cts))))
-                       adios (NULL, "out of memory");
+               if (!(cts = (CT *) calloc((size_t) 2, sizeof(*cts))))
+                       adios(NULL, "out of memory");
                ctp = cts;
 
-               if ((ct = parse_mime (file)));
+               if ((ct = parse_mime(file)));
                        *ctp++ = ct;
        } else {
                /*
@@ -366,24 +363,24 @@ do_cache:
                if (!msgs.size)
                        app_msgarg(&msgs, "cur");
                if (!folder)
-                       folder = getfolder (1);
-               maildir = m_maildir (folder);
+                       folder = getfolder(1);
+               maildir = m_maildir(folder);
 
-               if (chdir (maildir) == NOTOK)
-                       adios (maildir, "unable to change directory to");
+               if (chdir(maildir) == NOTOK)
+                       adios(maildir, "unable to change directory to");
 
                /* read folder and create message structure */
-               if (!(mp = folder_read (folder)))
-                       adios (NULL, "unable to read folder %s", folder);
+               if (!(mp = folder_read(folder)))
+                       adios(NULL, "unable to read folder %s", folder);
 
                /* check for empty folder */
                if (mp->nummsg == 0)
-                       adios (NULL, "no messages in %s", folder);
+                       adios(NULL, "no messages in %s", folder);
 
                /* parse all the message ranges/sequences and set SELECTED */
                for (msgnum = 0; msgnum < msgs.size; msgnum++)
-                       if (!m_convert (mp, msgs.msgs[msgnum]))
-                               done (1);
+                       if (!m_convert(mp, msgs.msgs[msgnum]))
+                               done(1);
 
                /*
                ** Set the SELECT_UNSEEN bit for all the SELECTED messages,
@@ -392,14 +389,14 @@ do_cache:
                */
                for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
                        if (is_selected(mp, msgnum))
-                               set_unseen (mp, msgnum);
+                               set_unseen(mp, msgnum);
 
-               seq_setprev (mp);  /* set the Previous-Sequence */
-               seq_setunseen (mp, 1);  /* unset the Unseen-Sequence */
+               seq_setprev(mp);  /* set the Previous-Sequence */
+               seq_setunseen(mp, 1);  /* unset the Unseen-Sequence */
 
-               if (!(cts = (CT *) calloc ((size_t) (mp->numsel + 1),
+               if (!(cts = (CT *) calloc((size_t) (mp->numsel + 1),
                                sizeof(*cts))))
-                       adios (NULL, "out of memory");
+                       adios(NULL, "out of memory");
                ctp = cts;
 
                /*
@@ -409,19 +406,19 @@ do_cache:
                        if (is_selected(mp, msgnum)) {
                                char *msgnam;
 
-                               msgnam = m_name (msgnum);
-                               if ((ct = parse_mime (msgnam)))
+                               msgnam = m_name(msgnum);
+                               if ((ct = parse_mime(msgnam)))
                                        *ctp++ = ct;
                        }
                }
        }
 
        if (!*cts)
-               done (1);
+               done(1);
 
        userrs = 1;
-       SIGNAL (SIGQUIT, quitser);
-       SIGNAL (SIGPIPE, pipeser);
+       SIGNAL(SIGQUIT, quitser);
+       SIGNAL(SIGPIPE, pipeser);
 
        /*
        ** Get the associated umask for the relevant contents.
@@ -430,8 +427,8 @@ do_cache:
                struct stat st;
 
                ct = *ctp;
-               if (type_ok (ct, 1) && !ct->c_umask) {
-                       if (stat (ct->c_file, &st) != NOTOK)
+               if (type_ok(ct, 1) && !ct->c_umask) {
+                       if (stat(ct->c_file, &st) != NOTOK)
                                ct->c_umask = ~(st.st_mode & 0777);
                        else
                                ct->c_umask = ~m_gmprot();
@@ -441,38 +438,38 @@ do_cache:
        /*
        ** Show the message content
        */
-       show_all_messages (cts);
+       show_all_messages(cts);
 
        /* Now free all the structures for the content */
        for (ctp = cts; *ctp; ctp++)
-               free_content (*ctp);
+               free_content(*ctp);
 
-       free ((char *) cts);
+       free((char *) cts);
        cts = NULL;
 
        /* If reading from a folder, do some updating */
        if (mp) {
-               context_replace (pfolder, folder);  /* update current folder */
-               seq_setcur (mp, mp->hghsel);       /* update current message */
-               seq_save (mp);                      /* synchronize sequences */
-               context_save ();                    /* save the context file */
+               context_replace(pfolder, folder);  /* update current folder */
+               seq_setcur(mp, mp->hghsel);       /* update current message */
+               seq_save(mp);                      /* synchronize sequences */
+               context_save();                    /* save the context file */
        }
 
-       done (0);
+       done(0);
        return 1;
 }
 
 
 static RETSIGTYPE
-pipeser (int i)
+pipeser(int i)
 {
        if (i == SIGQUIT) {
-               unlink ("core");
-               fflush (stdout);
-               fprintf (stderr, "\n");
-               fflush (stderr);
+               unlink("core");
+               fflush(stdout);
+               fprintf(stderr, "\n");
+               fflush(stderr);
        }
 
-       done (1);
+       done(1);
        /* NOTREACHED */
 }
index 68576f6..f79d42e 100644 (file)
@@ -51,44 +51,44 @@ static sigjmp_buf intrenv;
 
 
 /* termsbr.c */
-int SOprintf (char *, ...);
+int SOprintf(char *, ...);
 
 /* mhparse.c */
-int pidcheck (int);
+int pidcheck(int);
 
 /* mhmisc.c */
-int part_ok (CT, int);
-int type_ok (CT, int);
-void content_error (char *, CT, char *, ...);
-void flush_errors (void);
+int part_ok(CT, int);
+int type_ok(CT, int);
+void content_error(char *, CT, char *, ...);
+void flush_errors(void);
 
 /* mhlistsbr.c */
-int list_switch (CT, int, int, int, int);
-int list_content (CT, int, int, int, int);
+int list_switch(CT, int, int, int, int);
+int list_content(CT, int, int, int, int);
 
 /*
 ** prototypes
 */
-void show_all_messages (CT *);
-int show_content_aux (CT, int, int, char *, char *);
+void show_all_messages(CT *);
+int show_content_aux(CT, int, int, char *, char *);
 
 /*
 ** static prototypes
 */
-static void show_single_message (CT, char *);
-static void DisplayMsgHeader (CT, char *);
-static int show_switch (CT, int, int);
-static int show_content (CT, int, int);
-static int show_content_aux2 (CT, int, int, char *, char *,
+static void show_single_message(CT, char *);
+static void DisplayMsgHeader(CT, char *);
+static int show_switch(CT, int, int);
+static int show_content(CT, int, int);
+static int show_content_aux2(CT, int, int, char *, char *,
                int, int, int, int, int);
-static int show_text (CT, int, int);
-static int show_multi (CT, int, int);
-static int show_multi_internal (CT, int, int);
-static int show_multi_aux (CT, int, int, char *);
-static int show_message_rfc822 (CT, int, int);
-static int show_partial (CT, int, int);
-static int show_external (CT, int, int);
-static RETSIGTYPE intrser (int);
+static int show_text(CT, int, int);
+static int show_multi(CT, int, int);
+static int show_multi_internal(CT, int, int);
+static int show_multi_aux(CT, int, int, char *);
+static int show_message_rfc822(CT, int, int);
+static int show_partial(CT, int, int);
+static int show_external(CT, int, int);
+static RETSIGTYPE intrser(int);
 
 
 /*
@@ -96,7 +96,7 @@ static RETSIGTYPE intrser (int);
 */
 
 void
-show_all_messages (CT *cts)
+show_all_messages(CT *cts)
 {
        CT ct, *ctp;
 
@@ -105,20 +105,20 @@ show_all_messages (CT *cts)
        ** for showing headers of MIME messages.
        */
        if (!formsw)
-               formsw = getcpy (etcpath ("mhl.headers"));
+               formsw = getcpy(etcpath("mhl.headers"));
 
        /*
        ** If form is "mhl.null", suppress display of header.
        */
-       if (!strcmp (formsw, "mhl.null"))
+       if (!strcmp(formsw, "mhl.null"))
                formsw = NULL;
 
        for (ctp = cts; *ctp; ctp++) {
                ct = *ctp;
 
                /* if top-level type is ok, then display message */
-               if (type_ok (ct, 1))
-                       show_single_message (ct, formsw);
+               if (type_ok(ct, 1))
+                       show_single_message(ct, formsw);
        }
 }
 
@@ -128,7 +128,7 @@ show_all_messages (CT *cts)
 */
 
 static void
-show_single_message (CT ct, char *form)
+show_single_message(CT ct, char *form)
 {
        sigset_t set, oset;
 
@@ -142,7 +142,7 @@ show_single_message (CT ct, char *form)
        ** Allow user executable bit so that temporary directories created by
        ** the viewer (e.g., lynx) are going to be accessible
        */
-       umask (ct->c_umask & ~(0100));
+       umask(ct->c_umask & ~(0100));
 
        /*
        ** If you have a format file, then display
@@ -154,37 +154,37 @@ show_single_message (CT ct, char *form)
                xpid = 0;
 
        /* Show the body of the message */
-       show_switch (ct, 1, 0);
+       show_switch(ct, 1, 0);
 
        if (ct->c_fp) {
-               fclose (ct->c_fp);
+               fclose(ct->c_fp);
                ct->c_fp = NULL;
        }
        if (ct->c_ceclosefnx)
                (*ct->c_ceclosefnx) (ct);
 
        /* block a few signals */
-       sigemptyset (&set);
-       sigaddset (&set, SIGHUP);
-       sigaddset (&set, SIGINT);
-       sigaddset (&set, SIGQUIT);
-       sigaddset (&set, SIGTERM);
-       SIGPROCMASK (SIG_BLOCK, &set, &oset);
-
-       while (wait (&status) != NOTOK) {
+       sigemptyset(&set);
+       sigaddset(&set, SIGHUP);
+       sigaddset(&set, SIGINT);
+       sigaddset(&set, SIGQUIT);
+       sigaddset(&set, SIGTERM);
+       SIGPROCMASK(SIG_BLOCK, &set, &oset);
+
+       while (wait(&status) != NOTOK) {
 #ifdef HAVE_UNION_WAIT
-               pidcheck (status.w_status);
+               pidcheck(status.w_status);
 #else
-               pidcheck (status);
+               pidcheck(status);
 #endif
                continue;
        }
 
        /* reset the signal mask */
-       SIGPROCMASK (SIG_SETMASK, &oset, &set);
+       SIGPROCMASK(SIG_SETMASK, &oset, &set);
 
        xpid = 0;
-       flush_errors ();
+       flush_errors();
 }
 
 
@@ -193,14 +193,14 @@ show_single_message (CT ct, char *form)
 */
 
 static void
-DisplayMsgHeader (CT ct, char *form)
+DisplayMsgHeader(CT ct, char *form)
 {
        pid_t child_id;
        int i, vecp;
        char *vec[8];
 
        vecp = 0;
-       vec[vecp++] = r1bindex (mhlproc, '/');
+       vec[vecp++] = r1bindex(mhlproc, '/');
        vec[vecp++] = "-form";
        vec[vecp++] = form;
        vec[vecp++] = "-nobody";
@@ -218,21 +218,21 @@ DisplayMsgHeader (CT ct, char *form)
        }
        vec[vecp] = NULL;
 
-       fflush (stdout);
+       fflush(stdout);
 
        for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
-               sleep (5);
+               sleep(5);
 
        switch (child_id) {
        case NOTOK:
-               adios ("fork", "unable to");
+               adios("fork", "unable to");
                /* NOTREACHED */
 
        case OK:
-               execvp (mhlproc, vec);
-               fprintf (stderr, "unable to exec ");
-               perror (mhlproc);
-               _exit (-1);
+               execvp(mhlproc, vec);
+               fprintf(stderr, "unable to exec ");
+               perror(mhlproc);
+               _exit(-1);
                /* NOTREACHED */
 
        default:
@@ -248,43 +248,46 @@ DisplayMsgHeader (CT ct, char *form)
 */
 
 static int
-show_switch (CT ct, int serial, int alternate)
+show_switch(CT ct, int serial, int alternate)
 {
        switch (ct->c_type) {
                case CT_MULTIPART:
-                       return show_multi (ct, serial, alternate);
+                       return show_multi(ct, serial, alternate);
                        break;
 
                case CT_MESSAGE:
                        switch (ct->c_subtype) {
                                case MESSAGE_PARTIAL:
-                                       return show_partial (ct, serial, alternate);
+                                       return show_partial(ct, serial,
+                                                       alternate);
                                        break;
 
                                case MESSAGE_EXTERNAL:
-                                       return show_external (ct, serial, alternate);
+                                       return show_external(ct, serial,
+                                                       alternate);
                                        break;
 
                                case MESSAGE_RFC822:
                                default:
-                                       return show_message_rfc822 (ct, serial, alternate);
+                                       return show_message_rfc822(ct, serial,
+                                                       alternate);
                                        break;
                        }
                        break;
 
                case CT_TEXT:
-                       return show_text (ct, serial, alternate);
+                       return show_text(ct, serial, alternate);
                        break;
 
                case CT_AUDIO:
                case CT_IMAGE:
                case CT_VIDEO:
                case CT_APPLICATION:
-                       return show_content (ct, serial, alternate);
+                       return show_content(ct, serial, alternate);
                        break;
 
                default:
-                       adios (NULL, "unknown content type %d", ct->c_type);
+                       adios(NULL, "unknown content type %d", ct->c_type);
                        break;
        }
 
@@ -297,28 +300,28 @@ show_switch (CT ct, int serial, int alternate)
 */
 
 static int
-show_content (CT ct, int serial, int alternate)
+show_content(CT ct, int serial, int alternate)
 {
        char *cp, buffer[BUFSIZ];
        CI ci = &ct->c_ctinfo;
 
        /* Check for mhshow-show-type/subtype */
-       snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
+       snprintf(buffer, sizeof(buffer), "%s-show-%s/%s",
                                invo_name, ci->ci_type, ci->ci_subtype);
-       if ((cp = context_find (buffer)) && *cp != '\0')
-               return show_content_aux (ct, serial, alternate, cp, NULL);
+       if ((cp = context_find(buffer)) && *cp != '\0')
+               return show_content_aux(ct, serial, alternate, cp, NULL);
 
        /* Check for mhshow-show-type */
-       snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
-       if ((cp = context_find (buffer)) && *cp != '\0')
-               return show_content_aux (ct, serial, alternate, cp, NULL);
+       snprintf(buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
+       if ((cp = context_find(buffer)) && *cp != '\0')
+               return show_content_aux(ct, serial, alternate, cp, NULL);
 
        if ((cp = ct->c_showproc))
-               return show_content_aux (ct, serial, alternate, cp, NULL);
+               return show_content_aux(ct, serial, alternate, cp, NULL);
 
        /* complain if we are not a part of a multipart/alternative */
        if (!alternate)
-               content_error (NULL, ct, "don't know how to display content");
+               content_error(NULL, ct, "don't know how to display content");
 
        return NOTOK;
 }
@@ -329,7 +332,7 @@ show_content (CT ct, int serial, int alternate)
 */
 
 int
-show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
+show_content_aux(CT ct, int serial, int alternate, char *cp, char *cracked)
 {
        int fd, len, buflen, quoted;
        int xstdin, xlist, xpause, xtty;
@@ -338,7 +341,7 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
 
        if (!ct->c_ceopenfnx) {
                if (!alternate)
-                       content_error (NULL, ct,
+                       content_error(NULL, ct,
                                        "don't know how to decode content");
 
                return NOTOK;
@@ -347,7 +350,7 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
        file = NULL;
        if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
                return NOTOK;
-       if (ct->c_showproc && !strcmp (ct->c_showproc, "true"))
+       if (ct->c_showproc && !strcmp(ct->c_showproc, "true"))
                return (alternate ? DONE : OK);
 
        xlist  = 0;
@@ -356,7 +359,7 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
        xtty   = 0;
 
        if (cracked) {
-               strncpy (buffer, cp, sizeof(buffer));
+               strncpy(buffer, cp, sizeof(buffer));
                goto got_command;
        }
 
@@ -380,9 +383,9 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
 
                                for (ap = ci->ci_attrs, ep = ci->ci_values;
                                                *ap; ap++, ep++) {
-                                       snprintf (bp, buflen, "%s%s=\"%s\"",
+                                       snprintf(bp, buflen, "%s%s=\"%s\"",
                                                        s, *ap, *ep);
-                                       len = strlen (bp);
+                                       len = strlen(bp);
                                        bp += len;
                                        buflen -= len;
                                        s = " ";
@@ -395,9 +398,9 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
                                if (ct->c_descr) {
                                        char *s;
 
-                                       s = trimcpy (ct->c_descr);
-                                       strncpy (bp, s, buflen);
-                                       free (s);
+                                       s = trimcpy(ct->c_descr);
+                                       strncpy(bp, s, buflen);
+                                       free(s);
                                }
                                break;
 
@@ -414,7 +417,7 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
 
                        case 'f':
                                /* insert filename containing content */
-                               snprintf (bp, buflen, "'%s'", file);
+                               snprintf(bp, buflen, "'%s'", file);
                                /*
                                ** since we've quoted the file argument,
                                ** set things up to look past it, to avoid
@@ -442,7 +445,7 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
 
                        case 's':
                                /* insert subtype of content */
-                               strncpy (bp, ci->ci_subtype, buflen);
+                               strncpy(bp, ci->ci_subtype, buflen);
                                break;
 
                        case '%':
@@ -455,7 +458,7 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
                                buflen--;
                                continue;
                        }
-                       len = strlen (bp);
+                       len = strlen(bp);
                        bp += len;
                        buflen -= len;
 
@@ -466,16 +469,16 @@ show_content_aux (CT ct, int serial, int alternate, char *cp, char *cracked)
                                ** already
                                */
                                if (!quoted && buflen) {
-                                       len = strlen (pp);
-                                       memmove (pp + 1, pp, len);
+                                       len = strlen(pp);
+                                       memmove(pp + 1, pp, len);
                                        *pp++ = '\'';
                                        buflen--;
                                        bp++;
                                }
                                /* Escape existing quotes */
-                               while ((pp = strchr (pp, '\'')) && buflen > 3) {
-                                       len = strlen (pp++);
-                                       memmove (pp + 3, pp, len);
+                               while ((pp = strchr(pp, '\'')) && buflen > 3) {
+                                       len = strlen(pp++);
+                                       memmove(pp + 3, pp, len);
                                        *pp++ = '\\';
                                        *pp++ = '\'';
                                        *pp++ = '\'';
@@ -519,12 +522,12 @@ raw:
        if (ct->c_termproc) {
                char term[BUFSIZ];
 
-               strncpy (term, buffer, sizeof(term));
-               snprintf (buffer, sizeof(buffer), ct->c_termproc, term);
+               strncpy(term, buffer, sizeof(term));
+               snprintf(buffer, sizeof(buffer), ct->c_termproc, term);
        }
 
 got_command:
-       return show_content_aux2 (ct, serial, alternate, cracked, buffer,
+       return show_content_aux2(ct, serial, alternate, cracked, buffer,
                        fd, xlist, xpause, xstdin, xtty);
 }
 
@@ -534,7 +537,7 @@ got_command:
 */
 
 static int
-show_content_aux2 (CT ct, int serial, int alternate, char *cracked,
+show_content_aux2(CT ct, int serial, int alternate, char *cracked,
        char *buffer, int fd, int xlist, int xpause, int xstdin, int xtty)
 {
        pid_t child_id;
@@ -542,23 +545,23 @@ show_content_aux2 (CT ct, int serial, int alternate, char *cracked,
        char *vec[4], exec[BUFSIZ + sizeof "exec "];
 
        if (debugsw || cracked) {
-               fflush (stdout);
+               fflush(stdout);
 
-               fprintf (stderr, "%s msg %s", cracked ? "storing" : "show",
+               fprintf(stderr, "%s msg %s", cracked ? "storing" : "show",
                                 ct->c_file);
                if (ct->c_partno)
-                       fprintf (stderr, " part %s", ct->c_partno);
+                       fprintf(stderr, " part %s", ct->c_partno);
                if (cracked)
-                       fprintf (stderr, " using command (cd %s; %s)\n",
+                       fprintf(stderr, " using command (cd %s; %s)\n",
                                        cracked, buffer);
                else
-                       fprintf (stderr, " using command %s\n", buffer);
+                       fprintf(stderr, " using command %s\n", buffer);
        }
 
        if (xpid < 0 || (xtty && xpid)) {
                if (xpid < 0)
                        xpid = -xpid;
-               pidcheck(pidwait (xpid, NOTOK));
+               pidcheck(pidwait(xpid, NOTOK));
                xpid = 0;
        }
 
@@ -566,24 +569,24 @@ show_content_aux2 (CT ct, int serial, int alternate, char *cracked,
                char prompt[BUFSIZ];
 
                if (ct->c_type == CT_MULTIPART)
-                       list_content (ct, -1, 1, 0, 0);
+                       list_content(ct, -1, 1, 0, 0);
                else
-                       list_switch (ct, -1, 1, 0, 0);
+                       list_switch(ct, -1, 1, 0, 0);
 
-               if (xpause && SOprintf ("Press <return> to show content..."))
-                       printf ("Press <return> to show content...");
+               if (xpause && SOprintf("Press <return> to show content..."))
+                       printf("Press <return> to show content...");
 
                if (xpause) {
                        int intr;
                        SIGNAL_HANDLER istat;
 
-                       istat = SIGNAL (SIGINT, intrser);
-                       if ((intr = sigsetjmp (intrenv, 1)) == OK) {
-                               fflush (stdout);
+                       istat = SIGNAL(SIGINT, intrser);
+                       if ((intr = sigsetjmp(intrenv, 1)) == OK) {
+                               fflush(stdout);
                                prompt[0] = 0;
-                               read (fileno (stdout), prompt, sizeof(prompt));
+                               read(fileno(stdout), prompt, sizeof(prompt));
                        }
-                       SIGNAL (SIGINT, istat);
+                       SIGNAL(SIGINT, istat);
                        if (intr != OK || prompt[0] == 'n') {
                                (*ct->c_ceclosefnx) (ct);
                                return (alternate ? DONE : NOTOK);
@@ -592,33 +595,33 @@ show_content_aux2 (CT ct, int serial, int alternate, char *cracked,
                }
        }
 
-       snprintf (exec, sizeof(exec), "exec %s", buffer);
+       snprintf(exec, sizeof(exec), "exec %s", buffer);
 
        vec[0] = "/bin/sh";
        vec[1] = "-c";
        vec[2] = exec;
        vec[3] = NULL;
 
-       fflush (stdout);
+       fflush(stdout);
 
-       for (i = 0; (child_id = vfork ()) == NOTOK && i < 5; i++)
-               sleep (5);
+       for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+               sleep(5);
        switch (child_id) {
                case NOTOK:
-                       advise ("fork", "unable to");
+                       advise("fork", "unable to");
                        (*ct->c_ceclosefnx) (ct);
                        return NOTOK;
 
                case OK:
                        if (cracked)
-                               chdir (cracked);
+                               chdir(cracked);
                        if (!xstdin)
-                               dup2 (fd, 0);
-                       close (fd);
-                       execvp ("/bin/sh", vec);
-                       fprintf (stderr, "unable to exec ");
-                       perror ("/bin/sh");
-                       _exit (-1);
+                               dup2(fd, 0);
+                       close(fd);
+                       execvp("/bin/sh", vec);
+                       fprintf(stderr, "unable to exec ");
+                       perror("/bin/sh");
+                       _exit(-1);
                        /* NOTREACHED */
 
                default:
@@ -627,7 +630,7 @@ show_content_aux2 (CT ct, int serial, int alternate, char *cracked,
                                if (xtty)
                                        xpid = child_id;
                        } else {
-                               pidcheck (pidXwait (child_id, NULL));
+                               pidcheck(pidXwait(child_id, NULL));
                        }
 
                        if (fd != NOTOK)
@@ -642,31 +645,32 @@ show_content_aux2 (CT ct, int serial, int alternate, char *cracked,
 */
 
 static int
-show_text (CT ct, int serial, int alternate)
+show_text(CT ct, int serial, int alternate)
 {
        char *cp, buffer[BUFSIZ];
        CI ci = &ct->c_ctinfo;
 
        /* Check for mhshow-show-type/subtype */
-       snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
-               invo_name, ci->ci_type, ci->ci_subtype);
-       if ((cp = context_find (buffer)) && *cp != '\0')
-               return show_content_aux (ct, serial, alternate, cp, NULL);
+       snprintf(buffer, sizeof(buffer), "%s-show-%s/%s",
+                       invo_name, ci->ci_type, ci->ci_subtype);
+       if ((cp = context_find(buffer)) && *cp != '\0')
+               return show_content_aux(ct, serial, alternate, cp, NULL);
 
        /* Check for mhshow-show-type */
-       snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
-       if ((cp = context_find (buffer)) && *cp != '\0')
-               return show_content_aux (ct, serial, alternate, cp, NULL);
+       snprintf(buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
+       if ((cp = context_find(buffer)) && *cp != '\0')
+               return show_content_aux(ct, serial, alternate, cp, NULL);
 
        /*
        ** Use default method if content is text/plain, or if
        ** if it is not a text part of a multipart/alternative
        */
        if (!alternate || ct->c_subtype == TEXT_PLAIN) {
-               snprintf (buffer, sizeof(buffer), "%%p%s '%%F'", progsw ? progsw :
-                               moreproc && *moreproc ? moreproc : "more");
-               cp = (ct->c_showproc = add (buffer, NULL));
-               return show_content_aux (ct, serial, alternate, cp, NULL);
+               snprintf(buffer, sizeof(buffer), "%%p%s '%%F'",
+                               progsw ? progsw : moreproc && *moreproc ?
+                               moreproc : "more");
+               cp = (ct->c_showproc = add(buffer, NULL));
+               return show_content_aux(ct, serial, alternate, cp, NULL);
        }
 
        return NOTOK;
@@ -678,24 +682,24 @@ show_text (CT ct, int serial, int alternate)
 */
 
 static int
-show_multi (CT ct, int serial, int alternate)
+show_multi(CT ct, int serial, int alternate)
 {
        char *cp, buffer[BUFSIZ];
        CI ci = &ct->c_ctinfo;
 
        /* Check for mhshow-show-type/subtype */
-       snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
-               invo_name, ci->ci_type, ci->ci_subtype);
-       if ((cp = context_find (buffer)) && *cp != '\0')
-               return show_multi_aux (ct, serial, alternate, cp);
+       snprintf(buffer, sizeof(buffer), "%s-show-%s/%s",
+                       invo_name, ci->ci_type, ci->ci_subtype);
+       if ((cp = context_find(buffer)) && *cp != '\0')
+               return show_multi_aux(ct, serial, alternate, cp);
 
        /* Check for mhshow-show-type */
-       snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
-       if ((cp = context_find (buffer)) && *cp != '\0')
-               return show_multi_aux (ct, serial, alternate, cp);
+       snprintf(buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
+       if ((cp = context_find(buffer)) && *cp != '\0')
+               return show_multi_aux(ct, serial, alternate, cp);
 
        if ((cp = ct->c_showproc))
-               return show_multi_aux (ct, serial, alternate, cp);
+               return show_multi_aux(ct, serial, alternate, cp);
 
        /*
        ** Use default method to display this multipart content
@@ -703,7 +707,7 @@ show_multi (CT ct, int serial, int alternate)
        ** or if it is one of the known subtypes of multipart.
        */
        if (!alternate || ct->c_subtype != MULTI_UNKNOWN)
-               return show_multi_internal (ct, serial, alternate);
+               return show_multi_internal(ct, serial, alternate);
 
        return NOTOK;
 }
@@ -715,7 +719,7 @@ show_multi (CT ct, int serial, int alternate)
 */
 
 static int
-show_multi_internal (CT ct, int serial, int alternate)
+show_multi_internal(CT ct, int serial, int alternate)
 {
        int alternating, nowalternate, nowserial, result;
        struct multipart *m = (struct multipart *) ct->c_ctparams;
@@ -743,12 +747,12 @@ show_multi_internal (CT ct, int serial, int alternate)
 
        /* block a few signals */
        if (!nowserial) {
-               sigemptyset (&set);
-               sigaddset (&set, SIGHUP);
-               sigaddset (&set, SIGINT);
-               sigaddset (&set, SIGQUIT);
-               sigaddset (&set, SIGTERM);
-               SIGPROCMASK (SIG_BLOCK, &set, &oset);
+               sigemptyset(&set);
+               sigaddset(&set, SIGHUP);
+               sigaddset(&set, SIGINT);
+               sigaddset(&set, SIGQUIT);
+               sigaddset(&set, SIGTERM);
+               SIGPROCMASK(SIG_BLOCK, &set, &oset);
        }
 
 /*
@@ -761,10 +765,10 @@ show_multi_internal (CT ct, int serial, int alternate)
        for (part = m->mp_parts; part; part = part->mp_next) {
                p = part->mp_part;
 
-               if (part_ok (p, 0) && type_ok (p, 0)) {
+               if (part_ok(p, 0) && type_ok(p, 0)) {
                        int inneresult;
 
-                       inneresult = show_switch (p, nowserial, nowalternate);
+                       inneresult = show_switch(p, nowserial, nowalternate);
                        switch (inneresult) {
                                case NOTOK:
                                        if (alternate && !alternating) {
@@ -792,7 +796,7 @@ show_multi_internal (CT ct, int serial, int alternate)
 
        if (alternating && !part) {
                if (!alternate)
-                       content_error (NULL, ct, "don't know how to display any of the contents");
+                       content_error(NULL, ct, "don't know how to display any of the contents");
                result = NOTOK;
                goto out;
        }
@@ -811,18 +815,18 @@ show_multi_internal (CT ct, int serial, int alternate)
                        p = part->mp_part;
 
                        if (p->c_pid > OK) {
-                               if (kill (p->c_pid, 0) == NOTOK)
+                               if (kill(p->c_pid, 0) == NOTOK)
                                        p->c_pid = 0;
                                else
                                        kids++;
                        }
                }
 
-               while (kids > 0 && (pid = wait (&status)) != NOTOK) {
+               while (kids > 0 && (pid = wait(&status)) != NOTOK) {
 #ifdef HAVE_UNION_WAIT
-                       pidcheck (status.w_status);
+                       pidcheck(status.w_status);
 #else
-                       pidcheck (status);
+                       pidcheck(status);
 #endif
 
                        for (part = m->mp_parts; part; part = part->mp_next) {
@@ -842,7 +846,7 @@ show_multi_internal (CT ct, int serial, int alternate)
 out:
        if (!nowserial) {
                /* reset the signal mask */
-               SIGPROCMASK (SIG_SETMASK, &oset, &set);
+               SIGPROCMASK(SIG_SETMASK, &oset, &set);
        }
 
        return result;
@@ -855,7 +859,7 @@ out:
 */
 
 static int
-show_multi_aux (CT ct, int serial, int alternate, char *cp)
+show_multi_aux(CT ct, int serial, int alternate, char *cp)
 {
        int len, buflen, quoted;
        int xlist, xpause, xtty;
@@ -870,7 +874,7 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp)
 
                if (!p->c_ceopenfnx) {
                        if (!alternate)
-                               content_error (NULL, p, "don't know how to decode content");
+                               content_error(NULL, p, "don't know how to decode content");
                        return NOTOK;
                }
 
@@ -880,9 +884,9 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp)
                                return NOTOK;
 
                        /* I'm not sure if this is necessary? */
-                       p->c_storage = add (file, NULL);
+                       p->c_storage = add(file, NULL);
 
-                       if (p->c_showproc && !strcmp (p->c_showproc, "true"))
+                       if (p->c_showproc && !strcmp(p->c_showproc, "true"))
                                return (alternate ? DONE : OK);
                        (*p->c_ceclosefnx) (p);
                }
@@ -911,9 +915,9 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp)
 
                                for (ap = ci->ci_attrs, ep = ci->ci_values;
                                                *ap; ap++, ep++) {
-                                       snprintf (bp, buflen, "%s%s=\"%s\"",
+                                       snprintf(bp, buflen, "%s%s=\"%s\"",
                                                        s, *ap, *ep);
-                                       len = strlen (bp);
+                                       len = strlen(bp);
                                        bp += len;
                                        buflen -= len;
                                        s = " ";
@@ -926,9 +930,9 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp)
                                if (ct->c_descr) {
                                        char *s;
 
-                                       s = trimcpy (ct->c_descr);
-                                       strncpy (bp, s, buflen);
-                                       free (s);
+                                       s = trimcpy(ct->c_descr);
+                                       strncpy(bp, s, buflen);
+                                       free(s);
                                }
                                break;
 
@@ -951,8 +955,9 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp)
                                                part = part->mp_next) {
                                        p = part->mp_part;
 
-                                       snprintf (bp, buflen, "%s'%s'", s, p->c_storage);
-                                       len = strlen (bp);
+                                       snprintf(bp, buflen, "%s'%s'",
+                                                       s, p->c_storage);
+                                       len = strlen(bp);
                                        bp += len;
                                        buflen -= len;
                                        s = " ";
@@ -980,7 +985,7 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp)
 
                        case 's':
                                /* insert subtype of content */
-                               strncpy (bp, ci->ci_subtype, buflen);
+                               strncpy(bp, ci->ci_subtype, buflen);
                                break;
 
                        case '%':
@@ -993,7 +998,7 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp)
                                buflen--;
                                continue;
                        }
-                       len = strlen (bp);
+                       len = strlen(bp);
                        bp += len;
                        buflen -= len;
 
@@ -1004,16 +1009,16 @@ show_multi_aux (CT ct, int serial, int alternate, char *cp)
                                ** already
                                */
                                if (!quoted && buflen) {
-                                       len = strlen (pp);
-                                       memmove (pp + 1, pp, len);
+                                       len = strlen(pp);
+                                       memmove(pp + 1, pp, len);
                                        *pp++ = '\'';
                                        buflen--;
                                        bp++;
                                }
                                /* Escape existing quotes */
-                               while ((pp = strchr (pp, '\'')) && buflen > 3) {
-                                       len = strlen (pp++);
-                                       memmove (pp + 3, pp, len);
+                               while ((pp = strchr(pp, '\'')) && buflen > 3) {
+                                       len = strlen(pp++);
+                                       memmove(pp + 3, pp, len);
                                        *pp++ = '\\';
                                        *pp++ = '\'';
                                        *pp++ = '\'';
@@ -1043,7 +1048,8 @@ raw:
                }
        }
 
-       if (buflen <= 0 || (ct->c_termproc && buflen <= strlen(ct->c_termproc))) {
+       if (buflen <= 0 ||
+                       (ct->c_termproc && buflen <= strlen(ct->c_termproc))) {
                /*
                ** content_error would provide a more useful error message
                ** here, except that if we got overrun, it probably would
@@ -1057,11 +1063,11 @@ raw:
        if (ct->c_termproc) {
                char term[BUFSIZ];
 
-               strncpy (term, buffer, sizeof(term));
-               snprintf (buffer, sizeof(buffer), ct->c_termproc, term);
+               strncpy(term, buffer, sizeof(term));
+               snprintf(buffer, sizeof(buffer), ct->c_termproc, term);
        }
 
-       return show_content_aux2 (ct, serial, alternate, NULL, buffer,
+       return show_content_aux2(ct, serial, alternate, NULL, buffer,
                        NOTOK, xlist, xpause, 0, xtty);
 }
 
@@ -1071,34 +1077,34 @@ raw:
 */
 
 static int
-show_message_rfc822 (CT ct, int serial, int alternate)
+show_message_rfc822(CT ct, int serial, int alternate)
 {
        char *cp, buffer[BUFSIZ];
        CI ci = &ct->c_ctinfo;
 
        /* Check for mhshow-show-type/subtype */
-       snprintf (buffer, sizeof(buffer), "%s-show-%s/%s",
+       snprintf(buffer, sizeof(buffer), "%s-show-%s/%s",
                                invo_name, ci->ci_type, ci->ci_subtype);
-       if ((cp = context_find (buffer)) && *cp != '\0')
-               return show_content_aux (ct, serial, alternate, cp, NULL);
+       if ((cp = context_find(buffer)) && *cp != '\0')
+               return show_content_aux(ct, serial, alternate, cp, NULL);
 
        /* Check for mhshow-show-type */
-       snprintf (buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
-       if ((cp = context_find (buffer)) && *cp != '\0')
-               return show_content_aux (ct, serial, alternate, cp, NULL);
+       snprintf(buffer, sizeof(buffer), "%s-show-%s", invo_name, ci->ci_type);
+       if ((cp = context_find(buffer)) && *cp != '\0')
+               return show_content_aux(ct, serial, alternate, cp, NULL);
 
        if ((cp = ct->c_showproc))
-               return show_content_aux (ct, serial, alternate, cp, NULL);
+               return show_content_aux(ct, serial, alternate, cp, NULL);
 
        /* default method for message/rfc822 */
        if (ct->c_subtype == MESSAGE_RFC822) {
-               cp = (ct->c_showproc = add ("%pshow -file '%F'", NULL));
-               return show_content_aux (ct, serial, alternate, cp, NULL);
+               cp = (ct->c_showproc = add("%pshow -file '%F'", NULL));
+               return show_content_aux(ct, serial, alternate, cp, NULL);
        }
 
        /* complain if we are not a part of a multipart/alternative */
        if (!alternate)
-               content_error (NULL, ct, "don't know how to display content");
+               content_error(NULL, ct, "don't know how to display content");
 
        return NOTOK;
 }
@@ -1109,9 +1115,9 @@ show_message_rfc822 (CT ct, int serial, int alternate)
 */
 
 static int
-show_partial (CT ct, int serial, int alternate)
+show_partial(CT ct, int serial, int alternate)
 {
-       content_error (NULL, ct,
+       content_error(NULL, ct,
                "in order to display this message, you must reassemble it");
        return NOTOK;
 }
@@ -1124,30 +1130,30 @@ show_partial (CT ct, int serial, int alternate)
 */
 
 static int
-show_external (CT ct, int serial, int alternate)
+show_external(CT ct, int serial, int alternate)
 {
        struct exbody *e = (struct exbody *) ct->c_ctparams;
        CT p = e->eb_content;
 
-       if (!type_ok (p, 0))
+       if (!type_ok(p, 0))
                return OK;
 
-       return show_switch (p, serial, alternate);
+       return show_switch(p, serial, alternate);
 
 #if 0
-       content_error (NULL, p, "don't know how to display content");
+       content_error(NULL, p, "don't know how to display content");
        return NOTOK;
 #endif
 }
 
 
 static RETSIGTYPE
-intrser (int i)
+intrser(int i)
 {
 #ifndef RELIABLE_SIGNALS
-       SIGNAL (SIGINT, intrser);
+       SIGNAL(SIGINT, intrser);
 #endif
 
-       putchar ('\n');
-       siglongjmp (intrenv, DONE);
+       putchar('\n');
+       siglongjmp(intrenv, DONE);
 }
index add5c02..dd5f517 100644 (file)
@@ -86,30 +86,30 @@ int verbosw = 0;
 #define quitser pipeser
 
 /* mhparse.c */
-CT parse_mime (char *);
+CT parse_mime(char *);
 
 /* mhmisc.c */
-int part_ok (CT, int);
-int type_ok (CT, int);
-void set_endian (void);
-void flush_errors (void);
+int part_ok(CT, int);
+int type_ok(CT, int);
+void set_endian(void);
+void flush_errors(void);
 
 /* mhstoresbr.c */
-void store_all_messages (CT *);
+void store_all_messages(CT *);
 
 /* mhfree.c */
-void free_content (CT);
+void free_content(CT);
 extern CT *cts;
-void freects_done (int) NORETURN;
+void freects_done(int) NORETURN;
 
 /*
 ** static prototypes
 */
-static RETSIGTYPE pipeser (int);
+static RETSIGTYPE pipeser(int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int msgnum, *icachesw;
        char *cp, *file = NULL, *folder = NULL;
@@ -125,12 +125,12 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -138,21 +138,20 @@ main (int argc, char **argv)
        */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
-                                               invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case AUTOSW:
                                autosw++;
@@ -168,13 +167,14 @@ main (int argc, char **argv)
                                icachesw = &wcachesw;
 do_cache:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               switch (*icachesw = smatch (cp, caches)) {
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               switch (*icachesw = smatch(cp, caches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, caches);
-                                       done (1);
+                                       ambigsw(cp, caches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "%s unknown", cp);
+                                       adios(NULL, "%s unknown", cp);
                                default:
                                        break;
                                }
@@ -189,26 +189,27 @@ do_cache:
 
                        case PARTSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
                                if (npart >= NPARTS)
-                                       adios (NULL, "too many parts (starting with %s), %d max",
-                                                  cp, NPARTS);
+                                       adios(NULL, "too many parts (starting with %s), %d max", cp, NPARTS);
                                parts[npart++] = cp;
                                continue;
 
                        case TYPESW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
                                if (ntype >= NTYPES)
-                                       adios (NULL, "too many types (starting with %s), %d max",
-                                                  cp, NTYPES);
+                                       adios(NULL, "too many types (starting with %s), %d max", cp, NTYPES);
                                types[ntype++] = cp;
                                continue;
 
                        case FILESW:
                                if (!(cp = *argp++) || (*cp == '-' && cp[1]))
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               file = *cp == '-' ? cp : path (cp, TFILE);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               file = *cp == '-' ? cp : path(cp, TFILE);
                                continue;
 
                        case VERBSW:
@@ -224,9 +225,9 @@ do_cache:
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else
                                app_msgarg(&msgs, cp);
        }
@@ -235,67 +236,68 @@ do_cache:
        parts[npart] = NULL;
        types[ntype] = NULL;
 
-       set_endian ();
+       set_endian();
 
        /*
        ** Check if we've specified an additional profile
        */
-       if ((cp = getenv ("MHSTORE"))) {
-               if ((fp = fopen (cp, "r"))) {
-                       readconfig ((struct node **) 0, fp, cp, 0);
-                       fclose (fp);
+       if ((cp = getenv("MHSTORE"))) {
+               if ((fp = fopen(cp, "r"))) {
+                       readconfig((struct node **) 0, fp, cp, 0);
+                       fclose(fp);
                } else {
-                       admonish ("", "unable to read $MHSTORE profile (%s)", cp);
+                       admonish("", "unable to read $MHSTORE profile (%s)",
+                                       cp);
                }
        }
 
        /*
        ** Read the standard profile setup
        */
-       if ((fp = fopen (cp = etcpath ("mhn.defaults"), "r"))) {
-               readconfig ((struct node **) 0, fp, cp, 0);
-               fclose (fp);
+       if ((fp = fopen(cp = etcpath("mhn.defaults"), "r"))) {
+               readconfig((struct node **) 0, fp, cp, 0);
+               fclose(fp);
        }
 
        /* Check for public cache location */
-       if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
+       if ((cache_public = context_find(nmhcache)) && *cache_public != '/')
                cache_public = NULL;
 
        /* Check for private cache location */
-       if (!(cache_private = context_find (nmhprivcache)))
+       if (!(cache_private = context_find(nmhprivcache)))
                cache_private = ".cache";
-       cache_private = getcpy (m_maildir (cache_private));
+       cache_private = getcpy(m_maildir(cache_private));
 
        /*
        ** Cache the current directory before we do any chdirs()'s.
        */
-       cwd = getcpy (pwd());
+       cwd = getcpy(pwd());
 
        /*
        ** Check for storage directory.  If specified,
        ** then store temporary files there.  Else we
        ** store them in standard nmh directory.
        */
-       if ((cp = context_find (nmhstorage)) && *cp)
-               tmp = concat (cp, "/", invo_name, NULL);
+       if ((cp = context_find(nmhstorage)) && *cp)
+               tmp = concat(cp, "/", invo_name, NULL);
        else
-               tmp = add (m_maildir (invo_name), NULL);
+               tmp = add(m_maildir(invo_name), NULL);
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        if (file && msgs.size)
-               adios (NULL, "cannot specify msg and file at same time!");
+               adios(NULL, "cannot specify msg and file at same time!");
 
        /*
        ** check if message is coming from file
        */
        if (file) {
-               if (!(cts = (CT *) calloc ((size_t) 2, sizeof(*cts))))
-                       adios (NULL, "out of memory");
+               if (!(cts = (CT *) calloc((size_t) 2, sizeof(*cts))))
+                       adios(NULL, "out of memory");
                ctp = cts;
 
-               if ((ct = parse_mime (file)));
+               if ((ct = parse_mime(file)));
                        *ctp++ = ct;
        } else {
                /*
@@ -304,48 +306,48 @@ do_cache:
                if (!msgs.size)
                        app_msgarg(&msgs, "cur");
                if (!folder)
-                       folder = getfolder (1);
-               maildir = m_maildir (folder);
+                       folder = getfolder(1);
+               maildir = m_maildir(folder);
 
-               if (chdir (maildir) == NOTOK)
-                       adios (maildir, "unable to change directory to");
+               if (chdir(maildir) == NOTOK)
+                       adios(maildir, "unable to change directory to");
 
                /* read folder and create message structure */
-               if (!(mp = folder_read (folder)))
-                       adios (NULL, "unable to read folder %s", folder);
+               if (!(mp = folder_read(folder)))
+                       adios(NULL, "unable to read folder %s", folder);
 
                /* check for empty folder */
                if (mp->nummsg == 0)
-                       adios (NULL, "no messages in %s", folder);
+                       adios(NULL, "no messages in %s", folder);
 
                /* parse all the message ranges/sequences and set SELECTED */
                for (msgnum = 0; msgnum < msgs.size; msgnum++)
-                       if (!m_convert (mp, msgs.msgs[msgnum]))
-                               done (1);
-               seq_setprev (mp);  /* set the previous-sequence */
+                       if (!m_convert(mp, msgs.msgs[msgnum]))
+                               done(1);
+               seq_setprev(mp);  /* set the previous-sequence */
 
-               if (!(cts = (CT *) calloc ((size_t) (mp->numsel + 1),
+               if (!(cts = (CT *) calloc((size_t) (mp->numsel + 1),
                                sizeof(*cts))))
-                       adios (NULL, "out of memory");
+                       adios(NULL, "out of memory");
                ctp = cts;
 
                for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
                        if (is_selected(mp, msgnum)) {
                                char *msgnam;
 
-                               msgnam = m_name (msgnum);
-                               if ((ct = parse_mime (msgnam)))
+                               msgnam = m_name(msgnum);
+                               if ((ct = parse_mime(msgnam)))
                                        *ctp++ = ct;
                        }
                }
        }
 
        if (!*cts)
-               done (1);
+               done(1);
 
        userrs = 1;
-       SIGNAL (SIGQUIT, quitser);
-       SIGNAL (SIGPIPE, pipeser);
+       SIGNAL(SIGQUIT, quitser);
+       SIGNAL(SIGPIPE, pipeser);
 
        /*
        ** Get the associated umask for the relevant contents.
@@ -354,8 +356,8 @@ do_cache:
                struct stat st;
 
                ct = *ctp;
-               if (type_ok (ct, 1) && !ct->c_umask) {
-                       if (stat (ct->c_file, &st) != NOTOK)
+               if (type_ok(ct, 1) && !ct->c_umask) {
+                       if (stat(ct->c_file, &st) != NOTOK)
                                ct->c_umask = ~(st.st_mode & 0777);
                        else
                                ct->c_umask = ~m_gmprot();
@@ -365,38 +367,38 @@ do_cache:
        /*
        ** Store the message content
        */
-       store_all_messages (cts);
+       store_all_messages(cts);
 
        /* Now free all the structures for the content */
        for (ctp = cts; *ctp; ctp++)
-               free_content (*ctp);
+               free_content(*ctp);
 
-       free ((char *) cts);
+       free((char *) cts);
        cts = NULL;
 
        /* If reading from a folder, do some updating */
        if (mp) {
-               context_replace (pfolder, folder);  /* update current folder */
-               seq_setcur (mp, mp->hghsel);  /* update current message */
-               seq_save (mp);  /* synchronize sequences  */
-               context_save ();  /* save the context file  */
+               context_replace(pfolder, folder);  /* update current folder */
+               seq_setcur(mp, mp->hghsel);  /* update current message */
+               seq_save(mp);  /* synchronize sequences  */
+               context_save();  /* save the context file  */
        }
 
-       done (0);
+       done(0);
        return 1;
 }
 
 
 static RETSIGTYPE
-pipeser (int i)
+pipeser(int i)
 {
        if (i == SIGQUIT) {
-               unlink ("core");
-               fflush (stdout);
-               fprintf (stderr, "\n");
-               fflush (stderr);
+               unlink("core");
+               fflush(stdout);
+               fprintf(stderr, "\n");
+               fflush(stderr);
        }
 
-       done (1);
+       done(1);
        /* NOTREACHED */
 }
index e5b92e8..8b2dc00 100644 (file)
@@ -46,36 +46,36 @@ typedef int (*qsort_comp) (const void *, const void *);
 
 
 /* mhmisc.c */
-int part_ok (CT, int);
-int type_ok (CT, int);
-int make_intermediates (char *);
-void flush_errors (void);
+int part_ok(CT, int);
+int type_ok(CT, int);
+int make_intermediates(char *);
+void flush_errors(void);
 
 /* mhshowsbr.c */
-int show_content_aux (CT, int, int, char *, char *);
+int show_content_aux(CT, int, int, char *, char *);
 
 /*
 ** prototypes
 */
-void store_all_messages (CT *);
+void store_all_messages(CT *);
 
 /*
 ** static prototypes
 */
-static void store_single_message (CT);
-static int store_switch (CT);
-static int store_generic (CT);
-static int store_application (CT);
-static int store_multi (CT);
-static int store_partial (CT);
-static int store_external (CT);
-static int ct_compar (CT *, CT *);
-static int store_content (CT, CT);
-static int output_content_file (CT, int);
-static int output_content_folder (char *, char *);
-static int parse_format_string (CT, char *, char *, int, char *);
-static void get_storeproc (CT);
-static int copy_some_headers (FILE *, CT);
+static void store_single_message(CT);
+static int store_switch(CT);
+static int store_generic(CT);
+static int store_application(CT);
+static int store_multi(CT);
+static int store_partial(CT);
+static int store_external(CT);
+static int ct_compar(CT *, CT *);
+static int store_content(CT, CT);
+static int output_content_file(CT, int);
+static int output_content_folder(char *, char *);
+static int parse_format_string(CT, char *, char *, int, char *);
+static void get_storeproc(CT);
+static int copy_some_headers(FILE *, CT);
 
 
 /*
@@ -84,7 +84,7 @@ static int copy_some_headers (FILE *, CT);
 */
 
 void
-store_all_messages (CT *cts)
+store_all_messages(CT *cts)
 {
        CT ct, *ctp;
        char *cp;
@@ -94,18 +94,18 @@ store_all_messages (CT *cts)
        ** store any contents.
        */
        if (autosw)
-               dir = getcpy (cwd);
-       else if ((cp = context_find (nmhstorage)) && *cp)
-               dir = getcpy (cp);
+               dir = getcpy(cwd);
+       else if ((cp = context_find(nmhstorage)) && *cp)
+               dir = getcpy(cp);
        else
-               dir = getcpy (cwd);
+               dir = getcpy(cwd);
 
        for (ctp = cts; *ctp; ctp++) {
                ct = *ctp;
-               store_single_message (ct);
+               store_single_message(ct);
        }
 
-       flush_errors ();
+       flush_errors();
 }
 
 
@@ -115,13 +115,13 @@ store_all_messages (CT *cts)
 */
 
 static void
-store_single_message (CT ct)
+store_single_message(CT ct)
 {
-       if (type_ok (ct, 1)) {
-               umask (ct->c_umask);
-               store_switch (ct);
+       if (type_ok(ct, 1)) {
+               umask(ct->c_umask);
+               store_switch(ct);
                if (ct->c_fp) {
-                       fclose (ct->c_fp);
+                       fclose(ct->c_fp);
                        ct->c_fp = NULL;
                }
                if (ct->c_ceclosefnx)
@@ -135,42 +135,42 @@ store_single_message (CT ct)
 */
 
 static int
-store_switch (CT ct)
+store_switch(CT ct)
 {
        switch (ct->c_type) {
                case CT_MULTIPART:
-                       return store_multi (ct);
+                       return store_multi(ct);
                        break;
 
                case CT_MESSAGE:
                        switch (ct->c_subtype) {
                                case MESSAGE_PARTIAL:
-                                       return store_partial (ct);
+                                       return store_partial(ct);
                                        break;
 
                                case MESSAGE_EXTERNAL:
-                                       return store_external (ct);
+                                       return store_external(ct);
 
                                case MESSAGE_RFC822:
                                default:
-                                       return store_generic (ct);
+                                       return store_generic(ct);
                                        break;
                        }
                        break;
 
                case CT_APPLICATION:
-                       return store_application (ct);
+                       return store_application(ct);
                        break;
 
                case CT_TEXT:
                case CT_AUDIO:
                case CT_IMAGE:
                case CT_VIDEO:
-                       return store_generic (ct);
+                       return store_generic(ct);
                        break;
 
                default:
-                       adios (NULL, "unknown content type %d", ct->c_type);
+                       adios(NULL, "unknown content type %d", ct->c_type);
                        break;
        }
 
@@ -184,7 +184,7 @@ store_switch (CT ct)
 */
 
 static int
-store_generic (CT ct)
+store_generic(CT ct)
 {
        /*
        ** Check if the content specifies a filename.
@@ -192,9 +192,9 @@ store_generic (CT ct)
        ** (only "message/rfc822" will use store_generic).
        */
        if (autosw && ct->c_type != CT_MESSAGE)
-               get_storeproc (ct);
+               get_storeproc(ct);
 
-       return store_content (ct, NULL);
+       return store_content(ct, NULL);
 }
 
 
@@ -203,14 +203,14 @@ store_generic (CT ct)
 */
 
 static int
-store_application (CT ct)
+store_application(CT ct)
 {
        char **ap, **ep;
        CI ci = &ct->c_ctinfo;
 
        /* Check if the content specifies a filename */
        if (autosw)
-               get_storeproc (ct);
+               get_storeproc(ct);
 
        /*
        ** If storeproc is not defined, and the content is type
@@ -222,8 +222,8 @@ store_application (CT ct)
 
                for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
                        /* check for "type=tar" attribute */
-                       if (!mh_strcasecmp (*ap, "type")) {
-                               if (mh_strcasecmp (*ep, "tar"))
+                       if (!mh_strcasecmp(*ap, "type")) {
+                               if (mh_strcasecmp(*ep, "tar"))
                                        break;
 
                                tarP = 1;
@@ -231,37 +231,37 @@ store_application (CT ct)
                        }
 
                        /* check for "conversions=compress" attribute */
-                       if ((!mh_strcasecmp (*ap, "conversions") ||
-                                       !mh_strcasecmp (*ap, "x-conversions"))
-                                       && (!mh_strcasecmp (*ep, "compress") ||
-                                       !mh_strcasecmp (*ep, "x-compress"))) {
+                       if ((!mh_strcasecmp(*ap, "conversions") ||
+                                       !mh_strcasecmp(*ap, "x-conversions"))
+                                       && (!mh_strcasecmp(*ep, "compress") ||
+                                       !mh_strcasecmp(*ep, "x-compress"))) {
                                zP = 1;
                                continue;
                        }
                        /* check for "conversions=gzip" attribute */
-                       if ((!mh_strcasecmp (*ap, "conversions") ||
-                                       !mh_strcasecmp (*ap, "x-conversions"))
-                                       && (!mh_strcasecmp (*ep, "gzip") ||
-                                       !mh_strcasecmp (*ep, "x-gzip"))) {
+                       if ((!mh_strcasecmp(*ap, "conversions") ||
+                                       !mh_strcasecmp(*ap, "x-conversions"))
+                                       && (!mh_strcasecmp(*ep, "gzip") ||
+                                       !mh_strcasecmp(*ep, "x-gzip"))) {
                                gzP = 1;
                                continue;
                        }
                }
 
                if (tarP) {
-                       ct->c_showproc = add (zP ? "%euncompress | tar tvf -" : (gzP ? "%egzip -dc | tar tvf -" : "%etar tvf -"), NULL);
+                       ct->c_showproc = add(zP ? "%euncompress | tar tvf -" : (gzP ? "%egzip -dc | tar tvf -" : "%etar tvf -"), NULL);
                        if (!ct->c_storeproc) {
                                if (autosw) {
-                                       ct->c_storeproc = add (zP ? "| uncompress | tar xvpf -" : (gzP ? "| gzip -dc | tar xvpf -" : "| tar xvpf -"), NULL);
+                                       ct->c_storeproc = add(zP ? "| uncompress | tar xvpf -" : (gzP ? "| gzip -dc | tar xvpf -" : "| tar xvpf -"), NULL);
                                        ct->c_umask = 0022;
                                } else {
-                                       ct->c_storeproc= add (zP ? "%m%P.tar.Z" : (gzP ? "%m%P.tar.gz" : "%m%P.tar"), NULL);
+                                       ct->c_storeproc= add(zP ? "%m%P.tar.Z" : (gzP ? "%m%P.tar.gz" : "%m%P.tar"), NULL);
                                }
                        }
                }
        }
 
-       return store_content (ct, NULL);
+       return store_content(ct, NULL);
 }
 
 
@@ -270,7 +270,7 @@ store_application (CT ct)
 */
 
 static int
-store_multi (CT ct)
+store_multi(CT ct)
 {
        int result;
        struct multipart *m = (struct multipart *) ct->c_ctparams;
@@ -280,8 +280,8 @@ store_multi (CT ct)
        for (part = m->mp_parts; part; part = part->mp_next) {
                CT  p = part->mp_part;
 
-               if (part_ok (p, 1) && type_ok (p, 1)) {
-                       result = store_switch (p);
+               if (part_ok(p, 1) && type_ok(p, 1)) {
+                       result = store_switch(p);
                        if (result == OK && ct->c_subtype == MULTI_ALTERNATE)
                                break;
                }
@@ -297,7 +297,7 @@ store_multi (CT ct)
 */
 
 static int
-store_partial (CT ct)
+store_partial(CT ct)
 {
        int cur, hi, i;
        CT p, *ctp, *ctq;
@@ -313,8 +313,9 @@ store_partial (CT ct)
                p = *ctp;
                if (p->c_type == CT_MESSAGE && p->c_subtype == ct->c_subtype) {
                        pm = (struct partial *) p->c_ctparams;
-                       if (!pm->pm_stored
-                                       && strcmp (qm->pm_partid, pm->pm_partid) == 0) {
+                       if (!pm->pm_stored &&
+                                       strcmp(qm->pm_partid, pm->pm_partid)
+                                       == 0) {
                                pm->pm_marked = pm->pm_partno;
                                if (pm->pm_maxno)
                                        hi = pm->pm_maxno;
@@ -326,12 +327,12 @@ store_partial (CT ct)
        }
 
        if (hi == 0) {
-               advise (NULL, "missing (at least) last part of multipart message");
+               advise(NULL, "missing (at least) last part of multipart message");
                return NOTOK;
        }
 
-       if ((base = (CT *) calloc ((size_t) (i + 1), sizeof(*base))) == NULL)
-               adios (NULL, "out of memory");
+       if ((base = (CT *) calloc((size_t) (i + 1), sizeof(*base))) == NULL)
+               adios(NULL, "out of memory");
 
        ctq = base;
        for (ctp = cts; *ctp; ctp++) {
@@ -345,7 +346,7 @@ store_partial (CT ct)
        *ctq = NULL;
 
        if (i > 1)
-               qsort ((char *) base, i, sizeof(*base), (qsort_comp) ct_compar);
+               qsort((char *) base, i, sizeof(*base), (qsort_comp) ct_compar);
 
        cur = 1;
        for (ctq = base; *ctq; ctq++) {
@@ -353,7 +354,7 @@ store_partial (CT ct)
                pm = (struct partial *) p->c_ctparams;
                if (pm->pm_marked != cur) {
                        if (pm->pm_marked == cur - 1) {
-                               admonish (NULL, "duplicate part %d of %d part multipart message", pm->pm_marked, hi);
+                               admonish(NULL, "duplicate part %d of %d part multipart message", pm->pm_marked, hi);
                                continue;
                        }
 
@@ -375,19 +376,19 @@ missing_part:
 
        ctq = base;
        ct = *ctq++;
-       if (store_content (ct, NULL) == NOTOK) {
+       if (store_content(ct, NULL) == NOTOK) {
 losing:
-               free ((char *) base);
+               free((char *) base);
                return NOTOK;
        }
 
        for (; *ctq; ctq++) {
                p = *ctq;
-               if (store_content (p, ct) == NOTOK)
+               if (store_content(p, ct) == NOTOK)
                        goto losing;
        }
 
-       free ((char *) base);
+       free((char *) base);
        return OK;
 }
 
@@ -397,13 +398,13 @@ losing:
 */
 
 static int
-store_external (CT ct)
+store_external(CT ct)
 {
        int result = NOTOK;
        struct exbody *e = (struct exbody *) ct->c_ctparams;
        CT p = e->eb_content;
 
-       if (!type_ok (p, 1))
+       if (!type_ok(p, 1))
                return OK;
 
        /*
@@ -413,16 +414,12 @@ store_external (CT ct)
        if (autosw) {
                char *cp;
 
-               if ((cp = e->eb_name)
-                       && *cp != '/'
-                       && *cp != '.'
-                       && *cp != '|'
-                       && *cp != '!'
-                       && !strchr (cp, '%')) {
+               if ((cp = e->eb_name) && *cp != '/' && *cp != '.' &&
+                               *cp != '|' && *cp != '!' && !strchr(cp, '%')) {
                        if (!ct->c_storeproc)
-                               ct->c_storeproc = add (cp, NULL);
+                               ct->c_storeproc = add(cp, NULL);
                        if (!p->c_storeproc)
-                               p->c_storeproc = add (cp, NULL);
+                               p->c_storeproc = add(cp, NULL);
                }
        }
 
@@ -435,7 +432,7 @@ store_external (CT ct)
        p->c_partno = ct->c_partno;
 
        /* we probably need to check if content is really there */
-       result = store_switch (p);
+       result = store_switch(p);
 
        p->c_partno = NULL;
        return result;
@@ -448,7 +445,7 @@ store_external (CT ct)
 */
 
 static int
-ct_compar (CT *a, CT *b)
+ct_compar(CT *a, CT *b)
 {
        struct partial *am = (struct partial *) ((*a)->c_ctparams);
        struct partial *bm = (struct partial *) ((*b)->c_ctparams);
@@ -469,7 +466,7 @@ ct_compar (CT *a, CT *b)
 */
 
 static int
-store_content (CT ct, CT p)
+store_content(CT ct, CT p)
 {
        int appending = 0, msgnum = 0;
        int is_partial = 0, first_partial = 0;
@@ -509,11 +506,11 @@ store_content (CT ct, CT p)
                */
                if (p) {
                        appending = 1;
-                       ct->c_storage = add (p->c_storage, NULL);
+                       ct->c_storage = add(p->c_storage, NULL);
 
                        /* record the folder name */
                        if (p->c_folder) {
-                               ct->c_folder = add (p->c_folder, NULL);
+                               ct->c_folder = add(p->c_folder, NULL);
                        }
                        goto got_filename;
                }
@@ -531,13 +528,15 @@ store_content (CT ct, CT p)
        if ((cp = ct->c_storeproc) == NULL || *cp == '\0') {
                CI ci = &ct->c_ctinfo;
 
-               snprintf (buffer, sizeof(buffer), "%s-store-%s/%s",
+               snprintf(buffer, sizeof(buffer), "%s-store-%s/%s",
                                invo_name, ci->ci_type, ci->ci_subtype);
-               if ((cp = context_find (buffer)) == NULL || *cp == '\0') {
-                       snprintf (buffer, sizeof(buffer), "%s-store-%s",
+               if ((cp = context_find(buffer)) == NULL || *cp == '\0') {
+                       snprintf(buffer, sizeof(buffer), "%s-store-%s",
                                        invo_name, ci->ci_type);
-                       if ((cp = context_find (buffer)) == NULL || *cp == '\0') {
-                               cp = ct->c_type == CT_MESSAGE ? "+" : "%m%P.%s";
+                       if ((cp = context_find(buffer)) == NULL ||
+                                       *cp == '\0') {
+                               cp = ct->c_type == CT_MESSAGE ?
+                                               "+" : "%m%P.%s";
                        }
                }
        }
@@ -551,22 +550,22 @@ store_content (CT ct, CT p)
 
                /* Store content in temporary file for now */
                tmpfilenam = m_mktemp(invo_name, NULL, NULL);
-               ct->c_storage = add (tmpfilenam, NULL);
+               ct->c_storage = add(tmpfilenam, NULL);
 
                /* Get the folder name */
                if (cp[1])
-                       folder = pluspath (cp);
+                       folder = pluspath(cp);
                else
-                       folder = getfolder (1);
+                       folder = getfolder(1);
 
                /* Check if folder exists */
                create_folder(m_mailpath(folder), 0, exit);
 
                /* Record the folder name */
-               ct->c_folder = add (folder, NULL);
+               ct->c_folder = add(folder, NULL);
 
                if (cp[1])
-                       free (folder);
+                       free(folder);
 
                goto got_filename;
        }
@@ -575,24 +574,24 @@ store_content (CT ct, CT p)
        ** Parse and expand the storage formatting string
        ** in `cp' into `buffer'.
        */
-       parse_format_string (ct, cp, buffer, sizeof(buffer), dir);
+       parse_format_string(ct, cp, buffer, sizeof(buffer), dir);
 
        /*
        ** If formatting begins with '|' or '!', then pass
        ** content to standard input of a command and return.
        */
        if (buffer[0] == '|' || buffer[0] == '!')
-               return show_content_aux (ct, 1, 0, buffer + 1, dir);
+               return show_content_aux(ct, 1, 0, buffer + 1, dir);
 
        /* record the filename */
-       ct->c_storage = add (buffer, NULL);
+       ct->c_storage = add(buffer, NULL);
 
 got_filename:
        /* flush the output stream */
-       fflush (stdout);
+       fflush(stdout);
 
        /* Now save or append the content to a file */
-       if (output_content_file (ct, appending) == NOTOK)
+       if (output_content_file(ct, appending) == NOTOK)
                return NOTOK;
 
        /*
@@ -601,8 +600,8 @@ got_filename:
        ** then only do this if it is the last one in the group.
        */
        if (ct->c_folder && (!is_partial || last_partial)) {
-               msgnum = output_content_folder (ct->c_folder, ct->c_storage);
-               unlink (ct->c_storage);
+               msgnum = output_content_folder(ct->c_folder, ct->c_storage);
+               unlink(ct->c_storage);
                if (msgnum == NOTOK)
                        return NOTOK;
        }
@@ -613,15 +612,15 @@ got_filename:
        */
        if (is_partial) {
                if (first_partial)
-                       fprintf (stderr, "reassembling partials ");
+                       fprintf(stderr, "reassembling partials ");
                if (last_partial)
-                       fprintf (stderr, "%s", ct->c_file);
+                       fprintf(stderr, "%s", ct->c_file);
                else
-                       fprintf (stderr, "%s,", ct->c_file);
+                       fprintf(stderr, "%s,", ct->c_file);
        } else {
-               fprintf (stderr, "storing message %s", ct->c_file);
+               fprintf(stderr, "storing message %s", ct->c_file);
                if (ct->c_partno)
-                       fprintf (stderr, " part %s", ct->c_partno);
+                       fprintf(stderr, " part %s", ct->c_partno);
        }
 
        /*
@@ -631,17 +630,19 @@ got_filename:
        */
        if (!is_partial || last_partial) {
                if (ct->c_folder) {
-                       fprintf (stderr, " to folder %s as message %d\n", ct->c_folder, msgnum);
+                       fprintf(stderr, " to folder %s as message %d\n",
+                                       ct->c_folder, msgnum);
                } else if (!strcmp(ct->c_storage, "-")) {
-                       fprintf (stderr, " to stdout\n");
+                       fprintf(stderr, " to stdout\n");
                } else {
                        int cwdlen;
 
-                       cwdlen = strlen (cwd);
-                       fprintf (stderr, " as file %s\n",
-                               strncmp (ct->c_storage, cwd, cwdlen)
-                               || ct->c_storage[cwdlen] != '/'
-                               ? ct->c_storage : ct->c_storage + cwdlen + 1);
+                       cwdlen = strlen(cwd);
+                       fprintf(stderr, " as file %s\n",
+                                       strncmp(ct->c_storage, cwd, cwdlen) ||
+                                       ct->c_storage[cwdlen] != '/' ?
+                                       ct->c_storage :
+                                       ct->c_storage + cwdlen + 1);
                }
        }
 
@@ -654,7 +655,7 @@ got_filename:
 */
 
 static int
-output_content_file (CT ct, int appending)
+output_content_file(CT ct, int appending)
 {
        int filterstate;
        char *file, buffer[BUFSIZ];
@@ -665,24 +666,23 @@ output_content_file (CT ct, int appending)
        ** If the pathname is absolute, make sure
        ** all the relevant directories exist.
        */
-       if (strchr(ct->c_storage, '/')
-                       && make_intermediates (ct->c_storage) == NOTOK)
+       if (strchr(ct->c_storage, '/') && make_intermediates(ct->c_storage)
+                       == NOTOK)
                return NOTOK;
 
        if (ct->c_encoding != CE_7BIT) {
                int cc, fd;
 
                if (!ct->c_ceopenfnx) {
-                       advise (NULL, "don't know how to decode part %s of message %s",
-                                       ct->c_partno, ct->c_file);
+                       advise(NULL, "don't know how to decode part %s of message %s", ct->c_partno, ct->c_file);
                        return NOTOK;
                }
 
-               file = appending || !strcmp (ct->c_storage, "-") ? NULL
-                                                                                                                  : ct->c_storage;
+               file = appending || !strcmp(ct->c_storage, "-") ?
+                               NULL : ct->c_storage;
                if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
                        return NOTOK;
-               if (!strcmp (file, ct->c_storage)) {
+               if (!strcmp(file, ct->c_storage)) {
                        (*ct->c_ceclosefnx) (ct);
                        return OK;
                }
@@ -690,28 +690,29 @@ output_content_file (CT ct, int appending)
                /*
                ** Send to standard output
                */
-               if (!strcmp (ct->c_storage, "-")) {
+               if (!strcmp(ct->c_storage, "-")) {
                        int gd;
 
-                       if ((gd = dup (fileno (stdout))) == NOTOK) {
-                               advise ("stdout", "unable to dup");
+                       if ((gd = dup(fileno(stdout))) == NOTOK) {
+                               advise("stdout", "unable to dup");
 losing:
                                (*ct->c_ceclosefnx) (ct);
                                return NOTOK;
                        }
-                       if ((fp = fdopen (gd, appending ? "a" : "w")) == NULL) {
-                               advise ("stdout", "unable to fdopen (%d, \"%s\") from", gd,
-                                               appending ? "a" : "w");
-                               close (gd);
+                       if ((fp = fdopen(gd, appending ? "a" : "w")) == NULL) {
+                               advise("stdout", "unable to fdopen (%d, \"%s\") from", gd, appending ? "a" : "w");
+                               close(gd);
                                goto losing;
                        }
                } else {
                        /*
                        ** Open output file
                        */
-                       if ((fp = fopen (ct->c_storage, appending ? "a" : "w")) == NULL) {
-                               advise (ct->c_storage, "unable to fopen for %s",
-                                               appending ? "appending" : "writing");
+                       if ((fp = fopen(ct->c_storage, appending ? "a" : "w"))
+                                       == NULL) {
+                               advise(ct->c_storage, "unable to fopen for %s",
+                                               appending ?
+                                               "appending" : "writing");
                                goto losing;
                        }
                }
@@ -724,20 +725,21 @@ losing:
                        struct partial *pm = (struct partial *) ct->c_ctparams;
 
                        if (pm->pm_partno == 1)
-                               copy_some_headers (fp, ct);
+                               copy_some_headers(fp, ct);
                }
 
                for (;;) {
-                       switch (cc = read (fd, buffer, sizeof(buffer))) {
+                       switch (cc = read(fd, buffer, sizeof(buffer))) {
                                case NOTOK:
-                                       advise (file, "error reading content from");
+                                       advise(file, "error reading content from");
                                        break;
 
                                case OK:
                                        break;
 
                                default:
-                                       fwrite (buffer, sizeof(*buffer), cc, fp);
+                                       fwrite(buffer, sizeof(*buffer),
+                                                       cc, fp);
                                        continue;
                        }
                        break;
@@ -745,39 +747,40 @@ losing:
 
                (*ct->c_ceclosefnx) (ct);
 
-               if (cc != NOTOK && fflush (fp))
-                       advise (ct->c_storage, "error writing to");
+               if (cc != NOTOK && fflush(fp))
+                       advise(ct->c_storage, "error writing to");
 
-               fclose (fp);
+               fclose(fp);
 
                return (cc != NOTOK ? OK : NOTOK);
        }
 
-       if (!ct->c_fp && (ct->c_fp = fopen (ct->c_file, "r")) == NULL) {
-               advise (ct->c_file, "unable to open for reading");
+       if (!ct->c_fp && (ct->c_fp = fopen(ct->c_file, "r")) == NULL) {
+               advise(ct->c_file, "unable to open for reading");
                return NOTOK;
        }
 
        pos = ct->c_begin;
        last = ct->c_end;
-       fseek (ct->c_fp, pos, SEEK_SET);
+       fseek(ct->c_fp, pos, SEEK_SET);
 
-       if (!strcmp (ct->c_storage, "-")) {
+       if (!strcmp(ct->c_storage, "-")) {
                int gd;
 
-               if ((gd = dup (fileno (stdout))) == NOTOK) {
-                       advise ("stdout", "unable to dup");
+               if ((gd = dup(fileno(stdout))) == NOTOK) {
+                       advise("stdout", "unable to dup");
                        return NOTOK;
                }
-               if ((fp = fdopen (gd, appending ? "a" : "w")) == NULL) {
-                       advise ("stdout", "unable to fdopen (%d, \"%s\") from", gd,
-                                       appending ? "a" : "w");
-                       close (gd);
+               if ((fp = fdopen(gd, appending ? "a" : "w")) == NULL) {
+                       advise("stdout", "unable to fdopen (%d, \"%s\") from",
+                                       gd, appending ? "a" : "w");
+                       close(gd);
                        return NOTOK;
                }
        } else {
-               if ((fp = fopen (ct->c_storage, appending ? "a" : "w")) == NULL) {
-                       advise (ct->c_storage, "unable to fopen for %s",
+               if ((fp = fopen(ct->c_storage, appending ? "a" : "w"))
+                               == NULL) {
+                       advise(ct->c_storage, "unable to fopen for %s",
                                        appending ? "appending" : "writing");
                        return NOTOK;
                }
@@ -792,16 +795,16 @@ losing:
                struct partial *pm = (struct partial *) ct->c_ctparams;
 
                if (pm->pm_partno == 1) {
-                       copy_some_headers (fp, ct);
+                       copy_some_headers(fp, ct);
                        filterstate = 1;
                }
        }
 
-       while (fgets (buffer, sizeof(buffer) - 1, ct->c_fp)) {
-               if ((pos += strlen (buffer)) > last) {
+       while (fgets(buffer, sizeof(buffer) - 1, ct->c_fp)) {
+               if ((pos += strlen(buffer)) > last) {
                        int diff;
 
-                       diff = strlen (buffer) - (pos - last);
+                       diff = strlen(buffer) - (pos - last);
                        if (diff >= 0)
                                buffer[diff] = '\0';
                }
@@ -823,11 +826,7 @@ losing:
                                        break;
 
                                default:
-                                       if (!uprf (buffer, XXX_FIELD_PRF)
-                                                       && !uprf (buffer, VRSN_FIELD)
-                                                       && !uprf (buffer, "Subject:")
-                                                       && !uprf (buffer, "Encrypted:")
-                                                       && !uprf (buffer, "Message-ID:")) {
+                                       if (!uprf(buffer, XXX_FIELD_PRF) && !uprf(buffer, VRSN_FIELD) && !uprf(buffer, "Subject:") && !uprf(buffer, "Encrypted:") && !uprf(buffer, "Message-ID:")) {
                                                filterstate = -1;
                                                buffer[0] = 0;
                                                break;
@@ -836,16 +835,16 @@ losing:
                                        break;
                        }
                }
-               fputs (buffer, fp);
+               fputs(buffer, fp);
                if (pos >= last)
                        break;
        }
 
-       if (fflush (fp))
-               advise (ct->c_storage, "error writing to");
+       if (fflush(fp))
+               advise(ct->c_storage, "error writing to");
 
-       fclose (fp);
-       fclose (ct->c_fp);
+       fclose(fp);
+       fclose(ct->c_fp);
        ct->c_fp = NULL;
        return OK;
 }
@@ -860,22 +859,22 @@ losing:
 */
 
 static int
-output_content_folder (char *folder, char *filename)
+output_content_folder(char *folder, char *filename)
 {
        int msgnum;
        struct msgs *mp;
 
        /* Read the folder. */
-       if ((mp = folder_read (folder))) {
+       if ((mp = folder_read(folder))) {
                /* Link file into folder */
-               msgnum = folder_addmsg (&mp, filename, 0, 0, 0, 0, (char *)0);
+               msgnum = folder_addmsg(&mp, filename, 0, 0, 0, 0, (char *)0);
        } else {
-               advise (NULL, "unable to read folder %s", folder);
+               advise(NULL, "unable to read folder %s", folder);
                return NOTOK;
        }
 
        /* free folder structure */
-       folder_free (mp);
+       folder_free(mp);
 
        /*
        ** Return msgnum.  We are relying on the fact that
@@ -891,7 +890,7 @@ output_content_folder (char *folder, char *filename)
 */
 
 static int
-parse_format_string (CT ct, char *cp, char *buffer, int buflen, char *dir)
+parse_format_string(CT ct, char *cp, char *buffer, int buflen, char *dir)
 {
        int len;
        char *bp;
@@ -902,7 +901,7 @@ parse_format_string (CT ct, char *cp, char *buffer, int buflen, char *dir)
        ** return (send content to standard output).
        */
        if (cp[0] == '-' && cp[1] == '\0') {
-               strncpy (buffer, cp, buflen);
+               strncpy(buffer, cp, buflen);
                return 0;
        }
 
@@ -915,8 +914,8 @@ parse_format_string (CT ct, char *cp, char *buffer, int buflen, char *dir)
        ** appropriate directory.
        */
        if (*cp != '/' && *cp != '|' && *cp != '!') {
-               snprintf (bp, buflen, "%s/", dir[1] ? dir : "");
-               len = strlen (bp);
+               snprintf(bp, buflen, "%s/", dir[1] ? dir : "");
+               len = strlen(bp);
                bp += len;
                buflen -= len;
        }
@@ -942,8 +941,8 @@ parse_format_string (CT ct, char *cp, char *buffer, int buflen, char *dir)
 
                                                for (ap = ci->ci_attrs, ep = ci->ci_values;
                                                                 *ap; ap++, ep++) {
-                                                       snprintf (bp, buflen, "%s%s=\"%s\"", s, *ap, *ep);
-                                                       len = strlen (bp);
+                                                       snprintf(bp, buflen, "%s%s=\"%s\"", s, *ap, *ep);
+                                                       len = strlen(bp);
                                                        bp += len;
                                                        buflen -= len;
                                                        s = " ";
@@ -953,29 +952,29 @@ parse_format_string (CT ct, char *cp, char *buffer, int buflen, char *dir)
 
                                case 'm':
                                        /* insert message number */
-                                       snprintf (bp, buflen, "%s", r1bindex (ct->c_file, '/'));
+                                       snprintf(bp, buflen, "%s", r1bindex(ct->c_file, '/'));
                                        break;
 
                                case 'P':
                                        /* insert part number with leading dot */
                                        if (ct->c_partno)
-                                               snprintf (bp, buflen, ".%s", ct->c_partno);
+                                               snprintf(bp, buflen, ".%s", ct->c_partno);
                                        break;
 
                                case 'p':
                                        /* insert part number withouth leading dot */
                                        if (ct->c_partno)
-                                               strncpy (bp, ct->c_partno, buflen);
+                                               strncpy(bp, ct->c_partno, buflen);
                                        break;
 
                                case 't':
                                        /* insert content type */
-                                       strncpy (bp, ci->ci_type, buflen);
+                                       strncpy(bp, ci->ci_type, buflen);
                                        break;
 
                                case 's':
                                        /* insert content subtype */
-                                       strncpy (bp, ci->ci_subtype, buflen);
+                                       strncpy(bp, ci->ci_subtype, buflen);
                                        break;
 
                                case '%':
@@ -990,7 +989,7 @@ parse_format_string (CT ct, char *cp, char *buffer, int buflen, char *dir)
                        }
 
                        /* Advance bp and decrement buflen */
-                       len = strlen (bp);
+                       len = strlen(bp);
                        bp += len;
                        buflen -= len;
 
@@ -1012,7 +1011,7 @@ raw:
 */
 
 static void
-get_storeproc (CT ct)
+get_storeproc(CT ct)
 {
        char **ap, **ep, *cp;
        CI ci = &ct->c_ctinfo;
@@ -1031,13 +1030,10 @@ get_storeproc (CT ct)
        ** the storeproc.
        */
        for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
-               if (!mh_strcasecmp (*ap, "name")
-                       && *(cp = *ep) != '/'
-                       && *cp != '.'
-                       && *cp != '|'
-                       && *cp != '!'
-                       && !strchr (cp, '%')) {
-                       ct->c_storeproc = add (cp, NULL);
+               if (!mh_strcasecmp(*ap, "name") && *(cp = *ep) != '/' &&
+                               *cp != '.' && *cp != '|' && *cp != '!' &&
+                               !strchr(cp, '%')) {
+                       ct->c_storeproc = add(cp, NULL);
                        return;
                }
        }
@@ -1050,7 +1046,7 @@ get_storeproc (CT ct)
 */
 
 static int
-copy_some_headers (FILE *out, CT ct)
+copy_some_headers(FILE *out, CT ct)
 {
        HF hp;
 
@@ -1061,12 +1057,12 @@ copy_some_headers (FILE *out, CT ct)
                ** A few of the header fields of the enclosing
                ** messages are not copied.
                */
-               if (!uprf (hp->name, XXX_FIELD_PRF)
-                               && mh_strcasecmp (hp->name, VRSN_FIELD)
-                               && mh_strcasecmp (hp->name, "Subject")
-                               && mh_strcasecmp (hp->name, "Encrypted")
-                               && mh_strcasecmp (hp->name, "Message-ID"))
-                       fprintf (out, "%s:%s", hp->name, hp->value);
+               if (!uprf(hp->name, XXX_FIELD_PRF) &&
+                               mh_strcasecmp(hp->name, VRSN_FIELD) &&
+                               mh_strcasecmp(hp->name, "Subject") &&
+                               mh_strcasecmp(hp->name, "Encrypted") &&
+                               mh_strcasecmp(hp->name, "Message-ID"))
+                       fprintf(out, "%s:%s", hp->name, hp->value);
                hp = hp->next;  /* next header field */
        }
 
index f8e6e38..621c701 100644 (file)
@@ -88,31 +88,31 @@ int verbosw = 0;
 #define quitser pipeser
 
 /* mhparse.c */
-CT parse_mime (char *);
+CT parse_mime(char *);
 
 /* mhoutsbr.c */
-int output_message (CT, char *);
+int output_message(CT, char *);
 
 /* mhmisc.c */
-int part_ok (CT, int);
-int type_ok (CT, int);
-void set_endian (void);
-void flush_errors (void);
+int part_ok(CT, int);
+int type_ok(CT, int);
+void set_endian(void);
+void flush_errors(void);
 
 /* mhfree.c */
-void free_content (CT);
+void free_content(CT);
 extern CT *cts;
-void freects_done (int) NORETURN;
+void freects_done(int) NORETURN;
 
 /*
 ** static prototypes
 */
-static int write_content (CT *, char *);
-static RETSIGTYPE pipeser (int);
+static int write_content(CT *, char *);
+static RETSIGTYPE pipeser(int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int msgnum, *icachesw;
        char *cp, *file = NULL, *folder = NULL;
@@ -127,12 +127,12 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -140,20 +140,20 @@ main (int argc, char **argv)
        */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case RCACHESW:
                                icachesw = &rcachesw;
@@ -162,13 +162,14 @@ main (int argc, char **argv)
                                icachesw = &wcachesw;
 do_cache:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               switch (*icachesw = smatch (cp, caches)) {
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               switch (*icachesw = smatch(cp, caches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, caches);
-                                       done (1);
+                                       ambigsw(cp, caches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "%s unknown", cp);
+                                       adios(NULL, "%s unknown", cp);
                                default:
                                        break;
                                }
@@ -183,32 +184,33 @@ do_cache:
 
                        case PARTSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
+                                       adios(NULL, "missing argument to %s", argp[-2]);
                                if (npart >= NPARTS)
-                                       adios (NULL, "too many parts (starting with %s), %d max",
-                                                  cp, NPARTS);
+                                       adios(NULL, "too many parts (starting with %s), %d max", cp, NPARTS);
                                parts[npart++] = cp;
                                continue;
 
                        case TYPESW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
+                                       adios(NULL, "missing argument to %s", argp[-2]);
                                if (ntype >= NTYPES)
-                                       adios (NULL, "too many types (starting with %s), %d max",
+                                       adios(NULL, "too many types (starting with %s), %d max",
                                                   cp, NTYPES);
                                types[ntype++] = cp;
                                continue;
 
                        case FILESW:
                                if (!(cp = *argp++) || (*cp == '-' && cp[1]))
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               file = *cp == '-' ? cp : path (cp, TFILE);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               file = *cp == '-' ? cp : path(cp, TFILE);
                                continue;
 
                        case OUTFILESW:
                                if (!(cp = *argp++) || (*cp == '-' && cp[1]))
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               outfile = *cp == '-' ? cp : path (cp, TFILE);
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               outfile = *cp == '-' ? cp : path(cp, TFILE);
                                continue;
 
                        case VERBSW:
@@ -224,9 +226,9 @@ do_cache:
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else
                        app_msgarg(&msgs, cp);
        }
@@ -235,45 +237,45 @@ do_cache:
        parts[npart] = NULL;
        types[ntype] = NULL;
 
-       set_endian ();
+       set_endian();
 
        if (outfile == NULL)
-               adios (NULL, "must specify output file");
+               adios(NULL, "must specify output file");
 
        /* Check for public cache location */
-       if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
+       if ((cache_public = context_find(nmhcache)) && *cache_public != '/')
                cache_public = NULL;
 
        /* Check for private cache location */
-       if (!(cache_private = context_find (nmhprivcache)))
+       if (!(cache_private = context_find(nmhprivcache)))
                cache_private = ".cache";
-       cache_private = getcpy (m_maildir (cache_private));
+       cache_private = getcpy(m_maildir(cache_private));
 
        /*
        ** Check for storage directory.  If specified,
        ** then store temporary files there.  Else we
        ** store them in standard nmh directory.
        */
-       if ((cp = context_find (nmhstorage)) && *cp)
-               tmp = concat (cp, "/", invo_name, NULL);
+       if ((cp = context_find(nmhstorage)) && *cp)
+               tmp = concat(cp, "/", invo_name, NULL);
        else
-               tmp = add (m_maildir (invo_name), NULL);
+               tmp = add(m_maildir(invo_name), NULL);
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        if (file && msgs.size)
-               adios (NULL, "cannot specify msg and file at same time!");
+               adios(NULL, "cannot specify msg and file at same time!");
 
        /*
        ** check if message is coming from file
        */
        if (file) {
-               if (!(cts = (CT *) calloc ((size_t) 2, sizeof(*cts))))
-                       adios (NULL, "out of memory");
+               if (!(cts = (CT *) calloc((size_t) 2, sizeof(*cts))))
+                       adios(NULL, "out of memory");
                ctp = cts;
 
-               if ((ct = parse_mime (file)));
+               if ((ct = parse_mime(file)));
                        *ctp++ = ct;
        } else {
                /*
@@ -282,47 +284,48 @@ do_cache:
                if (!msgs.size)
                        app_msgarg(&msgs, "cur");
                if (!folder)
-                       folder = getfolder (1);
-               maildir = m_maildir (folder);
+                       folder = getfolder(1);
+               maildir = m_maildir(folder);
 
-               if (chdir (maildir) == NOTOK)
-                       adios (maildir, "unable to change directory to");
+               if (chdir(maildir) == NOTOK)
+                       adios(maildir, "unable to change directory to");
 
                /* read folder and create message structure */
-               if (!(mp = folder_read (folder)))
-                       adios (NULL, "unable to read folder %s", folder);
+               if (!(mp = folder_read(folder)))
+                       adios(NULL, "unable to read folder %s", folder);
 
                /* check for empty folder */
                if (mp->nummsg == 0)
-                       adios (NULL, "no messages in %s", folder);
+                       adios(NULL, "no messages in %s", folder);
 
                /* parse all the message ranges/sequences and set SELECTED */
                for (msgnum = 0; msgnum < msgs.size; msgnum++)
-                       if (!m_convert (mp, msgs.msgs[msgnum]))
-                               done (1);
-               seq_setprev (mp);  /* set the previous-sequence */
+                       if (!m_convert(mp, msgs.msgs[msgnum]))
+                               done(1);
+               seq_setprev(mp);  /* set the previous-sequence */
 
-               if (!(cts = (CT *) calloc ((size_t) (mp->numsel + 1), sizeof(*cts))))
-                       adios (NULL, "out of memory");
+               if (!(cts = (CT *) calloc((size_t) (mp->numsel + 1),
+                               sizeof(*cts))))
+                       adios(NULL, "out of memory");
                ctp = cts;
 
                for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
                        if (is_selected(mp, msgnum)) {
                                char *msgnam;
 
-                               msgnam = m_name (msgnum);
-                               if ((ct = parse_mime (msgnam)))
+                               msgnam = m_name(msgnum);
+                               if ((ct = parse_mime(msgnam)))
                                        *ctp++ = ct;
                        }
                }
        }
 
        if (!*cts)
-               done (1);
+               done(1);
 
        userrs = 1;
-       SIGNAL (SIGQUIT, quitser);
-       SIGNAL (SIGPIPE, pipeser);
+       SIGNAL(SIGQUIT, quitser);
+       SIGNAL(SIGPIPE, pipeser);
 
        /*
        ** Get the associated umask for the relevant contents.
@@ -331,8 +334,8 @@ do_cache:
                struct stat st;
 
                ct = *ctp;
-               if (type_ok (ct, 1) && !ct->c_umask) {
-                       if (stat (ct->c_file, &st) != NOTOK)
+               if (type_ok(ct, 1) && !ct->c_umask) {
+                       if (stat(ct->c_file, &st) != NOTOK)
                                ct->c_umask = ~(st.st_mode & 0777);
                        else
                                ct->c_umask = ~m_gmprot();
@@ -342,53 +345,53 @@ do_cache:
        /*
        ** Write the content to a file
        */
-       write_content (cts, outfile);
+       write_content(cts, outfile);
 
        /* Now free all the structures for the content */
        for (ctp = cts; *ctp; ctp++)
-               free_content (*ctp);
+               free_content(*ctp);
 
-       free ((char *) cts);
+       free((char *) cts);
        cts = NULL;
 
        /* If reading from a folder, do some updating */
        if (mp) {
-               context_replace (pfolder, folder);  /* update current folder */
-               seq_setcur (mp, mp->hghsel);  /* update current message */
-               seq_save (mp);  /* synchronize sequences  */
-               context_save ();  /* save the context file  */
+               context_replace(pfolder, folder);  /* update current folder */
+               seq_setcur(mp, mp->hghsel);  /* update current message */
+               seq_save(mp);  /* synchronize sequences  */
+               context_save();  /* save the context file  */
        }
 
-       done (0);
+       done(0);
        return 1;
 }
 
 
 static int
-write_content (CT *cts, char *outfile)
+write_content(CT *cts, char *outfile)
 {
        CT ct, *ctp;
 
        for (ctp = cts; *ctp; ctp++) {
                ct = *ctp;
-               output_message (ct, outfile);
+               output_message(ct, outfile);
        }
 
-       flush_errors ();
+       flush_errors();
        return OK;
 }
 
 
 static RETSIGTYPE
-pipeser (int i)
+pipeser(int i)
 {
        if (i == SIGQUIT) {
-               unlink ("core");
-               fflush (stdout);
-               fprintf (stderr, "\n");
-               fflush (stderr);
+               unlink("core");
+               fflush(stdout);
+               fprintf(stderr, "\n");
+               fflush(stderr);
        }
 
-       done (1);
+       done(1);
        /* NOTREACHED */
 }
index 0b2f3eb..ffde2b4 100644 (file)
@@ -49,12 +49,12 @@ static struct swit switches[] = {
 /*
 ** static prototypes
 */
-static int donote (char *, int);
-static int checkmail (char *, char *, int, int, int);
+static int donote(char *, int);
+static int checkmail(char *, char *, int, int, int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int datesw = 1, notifysw = NT_ALL;
        int status = 0;
@@ -68,35 +68,34 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       mts_init (invo_name);
-       uid = getuid ();
+       mts_init(invo_name);
+       uid = getuid();
        user = getusername();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [switches] [users ...]",
-                                               invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [switches] [users ...]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case DATESW:
                                        datesw++;
@@ -107,18 +106,19 @@ main (int argc, char **argv)
 
                                case NOTESW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       notifysw |= donote (cp, 1);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       notifysw |= donote(cp, 1);
                                        continue;
                                case NNOTESW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       notifysw &= ~donote (cp, 0);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       notifysw &= ~donote(cp, 0);
                                        continue;
                        }
                }
                if (vecp >= MAXVEC-1)
-                       adios (NULL, "you can only check %d users at a time", MAXVEC-1);
+                       adios(NULL, "you can only check %d users at a time",
+                                       MAXVEC-1);
                else
                        vec[vecp++] = cp;
        }
@@ -131,22 +131,23 @@ main (int argc, char **argv)
 
                /* Not sure this check makes sense... */
                if (!geteuid() || NULL == (home = getenv("HOME"))) {
-                       pw = getpwnam (user);
+                       pw = getpwnam(user);
                        if (pw == NULL)
-                               adios (NULL, "unable to get information about user");
+                               adios(NULL, "unable to get information about user");
                        home = pw->pw_dir;
                }
-               status = checkmail (user, home, datesw, notifysw, 1);
+               status = checkmail(user, home, datesw, notifysw, 1);
        } else {
                for (vecp = 0; vec[vecp]; vecp++) {
-                       if ((pw = getpwnam (vec[vecp])))
-                               status += checkmail (pw->pw_name, pw->pw_dir, datesw, notifysw, 0);
+                       if ((pw = getpwnam(vec[vecp])))
+                               status += checkmail(pw->pw_name, pw->pw_dir,
+                                               datesw, notifysw, 0);
                        else
-                               advise (NULL, "no such user as %s", vec[vecp]);
+                               advise(NULL, "no such user as %s", vec[vecp]);
                }
        }
 
-       done (status);
+       done(status);
        return 1;
 }
 
@@ -163,14 +164,15 @@ static struct swit ntswitches[] = {
 
 
 static int
-donote (char *cp, int ntflag)
+donote(char *cp, int ntflag)
 {
-       switch (smatch (cp, ntswitches)) {
+       switch (smatch(cp, ntswitches)) {
                case AMBIGSW:
-                       ambigsw (cp, ntswitches);
-                       done (1);
+                       ambigsw(cp, ntswitches);
+                       done(1);
                case UNKWNSW:
-                       adios (NULL, "-%snotify %s unknown", ntflag ? "" : "no", cp);
+                       adios(NULL, "-%snotify %s unknown",
+                                       ntflag ? "" : "no", cp);
 
                case NALLSW:
                        return NT_ALL;
@@ -186,34 +188,34 @@ donote (char *cp, int ntflag)
 
 
 static int
-checkmail (char *user, char *home, int datesw, int notifysw, int personal)
+checkmail(char *user, char *home, int datesw, int notifysw, int personal)
 {
        int mf, status;
        char buffer[BUFSIZ];
        struct stat st;
 
-       snprintf (buffer, sizeof(buffer), "%s/%s",
+       snprintf(buffer, sizeof(buffer), "%s/%s",
                        mmdfldir[0] ? mmdfldir : home,
                        mmdflfil[0] ? mmdflfil : user);
        if (datesw) {
                st.st_size = 0;
                st.st_atime = st.st_mtime = 0;
        }
-       mf = (stat (buffer, &st) == NOTOK || st.st_size == 0) ? NONEOK
+       mf = (stat(buffer, &st) == NOTOK || st.st_size == 0) ? NONEOK
                : st.st_atime <= st.st_mtime ? MMDFNEW : MMDFOLD;
 
        if ((mf & UUCPOK) || (mf & MMDFOK)) {
                if (notifysw & NT_MAIL) {
-                       printf (personal ? "You have " : "%s has ", user);
+                       printf(personal ? "You have " : "%s has ", user);
                        if (mf & UUCPOK)
-                               printf ("%s old-style bell",
+                               printf("%s old-style bell",
                                                mf & UUCPOLD ? "old" : "new");
                        if ((mf & UUCPOK) && (mf & MMDFOK))
-                               printf (" and ");
+                               printf(" and ");
                        if (mf & MMDFOK)
-                               printf ("%s%s", mf & MMDFOLD ? "old" : "new",
+                               printf("%s%s", mf & MMDFOLD ? "old" : "new",
                                                mf & UUCPOK ? " Internet" : "");
-                       printf (" mail waiting");
+                       printf(" mail waiting");
                } else {
                        notifysw = 0;
                }
@@ -221,7 +223,7 @@ checkmail (char *user, char *home, int datesw, int notifysw, int personal)
        }
        else {
                if (notifysw & NT_NMAI)
-                       printf (personal ? "You don't %s%s" : "%s doesn't %s",
+                       printf(personal ? "You don't %s%s" : "%s doesn't %s",
                                        personal ? "" : user,
                                        "have any mail waiting");
                else
@@ -232,9 +234,9 @@ checkmail (char *user, char *home, int datesw, int notifysw, int personal)
 
        if (notifysw)
                if (datesw && st.st_atime)
-                       printf ("; last read on %s", dtime (&st.st_atime, 1));
+                       printf("; last read on %s", dtime(&st.st_atime, 1));
        if (notifysw)
-               printf ("\n");
+               printf("\n");
 
        return status;
 }
index cb2abc4..9236662 100644 (file)
--- a/uip/new.c
+++ b/uip/new.c
@@ -57,11 +57,11 @@ count_messages(char *field)
        field = getcpy(field);
 
        /* copied from seq_read.c:seq_init */
-       for (ap = brkstring (field, " ", "\n"); *ap; ap++) {
+       for (ap = brkstring(field, " ", "\n"); *ap; ap++) {
                if ((cp = strchr(*ap, '-')))
                        *cp++ = '\0';
-               if ((j = m_atoi (*ap)) > 0) {
-                       k = cp ? m_atoi (cp) : j;
+               if ((j = m_atoi(*ap)) > 0) {
+                       k = cp ? m_atoi(cp) : j;
 
                        total += k - j + 1;
                }
@@ -108,18 +108,19 @@ get_msgnums(char *folder, char *sequences[])
 
        /* copied from seq_read.c:seq_public */
        for (state = FLD;;) {
-               switch (state = m_getfld (state, name, field, sizeof(field), fp)) {
+               switch (state = m_getfld(state, name, field, sizeof(field),
+                               fp)) {
                        case FLD:
                        case FLDPLUS:
                        case FLDEOF:
                                if (state == FLDPLUS) {
-                                       cp = getcpy (field);
+                                       cp = getcpy(field);
                                        while (state == FLDPLUS) {
-                                               state = m_getfld (state, name,
+                                               state = m_getfld(state, name,
                                                                field,
                                                                sizeof(field),
                                                                fp);
-                                               cp = add (field, cp);
+                                               cp = add(field, cp);
                                        }
 
                                        /*
@@ -139,7 +140,7 @@ get_msgnums(char *folder, char *sequences[])
                                                        free(this_msgnums);
                                                }
                                        }
-                                       free (cp);
+                                       free(cp);
                                } else {
                                        /* and here */
                                        if (seq_in_list(name, sequences)) {
@@ -161,14 +162,14 @@ get_msgnums(char *folder, char *sequences[])
 
                        case BODY:
                        case BODYEOF:
-                               adios (NULL, "no blank lines are permitted in %s", seqfile);
+                               adios(NULL, "no blank lines are permitted in %s", seqfile);
                                /* fall */
 
                        case FILEEOF:
                                break;
 
                        default:
-                               adios (NULL, "%s is poorly formatted", seqfile);
+                               adios(NULL, "%s is poorly formatted", seqfile);
                }
                break;  /* break from for loop */
        }
@@ -399,11 +400,10 @@ doit(char *cur, char *folders, char *sequences[])
                        count = count_messages(node->n_field);
                        total += count;
 
-                       printf("%-*s %6d.%c %s\n",
-                                  (int) folder_len, node->n_name,
-                                  count,
-                                  (strcmp(node->n_name, cur) == 0 ? '*' : ' '),
-                                  node->n_field);
+                       printf("%-*s %6d.%c %s\n", (int) folder_len,
+                               node->n_name, count,
+                               (strcmp(node->n_name, cur) == 0 ? '*' : ' '),
+                               node->n_field);
                }
        }
 
@@ -441,7 +441,7 @@ main(int argc, char **argv)
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -449,22 +449,22 @@ main(int argc, char **argv)
        */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf (help, sizeof(help),
+                               snprintf(help, sizeof(help),
                                                "%s [switches] [sequences]",
                                                invo_name);
-                               print_help (help, switches, 1);
-                               done (1);
+                               print_help(help, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case FOLDERSSW:
                                if (!(folders = *argp++) || *folders == '-')
@@ -539,6 +539,6 @@ main(int argc, char **argv)
 
        context_save();
 
-       done (0);
+       done(0);
        return 1;
 }
index 732be65..14ecdaa 100644 (file)
@@ -36,7 +36,7 @@ char *file = NULL;
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int fd, msgnum;
        char *cp, *maildir, *msgnam, *folder = NULL, buf[BUFSIZ];
@@ -50,12 +50,12 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -63,26 +63,26 @@ main (int argc, char **argv)
        */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case FILESW:
                                        if (file)
-                                               adios (NULL, "only one file at a time!");
+                                               adios(NULL, "only one file at a time!");
                                        if (!(file = *argp++) || *file == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case MBOXSW:
@@ -97,15 +97,15 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
-                       folder = pluspath (cp);
+                               adios(NULL, "only one folder at a time!");
+                       folder = pluspath(cp);
                } else
                        app_msgarg(&msgs, cp);
        }
 
        if (!file)
                file = "./msgbox";
-       file = path (file, TFILE);
+       file = path(file, TFILE);
 
        /*
        ** Check if file to be created (or appended to)
@@ -113,78 +113,78 @@ main (int argc, char **argv)
        */
        if (stat (file, &st) == NOTOK) {
                if (errno != ENOENT)
-                       adios (file, "error on file");
-               cp = concat ("Create file \"", file, "\"? ", NULL);
-               if (!getanswer (cp))
-                       done (1);
-               free (cp);
+                       adios(file, "error on file");
+               cp = concat("Create file \"", file, "\"? ", NULL);
+               if (!getanswer(cp))
+                       done(1);
+               free(cp);
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        /* default is to pack whole folder */
        if (!msgs.size)
                app_msgarg(&msgs, "all");
 
        if (!folder)
-               folder = getfolder (1);
-       maildir = m_maildir (folder);
+               folder = getfolder(1);
+       maildir = m_maildir(folder);
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to ");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to ");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
        if (mp->nummsg == 0)
-               adios (NULL, "no messages in %s", folder);
+               adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
-               if (!m_convert (mp, msgs.msgs[msgnum]))
-                       done (1);
-       seq_setprev (mp);  /* set the previous-sequence */
+               if (!m_convert(mp, msgs.msgs[msgnum]))
+                       done(1);
+       seq_setprev(mp);  /* set the previous-sequence */
 
        /* open and lock new maildrop file */
        if ((md = mbx_open(file, mbx_style, getuid(), getgid(), m_gmprot()))
                        == NOTOK)
-               adios (file, "unable to open");
+               adios(file, "unable to open");
 
        /* copy all the SELECTED messages to the file */
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
                if (is_selected(mp, msgnum)) {
-                       if ((fd = open (msgnam = m_name (msgnum), O_RDONLY))
+                       if ((fd = open(msgnam = m_name(msgnum), O_RDONLY))
                                        == NOTOK) {
-                               admonish (msgnam, "unable to read message");
+                               admonish(msgnam, "unable to read message");
                                break;
                        }
 
                        if (mbx_copy(file, mbx_style, md, fd, mapping, NULL, 1)
                                        == NOTOK)
-                               adios (file, "error writing to file");
+                               adios(file, "error writing to file");
 
-                       close (fd);
+                       close(fd);
                }
 
        /* close and unlock maildrop file */
-       mbx_close (file, md);
+       mbx_close(file, md);
 
-       context_replace (pfolder, folder);  /* update current folder */
+       context_replace(pfolder, folder);  /* update current folder */
        if (mp->hghsel != mp->curmsg)
-               seq_setcur (mp, mp->lowsel);
-       seq_save (mp);
-       context_save ();  /* save the context file */
-       folder_free (mp);  /* free folder/message structure */
-       done (0);
+               seq_setcur(mp, mp->lowsel);
+       seq_save(mp);
+       context_save();  /* save the context file */
+       folder_free(mp);  /* free folder/message structure */
+       done(0);
        return 1;
 }
 
 static void
-mbxclose_done (int status)
+mbxclose_done(int status)
 {
-       mbx_close (file, md);
-       exit (status);
+       mbx_close(file, md);
+       exit(status);
 }
index 95f99cd..040ebec 100644 (file)
@@ -65,10 +65,10 @@ static struct swit switches[] = {
 
 static int listsw = -1;
 
-static void putzero_done (int) NORETURN;
+static void putzero_done(int) NORETURN;
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int publicsw = -1, zerosw = 1, seqp = 0, vecp = 0;
        int lo, hi, msgnum;
@@ -84,12 +84,12 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
@@ -98,23 +98,23 @@ main (int argc, char **argv)
                                vec[vecp++] = --cp;
                                goto pattern;
                        }
-                       switch (smatch (cp, switches)) {
+                       switch (smatch(cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
+                               ambigsw(cp, switches);
                                listsw = 0;  /* HACK */
-                               done (1);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
-                               print_help (buf, switches, 1);
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
                                listsw = 0;  /* HACK */
-                               done (1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
                                listsw = 0;  /* HACK */
-                               done (1);
+                               done(1);
 
                        case CCSW:
                        case DATESW:
@@ -128,12 +128,12 @@ main (int argc, char **argv)
                                vec[vecp++] = --cp;
                        pattern:
                                if (!(cp = *argp++)) /* allow -xyz arguments */
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                vec[vecp++] = cp;
                                continue;
                        case OTHRSW:
-                               adios (NULL, "internal error!");
+                               adios(NULL, "internal error!");
 
                        case ANDSW:
                        case ORSW:
@@ -145,15 +145,15 @@ main (int argc, char **argv)
 
                        case SEQSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
 
                                /* check if too many sequences specified */
                                if (seqp >= NUMATTRS)
-                                       adios (NULL, "too many sequences (more than %d) specified", NUMATTRS);
+                                       adios(NULL, "too many sequences (more than %d) specified", NUMATTRS);
 
-                               if (!seq_nameok (cp))
-                                 done (1);
+                               if (!seq_nameok(cp))
+                                 done(1);
 
                                seqs[seqp++] = cp;
                                continue;
@@ -180,16 +180,16 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else
                        app_msgarg(&msgs, cp);
        }
        vec[vecp] = NULL;
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        /*
        ** If we didn't specify which messages to search,
@@ -199,25 +199,25 @@ main (int argc, char **argv)
                app_msgarg(&msgs, "all");
 
        if (!folder)
-               folder = getfolder (1);
-       maildir = m_maildir (folder);
+               folder = getfolder(1);
+       maildir = m_maildir(folder);
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
        if (mp->nummsg == 0)
-               adios (NULL, "no messages in %s", folder);
+               adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
-               if (!m_convert (mp, msgs.msgs[msgnum]))
-                       done (1);
-       seq_setprev (mp);  /* set the previous-sequence */
+               if (!m_convert(mp, msgs.msgs[msgnum]))
+                       done(1);
+       seq_setprev(mp);  /* set the previous-sequence */
 
        /*
        ** If we aren't saving the results to a sequence,
@@ -227,11 +227,11 @@ main (int argc, char **argv)
                listsw = !seqp;
 
        if (publicsw == 1 && is_readonly(mp))
-               adios (NULL, "folder %s is read-only, so -public not allowed",
+               adios(NULL, "folder %s is read-only, so -public not allowed",
                                folder);
 
-       if (!pcompile (vec, NULL))
-               done (1);
+       if (!pcompile(vec, NULL))
+               done(1);
 
        lo = mp->lowsel;
        hi = mp->hghsel;
@@ -241,31 +241,31 @@ main (int argc, char **argv)
        ** force line buffering on.
        */
        if (listsw)
-               setvbuf (stdout, NULL, _IOLBF, 0);
+               setvbuf(stdout, NULL, _IOLBF, 0);
 
        /*
        ** Scan through all the SELECTED messages and check for a
        ** match.  If the message does not match, then unselect it.
        */
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
-               if (is_selected (mp, msgnum)) {
-                       if ((fp = fopen (cp = m_name (msgnum), "r")) == NULL)
-                               admonish (cp, "unable to read message");
-                       if (fp && pmatches (fp, msgnum, 0L, 0L)) {
+               if (is_selected(mp, msgnum)) {
+                       if ((fp = fopen(cp = m_name(msgnum), "r")) == NULL)
+                               admonish(cp, "unable to read message");
+                       if (fp && pmatches(fp, msgnum, 0L, 0L)) {
                                if (msgnum < lo)
                                        lo = msgnum;
                                if (msgnum > hi)
                                        hi = msgnum;
 
                                if (listsw)
-                                       printf ("%s\n", m_name (msgnum));
+                                       printf("%s\n", m_name(msgnum));
                        } else {
                                /* if it doesn't match, then unselect it */
-                               unset_selected (mp, msgnum);
+                               unset_selected(mp, msgnum);
                                mp->numsel--;
                        }
                        if (fp)
-                               fclose (fp);
+                               fclose(fp);
                }
        }
 
@@ -273,7 +273,7 @@ main (int argc, char **argv)
        mp->hghsel = hi;
 
        if (mp->numsel <= 0)
-               adios (NULL, "no messages match specification");
+               adios(NULL, "no messages match specification");
 
        seqs[seqp] = NULL;
 
@@ -281,29 +281,29 @@ main (int argc, char **argv)
        ** Add the matching messages to sequences
        */
        for (seqp = 0; seqs[seqp]; seqp++)
-               if (!seq_addsel (mp, seqs[seqp], publicsw, zerosw))
-                       done (1);
+               if (!seq_addsel(mp, seqs[seqp], publicsw, zerosw))
+                       done(1);
 
        /*
        ** Print total matched if not printing each matched message number.
        */
        if (!listsw) {
-               printf ("%d hit%s\n", mp->numsel, mp->numsel == 1 ? "" : "s");
+               printf("%d hit%s\n", mp->numsel, mp->numsel == 1 ? "" : "s");
        }
 
-       context_replace (pfolder, folder);  /* update current folder */
-       seq_save (mp);  /* synchronize message sequences */
-       context_save ();  /* save the context file */
-       folder_free (mp);  /* free folder/message structure */
-       done (0);
+       context_replace(pfolder, folder);  /* update current folder */
+       seq_save(mp);  /* synchronize message sequences */
+       context_save();  /* save the context file */
+       folder_free(mp);  /* free folder/message structure */
+       done(0);
        return 1;
 }
 
 
 static void
-putzero_done (int status)
+putzero_done(int status)
 {
-       if (listsw && status && !isatty (fileno (stdout)))
-               printf ("0\n");
-       exit (status);
+       if (listsw && status && !isatty(fileno(stdout)))
+               printf("0\n");
+       exit(status);
 }
index c0692a8..f95ddbc 100644 (file)
@@ -206,11 +206,11 @@ static int TWSaction();
 
 
 int
-pcompile (char **vec, char *date)
+pcompile(char **vec, char *date)
 {
        register char *cp;
 
-       if ((cp = getenv ("MHPDEBUG")) && *cp)
+       if ((cp = getenv("MHPDEBUG")) && *cp)
                pdebug++;
 
        argp = vec;
@@ -218,11 +218,11 @@ pcompile (char **vec, char *date)
                datesw = "date";
        talked = 0;
 
-       if ((head = parse ()) == NULL)
+       if ((head = parse()) == NULL)
                return (talked ? 0 : 1);
 
        if (*argp) {
-               padvise (NULL, "%s unexpected", *argp);
+               padvise(NULL, "%s unexpected", *argp);
                return 0;
        }
 
@@ -231,141 +231,141 @@ pcompile (char **vec, char *date)
 
 
 static struct nexus *
-parse (void)
+parse(void)
 {
        register char  *cp;
        register struct nexus *n, *o;
 
-       if ((n = nexp1 ()) == NULL || (cp = nxtarg ()) == NULL)
+       if ((n = nexp1()) == NULL || (cp = nxtarg()) == NULL)
                return n;
 
        if (*cp != '-') {
-               padvise (NULL, "%s unexpected", cp);
+               padvise(NULL, "%s unexpected", cp);
                return NULL;
        }
 
        if (*++cp == '-')
                goto header;
-       switch (smatch (cp, parswit)) {
+       switch (smatch(cp, parswit)) {
                case AMBIGSW:
-                       ambigsw (cp, parswit);
+                       ambigsw(cp, parswit);
                        talked++;
                        return NULL;
                case UNKWNSW:
-                       fprintf (stderr, "-%s unknown\n", cp);
+                       fprintf(stderr, "-%s unknown\n", cp);
                        talked++;
                        return NULL;
 
                case PROR:
-                       o = newnexus (ORaction);
+                       o = newnexus(ORaction);
                        o->n_L_child = n;
-                       if ((o->n_R_child = parse ()))
+                       if ((o->n_R_child = parse()))
                                return o;
-                       padvise (NULL, "missing disjunctive");
+                       padvise(NULL, "missing disjunctive");
                        return NULL;
 
 header: ;
                default:
-                       prvarg ();
+                       prvarg();
                        return n;
        }
 }
 
 static struct nexus *
-nexp1 (void)
+nexp1(void)
 {
        register char *cp;
        register struct nexus *n, *o;
 
-       if ((n = nexp2 ()) == NULL || (cp = nxtarg ()) == NULL)
+       if ((n = nexp2()) == NULL || (cp = nxtarg()) == NULL)
                return n;
 
        if (*cp != '-') {
-               padvise (NULL, "%s unexpected", cp);
+               padvise(NULL, "%s unexpected", cp);
                return NULL;
        }
 
        if (*++cp == '-')
                goto header;
-       switch (smatch (cp, parswit)) {
+       switch (smatch(cp, parswit)) {
                case AMBIGSW:
-                       ambigsw (cp, parswit);
+                       ambigsw(cp, parswit);
                        talked++;
                        return NULL;
                case UNKWNSW:
-                       fprintf (stderr, "-%s unknown\n", cp);
+                       fprintf(stderr, "-%s unknown\n", cp);
                        talked++;
                        return NULL;
 
                case PRAND:
-                       o = newnexus (ANDaction);
+                       o = newnexus(ANDaction);
                        o->n_L_child = n;
-                       if ((o->n_R_child = nexp1 ()))
+                       if ((o->n_R_child = nexp1()))
                                return o;
-                       padvise (NULL, "missing conjunctive");
+                       padvise(NULL, "missing conjunctive");
                        return NULL;
 
 header: ;
                default:
-                       prvarg ();
+                       prvarg();
                        return n;
        }
 }
 
 
 static struct nexus *
-nexp2 (void)
+nexp2(void)
 {
        register char *cp;
        register struct nexus *n;
 
-       if ((cp = nxtarg ()) == NULL)
+       if ((cp = nxtarg()) == NULL)
                return NULL;
 
        if (*cp != '-') {
-               prvarg ();
-               return nexp3 ();
+               prvarg();
+               return nexp3();
        }
 
        if (*++cp == '-')
                goto header;
-       switch (smatch (cp, parswit)) {
+       switch (smatch(cp, parswit)) {
                case AMBIGSW:
-                       ambigsw (cp, parswit);
+                       ambigsw(cp, parswit);
                        talked++;
                        return NULL;
                case UNKWNSW:
-                       fprintf (stderr, "-%s unknown\n", cp);
+                       fprintf(stderr, "-%s unknown\n", cp);
                        talked++;
                        return NULL;
 
                case PRNOT:
-                       n = newnexus (NOTaction);
-                       if ((n->n_L_child = nexp3 ()))
+                       n = newnexus(NOTaction);
+                       if ((n->n_L_child = nexp3()))
                                return n;
-                       padvise (NULL, "missing negation");
+                       padvise(NULL, "missing negation");
                        return NULL;
 
 header: ;
                default:
-                       prvarg ();
-                       return nexp3 ();
+                       prvarg();
+                       return nexp3();
        }
 }
 
 static struct nexus *
-nexp3 (void)
+nexp3(void)
 {
        int i;
        register char *cp, *dp;
        char buffer[BUFSIZ], temp[64];
        register struct nexus *n;
 
-       if ((cp = nxtarg ()) == NULL)
+       if ((cp = nxtarg()) == NULL)
                return NULL;
 
        if (*cp != '-') {
-               padvise (NULL, "%s unexpected", cp);
+               padvise(NULL, "%s unexpected", cp);
                return NULL;
        }
 
@@ -373,32 +373,32 @@ nexp3 (void)
                dp = ++cp;
                goto header;
        }
-       switch (i = smatch (cp, parswit)) {
+       switch (i = smatch(cp, parswit)) {
                case AMBIGSW:
-                       ambigsw (cp, parswit);
+                       ambigsw(cp, parswit);
                        talked++;
                        return NULL;
                case UNKWNSW:
-                       fprintf (stderr, "-%s unknown\n", cp);
+                       fprintf(stderr, "-%s unknown\n", cp);
                        talked++;
                        return NULL;
 
                case PRLBR:
-                       if ((n = parse ()) == NULL) {
-                               padvise (NULL, "missing group");
+                       if ((n = parse()) == NULL) {
+                               padvise(NULL, "missing group");
                                return NULL;
                        }
-                       if ((cp = nxtarg ()) == NULL) {
-                               padvise (NULL, "missing -rbrace");
+                       if ((cp = nxtarg()) == NULL) {
+                               padvise(NULL, "missing -rbrace");
                                return NULL;
                        }
-                       if (*cp++ == '-' && smatch (cp, parswit) == PRRBR)
+                       if (*cp++ == '-' && smatch(cp, parswit) == PRRBR)
                                return n;
-                       padvise (NULL, "%s unexpected", --cp);
+                       padvise(NULL, "%s unexpected", --cp);
                        return NULL;
 
                default:
-                       prvarg ();
+                       prvarg();
                        return NULL;
 
                case PRCC:
@@ -408,61 +408,62 @@ nexp3 (void)
                case PRSUBJ:
                        strncpy(temp, parswit[i].sw, sizeof(temp));
                        temp[sizeof(temp) - 1] = '\0';
-                       dp = *brkstring (temp, " ", NULL);
+                       dp = *brkstring(temp, " ", NULL);
 header: ;
-                       if (!(cp = nxtarg ())) {  /* allow -xyz arguments */
-                               padvise (NULL, "missing argument to %s",
+                       if (!(cp = nxtarg())) {  /* allow -xyz arguments */
+                               padvise(NULL, "missing argument to %s",
                                                argp[-2]);
                                return NULL;
                        }
-                       n = newnexus (GREPaction);
+                       n = newnexus(GREPaction);
                        n->n_header = 1;
-                       snprintf (buffer, sizeof(buffer), "^%s[ \t]*:.*%s",
+                       snprintf(buffer, sizeof(buffer), "^%s[ \t]*:.*%s",
                                        dp, cp);
                        dp = buffer;
                        goto pattern;
 
                case PRSRCH:
-                       n = newnexus (GREPaction);
+                       n = newnexus(GREPaction);
                        n->n_header = 0;
-                       if (!(cp = nxtarg ())) {  /* allow -xyz arguments */
-                               padvise (NULL, "missing argument to %s",
+                       if (!(cp = nxtarg())) {  /* allow -xyz arguments */
+                               padvise(NULL, "missing argument to %s",
                                                argp[-2]);
                                return NULL;
                        }
                        dp = cp;
 pattern: ;
-                       if (!gcompile (n, dp)) {
-                               padvise (NULL, "pattern error in %s %s",
+                       if (!gcompile(n, dp)) {
+                               padvise(NULL, "pattern error in %s %s",
                                                argp[-2], cp);
                                return NULL;
                        }
-                       n->n_patbuf = getcpy (dp);
+                       n->n_patbuf = getcpy(dp);
                        return n;
 
                case PROTHR:
-                       padvise (NULL, "internal error!");
+                       padvise(NULL, "internal error!");
                        return NULL;
 
                case PRDATF:
-                       if (!(datesw = nxtarg ()) || *datesw == '-') {
-                               padvise (NULL, "missing argument to %s",
+                       if (!(datesw = nxtarg()) || *datesw == '-') {
+                               padvise(NULL, "missing argument to %s",
                                                argp[-2]);
                                return NULL;
                        }
-                       return nexp3 ();
+                       return nexp3();
 
                case PRAFTR:
                case PRBEFR:
-                       if (!(cp = nxtarg ())) {  /* allow -xyz arguments */
-                               padvise (NULL, "missing argument to %s",
+                       if (!(cp = nxtarg())) {  /* allow -xyz arguments */
+                               padvise(NULL, "missing argument to %s",
                                                argp[-2]);
                                return NULL;
                        }
-                       n = newnexus (TWSaction);
+                       n = newnexus(TWSaction);
                        n->n_datef = datesw;
-                       if (!tcompile (cp, &n->n_tws, n->n_after = i == PRAFTR)) {
-                               padvise (NULL, "unable to parse %s %s",
+                       if (!tcompile(cp, &n->n_tws, n->n_after =
+                                       i == PRAFTR)) {
+                               padvise(NULL, "unable to parse %s %s",
                                                argp[-2], cp);
                                return NULL;
                        }
@@ -472,12 +473,12 @@ pattern: ;
 
 
 static struct nexus *
-newnexus (int (*action)())
+newnexus(int (*action)())
 {
        register struct nexus *p;
 
-       if ((p = (struct nexus *) calloc ((size_t) 1, sizeof *p)) == NULL)
-               adios (NULL, "unable to allocate component storage");
+       if ((p = (struct nexus *) calloc((size_t) 1, sizeof *p)) == NULL)
+               adios(NULL, "unable to allocate component storage");
 
        p->n_action = action;
        return p;
@@ -485,7 +486,7 @@ newnexus (int (*action)())
 
 
 #define args(a)  a, fp, msgnum, start, stop
-#define params   args (n)
+#define params   args(n)
 #define plist    \
        register struct nexus  *n; \
        register FILE *fp; \
@@ -494,89 +495,89 @@ newnexus (int (*action)())
        stop;
 
 int
-pmatches (FILE *fp, int msgnum, long start, long stop)
+pmatches(FILE *fp, int msgnum, long start, long stop)
 {
        if (!head)
                return 1;
 
        if (!talked++ && pdebug)
-               PRaction (head, 0);
+               PRaction(head, 0);
 
-       return (*head->n_action) (args (head));
+       return (*head->n_action) (args(head));
 }
 
 
 static void
-PRaction (struct nexus *n, int level)
+PRaction(struct nexus *n, int level)
 {
        register int i;
 
        for (i = 0; i < level; i++)
-               fprintf (stderr, "| ");
+               fprintf(stderr, "| ");
 
        if (n->n_action == ORaction) {
-               fprintf (stderr, "OR\n");
-               PRaction (n->n_L_child, level + 1);
-               PRaction (n->n_R_child, level + 1);
+               fprintf(stderr, "OR\n");
+               PRaction(n->n_L_child, level + 1);
+               PRaction(n->n_R_child, level + 1);
                return;
        }
        if (n->n_action == ANDaction) {
-               fprintf (stderr, "AND\n");
-               PRaction (n->n_L_child, level + 1);
-               PRaction (n->n_R_child, level + 1);
+               fprintf(stderr, "AND\n");
+               PRaction(n->n_L_child, level + 1);
+               PRaction(n->n_R_child, level + 1);
                return;
        }
        if (n->n_action == NOTaction) {
-               fprintf (stderr, "NOT\n");
-               PRaction (n->n_L_child, level + 1);
+               fprintf(stderr, "NOT\n");
+               PRaction(n->n_L_child, level + 1);
                return;
        }
        if (n->n_action == GREPaction) {
-               fprintf (stderr, "PATTERN(%s) %s\n",
+               fprintf(stderr, "PATTERN(%s) %s\n",
                                n->n_header ? "header" : "body", n->n_patbuf);
                return;
        }
        if (n->n_action == TWSaction) {
-               fprintf (stderr, "TEMPORAL(%s) %s: %s\n",
+               fprintf(stderr, "TEMPORAL(%s) %s: %s\n",
                                n->n_after ? "after" : "before", n->n_datef,
-                               dasctime (&n->n_tws, TW_NULL));
+                               dasctime(&n->n_tws, TW_NULL));
                return;
        }
-       fprintf (stderr, "UNKNOWN(0x%x)\n",
+       fprintf(stderr, "UNKNOWN(0x%x)\n",
                         (unsigned int)(unsigned long) (*n->n_action));
 }
 
 
 static int
-ORaction (params)
+ORaction(params)
 plist
 {
-       if ((*n->n_L_child->n_action) (args (n->n_L_child)))
+       if ((*n->n_L_child->n_action) (args(n->n_L_child)))
                return 1;
-       return (*n->n_R_child->n_action) (args (n->n_R_child));
+       return (*n->n_R_child->n_action) (args(n->n_R_child));
 }
 
 
 static int
-ANDaction (params)
+ANDaction(params)
 plist
 {
-       if (!(*n->n_L_child->n_action) (args (n->n_L_child)))
+       if (!(*n->n_L_child->n_action) (args(n->n_L_child)))
                return 0;
-       return (*n->n_R_child->n_action) (args (n->n_R_child));
+       return (*n->n_R_child->n_action) (args(n->n_R_child));
 }
 
 
 static int
-NOTaction (params)
+NOTaction(params)
 plist
 {
-       return (!(*n->n_L_child->n_action) (args (n->n_L_child)));
+       return (!(*n->n_L_child->n_action) (args(n->n_L_child)));
 }
 
 
 static int
-gcompile (struct nexus *n, char *astr)
+gcompile(struct nexus *n, char *astr)
 {
        register int c;
        int cclcnt;
@@ -665,7 +666,7 @@ cerror: ;
 
 
 static int
-GREPaction (params)
+GREPaction(params)
 plist
 {
        int c, body, lf;
@@ -673,7 +674,7 @@ plist
        register char *p1, *p2, *ebp, *cbp;
        char ibuf[BUFSIZ];
 
-       fseek (fp, start, SEEK_SET);
+       fseek(fp, start, SEEK_SET);
        body = 0;
        ebp = cbp = ibuf;
        for (;;) {
@@ -684,15 +685,15 @@ plist
                lf = 0;
                for (;;) {
                        if (p2 >= ebp) {
-                               if (fgets (ibuf, sizeof ibuf, fp) == NULL
+                               if (fgets(ibuf, sizeof ibuf, fp) == NULL
                                                || (stop && pos >= stop)) {
                                        if (lf)
                                                break;
                                        return 0;
                                }
-                               pos += (long) strlen (ibuf);
+                               pos += (long) strlen(ibuf);
                                p2 = ibuf;
-                               ebp = ibuf + strlen (ibuf);
+                               ebp = ibuf + strlen(ibuf);
                        }
                        c = *p2++;
                        if (lf && c != '\n') {
@@ -725,7 +726,7 @@ plist
                p2 = n->n_expbuf;
 
                if (n->n_circf) {
-                       if (advance (p1, p2))
+                       if (advance(p1, p2))
                                return 1;
                        continue;
                }
@@ -734,14 +735,14 @@ plist
                        c = p2[1];
                        do {
                                if (*p1 == c || cc[(unsigned char)*p1] == c)
-                                       if (advance (p1, p2))
+                                       if (advance(p1, p2))
                                                return 1;
                        } while (*p1++);
                        continue;
                }
 
                do {
-                       if (advance (p1, p2))
+                       if (advance(p1, p2))
                                return 1;
                } while (*p1++);
        }
@@ -749,7 +750,7 @@ plist
 
 
 static int
-advance (char *alp, char *aep)
+advance(char *alp, char *aep)
 {
        register unsigned char *lp, *ep, *curlp;
 
@@ -776,14 +777,14 @@ advance (char *alp, char *aep)
                                return 1;
 
                        case CCL:
-                               if (cclass (ep, *lp++, 1)) {
+                               if (cclass(ep, *lp++, 1)) {
                                        ep += *ep + 1;
                                        continue;
                                }
                                return 0;
 
                        case NCCL:
-                               if (cclass (ep, *lp++, 0)) {
+                               if (cclass(ep, *lp++, 0)) {
                                        ep += *ep + 1;
                                        continue;
                                }
@@ -805,7 +806,7 @@ advance (char *alp, char *aep)
                        case CCL | STAR:
                        case NCCL | STAR:
                                curlp = lp;
-                               while (cclass (ep, *lp++, ep[-1] == (CCL | STAR)))
+                               while (cclass(ep, *lp++, ep[-1] == (CCL | STAR)))
                                        continue;
                                ep += *ep + 1;
                                goto star;
@@ -813,23 +814,23 @@ advance (char *alp, char *aep)
                star:
                                do {
                                        lp--;
-                                       if (advance (lp, ep))
+                                       if (advance(lp, ep))
                                                return (1);
                                } while (lp > curlp);
                                return 0;
 
                        default:
-                               admonish (NULL, "advance() botch -- you lose big");
+                               admonish(NULL, "advance() botch -- you lose big");
                                return 0;
                }
 }
 
 
 static int
-cclass (unsigned char *aset, int ac, int af)
+cclass(unsigned char *aset, int ac, int af)
 {
        register unsigned int n;
-       register unsigned char   c, *set;
+       register unsigned char c, *set;
 
        set = aset;
        if ((c = ac) == 0)
@@ -845,53 +846,53 @@ cclass (unsigned char *aset, int ac, int af)
 
 
 static int
-tcompile (char *ap, struct tws *tb, int isafter)
+tcompile(char *ap, struct tws *tb, int isafter)
 {
        register struct tws *tw;
 
-       if ((tw = tws_parse (ap, isafter)) == NULL)
+       if ((tw = tws_parse(ap, isafter)) == NULL)
                return 0;
 
-       twscopy (tb, tw);
+       twscopy(tb, tw);
        return 1;
 }
 
 
 static struct tws *
-tws_parse (char *ap, int isafter)
+tws_parse(char *ap, int isafter)
 {
        char buffer[BUFSIZ];
        register struct tws *tw, *ts;
 
-       if ((tw = tws_special (ap)) != NULL) {
+       if ((tw = tws_special(ap)) != NULL) {
                tw->tw_sec = tw->tw_min = isafter ? 59 : 0;
                tw->tw_hour = isafter ? 23 : 0;
                return tw;
        }
-       if ((tw = dparsetime (ap)) != NULL)
+       if ((tw = dparsetime(ap)) != NULL)
                return tw;
 
-       if ((ts = dlocaltimenow ()) == NULL)
+       if ((ts = dlocaltimenow()) == NULL)
                return NULL;
 
-       snprintf (buffer, sizeof(buffer), "%s %s", ap, dtwszone (ts));
-       if ((tw = dparsetime (buffer)) != NULL)
+       snprintf(buffer, sizeof(buffer), "%s %s", ap, dtwszone(ts));
+       if ((tw = dparsetime(buffer)) != NULL)
                return tw;
 
-       snprintf (buffer, sizeof(buffer), "%s %02d:%02d:%02d %s", ap,
-                       ts->tw_hour, ts->tw_min, ts->tw_sec, dtwszone (ts));
-       if ((tw = dparsetime (buffer)) != NULL)
+       snprintf(buffer, sizeof(buffer), "%s %02d:%02d:%02d %s", ap,
+                       ts->tw_hour, ts->tw_min, ts->tw_sec, dtwszone(ts));
+       if ((tw = dparsetime(buffer)) != NULL)
                return tw;
 
-       snprintf (buffer, sizeof(buffer), "%02d %s %04d %s",
+       snprintf(buffer, sizeof(buffer), "%02d %s %04d %s",
                        ts->tw_mday, tw_moty[ts->tw_mon], ts->tw_year, ap);
-       if ((tw = dparsetime (buffer)) != NULL)
+       if ((tw = dparsetime(buffer)) != NULL)
                return tw;
 
-       snprintf (buffer, sizeof(buffer), "%02d %s %04d %s %s",
+       snprintf(buffer, sizeof(buffer), "%02d %s %04d %s %s",
                        ts->tw_mday, tw_moty[ts->tw_mon], ts->tw_year,
-                       ap, dtwszone (ts));
-       if ((tw = dparsetime (buffer)) != NULL)
+                       ap, dtwszone(ts));
+       if ((tw = dparsetime(buffer)) != NULL)
                return tw;
 
        return NULL;
@@ -899,29 +900,29 @@ tws_parse (char *ap, int isafter)
 
 
 static struct tws *
-tws_special (char *ap)
+tws_special(char *ap)
 {
        int i;
        time_t clock;
        register struct tws *tw;
 
-       time (&clock);
-       if (!mh_strcasecmp (ap, "today"))
-               return dlocaltime (&clock);
-       if (!mh_strcasecmp (ap, "yesterday")) {
+       time(&clock);
+       if (!mh_strcasecmp(ap, "today"))
+               return dlocaltime(&clock);
+       if (!mh_strcasecmp(ap, "yesterday")) {
                clock -= (long) (60 * 60 * 24);
-               return dlocaltime (&clock);
+               return dlocaltime(&clock);
        }
-       if (!mh_strcasecmp (ap, "tomorrow")) {
+       if (!mh_strcasecmp(ap, "tomorrow")) {
                clock += (long) (60 * 60 * 24);
-               return dlocaltime (&clock);
+               return dlocaltime(&clock);
        }
 
        for (i = 0; tw_ldotw[i]; i++)
-               if (!mh_strcasecmp (ap, tw_ldotw[i]))
+               if (!mh_strcasecmp(ap, tw_ldotw[i]))
                        break;
        if (tw_ldotw[i]) {
-               if ((tw = dlocaltime (&clock)) == NULL)
+               if ((tw = dlocaltime(&clock)) == NULL)
                        return NULL;
                if ((i -= tw->tw_wday) > 0)
                        i -= 7;
@@ -930,15 +931,15 @@ tws_special (char *ap)
                if (*ap != '-')
                        return NULL;
                else  /* -ddd days ago */
-                       i = atoi (ap);  /* we should error check this */
+                       i = atoi(ap);  /* we should error check this */
 
        clock += (long) ((60 * 60 * 24) * i);
-       return dlocaltime (&clock);
+       return dlocaltime(&clock);
 }
 
 
 static int
-TWSaction (params)
+TWSaction(params)
 plist
 {
        int state;
@@ -946,21 +947,21 @@ plist
        char buf[BUFSIZ], name[NAMESZ];
        register struct tws *tw;
 
-       fseek (fp, start, SEEK_SET);
+       fseek(fp, start, SEEK_SET);
        for (state = FLD, bp = NULL;;) {
-               switch (state = m_getfld (state, name, buf, sizeof buf, fp)) {
+               switch (state = m_getfld(state, name, buf, sizeof buf, fp)) {
                        case FLD:
                        case FLDEOF:
                        case FLDPLUS:
                                if (bp != NULL)
-                                       free (bp), bp = NULL;
-                               bp = add (buf, NULL);
+                                       free(bp), bp = NULL;
+                               bp = add(buf, NULL);
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, name, buf,
+                                       state = m_getfld(state, name, buf,
                                                        sizeof buf, fp);
-                                       bp = add (buf, bp);
+                                       bp = add(buf, bp);
                                }
-                               if (!mh_strcasecmp (name, n->n_datef))
+                               if (!mh_strcasecmp(name, n->n_datef))
                                        break;
                                if (state != FLDEOF)
                                        continue;
@@ -971,25 +972,25 @@ plist
                        case LENERR:
                        case FMTERR:
                                if (state == LENERR || state == FMTERR)
-                                       advise (NULL, "format error in message %d", msgnum);
+                                       advise(NULL, "format error in message %d", msgnum);
                                if (bp != NULL)
-                                       free (bp);
+                                       free(bp);
                                return 0;
 
                        default:
-                               adios (NULL, "internal error -- you lose");
+                               adios(NULL, "internal error -- you lose");
                }
                break;
        }
 
-       if ((tw = dparsetime (bp)) == NULL)
-               advise (NULL, "unable to parse %s field in message %d, matching...",
+       if ((tw = dparsetime(bp)) == NULL)
+               advise(NULL, "unable to parse %s field in message %d, matching...",
                                n->n_datef, msgnum), state = 1;
        else
-               state = n->n_after ? (twsort (tw, &n->n_tws) > 0)
-                       : (twsort (tw, &n->n_tws) < 0);
+               state = n->n_after ? (twsort(tw, &n->n_tws) > 0)
+                       : (twsort(tw, &n->n_tws) < 0);
 
        if (bp != NULL)
-               free (bp);
+               free(bp);
        return state;
 }
index 88a56df..a75c563 100644 (file)
@@ -89,14 +89,14 @@ static jmp_buf sigenv;
 /*
 ** prototypes
 */
-int getln (char *, int);
-static int chrcnv (char *);
-static void chrdsp (char *, char);
-static RETSIGTYPE intrser (int);
+int getln(char *, int);
+static int chrcnv(char *);
+static void chrdsp(char *, char);
+static RETSIGTYPE intrser(int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int body = 1, prepend = 1, rapid = 0;
        int doteof = 0, fdi, fdo, i, state;
@@ -110,40 +110,40 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++))
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buffer, sizeof(buffer),
+                                       snprintf(buffer, sizeof(buffer),
                                                        "%s [switches] file",
                                                        invo_name);
-                                       print_help (buffer, switches, 1);
-                                       done (1);
+                                       print_help(buffer, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case ERASESW:
                                        if (!(erasep = *argp++) || *erasep == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case KILLSW:
                                        if (!(killp = *argp++) || *killp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case PREPSW:
@@ -179,15 +179,15 @@ main (int argc, char **argv)
                }
 
        if (!drft)
-               adios (NULL, "usage: %s [switches] file", invo_name);
-       if ((in = fopen (drft, "r")) == NULL)
-               adios (drft, "unable to open");
+               adios(NULL, "usage: %s [switches] file", invo_name);
+       if ((in = fopen(drft, "r")) == NULL)
+               adios(drft, "unable to open");
 
        tfile = m_mktemp2(NULL, invo_name, NULL, &out);
        if (tfile == NULL)
                adios("prompter", "unable to create temporary file");
-       chmod (tmpfil, 0600);
-       strncpy (tmpfil, tfile, sizeof(tmpfil));
+       chmod(tmpfil, 0600);
+       strncpy(tmpfil, tfile, sizeof(tmpfil));
 
        /*
        ** Are we changing the kill or erase character?
@@ -206,8 +206,8 @@ main (int argc, char **argv)
 # ifdef HAVE_TERMIO_H
                ioctl(0, TCGETA, &tio);
 # else
-               ioctl (0, TIOCGETP, (char *) &tio);
-               ioctl (0, TIOCGETC, (char *) &tc);
+               ioctl(0, TIOCGETP, (char *) &tio);
+               ioctl(0, TIOCGETC, (char *) &tc);
 # endif
 #endif
 
@@ -216,8 +216,8 @@ main (int argc, char **argv)
                save_erase = ERASE;
 
                /* set new kill, erase character in terminal structure */
-               KILL = killp ? chrcnv (killp) : save_kill;
-               ERASE = erasep ? chrcnv (erasep) : save_erase;
+               KILL = killp ? chrcnv(killp) : save_kill;
+               ERASE = erasep ? chrcnv(erasep) : save_erase;
 
                /* set the new terminal attributes */
 #ifdef HAVE_TERMIOS_H
@@ -226,16 +226,16 @@ main (int argc, char **argv)
 # ifdef HAVE_TERMIO_H
                ioctl(0, TCSETAW, &tio);
 # else
-               ioctl (0, TIOCSETN, (char *) &tio);
+               ioctl(0, TIOCSETN, (char *) &tio);
 # endif
 #endif
 
                /* print out new kill erase characters */
-               chrdsp ("erase", ERASE);
-               chrdsp (", kill", KILL);
-               chrdsp (", intr", INTR);
-               putchar ('\n');
-               fflush (stdout);
+               chrdsp("erase", ERASE);
+               chrdsp(", kill", KILL);
+               chrdsp(", intr", INTR);
+               putchar('\n');
+               fflush(stdout);
 
                /*
                ** We set the kill and erase character back to original
@@ -247,13 +247,14 @@ main (int argc, char **argv)
        }
 
        sigint = 0;
-       SIGNAL2 (SIGINT, intrser);
+       SIGNAL2(SIGINT, intrser);
 
        /*
        ** Loop through the lines of the draft skeleton.
        */
        for (state = FLD;;) {
-               switch (state = m_getfld (state, name, field, sizeof(field), in)) {
+               switch (state = m_getfld(state, name, field, sizeof(field),
+                               in)) {
                        case FLD:
                        case FLDEOF:
                        case FLDPLUS:
@@ -267,19 +268,18 @@ main (int argc, char **argv)
 
                                /* If so, just add header line to draft */
                                if (*cp++ != '\n' || *cp != 0) {
-                                       printf ("%s:%s", name, field);
-                                       fprintf (out, "%s:%s", name, field);
+                                       printf("%s:%s", name, field);
+                                       fprintf(out, "%s:%s", name, field);
                                        while (state == FLDPLUS) {
-                                               state =
-                                                       m_getfld (state, name, field, sizeof(field), in);
-                                               printf ("%s", field);
-                                               fprintf (out, "%s", field);
+                                               state = m_getfld(state, name, field, sizeof(field), in);
+                                               printf("%s", field);
+                                               fprintf(out, "%s", field);
                                        }
                                } else {
                                        /* Else, get value of header field */
-                                       printf ("%s: ", name);
-                                       fflush (stdout);
-                                       i = getln (field, sizeof(field));
+                                       printf("%s: ", name);
+                                       fflush(stdout);
+                                       i = getln(field, sizeof(field));
                                        if (i == -1) {
 abort:
                                                if (killp || erasep) {
@@ -287,31 +287,30 @@ abort:
                                                        tcsetattr(0, TCSADRAIN, &tio);
 #else
 # ifdef HAVE_TERMIO
-                                                       ioctl (0, TCSETA, &tio);
+                                                       ioctl(0, TCSETA, &tio);
 # else
-                                                       ioctl (0, TIOCSETN, (char *) &tio);
+                                                       ioctl(0, TIOCSETN, (char *) &tio);
 # endif
 #endif
                                                }
-                                               unlink (tmpfil);
-                                               done (1);
+                                               unlink(tmpfil);
+                                               done(1);
                                        }
                                        if (i != 0 || (field[0] != '\n' && field[0] != 0)) {
-                                               fprintf (out, "%s:", name);
+                                               fprintf(out, "%s:", name);
                                                do {
                                                        if (field[0] != ' ' && field[0] != '\t')
-                                                               putc (' ', out);
-                                                       fprintf (out, "%s", field);
-                                               } while (i == 1
-                                                                       && (i = getln (field, sizeof(field))) >= 0);
+                                                               putc(' ', out);
+                                                       fprintf(out, "%s", field);
+                                               } while (i == 1 && (i = getln(field, sizeof(field))) >= 0);
                                                if (i == -1)
                                                        goto abort;
                                        }
                                }
 
                                if (state == FLDEOF) {  /* moby hack */
-                                       fprintf (out, "--------\n");
-                                       printf ("--------\n");
+                                       fprintf(out, "--------\n");
+                                       printf("--------\n");
                                        if (!body)
                                                break;
                                        goto no_body;
@@ -323,89 +322,89 @@ abort:
                        case FILEEOF:
                                if (!body)
                                        break;
-                               fprintf (out, "--------\n");
+                               fprintf(out, "--------\n");
                                if (field[0] == 0 || !prepend)
-                                       printf ("--------\n");
+                                       printf("--------\n");
                                if (field[0]) {
                                        if (prepend && body) {
-                                               printf ("\n--------Enter initial text\n\n");
-                                               fflush (stdout);
+                                               printf("\n--------Enter initial text\n\n");
+                                               fflush(stdout);
                                                for (;;) {
-                                                       getln (buffer, sizeof(buffer));
+                                                       getln(buffer, sizeof(buffer));
                                                        if (doteof && buffer[0] == '.' && buffer[1] == '\n')
                                                                break;
                                                        if (buffer[0] == 0)
                                                                break;
-                                                       fprintf (out, "%s", buffer);
+                                                       fprintf(out, "%s", buffer);
                                                }
                                        }
 
                                        do {
-                                               fprintf (out, "%s", field);
+                                               fprintf(out, "%s", field);
                                                if (!rapid && !sigint)
-                                                       printf ("%s", field);
+                                                       printf("%s", field);
                                        } while (state == BODY &&
-                                                       (state = m_getfld (state, name, field, sizeof(field), in)));
+                                                       (state = m_getfld(state, name, field, sizeof(field), in)));
                                        if (prepend || !body)
                                                break;
                                        else
                                                printf ("\n--------Enter additional text\n\n");
                                }
 no_body:
-                               fflush (stdout);
+                               fflush(stdout);
                                for (;;) {
-                                       getln (field, sizeof(field));
+                                       getln(field, sizeof(field));
                                        if (doteof && field[0] == '.' && field[1] == '\n')
                                                break;
                                        if (field[0] == 0)
                                                break;
-                                        fprintf (out, "%s", field);
+                                        fprintf(out, "%s", field);
                                }
                                break;
 
                        default:
-                               adios (NULL, "skeleton is poorly formatted");
+                               adios(NULL, "skeleton is poorly formatted");
                }
                break;
        }
 
        if (body)
-               printf ("--------\n");
+               printf("--------\n");
 
-       fflush (stdout);
-       fclose (in);
-       fclose (out);
-       SIGNAL (SIGINT, SIG_IGN);
+       fflush(stdout);
+       fclose(in);
+       fclose(out);
+       SIGNAL(SIGINT, SIG_IGN);
 
        if (killp || erasep) {
 #ifdef HAVE_TERMIOS_H
                 tcsetattr(0, TCSADRAIN, &tio);
 #else
 # ifdef HAVE_TERMIO_H
-               ioctl (0, TCSETAW, &tio);
+               ioctl(0, TCSETAW, &tio);
 # else
-               ioctl (0, TIOCSETN, (char *) &tio);
+               ioctl(0, TIOCSETN, (char *) &tio);
 # endif
 #endif
        }
 
-       if ((fdi = open (tmpfil, O_RDONLY)) == NOTOK)
-               adios (tmpfil, "unable to re-open");
-       if ((fdo = creat (drft, m_gmprot ())) == NOTOK)
-               adios (drft, "unable to write");
-       cpydata (fdi, fdo, tmpfil, drft);
-       close (fdi);
-       close (fdo);
-       unlink (tmpfil);
-
-       context_save ();  /* save the context file */
-       done (0);
+       if ((fdi = open(tmpfil, O_RDONLY)) == NOTOK)
+               adios(tmpfil, "unable to re-open");
+       if ((fdo = creat(drft, m_gmprot())) == NOTOK)
+               adios(drft, "unable to write");
+       cpydata(fdi, fdo, tmpfil, drft);
+       close(fdi);
+       close(fdo);
+       unlink(tmpfil);
+
+       context_save();  /* save the context file */
+       done(0);
        return 1;
 }
 
 
 int
-getln (char *buffer, int n)
+getln(char *buffer, int n)
 {
        int c;
        char *cp;
@@ -413,7 +412,7 @@ getln (char *buffer, int n)
        cp = buffer;
        *cp = 0;
 
-       switch (setjmp (sigenv)) {
+       switch (setjmp(sigenv)) {
                case OK:
                        wtuser = 1;
                        break;
@@ -428,10 +427,10 @@ getln (char *buffer, int n)
        }
 
        for (;;) {
-               switch (c = getchar ()) {
+               switch (c = getchar()) {
                        case EOF:
-                               clearerr (stdin);
-                               longjmp (sigenv, DONE);
+                               clearerr(stdin);
+                               longjmp(sigenv, DONE);
 
                        case '\n':
                                if (cp[-1] == QUOTE) {
@@ -454,31 +453,31 @@ getln (char *buffer, int n)
 
 
 static RETSIGTYPE
-intrser (int i)
+intrser(int i)
 {
 #ifndef RELIABLE_SIGNALS
-       SIGNAL (SIGINT, intrser);
+       SIGNAL(SIGINT, intrser);
 #endif
 
        if (wtuser)
-               longjmp (sigenv, NOTOK);
+               longjmp(sigenv, NOTOK);
        sigint++;
 }
 
 
 static int
-chrcnv (char *cp)
+chrcnv(char *cp)
 {
-       return (*cp != QUOTE ? *cp : m_atoi (++cp));
+       return (*cp != QUOTE ? *cp : m_atoi(++cp));
 }
 
 
 static void
-chrdsp (char *s, char c)
+chrdsp(char *s, char c)
 {
-       printf ("%s ", s);
+       printf("%s ", s);
        if (c < ' ' || c == 0177)
-               printf ("^%c", c ^ 0100);
+               printf("^%c", c ^ 0100);
        else
-               printf ("%c", c);
+               printf("%c", c);
 }
index 53d7455..62ae2a8 100644 (file)
@@ -30,12 +30,12 @@ static char tmpfil[BUFSIZ] = "";
 /*
 ** prototypes
 */
-static void rcvdistout (FILE *, char *, char *);
-static void unlink_done (int) NORETURN;
+static void rcvdistout(FILE *, char *, char *);
+static void unlink_done(int) NORETURN;
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        pid_t child_id;
        int i, vecp = 1;
@@ -49,82 +49,82 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       mts_init (invo_name);
-       arguments = getarguments (invo_name, argc, argv, 1);
+       mts_init(invo_name);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
                                        vec[vecp++] = --cp;
                                        continue;
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [switches] [switches for postproc] address ...", invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [switches] [switches for postproc] address ...", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case FORMSW:
                                        if (!(form = *argp++) || *form == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                        }
                }
-               addrs = addrs ? add (cp, add (", ", addrs)) : getcpy (cp);
+               addrs = addrs ? add(cp, add(", ", addrs)) : getcpy(cp);
        }
 
        if (addrs == NULL)
-               adios (NULL, "usage: %s [switches] [switches for postproc] address ...", invo_name);
+               adios(NULL, "usage: %s [switches] [switches for postproc] address ...", invo_name);
 
-       umask (~m_gmprot ());
+       umask(~m_gmprot());
 
        tfile = m_mktemp2(NULL, invo_name, NULL, &fp);
        if (tfile == NULL) adios("rcvdist", "unable to create temporary file");
-       strncpy (tmpfil, tfile, sizeof(tmpfil));
+       strncpy(tmpfil, tfile, sizeof(tmpfil));
 
-       cpydata (fileno (stdin), fileno (fp), "message", tmpfil);
-       fseek (fp, 0L, SEEK_SET);
+       cpydata(fileno(stdin), fileno(fp), "message", tmpfil);
+       fseek(fp, 0L, SEEK_SET);
 
        tfile = m_mktemp2(NULL, invo_name, NULL, NULL);
        if (tfile == NULL) adios("forw", "unable to create temporary file");
-       strncpy (drft, tfile, sizeof(tmpfil));
+       strncpy(drft, tfile, sizeof(tmpfil));
 
-       rcvdistout (fp, form, addrs);
-       fclose (fp);
+       rcvdistout(fp, form, addrs);
+       fclose(fp);
 
-       if (distout (drft, tmpfil, backup) == NOTOK)
-               done (1);
+       if (distout(drft, tmpfil, backup) == NOTOK)
+               done(1);
 
-       vec[0] = r1bindex (postproc, '/');
+       vec[0] = r1bindex(postproc, '/');
        vec[vecp++] = "-dist";
        vec[vecp++] = drft;
        vec[vecp] = NULL;
 
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
-               sleep (5);
+               sleep(5);
        switch (child_id) {
                case NOTOK:
-                       admonish (NULL, "unable to fork");/* fall */
+                       admonish(NULL, "unable to fork");/* fall */
                case OK:
-                       execvp (postproc, vec);
-                       fprintf (stderr, "unable to exec ");
-                       perror (postproc);
-                       _exit (1);
+                       execvp(postproc, vec);
+                       fprintf(stderr, "unable to exec ");
+                       perror(postproc);
+                       _exit(1);
 
                default:
-                       done (pidXwait(child_id, postproc));
+                       done(pidXwait(child_id, postproc));
        }
 
        return 0;  /* dead code to satisfy the compiler */
@@ -162,7 +162,7 @@ static char *addrcomps[] = {
 
 
 static void
-rcvdistout (FILE *inb, char *form, char *addrs)
+rcvdistout(FILE *inb, char *form, char *addrs)
 {
        register int char_read = 0, format_len, i, state;
        register char *tmpbuf, **nxtbuf, **ap;
@@ -170,65 +170,64 @@ rcvdistout (FILE *inb, char *form, char *addrs)
        register struct comp *cptr, **savecomp;
        FILE *out;
 
-       if (!(out = fopen (drft, "w")))
-               adios (drft, "unable to create");
+       if (!(out = fopen(drft, "w")))
+               adios(drft, "unable to create");
 
        /* get new format string */
-       cp = new_fs (form ? form : rcvdistcomps, NULL, NULL);
-       format_len = strlen (cp);
-       ncomps = fmt_compile (cp, &fmt) + 1;
+       cp = new_fs(form ? form : rcvdistcomps, NULL, NULL);
+       format_len = strlen(cp);
+       ncomps = fmt_compile(cp, &fmt) + 1;
        if (!(nxtbuf = compbuffers =
-                       (char **) calloc ((size_t) ncomps, sizeof(char *))))
-               adios (NULL, "unable to allocate component buffers");
+                       (char **) calloc((size_t) ncomps, sizeof(char *))))
+               adios(NULL, "unable to allocate component buffers");
        if (!(savecomp = used_buf =
-                       (struct comp **) calloc ((size_t) (ncomps + 1),
+                       (struct comp **) calloc((size_t) (ncomps + 1),
                        sizeof(struct comp *))))
-               adios (NULL, "unable to allocate component buffer stack");
+               adios(NULL, "unable to allocate component buffer stack");
        savecomp += ncomps + 1;
        *--savecomp = 0;
 
        for (i = ncomps; i--;)
-               *nxtbuf++ = mh_xmalloc (SBUFSIZ);
+               *nxtbuf++ = mh_xmalloc(SBUFSIZ);
        nxtbuf = compbuffers;
        tmpbuf = *nxtbuf++;
 
        for (ap = addrcomps; *ap; ap++) {
-               FINDCOMP (cptr, *ap);
+               FINDCOMP(cptr, *ap);
                if (cptr)
                        cptr->c_type |= CT_ADDR;
        }
 
-       FINDCOMP (cptr, "addresses");
+       FINDCOMP(cptr, "addresses");
        if (cptr)
                cptr->c_text = addrs;
 
        for (state = FLD;;) {
-               switch (state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb)) {
+               switch (state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb)) {
                        case FLD:
                        case FLDPLUS:
-                               if ((cptr = wantcomp[CHASH (name)]))
+                               if ((cptr = wantcomp[CHASH(name)]))
                                        do {
-                                               if (!mh_strcasecmp (name, cptr->c_name)) {
+                                               if (!mh_strcasecmp(name, cptr->c_name)) {
                                                        char_read += msg_count;
                                                        if (!cptr->c_text) {
                                                                cptr->c_text = tmpbuf;
                                                                *--savecomp = cptr;
                                                                tmpbuf = *nxtbuf++;
                                                        } else {
-                                                               i = strlen (cp = cptr->c_text) - 1;
+                                                               i = strlen(cp = cptr->c_text) - 1;
                                                                if (cp[i] == '\n') {
                                                                        if (cptr->c_type & CT_ADDR) {
                                                                                cp[i] = 0;
-                                                                               cp = add (",\n\t", cp);
+                                                                               cp = add(",\n\t", cp);
                                                                        } else
-                                                                               cp = add ("\t", cp);
+                                                                               cp = add("\t", cp);
                                                                }
-                                                               cptr->c_text = add (tmpbuf, cp);
+                                                               cptr->c_text = add(tmpbuf, cp);
                                                        }
                                                        while (state == FLDPLUS) {
-                                                               state = m_getfld (state, name, tmpbuf,
-                                                                                                 SBUFSIZ, inb);
-                                                               cptr->c_text = add (tmpbuf, cptr->c_text);
+                                                               state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb);
+                                                               cptr->c_text = add(tmpbuf, cptr->c_text);
                                                                char_read += msg_count;
                                                        }
                                                        break;
@@ -236,7 +235,7 @@ rcvdistout (FILE *inb, char *form, char *addrs)
                                        } while ((cptr = cptr->c_next));
 
                                while (state == FLDPLUS)
-                                       state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb);
+                                       state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb);
                                break;
 
                        case LENERR:
@@ -246,42 +245,42 @@ rcvdistout (FILE *inb, char *form, char *addrs)
                                goto finished;
 
                        default:
-                               adios (NULL, "m_getfld() returned %d", state);
+                               adios(NULL, "m_getfld() returned %d", state);
                }
        }
 finished: ;
 
        i = format_len + char_read + 256;
-       scanl = mh_xmalloc ((size_t) i + 2);
+       scanl = mh_xmalloc((size_t) i + 2);
        dat[0] = dat[1] = dat[2] = dat[4] = 0;
        dat[3] = outputlinelen;
-       fmt_scan (fmt, scanl, i, dat);
-       fputs (scanl, out);
+       fmt_scan(fmt, scanl, i, dat);
+       fputs(scanl, out);
 
-       if (ferror (out))
-               adios (drft, "error writing");
-       fclose (out);
+       if (ferror(out))
+               adios(drft, "error writing");
+       fclose(out);
 
-       free (scanl);
+       free(scanl);
        for (nxtbuf = compbuffers, i = ncomps; (cptr = *savecomp++);
                        nxtbuf++, i--)
-               free (cptr->c_text);
+               free(cptr->c_text);
        while (i-- > 0)
-               free (*nxtbuf++);
-       free ((char *) compbuffers);
-       free ((char *) used_buf);
+               free(*nxtbuf++);
+       free((char *) compbuffers);
+       free((char *) used_buf);
 }
 
 
 static void
-unlink_done (int status)
+unlink_done(int status)
 {
        if (backup[0])
-               unlink (backup);
+               unlink(backup);
        if (drft[0])
-               unlink (drft);
+               unlink(drft);
        if (tmpfil[0])
-               unlink (tmpfil);
+               unlink(tmpfil);
 
-       exit (status ? RCV_MBX : RCV_MOK);
+       exit(status ? RCV_MBX : RCV_MOK);
 }
index a89d1fe..e8934ca 100644 (file)
@@ -31,7 +31,7 @@ static int mbx_style = MBOX_FORMAT;
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int md;
        char *cp, *file = NULL, buf[BUFSIZ];
@@ -40,34 +40,34 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       mts_init (invo_name);
-       arguments = getarguments (invo_name, argc, argv, 1);
+       mts_init(invo_name);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /* parse arguments */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf),
+                                       snprintf(buf, sizeof(buf),
                                                        "%s [switches] file",
                                                        invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case MBOXSW:
                                        mbx_style = MBOX_FORMAT;
@@ -78,32 +78,32 @@ main (int argc, char **argv)
                        }
                }
                if (file)
-                       adios (NULL, "only one file at a time!");
+                       adios(NULL, "only one file at a time!");
                else
                        file = cp;
        }
 
        if (!file)
-               adios (NULL, "%s [switches] file", invo_name);
+               adios(NULL, "%s [switches] file", invo_name);
 
-       rewind (stdin);
+       rewind(stdin);
 
        /* open and lock the file */
-       if ((md = mbx_open (file, mbx_style, getuid(), getgid(), m_gmprot()))
+       if ((md = mbx_open(file, mbx_style, getuid(), getgid(), m_gmprot()))
                        == NOTOK)
-               done (RCV_MBX);
+               done(RCV_MBX);
 
        /* append the message */
-       if (mbx_copy (file, mbx_style, md, fileno(stdin), 1, NULL, 0)
+       if (mbx_copy(file, mbx_style, md, fileno(stdin), 1, NULL, 0)
                        == NOTOK) {
-               mbx_close (file, md);
-               done (RCV_MBX);
+               mbx_close(file, md);
+               done(RCV_MBX);
        }
 
        /* close and unlock the file */
-       if (mbx_close (file, md) == NOTOK)
-               done (RCV_MBX);
+       if (mbx_close(file, md) == NOTOK)
+               done(RCV_MBX);
 
-       done (RCV_MOK);
+       done(RCV_MOK);
        return 1;
 }
index 40adf86..868ed47 100644 (file)
@@ -48,7 +48,7 @@ static char *tmpfilenam = NULL;
 static void unlink_done(int) NORETURN;
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int publicsw = -1, zerosw = 0;
        int create = 1, unseensw = 1;
@@ -63,42 +63,42 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       mts_init (invo_name);
-       arguments = getarguments (invo_name, argc, argv, 1);
+       mts_init(invo_name);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /* parse arguments */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf),
-                                       "%s [+folder] [switches]",
-                                       invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               snprintf(buf, sizeof(buf),
+                                               "%s [+folder] [switches]",
+                                               invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case SEQSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument name to %s", argp[-2]);
+                                       adios(NULL, "missing argument name to %s", argp[-2]);
 
                                /* check if too many sequences specified */
                                if (seqp >= NUMATTRS)
-                                       adios (NULL, "too many sequences (more than %d) specified", NUMATTRS);
+                                       adios(NULL, "too many sequences (more than %d) specified", NUMATTRS);
                                seqs[seqp++] = cp;
                                continue;
 
@@ -133,100 +133,100 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else {
-                       adios (NULL, "usage: %s [+folder] [switches]",
+                       adios(NULL, "usage: %s [+folder] [switches]",
                                        invo_name);
                }
        }
 
        seqs[seqp] = NULL;  /* NULL terminate list of sequences */
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        /* if no folder is given, use default folder */
        if (!folder)
-               folder = getfolder (0);
-       maildir = m_maildir (folder);
+               folder = getfolder(0);
+       maildir = m_maildir(folder);
 
        /* check if folder exists */
-       if (stat (maildir, &st) == NOTOK) {
+       if (stat(maildir, &st) == NOTOK) {
                if (errno != ENOENT)
-                       adios (maildir, "error on folder");
+                       adios(maildir, "error on folder");
                if (!create)
-                       adios (NULL, "folder %s doesn't exist", maildir);
-               if (!makedir (maildir))
-                       adios (NULL, "unable to create folder %s", maildir);
+                       adios(NULL, "folder %s doesn't exist", maildir);
+               if (!makedir(maildir))
+                       adios(NULL, "unable to create folder %s", maildir);
        }
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* ignore a few signals */
-       SIGNAL (SIGHUP, SIG_IGN);
-       SIGNAL (SIGINT, SIG_IGN);
-       SIGNAL (SIGQUIT, SIG_IGN);
-       SIGNAL (SIGTERM, SIG_IGN);
+       SIGNAL(SIGHUP, SIG_IGN);
+       SIGNAL(SIGINT, SIG_IGN);
+       SIGNAL(SIGQUIT, SIG_IGN);
+       SIGNAL(SIGTERM, SIG_IGN);
 
        /* create a temporary file */
-       tmpfilenam = m_mktemp (invo_name, &fd, NULL);
+       tmpfilenam = m_mktemp(invo_name, &fd, NULL);
        if (tmpfilenam == NULL) {
-               adios ("rcvstore", "unable to create temporary file");
+               adios("rcvstore", "unable to create temporary file");
        }
-       chmod (tmpfilenam, m_gmprot());
+       chmod(tmpfilenam, m_gmprot());
 
        /* copy the message from stdin into temp file */
-       cpydata (fileno (stdin), fd, "standard input", tmpfilenam);
+       cpydata(fileno(stdin), fd, "standard input", tmpfilenam);
 
-       if (fstat (fd, &st) == NOTOK) {
-               unlink (tmpfilenam);
-               adios (tmpfilenam, "unable to fstat");
+       if (fstat(fd, &st) == NOTOK) {
+               unlink(tmpfilenam);
+               adios(tmpfilenam, "unable to fstat");
        }
-       if (close (fd) == NOTOK)
-               adios (tmpfilenam, "error closing");
+       if (close(fd) == NOTOK)
+               adios(tmpfilenam, "error closing");
 
        /* don't add file if it is empty */
        if (st.st_size == 0) {
-               unlink (tmpfilenam);
-               advise (NULL, "empty file");
-               done (0);
+               unlink(tmpfilenam);
+               advise(NULL, "empty file");
+               done(0);
        }
 
        /*
        ** read folder and create message structure
        */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /*
        ** Link message into folder, and possibly add
        ** to the Unseen-Sequence's.
        */
-       if ((msgnum = folder_addmsg (&mp, tmpfilenam, 0, unseensw, 0, 0,
+       if ((msgnum = folder_addmsg(&mp, tmpfilenam, 0, unseensw, 0, 0,
                        (char *)0)) == -1)
-               done (1);
+               done(1);
 
        /*
        ** Add the message to any extra sequences
        ** that have been specified.
        */
        for (seqp = 0; seqs[seqp]; seqp++) {
-               if (!seq_addmsg (mp, seqs[seqp], msgnum, publicsw, zerosw))
-                       done (1);
+               if (!seq_addmsg(mp, seqs[seqp], msgnum, publicsw, zerosw))
+                       done(1);
        }
 
-       seq_setunseen (mp, 0);  /* synchronize any Unseen-Sequence's */
-       seq_save (mp);  /* synchronize and save message sequences */
-       folder_free (mp);  /* free folder/message structure */
+       seq_setunseen(mp, 0);  /* synchronize any Unseen-Sequence's */
+       seq_save(mp);  /* synchronize and save message sequences */
+       folder_free(mp);  /* free folder/message structure */
 
-       context_save ();  /* save the global context file */
-       unlink (tmpfilenam);  /* remove temporary file */
+       context_save();  /* save the global context file */
+       unlink(tmpfilenam);  /* remove temporary file */
        tmpfilenam = NULL;
 
-       done (0);
+       done(0);
        return 1;
 }
 
@@ -237,6 +237,6 @@ static void
 unlink_done(int status)
 {
        if (tmpfilenam && *tmpfilenam)
-               unlink (tmpfilenam);
-       exit (status);
+               unlink(tmpfilenam);
+       exit(status);
 }
index b3c1d52..1e2a3ef 100644 (file)
@@ -77,14 +77,14 @@ char *getusername(void);
 /*
 ** static prototypes
 */
-static RETSIGTYPE alrmser (int);
-static int message_fd (char **);
-static int header_fd (void);
-static void alert (char *, int);
+static RETSIGTYPE alrmser(int);
+static int message_fd(char **);
+static int header_fd(void);
+static void alert(char *, int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int md, vecp = 0;
        char *cp, *user, buf[BUFSIZ], tty[BUFSIZ];
@@ -99,34 +99,34 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       mts_init (invo_name);
-       arguments = getarguments (invo_name, argc, argv, 1);
+       mts_init(invo_name);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
                                        vec[vecp++] = --cp;
                                        continue;
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf),
+                                       snprintf(buf, sizeof(buf),
                                                        "%s [command ...]",
                                                        invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case BIFFSW:
                                        biff = 1;
@@ -134,12 +134,12 @@ main (int argc, char **argv)
 
                                case FORMSW:
                                        if (!(form = *argp++) || *form == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        format = NULL;
                                        continue;
                                case FMTSW:
                                        if (!(format = *argp++) || *format == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        form = NULL;
                                        continue;
 
@@ -167,8 +167,8 @@ main (int argc, char **argv)
        }
        vec[vecp] = 0;
 
-       if ((md = vecp ? message_fd (vec) : header_fd ()) == NOTOK)
-               exit (RCV_MBX);
+       if ((md = vecp ? message_fd(vec) : header_fd()) == NOTOK)
+               exit(RCV_MBX);
 
        user = getusername();
 
@@ -180,44 +180,44 @@ main (int argc, char **argv)
                                utp->ut_type == USER_PROCESS &&
 #endif
                                utp->ut_name[0] != 0 && utp->ut_line[0] != 0
-                               && strncmp (user, utp->ut_name,
+                               && strncmp(user, utp->ut_name,
                                sizeof(utp->ut_name)) == 0) {
-                       strncpy (tty, utp->ut_line, sizeof(utp->ut_line));
-                       alert (tty, md);
+                       strncpy(tty, utp->ut_line, sizeof(utp->ut_line));
+                       alert(tty, md);
                }
        }
        endutent();
 #else
-       if ((uf = fopen (UTMP_FILE, "r")) == NULL)
-               exit (RCV_MBX);
-       while (fread ((char *) &ut, sizeof(ut), 1, uf) == 1)
-               if (ut.ut_name[0] != 0
-                               && strncmp (user, ut.ut_name,
-                               sizeof(ut.ut_name)) == 0) {
-                       strncpy (tty, ut.ut_line, sizeof(ut.ut_line));
-                       alert (tty, md);
+       if ((uf = fopen(UTMP_FILE, "r")) == NULL)
+               exit(RCV_MBX);
+       while (fread((char *) &ut, sizeof(ut), 1, uf) == 1)
+               if (ut.ut_name[0] != 0 &&
+                               strncmp(user, ut.ut_name, sizeof(ut.ut_name))
+                               == 0) {
+                       strncpy(tty, ut.ut_line, sizeof(ut.ut_line));
+                       alert(tty, md);
                }
-       fclose (uf);
+       fclose(uf);
 #endif
 
-       exit (RCV_MOK);
+       exit(RCV_MOK);
        return 0;  /* dead code to satisfy the compiler */
 }
 
 
 static RETSIGTYPE
-alrmser (int i)
+alrmser(int i)
 {
 #ifndef RELIABLE_SIGNALS
-       SIGNAL (SIGALRM, alrmser);
+       SIGNAL(SIGALRM, alrmser);
 #endif
 
-       longjmp (myctx, 1);
+       longjmp(myctx, 1);
 }
 
 
 static int
-message_fd (char **vec)
+message_fd(char **vec)
 {
        pid_t child_id;
        int bytes, fd, seconds;
@@ -225,23 +225,23 @@ message_fd (char **vec)
        struct stat st;
 
 #ifdef HAVE_MKSTEMP
-       fd = mkstemp (strncpy (tmpfil, "/tmp/rcvttyXXXXX", sizeof(tmpfil)));
+       fd = mkstemp(strncpy(tmpfil, "/tmp/rcvttyXXXXX", sizeof(tmpfil)));
 #else
-       unlink (mktemp (strncpy (tmpfil, "/tmp/rcvttyXXXXX", sizeof(tmpfil))));
-       if ((fd = open (tmpfil, O_RDWR | O_CREAT | O_TRUNC, 0600)) == NOTOK)
-               return header_fd ();
+       unlink(mktemp(strncpy(tmpfil, "/tmp/rcvttyXXXXX", sizeof(tmpfil))));
+       if ((fd = open(tmpfil, O_RDWR | O_CREAT | O_TRUNC, 0600)) == NOTOK)
+               return header_fd();
 #endif
-       unlink (tmpfil);
+       unlink(tmpfil);
 
        if ((child_id = vfork()) == NOTOK) {
                /* fork error */
-               close (fd);
-               return header_fd ();
+               close(fd);
+               return header_fd();
        } else if (child_id) {
                /* parent process */
-               if (!setjmp (myctx)) {
-                       SIGNAL (SIGALRM, alrmser);
-                       bytes = fstat(fileno (stdin), &st) != NOTOK ?
+               if (!setjmp(myctx)) {
+                       SIGNAL(SIGALRM, alrmser);
+                       bytes = fstat(fileno(stdin), &st) != NOTOK ?
                                        (int) st.st_size : 100;
 
                        /* amount of time to wait depends on message size */
@@ -254,11 +254,11 @@ message_fd (char **vec)
                        } else {
                                seconds = (bytes / 60) + 300;
                        }
-                       alarm ((unsigned int) seconds);
+                       alarm((unsigned int) seconds);
                        pidwait(child_id, OK);
-                       alarm (0);
+                       alarm(0);
 
-                       if (fstat (fd, &st) != NOTOK && st.st_size > (off_t) 0)
+                       if (fstat(fd, &st) != NOTOK && st.st_size > (off_t) 0)
                                return fd;
                } else {
                        /*
@@ -267,24 +267,24 @@ message_fd (char **vec)
                        */
                        KILLPG(child_id, SIGKILL);
                }
-               close (fd);
-               return header_fd ();
+               close(fd);
+               return header_fd();
        }
 
        /* child process */
-       rewind (stdin);
-       if (dup2 (fd, 1) == NOTOK || dup2 (fd, 2) == NOTOK)
-               _exit (-1);
-       closefds (3);
-       setpgid ((pid_t) 0, getpid ());  /* put in own process group */
-       execvp (vec[0], vec);
-       _exit (-1);
+       rewind(stdin);
+       if (dup2(fd, 1) == NOTOK || dup2(fd, 2) == NOTOK)
+               _exit(-1);
+       closefds(3);
+       setpgid((pid_t) 0, getpid());  /* put in own process group */
+       execvp(vec[0], vec);
+       _exit(-1);
        return 1;  /* dead code to satisfy compiler */
 }
 
 
 static int
-header_fd (void)
+header_fd(void)
 {
        int fd;
        char *nfs;
@@ -292,58 +292,57 @@ header_fd (void)
 
        tfile = m_mktemp2(NULL, invo_name, &fd, NULL);
        if (tfile == NULL) return NOTOK;
-       unlink (tfile);
+       unlink(tfile);
 
-       rewind (stdin);
+       rewind(stdin);
 
        /* get new format string */
-       nfs = new_fs (form, format, SCANFMT);
-       scan (stdin, 0, 0, nfs, width, 0, 0, NULL, 0L, 0);
+       nfs = new_fs(form, format, SCANFMT);
+       scan(stdin, 0, 0, nfs, width, 0, 0, NULL, 0L, 0);
        if (newline)
-               write (fd, "\n\r", 2);
-       write (fd, scanl, strlen (scanl));
+               write(fd, "\n\r", 2);
+       write(fd, scanl, strlen(scanl));
        if (bell)
-               write (fd, "\007", 1);
+               write(fd, "\007", 1);
 
        return fd;
 }
 
 
 static void
-alert (char *tty, int md)
+alert(char *tty, int md)
 {
        int i, td, mask;
        char buffer[BUFSIZ], ttyspec[BUFSIZ];
        struct stat st;
 
-       snprintf (ttyspec, sizeof(ttyspec), "/dev/%s", tty);
+       snprintf(ttyspec, sizeof(ttyspec), "/dev/%s", tty);
 
        /*
        ** The mask depends on whether we are checking for
        ** write permission based on `biff' or `mesg'.
        */
        mask = biff ? S_IEXEC : (S_IWRITE >> 3);
-       if (stat (ttyspec, &st) == NOTOK || (st.st_mode & mask) == 0)
+       if (stat(ttyspec, &st) == NOTOK || (st.st_mode & mask) == 0)
                return;
 
-       if (!setjmp (myctx)) {
-               SIGNAL (SIGALRM, alrmser);
-               alarm (2);
-               td = open (ttyspec, O_WRONLY);
-               alarm (0);
+       if (!setjmp(myctx)) {
+               SIGNAL(SIGALRM, alrmser);
+               alarm(2);
+               td = open(ttyspec, O_WRONLY);
+               alarm(0);
                if (td == NOTOK)
                        return;
        } else {
-               alarm (0);
+               alarm(0);
                return;
        }
 
-       lseek (md, (off_t) 0, SEEK_SET);
+       lseek(md, (off_t) 0, SEEK_SET);
 
-       while ((i = read (md, buffer, sizeof(buffer))) > 0)
-               if (write (td, buffer, i) != i)
+       while ((i = read(md, buffer, sizeof(buffer))) > 0)
+               if (write(td, buffer, i) != i)
                        break;
 
-       close (td);
+       close(td);
 }
-
index b1c2aa9..b24e42e 100644 (file)
@@ -50,14 +50,14 @@ struct st_fold {
 /*
 ** static prototypes
 */
-static void opnfolds (struct st_fold *, int);
-static void clsfolds (struct st_fold *, int);
-static void remove_files (int, char **);
-static int m_file (char *, struct st_fold *, int, int, int);
+static void opnfolds(struct st_fold *, int);
+static void clsfolds(struct st_fold *, int);
+static void remove_files(int, char **);
+static int m_file(char *, struct st_fold *, int, int, int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int linkf = 0, preserve = 0, filep = 0;
        int foldp = 0, unlink_msgs = 0;
@@ -73,12 +73,12 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -86,20 +86,20 @@ main (int argc, char **argv)
        */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown\n", cp);
+                               adios(NULL, "-%s unknown\n", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf), "%s [msgs] [switches] +folder ...", invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               snprintf(buf, sizeof(buf), "%s [msgs] [switches] +folder ...", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case LINKSW:
                                linkf++;
@@ -124,27 +124,28 @@ main (int argc, char **argv)
 
                        case SRCSW:
                                if (folder)
-                                       adios (NULL, "only one source folder at a time!");
+                                       adios(NULL, "only one source folder at a time!");
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s", argp[-2]);
-                               folder = path (*cp == '+' || *cp == '@' ?
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               folder = path(*cp == '+' || *cp == '@' ?
                                                cp + 1 : cp,
                                                *cp != '@' ?
                                                TFOLDER : TSUBCWF);
                                continue;
                        case FILESW:
                                if (filep > NFOLDERS)
-                                       adios (NULL, "only %d files allowed!",
+                                       adios(NULL, "only %d files allowed!",
                                                        NFOLDERS);
                                if (!(cp = *argp++) || *cp == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
-                               files[filep++] = path (cp, TFILE);
+                               files[filep++] = path(cp, TFILE);
                                continue;
 
                        case RPROCSW:
                                if (!(rmmproc = *argp++) || *rmmproc == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                continue;
                        case NRPRCSW:
@@ -154,21 +155,21 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (foldp > NFOLDERS)
-                               adios (NULL, "only %d folders allowed!",
+                               adios(NULL, "only %d folders allowed!",
                                                NFOLDERS);
                        folders[foldp++].f_name =
-                               pluspath (cp);
+                               pluspath(cp);
                } else
                                app_msgarg(&msgs, cp);
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
        if (foldp == 0)
-               adios (NULL, "no folder specified");
+               adios(NULL, "no folder specified");
 
 #ifdef WHATNOW
-       if (!msgs.size && !foldp && !filep && (cp = getenv ("mhdraft")) && *cp)
+       if (!msgs.size && !foldp && !filep && (cp = getenv("mhdraft")) && *cp)
                files[filep++] = cp;
 #endif /* WHATNOW */
 
@@ -177,42 +178,42 @@ main (int argc, char **argv)
        */
        if (filep > 0) {
                if (folder || msgs.size)
-                       adios (NULL, "use -file or some messages, not both");
-               opnfolds (folders, foldp);
+                       adios(NULL, "use -file or some messages, not both");
+               opnfolds(folders, foldp);
                for (i = 0; i < filep; i++)
-                       if (m_file (files[i], folders, foldp, preserve, 0))
-                               done (1);
+                       if (m_file(files[i], folders, foldp, preserve, 0))
+                               done(1);
                /* If -nolink, then "remove" files */
                if (!linkf)
-                       remove_files (filep, filevec);
-               done (0);
+                       remove_files(filep, filevec);
+               done(0);
        }
 
        if (!msgs.size)
                app_msgarg(&msgs, "cur");
        if (!folder)
-               folder = getfolder (1);
-       strncpy (maildir, m_maildir (folder), sizeof(maildir));
+               folder = getfolder(1);
+       strncpy(maildir, m_maildir(folder), sizeof(maildir));
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read source folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
        if (mp->nummsg == 0)
-               adios (NULL, "no messages in %s", folder);
+               adios(NULL, "no messages in %s", folder);
 
        /* parse the message range/sequence/name and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
-               if (!m_convert (mp, msgs.msgs[msgnum]))
-                       done (1);
-       seq_setprev (mp);  /* set the previous-sequence */
+               if (!m_convert(mp, msgs.msgs[msgnum]))
+                       done(1);
+       seq_setprev(mp);  /* set the previous-sequence */
 
        /* create folder structures for each destination folder */
-       opnfolds (folders, foldp);
+       opnfolds(folders, foldp);
 
        /* Link all the selected messages into destination folders.
        **
@@ -221,11 +222,11 @@ main (int argc, char **argv)
        ** messages that are moved to another folder.
        */
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
-               if (is_selected (mp, msgnum)) {
-                       cp = getcpy (m_name (msgnum));
-                       if (m_file (cp, folders, foldp, preserve, !linkf))
-                               done (1);
-                       free (cp);
+               if (is_selected(mp, msgnum)) {
+                       cp = getcpy(m_name(msgnum));
+                       if (m_file(cp, folders, foldp, preserve, !linkf))
+                               done(1);
+                       free(cp);
                }
        }
 
@@ -236,9 +237,9 @@ main (int argc, char **argv)
        ** directory.  This should be moved to folder_delmsgs().
        */
        if (rmmproc) {
-               context_replace (pfolder, folder);
-               context_save ();
-               fflush (stdout);
+               context_replace(pfolder, folder);
+               context_save();
+               fflush(stdout);
        }
 
        /*
@@ -248,20 +249,20 @@ main (int argc, char **argv)
        ** because the message has already been handled above.
        */
        if (!linkf) {
-               folder_delmsgs (mp, unlink_msgs, 1);
+               folder_delmsgs(mp, unlink_msgs, 1);
        }
 
-       clsfolds (folders, foldp);
+       clsfolds(folders, foldp);
 
-       if (mp->hghsel != mp->curmsg
-               && (mp->numsel != mp->nummsg || linkf))
-               seq_setcur (mp, mp->hghsel);
-       seq_save (mp);  /* synchronize message sequences */
+       if (mp->hghsel != mp->curmsg &&
+                               (mp->numsel != mp->nummsg || linkf))
+               seq_setcur(mp, mp->hghsel);
+       seq_save(mp);  /* synchronize message sequences */
 
-       context_replace (pfolder, folder);  /* update current folder   */
-       context_save ();  /* save the context file   */
-       folder_free (mp);  /* free folder structure   */
-       done (0);
+       context_replace(pfolder, folder);  /* update current folder   */
+       context_save();  /* save the context file   */
+       folder_free(mp);  /* free folder structure   */
+       done(0);
        return 1;
 }
 
@@ -272,27 +273,27 @@ main (int argc, char **argv)
 */
 
 static void
-opnfolds (struct st_fold *folders, int nfolders)
+opnfolds(struct st_fold *folders, int nfolders)
 {
        char nmaildir[BUFSIZ];
        register struct st_fold *fp, *ep;
        register struct msgs *mp;
 
        for (fp = folders, ep = folders + nfolders; fp < ep; fp++) {
-               chdir (m_maildir (""));
-               strncpy (nmaildir, m_maildir (fp->f_name), sizeof(nmaildir));
+               chdir(m_maildir(""));
+               strncpy(nmaildir, m_maildir(fp->f_name), sizeof(nmaildir));
 
-       create_folder (nmaildir, 0, done);
+               create_folder(nmaildir, 0, done);
 
-               if (chdir (nmaildir) == NOTOK)
-                       adios (nmaildir, "unable to change directory to");
-               if (!(mp = folder_read (fp->f_name)))
-                       adios (NULL, "unable to read folder %s", fp->f_name);
+               if (chdir(nmaildir) == NOTOK)
+                       adios(nmaildir, "unable to change directory to");
+               if (!(mp = folder_read(fp->f_name)))
+                       adios(NULL, "unable to read folder %s", fp->f_name);
                mp->curmsg = 0;
 
                fp->f_mp = mp;
 
-               chdir (maildir);
+               chdir(maildir);
        }
 }
 
@@ -303,15 +304,15 @@ opnfolds (struct st_fold *folders, int nfolders)
 */
 
 static void
-clsfolds (struct st_fold *folders, int nfolders)
+clsfolds(struct st_fold *folders, int nfolders)
 {
        register struct st_fold *fp, *ep;
        register struct msgs *mp;
 
        for (fp = folders, ep = folders + nfolders; fp < ep; fp++) {
                mp = fp->f_mp;
-               seq_setprev (mp);
-               seq_save (mp);
+               seq_setprev(mp);
+               seq_save(mp);
        }
 }
 
@@ -323,7 +324,7 @@ clsfolds (struct st_fold *folders, int nfolders)
 */
 
 static void
-remove_files (int filep, char **files)
+remove_files(int filep, char **files)
 {
        int i;
        char **vec;
@@ -333,17 +334,17 @@ remove_files (int filep, char **files)
                vec = files++;  /* vec[0] = filevec[0] */
                files[filep] = NULL;  /* NULL terminate list */
 
-               fflush (stdout);
-               vec[0] = r1bindex (rmmproc, '/');
-               execvp (rmmproc, vec);
-               adios (rmmproc, "unable to exec");
+               fflush(stdout);
+               vec[0] = r1bindex(rmmproc, '/');
+               execvp(rmmproc, vec);
+               adios(rmmproc, "unable to exec");
        }
 
        /* Else just unlink the files */
        files++;  /* advance past filevec[0] */
        for (i = 0; i < filep; i++) {
-               if (unlink (files[i]) == NOTOK)
-                       admonish (files[i], "unable to unlink");
+               if (unlink(files[i]) == NOTOK)
+                       admonish(files[i], "unable to unlink");
        }
 }
 
@@ -354,14 +355,14 @@ remove_files (int filep, char **files)
 */
 
 static int
-m_file (char *msgfile, struct st_fold *folders, int nfolders, int preserve,
+m_file(char *msgfile, struct st_fold *folders, int nfolders, int preserve,
                int refile)
 {
        int msgnum;
        struct st_fold *fp, *ep;
 
        for (fp = folders, ep = folders + nfolders; fp < ep; fp++) {
-               if ((msgnum = folder_addmsg (&fp->f_mp, msgfile, 1, 0,
+               if ((msgnum = folder_addmsg(&fp->f_mp, msgfile, 1, 0,
                                preserve, nfolders == 1 && refile, maildir))
                                == -1)
                        return 1;
index f6016de..6893f56 100644 (file)
@@ -99,11 +99,11 @@ char *fcc = NULL;  /* folders to add to Fcc: header */
 /*
 ** prototypes
 */
-void docc (char *, int);
+void docc(char *, int);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int anot = 0, inplace = 1;
        int nedit = 0, nwhat = 0;
@@ -121,30 +121,30 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s: [+folder] [msg] [switches]", invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (0);
+                                       snprintf(buf, sizeof(buf), "%s: [+folder] [msg] [switches]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(0);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case GROUPSW:
                                        groupreply++;
@@ -162,18 +162,18 @@ main (int argc, char **argv)
 
                                case CCSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       docc (cp, 1);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       docc(cp, 1);
                                        continue;
                                case NCCSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       docc (cp, 0);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       docc(cp, 0);
                                        continue;
 
                                case EDITRSW:
                                        if (!(ed = *argp++) || *ed == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        nedit = 0;
                                        continue;
                                case NEDITSW:
@@ -183,7 +183,7 @@ main (int argc, char **argv)
                                case WHATSW:
                                        if (!(whatnowproc = *argp++) ||
                                                        *whatnowproc == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        nwhat = 0;
                                        continue;
 #ifdef MHE
@@ -196,38 +196,38 @@ main (int argc, char **argv)
 
                                case FCCSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        dp = NULL;
                                        if (*cp == '@')
-                                               cp = dp = path (cp + 1,
+                                               cp = dp = path(cp + 1,
                                                                TSUBCWF);
                                        if (fcc)
-                                               fcc = add (", ", fcc);
-                                       fcc = add (cp, fcc);
+                                               fcc = add(", ", fcc);
+                                       fcc = add(cp, fcc);
                                        if (dp)
-                                               free (dp);
+                                               free(dp);
                                        continue;
 
                                case FILESW:
                                        if (file)
-                                               adios (NULL, "only one file at a time!");
+                                               adios(NULL, "only one file at a time!");
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       file = path (cp, TFILE);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       file = path(cp, TFILE);
                                        continue;
                                case FILTSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       filter = getcpy (etcpath (cp));
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       filter = getcpy(etcpath(cp));
                                        mime = 0;
                                        continue;
                                case FORMSW:
                                        if (!(form = *argp++) || *form == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case FRMTSW:
-                                       filter = getcpy (etcpath (mhlreply));
+                                       filter = getcpy(etcpath(mhlreply));
                                        mime = 0;
                                        continue;
                                case NFRMTSW:
@@ -258,20 +258,20 @@ main (int argc, char **argv)
 
                                case WIDTHSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       if ((outputlinelen = atoi (cp)) < 10)
-                                               adios (NULL, "impossible width %d", outputlinelen);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       if ((outputlinelen = atoi(cp)) < 10)
+                                               adios(NULL, "impossible width %d", outputlinelen);
                                        continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else {
                        if (msg)
-                               adios (NULL, "only one message at a time!");
+                               adios(NULL, "only one message at a time!");
                        else
                                msg = cp;
                }
@@ -284,18 +284,18 @@ main (int argc, char **argv)
        if (ccme == -1)
                ccme = groupreply;
 
-       cwd = getcpy (pwd ());
+       cwd = getcpy(pwd());
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
        if (file && (msg || folder))
-               adios (NULL, "can't mix files and folders/msgs");
+               adios(NULL, "can't mix files and folders/msgs");
 
 #ifdef MHE
-       strncpy (drft, buildsw ? m_maildir ("reply")
+       strncpy(drft, buildsw ? m_maildir("reply")
                : m_draft("new"), sizeof(drft));
 #else
-       strncpy (drft, m_draft("new"), sizeof(drft));
+       strncpy(drft, m_draft("new"), sizeof(drft));
 #endif /* MHE */
 
        if (file) {
@@ -310,68 +310,68 @@ main (int argc, char **argv)
                if (!msg)
                        msg = "cur";
                if (!folder)
-                       folder = getfolder (1);
-               maildir = m_maildir (folder);
+                       folder = getfolder(1);
+               maildir = m_maildir(folder);
 
-               if (chdir (maildir) == NOTOK)
-                       adios (maildir, "unable to change directory to");
+               if (chdir(maildir) == NOTOK)
+                       adios(maildir, "unable to change directory to");
 
                /* read folder and create message structure */
-               if (!(mp = folder_read (folder)))
-                       adios (NULL, "unable to read folder %s", folder);
+               if (!(mp = folder_read(folder)))
+                       adios(NULL, "unable to read folder %s", folder);
 
                /* check for empty folder */
                if (mp->nummsg == 0)
-                       adios (NULL, "no messages in %s", folder);
+                       adios(NULL, "no messages in %s", folder);
 
                /* parse the message range/sequence/name and set SELECTED */
-               if (!m_convert (mp, msg))
-                       done (1);
-               seq_setprev (mp);  /* set the previous-sequence */
+               if (!m_convert(mp, msg))
+                       done(1);
+               seq_setprev(mp);  /* set the previous-sequence */
 
                if (mp->numsel > 1)
-                       adios (NULL, "only one message at a time!");
+                       adios(NULL, "only one message at a time!");
 
-               context_replace (pfolder, folder);  /* update current folder */
-               seq_setcur (mp, mp->lowsel);  /* update current message  */
-               seq_save (mp);  /* synchronize sequences   */
-               context_save ();  /* save the context file   */
+               context_replace(pfolder, folder);  /* update current folder */
+               seq_setcur(mp, mp->lowsel);  /* update current message  */
+               seq_save(mp);  /* synchronize sequences   */
+               context_save();  /* save the context file   */
        }
 
-       msg = file ? file : getcpy (m_name (mp->lowsel));
+       msg = file ? file : getcpy(m_name(mp->lowsel));
 
-       if ((in = fopen (msg, "r")) == NULL)
-               adios (msg, "unable to open");
+       if ((in = fopen(msg, "r")) == NULL)
+               adios(msg, "unable to open");
 
        /* find form (components) file */
        if (!form) {
                if (groupreply)
-                       form = etcpath (replgroupcomps);
+                       form = etcpath(replgroupcomps);
                else
-                       form = etcpath (replcomps);
+                       form = etcpath(replcomps);
        }
 
-       replout (in, msg, drft, mp, outputlinelen, mime, form, filter, fcc);
-       fclose (in);
+       replout(in, msg, drft, mp, outputlinelen, mime, form, filter, fcc);
+       fclose(in);
 
        if (nwhat)
-               done (0);
-       what_now (ed, nedit, NOUSE, drft, msg, 0, mp,
-                       anot ? "Replied" : NULL, inplace, cwd);
-       done (1);
+               done(0);
+       what_now(ed, nedit, NOUSE, drft, msg, 0, mp, anot ? "Replied" : NULL,
+                       inplace, cwd);
+       done(1);
        return 1;
 }
 
 void
-docc (char *cp, int ccflag)
+docc(char *cp, int ccflag)
 {
-       switch (smatch (cp, ccswitches)) {
+       switch (smatch(cp, ccswitches)) {
                case AMBIGSW:
-                       ambigsw (cp, ccswitches);
-                       done (1);
+                       ambigsw(cp, ccswitches);
+                       done(1);
                case UNKWNSW:
-                       adios (NULL, "-%scc %s unknown",
-                                       ccflag ? "" : "no", cp);
+                       adios(NULL, "-%scc %s unknown", ccflag ? "" : "no",
+                                       cp);
 
                case CTOSW:
                        ccto = ccflag;
index 8e60a52..e26badd 100644 (file)
@@ -61,12 +61,12 @@ static char *addrcomps[] = {
 /*
 ** static prototypes
 */
-static int insert (struct mailname *);
-static void replfilter (FILE *, FILE *, char *);
+static int insert(struct mailname *);
+static void replfilter(FILE *, FILE *, char *);
 
 
 void
-replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
+replout(FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
        int mime, char *form, char *filter, char *fcc)
 {
        register int state, i;
@@ -81,24 +81,24 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
        FILE *out;
 
        mask = umask(~m_gmprot());
-       if ((out = fopen (drft, "w")) == NULL)
-               adios (drft, "unable to create");
+       if ((out = fopen(drft, "w")) == NULL)
+               adios(drft, "unable to create");
 
        umask(mask);
 
        /* get new format string */
-       cp = new_fs (form, NULL, NULL);
-       format_len = strlen (cp);
+       cp = new_fs(form, NULL, NULL);
+       format_len = strlen(cp);
 
        /* compile format string */
-       ncomps = fmt_compile (cp, &fmt) + 1;
+       ncomps = fmt_compile(cp, &fmt) + 1;
 
        if (!(nxtbuf = compbuffers = (char **)
                        calloc((size_t) ncomps, sizeof(char *))))
-               adios (NULL, "unable to allocate component buffers");
+               adios(NULL, "unable to allocate component buffers");
        if (!(savecomp = used_buf = (struct comp **)
                        calloc((size_t) (ncomps+1), sizeof(struct comp *))))
-               adios (NULL, "unable to allocate component buffer stack");
+               adios(NULL, "unable to allocate component buffer stack");
        savecomp += ncomps + 1;
        *--savecomp = NULL;  /* point at zero'd end minus 1 */
 
@@ -109,7 +109,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
        tmpbuf = *nxtbuf++;
 
        for (ap = addrcomps; *ap; ap++) {
-               FINDCOMP (cptr, *ap);
+               FINDCOMP(cptr, *ap);
                if (cptr)
                        cptr->c_type |= CT_ADDR;
        }
@@ -118,34 +118,34 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
        ** ignore any components killed by command line switches
        */
        if (!ccto) {
-               FINDCOMP (cptr, "to");
+               FINDCOMP(cptr, "to");
                if (cptr)
                        cptr->c_name = "";
        }
        if (!cccc) {
-               FINDCOMP (cptr, "cc");
+               FINDCOMP(cptr, "cc");
                if (cptr)
                        cptr->c_name = "";
        }
        /* set up the "fcc" pseudo-component */
        if (fcc) {
-               FINDCOMP (cptr, "fcc");
+               FINDCOMP(cptr, "fcc");
                if (cptr)
-                       cptr->c_text = getcpy (fcc);
+                       cptr->c_text = getcpy(fcc);
        }
        if ((cp = getenv("USER"))) {
-               FINDCOMP (cptr, "user");
+               FINDCOMP(cptr, "user");
                if (cptr)
                        cptr->c_text = getcpy(cp);
        }
        if (!ccme)
-               ismymbox (NULL);
+               ismymbox(NULL);
 
        /*
        ** pick any interesting stuff out of msg "inb"
        */
        for (state = FLD;;) {
-               state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb);
+               state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb);
                switch (state) {
                        case FLD:
                        case FLDPLUS:
@@ -168,21 +168,21 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
                                                                *--savecomp = cptr;
                                                                tmpbuf = *nxtbuf++;
                                                        } else {
-                                                               i = strlen (cp = cptr->c_text) - 1;
+                                                               i = strlen(cp = cptr->c_text) - 1;
                                                                if (cp[i] == '\n') {
                                                                        if (cptr->c_type & CT_ADDR) {
                                                                                cp[i] = '\0';
-                                                                               cp = add (",\n\t", cp);
+                                                                               cp = add(",\n\t", cp);
                                                                        } else {
-                                                                               cp = add ("\t", cp);
+                                                                               cp = add("\t", cp);
                                                                        }
                                                                }
-                                                               cptr->c_text = add (tmpbuf, cp);
+                                                               cptr->c_text = add(tmpbuf, cp);
                                                        }
                                                        while (state == FLDPLUS) {
-                                                               state = m_getfld (state, name, tmpbuf,
+                                                               state = m_getfld(state, name, tmpbuf,
                                                                                                  SBUFSIZ, inb);
-                                                               cptr->c_text = add (tmpbuf, cptr->c_text);
+                                                               cptr->c_text = add(tmpbuf, cptr->c_text);
                                                                char_read += msg_count;
                                                        }
                                                        break;
@@ -190,7 +190,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
                                        } while ((cptr = cptr->c_next));
 
                                while (state == FLDPLUS)
-                                       state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb);
+                                       state = m_getfld(state, name, tmpbuf, SBUFSIZ, inb);
                                break;
 
                        case LENERR:
@@ -200,7 +200,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
                                goto finished;
 
                        default:
-                               adios (NULL, "m_getfld() returned %d", state);
+                               adios(NULL, "m_getfld() returned %d", state);
                }
        }
 
@@ -212,7 +212,7 @@ finished:
        /*
        ** if there's a "Subject" component, strip any "Re:"s off it
        */
-       FINDCOMP (cptr, "subject")
+       FINDCOMP(cptr, "subject")
        if (cptr && (cp = cptr->c_text)) {
                register char *sp = cp;
 
@@ -227,22 +227,22 @@ finished:
                }
                if (sp != cptr->c_text) {
                        cp = cptr->c_text;
-                       cptr->c_text = getcpy (sp);
-                       free (cp);
+                       cptr->c_text = getcpy(sp);
+                       free(cp);
                }
        }
        i = format_len + char_read + 256;
-       scanl = mh_xmalloc ((size_t) i + 2);
+       scanl = mh_xmalloc((size_t) i + 2);
        dat[0] = 0;
        dat[1] = 0;
        dat[2] = 0;
        dat[3] = outputlinelen;
        dat[4] = 0;
-       fmt_scan (fmt, scanl, i, dat);
-       fputs (scanl, out);
+       fmt_scan(fmt, scanl, i, dat);
+       fputs(scanl, out);
        if (badaddrs) {
-               fputs ("\nrepl: bad addresses:\n", out);
-               fputs ( badaddrs, out);
+               fputs("\nrepl: bad addresses:\n", out);
+               fputs( badaddrs, out);
        }
 
        /*
@@ -251,29 +251,29 @@ finished:
        */
        if (filter) {
                fflush(out);
-               if (ferror (out))
-                       adios (drft, "error writing");
+               if (ferror(out))
+                       adios(drft, "error writing");
 
-               replfilter (inb, out, filter);
+               replfilter(inb, out, filter);
        } else if (mime && mp) {
-               fprintf (out, "#forw [original message] +%s %s\n",
-                               mp->foldpath, m_name (mp->lowsel));
+               fprintf(out, "#forw [original message] +%s %s\n",
+                               mp->foldpath, m_name(mp->lowsel));
        }
 
        fflush(out);
-       if (ferror (out))
-               adios (drft, "error writing");
-       fclose (out);
+       if (ferror(out))
+               adios(drft, "error writing");
+       fclose(out);
 
        /* return dynamically allocated buffers */
-       free (scanl);
+       free(scanl);
        for (nxtbuf = compbuffers, i = ncomps; (cptr = *savecomp++);
                        nxtbuf++, i--)
-               free (cptr->c_text);  /* if not nxtbuf, nxtbuf already freed */
+               free(cptr->c_text);  /* if not nxtbuf, nxtbuf already freed */
        while ( i-- > 0)
-               free (*nxtbuf++);  /* free unused nxtbufs */
-       free ((char *) compbuffers);
-       free ((char *) used_buf);
+               free(*nxtbuf++);  /* free unused nxtbufs */
+       free((char *) compbuffers);
+       free((char *) used_buf);
 }
 
 static char *buf;  /* our current working buffer */
@@ -290,11 +290,11 @@ static unsigned int bufsiz=0;  /* current size of buf */
 ** add more mem if needed
 */
 #define CHECKMEM(str) \
-       if ((len = strlen (str)) >= bufend - dst) {\
+       if ((len = strlen(str)) >= bufend - dst) {\
                int i = dst - buf;\
                int n = last_dst - buf;\
                bufsiz += ((dst + len - bufend) / BUFINCR + 1) * BUFINCR;\
-               buf = mh_xrealloc (buf, bufsiz);\
+               buf = mh_xrealloc(buf, bufsiz);\
                dst = buf + i;\
                last_dst = buf + n;\
                bufend = buf + bufsiz;\
@@ -313,7 +313,7 @@ static unsigned int bufsiz=0;  /* current size of buf */
 ** length of the result string.
 */
 char *
-formataddr (char *orig, char *str)
+formataddr(char *orig, char *str)
 {
        register int len;
        char baddr[BUFSIZ], error[BUFSIZ];
@@ -325,7 +325,7 @@ formataddr (char *orig, char *str)
 
        /* if we don't have a buffer yet, get one */
        if (bufsiz == 0) {
-               buf = mh_xmalloc (BUFINCR);
+               buf = mh_xmalloc(BUFINCR);
                last_dst = buf;  /* XXX */
                bufsiz = BUFINCR - 6;  /* leave some slop */
                bufend = buf + bufsiz;
@@ -341,36 +341,36 @@ formataddr (char *orig, char *str)
                *dst = '\0';
        } else {
                dst = last_dst;  /* XXX */
-               CHECKMEM (orig);
-               CPY (orig);
+               CHECKMEM(orig);
+               CPY(orig);
        }
 
        /* concatenate all the new addresses onto 'buf' */
-       for (isgroup = 0; (cp = getname (str)); ) {
-               if ((mp = getm (cp, dfhost, dftype, AD_NAME, error)) == NULL) {
-                       snprintf (baddr, sizeof(baddr), "\t%s -- %s\n",
+       for (isgroup = 0; (cp = getname(str)); ) {
+               if ((mp = getm(cp, dfhost, dftype, AD_NAME, error)) == NULL) {
+                       snprintf(baddr, sizeof(baddr), "\t%s -- %s\n",
                                        cp, error);
-                       badaddrs = add (baddr, badaddrs);
+                       badaddrs = add(baddr, badaddrs);
                        continue;
                }
                if (isgroup && (mp->m_gname || !mp->m_ingrp)) {
                        *dst++ = ';';
                        isgroup = 0;
                }
-               if (insert (mp)) {
+               if (insert(mp)) {
                        /* if we get here we're going to add an address */
                        if (dst != buf) {
                                *dst++ = ',';
                                *dst++ = ' ';
                        }
                        if (mp->m_gname) {
-                               CHECKMEM (mp->m_gname);
-                               CPY (mp->m_gname);
+                               CHECKMEM(mp->m_gname);
+                               CPY(mp->m_gname);
                                isgroup++;
                        }
-                       sp = adrformat (mp);
-                       CHECKMEM (sp);
-                       CPY (sp);
+                       sp = adrformat(mp);
+                       CHECKMEM(sp);
+                       CPY(sp);
                }
        }
 
@@ -384,7 +384,7 @@ formataddr (char *orig, char *str)
 
 
 static int
-insert (struct mailname *np)
+insert(struct mailname *np)
 {
        char buffer[BUFSIZ];
        register struct mailname *mp;
@@ -393,24 +393,23 @@ insert (struct mailname *np)
                return 0;
 
        for (mp = &mq; mp->m_next; mp = mp->m_next) {
-               if (!mh_strcasecmp (np->m_host, mp->m_next->m_host)
-                               && !mh_strcasecmp (np->m_mbox,
-                               mp->m_next->m_mbox))
+               if (!mh_strcasecmp(np->m_host, mp->m_next->m_host) &&
+                               !mh_strcasecmp(np->m_mbox, mp->m_next->m_mbox))
                        return 0;
        }
-       if (!ccme && ismymbox (np))
+       if (!ccme && ismymbox(np))
                return 0;
 
        if (querysw) {
-               snprintf (buffer, sizeof(buffer), "Reply to %s? ",
-                               adrformat (np));
-               if (!gans (buffer, anoyes))
+               snprintf(buffer, sizeof(buffer), "Reply to %s? ",
+                               adrformat(np));
+               if (!gans(buffer, anoyes))
                return 0;
        }
        mp->m_next = np;
 
 #ifdef ISI
-       if (ismymbox (np))
+       if (ismymbox(np))
                ccme = 0;
 #endif
 
@@ -425,7 +424,7 @@ insert (struct mailname *np)
 */
 
 static void
-replfilter (FILE *in, FILE *out, char *filter)
+replfilter(FILE *in, FILE *out, char *filter)
 {
        int pid;
        char *mhl;
@@ -434,24 +433,24 @@ replfilter (FILE *in, FILE *out, char *filter)
        if (filter == NULL)
                return;
 
-       if (access (filter, R_OK) == NOTOK)
-               adios (filter, "unable to read");
+       if (access(filter, R_OK) == NOTOK)
+               adios(filter, "unable to read");
 
-       mhl = r1bindex (mhlproc, '/');
+       mhl = r1bindex(mhlproc, '/');
 
-       rewind (in);
-       lseek (fileno(in), (off_t) 0, SEEK_SET);
+       rewind(in);
+       lseek(fileno(in), (off_t) 0, SEEK_SET);
 
-       switch (pid = vfork ()) {
+       switch (pid = vfork()) {
                case NOTOK:
-                       adios ("fork", "unable to");
+                       adios("fork", "unable to");
 
                case OK:
-                       dup2 (fileno (in), fileno (stdin));
-                       dup2 (fileno (out), fileno (stdout));
-                       closefds (3);
+                       dup2(fileno(in), fileno(stdin));
+                       dup2(fileno(out), fileno(stdout));
+                       closefds(3);
 
-                       execlp (mhlproc, mhl, "-form", filter, "-noclear",
+                       execlp(mhlproc, mhl, "-form", filter, "-noclear",
                                        NULL);
                        errstr = strerror(errno);
                        write(2, "unable to exec ", 15);
@@ -459,12 +458,12 @@ replfilter (FILE *in, FILE *out, char *filter)
                        write(2, ": ", 2);
                        write(2, errstr, strlen(errstr));
                        write(2, "\n", 1);
-                       _exit (-1);
+                       _exit(-1);
 
                default:
-                       if (pidXwait (pid, mhl))
-                               done (1);
-                       fseek (out, 0L, SEEK_END);
+                       if (pidXwait(pid, mhl))
+                               done(1);
+                       fseek(out, 0L, SEEK_END);
                        break;
        }
 }
index 050817b..38a93ff 100644 (file)
--- a/uip/rmf.c
+++ b/uip/rmf.c
@@ -24,11 +24,11 @@ static struct swit switches[] = {
 ** static prototypes
 */
 static int rmf(char *);
-static void rma (char *);
+static void rma(char *);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int defolder = 0, interactive = -1;
        char *cp, *folder = NULL, newfolder[BUFSIZ];
@@ -37,30 +37,30 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [+folder] [switches]", invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [+folder] [switches]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case INTRSW:
                                        interactive = 1;
@@ -72,61 +72,61 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else {
-                       adios (NULL, "usage: %s [+folder] [switches]",
+                       adios(NULL, "usage: %s [+folder] [switches]",
                                        invo_name);
                }
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
        if (!folder) {
-               folder = getfolder (1);
+               folder = getfolder(1);
                defolder++;
        }
-       if (strcmp (m_mailpath (folder), pwd ()) == 0)
-               adios (NULL, "sorry, you can't remove the current working directory");
+       if (strcmp(m_mailpath(folder), pwd()) == 0)
+               adios(NULL, "sorry, you can't remove the current working directory");
 
        if (interactive == -1)
                interactive = defolder;
 
-       if (strchr (folder, '/') && (*folder != '/') && (*folder != '.')) {
-               for (cp = copy (folder, newfolder);
+       if (strchr(folder, '/') && (*folder != '/') && (*folder != '.')) {
+               for (cp = copy(folder, newfolder);
                                cp > newfolder && *cp != '/'; cp--)
                        continue;
                if (cp > newfolder)
                        *cp = '\0';
                else
-                       strncpy (newfolder, getfolder(0), sizeof(newfolder));
+                       strncpy(newfolder, getfolder(0), sizeof(newfolder));
        } else {
-               strncpy (newfolder, getfolder(0), sizeof(newfolder));
+               strncpy(newfolder, getfolder(0), sizeof(newfolder));
        }
 
        if (interactive) {
-               cp = concat ("Remove folder \"", folder, "\"? ", NULL);
-               if (!getanswer (cp))
-                       done (0);
-               free (cp);
+               cp = concat("Remove folder \"", folder, "\"? ", NULL);
+               if (!getanswer(cp))
+                       done(0);
+               free(cp);
        }
 
-       if (rmf (folder) == OK) {
+       if (rmf(folder) == OK) {
                char *cfolder = context_find(pfolder);
-               if (cfolder && strcmp (cfolder, newfolder)) {
-                       printf ("[+%s now current]\n", newfolder);
+               if (cfolder && strcmp(cfolder, newfolder)) {
+                       printf("[+%s now current]\n", newfolder);
                        /* update current folder */
-                       context_replace (pfolder, newfolder);
+                       context_replace(pfolder, newfolder);
                }
        }
-       context_save ();  /* save the context file */
-       done (0);
+       context_save();  /* save the context file */
+       done(0);
        return 1;
 }
 
 static int
-rmf (char *folder)
+rmf(char *folder)
 {
        int i, j, others;
        register char *maildir;
@@ -134,25 +134,25 @@ rmf (char *folder)
        register struct dirent *dp;
        register DIR *dd;
 
-       switch (i = chdir (maildir = m_maildir (folder))) {
+       switch (i = chdir(maildir = m_maildir(folder))) {
                case OK:
-                       if (access (".", W_OK) != NOTOK &&
-                                       access ("..", W_OK) != NOTOK)
+                       if (access(".", W_OK) != NOTOK &&
+                                       access("..", W_OK) != NOTOK)
                                break;  /* fall otherwise */
 
                case NOTOK:
-                       snprintf (cur, sizeof(cur), "atr-%s-%s",
-                                               current, m_mailpath (folder));
-                       if (!context_del (cur)) {
-                               printf ("[+%s de-referenced]\n", folder);
+                       snprintf(cur, sizeof(cur), "atr-%s-%s",
+                                               current, m_mailpath(folder));
+                       if (!context_del(cur)) {
+                               printf("[+%s de-referenced]\n", folder);
                                return OK;
                        }
-                       advise (NULL, "you have no profile entry for the %s folder +%s", i == NOTOK ? "unreadable" : "read-only", folder);
+                       advise(NULL, "you have no profile entry for the %s folder +%s", i == NOTOK ? "unreadable" : "read-only", folder);
                        return NOTOK;
        }
 
-       if ((dd = opendir (".")) == NULL)
-               adios (NULL, "unable to read folder +%s", folder);
+       if ((dd = opendir(".")) == NULL)
+               adios(NULL, "unable to read folder +%s", folder);
        others = 0;
 
        /*
@@ -162,12 +162,11 @@ rmf (char *folder)
        (void)ext_hook("del-hook", maildir, (char *)0);
 
        j = strlen(backup_prefix);
-       while ((dp = readdir (dd))) {
+       while ((dp = readdir(dd))) {
                switch (dp->d_name[0]) {
                        case '.':
-                               if (strcmp (dp->d_name, ".") == 0
-                                               || strcmp (dp->d_name, "..")
-                                               == 0)
+                               if (strcmp(dp->d_name, ".") == 0 ||
+                                               strcmp(dp->d_name, "..") == 0)
                                        continue;  /* else fall */
 
                        case ',':
@@ -181,43 +180,43 @@ rmf (char *folder)
                                break;
 
                        default:
-                               if (m_atoi (dp->d_name))
+                               if (m_atoi(dp->d_name))
                                        break;
-                               if (strcmp (dp->d_name, altmsglink) == 0
-                                               || strncmp (dp->d_name,
+                               if (strcmp(dp->d_name, altmsglink) == 0 ||
+                                               strncmp(dp->d_name,
                                                backup_prefix, j) == 0)
                                        break;
 
-                               admonish (NULL, "file \"%s/%s\" not deleted",
+                               admonish(NULL, "file \"%s/%s\" not deleted",
                                                folder, dp->d_name);
                                others++;
                                continue;
                }
-               if (unlink (dp->d_name) == NOTOK) {
-                       admonish (dp->d_name, "unable to unlink %s:", folder);
+               if (unlink(dp->d_name) == NOTOK) {
+                       admonish(dp->d_name, "unable to unlink %s:", folder);
                        others++;
                }
        }
 
-       closedir (dd);
+       closedir(dd);
 
        /*
        ** Remove any relevant private sequences
        ** or attributes from context file.
        */
-       rma (folder);
+       rma(folder);
 
-       chdir ("..");
+       chdir("..");
        if (others == 0) {
                context_save();  /* Is this needed? meillo 2011-10 */
                fflush(stdout);  /* Is this needed? meillo 2011-10 */
                if (rmdir(maildir) != -1) {
                        return OK;
                }
-               admonish (maildir, "unable to remove directory");
+               admonish(maildir, "unable to remove directory");
        }
 
-       advise (NULL, "folder +%s not removed", folder);
+       advise(NULL, "folder +%s not removed", folder);
        return NOTOK;
 }
 
@@ -228,26 +227,26 @@ rmf (char *folder)
 */
 
 static void
-rma (char *folder)
+rma(char *folder)
 {
        register int alen, j, plen;
        register char *cp;
        register struct node *np, *pp;
 
-       alen = strlen ("atr-");
-       plen = strlen (cp = m_mailpath (folder)) + 1;
+       alen = strlen("atr-");
+       plen = strlen(cp = m_mailpath(folder)) + 1;
 
        /*
        ** Search context list for keys that look like
        ** "atr-something-folderpath", and remove them.
        */
        for (np = m_defs, pp = NULL; np; np = np->n_next) {
-               if (ssequal ("atr-", np->n_name)
-                               && (j = strlen (np->n_name) - plen) > alen
-                               && *(np->n_name + j) == '-'
-                               && strcmp (cp, np->n_name + j + 1) == 0) {
+               if (ssequal("atr-", np->n_name) &&
+                               (j = strlen(np->n_name) - plen) > alen &&
+                               *(np->n_name + j) == '-' &&
+                               strcmp(cp, np->n_name + j + 1) == 0) {
                        if (!np->n_context)
-                               admonish (NULL, "bug: context_del(key=\"%s\")",
+                               admonish(NULL, "bug: context_del(key=\"%s\")",
                                                np->n_name);
                        if (pp) {
                                pp->n_next = np->n_next;
index 6e991b0..f8a1d23 100644 (file)
--- a/uip/rmm.c
+++ b/uip/rmm.c
@@ -23,7 +23,7 @@ static struct swit switches[] = {
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int msgnum, unlink_msgs = 0;
        char *cp, *maildir, *folder = NULL;
@@ -35,31 +35,31 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /* parse arguments */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown\n", cp);
+                               adios(NULL, "-%s unknown\n", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case UNLINKSW:
                                unlink_msgs++;
@@ -71,37 +71,37 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else
                        app_msgarg(&msgs, cp);
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
        if (!msgs.size)
                app_msgarg(&msgs, "cur");
        if (!folder)
-               folder = getfolder (1);
-       maildir = m_maildir (folder);
+               folder = getfolder(1);
+       maildir = m_maildir(folder);
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
        if (mp->nummsg == 0)
-               adios (NULL, "no messages in %s", folder);
+               adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
-               if (!m_convert (mp, msgs.msgs[msgnum]))
-                       done (1);
-       seq_setprev (mp);  /* set the previous-sequence */
+               if (!m_convert(mp, msgs.msgs[msgnum]))
+                       done(1);
+       seq_setprev(mp);  /* set the previous-sequence */
 
        /*
        ** This is hackish.  If we are using a external rmmproc,
@@ -111,18 +111,18 @@ main (int argc, char **argv)
        ** folder_delmsgs().
        */
        if (rmmproc) {
-               context_replace (pfolder, folder);
-               context_save ();
-               fflush (stdout);
+               context_replace(pfolder, folder);
+               context_save();
+               fflush(stdout);
        }
 
        /* "remove" the SELECTED messages */
-       folder_delmsgs (mp, unlink_msgs, 0);
+       folder_delmsgs(mp, unlink_msgs, 0);
 
-       seq_save (mp);  /* synchronize message sequences  */
-       context_replace (pfolder, folder);  /* update current folder   */
-       context_save ();  /* save the context file   */
-       folder_free (mp);  /* free folder structure   */
-       done (0);
+       seq_save(mp);  /* synchronize message sequences  */
+       context_replace(pfolder, folder);  /* update current folder   */
+       context_save();  /* save the context file   */
+       folder_free(mp);  /* free folder structure   */
+       done(0);
        return 1;
 }
index 3a0e6c6..03a260b 100644 (file)
@@ -57,7 +57,7 @@ void clear_screen(void);  /* from termsbr.c */
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int clearflag = 0, hdrflag = 0, ontty;
        int width = 0, revflag = 0;
@@ -73,13 +73,13 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       mts_init (invo_name);
-       arguments = getarguments (invo_name, argc, argv, 1);
+       mts_init(invo_name);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -87,20 +87,20 @@ main (int argc, char **argv)
        */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case CLRSW:
                                        clearflag++;
@@ -111,13 +111,13 @@ main (int argc, char **argv)
 
                                case FORMSW:
                                        if (!(form = *argp++) || *form == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        format = NULL;
                                        continue;
                                case FMTSW:
                                        if (!(format = *argp++) ||
                                                        *format == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        form = NULL;
                                        continue;
 
@@ -130,8 +130,8 @@ main (int argc, char **argv)
 
                                case WIDTHSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       width = atoi (cp);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       width = atoi(cp);
                                        continue;
                                case REVSW:
                                        revflag++;
@@ -142,62 +142,62 @@ main (int argc, char **argv)
 
                                case FILESW:
                                        if (!(cp = *argp++) || (cp[0] == '-' && cp[1]))
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       if (strcmp (file = cp, "-"))
-                                               file = path (cp, TFILE);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       if (strcmp(file = cp, "-"))
+                                               file = path(cp, TFILE);
                                        continue;
                        }
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else
                                app_msgarg(&msgs, cp);
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        /*
        ** Get new format string.  Must be before chdir().
        */
-       nfs = new_fs (form, format, FORMAT);
+       nfs = new_fs(form, format, FORMAT);
 
        /*
        ** We are scanning a maildrop file
        */
        if (file) {
                if (msgs.size)
-                       adios (NULL, "\"msgs\" not allowed with -file");
+                       adios(NULL, "\"msgs\" not allowed with -file");
                if (folder)
-                       adios (NULL, "\"+folder\" not allowed with -file");
+                       adios(NULL, "\"+folder\" not allowed with -file");
 
                /* check if "file" is really stdin */
-               if (strcmp (file, "-") == 0) {
+               if (strcmp(file, "-") == 0) {
                        in = stdin;
                        file = "stdin";
                } else {
-                       if ((in = fopen (file, "r")) == NULL)
-                               adios (file, "unable to open");
+                       if ((in = fopen(file, "r")) == NULL)
+                               adios(file, "unable to open");
                }
 
 #ifndef JLR
                if (hdrflag) {
-                       printf ("FOLDER %s\t%s\n", file, dtimenow (1));
+                       printf("FOLDER %s\t%s\n", file, dtimenow(1));
                }
 #endif /* JLR */
 
-               m_unknown (in);
+               m_unknown(in);
                for (msgnum = 1; ; ++msgnum) {
-                       state = scan (in, msgnum, -1, nfs, width, 0, 0,
+                       state = scan(in, msgnum, -1, nfs, width, 0, 0,
                                        hdrflag ? file : NULL, 0L, 1);
                        if (state != SCNMSG && state != SCNENC)
                                break;
                }
-               fclose (in);
-               done (0);
+               fclose(in);
+               done(0);
        }
 
        /*
@@ -207,48 +207,48 @@ main (int argc, char **argv)
        if (!msgs.size)
                app_msgarg(&msgs, "all");
        if (!folder)
-               folder = getfolder (1);
-       maildir = m_maildir (folder);
+               folder = getfolder(1);
+       maildir = m_maildir(folder);
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
        if (mp->nummsg == 0)
-               adios (NULL, "no messages in %s", folder);
+               adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
-               if (!m_convert (mp, msgs.msgs[msgnum]))
+               if (!m_convert(mp, msgs.msgs[msgnum]))
                        done(1);
-       seq_setprev (mp);  /* set the Previous-Sequence */
+       seq_setprev(mp);  /* set the Previous-Sequence */
 
-       context_replace (pfolder, folder);  /* update current folder */
-       seq_save (mp);  /* synchronize message sequences */
-       context_save ();  /* save the context file */
+       context_replace(pfolder, folder);  /* update current folder */
+       seq_save(mp);  /* synchronize message sequences */
+       context_save();  /* save the context file */
 
        /*
        ** Get the sequence number for each sequence
        ** specified by Unseen-Sequence
        */
-       if ((cp = context_find (usequence)) && *cp) {
+       if ((cp = context_find(usequence)) && *cp) {
                char **ap, *dp;
 
                dp = getcpy(cp);
-               ap = brkstring (dp, " ", "\n");
+               ap = brkstring(dp, " ", "\n");
                for (i = 0; ap && *ap; i++, ap++)
-                       seqnum[i] = seq_getnum (mp, *ap);
+                       seqnum[i] = seq_getnum(mp, *ap);
 
                num_unseen_seq = i;
                if (dp)
                        free(dp);
        }
 
-       ontty = isatty (fileno (stdout));
+       ontty = isatty(fileno(stdout));
 
 #ifdef LBL
        else
@@ -259,14 +259,14 @@ main (int argc, char **argv)
                 (revflag ? msgnum >= mp->lowsel : msgnum <= mp->hghsel);
                 msgnum += (revflag ? -1 : 1)) {
                if (is_selected(mp, msgnum)) {
-                       if ((in = fopen (cp = m_name (msgnum), "r")) == NULL) {
+                       if ((in = fopen(cp = m_name(msgnum), "r")) == NULL) {
 #if 0
                                if (errno != EACCES)
 #endif
-                                       admonish (cp, "unable to open message");
+                                       admonish(cp, "unable to open message");
 #if 0
                                else
-                                       printf ("%*d  unreadable\n",
+                                       printf("%*d  unreadable\n",
                                                        DMAXFOLDER, msgnum);
 #endif
                                continue;
@@ -274,8 +274,7 @@ main (int argc, char **argv)
 
 #ifndef JLR
                        if (hdrflag) {
-                               printf ("FOLDER %s\t%s\n", folder,
-                                               dtimenow(1));
+                               printf("FOLDER %s\t%s\n", folder, dtimenow(1));
                        }
 #endif /* JLR */
 
@@ -291,7 +290,7 @@ main (int argc, char **argv)
                                }
                        }
 
-                       switch (state = scan (in, msgnum, 0, nfs, width,
+                       switch (state = scan(in, msgnum, 0, nfs, width,
                                                msgnum == mp->curmsg, unseen,
                                                folder, 0L, 1)) {
                                case SCNMSG:
@@ -300,34 +299,33 @@ main (int argc, char **argv)
                                        break;
 
                                default:
-                                       adios (NULL, "scan() botch (%d)",
-                                                       state);
+                                       adios(NULL, "scan() botch(%d)", state);
 
                                case SCNEOF:
 #if 0
-                                       printf ("%*d  empty\n", DMAXFOLDER,
+                                       printf("%*d  empty\n", DMAXFOLDER,
                                                        msgnum);
 #else
-                                       advise (NULL, "message %d: empty",
+                                       advise(NULL, "message %d: empty",
                                                        msgnum);
 #endif
                                        break;
                        }
                        hdrflag = 0;
-                       fclose (in);
+                       fclose(in);
                        if (ontty)
-                               fflush (stdout);
+                               fflush(stdout);
                }
        }
 
 #ifdef LBL
-       seq_save (mp);  /* because formatsbr might have made changes */
+       seq_save(mp);  /* because formatsbr might have made changes */
 #endif
 
-       folder_free (mp);  /* free folder/message structure */
+       folder_free(mp);  /* free folder/message structure */
        if (clearflag)
-               clear_screen ();
+               clear_screen();
 
-       done (0);
+       done(0);
        return 1;
 }
index 67fc5eb..8a07418 100644 (file)
@@ -51,7 +51,7 @@ static int dat[5];  /* aux. data for format routine */
 
 char *scanl = 0;  /* text of most recent scanline */
 
-#define DIEWRERR() adios (scnmsg, "write error on")
+#define DIEWRERR() adios(scnmsg, "write error on")
 
 #define FPUTS(buf) {\
                if (mh_fputs(buf,scnout) == EOF)\
@@ -61,7 +61,7 @@ char *scanl = 0;  /* text of most recent scanline */
 /*
 ** prototypes
 */
-int sc_width (void);  /* from termsbr.c */
+int sc_width(void);  /* from termsbr.c */
 static int mh_fputs(char *, FILE *);
 
 #ifdef MULTIBYTE_SUPPORT
@@ -71,7 +71,7 @@ static int mh_fputs(char *, FILE *);
 #endif
 
 int
-scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
+scan(FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
        int unseen, char *folder, long size, int noisy)
 {
        int i, compnum, encrypted, state;
@@ -93,7 +93,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
        /* first-time only initialization */
        if (!scanl) {
                if (width == 0) {
-                       if ((width = sc_width ()) < WIDTH/2)
+                       if ((width = sc_width()) < WIDTH/2)
                                width = WIDTH/2;
                        else if (width > MAXSCANL)
                                width = MAXSCANL;
@@ -105,7 +105,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
                        umask(~m_gmprot());
 
                /* Compile format string */
-               ncomps = fmt_compile (nfs, &fmt) + 1;
+               ncomps = fmt_compile(nfs, &fmt) + 1;
 
 #ifdef JLR
                fmt_top = fmt;
@@ -117,24 +117,23 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
                        cptr->c_text = folder;
                FINDCOMP(cptr, "encrypted");
                if (!cptr)
-                       if ((cptr = (struct comp *) calloc (1,
-                                       sizeof(*cptr)))) {
+                       if ((cptr = (struct comp *)calloc(1, sizeof(*cptr)))) {
                                cptr->c_name = "encrypted";
-                               cptr->c_next = wantcomp[i = CHASH (cptr->c_name)];
+                               cptr->c_next = wantcomp[i = CHASH(cptr->c_name)];
                                wantcomp[i] = cptr;
                                ncomps++;
                }
-               FINDCOMP (cptr, "dtimenow");
+               FINDCOMP(cptr, "dtimenow");
                if (cptr)
-                       cptr->c_text = getcpy(dtimenow (0));
+                       cptr->c_text = getcpy(dtimenow(0));
                nxtbuf = compbuffers = (char **) calloc((size_t) ncomps,
                                sizeof(char *));
                if (nxtbuf == NULL)
-                       adios (NULL, "unable to allocate component buffers");
+                       adios(NULL, "unable to allocate component buffers");
                used_buf = (struct comp **) calloc((size_t) (ncomps+1),
                        sizeof(struct comp *));
                if (used_buf == NULL)
-                       adios (NULL, "unable to allocate component buffer stack");
+                       adios(NULL, "unable to allocate component buffer stack");
                used_buf += ncomps+1; *--used_buf = 0;
                rlwidth = bodycomp && (width > SBUFSIZ) ? width : SBUFSIZ;
                for (i = ncomps; i--; )
@@ -155,7 +154,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
        ** Get the first field.  If the message is non-empty
        ** and we're doing an "inc", open the output file.
        */
-       if ((state = m_getfld (FLD, name, tmpbuf, rlwidth, inb)) == FILEEOF) {
+       if ((state = m_getfld(FLD, name, tmpbuf, rlwidth, inb)) == FILEEOF) {
                if (ferror(inb)) {
                        advise("read", "unable to"); /* "read error" */
                        return SCNFAT;
@@ -166,41 +165,41 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
 
        if (outnum) {
                if (outnum > 0) {
-                       scnmsg = m_name (outnum);
+                       scnmsg = m_name(outnum);
                        if (*scnmsg == '?')  /* msg num out of range */
                                return SCNNUM;
                } else {
                        scnmsg = "/dev/null";
                }
-               if ((scnout = fopen (scnmsg, "w")) == NULL)
-                       adios (scnmsg, "unable to write");
+               if ((scnout = fopen(scnmsg, "w")) == NULL)
+                       adios(scnmsg, "unable to write");
 #ifdef RPATHS
                /*
                ** Add the Return-Path and Delivery-Date
                ** header fields to message.
                */
-               if (get_returnpath (returnpath, sizeof(returnpath),
+               if (get_returnpath(returnpath, sizeof(returnpath),
                                deliverydate, sizeof(deliverydate))) {
-                       FPUTS ("Return-Path: ");
-                       FPUTS (returnpath);
-                       FPUTS ("Delivery-Date: ");
-                       FPUTS (deliverydate);
+                       FPUTS("Return-Path: ");
+                       FPUTS(returnpath);
+                       FPUTS("Delivery-Date: ");
+                       FPUTS(deliverydate);
                }
 #endif /* RPATHS */
        }
 
        /* scan - main loop */
        for (compnum = 1; ;
-                       state = m_getfld (state, name, tmpbuf, rlwidth, inb)) {
+                       state = m_getfld(state, name, tmpbuf, rlwidth, inb)) {
                switch (state) {
                        case FLD:
                        case FLDPLUS:
                                compnum++;
                                if (outnum) {
-                                       FPUTS (name);
-                                       if ( putc (':', scnout) == EOF)
+                                       FPUTS(name);
+                                       if (putc(':', scnout) == EOF)
                                                DIEWRERR();
-                                       FPUTS (tmpbuf);
+                                       FPUTS(tmpbuf);
                                }
                                /*
                                ** if we're interested in this component,
@@ -215,9 +214,9 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
                                                if (!mh_strcasecmp(name, cptr->c_name)) {
                                                        if (! cptr->c_text) {
                                                                cptr->c_text = tmpbuf;
-                                                               for (cp = tmpbuf + strlen (tmpbuf) - 1;
+                                                               for (cp = tmpbuf + strlen(tmpbuf) - 1;
                                                                                cp >= tmpbuf; cp--)
-                                                                       if (isspace (*cp))
+                                                                       if (isspace(*cp))
                                                                                *cp = 0;
                                                                        else
                                                                                break;
@@ -230,9 +229,10 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
                                }
 
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, name, tmpbuf, rlwidth, inb);
+                                       state = m_getfld(state, name, tmpbuf,
+                                                       rlwidth, inb);
                                        if (outnum)
-                                               FPUTS (tmpbuf);
+                                               FPUTS(tmpbuf);
                                }
                                break;
 
@@ -242,8 +242,8 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
                                        state = FILEEOF; /* stop now if scan cmd */
                                        goto finished;
                                }
-                               if (putc ('\n', scnout) == EOF) DIEWRERR();
-                               FPUTS (tmpbuf);
+                               if (putc('\n', scnout) == EOF) DIEWRERR();
+                               FPUTS(tmpbuf);
                                /*
                                ** performance hack: some people like to
                                ** run "inc" on things like net.sources or
@@ -267,14 +267,14 @@ body:;
                                        if (scnout->_cnt <= 0) {
 #endif
                                                if (fflush(scnout) == EOF)
-                                                       DIEWRERR ();
+                                                       DIEWRERR();
                                        }
 #ifdef LINUX_STDIO
                                        state = m_getfld(state, name, scnout->_IO_write_ptr,
                                                (long)scnout->_IO_write_ptr-(long)scnout->_IO_write_end , inb);
                                        scnout->_IO_write_ptr += msg_count;
 #elif defined(__DragonFly__)
-                                       state = m_getfld( state, name, ((struct __FILE_public *)scnout)->_p, -(((struct __FILE_public *)scnout)->_w), inb );
+                                       state = m_getfld(state, name, ((struct __FILE_public *)scnout)->_p, -(((struct __FILE_public *)scnout)->_w), inb );
                                        ((struct __FILE_public *)scnout)->_w -= msg_count;
                                        ((struct __FILE_public *)scnout)->_p += msg_count;
 #else
@@ -287,13 +287,14 @@ body:;
 
                        case LENERR:
                        case FMTERR:
-                               fprintf (stderr, innum ? "??Format error (message %d) in " : "??Format error in ", outnum ? outnum : innum);
-                               fprintf (stderr, "component %d\n", compnum);
+                               fprintf(stderr, innum ? "??Format error (message %d) in " : "??Format error in ", outnum ? outnum : innum);
+                               fprintf(stderr, "component %d\n", compnum);
 
                                if (outnum) {
-                                       FPUTS ("\n\nBAD MSG:\n");
-                                       FPUTS (name);
-                                       if (putc ('\n', scnout) == EOF) DIEWRERR();
+                                       FPUTS("\n\nBAD MSG:\n");
+                                       FPUTS(name);
+                                       if (putc('\n', scnout) == EOF)
+                                               DIEWRERR();
                                        state = BODY;
                                        goto body;
                                }
@@ -303,7 +304,7 @@ body:;
                                goto finished;
 
                        default:
-                               adios (NULL, "getfld() returned %d", state);
+                               adios(NULL, "getfld() returned %d", state);
                }
        }
 
@@ -326,23 +327,23 @@ finished:
                dat[2] = size;
        else if (outnum > 0) {
                dat[2] = ftell(scnout);
-               if (dat[2] == EOF) DIEWRERR();
+               if (dat[2] == EOF)
+                       DIEWRERR();
        }
 
        if ((datecomp && !datecomp->c_text) || (!size && !outnum)) {
                struct stat st;
 
-               fstat (fileno(inb), &st);
+               fstat(fileno(inb), &st);
                if (!size && !outnum)
                        dat[2] = st.st_size;
                if (datecomp) {
                        if (! datecomp->c_text) {
                                if (datecomp->c_tws == NULL)
-                                       datecomp->c_tws = (struct tws *)
-                                               calloc((size_t) 1, sizeof(*datecomp->c_tws));
+                                       datecomp->c_tws = (struct tws *) calloc((size_t) 1, sizeof(*datecomp->c_tws));
                                if (datecomp->c_tws == NULL)
-                                       adios (NULL, "unable to allocate tws buffer");
-                               *datecomp->c_tws = *dlocaltime ((time_t *) &st.st_mtime);
+                                       adios(NULL, "unable to allocate tws buffer");
+                               *datecomp->c_tws = *dlocaltime((time_t *) &st.st_mtime);
                                datecomp->c_flags |= CF_DATEFAB|CF_TRUE;
                        } else {
                                datecomp->c_flags &= ~CF_DATEFAB;
@@ -350,10 +351,10 @@ finished:
                }
        }
 
-       fmt_scan (fmt, scanl, slwidth, dat);
+       fmt_scan(fmt, scanl, slwidth, dat);
 
 #if 0
-       fmt = fmt_scan (fmt, scanl, slwidth, dat);
+       fmt = fmt_scan(fmt, scanl, slwidth, dat);
        if (!fmt)
                fmt = fmt_top;  /* reset for old format files */
 #endif
@@ -362,9 +363,9 @@ finished:
                bodycomp->c_text = saved_c_text;
 
        if (noisy)
-               fputs (scanl, stdout);
+               fputs(scanl, stdout);
 
-       FINDCOMP (cptr, "encrypted");
+       FINDCOMP(cptr, "encrypted");
        encrypted = cptr && cptr->c_text;
 
        /* return dynamically allocated buffers to pool */
@@ -374,7 +375,7 @@ finished:
        }
        *--nxtbuf = tmpbuf;
 
-       if (outnum && (ferror(scnout) || fclose (scnout) == EOF))
+       if (outnum && (ferror(scnout) || fclose(scnout) == EOF))
                DIEWRERR();
 
        return (state != FILEEOF ? SCNERR : encrypted ? SCNENC : SCNMSG);
@@ -386,7 +387,7 @@ mh_fputs(char *s, FILE *stream)
        char c;
 
        while ((c = *s++))
-               if (putc (c,stream) == EOF )
+               if (putc(c,stream) == EOF )
                        return(EOF);
        return (0);
 }
index 043e05e..2416baf 100644 (file)
@@ -99,7 +99,7 @@ extern char *distfile;
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int msgp = 0, distsw = 0, vecp = 1;
        int mime = 0;
@@ -118,35 +118,35 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        vec[vecp++] = "-library";
-       vec[vecp++] = getcpy (m_maildir (""));
+       vec[vecp++] = getcpy(m_maildir(""));
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown\n", cp);
+                                       adios(NULL, "-%s unknown\n", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf),
+                                       snprintf(buf, sizeof(buf),
                                                        "%s [file] [switches]",
                                                        invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case PUSHSW:
                                        pushsw++;
@@ -214,23 +214,24 @@ main (int argc, char **argv)
                                case PORTSW:
                                        vec[vecp++] = --cp;
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        vec[vecp++] = cp;
                                        continue;
 
                                case ATTACHSW:
-                                       if (!(attach = *argp++) || *attach == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                       if (!(attach = *argp++) ||
+                                                       *attach == '-')
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case ATTACHFORMATSW:
                                        if (! *argp || **argp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-1]);
+                                               adios(NULL, "missing argument to %s", argp[-1]);
                                        else {
-                                               attachformat = atoi (*argp);
+                                               attachformat = atoi(*argp);
                                                if (attachformat < 0 ||
                                                        attachformat > ATTACHFORMATS - 1) {
-                                                       advise (NULL, "unsupported attachformat %d",
+                                                       advise(NULL, "unsupported attachformat %d",
                                                                        attachformat);
                                                        continue;
                                                }
@@ -246,7 +247,7 @@ main (int argc, char **argv)
        /*
        ** check for "Aliasfile:" profile entry
        */
-       if ((cp = context_find ("Aliasfile"))) {
+       if ((cp = context_find("Aliasfile"))) {
                char *dp = NULL;
 
                for (ap = brkstring(dp = getcpy(cp), " ", "\n"); ap && *ap;
@@ -256,121 +257,118 @@ main (int argc, char **argv)
                }
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        if (!msgp)
                msgs[msgp++] = "cur";
-       maildir = m_maildir (draftfolder);
+       maildir = m_maildir(draftfolder);
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (draftfolder)))
-               adios (NULL, "unable to read draft folder %s", draftfolder);
+       if (!(mp = folder_read(draftfolder)))
+               adios(NULL, "unable to read draft folder %s", draftfolder);
 
        /* check for empty folder */
        if (mp->nummsg == 0)
-               adios (NULL, "no messages in draft folder %s", draftfolder);
+               adios(NULL, "no messages in draft folder %s", draftfolder);
 
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgp; msgnum++)
-               if (!m_convert (mp, msgs[msgnum]))
-                       done (1);
-       seq_setprev (mp);  /* set the previous-sequence */
+               if (!m_convert(mp, msgs[msgnum]))
+                       done(1);
+       seq_setprev(mp);  /* set the previous-sequence */
 
        for (msgp = 0, msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
-               if (is_selected (mp, msgnum)) {
-                       msgs[msgp++] = getcpy (m_name (msgnum));
-                       unset_exists (mp, msgnum);
+               if (is_selected(mp, msgnum)) {
+                       msgs[msgp++] = getcpy(m_name(msgnum));
+                       unset_exists(mp, msgnum);
                }
        }
 
        mp->msgflags |= SEQMOD;
-       seq_save (mp);
+       seq_save(mp);
 
-       if ((cp = getenv ("SIGNATURE")) == NULL || *cp == 0)
-               if ((cp = context_find ("signature")) && *cp)
-                       m_putenv ("SIGNATURE", cp);
+       if ((cp = getenv("SIGNATURE")) == NULL || *cp == 0)
+               if ((cp = context_find("signature")) && *cp)
+                       m_putenv("SIGNATURE", cp);
 #ifdef UCI
                else {
-                       snprintf (buf, sizeof(buf), "%s/.signature", mypath);
-                       if ((fp = fopen (buf, "r")) != NULL &&
+                       snprintf(buf, sizeof(buf), "%s/.signature", mypath);
+                       if ((fp = fopen(buf, "r")) != NULL &&
                                        fgets(buf, sizeof buf, fp) != NULL) {
-                                       fclose (fp);
-                                       if (cp = strchr (buf, '\n'))
+                                       fclose(fp);
+                                       if (cp = strchr(buf, '\n'))
                                                *cp = 0;
-                                       m_putenv ("SIGNATURE", buf);
+                                       m_putenv("SIGNATURE", buf);
                        }
                }
 #endif /* UCI */
 
        for (msgnum = 0; msgnum < msgp; msgnum++)
-               if (stat (msgs[msgnum], &st) == NOTOK)
-                       adios (msgs[msgnum], "unable to stat draft file");
+               if (stat(msgs[msgnum], &st) == NOTOK)
+                       adios(msgs[msgnum], "unable to stat draft file");
 
-       if ((annotext = getenv ("mhannotate")) == NULL || *annotext == 0)
+       if ((annotext = getenv("mhannotate")) == NULL || *annotext == 0)
                annotext = NULL;
-       if (annotext && ((cp = getenv ("mhinplace")) != NULL && *cp != 0))
-               inplace = atoi (cp);
-       if ((altmsg = getenv ("mhaltmsg")) == NULL || *altmsg == 0)
+       if (annotext && ((cp = getenv("mhinplace")) != NULL && *cp != 0))
+               inplace = atoi(cp);
+       if ((altmsg = getenv("mhaltmsg")) == NULL || *altmsg == 0)
                altmsg = NULL;  /* used by dist interface - see below */
 
-       if ((cp = getenv ("mhdist"))
-                       && *cp
-                       && (distsw = atoi (cp))
-                       && altmsg) {
+       if ((cp = getenv("mhdist")) && *cp && (distsw = atoi (cp)) && altmsg) {
                vec[vecp++] = "-dist";
-               distfile = getcpy (m_mktemp2 (altmsg, invo_name, NULL, NULL));
-               if (link (altmsg, distfile) == NOTOK) {
+               distfile = getcpy(m_mktemp2(altmsg, invo_name, NULL, NULL));
+               if (link(altmsg, distfile) == NOTOK) {
                        if (errno != EXDEV
 #ifdef EISREMOTE
                                        && errno != EISREMOTE
 #endif /* EISREMOTE */
                                )
-                               adios (distfile, "unable to link %s to",
+                               adios(distfile, "unable to link %s to",
                                                altmsg);
-                       free (distfile);
-                       distfile = getcpy (m_mktemp2(NULL, invo_name,
+                       free(distfile);
+                       distfile = getcpy(m_mktemp2(NULL, invo_name,
                                        NULL, NULL));
                        {
                                int in, out;
                                struct stat st;
 
-                               if ((in = open (altmsg, O_RDONLY)) == NOTOK)
-                                       adios (altmsg, "unable to open");
+                               if ((in = open(altmsg, O_RDONLY)) == NOTOK)
+                                       adios(altmsg, "unable to open");
                                fstat(in, &st);
-                               if ((out = creat (distfile,
+                               if ((out = creat(distfile,
                                                (int) st.st_mode & 0777))
                                                == NOTOK)
-                                       adios (distfile, "unable to write");
-                               cpydata (in, out, altmsg, distfile);
-                               close (in);
-                               close (out);
+                                       adios(distfile, "unable to write");
+                               cpydata(in, out, altmsg, distfile);
+                               close(in);
+                               close(out);
                        }
                }
        } else {
                distfile = NULL;
        }
 
-       if (altmsg == NULL || stat (altmsg, &st) == NOTOK) {
+       if (altmsg == NULL || stat(altmsg, &st) == NOTOK) {
                st.st_mtime = 0;
                st.st_dev = 0;
                st.st_ino = 0;
        }
        if (pushsw)
-               push ();
+               push();
 
        status = 0;
-       vec[0] = r1bindex (postproc, '/');
-       closefds (3);
+       vec[0] = r1bindex(postproc, '/');
+       closefds(3);
 
        for (msgnum = 0; msgnum < msgp; msgnum++) {
-               switch (sendsbr (vec, vecp, msgs[msgnum], &st, 1, attach,
+               switch (sendsbr(vec, vecp, msgs[msgnum], &st, 1, attach,
                                attachformat)) {
                        case DONE:
-                               done (++status);
+                               done(++status);
                        case NOTOK:
                                status++;  /* fall */
                        case OK:
@@ -378,7 +376,7 @@ main (int argc, char **argv)
                }
        }
 
-       context_save ();  /* save the context file */
-       done (status);
+       context_save();  /* save the context file */
+       done(status);
        return 1;
 }
index 0cae878..c7f4d44 100644 (file)
@@ -52,18 +52,18 @@ static FILE *composition_file;  /* composition file pointer */
 /*
 ** external prototypes
 */
-int sendsbr (char **, int, char *, struct stat *, int, char *, int);
-char *getusername (void);
+int sendsbr(char **, int, char *, struct stat *, int, char *, int);
+char *getusername(void);
 
 /*
 ** static prototypes
 */
-static void armed_done (int) NORETURN;
-static void alert (char *, int);
-static int tmp_fd (void);
-static void anno (int, struct stat *);
-static void annoaux (int);
-static int sendaux (char **, int, char *, struct stat *);
+static void armed_done(int) NORETURN;
+static void alert(char *, int);
+static int tmp_fd(void);
+static void anno(int, struct stat *);
+static void annoaux(int);
+static int sendaux(char **, int, char *, struct stat *);
 
 static int attach(char *, char *, int);
 static void clean_up_temporary_files(void);
@@ -76,7 +76,7 @@ static void make_mime_composition_file_entry(char *, int);
 */
 
 int
-sendsbr (char **vec, int vecp, char *drft, struct stat *st,
+sendsbr(char **vec, int vecp, char *drft, struct stat *st,
        int rename_drft, char *attachment_header_field_name, int attachformat)
 {
        int status;
@@ -119,7 +119,7 @@ sendsbr (char **vec, int vecp, char *drft, struct stat *st,
        }
 
        done=armed_done;
-       switch (setjmp (env)) {
+       switch (setjmp(env)) {
        case OK:
                /*
                ** If given -push and -unique (which is undocumented), then
@@ -128,20 +128,22 @@ sendsbr (char **vec, int vecp, char *drft, struct stat *st,
                if (pushsw && unique) {
                        char *cp = m_mktemp2(drft, invo_name, NULL, NULL);
                        if (cp == NULL) {
-                               adios ("sendsbr", "unable to create temporary file");
+                               adios("sendsbr", "unable to create temporary file");
                        }
-                       if (rename (drft, strncpy(file, cp, sizeof(file)))
+                       if (rename(drft, strncpy(file, cp, sizeof(file)))
                                        == NOTOK)
-                               adios (file, "unable to rename %s to", drft);
+                               adios(file, "unable to rename %s to", drft);
                        drft = file;
                }
 
-               status = sendaux (vec, vecp, drft, st) ? NOTOK : OK;
+               status = sendaux(vec, vecp, drft, st) ? NOTOK : OK;
 
                /* rename the original draft */
                if (rename_drft && status == OK &&
-                               rename (original_draft, strncpy (buffer, m_backup (original_draft), sizeof(buffer))) == NOTOK)
-                       advise (buffer, "unable to rename %s to", drft);
+                               rename(original_draft, strncpy(buffer,
+                               m_backup(original_draft), sizeof(buffer)))
+                               == NOTOK)
+                       advise(buffer, "unable to rename %s to", drft);
                break;
 
        default:
@@ -151,7 +153,7 @@ sendsbr (char **vec, int vecp, char *drft, struct stat *st,
 
        done=exit;
        if (distfile)
-               unlink (distfile);
+               unlink(distfile);
 
        /*
        ** Get rid of any temporary files that we created for attachments.
@@ -510,20 +512,20 @@ make_mime_composition_file_entry(char *file_name, int attachformat)
 
                break;
        case 1:
-               if (stringdex (m_maildir(invo_name), file_name) == 0) {
+               if (stringdex(m_maildir(invo_name), file_name) == 0) {
                        /*
                        ** Content had been placed by send into a temp file.
                        ** Don't generate Content-Disposition header, because
                        ** it confuses Microsoft Outlook, Build 10.0.6626, at
                        ** least.
                        */
-                       (void) fprintf (composition_file, "#%s <>", content_type);
+                       fprintf(composition_file, "#%s <>", content_type);
                } else {
                        /*
                        ** Suppress Content-Id, insert simple
                        ** Content-Disposition.
                        */
-                       (void) fprintf (composition_file,
+                       fprintf(composition_file,
                                "#%s; name=\"%s\" <>{attachment}",
                                content_type,
                                ((p = strrchr(file_name, '/')) == (char *)0) ?
@@ -532,30 +534,29 @@ make_mime_composition_file_entry(char *file_name, int attachformat)
 
                break;
        case 2:
-               if (stringdex (m_maildir(invo_name), file_name) == 0) {
+               if (stringdex(m_maildir(invo_name), file_name) == 0) {
                        /*
                        ** Content had been placed by send into a temp file.
                        ** Don't generate Content-Disposition header, because
                        ** it confuses Microsoft Outlook, Build 10.0.6626, at
                        ** least.
                        */
-                       (void) fprintf (composition_file, "#%s <>",
-                                       content_type);
+                       fprintf(composition_file, "#%s <>", content_type);
                } else {
                        /*
                        ** Suppress Content-Id, insert Content-Disposition
                        ** with modification date.
                        */
-                       (void) fprintf (composition_file,
+                       fprintf(composition_file,
                                "#%s; name=\"%s\" <>{attachment; modification-date=\"%s\"}",
                                content_type,
                                ((p = strrchr(file_name, '/')) == (char *)0) ?
-                               file_name : p + 1, dtime (&st.st_mtime, 0));
+                               file_name : p + 1, dtime(&st.st_mtime, 0));
                }
 
                break;
        default:
-               adios ((char *)0, "unsupported attachformat %d", attachformat);
+               adios((char *)0, "unsupported attachformat %d", attachformat);
        }
 
        /*
@@ -573,36 +574,36 @@ make_mime_composition_file_entry(char *file_name, int attachformat)
 */
 
 static int
-sendaux (char **vec, int vecp, char *drft, struct stat *st)
+sendaux(char **vec, int vecp, char *drft, struct stat *st)
 {
        pid_t child_id;
        int i, status, fd, fd2;
        char backup[BUFSIZ], buf[BUFSIZ];
 
-       fd = pushsw ? tmp_fd () : NOTOK;
+       fd = pushsw ? tmp_fd() : NOTOK;
        fd2 = NOTOK;
 
        vec[vecp++] = drft;
        if (annotext) {
-               if ((fd2 = tmp_fd ()) != NOTOK) {
+               if ((fd2 = tmp_fd()) != NOTOK) {
                        vec[vecp++] = "-idanno";
-                       snprintf (buf, sizeof(buf), "%d", fd2);
+                       snprintf(buf, sizeof(buf), "%d", fd2);
                        vec[vecp++] = buf;
                } else {
-                       admonish (NULL, "unable to create file for annotation list");
+                       admonish(NULL, "unable to create file for annotation list");
                }
        }
-       if (distfile && distout (drft, distfile, backup) == NOTOK)
-               done (1);
+       if (distfile && distout(drft, distfile, backup) == NOTOK)
+               done(1);
        vec[vecp] = NULL;
 
        for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
-               sleep (5);
+               sleep(5);
 
        switch (child_id) {
        case -1:
                /* oops -- fork error */
-               adios ("fork", "unable to");
+               adios("fork", "unable to");
                break;  /* NOT REACHED */
 
        case 0:
@@ -613,14 +614,14 @@ sendaux (char **vec, int vecp, char *drft, struct stat *st)
                ** file, so capture anything on stdout and stderr there.
                */
                if (fd != NOTOK) {
-                       dup2 (fd, fileno (stdout));
-                       dup2 (fd, fileno (stderr));
-                       close (fd);
+                       dup2(fd, fileno(stdout));
+                       dup2(fd, fileno(stderr));
+                       close(fd);
                }
-               execvp (postproc, vec);
-               fprintf (stderr, "unable to exec ");
-               perror (postproc);
-               _exit (-1);
+               execvp(postproc, vec);
+               fprintf(stderr, "unable to exec ");
+               perror(postproc);
+               _exit(-1);
                break;  /* NOT REACHED */
 
        default:
@@ -629,7 +630,7 @@ sendaux (char **vec, int vecp, char *drft, struct stat *st)
                */
                if ((status = pidwait(child_id, NOTOK)) == OK) {
                        if (annotext && fd2 != NOTOK)
-                               anno (fd2, st);
+                               anno(fd2, st);
                } else {
                        /*
                        ** If postproc failed, and we have good fd (which
@@ -637,17 +638,17 @@ sendaux (char **vec, int vecp, char *drft, struct stat *st)
                        ** (and possibly the draft) back to the user.
                        */
                        if (fd != NOTOK) {
-                               alert (drft, fd);
-                               close (fd);
+                               alert(drft, fd);
+                               close(fd);
                        } else {
-                               advise (NULL, "message not delivered to anyone");
+                               advise(NULL, "message not delivered to anyone");
                        }
                        if (annotext && fd2 != NOTOK)
-                               close (fd2);
+                               close(fd2);
                        if (distfile) {
-                               unlink (drft);
-                               if (rename (backup, drft) == NOTOK)
-                                       advise (drft, "unable to rename %s to",
+                               unlink(drft);
+                               if (rename(backup, drft) == NOTOK)
+                                       advise(drft, "unable to rename %s to",
                                                        backup);
                        }
                }
@@ -664,57 +665,55 @@ sendaux (char **vec, int vecp, char *drft, struct stat *st)
 */
 
 static void
-alert (char *file, int out)
+alert(char *file, int out)
 {
        pid_t child_id;
        int i, in;
        char buf[BUFSIZ];
 
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
-               sleep (5);
+               sleep(5);
 
        switch (child_id) {
                case NOTOK:
                        /* oops -- fork error */
-                       advise ("fork", "unable to");
+                       advise("fork", "unable to");
 
                case OK:
                        /* child process -- send it */
-                       SIGNAL (SIGHUP, SIG_IGN);
-                       SIGNAL (SIGINT, SIG_IGN);
-                       SIGNAL (SIGQUIT, SIG_IGN);
-                       SIGNAL (SIGTERM, SIG_IGN);
+                       SIGNAL(SIGHUP, SIG_IGN);
+                       SIGNAL(SIGINT, SIG_IGN);
+                       SIGNAL(SIGQUIT, SIG_IGN);
+                       SIGNAL(SIGTERM, SIG_IGN);
                        if (forwsw) {
-                               if ((in = open (file, O_RDONLY)) == NOTOK) {
-                                       admonish (file, "unable to re-open");
+                               if ((in = open(file, O_RDONLY)) == NOTOK) {
+                                       admonish(file, "unable to re-open");
                                } else {
-                                       lseek (out, (off_t) 0, SEEK_END);
-                                       strncpy (buf, "\nMessage not delivered to anyone.\n", sizeof(buf));
-                                       write (out, buf, strlen (buf));
-                                       strncpy (buf, "\n------- Unsent Draft\n\n", sizeof(buf));
-                                       write (out, buf, strlen (buf));
-                                       cpydgst (in, out, file, "temporary file");
-                                       close (in);
-                                       strncpy (buf, "\n------- End of Unsent Draft\n", sizeof(buf));
-                                       write (out, buf, strlen (buf));
-                                       if (rename (file, strncpy (buf, m_backup (file), sizeof(buf))) == NOTOK)
-                                               admonish (buf, "unable to rename %s to", file);
+                                       lseek(out, (off_t) 0, SEEK_END);
+                                       strncpy(buf, "\nMessage not delivered to anyone.\n", sizeof(buf));
+                                       write(out, buf, strlen(buf));
+                                       strncpy(buf, "\n------- Unsent Draft\n\n", sizeof(buf));
+                                       write(out, buf, strlen(buf));
+                                       cpydgst(in, out, file, "temporary file");
+                                       close(in);
+                                       strncpy(buf, "\n------- End of Unsent Draft\n", sizeof(buf));
+                                       write(out, buf, strlen(buf));
+                                       if (rename(file, strncpy(buf, m_backup(file), sizeof(buf))) == NOTOK)
+                                               admonish(buf, "unable to rename %s to", file);
                                }
                        }
-                       lseek (out, (off_t) 0, SEEK_SET);
-                       dup2 (out, fileno (stdin));
-                       close (out);
+                       lseek(out, (off_t) 0, SEEK_SET);
+                       dup2(out, fileno(stdin));
+                       close(out);
                        /* create subject for error notification */
-                       snprintf (buf, sizeof(buf), "send failed on %s",
-                                               forwsw ?
-                                               "enclosed draft" : file);
+                       snprintf(buf, sizeof(buf), "send failed on %s",
+                                       forwsw ? "enclosed draft" : file);
 
-                       execlp (mailproc, r1bindex (mailproc, '/'),
-                                       getusername (),
-                                       "-subject", buf, NULL);
-                       fprintf (stderr, "unable to exec ");
-                       perror (mailproc);
-                       _exit (-1);
+                       execlp(mailproc, r1bindex(mailproc, '/'),
+                                       getusername(), "-subject", buf, NULL);
+                       fprintf(stderr, "unable to exec ");
+                       perror(mailproc);
+                       _exit(-1);
 
                default:  /* no waiting... */
                        break;
@@ -723,7 +722,7 @@ alert (char *file, int out)
 
 
 static int
-tmp_fd (void)
+tmp_fd(void)
 {
        int fd;
        char *tfile = NULL;
@@ -733,69 +732,68 @@ tmp_fd (void)
        fchmod(fd, 0600);
 
        if (debugsw)
-               advise (NULL, "temporary file %s selected", tfile);
+               advise(NULL, "temporary file %s selected", tfile);
        else
-               if (unlink (tfile) == NOTOK)
-                       advise (tfile, "unable to remove");
+               if (unlink(tfile) == NOTOK)
+                       advise(tfile, "unable to remove");
 
        return fd;
 }
 
 
 static void
-anno (int fd, struct stat *st)
+anno(int fd, struct stat *st)
 {
        pid_t child_id;
        sigset_t set, oset;
        static char *cwd = NULL;
        struct stat st2;
 
-       if (altmsg &&
-                       (stat (altmsg, &st2) == NOTOK
-                               || st->st_mtime != st2.st_mtime
-                               || st->st_dev != st2.st_dev
-                               || st->st_ino != st2.st_ino)) {
+       if (altmsg && (stat(altmsg, &st2) == NOTOK ||
+                       st->st_mtime != st2.st_mtime ||
+                       st->st_dev != st2.st_dev ||
+                       st->st_ino != st2.st_ino)) {
                if (debugsw)
-                       admonish (NULL, "$mhaltmsg mismatch");
+                       admonish(NULL, "$mhaltmsg mismatch");
                return;
        }
 
-       child_id = debugsw ? NOTOK : fork ();
+       child_id = debugsw ? NOTOK : fork();
        switch (child_id) {
                case NOTOK:  /* oops */
                        if (!debugsw)
-                               advise (NULL, "unable to fork, so doing annotations by hand...");
+                               advise(NULL, "unable to fork, so doing annotations by hand...");
                        if (cwd == NULL)
-                               cwd = getcpy (pwd ());
+                               cwd = getcpy(pwd());
 
                case OK:
                        /* block a few signals */
-                       sigemptyset (&set);
-                       sigaddset (&set, SIGHUP);
-                       sigaddset (&set, SIGINT);
-                       sigaddset (&set, SIGQUIT);
-                       sigaddset (&set, SIGTERM);
-                       SIGPROCMASK (SIG_BLOCK, &set, &oset);
-
-                       annoaux (fd);
+                       sigemptyset(&set);
+                       sigaddset(&set, SIGHUP);
+                       sigaddset(&set, SIGINT);
+                       sigaddset(&set, SIGQUIT);
+                       sigaddset(&set, SIGTERM);
+                       SIGPROCMASK(SIG_BLOCK, &set, &oset);
+
+                       annoaux(fd);
                        if (child_id == OK)
-                               _exit (0);
+                               _exit(0);
 
                        /* reset the signal mask */
-                       SIGPROCMASK (SIG_SETMASK, &oset, &set);
+                       SIGPROCMASK(SIG_SETMASK, &oset, &set);
 
-                       chdir (cwd);
+                       chdir(cwd);
                        break;
 
                default:  /* no waiting... */
-                       close (fd);
+                       close(fd);
                        break;
        }
 }
 
 
 static void
-annoaux (int fd)
+annoaux(int fd)
 {
        int fd2, fd3, msgnum;
        char *cp, *folder, *maildir;
@@ -803,88 +801,89 @@ annoaux (int fd)
        FILE *fp;
        struct msgs *mp;
 
-       if ((folder = getenv ("mhfolder")) == NULL || *folder == 0) {
+       if ((folder = getenv("mhfolder")) == NULL || *folder == 0) {
                if (debugsw)
-                       admonish (NULL, "$mhfolder not set");
+                       admonish(NULL, "$mhfolder not set");
                return;
        }
-       maildir = m_maildir (folder);
-       if (chdir (maildir) == NOTOK) {
+       maildir = m_maildir(folder);
+       if (chdir(maildir) == NOTOK) {
                if (debugsw)
-                       admonish (maildir, "unable to change directory to");
+                       admonish(maildir, "unable to change directory to");
                return;
        }
-       if (!(mp = folder_read (folder))) {
+       if (!(mp = folder_read(folder))) {
                if (debugsw)
-                       admonish (NULL, "unable to read folder %s", folder);
+                       admonish(NULL, "unable to read folder %s", folder);
                return;
        }
 
        /* check for empty folder */
        if (mp->nummsg == 0) {
                if (debugsw)
-                       admonish (NULL, "no messages in %s", folder);
+                       admonish(NULL, "no messages in %s", folder);
                goto oops;
        }
 
-       if ((cp = getenv ("mhmessages")) == NULL || *cp == 0) {
+       if ((cp = getenv("mhmessages")) == NULL || *cp == 0) {
                if (debugsw)
-                       admonish (NULL, "$mhmessages not set");
+                       admonish(NULL, "$mhmessages not set");
                goto oops;
        }
        if (!debugsw  /* MOBY HACK... */
                        && pushsw
-                       && (fd3 = open ("/dev/null", O_RDWR)) != NOTOK
-                       && (fd2 = dup (fileno (stderr))) != NOTOK) {
-               dup2 (fd3, fileno (stderr));
-               close (fd3);
+                       && (fd3 = open("/dev/null", O_RDWR)) != NOTOK
+                       && (fd2 = dup(fileno(stderr))) != NOTOK) {
+               dup2(fd3, fileno(stderr));
+               close(fd3);
        }
        else
                fd2 = NOTOK;
-       for (ap = brkstring (cp = getcpy (cp), " ", NULL); *ap; ap++)
-               m_convert (mp, *ap);
-       free (cp);
+       for (ap = brkstring(cp = getcpy(cp), " ", NULL); *ap; ap++)
+               m_convert(mp, *ap);
+       free(cp);
        if (fd2 != NOTOK)
-               dup2 (fd2, fileno (stderr));
+               dup2(fd2, fileno(stderr));
        if (mp->numsel == 0) {
                if (debugsw)
-                       admonish (NULL, "no messages to annotate");
+                       admonish(NULL, "no messages to annotate");
                goto oops;
        }
 
-       lseek (fd, (off_t) 0, SEEK_SET);
-       if ((fp = fdopen (fd, "r")) == NULL) {
+       lseek(fd, (off_t) 0, SEEK_SET);
+       if ((fp = fdopen(fd, "r")) == NULL) {
                if (debugsw)
-                       admonish (NULL, "unable to fdopen annotation list");
+                       admonish(NULL, "unable to fdopen annotation list");
                goto oops;
        }
        cp = NULL;
-       while (fgets (buffer, sizeof(buffer), fp) != NULL)
-               cp = add (buffer, cp);
-       fclose (fp);
+       while (fgets(buffer, sizeof(buffer), fp) != NULL)
+               cp = add(buffer, cp);
+       fclose(fp);
 
        if (debugsw)
-               advise (NULL, "annotate%s with %s: \"%s\"",
+               advise(NULL, "annotate%s with %s: \"%s\"",
                                inplace ? " inplace" : "", annotext, cp);
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
                if (is_selected(mp, msgnum)) {
                        if (debugsw)
-                               advise (NULL, "annotate message %d", msgnum);
-                       annotate (m_name (msgnum), annotext, cp, inplace, 1, -2, 0);
+                               advise(NULL, "annotate message %d", msgnum);
+                       annotate(m_name (msgnum), annotext, cp, inplace,
+                                       1, -2, 0);
                }
        }
 
-       free (cp);
+       free(cp);
 
 oops:
-       folder_free (mp);  /* free folder/message structure */
+       folder_free(mp);  /* free folder/message structure */
 }
 
 
 static void
-armed_done (int status)
+armed_done(int status)
 {
-       longjmp (env, status ? status : NOTOK);
+       longjmp(env, status ? status : NOTOK);
 
-       exit (status);
+       exit(status);
 }
index 6c795ca..dc6d24e 100644 (file)
@@ -50,7 +50,7 @@ static struct swit switches[] = {
 static int is_nontext(char *);
 
 /* prototype from mhlsbr.c */
-int mhl (int, char **);
+int mhl(int, char **);
 
 #define SHOW  0
 #define NEXT  1
@@ -58,7 +58,7 @@ int mhl (int, char **);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int headersw = 1, msgp = 0;
        int nshow = 0, checkmime = 1, mime;
@@ -71,48 +71,48 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       if (!mh_strcasecmp (invo_name, "next")) {
+       if (!mh_strcasecmp(invo_name, "next")) {
                mode = NEXT;
-       } else if (!mh_strcasecmp (invo_name, "prev")) {
+       } else if (!mh_strcasecmp(invo_name, "prev")) {
                mode = PREV;
        }
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
                                case NPROGSW:
                                        vec[vecp++] = --cp;
                                        continue;
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [+folder] %s[switches] [switches for showproc]", invo_name, mode == SHOW ? "[msgs] ": "");
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [+folder] %s[switches] [switches for showproc]", invo_name, mode == SHOW ? "[msgs] ": "");
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case FILESW:
                                        if (mode != SHOW)
 usage:
-                                               adios (NULL, "usage: %s [+folder] [switches] [switches for showproc]", invo_name);
+                                               adios(NULL, "usage: %s [+folder] [switches] [switches for showproc]", invo_name);
 
                                        if (file)
-                                               adios (NULL, "only one file at a time!");
+                                               adios(NULL, "only one file at a time!");
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       file = path (cp, TFILE);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       file = path(cp, TFILE);
                                        continue;
 
                                case HEADSW:
@@ -125,8 +125,8 @@ usage:
                                case FORMSW:
                                        vec[vecp++] = --cp;
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       vec[vecp++] = getcpy (etcpath(cp));
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       vec[vecp++] = getcpy(etcpath(cp));
                                        continue;
 
                                case PROGSW:
@@ -134,13 +134,13 @@ usage:
                                case WIDTHSW:
                                        vec[vecp++] = --cp;
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        vec[vecp++] = cp;
                                        continue;
 
                                case SHOWSW:
                                        if (!(showproc = *argp++) || *showproc == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        nshow = 0;
                                        continue;
                                case NSHOWSW:
@@ -149,7 +149,7 @@ usage:
 
                                case SHOWMIMESW:
                                        if (!(showmimeproc = *argp++) || *showmimeproc == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        nshow = 0;
                                        continue;
                                case CHECKMIMESW:
@@ -162,9 +162,9 @@ usage:
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else if (mode != SHOW) {
                        goto usage;
                } else {
@@ -173,19 +173,19 @@ usage:
        }
        procp = vecp;
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
 
        if (file) {
                if (msgp)
-                       adios (NULL, "only one file at a time!");
+                       adios(NULL, "only one file at a time!");
                vec[vecp++] = file;
                goto go_to_it;
        }
 
 #ifdef WHATNOW
        if (!msgp && !folder && mode == SHOW &&
-                       (cp = getenv ("mhdraft")) && *cp) {
+                       (cp = getenv("mhdraft")) && *cp) {
                vec[vecp++] = cp;
                goto go_to_it;
        }
@@ -206,24 +206,24 @@ usage:
        }
 
        if (!folder)
-               folder = getfolder (1);
-       maildir = m_maildir (folder);
+               folder = getfolder(1);
+       maildir = m_maildir(folder);
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
        if (mp->nummsg == 0)
-               adios (NULL, "no messages in %s", folder);
+               adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgp; msgnum++)
-               if (!m_convert (mp, msgs[msgnum]))
-                       done (1);
+               if (!m_convert(mp, msgs[msgnum]))
+                       done(1);
 
        /*
        ** Set the SELECT_UNSEEN bit for all the SELECTED messages,
@@ -232,29 +232,29 @@ usage:
        */
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
                if (is_selected(mp, msgnum))
-                       set_unseen (mp, msgnum);
+                       set_unseen(mp, msgnum);
 
-       seq_setprev (mp);  /* set the Previous-Sequence */
-       seq_setunseen (mp, 1);  /* unset the Unseen-Sequence */
+       seq_setprev(mp);  /* set the Previous-Sequence */
+       seq_setunseen(mp, 1);  /* unset the Unseen-Sequence */
 
        if (mp->numsel > MAXARGS - 2)
-               adios (NULL, "more than %d messages for show exec",
+               adios(NULL, "more than %d messages for show exec",
                                MAXARGS - 2);
 
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
                if (is_selected(mp, msgnum))
-                       vec[vecp++] = getcpy (m_name (msgnum));
+                       vec[vecp++] = getcpy(m_name(msgnum));
 
-       seq_setcur (mp, mp->hghsel);  /* update current message  */
-       seq_save (mp);  /* synchronize sequences   */
-       context_replace (pfolder, folder);  /* update current folder   */
-       context_save ();  /* save the context file   */
+       seq_setcur(mp, mp->hghsel);  /* update current message  */
+       seq_save(mp);  /* synchronize sequences   */
+       context_replace(pfolder, folder);  /* update current folder   */
+       context_save();  /* save the context file   */
 
        if (headersw && vecp == 2)
-               printf ("(Message %s:%s)\n", folder, vec[1]);
+               printf("(Message %s:%s)\n", folder, vec[1]);
 
 go_to_it: ;
-       fflush (stdout);
+       fflush(stdout);
 
        vec[vecp] = NULL;
 
@@ -266,7 +266,7 @@ go_to_it: ;
                proc = catproc;
        } else {
                /* check if any messages are non-text MIME messages */
-               if (checkmime && !getenv ("NOMHNPROC")) {
+               if (checkmime && !getenv("NOMHNPROC")) {
                        if (!file) {
                                /*
                                ** loop through selected messages
@@ -275,13 +275,13 @@ go_to_it: ;
                                for (msgnum = mp->lowsel;
                                                msgnum <= mp->hghsel;
                                                msgnum++)
-                                       if (is_selected (mp, msgnum) && is_nontext (m_name (msgnum))) {
+                                       if (is_selected(mp, msgnum) && is_nontext(m_name(msgnum))) {
                                                mime = 1;
                                                break;
                                        }
                        } else {
                                /* check the file for MIME */
-                               if (is_nontext (vec[vecp - 1]))
+                               if (is_nontext(vec[vecp - 1]))
                                        mime = 1;
                        }
                }
@@ -294,14 +294,14 @@ go_to_it: ;
        }
 
        if (folder && !file)
-               m_putenv ("mhfolder", folder);
+               m_putenv("mhfolder", folder);
 
        /*
        ** For backward compatibility, if the "proc" is mhn,
        ** then add "-show" option.  Add "-file" if showing
        ** file.
        */
-       if (strcmp (r1bindex (proc, '/'), "mhn") == 0) {
+       if (strcmp(r1bindex(proc, '/'), "mhn") == 0) {
                if (file) {
                        vec[vecp] = vec[vecp - 1];
                        vec[vecp - 1] = "-file";
@@ -312,7 +312,7 @@ go_to_it: ;
        }
 
        /* If the "proc" is "mhshow", add "-file" if showing file.  */
-       if (strcmp (r1bindex (proc, '/'), "mhshow") == 0 && file ) {
+       if (strcmp(r1bindex(proc, '/'), "mhshow") == 0 && file ) {
           vec[vecp] = vec[vecp - 1];
           vec[vecp - 1] = "-file";
           vec[++vecp] = NULL;
@@ -322,10 +322,10 @@ go_to_it: ;
        ** If "proc" is mhl, then run it internally
        ** rather than exec'ing it.
        */
-       if (strcmp (r1bindex (proc, '/'), "mhl") == 0) {
+       if (strcmp(r1bindex(proc, '/'), "mhl") == 0) {
                vec[0] = "mhl";
-               mhl (vecp, vec);
-               done (0);
+               mhl(vecp, vec);
+               done(0);
        }
 
        /*
@@ -333,21 +333,21 @@ go_to_it: ;
        ** add the path to the message names.  Currently, we are just
        ** checking for mhn here, since we've already taken care of mhl.
        */
-       if (!strcmp (r1bindex (proc, '/'), "mhl")
+       if (!strcmp(r1bindex(proc, '/'), "mhl")
                        && !file
-                       && chdir (maildir =
-                       concat (m_maildir (""), "/", NULL)) != NOTOK) {
-               mp->foldpath = concat (mp->foldpath, "/", NULL);
-               cp = ssequal (maildir, mp->foldpath)
-                       ? mp->foldpath + strlen (maildir)
+                       && chdir(maildir =
+                       concat(m_maildir(""), "/", NULL)) != NOTOK) {
+               mp->foldpath = concat(mp->foldpath, "/", NULL);
+               cp = ssequal(maildir, mp->foldpath)
+                       ? mp->foldpath + strlen(maildir)
                        : mp->foldpath;
                for (msgnum = procp; msgnum < vecp; msgnum++)
-                       vec[msgnum] = concat (cp, vec[msgnum], NULL);
+                       vec[msgnum] = concat(cp, vec[msgnum], NULL);
        }
 
-       vec[0] = r1bindex (proc, '/');
-       execvp (proc, vec);
-       adios (proc, "unable to exec");
+       vec[0] = r1bindex(proc, '/');
+       execvp(proc, vec);
+       adios(proc, "unable to exec");
        return 0;  /* dead code to satisfy the compiler */
 }
 
@@ -355,7 +355,7 @@ go_to_it: ;
 ** Check if a message or file contains any non-text parts
 */
 static int
-is_nontext (char *msgnam)
+is_nontext(char *msgnam)
 {
        int result, state;
        unsigned char *bp, *dp;
@@ -363,32 +363,32 @@ is_nontext (char *msgnam)
        char buf[BUFSIZ], name[NAMESZ];
        FILE *fp;
 
-       if ((fp = fopen (msgnam, "r")) == NULL)
+       if ((fp = fopen(msgnam, "r")) == NULL)
                return 0;
 
        for (state = FLD;;) {
-               switch (state = m_getfld (state, name, buf, sizeof(buf), fp)) {
+               switch (state = m_getfld(state, name, buf, sizeof(buf), fp)) {
                case FLD:
                case FLDPLUS:
                case FLDEOF:
                        /*
                        ** Check Content-Type field
                        */
-                       if (!mh_strcasecmp (name, TYPE_FIELD)) {
+                       if (!mh_strcasecmp(name, TYPE_FIELD)) {
                                int passno;
                                char c;
 
-                               cp = add (buf, NULL);
+                               cp = add(buf, NULL);
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, name, buf,
+                                       state = m_getfld(state, name, buf,
                                                        sizeof(buf), fp);
-                                       cp = add (buf, cp);
+                                       cp = add(buf, cp);
                                }
                                bp = cp;
                                passno = 1;
 
 again:
-                               for (; isspace (*bp); bp++)
+                               for (; isspace(*bp); bp++)
                                        continue;
                                if (*bp == '(') {
                                        int i;
@@ -423,36 +423,36 @@ invalid:
                                        passno = 3;
                                        goto again;
                                }
-                               for (dp = bp; istoken (*dp); dp++)
+                               for (dp = bp; istoken(*dp); dp++)
                                        continue;
                                c = *dp;
                                *dp = '\0';
                                if (!*bp)
                                        goto invalid;
                                if (passno > 1) {
-                                       if ((result = (mh_strcasecmp (bp,
+                                       if ((result = (mh_strcasecmp(bp,
                                                        "plain") != 0)))
                                                goto out;
                                        *dp = c;
-                                       for (dp++; isspace (*dp); dp++)
+                                       for (dp++; isspace(*dp); dp++)
                                                continue;
                                        if (*dp) {
-                                               if ((result = !uprf (dp,
+                                               if ((result = !uprf(dp,
                                                                "charset")))
                                                        goto out;
                                                dp += sizeof("charset") - 1;
-                                               while (isspace (*dp))
+                                               while (isspace(*dp))
                                                        dp++;
                                                if (*dp++ != '=')
                                                        goto invalid;
-                                               while (isspace (*dp))
+                                               while (isspace(*dp))
                                                        dp++;
                                                if (*dp == '"') {
                                                        if ((bp = strchr(++dp, '"')))
                                                                *bp = '\0';
                                                } else {
                                                        for (bp = dp; *bp; bp++)
-                                                               if (!istoken (*bp)) {
+                                                               if (!istoken(*bp)) {
                                                                        *bp = '\0';
                                                                        break;
                                                                }
@@ -462,9 +462,9 @@ invalid:
                                                dp = "US-ASCII";
                                        }
                                        /* Check the character set */
-                                       result = !check_charset (dp, strlen (dp));
+                                       result = !check_charset(dp, strlen(dp));
                                } else {
-                                       if (!(result = (mh_strcasecmp (bp, "text") != 0))) {
+                                       if (!(result = (mh_strcasecmp(bp, "text") != 0))) {
                                                *dp = c;
                                                bp = dp;
                                                passno = 2;
@@ -472,9 +472,9 @@ invalid:
                                        }
                                }
 out:
-                               free (cp);
+                               free(cp);
                                if (result) {
-                                       fclose (fp);
+                                       fclose(fp);
                                        return result;
                                }
                                break;
@@ -483,24 +483,25 @@ out:
                        /*
                        ** Check Content-Transfer-Encoding field
                        */
-                       if (!mh_strcasecmp (name, ENCODING_FIELD)) {
-                               cp = add (buf, NULL);
+                       if (!mh_strcasecmp(name, ENCODING_FIELD)) {
+                               cp = add(buf, NULL);
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, name, buf, sizeof(buf), fp);
-                                       cp = add (buf, cp);
+                                       state = m_getfld(state, name, buf,
+                                                       sizeof(buf), fp);
+                                       cp = add(buf, cp);
                                }
-                               for (bp = cp; isspace (*bp); bp++)
+                               for (bp = cp; isspace(*bp); bp++)
                                        continue;
-                               for (dp = bp; istoken (*dp); dp++)
+                               for (dp = bp; istoken(*dp); dp++)
                                        continue;
                                *dp = '\0';
-                               result = (mh_strcasecmp (bp, "7bit")
-                                          && mh_strcasecmp (bp, "8bit")
-                                          && mh_strcasecmp (bp, "binary"));
+                               result = (mh_strcasecmp(bp, "7bit")
+                                          && mh_strcasecmp(bp, "8bit")
+                                          && mh_strcasecmp(bp, "binary"));
 
-                               free (cp);
+                               free(cp);
                                if (result) {
-                                       fclose (fp);
+                                       fclose(fp);
                                        return result;
                                }
                                break;
@@ -520,7 +521,7 @@ out:
                        ** so message is just text.
                        */
                default:
-                       fclose (fp);
+                       fclose(fp);
                        return 0;
                }
        }
index 52e323a..2e7c257 100644 (file)
@@ -180,30 +180,30 @@ extern char **environ;
 /*
 ** static prototypes
 */
-static int localmail (int, char *);
-static int usr_delivery (int, char *, int);
-static int split (char *, char **);
-static int parse (int);
-static void expand (char *, char *, int);
-static void glob (int);
-static struct pair *lookup (struct pair *, char *);
-static int logged_in (void);
-static int timely (char *, char *);
-static int usr_file (int, char *, int);
-static int usr_pipe (int, char *, char *, char **, int);
-static int usr_folder (int, char *);
-static RETSIGTYPE alrmser (int);
-static void get_sender (char *, char **);
-static int copy_message (int, char *, int);
-static void verbose_printf (char *fmt, ...);
-static void adorn (char *, char *, ...);
-static void debug_printf (char *fmt, ...);
-static int suppress_duplicates (int, char *);
-static char *trim (char *);
+static int localmail(int, char *);
+static int usr_delivery(int, char *, int);
+static int split(char *, char **);
+static int parse(int);
+static void expand(char *, char *, int);
+static void glob(int);
+static struct pair *lookup(struct pair *, char *);
+static int logged_in(void);
+static int timely(char *, char *);
+static int usr_file(int, char *, int);
+static int usr_pipe(int, char *, char *, char **, int);
+static int usr_folder(int, char *);
+static RETSIGTYPE alrmser(int);
+static void get_sender(char *, char **);
+static int copy_message(int, char *, int);
+static void verbose_printf(char *fmt, ...);
+static void adorn(char *, char *, ...);
+static void debug_printf(char *fmt, ...);
+static int suppress_duplicates(int, char *);
+static char *trim(char *);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int fd, status;
        FILE *fp = stdin;
@@ -214,73 +214,72 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (*argv, '/');
+       invo_name = r1bindex(*argv, '/');
 
        /* foil search of user profile/context */
-       if (context_foil (NULL) == -1)
-               done (1);
+       if (context_foil(NULL) == -1)
+               done(1);
 
-       mts_init (invo_name);
-       arguments = getarguments (invo_name, argc, argv, 0);
+       mts_init(invo_name);
+       arguments = getarguments(invo_name, argc, argv, 0);
        argp = arguments;
 
        /* Parse arguments */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf),
-                                               "%s [switches] [address info sender]", invo_name);
-                                       print_help (buf, switches, 0);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [switches] [address info sender]", invo_name);
+                                       print_help(buf, switches, 0);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case ADDRSW:
                                        if (!(addr = *argp++))
                                                /* allow -xyz arguments */
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case INFOSW:
                                        if (!(info = *argp++))
                                                /* allow -xyz arguments */
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case USERSW:
                                        if (!(user = *argp++))
                                                /* allow -xyz arguments */
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case FILESW:
                                        if (!(file = *argp++) || *file == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case SENDERSW:
                                        if (!(sender = *argp++))
                                                /* allow -xyz arguments */
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case MAILBOXSW:
                                        if (!(mbox = *argp++) || *mbox == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case HOMESW:
                                        if (!(home = *argp++) || *home == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
 
                                case MAILSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        if (mdlvr)
-                                               adios (NULL, "only one maildelivery file at a time!");
+                                               adios(NULL, "only one maildelivery file at a time!");
                                        mdlvr = cp;
                                        continue;
 
@@ -319,31 +318,31 @@ main (int argc, char **argv)
        }
 
        if (addr == NULL)
-               addr = getusername ();
+               addr = getusername();
        if (user == NULL)
                user = (cp = strchr(addr, '.')) ? ++cp : addr;
-       if ((pw = getpwnam (user)) == NULL)
-               adios (NULL, "no such local user as %s", user);
+       if ((pw = getpwnam(user)) == NULL)
+               adios(NULL, "no such local user as %s", user);
 
-       if (chdir (pw->pw_dir) == -1)
-               chdir ("/");
-       umask (0077);
+       if (chdir(pw->pw_dir) == -1)
+               chdir("/");
+       umask(0077);
 
        if (geteuid() == 0) {
-               setgid (pw->pw_gid);
-               initgroups (pw->pw_name, pw->pw_gid);
-               setuid (pw->pw_uid);
+               setgid(pw->pw_gid);
+               initgroups(pw->pw_name, pw->pw_gid);
+               setuid(pw->pw_uid);
        }
 
        if (info == NULL)
                info = "";
 
-       setbuf (stdin, NULL);
+       setbuf(stdin, NULL);
 
        /* Record the delivery time */
-       if ((now = dlocaltimenow ()) == NULL)
-               adios (NULL, "unable to ascertain local time");
-       snprintf (ddate, sizeof(ddate), "Delivery-Date: %s\n", dtimenow (0));
+       if ((now = dlocaltimenow()) == NULL)
+               adios(NULL, "unable to ascertain local time");
+       snprintf(ddate, sizeof(ddate), "Delivery-Date: %s\n", dtimenow(0));
 
        /*
        ** Copy the message to a temporary file
@@ -352,23 +351,24 @@ main (int argc, char **argv)
                int tempfd;
 
                /* getting message from file */
-               if ((tempfd = open (file, O_RDONLY)) == -1)
-                       adios (file, "unable to open");
+               if ((tempfd = open(file, O_RDONLY)) == -1)
+                       adios(file, "unable to open");
                if (debug)
-                       debug_printf ("retrieving message from file \"%s\"\n", file);
-               if ((fd = copy_message (tempfd, tmpfil, 1)) == -1)
-                       adios (NULL, "unable to create temporary file");
-               close (tempfd);
+                       debug_printf("retrieving message from file \"%s\"\n",
+                                       file);
+               if ((fd = copy_message(tempfd, tmpfil, 1)) == -1)
+                       adios(NULL, "unable to create temporary file");
+               close(tempfd);
        } else {
                /* getting message from stdin */
                if (debug)
-                       debug_printf ("retrieving message from stdin\n");
-               if ((fd = copy_message (fileno (stdin), tmpfil, 1)) == -1)
-                       adios (NULL, "unable to create temporary file");
+                       debug_printf("retrieving message from stdin\n");
+               if ((fd = copy_message(fileno(stdin), tmpfil, 1)) == -1)
+                       adios(NULL, "unable to create temporary file");
        }
 
        if (debug)
-               debug_printf ("temporary file=\"%s\"\n", tmpfil);
+               debug_printf("temporary file=\"%s\"\n", tmpfil);
 
        /*
        ** Delete the temp file now or a copy of every single message
@@ -385,20 +385,20 @@ main (int argc, char **argv)
        ** someone who cares about the temp-file-accessing functionality
        ** (they'll have to watch out for cases where we adios()).
        */
-       unlink (tmpfil);
+       unlink(tmpfil);
 
-       if (!(fp = fdopen (fd, "r+")))
-               adios (NULL, "unable to access temporary file");
+       if (!(fp = fdopen(fd, "r+")))
+               adios(NULL, "unable to access temporary file");
 
        /*
        ** If no sender given, extract it
        ** from envelope information.
        */
        if (sender == NULL)
-               get_sender (envelope, &sender);
+               get_sender(envelope, &sender);
 
        if (mbox == NULL) {
-               snprintf (mailbox, sizeof(mailbox), "%s/%s",
+               snprintf(mailbox, sizeof(mailbox), "%s/%s",
                                mmdfldir[0] ? mmdfldir : pw->pw_dir,
                                mmdflfil[0] ? mmdflfil : pw->pw_name);
                mbox = mailbox;
@@ -407,22 +407,22 @@ main (int argc, char **argv)
                home = pw->pw_dir;
 
        if (debug) {
-               debug_printf ("addr=\"%s\"\n", trim(addr));
-               debug_printf ("user=\"%s\"\n", trim(user));
-               debug_printf ("info=\"%s\"\n", trim(info));
-               debug_printf ("sender=\"%s\"\n", trim(sender));
-               debug_printf ("envelope=\"%s\"\n",
+               debug_printf("addr=\"%s\"\n", trim(addr));
+               debug_printf("user=\"%s\"\n", trim(user));
+               debug_printf("info=\"%s\"\n", trim(info));
+               debug_printf("sender=\"%s\"\n", trim(sender));
+               debug_printf("envelope=\"%s\"\n",
                                envelope ? trim(envelope) : "");
-               debug_printf ("mbox=\"%s\"\n", trim(mbox));
-               debug_printf ("home=\"%s\"\n", trim(home));
-               debug_printf ("ddate=\"%s\"\n", trim(ddate));
-               debug_printf ("now=%02d:%02d\n\n", now->tw_hour, now->tw_min);
+               debug_printf("mbox=\"%s\"\n", trim(mbox));
+               debug_printf("home=\"%s\"\n", trim(home));
+               debug_printf("ddate=\"%s\"\n", trim(ddate));
+               debug_printf("now=%02d:%02d\n\n", now->tw_hour, now->tw_min);
        }
 
        /* deliver the message */
-       status = localmail (fd, mdlvr);
+       status = localmail(fd, mdlvr);
 
-       done (status != -1 ? RCV_MOK : RCV_MBX);
+       done(status != -1 ? RCV_MOK : RCV_MBX);
        return 1;
 }
 
@@ -432,42 +432,41 @@ main (int argc, char **argv)
 */
 
 static int
-localmail (int fd, char *mdlvr)
+localmail(int fd, char *mdlvr)
 {
        /* check if this message is a duplicate */
-       if (suppressdup &&
-                       suppress_duplicates(fd,
-                       mdlvr ? mdlvr : ".maildelivery") == DONE)
+       if (suppressdup && suppress_duplicates(fd, mdlvr ?
+                       mdlvr : ".maildelivery") == DONE)
                return 0;
 
        /* delivery according to personal Maildelivery file */
-       if (usr_delivery (fd, mdlvr ? mdlvr : ".maildelivery", 0) != -1)
+       if (usr_delivery(fd, mdlvr ? mdlvr : ".maildelivery", 0) != -1)
                return 0;
 
        /* delivery according to global Maildelivery file */
-       if (usr_delivery (fd, maildelivery, 1) != -1)
+       if (usr_delivery(fd, maildelivery, 1) != -1)
                return 0;
 
        if (verbose)
-               verbose_printf ("(delivering to standard mail spool)\n");
+               verbose_printf("(delivering to standard mail spool)\n");
 
        /* last resort - deliver to standard mail spool */
 #ifdef SLOCAL_MBOX
-       return usr_file (fd, mbox, MBOX_FORMAT);
+       return usr_file(fd, mbox, MBOX_FORMAT);
 #else
-       return usr_file (fd, mbox, MMDF_FORMAT);
+       return usr_file(fd, mbox, MMDF_FORMAT);
 #endif
 }
 
 
-#define matches(a,b) (stringdex (b, a) >= 0)
+#define matches(a,b) (stringdex(b, a) >= 0)
 
 /*
 ** Parse the delivery file, and process incoming message.
 */
 
 static int
-usr_delivery (int fd, char *delivery, int su)
+usr_delivery(int fd, char *delivery, int su)
 {
        int i, accept, status=1, won, vecp, next;
        char *field, *pattern, *action, *result, *string;
@@ -478,15 +477,15 @@ usr_delivery (int fd, char *delivery, int su)
        FILE *fp;
 
        /* open the delivery file */
-       if ((fp = fopen (delivery, "r")) == NULL)
+       if ((fp = fopen(delivery, "r")) == NULL)
                return -1;
 
        /* check if delivery file has bad ownership or permissions */
-       if (fstat (fileno (fp), &st) == -1
-                       || (st.st_uid != 0 && (su || st.st_uid != pw->pw_uid))
-                       || st.st_mode & (S_IWGRP|S_IWOTH)) {
+       if (fstat(fileno(fp), &st) == -1 ||
+                       (st.st_uid != 0 && (su || st.st_uid != pw->pw_uid)) ||
+                       st.st_mode & (S_IWGRP|S_IWOTH)) {
                if (verbose) {
-                       verbose_printf ("WARNING: %s has bad ownership/modes (su=%d,uid=%d,owner=%d,mode=0%o)\n", delivery, su, (int) pw->pw_uid, (int) st.st_uid, (int) st.st_mode);
+                       verbose_printf("WARNING: %s has bad ownership/modes (su=%d,uid=%d,owner=%d,mode=0%o)\n", delivery, su, (int) pw->pw_uid, (int) st.st_uid, (int) st.st_mode);
                }
                return -1;
        }
@@ -495,7 +494,7 @@ usr_delivery (int fd, char *delivery, int su)
        next = 1;
 
        /* read and process delivery file */
-       while (fgets (buffer, sizeof(buffer), fp)) {
+       while (fgets(buffer, sizeof(buffer), fp)) {
                /* skip comments and empty lines */
                if (*buffer == '#' || *buffer == '\n')
                        continue;
@@ -505,18 +504,18 @@ usr_delivery (int fd, char *delivery, int su)
                        *cp = 0;
 
                /* split buffer into fields */
-               vecp = split (buffer, vec);
+               vecp = split(buffer, vec);
 
                /* check for too few fields */
                if (vecp < 5) {
                        if (debug)
-                               debug_printf ("WARNING: entry with only %d fields, skipping.\n", vecp);
+                               debug_printf("WARNING: entry with only %d fields, skipping.\n", vecp);
                        continue;
                }
 
                if (debug) {
                        for (i = 0; vec[i]; i++)
-                               debug_printf ("vec[%d]: \"%s\"\n",
+                               debug_printf("vec[%d]: \"%s\"\n",
                                                i, trim(vec[i]));
                }
 
@@ -567,10 +566,10 @@ usr_delivery (int fd, char *delivery, int su)
                }
 
                if (vecp > 5) {
-                       if (!mh_strcasecmp (vec[5], "select")) {
-                               if (logged_in () != -1)
+                       if (!mh_strcasecmp(vec[5], "select")) {
+                               if (logged_in() != -1)
                                        continue;
-                               if (vecp > 7 && timely (vec[6], vec[7]) == -1)
+                               if (vecp > 7 && timely(vec[6], vec[7]) == -1)
                                        continue;
                        }
                }
@@ -586,7 +585,7 @@ usr_delivery (int fd, char *delivery, int su)
                        ** "default" matches only if the message hasn't
                        ** been delivered yet.
                        */
-                               if (!mh_strcasecmp (field, "default")) {
+                               if (!mh_strcasecmp(field, "default")) {
                                        if (won)
                                                continue;
                                        break;
@@ -594,17 +593,17 @@ usr_delivery (int fd, char *delivery, int su)
 
                        default:
                                /* parse message and build lookup table */
-                               if (!parsed && parse (fd) == -1) {
-                                       fclose (fp);
+                               if (!parsed && parse(fd) == -1) {
+                                       fclose(fp);
                                        return -1;
                                }
                                /*
                                ** find header field in lookup table, and
                                ** see if the pattern matches.
                                */
-                               if ((p = lookup (hdrs, field)) &&
+                               if ((p = lookup(hdrs, field)) &&
                                                (p->p_value != NULL) &&
-                                               matches (p->p_value, pattern)
+                                               matches(p->p_value, pattern)
                                                ) {
                                        next = 1;
                                } else {
@@ -618,74 +617,75 @@ usr_delivery (int fd, char *delivery, int su)
                switch (*action) {
                        case 'q':
                                /* deliver to quoted pipe */
-                               if (mh_strcasecmp (action, "qpipe"))
+                               if (mh_strcasecmp(action, "qpipe"))
                                        continue;  /* else fall */
                        case '^':
-                               expand (tmpbuf, string, fd);
-                               if (split (tmpbuf, vec) < 1)
+                               expand(tmpbuf, string, fd);
+                               if (split(tmpbuf, vec) < 1)
                                        continue;
-                               status = usr_pipe (fd, tmpbuf, vec[0], vec, 0);
+                               status = usr_pipe(fd, tmpbuf, vec[0], vec, 0);
                                break;
 
                        case 'p':
                                /* deliver to pipe */
-                               if (mh_strcasecmp (action, "pipe"))
+                               if (mh_strcasecmp(action, "pipe"))
                                        continue;  /* else fall */
                        case '|':
                                vec[2] = "sh";
                                vec[3] = "-c";
-                               expand (tmpbuf, string, fd);
+                               expand(tmpbuf, string, fd);
                                vec[4] = tmpbuf;
                                vec[5] = NULL;
-                               status = usr_pipe (fd, tmpbuf, "/bin/sh",
+                               status = usr_pipe(fd, tmpbuf, "/bin/sh",
                                                vec + 2, 0);
                                break;
 
                        case 'f':
                                /* mbox format */
-                               if (!mh_strcasecmp (action, "file")) {
-                                       status = usr_file (fd, string,
+                               if (!mh_strcasecmp(action, "file")) {
+                                       status = usr_file(fd, string,
                                                        MBOX_FORMAT);
                                        break;
                                }
                                /* deliver to nmh folder */
-                               else if (mh_strcasecmp (action, "folder"))
+                               else if (mh_strcasecmp(action, "folder"))
                                        continue;  /* else fall */
                        case '+':
-                               status = usr_folder (fd, string);
+                               status = usr_folder(fd, string);
                                break;
 
                        case 'm':
                                /* mmdf format */
-                               if (!mh_strcasecmp (action, "mmdf")) {
-                                       status = usr_file (fd, string,
+                               if (!mh_strcasecmp(action, "mmdf")) {
+                                       status = usr_file(fd, string,
                                                        MMDF_FORMAT);
                                        break;
                                }
                                /* mbox format */
-                               else if (mh_strcasecmp (action, "mbox"))
+                               else if (mh_strcasecmp(action, "mbox"))
                                        continue;  /* else fall */
 
                        case '>':
                                /* mbox format */
-                               status = usr_file (fd, string, MBOX_FORMAT);
+                               status = usr_file(fd, string, MBOX_FORMAT);
                                break;
 
                        case 'd':
                                /* ignore message */
-                               if (mh_strcasecmp (action, "destroy"))
+                               if (mh_strcasecmp(action, "destroy"))
                                        continue;
                                status = 0;
                                break;
                }
 
-               if (status) next = 0;  /* action failed, mark for 'N' result */
+               if (status)
+                       next = 0;  /* action failed, mark for 'N' result */
 
                if (accept && status == 0)
                        won++;
        }
 
-       fclose (fp);
+       fclose(fp);
        return (won ? 0 : -1);
 }
 
@@ -698,7 +698,7 @@ usr_delivery (int fd, char *delivery, int su)
 */
 
 static int
-split (char *cp, char **vec)
+split(char *cp, char **vec)
 {
        int i;
        unsigned char *s;
@@ -710,7 +710,7 @@ split (char *cp, char **vec)
                vec[i] = NULL;
 
                /* zap any whitespace and comma's */
-               while (isspace (*s) || *s == ',')
+               while (isspace(*s) || *s == ',')
                        *s++ = 0;
 
                /* end of buffer, time to leave */
@@ -726,7 +726,7 @@ split (char *cp, char **vec)
                                */
                                if (*s == QUOTE) {
                                        if (*++s == '"')
-                                               strcpy (s - 1, s);
+                                               strcpy(s - 1, s);
                                        s--;
                                }
                        }
@@ -740,7 +740,7 @@ split (char *cp, char **vec)
                vec[i++] = s++;
 
                /* move forward to next field delimiter */
-               while (*s && !isspace (*s) && *s != ',')
+               while (*s && !isspace(*s) && *s != ',')
                        s++;
        }
        vec[i] = NULL;
@@ -755,7 +755,7 @@ split (char *cp, char **vec)
 */
 
 static int
-parse (int fd)
+parse(int fd)
 {
        int i, state;
        int fd1;
@@ -768,56 +768,57 @@ parse (int fd)
                return 0;
 
        /* get a new FILE pointer to message */
-       if ((fd1 = dup (fd)) == -1)
+       if ((fd1 = dup(fd)) == -1)
                return -1;
-       if ((in = fdopen (fd1, "r")) == NULL) {
-               close (fd1);
+       if ((in = fdopen(fd1, "r")) == NULL) {
+               close(fd1);
                return -1;
        }
-       rewind (in);
+       rewind(in);
 
        /* add special entries to lookup table */
-       if ((p = lookup (hdrs, "source")))
-               p->p_value = getcpy (sender);
-       if ((p = lookup (hdrs, "addr")))
-               p->p_value = getcpy (addr);
+       if ((p = lookup(hdrs, "source")))
+               p->p_value = getcpy(sender);
+       if ((p = lookup(hdrs, "addr")))
+               p->p_value = getcpy(addr);
 
        /*
         * Scan the headers of the message and build
         * a lookup table.
         */
        for (i = 0, state = FLD;;) {
-               switch (state = m_getfld (state, name, field, sizeof(field),
+               switch (state = m_getfld(state, name, field, sizeof(field),
                                in)) {
                        case FLD:
                        case FLDEOF:
                        case FLDPLUS:
-                               lp = add (field, NULL);
+                               lp = add(field, NULL);
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, name, field, sizeof(field), in);
-                                       lp = add (field, lp);
+                                       state = m_getfld(state, name, field,
+                                                       sizeof(field), in);
+                                       lp = add(field, lp);
                                }
                                for (p = hdrs; p->p_name; p++) {
-                                       if (!mh_strcasecmp (p->p_name, name)) {
+                                       if (!mh_strcasecmp(p->p_name, name)) {
                                                if (!(p->p_flags & P_HID)) {
                                                        if ((cp = p->p_value)) {
                                                                if (p->p_flags & P_ADR) {
-                                                                       dp = cp + strlen (cp) - 1;
+                                                                       dp = cp + strlen(cp) - 1;
                                                                        if (*dp == '\n')
                                                                                *dp = 0;
-                                                                       cp = add (",\n\t", cp);
+                                                                       cp = add(",\n\t", cp);
                                                                } else {
-                                                                       cp = add ("\t", cp);
+                                                                       cp = add("\t", cp);
                                                                }
                                                        }
-                                                       p->p_value = add (lp, cp);
+                                                       p->p_value = add(lp, cp);
                                                }
-                                               free (lp);
+                                               free(lp);
                                                break;
                                        }
                                }
                                if (p->p_name == NULL && i < NVEC) {
-                                       p->p_name = getcpy (name);
+                                       p->p_name = getcpy(name);
                                        p->p_value = lp;
                                        p->p_flags = P_NIL;
                                        p++, i++;
@@ -834,30 +835,31 @@ parse (int fd)
 
                        case LENERR:
                        case FMTERR:
-                               advise (NULL, "format error in message");
+                               advise(NULL, "format error in message");
                                break;
 
                        default:
-                               advise (NULL, "internal error in m_getfld");
-                               fclose (in);
+                               advise(NULL, "internal error in m_getfld");
+                               fclose(in);
                                return -1;
                }
                break;
        }
-       fclose (in);
+       fclose(in);
 
-       if ((p = lookup (vars, "reply-to"))) {
-               if ((q = lookup (hdrs, "reply-to")) == NULL || q->p_value == NULL)
-                       q = lookup (hdrs, "from");
-               p->p_value = getcpy (q ? q->p_value : "");
+       if ((p = lookup(vars, "reply-to"))) {
+               if ((q = lookup(hdrs, "reply-to")) == NULL ||
+                               q->p_value == NULL)
+                       q = lookup(hdrs, "from");
+               p->p_value = getcpy(q ? q->p_value : "");
                p->p_flags &= ~P_CHK;
                if (debug)
-                       debug_printf ("vars[%d]: name=\"%s\" value=\"%s\"\n",
+                       debug_printf("vars[%d]: name=\"%s\" value=\"%s\"\n",
                                        p - vars, p->p_name, trim(p->p_value));
        }
        if (debug) {
                for (p = hdrs; p->p_name; p++)
-                       debug_printf ("hdrs[%d]: name=\"%s\" value=\"%s\"\n",
+                       debug_printf("hdrs[%d]: name=\"%s\" value=\"%s\"\n",
                                p - hdrs, p->p_name, p->p_value ? trim(p->p_value) : "");
        }
 
@@ -874,13 +876,13 @@ parse (int fd)
 */
 
 static void
-expand (char *s1, char *s2, int fd)
+expand(char *s1, char *s2, int fd)
 {
        char c, *cp;
        struct pair *p;
 
        if (!globbed)
-               glob (fd);
+               glob(fd);
 
        while ((c = *s2++)) {
                if (c != '$' || *s2 != LPAREN) {
@@ -893,12 +895,12 @@ expand (char *s1, char *s2, int fd)
                                continue;
                        }
                        *s2++ = 0;
-                       if ((p = lookup (vars, cp))) {
+                       if ((p = lookup(vars, cp))) {
                                if (!parsed && (p->p_flags & P_CHK))
-                                       parse (fd);
+                                       parse(fd);
 
-                               strcpy (s1, p->p_value);
-                               s1 += strlen (s1);
+                               strcpy(s1, p->p_value);
+                               s1 += strlen(s1);
                        }
                }
        }
@@ -914,7 +916,7 @@ expand (char *s1, char *s2, int fd)
 */
 
 static void
-glob (int fd)
+glob(int fd)
 {
        char buffer[BUFSIZ];
        struct stat st;
@@ -923,21 +925,21 @@ glob (int fd)
        if (globbed++)
                return;
 
-       if ((p = lookup (vars, "sender")))
-               p->p_value = getcpy (sender);
-       if ((p = lookup (vars, "address")))
-               p->p_value = getcpy (addr);
-       if ((p = lookup (vars, "size"))) {
-               snprintf (buffer, sizeof(buffer), "%d",
-                               fstat (fd, &st) != -1 ? (int) st.st_size : 0);
-               p->p_value = getcpy (buffer);
+       if ((p = lookup(vars, "sender")))
+               p->p_value = getcpy(sender);
+       if ((p = lookup(vars, "address")))
+               p->p_value = getcpy(addr);
+       if ((p = lookup(vars, "size"))) {
+               snprintf(buffer, sizeof(buffer), "%d",
+                               fstat(fd, &st) != -1 ? (int) st.st_size : 0);
+               p->p_value = getcpy(buffer);
        }
-       if ((p = lookup (vars, "info")))
-               p->p_value = getcpy (info);
+       if ((p = lookup(vars, "info")))
+               p->p_value = getcpy(info);
 
        if (debug) {
                for (p = vars; p->p_name; p++)
-                       debug_printf ("vars[%d]: name=\"%s\" value=\"%s\"\n",
+                       debug_printf("vars[%d]: name=\"%s\" value=\"%s\"\n",
                                        p - vars, p->p_name, trim(p->p_value));
        }
 }
@@ -949,10 +951,10 @@ glob (int fd)
 */
 
 static struct pair *
-lookup (struct pair *pairs, char *key)
+lookup(struct pair *pairs, char *key)
 {
        for (; pairs->p_name; pairs++)
-               if (!mh_strcasecmp (pairs->p_name, key))
+               if (!mh_strcasecmp(pairs->p_name, key))
                        return pairs;
 
        return NULL;
@@ -966,7 +968,7 @@ lookup (struct pair *pairs, char *key)
 
 #ifdef HAVE_GETUTENT
 static int
-logged_in (void)
+logged_in(void)
 {
        struct utmp * utp;
 
@@ -981,7 +983,7 @@ logged_in (void)
                                utp->ut_type == USER_PROCESS &&
 #endif
                                utp->ut_name[0] != 0 &&
-                               strncmp (user, utp->ut_name,
+                               strncmp(user, utp->ut_name,
                                sizeof(utp->ut_name)) == 0) {
                        if (debug)
                                continue;
@@ -995,7 +997,7 @@ logged_in (void)
 }
 #else
 static int
-logged_in (void)
+logged_in(void)
 {
        struct utmp ut;
        FILE *uf;
@@ -1003,21 +1005,21 @@ logged_in (void)
        if (utmped)
                return utmped;
 
-       if ((uf = fopen (UTMP_FILE, "r")) == NULL)
+       if ((uf = fopen(UTMP_FILE, "r")) == NULL)
                return NOTOK;
 
-       while (fread ((char *) &ut, sizeof(ut), 1, uf) == 1) {
+       while (fread((char *) &ut, sizeof(ut), 1, uf) == 1) {
                if (ut.ut_name[0] != 0 &&
-                               strncmp (user, ut.ut_name, sizeof(ut.ut_name))
+                               strncmp(user, ut.ut_name, sizeof(ut.ut_name))
                                == 0) {
                        if (debug)
                                continue;
-                       fclose (uf);
+                       fclose(uf);
                        return (utmped = DONE);
                }
        }
 
-       fclose (uf);
+       fclose(uf);
        return (utmped = NOTOK);
 }
 #endif
@@ -1026,22 +1028,22 @@ logged_in (void)
 #define cmpar(h1,m1,h2,m2)  if (h1 < h2 || (h1 == h2 && m1 < m2)) return 0
 
 static int
-timely (char *t1, char *t2)
+timely(char *t1, char *t2)
 {
        int t1hours, t1mins, t2hours, t2mins;
 
-       if (sscanf (t1, "%d:%d", &t1hours, &t1mins) != 2)
+       if (sscanf(t1, "%d:%d", &t1hours, &t1mins) != 2)
                return -1;
-       check (t1hours, 0, 23);
-       check (t1mins, 0, 59);
+       check(t1hours, 0, 23);
+       check(t1mins, 0, 59);
 
-       if (sscanf (t2, "%d:%d", &t2hours, &t2mins) != 2)
+       if (sscanf(t2, "%d:%d", &t2hours, &t2mins) != 2)
                return -1;
-       check (t2hours, 0, 23);
-       check (t2mins, 0, 59);
+       check(t2hours, 0, 23);
+       check(t2mins, 0, 59);
 
-       cmpar (now->tw_hour, now->tw_min, t1hours, t1mins);
-       cmpar (t2hours, t2mins, now->tw_hour, now->tw_min);
+       cmpar(now->tw_hour, now->tw_min, t1hours, t1mins);
+       cmpar(t2hours, t2mins, now->tw_hour, now->tw_min);
 
        return -1;
 }
@@ -1052,50 +1054,50 @@ timely (char *t1, char *t2)
 */
 
 static int
-usr_file (int fd, char *mailbox, int mbx_style)
+usr_file(int fd, char *mailbox, int mbx_style)
 {
        int md, mapping;
 
        if (verbose)
-               verbose_printf ("delivering to file \"%s\"", mailbox);
+               verbose_printf("delivering to file \"%s\"", mailbox);
 
        if (mbx_style == MBOX_FORMAT) {
                if (verbose)
-                       verbose_printf (" (mbox style)");
+                       verbose_printf(" (mbox style)");
                mapping = 0;
        } else {
                if (verbose)
-                       verbose_printf (" (mmdf style)");
+                       verbose_printf(" (mmdf style)");
                mapping = 1;
        }
 
        /* open and lock the file */
-       if ((md = mbx_open (mailbox, mbx_style, pw->pw_uid, pw->pw_gid,
+       if ((md = mbx_open(mailbox, mbx_style, pw->pw_uid, pw->pw_gid,
                        m_gmprot())) == -1) {
                if (verbose)
-                       adorn ("", "unable to open:");
+                       adorn("", "unable to open:");
                return -1;
        }
 
-       lseek (fd, (off_t) 0, SEEK_SET);
+       lseek(fd, (off_t) 0, SEEK_SET);
 
        /* append message to file */
-       if (mbx_copy (mailbox, mbx_style, md, fd, mapping, NULL, verbose)
+       if (mbx_copy(mailbox, mbx_style, md, fd, mapping, NULL, verbose)
                        == -1) {
                if (verbose)
-                       adorn ("", "error writing to:");
+                       adorn("", "error writing to:");
                return -1;
        }
 
        /* close and unlock file */
-       if (mbx_close (mailbox, md) == NOTOK) {
+       if (mbx_close(mailbox, md) == NOTOK) {
                if (verbose)
-                       adorn ("", "error closing:");
+                       adorn("", "error closing:");
                return -1;
        }
 
        if (verbose)
-               verbose_printf (", success.\n");
+               verbose_printf(", success.\n");
        return 0;
 }
 
@@ -1105,7 +1107,7 @@ usr_file (int fd, char *mailbox, int mbx_style)
 */
 
 static int
-usr_folder (int fd, char *string)
+usr_folder(int fd, char *string)
 {
        int status;
        char folder[BUFSIZ], *vec[3];
@@ -1117,14 +1119,14 @@ usr_folder (int fd, char *string)
                snprintf(folder, sizeof(folder), "+%s", string);
 
        if (verbose)
-               verbose_printf ("delivering to folder \"%s\"", folder + 1);
+               verbose_printf("delivering to folder \"%s\"", folder + 1);
 
        vec[0] = "rcvstore";
        vec[1] = folder;
        vec[2] = NULL;
 
        /* use rcvstore to put message in folder */
-       status = usr_pipe (fd, "rcvstore", rcvstoreproc, vec, 1);
+       status = usr_pipe(fd, "rcvstore", rcvstoreproc, vec, 1);
 
 #if 0
        /*
@@ -1132,9 +1134,9 @@ usr_folder (int fd, char *string)
        */
        if (verbose) {
                if (status == 0)
-                       verbose_printf (", success.\n");
+                       verbose_printf(", success.\n");
                else
-                       verbose_printf (", failed.\n");
+                       verbose_printf(", failed.\n");
        }
 #endif
 
@@ -1146,60 +1148,60 @@ usr_folder (int fd, char *string)
 */
 
 static int
-usr_pipe (int fd, char *cmd, char *pgm, char **vec, int suppress)
+usr_pipe(int fd, char *cmd, char *pgm, char **vec, int suppress)
 {
        pid_t child_id;
        int i, bytes, seconds, status;
        struct stat st;
 
        if (verbose && !suppress)
-               verbose_printf ("delivering to pipe \"%s\"", cmd);
+               verbose_printf("delivering to pipe \"%s\"", cmd);
 
-       lseek (fd, (off_t) 0, SEEK_SET);
+       lseek(fd, (off_t) 0, SEEK_SET);
 
        for (i = 0; (child_id = fork()) == -1 && i < 5; i++)
-               sleep (5);
+               sleep(5);
 
        switch (child_id) {
                case -1:
                        /* fork error */
                        if (verbose)
-                               adorn ("fork", "unable to");
+                               adorn("fork", "unable to");
                        return -1;
 
                case 0:
                        /* child process */
                        if (fd != 0)
-                               dup2 (fd, 0);
-                       freopen ("/dev/null", "w", stdout);
-                       freopen ("/dev/null", "w", stderr);
+                               dup2(fd, 0);
+                       freopen("/dev/null", "w", stdout);
+                       freopen("/dev/null", "w", stderr);
                        if (fd != 3)
-                               dup2 (fd, 3);
-                       closefds (4);
+                               dup2(fd, 3);
+                       closefds(4);
 
 #ifdef TIOCNOTTY
-                       if ((fd = open ("/dev/tty", O_RDWR)) != -1) {
-                               ioctl (fd, TIOCNOTTY, NULL);
-                               close (fd);
+                       if ((fd = open("/dev/tty", O_RDWR)) != -1) {
+                               ioctl(fd, TIOCNOTTY, NULL);
+                               close(fd);
                        }
 #endif /* TIOCNOTTY */
 
                        /* put in own process group */
-                       setpgid ((pid_t) 0, getpid ());
+                       setpgid((pid_t) 0, getpid());
 
                        *environ = NULL;
-                       m_putenv ("USER", pw->pw_name);
-                       m_putenv ("HOME", pw->pw_dir);
-                       m_putenv ("SHELL", pw->pw_shell);
+                       m_putenv("USER", pw->pw_name);
+                       m_putenv("HOME", pw->pw_dir);
+                       m_putenv("SHELL", pw->pw_shell);
 
-                       execvp (pgm, vec);
-                       _exit (-1);
+                       execvp(pgm, vec);
+                       _exit(-1);
 
                default:
                        /* parent process */
-                       if (!setjmp (myctx)) {
-                               SIGNAL (SIGALRM, alrmser);
-                               bytes = fstat (fd, &st) != -1 ?
+                       if (!setjmp(myctx)) {
+                               SIGNAL(SIGALRM, alrmser);
+                               bytes = fstat(fd, &st) != -1 ?
                                                (int) st.st_size : 100;
 
                                /*
@@ -1215,18 +1217,18 @@ usr_pipe (int fd, char *cmd, char *pgm, char **vec, int suppress)
                                } else {
                                        seconds = (bytes / 60) + 300;
                                }
-                               alarm ((unsigned int) seconds);
-                               status = pidwait (child_id, 0);
-                               alarm (0);
+                               alarm((unsigned int) seconds);
+                               status = pidwait(child_id, 0);
+                               alarm(0);
 
                                if (verbose) {
                                        if (status == 0)
-                                               verbose_printf (", success.\n");
+                                               verbose_printf(", success.\n");
                                        else
                                                if ((status & 0xff00) == 0xff00)
-                                                       verbose_printf (", system error\n");
+                                                       verbose_printf(", system error\n");
                                                else
-                                                       pidstatus (status, stdout, ", failed");
+                                                       pidstatus(status, stdout, ", failed");
                                }
                                return (status == 0 ? 0 : -1);
                        } else {
@@ -1236,7 +1238,7 @@ usr_pipe (int fd, char *cmd, char *pgm, char **vec, int suppress)
                                */
                                KILLPG(child_id, SIGKILL);
                                if (verbose)
-                                       verbose_printf (", timed-out; terminated\n");
+                                       verbose_printf(", timed-out; terminated\n");
                                return -1;
                        }
        }
@@ -1244,13 +1246,13 @@ usr_pipe (int fd, char *cmd, char *pgm, char **vec, int suppress)
 
 
 static RETSIGTYPE
-alrmser (int i)
+alrmser(int i)
 {
 #ifndef RELIABLE_SIGNALS
-       SIGNAL (SIGALRM, alrmser);
+       SIGNAL(SIGALRM, alrmser);
 #endif
 
-       longjmp (myctx, DONE);
+       longjmp(myctx, DONE);
 }
 
 
@@ -1260,19 +1262,19 @@ alrmser (int i)
 */
 
 static void
-get_sender (char *envelope, char **sender)
+get_sender(char *envelope, char **sender)
 {
        int i;
        unsigned char *cp;
        unsigned char buffer[BUFSIZ];
 
        if (envelope == NULL) {
-               *sender = getcpy ("");
+               *sender = getcpy("");
                return;
        }
 
-       i = strlen ("From ");
-       strncpy (buffer, envelope + i, sizeof(buffer));
+       i = strlen("From ");
+       strncpy(buffer, envelope + i, sizeof(buffer));
        if ((cp = strchr(buffer, '\n'))) {
                *cp = 0;
                cp -= 24;
@@ -1283,12 +1285,12 @@ get_sender (char *envelope, char **sender)
        }
        *cp = 0;
 
-       for (cp = buffer + strlen (buffer) - 1; cp >= buffer; cp--)
-               if (isspace (*cp))
+       for (cp = buffer + strlen(buffer) - 1; cp >= buffer; cp--)
+               if (isspace(*cp))
                        *cp = 0;
                else
                        break;
-       *sender = getcpy (buffer);
+       *sender = getcpy(buffer);
 }
 
 
@@ -1299,7 +1301,7 @@ get_sender (char *envelope, char **sender)
 */
 
 static int
-copy_message (int qd, char *tmpfil, int fold)
+copy_message(int qd, char *tmpfil, int fold)
 {
        int i, first = 1, fd1, fd2;
        char buffer[BUFSIZ];
@@ -1309,47 +1311,47 @@ copy_message (int qd, char *tmpfil, int fold)
        tfile = m_mktemp2(NULL, invo_name, &fd1, NULL);
        if (tfile == NULL) return -1;
        fchmod(fd1, 0600);
-       strncpy (tmpfil, tfile, BUFSIZ);
+       strncpy(tmpfil, tfile, BUFSIZ);
 
        if (!fold) {
-               while ((i = read (qd, buffer, sizeof(buffer))) > 0)
-                       if (write (fd1, buffer, i) != i) {
+               while ((i = read(qd, buffer, sizeof(buffer))) > 0)
+                       if (write(fd1, buffer, i) != i) {
 you_lose:
-                               close (fd1);
-                               unlink (tmpfil);
+                               close(fd1);
+                               unlink(tmpfil);
                                return -1;
                        }
                if (i == -1)
                        goto you_lose;
-               lseek (fd1, (off_t) 0, SEEK_SET);
+               lseek(fd1, (off_t) 0, SEEK_SET);
                return fd1;
        }
 
        /* dup the fd for incoming message */
-       if ((fd2 = dup (qd)) == -1) {
-               close (fd1);
+       if ((fd2 = dup(qd)) == -1) {
+               close(fd1);
                return -1;
        }
 
        /* now create a FILE pointer for it */
-       if ((qfp = fdopen (fd2, "r")) == NULL) {
-               close (fd1);
-               close (fd2);
+       if ((qfp = fdopen(fd2, "r")) == NULL) {
+               close(fd1);
+               close(fd2);
                return -1;
        }
 
        /* dup the fd for temporary file */
-       if ((fd2 = dup (fd1)) == -1) {
-               close (fd1);
-               fclose (qfp);
+       if ((fd2 = dup(fd1)) == -1) {
+               close(fd1);
+               fclose(qfp);
                return -1;
        }
 
        /* now create a FILE pointer for it */
-       if ((ffp = fdopen (fd2, "r+")) == NULL) {
-               close (fd1);
-               close (fd2);
-               fclose (qfp);
+       if ((ffp = fdopen(fd2, "r+")) == NULL) {
+               close(fd1);
+               close(fd2);
+               fclose(qfp);
                return -1;
        }
 
@@ -1358,11 +1360,11 @@ you_lose:
        ** and massage the headers.  Save
        ** a copy of the "From " line for later.
        */
-       i = strlen ("From ");
-       while (fgets (buffer, sizeof(buffer), qfp)) {
+       i = strlen("From ");
+       while (fgets(buffer, sizeof(buffer), qfp)) {
                if (first) {
                        first = 0;
-                       if (!strncmp (buffer, "From ", i)) {
+                       if (!strncmp(buffer, "From ", i)) {
 #ifdef RPATHS
                                char *fp, *cp, *hp, *ep;
 #endif
@@ -1370,15 +1372,15 @@ you_lose:
                                ** get copy of envelope information
                                ** ("From " line)
                                */
-                               envelope = getcpy (buffer);
+                               envelope = getcpy(buffer);
 
 #if 0
                                /*
                                ** First go ahead and put "From " line
                                ** in message
                                */
-                               fputs (buffer, ffp);
-                               if (ferror (ffp))
+                               fputs(buffer, ffp);
+                               if (ferror(ffp))
                                        goto fputs_error;
 #endif
 
@@ -1389,7 +1391,7 @@ you_lose:
                                */
                                hp = cp = strchr(fp = envelope + i, ' ');
                                while ((hp = strchr(++hp, 'r')))
-                                       if (uprf (hp, "remote from")) {
+                                       if (uprf(hp, "remote from")) {
                                                hp = strrchr(hp, ' ');
                                                break;
                                        }
@@ -1399,49 +1401,49 @@ you_lose:
                                        ** addressing
                                        */
                                        ep = strchr(++hp, '\n');
-                                       snprintf (buffer, sizeof(buffer), "Return-Path: %.*s!%.*s\n", (int)(ep - hp), hp, (int)(cp - fp), fp);
+                                       snprintf(buffer, sizeof(buffer), "Return-Path: %.*s!%.*s\n", (int)(ep - hp), hp, (int)(cp - fp), fp);
                                } else {
                                        /*
                                        ** return path for standard domain
                                        ** addressing
                                        */
-                                       snprintf (buffer, sizeof(buffer), "Return-Path: %.*s\n", (int)(cp - fp), fp);
+                                       snprintf(buffer, sizeof(buffer), "Return-Path: %.*s\n", (int)(cp - fp), fp);
                                }
 
                                /* Add Return-Path header to message */
-                               fputs (buffer, ffp);
-                               if (ferror (ffp))
+                               fputs(buffer, ffp);
+                               if (ferror(ffp))
                                        goto fputs_error;
 #endif
                                /* Put the delivery date in message */
-                               fputs (ddate, ffp);
-                               if (ferror (ffp))
+                               fputs(ddate, ffp);
+                               if (ferror(ffp))
                                        goto fputs_error;
 
                                continue;
                        }
                }
 
-               fputs (buffer, ffp);
-               if (ferror (ffp))
+               fputs(buffer, ffp);
+               if (ferror(ffp))
                        goto fputs_error;
        }
 
-       fclose (ffp);
-       if (ferror (qfp)) {
-               close (fd1);
-               fclose (qfp);
+       fclose(ffp);
+       if (ferror(qfp)) {
+               close(fd1);
+               fclose(qfp);
                return -1;
        }
-       fclose (qfp);
-       lseek (fd1, (off_t) 0, SEEK_SET);
+       fclose(qfp);
+       lseek(fd1, (off_t) 0, SEEK_SET);
        return fd1;
 
 
 fputs_error:
-       close (fd1);
-       fclose (ffp);
-       fclose (qfp);
+       close(fd1);
+       fclose(ffp);
+       fclose(qfp);
        return -1;
 }
 
@@ -1450,7 +1452,7 @@ fputs_error:
 */
 
 static char *
-trim (char *cp)
+trim(char *cp)
 {
        char buffer[BUFSIZ*4];
        unsigned char *bp, *sp;
@@ -1459,7 +1461,7 @@ trim (char *cp)
                return NULL;
 
        /* copy string into temp buffer */
-       strncpy (buffer, cp, sizeof(buffer));
+       strncpy(buffer, cp, sizeof(buffer));
        bp = buffer;
 
        /* skip over leading whitespace */
@@ -1488,15 +1490,15 @@ trim (char *cp)
 */
 
 static void
-verbose_printf (char *fmt, ...)
+verbose_printf(char *fmt, ...)
 {
        va_list ap;
 
        va_start(ap, fmt);
-       vfprintf (stdout, fmt, ap);
+       vfprintf(stdout, fmt, ap);
        va_end(ap);
 
-       fflush (stdout);  /* now flush output */
+       fflush(stdout);  /* now flush output */
 }
 
 
@@ -1506,30 +1508,30 @@ verbose_printf (char *fmt, ...)
 */
 
 static void
-adorn (char *what, char *fmt, ...)
+adorn(char *what, char *fmt, ...)
 {
        va_list ap;
        int eindex;
        char *s;
 
        eindex = errno;  /* save the errno */
-       fprintf (stdout, ", ");
+       fprintf(stdout, ", ");
 
        va_start(ap, fmt);
-       vfprintf (stdout, fmt, ap);
+       vfprintf(stdout, fmt, ap);
        va_end(ap);
 
        if (what) {
                if (*what)
-                       fprintf (stdout, " %s: ", what);
-               if ((s = strerror (eindex)))
-                       fprintf (stdout, "%s", s);
+                       fprintf(stdout, " %s: ", what);
+               if ((s = strerror(eindex)))
+                       fprintf(stdout, "%s", s);
                else
-                       fprintf (stdout, "Error %d", eindex);
+                       fprintf(stdout, "Error %d", eindex);
        }
 
-       fputc ('\n', stdout);
-       fflush (stdout);
+       fputc('\n', stdout);
+       fflush(stdout);
 }
 
 
@@ -1538,12 +1540,12 @@ adorn (char *what, char *fmt, ...)
 */
 
 static void
-debug_printf (char *fmt, ...)
+debug_printf(char *fmt, ...)
 {
        va_list ap;
 
        va_start(ap, fmt);
-       vfprintf (stderr, fmt, ap);
+       vfprintf(stderr, fmt, ap);
        va_end(ap);
 }
 
@@ -1555,7 +1557,7 @@ debug_printf (char *fmt, ...)
 ** Message-Id of this message to the ndbm/db file.
 */
 static int
-suppress_duplicates (int fd, char *file)
+suppress_duplicates(int fd, char *file)
 {
        int fd1, lockfd, state, result;
        char *cp, buf[BUFSIZ], name[NAMESZ];
@@ -1563,41 +1565,42 @@ suppress_duplicates (int fd, char *file)
        DBM *db;
        FILE *in;
 
-       if ((fd1 = dup (fd)) == -1)
+       if ((fd1 = dup(fd)) == -1)
                return -1;
-       if (!(in = fdopen (fd1, "r"))) {
-               close (fd1);
+       if (!(in = fdopen(fd1, "r"))) {
+               close(fd1);
                return -1;
        }
-       rewind (in);
+       rewind(in);
 
        for (state = FLD;;) {
-               state = m_getfld (state, name, buf, sizeof(buf), in);
+               state = m_getfld(state, name, buf, sizeof(buf), in);
                switch (state) {
                        case FLD:
                        case FLDPLUS:
                        case FLDEOF:
                                /* Search for the message ID */
-                               if (mh_strcasecmp (name, "Message-ID")) {
+                               if (mh_strcasecmp(name, "Message-ID")) {
                                        while (state == FLDPLUS)
-                                               state = m_getfld (state, name, buf, sizeof(buf), in);
+                                               state = m_getfld(state, name, buf, sizeof(buf), in);
                                        continue;
                                }
 
-                               cp = add (buf, NULL);
+                               cp = add(buf, NULL);
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, name, buf, sizeof(buf), in);
-                                       cp = add (buf, cp);
+                                       state = m_getfld(state, name, buf, sizeof(buf), in);
+                                       cp = add(buf, cp);
                                }
-                               key.dptr = trimcpy (cp);
-                               key.dsize = strlen (key.dptr) + 1;
-                               free (cp);
+                               key.dptr = trimcpy(cp);
+                               key.dsize = strlen(key.dptr) + 1;
+                               free(cp);
                                cp = key.dptr;
 
-                               if (!(db = dbm_open (file, O_RDWR | O_CREAT, 0600))) {
-                                       advise (file, "unable to perform dbm_open on");
-                                       free (cp);
-                                       fclose (in);
+                               if (!(db = dbm_open(file, O_RDWR | O_CREAT,
+                                               0600))) {
+                                       advise(file, "unable to perform dbm_open on");
+                                       free(cp);
+                                       fclose(in);
                                        return -1;
                                }
                                /*
@@ -1608,28 +1611,28 @@ suppress_duplicates (int fd, char *file)
                                ** file doesn't exist.
                                */
                                if ((lockfd = lkopen(file, O_RDWR, 0)) == -1) {
-                                       advise (file, "unable to perform file locking on");
-                                       free (cp);
-                                       fclose (in);
+                                       advise(file, "unable to perform file locking on");
+                                       free(cp);
+                                       fclose(in);
                                        return -1;
                                }
-                               value = dbm_fetch (db, key);
+                               value = dbm_fetch(db, key);
                                if (value.dptr) {
                                        if (verbose)
-                                               verbose_printf ("Message-ID: %s\n            already received on %s", cp, value.dptr);
+                                               verbose_printf("Message-ID: %s\n            already received on %s", cp, value.dptr);
                                        result = DONE;
                                } else {
                                        value.dptr  = ddate + sizeof("Delivery-Date:");
                                        value.dsize = strlen(value.dptr) + 1;
-                                       if (dbm_store (db, key, value, DBM_INSERT))
-                                               advise (file, "possibly corrupt file");
+                                       if (dbm_store(db, key, value, DBM_INSERT))
+                                               advise(file, "possibly corrupt file");
                                        result = 0;
                                }
 
-                               dbm_close (db);
+                               dbm_close(db);
                                lkclose(lockfd, file);
-                               free (cp);
-                               fclose (in);
+                               free(cp);
+                               fclose(in);
                                return result;
                                break;
 
@@ -1647,6 +1650,6 @@ suppress_duplicates (int fd, char *file)
                break;
        }
 
-       fclose (in);
+       fclose(in);
        return 0;
 }
index 7d5a35c..a5d0e11 100644 (file)
@@ -54,17 +54,17 @@ typedef int (*qsort_comp) (const void *, const void *);
 /*
 ** static prototypes
 */
-static int read_hdrs (struct msgs *, char *);
-static int get_fields (char *, int, struct smsg *);
-static int dsort (struct smsg **, struct smsg **);
-static int subsort (struct smsg **, struct smsg **);
-static int txtsort (struct smsg **, struct smsg **);
-static void rename_chain (struct msgs *, struct smsg **, int, int);
-static void rename_msgs (struct msgs *, struct smsg **);
+static int read_hdrs(struct msgs *, char *);
+static int get_fields(char *, int, struct smsg *);
+static int dsort(struct smsg **, struct smsg **);
+static int subsort(struct smsg **, struct smsg **);
+static int txtsort(struct smsg **, struct smsg **);
+static void rename_chain(struct msgs *, struct smsg **, int, int);
+static void rename_msgs(struct msgs *, struct smsg **);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int i, msgnum;
        unsigned char *cp;
@@ -78,12 +78,12 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -91,34 +91,34 @@ main (int argc, char **argv)
        */
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case DATESW:
                                if (datesw)
-                                       adios (NULL, "only one date field at a time");
+                                       adios(NULL, "only one date field at a time");
                                if (!(datesw = *argp++) || *datesw == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                continue;
 
                        case TEXTSW:
                                if (subjsort)
-                                       adios (NULL, "only one text field at a time");
+                                       adios(NULL, "only one text field at a time");
                                if (!(subjsort = *argp++) || *subjsort == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                continue;
 
@@ -131,7 +131,7 @@ main (int argc, char **argv)
 
                        case LIMSW:
                                if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                while (*cp == '0')
                                        cp++;  /* skip any leading zeros */
                                if (!*cp) {  /* hit end of string */
@@ -139,7 +139,7 @@ main (int argc, char **argv)
                                        continue;
                                }
                                if (!isdigit(*cp) || !(datelimit = atoi(cp)))
-                                       adios (NULL, "impossible limit %s", cp);
+                                       adios(NULL, "impossible limit %s", cp);
                                datelimit *= 60*60*24;
                                continue;
                        case NLIMSW:
@@ -157,62 +157,62 @@ main (int argc, char **argv)
                }
                if (*cp == '+' || *cp == '@') {
                        if (folder)
-                               adios (NULL, "only one folder at a time!");
+                               adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath (cp);
+                               folder = pluspath(cp);
                } else
                        app_msgarg(&msgs, cp);
        }
 
-       if (!context_find ("path"))
-               free (path ("./", TFOLDER));
+       if (!context_find("path"))
+               free(path("./", TFOLDER));
        if (!msgs.size)
                app_msgarg(&msgs, "all");
        if (!datesw)
                datesw = "date";
        if (!folder)
-               folder = getfolder (1);
-       maildir = m_maildir (folder);
+               folder = getfolder(1);
+       maildir = m_maildir(folder);
 
-       if (chdir (maildir) == NOTOK)
-               adios (maildir, "unable to change directory to");
+       if (chdir(maildir) == NOTOK)
+               adios(maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
-               adios (NULL, "unable to read folder %s", folder);
+       if (!(mp = folder_read(folder)))
+               adios(NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
        if (mp->nummsg == 0)
-               adios (NULL, "no messages in %s", folder);
+               adios(NULL, "no messages in %s", folder);
 
        /* parse all the message ranges/sequences and set SELECTED */
        for (msgnum = 0; msgnum < msgs.size; msgnum++)
-               if (!m_convert (mp, msgs.msgs[msgnum]))
-                       done (1);
-       seq_setprev (mp);  /* set the previous sequence */
+               if (!m_convert(mp, msgs.msgs[msgnum]))
+                       done(1);
+       seq_setprev(mp);  /* set the previous sequence */
 
-       if ((nmsgs = read_hdrs (mp, datesw)) <= 0)
-               adios (NULL, "no messages to sort");
+       if ((nmsgs = read_hdrs(mp, datesw)) <= 0)
+               adios(NULL, "no messages to sort");
 
        /*
        ** sort a list of pointers to our "messages to be sorted".
        */
-       dlist = (struct smsg **) mh_xmalloc ((nmsgs+1) * sizeof(*dlist));
+       dlist = (struct smsg **) mh_xmalloc((nmsgs+1) * sizeof(*dlist));
        for (i = 0; i < nmsgs; i++)
                dlist[i] = &smsgs[i];
        dlist[nmsgs] = 0;
 
        if (verbose) {  /* announce what we're doing */
                if (subjsort)
-                       printf ("sorting by %s-major %s-minor\n",
+                       printf("sorting by %s-major %s-minor\n",
                                submajor ? subjsort : datesw,
                                submajor ? datesw : subjsort);
                else
-                       printf ("sorting by datefield %s\n", datesw);
+                       printf("sorting by datefield %s\n", datesw);
        }
 
        /* first sort by date, or by subject-major, date-minor */
-       qsort ((char *) dlist, nmsgs, sizeof(*dlist),
+       qsort((char *) dlist, nmsgs, sizeof(*dlist),
                        (qsort_comp) (submajor && subjsort ? txtsort : dsort));
 
        /*
@@ -225,7 +225,7 @@ main (int argc, char **argv)
                register struct smsg ***il, **fp, **dp;
 
                slist = (struct smsg **)
-                               mh_xmalloc ((nmsgs+1) * sizeof(*slist));
+                               mh_xmalloc((nmsgs+1) * sizeof(*slist));
                memcpy((char *)slist, (char *)dlist, (nmsgs+1)*sizeof(*slist));
                qsort((char *)slist, nmsgs, sizeof(*slist),
                                (qsort_comp) subsort);
@@ -235,9 +235,9 @@ main (int argc, char **argv)
                ** the collection of messages with the same subj
                ** given a message number.
                */
-               il = (struct smsg ***) calloc (mp->hghsel+1, sizeof(*il));
+               il = (struct smsg ***) calloc(mp->hghsel+1, sizeof(*il));
                if (! il)
-                       adios (NULL, "couldn't allocate msg list");
+                       adios(NULL, "couldn't allocate msg list");
                for (i = 0; i < nmsgs; i++)
                        il[slist[i]->s_msg] = &slist[i];
                /*
@@ -245,7 +245,7 @@ main (int argc, char **argv)
                ** all the same subjects grouped together.
                */
                flist = (struct smsg **)
-                               mh_xmalloc ((nmsgs+1) * sizeof(*flist));
+                               mh_xmalloc((nmsgs+1) * sizeof(*flist));
                fp = flist;
                for (dp = dlist; *dp;) {
                        register struct smsg **s = il[(*dp++)->s_msg];
@@ -267,8 +267,8 @@ main (int argc, char **argv)
                        }
                }
                *fp = 0;
-               free (slist);
-               free (dlist);
+               free(slist);
+               free(dlist);
                dlist = flist;
        }
 
@@ -277,35 +277,34 @@ main (int argc, char **argv)
        ** structures, each of which contains a message number.
        */
 
-       rename_msgs (mp, dlist);
+       rename_msgs(mp, dlist);
 
-       context_replace (pfolder, folder);  /* update current folder */
-       seq_save (mp);  /* synchronize message sequences */
-       context_save ();  /* save the context file */
-       folder_free (mp);  /* free folder/message structure */
-       done (0);
+       context_replace(pfolder, folder);  /* update current folder */
+       seq_save(mp);  /* synchronize message sequences */
+       context_save();  /* save the context file */
+       folder_free(mp);  /* free folder/message structure */
+       done(0);
        return 1;
 }
 
 static int
-read_hdrs (struct msgs *mp, char *datesw)
+read_hdrs(struct msgs *mp, char *datesw)
 {
        int msgnum;
        struct tws tb;
        register struct smsg *s;
 
-       twscopy (&tb, dlocaltimenow ());
+       twscopy(&tb, dlocaltimenow());
 
-       smsgs = (struct smsg *)
-               calloc ((size_t) (mp->hghsel - mp->lowsel + 2),
+       smsgs = (struct smsg *) calloc((size_t) (mp->hghsel - mp->lowsel + 2),
                        sizeof(*smsgs));
        if (smsgs == NULL)
-               adios (NULL, "unable to allocate sort storage");
+               adios(NULL, "unable to allocate sort storage");
 
        s = smsgs;
        for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
                if (is_selected(mp, msgnum)) {
-                       if (get_fields (datesw, msgnum, s)) {
+                       if (get_fields(datesw, msgnum, s)) {
                                s->s_msg = msgnum;
                                s++;
                        }
@@ -322,7 +321,7 @@ read_hdrs (struct msgs *mp, char *datesw)
 */
 
 static int
-get_fields (char *datesw, int msg, struct smsg *smsg)
+get_fields(char *datesw, int msg, struct smsg *smsg)
 {
        register int state;
        int compnum;
@@ -331,38 +330,38 @@ get_fields (char *datesw, int msg, struct smsg *smsg)
        register char *datecomp = NULL, *subjcomp = NULL;
        register FILE *in;
 
-       if ((in = fopen (msgnam = m_name (msg), "r")) == NULL) {
-               admonish (msgnam, "unable to read message");
+       if ((in = fopen(msgnam = m_name(msg), "r")) == NULL) {
+               admonish(msgnam, "unable to read message");
                return (0);
        }
        for (compnum = 1, state = FLD;;) {
-               switch (state = m_getfld (state, nam, buf, sizeof(buf), in)) {
+               switch (state = m_getfld(state, nam, buf, sizeof(buf), in)) {
                case FLD:
                case FLDEOF:
                case FLDPLUS:
                        compnum++;
-                       if (!mh_strcasecmp (nam, datesw)) {
-                               datecomp = add (buf, datecomp);
+                       if (!mh_strcasecmp(nam, datesw)) {
+                               datecomp = add(buf, datecomp);
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, nam, buf,
+                                       state = m_getfld(state, nam, buf,
                                                        sizeof(buf), in);
-                                       datecomp = add (buf, datecomp);
+                                       datecomp = add(buf, datecomp);
                                }
                                if (!subjsort || subjcomp)
                                        break;
                        } else if (subjsort && !mh_strcasecmp(nam, subjsort)) {
-                               subjcomp = add (buf, subjcomp);
+                               subjcomp = add(buf, subjcomp);
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, nam, buf,
+                                       state = m_getfld(state, nam, buf,
                                                        sizeof(buf), in);
-                                       subjcomp = add (buf, subjcomp);
+                                       subjcomp = add(buf, subjcomp);
                                }
                                if (datecomp)
                                        break;
                        } else {
                                /* just flush this guy */
                                while (state == FLDPLUS)
-                                       state = m_getfld (state, nam, buf,
+                                       state = m_getfld(state, nam, buf,
                                                        sizeof(buf), in);
                        }
                        continue;
@@ -375,16 +374,16 @@ get_fields (char *datesw, int msg, struct smsg *smsg)
                case LENERR:
                case FMTERR:
                        if (state == LENERR || state == FMTERR)
-                               admonish (NULL, "format error in message %d (header #%d)", msg, compnum);
+                               admonish(NULL, "format error in message %d (header #%d)", msg, compnum);
                        if (datecomp)
-                               free (datecomp);
+                               free(datecomp);
                        if (subjcomp)
-                               free (subjcomp);
-                       fclose (in);
+                               free(subjcomp);
+                       fclose(in);
                        return (0);
 
                default:
-                       adios (NULL, "internal error -- you lose");
+                       adios(NULL, "internal error -- you lose");
                }
                break;
        }
@@ -393,15 +392,15 @@ get_fields (char *datesw, int msg, struct smsg *smsg)
        ** If no date component, then use the modification
        ** time of the file as its date
        */
-       if (!datecomp || (tw = dparsetime (datecomp)) == NULL) {
+       if (!datecomp || (tw = dparsetime(datecomp)) == NULL) {
                struct stat st;
 
-               admonish (NULL, "can't parse %s field in message %d",
+               admonish(NULL, "can't parse %s field in message %d",
                                datesw, msg);
-               fstat (fileno (in), &st);
+               fstat(fileno(in), &st);
                smsg->s_clock = st.st_mtime;
        } else {
-               smsg->s_clock = dmktime (tw);
+               smsg->s_clock = dmktime(tw);
        }
 
        if (subjsort) {
@@ -416,7 +415,7 @@ get_fields (char *datesw, int msg, struct smsg *smsg)
 
                        cp = subjcomp;
                        cp2 = subjcomp;
-                       if (strcmp (subjsort, "subject") == 0) {
+                       if (strcmp(subjsort, "subject") == 0) {
                                while ((c = *cp)) {
                                        if (! isspace(c)) {
                                                if(uprf(cp, "re:"))
@@ -439,9 +438,9 @@ get_fields (char *datesw, int msg, struct smsg *smsg)
 
                smsg->s_subj = subjcomp;
        }
-       fclose (in);
+       fclose(in);
        if (datecomp)
-               free (datecomp);
+               free(datecomp);
 
        return (1);
 }
@@ -450,7 +449,7 @@ get_fields (char *datesw, int msg, struct smsg *smsg)
 ** sort on dates.
 */
 static int
-dsort (struct smsg **a, struct smsg **b)
+dsort(struct smsg **a, struct smsg **b)
 {
        if ((*a)->s_clock < (*b)->s_clock)
                return (-1);
@@ -466,22 +465,22 @@ dsort (struct smsg **a, struct smsg **b)
 ** sort on subjects.
 */
 static int
-subsort (struct smsg **a, struct smsg **b)
+subsort(struct smsg **a, struct smsg **b)
 {
        register int i;
 
-       if ((i = strcmp ((*a)->s_subj, (*b)->s_subj)))
+       if ((i = strcmp((*a)->s_subj, (*b)->s_subj)))
                return (i);
 
-       return (dsort (a, b));
+       return (dsort(a, b));
 }
 
 static int
-txtsort (struct smsg **a, struct smsg **b)
+txtsort(struct smsg **a, struct smsg **b)
 {
        register int i;
 
-       if ((i = strcmp ((*a)->s_subj, (*b)->s_subj)))
+       if ((i = strcmp((*a)->s_subj, (*b)->s_subj)))
                return (i);
        else if ((*a)->s_msg < (*b)->s_msg)
                return (-1);
@@ -490,7 +489,7 @@ txtsort (struct smsg **a, struct smsg **b)
 }
 
 static void
-rename_chain (struct msgs *mp, struct smsg **mlist, int msg, int endmsg)
+rename_chain(struct msgs *mp, struct smsg **mlist, int msg, int endmsg)
 {
        int nxt, old, new;
        char *newname, oldname[BUFSIZ];
@@ -501,22 +500,22 @@ rename_chain (struct msgs *mp, struct smsg **mlist, int msg, int endmsg)
                mlist[msg] = (struct smsg *)0;
                old = smsgs[nxt].s_msg;
                new = smsgs[msg].s_msg;
-               strncpy (oldname, m_name (old), sizeof(oldname));
-               newname = m_name (new);
+               strncpy(oldname, m_name(old), sizeof(oldname));
+               newname = m_name(new);
                if (verbose)
-                       printf ("message %d becomes message %d\n", old, new);
+                       printf("message %d becomes message %d\n", old, new);
 
                snprintf(oldname, sizeof (oldname), "%s/%d",
                                mp->foldpath, old);
                snprintf(newbuf, sizeof (newbuf), "%s/%d", mp->foldpath, new);
                ext_hook("ref-hook", oldname, newbuf);
 
-               if (rename (oldname, newname) == NOTOK)
-                       adios (newname, "unable to rename %s to", oldname);
+               if (rename(oldname, newname) == NOTOK)
+                       adios(newname, "unable to rename %s to", oldname);
 
-               copy_msg_flags (mp, new, old);
+               copy_msg_flags(mp, new, old);
                if (mp->curmsg == old)
-                       seq_setcur (mp, new);
+                       seq_setcur(mp, new);
 
                if (nxt == endmsg)
                        break;
@@ -524,11 +523,11 @@ rename_chain (struct msgs *mp, struct smsg **mlist, int msg, int endmsg)
                msg = nxt;
        }
 /* if (nxt != endmsg); */
-/* rename_chain (mp, mlist, nxt, endmsg); */
+/* rename_chain(mp, mlist, nxt, endmsg); */
 }
 
 static void
-rename_msgs (struct msgs *mp, struct smsg **mlist)
+rename_msgs(struct msgs *mp, struct smsg **mlist)
 {
        int i, j, old, new;
        seqset_t tmpset;
@@ -536,7 +535,7 @@ rename_msgs (struct msgs *mp, struct smsg **mlist)
        char newbuf[MAXPATHLEN + 1];
        struct smsg *sp;
 
-       strncpy (tmpfil, m_name (mp->hghmsg + 1), sizeof(tmpfil));
+       strncpy(tmpfil, m_name(mp->hghmsg + 1), sizeof(tmpfil));
 
        for (i = 0; i < nmsgs; i++) {
                if (! (sp = mlist[i]))
@@ -553,10 +552,10 @@ rename_msgs (struct msgs *mp, struct smsg **mlist)
                */
                old = smsgs[j].s_msg;
                new = smsgs[i].s_msg;
-               strncpy (f1, m_name (old), sizeof(f1));
+               strncpy(f1, m_name(old), sizeof(f1));
 
                if (verbose)
-                       printf ("renaming message chain from %d to %d\n",
+                       printf("renaming message chain from %d to %d\n",
                                        old, new);
 
                /*
@@ -570,12 +569,12 @@ rename_msgs (struct msgs *mp, struct smsg **mlist)
                                mp->foldpath, mp->hghmsg + 1);
                ext_hook("ref-hook", f1, newbuf);
 
-               if (rename (f1, tmpfil) == NOTOK)
-                       adios (tmpfil, "unable to rename %s to ", f1);
+               if (rename(f1, tmpfil) == NOTOK)
+                       adios(tmpfil, "unable to rename %s to ", f1);
 
-               get_msg_flags (mp, &tmpset, old);
+               get_msg_flags(mp, &tmpset, old);
 
-               rename_chain (mp, mlist, j, i);
+               rename_chain(mp, mlist, j, i);
 
                /*
                ** Run the external hook to refile the temorary message number
@@ -585,10 +584,10 @@ rename_msgs (struct msgs *mp, struct smsg **mlist)
                (void)snprintf(f1, sizeof (f1), "%s/%d", mp->foldpath, new);
                ext_hook("ref-hook", newbuf, f1);
 
-               if (rename (tmpfil, m_name(new)) == NOTOK)
-                       adios (m_name(new), "unable to rename %s to", tmpfil);
+               if (rename(tmpfil, m_name(new)) == NOTOK)
+                       adios(m_name(new), "unable to rename %s to", tmpfil);
 
-               set_msg_flags (mp, &tmpset, new);
+               set_msg_flags(mp, &tmpset, new);
                mp->msgflags |= SEQMOD;
        }
 }
index 63b49da..e87fcf1 100644 (file)
@@ -167,32 +167,32 @@ extern char *sendmail;
 /*
 ** external prototypes
 */
-extern char *getfullname (void);
-extern char *getusername (void);
+extern char *getfullname(void);
+extern char *getusername(void);
 
 extern boolean  draft_from_masquerading;  /* defined in mts.c */
 
 /*
 ** static prototypes
 */
-static void putfmt (char *, char *, FILE *);
-static void start_headers (void);
-static void finish_headers (FILE *);
-static int get_header (char *, struct headers *);
-static void putadr (char *, struct mailname *);
-static int putone (char *, int, int);
-static void insert_fcc (struct headers *, unsigned char *);
-static void file (char *);
-static void fcc (char *, char *);
+static void putfmt(char *, char *, FILE *);
+static void start_headers(void);
+static void finish_headers(FILE *);
+static int get_header(char *, struct headers *);
+static void putadr(char *, struct mailname *);
+static int putone(char *, int, int);
+static void insert_fcc(struct headers *, unsigned char *);
+static void file(char *);
+static void fcc(char *, char *);
 
 #if 0
-static void die (char *, char *, ...);
-static void make_bcc_file (void);
+static void die(char *, char *, ...);
+static void make_bcc_file(void);
 #endif
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int state, i, pid, compnum;
        char *cp, *msg = NULL, **argp, **arguments;
@@ -202,32 +202,32 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* foil search of user profile/context */
-       if (context_foil (NULL) == -1)
-               done (1);
+       if (context_foil(NULL) == -1)
+               done(1);
 
-       mts_init (invo_name);
-       arguments = getarguments (invo_name, argc, argv, 0);
+       mts_init(invo_name);
+       arguments = getarguments(invo_name, argc, argv, 0);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, switches);
-                                       done (1);
+                                       ambigsw(cp, switches);
+                                       done(1);
                                case UNKWNSW:
-                                       adios (NULL, "-%s unknown", cp);
+                                       adios(NULL, "-%s unknown", cp);
 
                                case HELPSW:
-                                       snprintf (buf, sizeof(buf), "%s [switches] file", invo_name);
-                                       print_help (buf, switches, 1);
-                                       done (1);
+                                       snprintf(buf, sizeof(buf), "%s [switches] file", invo_name);
+                                       print_help(buf, switches, 1);
+                                       done(1);
                                case VERSIONSW:
                                        print_version(invo_name);
-                                       done (1);
+                                       done(1);
 
                                case DEBUGSW:
                                        debug++;
@@ -240,7 +240,7 @@ main (int argc, char **argv)
                                case FILTSW:
                                        if (!(filter = *argp++) ||
                                                        *filter == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                                case NFILTSW:
                                        filter = NULL;
@@ -283,14 +283,14 @@ main (int argc, char **argv)
 
                                case ALIASW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        if (aliasflg < 0) {
                                                /* load default aka's */
-                                               alias (AliasFile);
+                                               alias(AliasFile);
                                        }
                                        aliasflg = 1;
                                        if ((state = alias(cp)) != AK_OK)
-                                               adios (NULL, "aliasing error in file %s - %s", cp, akerror(state) );
+                                               adios(NULL, "aliasing error in file %s - %s", cp, akerror(state) );
                                        continue;
                                case NALIASW:
                                        aliasflg = 0;
@@ -298,126 +298,127 @@ main (int argc, char **argv)
 
                                case WIDTHSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
-                                       outputlinelen = atoi (cp);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
+                                       outputlinelen = atoi(cp);
                                        if (outputlinelen <= 10)
                                                outputlinelen = 72;
                                        continue;
 
                                case LIBSW:
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        /* create a minimal context */
-                                       if (context_foil (cp) == -1)
+                                       if (context_foil(cp) == -1)
                                                done(1);
                                        continue;
 
                                case ANNOSW:
                                        /* -idanno switch ignored */
                                        if (!(cp = *argp++) || *cp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-2]);
+                                               adios(NULL, "missing argument to %s", argp[-2]);
                                        continue;
                        }
                }
                if (msg)
-                       adios (NULL, "only one message at a time!");
+                       adios(NULL, "only one message at a time!");
                else
                        msg = cp;
        }
 
        if (aliasflg < 0)
-               alias (AliasFile);  /* load default aka's */
+               alias(AliasFile);  /* load default aka's */
 
        if (!msg)
-               adios (NULL, "usage: %s [switches] file", invo_name);
+               adios(NULL, "usage: %s [switches] file", invo_name);
 
-       if ((in = fopen (msg, "r")) == NULL)
-               adios (msg, "unable to open");
+       if ((in = fopen(msg, "r")) == NULL)
+               adios(msg, "unable to open");
 
-       start_headers ();
+       start_headers();
        if (debug) {
                verbose++;
                out = stdout;
        }
        else {
 #ifdef HAVE_MKSTEMP
-                       if ((out = fdopen( mkstemp (tmpfil), "w" )) == NULL )
-                               adios (tmpfil, "unable to create");
+                       if ((out = fdopen( mkstemp(tmpfil), "w" )) == NULL )
+                               adios(tmpfil, "unable to create");
 #else
-                       mktemp (tmpfil);
-                       if ((out = fopen (tmpfil, "w")) == NULL)
-                               adios (tmpfil, "unable to create");
-                       chmod (tmpfil, 0600);
+                       mktemp(tmpfil);
+                       if ((out = fopen(tmpfil, "w")) == NULL)
+                               adios(tmpfil, "unable to create");
+                       chmod(tmpfil, 0600);
 #endif
                }
 
        hdrtab = (msgstate == normal) ? NHeaders : RHeaders;
 
        for (compnum = 1, state = FLD;;) {
-               switch (state = m_getfld (state, name, buf, sizeof(buf), in)) {
+               switch (state = m_getfld(state, name, buf, sizeof(buf), in)) {
                        case FLD:
                                compnum++;
-                               putfmt (name, buf, out);
+                               putfmt(name, buf, out);
                                continue;
 
                        case FLDPLUS:
                                compnum++;
-                               cp = add (buf, cp);
+                               cp = add(buf, cp);
                                while (state == FLDPLUS) {
-                                       state = m_getfld (state, name, buf, sizeof(buf), in);
-                                       cp = add (buf, cp);
+                                       state = m_getfld(state, name, buf,
+                                                       sizeof(buf), in);
+                                       cp = add(buf, cp);
                                }
-                               putfmt (name, cp, out);
-                               free (cp);
+                               putfmt(name, cp, out);
+                               free(cp);
                                continue;
 
                        case BODY:
-                               finish_headers (out);
-                               fprintf (out, "\n%s", buf);
+                               finish_headers(out);
+                               fprintf(out, "\n%s", buf);
                                while (state == BODY) {
-                                       state = m_getfld (state, name, buf,
+                                       state = m_getfld(state, name, buf,
                                                        sizeof(buf), in);
-                                       fputs (buf, out);
+                                       fputs(buf, out);
                                }
                                break;
 
                        case FILEEOF:
-                               finish_headers (out);
+                               finish_headers(out);
                                break;
 
                        case LENERR:
                        case FMTERR:
-                               adios (NULL, "message format error in component #%d", compnum);
+                               adios(NULL, "message format error in component #%d", compnum);
 
                        default:
-                               adios (NULL, "getfld() returned %d", state);
+                               adios(NULL, "getfld() returned %d", state);
                }
                break;
        }
 
-       fclose (in);
+       fclose(in);
        if (backflg) {
-               strncpy (buf, m_backup (msg), sizeof(buf));
-               if (rename (msg, buf) == NOTOK)
-                       advise (buf, "unable to rename %s to", msg);
+               strncpy(buf, m_backup(msg), sizeof(buf));
+               if (rename(msg, buf) == NOTOK)
+                       advise(buf, "unable to rename %s to", msg);
        }
 
        if (debug) {
-               done (0);
+               done(0);
        }
        else
-               fclose (out);
+               fclose(out);
 
-       file (tmpfil);
+       file(tmpfil);
 
        /*
        ** re-open the temp file, unlink it and exec sendmail, giving it
        ** the msg temp file as std in.
        */
-       if ( freopen( tmpfil, "r", stdin) == NULL)
-               adios (tmpfil, "can't reopen for sendmail");
+       if (freopen(tmpfil, "r", stdin) == NULL)
+               adios(tmpfil, "can't reopen for sendmail");
        if (rmflg)
-               unlink (tmpfil);
+               unlink(tmpfil);
 
        argp = sargv;
        *argp++ = "send-mail";
@@ -434,7 +435,7 @@ main (int argc, char **argv)
                        sleep(5);
                switch (pid) {
                        case NOTOK:
-                               fprintf (verbose ? stdout : stderr,
+                               fprintf(verbose ? stdout : stderr,
                                                "%s: can't fork to %s\n",
                                                invo_name, sendmail);
                                exit(-1);
@@ -445,15 +446,15 @@ main (int argc, char **argv)
                                exit(0);
                }
        }
-       execv ( sendmail, sargv);
-       adios ( sendmail, "can't exec");
+       execv(sendmail, sargv);
+       adios(sendmail, "can't exec");
        return 0;  /* dead code to satisfy the compiler */
 }
 
 /* DRAFT GENERATION */
 
 static void
-putfmt (char *name, char *str, FILE *out)
+putfmt(char *name, char *str, FILE *out)
 {
        int i;
        char *cp, *pp;
@@ -462,8 +463,8 @@ putfmt (char *name, char *str, FILE *out)
        while (*str == ' ' || *str == '\t')
                str++;
 
-       if ((i = get_header (name, hdrtab)) == NOTOK) {
-               fprintf (out, "%s: %s", name, str);
+       if ((i = get_header(name, hdrtab)) == NOTOK) {
+               fprintf(out, "%s: %s", name, str);
                return;
        }
 
@@ -471,24 +472,24 @@ putfmt (char *name, char *str, FILE *out)
        if (hdr->flags & HIGN)
                return;
        if (hdr->flags & HBAD) {
-               advise (NULL, "illegal header line -- %s:", name);
+               advise(NULL, "illegal header line -- %s:", name);
                badmsg++;
                return;
        }
        msgflags |= hdr->set;
 
        if (hdr->flags & HSUB)
-               subject = subject ? add (str, add ("\t", subject)) :
-                               getcpy (str);
+               subject = subject ? add(str, add("\t", subject)) :
+                               getcpy(str);
 
        if (hdr->flags & HFCC) {
                if ((cp = strrchr(str, '\n')))
                        *cp = 0;
                for (cp = pp = str; (cp = strchr(pp, ',')); pp = cp) {
                        *cp++ = 0;
-                       insert_fcc (hdr, pp);
+                       insert_fcc(hdr, pp);
                }
-               insert_fcc (hdr, pp);
+               insert_fcc(hdr, pp);
                return;
        }
 
@@ -544,36 +545,36 @@ putfmt (char *name, char *str, FILE *out)
                        ** alias processing as well.
                        ** -- Dan Harkless <dan-nmh@dilvish.speed.net>
                        */
-                       fprintf (out, "%s: %s", name, str );
+                       fprintf(out, "%s: %s", name, str );
                }
        }
 }
 
 
 static void
-start_headers (void)
+start_headers(void)
 {
        char *cp;
        char sigbuf[BUFSIZ];
 
        strncpy(from, getusername(), sizeof(from));
 
-       if ((cp = getfullname ()) && *cp) {
-               strncpy (sigbuf, cp, sizeof(sigbuf));
-               snprintf (signature, sizeof(signature), "%s <%s>",
+       if ((cp = getfullname()) && *cp) {
+               strncpy(sigbuf, cp, sizeof(sigbuf));
+               snprintf(signature, sizeof(signature), "%s <%s>",
                                sigbuf,  from);
        } else
-               snprintf (signature, sizeof(signature), "%s",  from);
+               snprintf(signature, sizeof(signature), "%s",  from);
 }
 
 
 static void
-finish_headers (FILE *out)
+finish_headers(FILE *out)
 {
        switch (msgstate) {
                case normal:
                        if (!(msgflags & MDAT))
-                               fprintf (out, "Date: %s\n", dtimenow (0));
+                               fprintf(out, "Date: %s\n", dtimenow(0));
 
                        if (msgflags & MFRM) {
                                /*
@@ -590,20 +591,19 @@ finish_headers (FILE *out)
                                        ** (and use it as the envelope
                                        ** From: later).
                                        */
-                                       fprintf (out, "Sender: %s\n", from);
+                                       fprintf(out, "Sender: %s\n", from);
                        } else
-                               fprintf (out, "From: %s\n", signature);
+                               fprintf(out, "From: %s\n", signature);
 
 #ifdef notdef
                        if (!(msgflags & MVIS))
-                               fprintf (out, "Bcc: Blind Distribution List: ;\n");
+                               fprintf(out, "Bcc: Blind Distribution List: ;\n");
 #endif /* notdef */
                        break;
 
                case resent:
                        if (!(msgflags & MRDT))
-                               fprintf (out, "Resent-Date: %s\n",
-                                               dtimenow(0));
+                               fprintf(out, "Resent-Date: %s\n", dtimenow(0));
                        if (msgflags & MRFM) {
                                /*
                                ** There was already a Resent-From: in draft.
@@ -619,30 +619,30 @@ finish_headers (FILE *out)
                                        ** (and use it as the envelope
                                        ** From: later).
                                        */
-                                       fprintf (out, "Resent-Sender: %s\n",
+                                       fprintf(out, "Resent-Sender: %s\n",
                                                        from);
                        } else
                                /* Construct a Resent-From: header. */
-                               fprintf (out, "Resent-From: %s\n", signature);
+                               fprintf(out, "Resent-From: %s\n", signature);
 #ifdef notdef
                        if (!(msgflags & MVIS))
-                               fprintf (out, "Resent-Bcc: Blind Re-Distribution List: ;\n");
+                               fprintf(out, "Resent-Bcc: Blind Re-Distribution List: ;\n");
 #endif /* notdef */
                        break;
        }
 
        if (badmsg)
-               adios (NULL, "re-format message and try again");
+               adios(NULL, "re-format message and try again");
 }
 
 
 static int
-get_header (char *header, struct headers *table)
+get_header(char *header, struct headers *table)
 {
        struct headers *h;
 
        for (h = table; h->value; h++)
-               if (!mh_strcasecmp (header, h->value))
+               if (!mh_strcasecmp(header, h->value))
                        return (h - table);
 
        return NOTOK;
@@ -655,20 +655,20 @@ get_header (char *header, struct headers *table)
 ** of the list.  Alias substitution should be done on nl.
 */
 static void
-putadr (char *name, struct mailname *nl)
+putadr(char *name, struct mailname *nl)
 {
        register struct mailname *mp, *mp2;
        register int linepos;
        register char *cp;
        int namelen;
 
-       fprintf (out, "%s: ", name);
+       fprintf(out, "%s: ", name);
        namelen = strlen(name) + 2;
        linepos = namelen;
 
        for (mp = nl; mp; ) {
                if (linepos > MAX_SM_FIELD) {
-                       fprintf (out, "\n%s: ", name);
+                       fprintf(out, "\n%s: ", name);
                        linepos = namelen;
                }
                if (mp->m_nohost) {
@@ -681,7 +681,7 @@ putadr (char *name, struct mailname *nl)
                                /* an alias - expand it */
                                while ((cp = getname(cp))) {
                                        if (linepos > MAX_SM_FIELD) {
-                                                       fprintf (out, "\n%s: ", name);
+                                                       fprintf(out, "\n%s: ", name);
                                                        linepos = namelen;
                                        }
                                        mp2 = getm( cp, NULL, 0, AD_HOST, NULL);
@@ -705,7 +705,7 @@ putadr (char *name, struct mailname *nl)
 }
 
 static int
-putone (char *adr, int pos, int indent)
+putone(char *adr, int pos, int indent)
 {
        register int len;
        static int linepos;
@@ -713,8 +713,8 @@ putone (char *adr, int pos, int indent)
        len = strlen( adr );
        if (pos == indent)
                linepos = pos;
-       else if ( linepos+len > outputlinelen ) {
-               fprintf ( out, ",\n%*s", indent, "");
+       else if (linepos+len > outputlinelen) {
+               fprintf( out, ",\n%*s", indent, "");
                linepos = indent;
                pos += indent + 2;
        } else {
@@ -730,13 +730,13 @@ putone (char *adr, int pos, int indent)
 
 
 static void
-insert_fcc (struct headers *hdr, unsigned char *pp)
+insert_fcc(struct headers *hdr, unsigned char *pp)
 {
        unsigned char   *cp;
 
-       for (cp = pp; isspace (*cp); cp++)
+       for (cp = pp; isspace(*cp); cp++)
                continue;
-       for (pp += strlen (pp) - 1; pp > cp && isspace (*pp); pp--)
+       for (pp += strlen(pp) - 1; pp > cp && isspace(*pp); pp--)
                continue;
        if (pp >= cp)
                *++pp = 0;
@@ -744,15 +744,15 @@ insert_fcc (struct headers *hdr, unsigned char *pp)
                return;
 
        if (fccind >= FCCS)
-               adios (NULL, "too many %ss", hdr->value);
-       fccfold[fccind++] = getcpy (cp);
+               adios(NULL, "too many %ss", hdr->value);
+       fccfold[fccind++] = getcpy(cp);
 }
 
 #if 0
 /* BCC GENERATION */
 
 static void
-make_bcc_file (void)
+make_bcc_file(void)
 {
        pid_t child_id;
        int fd, i, status;
@@ -762,15 +762,15 @@ make_bcc_file (void)
 #ifdef HAVE_MKSTEMP
        fd = mkstemp(bccfil);
        if (fd == -1 || (out = fdopen(fd, "w")) == NULL)
-               adios (bccfil, "unable to create");
+               adios(bccfil, "unable to create");
 #else
-       mktemp (bccfil);
-       if ((out = fopen (bccfil, "w")) == NULL)
-               adios (bccfil, "unable to create");
+       mktemp(bccfil);
+       if ((out = fopen(bccfil, "w")) == NULL)
+               adios(bccfil, "unable to create");
 #endif
-       chmod (bccfil, 0600);
+       chmod(bccfil, 0600);
 
-       fprintf (out, "Date: %s\n", dtimenow (0));
+       fprintf(out, "Date: %s\n", dtimenow(0));
        if (msgflags & MFRM) {
          /* There was already a From: in the draft.  Don't add one. */
          if (!draft_from_masquerading)
@@ -780,31 +780,31 @@ make_bcc_file (void)
                ** address in a Sender: header (and use it as the envelope
                ** From: later).
                */
-               fprintf (out, "Sender: %s\n", from);
+               fprintf(out, "Sender: %s\n", from);
        } else
-         /* Construct a From: header. */
-         fprintf (out, "From: %s\n", signature);
+               /* Construct a From: header. */
+               fprintf(out, "From: %s\n", signature);
        if (subject)
-               fprintf (out, "Subject: %s", subject);
-       fprintf (out, "BCC:\n\n------- Blind-Carbon-Copy\n\n");
-       fflush (out);
+               fprintf(out, "Subject: %s", subject);
+       fprintf(out, "BCC:\n\n------- Blind-Carbon-Copy\n\n");
+       fflush(out);
 
        if (filter == NULL) {
-               if ((fd = open (tmpfil, O_RDONLY)) == NOTOK)
-                       adios (NULL, "unable to re-open");
-               cpydgst (fd, fileno (out), tmpfil, bccfil);
-               close (fd);
+               if ((fd = open(tmpfil, O_RDONLY)) == NOTOK)
+                       adios(NULL, "unable to re-open");
+               cpydgst(fd, fileno(out), tmpfil, bccfil);
+               close(fd);
        } else {
-               vec[0] = r1bindex (mhlproc, '/');
+               vec[0] = r1bindex(mhlproc, '/');
 
                for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
-                       sleep (5);
+                       sleep(5);
                switch (child_id) {
                        case NOTOK:
-                               adios ("vfork", "unable to");
+                               adios("vfork", "unable to");
 
                        case OK:
-                               dup2 (fileno (out), 1);
+                               dup2(fileno(out), 1);
 
                                i = 1;
                                vec[i++] = "-forward";
@@ -813,27 +813,27 @@ make_bcc_file (void)
                                vec[i++] = tmpfil;
                                vec[i] = NULL;
 
-                               execvp (mhlproc, vec);
-                               adios (mhlproc, "unable to exec");
+                               execvp(mhlproc, vec);
+                               adios(mhlproc, "unable to exec");
 
                        default:
                                if (status = pidwait(child_id, OK))
-                                       admonish (NULL, "%s lost (status=0%o)",
+                                       admonish(NULL, "%s lost (status=0%o)",
                                                        vec[0], status);
                                break;
                }
        }
 
-       fseek (out, 0L, SEEK_END);
-       fprintf (out, "\n------- End of Blind-Carbon-Copy\n");
-       fclose (out);
+       fseek(out, 0L, SEEK_END);
+       fprintf(out, "\n------- End of Blind-Carbon-Copy\n");
+       fclose(out);
 }
 #endif /* if 0 */
 
 /* FCC INTERACTION */
 
 static void
-file (char *path)
+file(char *path)
 {
        int i;
 
@@ -841,49 +841,53 @@ file (char *path)
                return;
 
        for (i = 0; i < fccind; i++)
-               fcc (path, fccfold[i]);
+               fcc(path, fccfold[i]);
 }
 
 
 static void
-fcc (char *file, char *folder)
+fcc(char *file, char *folder)
 {
        pid_t child_id;
        int i, status;
        char fold[BUFSIZ];
 
        if (verbose)
-               printf ("%sFcc: %s\n", msgstate == resent ? "Resent-" : "", folder);
-       fflush (stdout);
+               printf("%sFcc: %s\n", msgstate == resent ? "Resent-" : "",
+                               folder);
+       fflush(stdout);
 
        for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
-               sleep (5);
+               sleep(5);
        switch (child_id) {
                case NOTOK:
                        if (!verbose)
-                               fprintf (stderr, "  %sFcc %s: ",
-                                       msgstate == resent ? "Resent-" : "", folder);
-                       fprintf (verbose ? stdout : stderr, "no forks, so not ok\n");
+                               fprintf(stderr, "  %sFcc %s: ",
+                                               msgstate == resent ?
+                                               "Resent-" : "", folder);
+                       fprintf(verbose ? stdout : stderr, "no forks, so not ok\n");
                        break;
 
                case OK:
-                       snprintf (fold, sizeof(fold), "%s%s",
+                       snprintf(fold, sizeof(fold), "%s%s",
                                *folder == '+' || *folder == '@' ? "" : "+", folder);
-                       execlp (fileproc, r1bindex (fileproc, '/'),
+                       execlp(fileproc, r1bindex(fileproc, '/'),
                                "-link", "-file", file, fold, NULL);
-                       _exit (-1);
+                       _exit(-1);
 
                default:
                        if ((status = pidwait(child_id, OK))) {
                                if (!verbose)
-                                       fprintf (stderr, "  %sFcc %s: ",
-                                               msgstate == resent ? "Resent-" : "", folder);
-                               fprintf (verbose ? stdout : stderr,
-                                       " errored (0%o)\n", status);
+                                       fprintf(stderr, "  %sFcc %s: ",
+                                                       msgstate == resent ?
+                                                       "Resent-" : "",
+                                                       folder);
+                               fprintf(verbose ? stdout : stderr,
+                                               " errored (0%o)\n", status);
                        }
        }
 
-       fflush (stdout);
+       fflush(stdout);
 }
 
 
@@ -894,14 +898,14 @@ fcc (char *file, char *folder)
 */
 
 static void
-die (char *what, char *fmt, ...)
+die(char *what, char *fmt, ...)
 {
        va_list ap;
 
        va_start(ap, fmt);
-       advertise (what, NULL, fmt, ap);
+       advertise(what, NULL, fmt, ap);
        va_end(ap);
 
-       done (1);
+       done(1);
 }
 #endif
index f2b0a53..bb8a607 100644 (file)
@@ -95,17 +95,17 @@ read_termcap(void)
        if (inited++)
                return;
 
-       if (!(term = getenv ("TERM")))
+       if (!(term = getenv("TERM")))
                return;
 
 /*
 ** If possible, we let tgetent allocate its own termcap buffer
 */
 #ifdef TGETENT_ACCEPTS_NULL
-       if (tgetent (NULL, term) != TGETENT_SUCCESS)
+       if (tgetent(NULL, term) != TGETENT_SUCCESS)
                return;
 #else
-       if (tgetent (termbuf, term) != TGETENT_SUCCESS)
+       if (tgetent(termbuf, term) != TGETENT_SUCCESS)
                return;
 #endif
 
@@ -121,32 +121,32 @@ read_termcap(void)
 # endif
 #endif
 
-       HC = tgetflag ("hc");
+       HC = tgetflag("hc");
 
-       if (!initCO && (CO = tgetnum ("co")) <= 0)
+       if (!initCO && (CO = tgetnum("co")) <= 0)
                CO = 80;
-       if (!initLI && (LI = tgetnum ("li")) <= 0)
+       if (!initLI && (LI = tgetnum("li")) <= 0)
                LI = 24;
 
        cp = termcap;
-       CL = tgetstr ("cl", &cp);
-       if ((bp = tgetstr ("pc", &cp)))
+       CL = tgetstr("cl", &cp);
+       if ((bp = tgetstr("pc", &cp)))
                PC = *bp;
-       if (tgetnum ("sg") <= 0) {
-               SE = tgetstr ("se", &cp);
-               SO = tgetstr ("so", &cp);
+       if (tgetnum("sg") <= 0) {
+               SE = tgetstr("se", &cp);
+               SO = tgetstr("so", &cp);
        }
 }
 
 
 int
-sc_width (void)
+sc_width(void)
 {
 #ifdef TIOCGWINSZ
        struct winsize win;
        int width;
 
-       if (ioctl (fileno (stderr), TIOCGWINSZ, &win) != NOTOK
+       if (ioctl(fileno(stderr), TIOCGWINSZ, &win) != NOTOK
                        && (width = win.ws_col) > 0) {
                CO = width;
                initCO++;
@@ -159,12 +159,12 @@ sc_width (void)
 
 
 int
-sc_length (void)
+sc_length(void)
 {
 #ifdef TIOCGWINSZ
        struct winsize win;
 
-       if (ioctl (fileno (stderr), TIOCGWINSZ, &win) != NOTOK
+       if (ioctl(fileno(stderr), TIOCGWINSZ, &win) != NOTOK
                        && (LI = win.ws_row) > 0)
                initLI++;
        else
@@ -176,26 +176,26 @@ sc_length (void)
 
 
 static int
-outc (int c)
+outc(int c)
 {
        return putchar(c);
 }
 
 
 void
-clear_screen (void)
+clear_screen(void)
 {
-       read_termcap ();
+       read_termcap();
 
        if (CL && speedcode)
-               tputs (CL, LI, outc);
+               tputs(CL, LI, outc);
        else {
-               printf ("\f");
+               printf("\f");
                if (speedcode)
-                       printf ("\200");
+                       printf("\200");
        }
 
-       fflush (stdout);
+       fflush(stdout);
 }
 
 
@@ -203,21 +203,21 @@ clear_screen (void)
 ** print in standout mode
 */
 int
-SOprintf (char *fmt, ...)
+SOprintf(char *fmt, ...)
 {
        va_list ap;
 
-       read_termcap ();
+       read_termcap();
        if (!(SO && SE))
                return NOTOK;
 
-       tputs (SO, 1, outc);
+       tputs(SO, 1, outc);
 
        va_start(ap, fmt);
-       vprintf (fmt, ap);
+       vprintf(fmt, ap);
        va_end(ap);
 
-       tputs (SE, 1, outc);
+       tputs(SE, 1, outc);
 
        return OK;
 }
index 3bf341d..bbae08b 100644 (file)
@@ -53,19 +53,19 @@ extern int verbsw;
 int ebcdicsw = 0;  /* hack for linking purposes */
 
 /* mhmisc.c */
-void set_endian (void);
+void set_endian(void);
 
 /* mhoutsbr.c */
-int writeBase64aux (FILE *, FILE *);
+int writeBase64aux(FILE *, FILE *);
 
 /*
 ** static prototypes
 */
-static int via_mail (char *, char *, char *, char *, char *, char *);
+static int via_mail(char *, char *, char *, char *, char *, char *);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        char *f1 = NULL, *f2 = NULL, *f3 = NULL;
        char *f4 = NULL, *f5 = NULL, *f7 = NULL;
@@ -75,61 +75,61 @@ main (int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* foil search of user profile/context */
-       if (context_foil (NULL) == -1)
-               done (1);
+       if (context_foil(NULL) == -1)
+               done(1);
 
-       arguments = getarguments (invo_name, argc, argv, 0);
+       arguments = getarguments(invo_name, argc, argv, 0);
        argp = arguments;
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, switches)) {
+                       switch (smatch(++cp, switches)) {
                        case AMBIGSW:
-                               ambigsw (cp, switches);
-                               done (1);
+                               ambigsw(cp, switches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf), "%s [switches]",
+                               snprintf(buf, sizeof(buf), "%s [switches]",
                                                invo_name);
-                               print_help (buf, switches, 1);
-                               done (1);
+                               print_help(buf, switches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case TOSW:
                                if (!(f1 = *argp++))
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                continue;
                        case SUBJECTSW:
                                if (!(f2 = *argp++))
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                argp[-2]);
                                continue;
                        case PARAMSW:
                                if (!(f3 = *argp++))
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                argp[-2]);
                                continue;
                        case DESCRIPTSW:
                                if (!(f4 = *argp++))
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                argp[-2]);
                                continue;
                        case COMMENTSW:
                                if (!(f5 = *argp++))
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                argp[-2]);
                                continue;
                        case FROMSW:
                                if (!(f7 = *argp++))
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                argp[-2]);
                                continue;
 
@@ -147,12 +147,12 @@ main (int argc, char **argv)
                }
        }
 
-       set_endian ();
+       set_endian();
 
        if (!f1)
-               adios (NULL, "missing -viamail \"mailpath\" switch");
+               adios(NULL, "missing -viamail \"mailpath\" switch");
 
-       via_mail (f1, f2, f3, f4, f5, f7);
+       via_mail(f1, f2, f3, f4, f5, f7);
        return 0;  /* dead code to satisfy the compiler */
 }
 
@@ -162,7 +162,7 @@ main (int argc, char **argv)
 */
 
 static int
-via_mail (char *mailsw, char *subjsw, char *parmsw, char *descsw,
+via_mail(char *mailsw, char *subjsw, char *parmsw, char *descsw,
        char *cmntsw, char *fromsw)
 {
        int status, vecp = 1;
@@ -172,56 +172,57 @@ via_mail (char *mailsw, char *subjsw, char *parmsw, char *descsw,
        FILE *fp;
        char *tfile = NULL;
 
-       umask (~m_gmprot ());
+       umask(~m_gmprot());
 
        tfile = m_mktemp2(NULL, invo_name, NULL, &fp);
-       if (tfile == NULL) adios("viamail", "unable to create temporary file");
+       if (tfile == NULL)
+               adios("viamail", "unable to create temporary file");
        chmod(tfile, 0600);
-       strncpy (tmpfil, tfile, sizeof(tmpfil));
+       strncpy(tmpfil, tfile, sizeof(tmpfil));
 
        if (!strchr(mailsw, '@'))
-               mailsw = concat (mailsw, "@", LocalName (), NULL);
-       fprintf (fp, "To: %s\n", mailsw);
+               mailsw = concat(mailsw, "@", LocalName(), NULL);
+       fprintf(fp, "To: %s\n", mailsw);
 
        if (subjsw)
-               fprintf (fp, "Subject: %s\n", subjsw);
+               fprintf(fp, "Subject: %s\n", subjsw);
 
        if (fromsw) {
                if (!strchr(fromsw, '@'))
-                       fromsw = concat (fromsw, "@", LocalName (), NULL);
-               fprintf (fp, "From: %s\n", fromsw);
+                       fromsw = concat(fromsw, "@", LocalName(), NULL);
+               fprintf(fp, "From: %s\n", fromsw);
        }
 
-       fprintf (fp, "%s: %s\n", VRSN_FIELD, VRSN_VALUE);
-       fprintf (fp, "%s: application/octet-stream", TYPE_FIELD);
+       fprintf(fp, "%s: %s\n", VRSN_FIELD, VRSN_VALUE);
+       fprintf(fp, "%s: application/octet-stream", TYPE_FIELD);
 
        if (parmsw)
-               fprintf (fp, "; %s", parmsw);
+               fprintf(fp, "; %s", parmsw);
 
        if (cmntsw)
-               fprintf (fp, "\n\t(%s)", cmntsw);
+               fprintf(fp, "\n\t(%s)", cmntsw);
 
        if (descsw)
-               fprintf (fp, "\n%s: %s", DESCR_FIELD, descsw);
+               fprintf(fp, "\n%s: %s", DESCR_FIELD, descsw);
 
-       fprintf (fp, "\n%s: %s\n\n", ENCODING_FIELD, "base64");
+       fprintf(fp, "\n%s: %s\n\n", ENCODING_FIELD, "base64");
 
-       if (fflush (fp))
-               adios (tmpfil, "error writing to");
+       if (fflush(fp))
+               adios(tmpfil, "error writing to");
 
-       writeBase64aux (stdin, fp);
-       if (fflush (fp))
-               adios (tmpfil, "error writing to");
+       writeBase64aux(stdin, fp);
+       if (fflush(fp))
+               adios(tmpfil, "error writing to");
 
-       if (fstat (fileno (fp), &st) == NOTOK)
-               adios ("failed", "fstat of %s", tmpfil);
+       if (fstat(fileno(fp), &st) == NOTOK)
+               adios("failed", "fstat of %s", tmpfil);
 
        status = 0;
-       vec[0] = r1bindex (postproc, '/');
+       vec[0] = r1bindex(postproc, '/');
        if (verbsw)
                vec[vecp++] = "-verbose";
 
-       switch (sendsbr (vec, vecp, tmpfil, &st, 0, (char *)0, 0)) {
+       switch (sendsbr(vec, vecp, tmpfil, &st, 0, (char *)0, 0)) {
                case DONE:
                case NOTOK:
                        status++;
@@ -230,9 +231,9 @@ via_mail (char *mailsw, char *subjsw, char *parmsw, char *descsw,
                        break;
        }
 
-       fclose (fp);
-       if (unlink (tmpfil) == -1)
-               advise (NULL, "unable to remove temp file %s", tmpfil);
-       done (status);
+       fclose(fp);
+       if (unlink(tmpfil) == -1)
+               advise(NULL, "unable to remove temp file %s", tmpfil);
+       done(status);
        return 1;
 }
index 061c844..0488f94 100644 (file)
@@ -9,14 +9,14 @@
 #include <h/mh.h>
 
 /* from whatnowsbr.c */
-int WhatNow (int, char **);
+int WhatNow(int, char **);
 
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       return WhatNow (argc, argv);
+       return WhatNow(argc, argv);
 }
index 9d4d06d..583f133 100644 (file)
 */
 
 /* from whatnowsbr.c */
-int WhatNow (int, char **);
+int WhatNow(int, char **);
 
 
 int
-what_now (char *ed, int nedit, int use, char *file, char *altmsg, int dist,
+what_now(char *ed, int nedit, int use, char *file, char *altmsg, int dist,
        struct msgs *mp, char *text, int inplace, char *cwd)
 {
        int found, k, msgnum, vecp;
@@ -32,41 +32,41 @@ what_now (char *ed, int nedit, int use, char *file, char *altmsg, int dist,
        char buffer[BUFSIZ], *vec[MAXARGS];
 
        vecp = 0;
-       vec[vecp++] = r1bindex (whatnowproc, '/');
+       vec[vecp++] = r1bindex(whatnowproc, '/');
        vec[vecp] = NULL;
 
-       m_putenv ("mhdraft", file);
+       m_putenv("mhdraft", file);
        if (mp)
-               m_putenv ("mhfolder", mp->foldpath);
+               m_putenv("mhfolder", mp->foldpath);
        else
-               unputenv ("mhfolder");
+               unputenv("mhfolder");
        if (altmsg) {
                if (mp == NULL || *altmsg == '/' || cwd == NULL)
-                       m_putenv ("mhaltmsg", altmsg);
+                       m_putenv("mhaltmsg", altmsg);
                else {
-                       snprintf (buffer, sizeof(buffer), "%s/%s",
+                       snprintf(buffer, sizeof(buffer), "%s/%s",
                                        mp->foldpath, altmsg);
-                       m_putenv ("mhaltmsg", buffer);
+                       m_putenv("mhaltmsg", buffer);
                }
        } else {
-               unputenv ("mhaltmsg");
+               unputenv("mhaltmsg");
        }
-       if ((bp = getenv ("mhaltmsg")))/* XXX */
-               m_putenv ("editalt", bp);
-       snprintf (buffer, sizeof(buffer), "%d", dist);
-       m_putenv ("mhdist", buffer);
+       if ((bp = getenv("mhaltmsg")))/* XXX */
+               m_putenv("editalt", bp);
+       snprintf(buffer, sizeof(buffer), "%d", dist);
+       m_putenv("mhdist", buffer);
        if (nedit) {
-               unputenv ("mheditor");
+               unputenv("mheditor");
        } else {
-               m_putenv ("mheditor", ed ? ed : (ed = context_find ("editor"))
-                       ? ed : defaulteditor);
+               m_putenv("mheditor", ed ? ed : (ed = context_find("editor")) ?
+                               ed : defaulteditor);
        }
-       snprintf (buffer, sizeof(buffer), "%d", use);
-       m_putenv ("mhuse", buffer);
+       snprintf(buffer, sizeof(buffer), "%d", use);
+       m_putenv("mhuse", buffer);
 
-       unputenv ("mhmessages");
-       unputenv ("mhannotate");
-       unputenv ("mhinplace");
+       unputenv("mhmessages");
+       unputenv("mhannotate");
+       unputenv("mhinplace");
 
        if (text && mp && !is_readonly(mp)) {
                found = 0;
@@ -74,18 +74,16 @@ what_now (char *ed, int nedit, int use, char *file, char *altmsg, int dist,
                buflen = sizeof(buffer);
                for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++) {
                        if (is_selected(mp, msgnum)) {
-                               snprintf (bp, buflen, "%s%s",
-                                               found ? " " : "",
-                                               m_name (msgnum));
-                               len = strlen (bp);
+                               snprintf(bp, buflen, "%s%s", found ? " " : "",
+                                               m_name(msgnum));
+                               len = strlen(bp);
                                bp += len;
                                buflen -= len;
                                for (k = msgnum + 1; k <= mp->hghmsg && is_selected(mp, k); k++)
                                        continue;
                                if (--k > msgnum) {
-                                       snprintf (bp, buflen, "-%s",
-                                                       m_name (k));
-                                       len = strlen (bp);
+                                       snprintf(bp, buflen, "-%s", m_name(k));
+                                       len = strlen(bp);
                                        bp += len;
                                        buflen -= len;
                                }
@@ -94,31 +92,31 @@ what_now (char *ed, int nedit, int use, char *file, char *altmsg, int dist,
                        }
                }
                if (found) {
-                       m_putenv ("mhmessages", buffer);
-                       m_putenv ("mhannotate", text);
-                       snprintf (buffer, sizeof(buffer), "%d", inplace);
-                       m_putenv ("mhinplace", buffer);
+                       m_putenv("mhmessages", buffer);
+                       m_putenv("mhannotate", text);
+                       snprintf(buffer, sizeof(buffer), "%d", inplace);
+                       m_putenv("mhinplace", buffer);
                }
        }
 
-       context_save ();  /* save the context file */
-       fflush (stdout);
+       context_save();  /* save the context file */
+       fflush(stdout);
 
        if (cwd)
-               chdir (cwd);
+               chdir(cwd);
 
        /*
        ** If the "whatnowproc" is the nmh command "whatnow",
        ** we run it internally, rather than exec'ing it.
        */
-       if (strcmp (vec[0], "whatnow") == 0) {
-               WhatNow (vecp, vec);
-               done (0);
+       if (strcmp(vec[0], "whatnow") == 0) {
+               WhatNow(vecp, vec);
+               done(0);
        }
 
-       execvp (whatnowproc, vec);
-       fprintf (stderr, "unable to exec ");
-       perror (whatnowproc);
+       execvp(whatnowproc, vec);
+       fprintf(stderr, "unable to exec ");
+       perror(whatnowproc);
 
        return 0;
 }
index 0dfc3d7..5a31a90 100644 (file)
@@ -101,13 +101,13 @@ static char *myprompt = "\nWhat now? ";
 /*
 ** static prototypes
 */
-static int editfile (char **, char **, char *, int, struct msgs *,
+static int editfile(char **, char **, char *, int, struct msgs *,
        char *, char *, int);
-static int sendfile (char **, char *, int);
-static void sendit (char *, char **, char *, int);
-static int buildfile (char **, char *);
-static int check_draft (char *);
-static int removefile (char *);
+static int sendfile(char **, char *, int);
+static void sendit(char *, char **, char *, int);
+static int buildfile(char **, char *);
+static int check_draft(char *);
+static int removefile(char *);
 static void writelscmd(char *, int, char **);
 static void writesomecmd(char *buf, int bufsz, char *cmd, char *trailcmd, char **argp);
 static FILE* popen_in_dir(const char *dir, const char *cmd, const char *type);
@@ -115,12 +115,12 @@ static int system_in_dir(const char *dir, const char *cmd);
 
 
 #ifdef HAVE_LSTAT
-static int copyf (char *, char *);
+static int copyf(char *, char *);
 #endif
 
 
 int
-WhatNow (int argc, char **argv)
+WhatNow(int argc, char **argv)
 {
        int nedit = 0, use = 0;
        char *cp;
@@ -136,12 +136,12 @@ WhatNow (int argc, char **argv)
        char *l;  /* set on -l to alist  command */
        int n;  /* set on -n to alist command */
 
-       invo_name = r1bindex (argv[0], '/');
+       invo_name = r1bindex(argv[0], '/');
 
        /* read user profile/context */
        context_read();
 
-       arguments = getarguments (invo_name, argc, argv, 1);
+       arguments = getarguments(invo_name, argc, argv, 1);
        argp = arguments;
 
        /*
@@ -154,26 +154,26 @@ WhatNow (int argc, char **argv)
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, whatnowswitches)) {
+                       switch (smatch(++cp, whatnowswitches)) {
                        case AMBIGSW:
-                               ambigsw (cp, whatnowswitches);
-                               done (1);
+                               ambigsw(cp, whatnowswitches);
+                               done(1);
                        case UNKWNSW:
-                               adios (NULL, "-%s unknown", cp);
+                               adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
-                               snprintf (buf, sizeof(buf),
+                               snprintf(buf, sizeof(buf),
                                                "%s [switches] [file]",
                                                invo_name);
-                               print_help (buf, whatnowswitches, 1);
-                               done (1);
+                               print_help(buf, whatnowswitches, 1);
+                               done(1);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done (1);
+                               done(1);
 
                        case EDITRSW:
                                if (!(ed = *argp++) || *ed == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                nedit = 0;
                                continue;
@@ -183,7 +183,7 @@ WhatNow (int argc, char **argv)
 
                        case PRMPTSW:
                                if (!(myprompt = *argp++) || *myprompt == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                continue;
 
@@ -191,26 +191,26 @@ WhatNow (int argc, char **argv)
                                if (attach != (char *)0)
                                        adios(NULL, "only one attachment header field name at a time!");
                                if (!(attach = *argp++) || *attach == '-')
-                                       adios (NULL, "missing argument to %s",
+                                       adios(NULL, "missing argument to %s",
                                                        argp[-2]);
                                continue;
                        }
                }
                if (drft)
-                       adios (NULL, "only one draft at a time!");
+                       adios(NULL, "only one draft at a time!");
                else
                        drft = cp;
        }
 
        if ((drft == NULL && (drft = getenv("mhdraft")) == NULL) || *drft == 0)
-               drft = getcpy (m_draft("cur"));
+               drft = getcpy(m_draft("cur"));
 
-       msgnam = (cp = getenv ("mhaltmsg")) && *cp ? getcpy (cp) : NULL;
+       msgnam = (cp = getenv("mhaltmsg")) && *cp ? getcpy(cp) : NULL;
 
-       if ((cp = getenv ("mhuse")) && *cp)
-               use = atoi (cp);
+       if ((cp = getenv("mhuse")) && *cp)
+               use = atoi(cp);
 
-       if (ed == NULL && ((ed = getenv ("mheditor")) == NULL || *ed == 0)) {
+       if (ed == NULL && ((ed = getenv("mheditor")) == NULL || *ed == 0)) {
                ed = NULL;
                nedit++;
        }
@@ -218,76 +218,76 @@ WhatNow (int argc, char **argv)
        /* start editing the draft, unless -noedit was given */
        if (!nedit && editfile(&ed, NULL, drft, use, NULL, msgnam, NULL, 1)
                        < 0)
-               done (1);
+               done(1);
 
-       snprintf (prompt, sizeof(prompt), myprompt, invo_name);
+       snprintf(prompt, sizeof(prompt), myprompt, invo_name);
        for (;;) {
-               if (!(argp = getans (prompt, aleqs))) {
-                       unlink (altmsglink);
-                       done (1);
+               if (!(argp = getans(prompt, aleqs))) {
+                       unlink(altmsglink);
+                       done(1);
                }
-               switch (smatch (*argp, aleqs)) {
+               switch (smatch(*argp, aleqs)) {
                case DISPSW:
                        /*
                        ** display the message being replied to,
                        ** or distributed
                        */
                        if (msgnam)
-                               showfile (++argp, msgnam);
+                               showfile(++argp, msgnam);
                        else
-                               advise (NULL, "no alternate message to display");
+                               advise(NULL, "no alternate message to display");
                        break;
 
                case BUILDMIMESW:
                        /* Translate MIME composition file */
-                       buildfile (++argp, drft);
+                       buildfile(++argp, drft);
                        break;
 
                case EDITSW:
                        /* Call an editor on the draft file */
                        if (*++argp)
                                ed = *argp++;
-                       if (editfile (&ed, argp, drft, NOUSE, NULL,
+                       if (editfile(&ed, argp, drft, NOUSE, NULL,
                                        msgnam, NULL, 1) == NOTOK)
-                               done (1);
+                               done(1);
                        break;
 
                case LISTSW:
                        /* display the draft file */
-                       showfile (++argp, drft);
+                       showfile(++argp, drft);
                        break;
 
                case QUITSW:
                        /* Quit, and possibly delete the draft */
                        if (*++argp && (*argp[0] == 'd' ||
                                ((*argp)[0] == '-' && (*argp)[1] == 'd'))) {
-                               removefile (drft);
+                               removefile(drft);
                        } else {
-                               if (stat (drft, &st) != NOTOK)
+                               if (stat(drft, &st) != NOTOK)
                                        advise(NULL, "draft left on %s", drft);
                        }
-                       done (1);
+                       done(1);
 
                case DELETESW:
                        /* Delete draft and exit */
-                       removefile (drft);
-                       done (1);
+                       removefile(drft);
+                       done(1);
 
                case PUSHSW:
                        /* Send draft in background */
-                       if (sendfile (++argp, drft, 1))
-                               done (1);
+                       if (sendfile(++argp, drft, 1))
+                               done(1);
                        break;
 
                case SENDSW:
                        /* Send draft */
-                       sendfile (++argp, drft, 0);
+                       sendfile(++argp, drft, 0);
                        break;
 
                case REFILEOPT:
                        /* Refile the draft */
-                       if (refile (++argp, drft) == 0)
-                               done (0);
+                       if (refile(++argp, drft) == 0)
+                               done(0);
                        break;
 
                case CDCMDSW:
@@ -519,7 +519,7 @@ WhatNow (int argc, char **argv)
 
                default:
                        /* Unknown command */
-                       advise (NULL, "say what?");
+                       advise(NULL, "say what?");
                        break;
                }
        }
@@ -632,7 +632,7 @@ static char *edsave = NULL;  /* the editor we used previously */
 
 
 static int
-editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
+editfile(char **ed, char **arg, char *file, int use, struct msgs *mp,
        char *altmsg, char *cwd, int save_editor)
 {
        int pid, status, vecp;
@@ -651,43 +651,43 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
        if (reedit) {
                if (!*ed) {  /* no explicit editor */
                        *ed = edsave;  /* so use the previous one */
-                       if ((cp = r1bindex (*ed, '/')) == NULL)
+                       if ((cp = r1bindex(*ed, '/')) == NULL)
                                cp = *ed;
 
                        /* unless we've specified it via "editor-next" */
-                       cp = concat (cp, "-next", NULL);
-                       if ((cp = context_find (cp)) != NULL)
+                       cp = concat(cp, "-next", NULL);
+                       if ((cp = context_find(cp)) != NULL)
                                *ed = cp;
                }
        } else {
                /* set initial editor */
-               if (*ed == NULL && (*ed = context_find ("editor")) == NULL)
+               if (*ed == NULL && (*ed = context_find("editor")) == NULL)
                        *ed = defaulteditor;
        }
 
        if (altmsg) {
                if (mp == NULL || *altmsg == '/' || cwd == NULL)
-                       strncpy (altpath, altmsg, sizeof(altpath));
+                       strncpy(altpath, altmsg, sizeof(altpath));
                else
-                       snprintf (altpath, sizeof(altpath), "%s/%s",
+                       snprintf(altpath, sizeof(altpath), "%s/%s",
                                        mp->foldpath, altmsg);
                if (cwd == NULL)
-                       strncpy (linkpath, altmsglink, sizeof(linkpath));
+                       strncpy(linkpath, altmsglink, sizeof(linkpath));
                else
-                       snprintf (linkpath, sizeof(linkpath), "%s/%s",
+                       snprintf(linkpath, sizeof(linkpath), "%s/%s",
                                        cwd, altmsglink);
        }
 
        if (altmsg) {
-               unlink (linkpath);
+               unlink(linkpath);
 #ifdef HAVE_LSTAT
-               if (link (altpath, linkpath) == NOTOK) {
+               if (link(altpath, linkpath) == NOTOK) {
 #if 0
                        /* I don't think permission on symlinks matters /JLR */
                        /* PJS: else symlinks are world 'r' */
                        oumask = umask(0044);
 #endif
-                       symlink (altpath, linkpath);
+                       symlink(altpath, linkpath);
 #if 0
                        umask(oumask);  /* PJS: else symlinks are world 'r' */
 #endif
@@ -696,57 +696,56 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
                        slinked = 0;
                }
 #else /* not HAVE_LSTAT */
-               link (altpath, linkpath);
+               link(altpath, linkpath);
 #endif /* not HAVE_LSTAT */
        }
 
-       context_save ();  /* save the context file */
-       fflush (stdout);
+       context_save();  /* save the context file */
+       fflush(stdout);
 
-       switch (pid = vfork ()) {
+       switch (pid = vfork()) {
                case NOTOK:
-                       advise ("fork", "unable to");
+                       advise("fork", "unable to");
                        status = NOTOK;
                        break;
 
                case OK:
                        if (cwd)
-                               chdir (cwd);
+                               chdir(cwd);
                        if (altmsg) {
                                if (mp)
-                                       m_putenv ("mhfolder", mp->foldpath);
-                               m_putenv ("editalt", altpath);
+                                       m_putenv("mhfolder", mp->foldpath);
+                               m_putenv("editalt", altpath);
                        }
 
                        vecp = 0;
-                       vec[vecp++] = r1bindex (*ed, '/');
+                       vec[vecp++] = r1bindex(*ed, '/');
                        if (arg)
                                while (*arg)
                                        vec[vecp++] = *arg++;
                        vec[vecp++] = file;
                        vec[vecp] = NULL;
 
-                       execvp (*ed, vec);
-                       fprintf (stderr, "unable to exec ");
-                       perror (*ed);
-                       _exit (-1);
+                       execvp(*ed, vec);
+                       fprintf(stderr, "unable to exec ");
+                       perror(*ed);
+                       _exit(-1);
 
                default:
-                       if ((status = pidwait (pid, NOTOK))) {
+                       if ((status = pidwait(pid, NOTOK))) {
 #ifdef ATTVIBUG
-                               if ((cp = r1bindex (*ed, '/'))
-                                               && strcmp (cp, "vi") == 0
-                                               && (status & 0x00ff) == 0)
+                               if ((cp = r1bindex(*ed, '/')) &&
+                                               strcmp(cp, "vi") == 0 &&
+                                               (status & 0x00ff) == 0)
                                        status = 0;
                                else {
 #endif
                                if (((status & 0xff00) != 0xff00)
                                        && (!reedit || (status & 0x00ff))) {
-                                       if (!use && (status & 0xff00) &&
-                                                       (rename (file, cp = m_backup (file)) != NOTOK)) {
-                                               advise (NULL, "problems with edit--draft left in %s", cp);
+                                       if (!use && (status & 0xff00) && (rename(file, cp = m_backup (file)) != NOTOK)) {
+                                               advise(NULL, "problems with edit--draft left in %s", cp);
                                        } else {
-                                               advise (NULL, "problems with edit--%s preserved", file);
+                                               advise(NULL, "problems with edit--%s preserved", file);
                                        }
                                }
                                status = -2;  /* maybe "reedit ? -2 : -1"? */
@@ -758,36 +757,33 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
 
                        reedit++;
 #ifdef HAVE_LSTAT
-                       if (altmsg
-                                       && mp
-                                       && !is_readonly(mp)
-                                       && (slinked
-                                                  ? lstat (linkpath, &st) != NOTOK
-                                                               && S_ISREG(st.st_mode)
-                                                               && copyf (linkpath, altpath) == NOTOK
-                                                  : stat (linkpath, &st) != NOTOK
-                                                               && st.st_nlink == 1
-                                                               && (unlink (altpath) == NOTOK
-                                                                               || link (linkpath, altpath) == NOTOK)))
-                               advise (linkpath, "unable to update %s from", altmsg);
+                       if (altmsg && mp && !is_readonly(mp) && (slinked ?
+                                       lstat (linkpath, &st) != NOTOK &&
+                                       S_ISREG(st.st_mode) &&
+                                       copyf(linkpath, altpath) == NOTOK :
+                                       stat(linkpath, &st) != NOTOK &&
+                                       st.st_nlink == 1 &&
+                                       (unlink(altpath) == NOTOK ||
+                                       link(linkpath, altpath) == NOTOK)))
+                               advise(linkpath, "unable to update %s from", altmsg);
 #else /* HAVE_LSTAT */
-                       if (altmsg && mp && !is_readonly(mp)
-                                       && stat (linkpath, &st) != NOTOK
-                                       && st.st_nlink == 1
-                                       && (unlink (altpath) == NOTOK
-                                       || link (linkpath, altpath) == NOTOK))
-                               advise (linkpath, "unable to update %s from",
+                       if (altmsg && mp && !is_readonly(mp) &&
+                                       stat(linkpath, &st) != NOTOK &&
+                                       st.st_nlink == 1 &&
+                                       (unlink(altpath) == NOTOK ||
+                                       link(linkpath, altpath) == NOTOK))
+                               advise(linkpath, "unable to update %s from",
                                                altmsg);
 #endif /* HAVE_LSTAT */
        }
 
        /* normally, we remember which editor we used */
        if (save_editor)
-               edsave = getcpy (*ed);
+               edsave = getcpy(*ed);
 
        *ed = NULL;
        if (altmsg)
-               unlink (linkpath);
+               unlink(linkpath);
 
        return status;
 }
@@ -795,28 +791,28 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
 
 #ifdef HAVE_LSTAT
 static int
-copyf (char *ifile, char *ofile)
+copyf(char *ifile, char *ofile)
 {
        int i, in, out;
        char buffer[BUFSIZ];
 
-       if ((in = open (ifile, O_RDONLY)) == NOTOK)
+       if ((in = open(ifile, O_RDONLY)) == NOTOK)
                return NOTOK;
-       if ((out = open (ofile, O_WRONLY | O_TRUNC)) == NOTOK) {
-               admonish (ofile, "unable to open and truncate");
-               close (in);
+       if ((out = open(ofile, O_WRONLY | O_TRUNC)) == NOTOK) {
+               admonish(ofile, "unable to open and truncate");
+               close(in);
                return NOTOK;
        }
 
-       while ((i = read (in, buffer, sizeof(buffer))) > OK)
-               if (write (out, buffer, i) != i) {
-                       advise (ofile, "may have damaged");
+       while ((i = read(in, buffer, sizeof(buffer))) > OK)
+               if (write(out, buffer, i) != i) {
+                       advise(ofile, "may have damaged");
                        i = NOTOK;
                        break;
                }
 
-       close (in);
-       close (out);
+       close(in);
+       close(out);
        return i;
 }
 #endif /* HAVE_LSTAT */
@@ -827,21 +823,21 @@ copyf (char *ifile, char *ofile)
 */
 
 static int
-sendfile (char **arg, char *file, int pushsw)
+sendfile(char **arg, char *file, int pushsw)
 {
        pid_t child_id;
        int i, vecp;
        char *cp, *sp, *vec[MAXARGS];
 
        /* Translate MIME composition file, if necessary */
-       if ((cp = context_find ("automimeproc")) && (!strcmp (cp, "1"))
-                       && !getenv ("NOMHNPROC") && check_draft (file)
-                       && (buildfile (NULL, file) == NOTOK))
+       if ((cp = context_find("automimeproc")) && (!strcmp(cp, "1")) &&
+                       !getenv("NOMHNPROC") && check_draft(file) &&
+                       (buildfile(NULL, file) == NOTOK))
                return 0;
 
        /* For backwards compatibility */
-       if ((cp = context_find ("automhnproc")) && !getenv ("NOMHNPROC")
-                       && check_draft (file) && (i = editfile (&cp, NULL,
+       if ((cp = context_find("automhnproc")) && !getenv("NOMHNPROC")
+                       && check_draft(file) && (i = editfile(&cp, NULL,
                        file, NOUSE, NULL, NULL, NULL, 0)))
                return 0;
 
@@ -849,21 +845,21 @@ sendfile (char **arg, char *file, int pushsw)
        ** If the sendproc is the nmh command `send', then we call
        ** those routines directly rather than exec'ing the command.
        */
-       if (strcmp (sp = r1bindex (sendproc, '/'), "send") == 0) {
+       if (strcmp(sp = r1bindex(sendproc, '/'), "send") == 0) {
                cp = invo_name;
-               sendit (invo_name = sp, arg, file, pushsw);
+               sendit(invo_name = sp, arg, file, pushsw);
                invo_name = cp;
                return 1;
        }
 
-       context_save ();  /* save the context file */
-       fflush (stdout);
+       context_save();  /* save the context file */
+       fflush(stdout);
 
        for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
-               sleep (5);
+               sleep(5);
        switch (child_id) {
                case NOTOK:
-                       advise (NULL, "unable to fork, so sending directly...");
+                       advise(NULL, "unable to fork, so sending directly...");
                case OK:
                        vecp = 0;
                        vec[vecp++] = invo_name;
@@ -875,14 +871,14 @@ sendfile (char **arg, char *file, int pushsw)
                        vec[vecp++] = file;
                        vec[vecp] = NULL;
 
-                       execvp (sendproc, vec);
-                       fprintf (stderr, "unable to exec ");
-                       perror (sendproc);
-                       _exit (-1);
+                       execvp(sendproc, vec);
+                       fprintf(stderr, "unable to exec ");
+                       perror(sendproc);
+                       _exit(-1);
 
                default:
                        if (pidwait(child_id, OK) == 0)
-                               done (0);
+                               done(0);
                        return 1;
        }
 }
@@ -893,7 +889,7 @@ sendfile (char **arg, char *file, int pushsw)
 */
 
 static int
-buildfile (char **argp, char *file)
+buildfile(char **argp, char *file)
 {
        int i;
        char **args, *ed;
@@ -913,7 +909,7 @@ buildfile (char **argp, char *file)
        ** if we are using mhn as buildmimeproc
        */
        i = 0;
-       if (strcmp (r1bindex (ed, '/'), "mhn") == 0)
+       if (strcmp(r1bindex(ed, '/'), "mhn") == 0)
                args[i++] = "-build";
 
        /* copy any other arguments */
@@ -921,8 +917,8 @@ buildfile (char **argp, char *file)
                args[i++] = *argp++;
        args[i] = NULL;
 
-       i = editfile (&ed, args, file, NOUSE, NULL, NULL, NULL, 0);
-       free (args);
+       i = editfile(&ed, args, file, NOUSE, NULL, NULL, NULL, 0);
+       free(args);
 
        return (i ? NOTOK : OK);
 }
@@ -933,16 +929,16 @@ buildfile (char **argp, char *file)
 */
 
 static int
-check_draft (char *msgnam)
+check_draft(char *msgnam)
 {
        int state;
        char buf[BUFSIZ], name[NAMESZ];
        FILE *fp;
 
-       if ((fp = fopen (msgnam, "r")) == NULL)
+       if ((fp = fopen(msgnam, "r")) == NULL)
                return 0;
        for (state = FLD;;)
-               switch (state = m_getfld (state, name, buf, sizeof(buf), fp)) {
+               switch (state = m_getfld(state, name, buf, sizeof(buf), fp)) {
                        case FLD:
                        case FLDPLUS:
                        case FLDEOF:
@@ -951,12 +947,12 @@ check_draft (char *msgnam)
                                ** Content-XXX fields, then assume it already
                                ** been converted.
                                */
-                               if (uprf (name, XXX_FIELD_PRF)) {
-                                       fclose (fp);
+                               if (uprf(name, XXX_FIELD_PRF)) {
+                                       fclose(fp);
                                        return 0;
                                }
                                while (state == FLDPLUS)
-                                       state = m_getfld (state, name, buf,
+                                       state = m_getfld(state, name, buf,
                                                        sizeof(buf), fp);
                                break;
 
@@ -966,17 +962,17 @@ check_draft (char *msgnam)
 
                                        for (bp = buf; *bp; bp++)
                                                if (*bp != ' ' && *bp != '\t' && *bp != '\n') {
-                                                       fclose (fp);
+                                                       fclose(fp);
                                                        return 1;
                                                }
 
-                                       state = m_getfld (state, name, buf,
+                                       state = m_getfld(state, name, buf,
                                                        sizeof(buf), fp);
                                } while (state == BODY);
                                /* and fall... */
 
                        default:
-                               fclose (fp);
+                               fclose(fp);
                                return 0;
                }
 }
@@ -1070,7 +1066,7 @@ extern char *distfile;
 
 
 static void
-sendit (char *sp, char **arg, char *file, int pushed)
+sendit(char *sp, char **arg, char *file, int pushed)
 {
        int vecp, n = 1;
        char *cp, buf[BUFSIZ], **argp;
@@ -1106,7 +1102,7 @@ sendit (char *sp, char **arg, char *file, int pushed)
        if (arg) {
                char **bp;
 
-               copyip (arg, vec+1, MAXARGS-1);
+               copyip(arg, vec+1, MAXARGS-1);
                bp = vec+1;
                while (*bp++)
                        n++;
@@ -1130,25 +1126,25 @@ sendit (char *sp, char **arg, char *file, int pushed)
 
        vecp = 1;  /* we'll get the zero'th element later */
        vec[vecp++] = "-library";
-       vec[vecp++] = getcpy (m_maildir (""));
+       vec[vecp++] = getcpy(m_maildir(""));
 
        while ((cp = *argp++)) {
                if (*cp == '-') {
-                       switch (smatch (++cp, sendswitches)) {
+                       switch (smatch(++cp, sendswitches)) {
                                case AMBIGSW:
-                                       ambigsw (cp, sendswitches);
+                                       ambigsw(cp, sendswitches);
                                        return;
                                case UNKWNSW:
-                                       advise (NULL, "-%s unknown\n", cp);
+                                       advise(NULL, "-%s unknown\n", cp);
                                        return;
 
                                case SHELPSW:
-                                       snprintf (buf, sizeof(buf),
+                                       snprintf(buf, sizeof(buf),
                                                        "%s [switches]", sp);
-                                       print_help (buf, sendswitches, 1);
+                                       print_help(buf, sendswitches, 1);
                                        return;
                                case SVERSIONSW:
-                                       print_version (invo_name);
+                                       print_version(invo_name);
                                        return;
 
                                case SPSHSW:
@@ -1209,7 +1205,7 @@ sendit (char *sp, char **arg, char *file, int pushed)
                                case PORTSW:
                                        vec[vecp++] = --cp;
                                        if (!(cp = *argp++) || *cp == '-') {
-                                               advise (NULL, "missing argument to %s", argp[-2]);
+                                               advise(NULL, "missing argument to %s", argp[-2]);
                                                return;
                                        }
                                        vec[vecp++] = cp;
@@ -1218,18 +1214,18 @@ sendit (char *sp, char **arg, char *file, int pushed)
                                case SNDATTACHSW:
                                        if (!(attach = *argp++) ||
                                                        *attach == '-') {
-                                               advise (NULL, "missing argument to %s", argp[-2]);
+                                               advise(NULL, "missing argument to %s", argp[-2]);
                                                return;
                                        }
                                        continue;
 
                                case SNDATTACHFORMAT:
                                        if (! *argp || **argp == '-')
-                                               adios (NULL, "missing argument to %s", argp[-1]);
+                                               adios(NULL, "missing argument to %s", argp[-1]);
                                        else {
-                                               attachformat = atoi (*argp);
+                                               attachformat = atoi(*argp);
                                                if (attachformat < 0 || attachformat > ATTACHFORMATS - 1) {
-                                                       advise (NULL, "unsupported attachformat %d", attachformat);
+                                                       advise(NULL, "unsupported attachformat %d", attachformat);
                                                        continue;
                                                }
                                        }
@@ -1237,71 +1233,70 @@ sendit (char *sp, char **arg, char *file, int pushed)
                                        continue;
                        }
                }
-               advise (NULL, "usage: %s [switches]", sp);
+               advise(NULL, "usage: %s [switches]", sp);
                return;
        }
 
        /* allow Aliasfile: profile entry */
-       if ((cp = context_find ("Aliasfile"))) {
+       if ((cp = context_find("Aliasfile"))) {
                char **ap, *dp;
 
-               dp = getcpy (cp);
-               for (ap = brkstring (dp, " ", "\n"); ap && *ap; ap++) {
+               dp = getcpy(cp);
+               for (ap = brkstring(dp, " ", "\n"); ap && *ap; ap++) {
                        vec[vecp++] = "-alias";
                        vec[vecp++] = *ap;
                }
        }
 
-       if ((cp = getenv ("SIGNATURE")) == NULL || *cp == 0)
-               if ((cp = context_find ("signature")) && *cp)
-                       m_putenv ("SIGNATURE", cp);
+       if ((cp = getenv("SIGNATURE")) == NULL || *cp == 0)
+               if ((cp = context_find("signature")) && *cp)
+                       m_putenv("SIGNATURE", cp);
 #ifdef UCI
                else {
-                       snprintf (buf, sizeof(buf), "%s/.signature", mypath);
-                       if ((fp = fopen (buf, "r")) != NULL
-                               && fgets (buf, sizeof(buf), fp) != NULL) {
-                                       fclose (fp);
-                                       if (cp = strchr (buf, '\n'))
-                                               *cp = 0;
-                                       m_putenv ("SIGNATURE", buf);
+                       snprintf(buf, sizeof(buf), "%s/.signature", mypath);
+                       if ((fp = fopen(buf, "r")) != NULL &&
+                                       fgets(buf, sizeof(buf), fp) != NULL) {
+                               fclose(fp);
+                               if (cp = strchr(buf, '\n'))
+                                       *cp = 0;
+                               m_putenv("SIGNATURE", buf);
                        }
                }
 #endif /* UCI */
 
-       if ((annotext = getenv ("mhannotate")) == NULL || *annotext == 0)
+       if ((annotext = getenv("mhannotate")) == NULL || *annotext == 0)
                annotext = NULL;
-       if ((altmsg = getenv ("mhaltmsg")) == NULL || *altmsg == 0)
+       if ((altmsg = getenv("mhaltmsg")) == NULL || *altmsg == 0)
                altmsg = NULL;
-       if (annotext && ((cp = getenv ("mhinplace")) != NULL && *cp != 0))
-               inplace = atoi (cp);
+       if (annotext && ((cp = getenv("mhinplace")) != NULL && *cp != 0))
+               inplace = atoi(cp);
 
-       if ((cp = getenv ("mhdist"))
-                       && *cp
+       if ((cp = getenv("mhdist")) && *cp
 #ifndef lint
                        && (distsw = atoi (cp))
 #endif /* not lint */
                        && altmsg) {
                vec[vecp++] = "-dist";
-               distfile = getcpy (m_mktemp2(altmsg, invo_name, NULL, NULL));
-               if (link (altmsg, distfile) == NOTOK)
-                       adios (distfile, "unable to link %s to", altmsg);
+               distfile = getcpy(m_mktemp2(altmsg, invo_name, NULL, NULL));
+               if (link(altmsg, distfile) == NOTOK)
+                       adios(distfile, "unable to link %s to", altmsg);
        } else {
                distfile = NULL;
        }
 
-       if (altmsg == NULL || stat (altmsg, &st) == NOTOK) {
+       if (altmsg == NULL || stat(altmsg, &st) == NOTOK) {
                st.st_mtime = 0;
                st.st_dev = 0;
                st.st_ino = 0;
        }
        if ((pushsw = pushed))
-               push ();
+               push();
 
-       vec[0] = r1bindex (postproc, '/');
-       closefds (3);
+       vec[0] = r1bindex(postproc, '/');
+       closefds(3);
 
-       if (sendsbr (vec, vecp, file, &st, 1, attach, attachformat) == OK)
-               done (0);
+       if (sendsbr(vec, vecp, file, &st, 1, attach, attachformat) == OK)
+               done(0);
 }
 
 
@@ -1310,10 +1305,10 @@ sendit (char *sp, char **arg, char *file, int pushed)
 */
 
 static int
-removefile (char *drft)
+removefile(char *drft)
 {
-       if (unlink (drft) == NOTOK)
-               adios (drft, "unable to unlink");
+       if (unlink(drft) == NOTOK)
+               adios(drft, "unable to unlink");
 
        return OK;
 }