+2007-11-04 Joel Reicher <joel@panacea.null.org>
+
+ * Changed done() link overriding to function pointer. Return type
+ is now void so that exit() can be used as done() callback. Dead
+ code return from all done()s removed, with return 1 in main()
+ following done() (should never be reached).
+
2007-08-21 Josh Bressers <josh@bress.net>
* Red Hat Bug #253342: inc.c, utils.c, utils.h: When inc is run with
extern char *whatnowproc;
extern char *whomproc;
-extern int (*done) (int);
+extern void (*done) (int);
#include <h/prototypes.h>
#include <h/mh.h>
-int (*done) (int) = default_done;
-
-int
-default_done (int status)
-{
- exit (status);
- return 1; /* dead code to satisfy the compiler */
-}
+void (*done) (int) = exit;
}
}
- return done (0);
+ done (0);
+ return 1;
}
static void
else
annotate (draft, comp, text, inplace, datesw, delete, append);
- return (done(0));
+ done(0);
+ return 1;
}
#ifdef UCI
seq_save (mp); /* synchronize message sequences */
folder_free (mp); /* free folder/message structure */
context_save (); /* save the context file */
- return done (0);
+ done (0);
+ return 1;
}
static void
for (addrp = 0; addrs[addrp]; addrp++)
status += process (addrs[addrp], width, normalize);
- return done (status);
+ done (status);
+ return 1;
}
struct pqpair {
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
- return done (0);
+ done (0);
+ return 1;
}
if (nwhat)
done (0);
what_now (ed, nedit, use, drft, NULL, 0, NULLMP, NULL, 0, cwd);
- return done (1);
+ done (1);
+ return 1;
}
#endif /* UCI */
maildrops ();
- return done (0);
+ done (0);
+ return 1;
}
done (0);
what_now (ed, nedit, NOUSE, drft, msgnam, 1, mp,
anot ? "Resent" : NULL, inplace, cwd);
- return done (1);
+ done (1);
+ return 1;
}
status += process (dates[datep], width);
context_save (); /* save the context file */
- return done (status);
+ done (status);
+ return 1;
}
ScanFolders();
qsort(folders, nFolders, sizeof(struct Folder), (qsort_comp) CompareFolders);
PrintFolders();
- return done (0);
+ done (0);
+ return 1;
}
/*
ncomps = fmt_compile(nfs, &fmt);
fmt_dump(fmt);
- return done(0);
+ done(0);
+ return 1;
}
static void
print_folders();
context_save (); /* save the context file */
- return done (0);
+ done (0);
+ return 1;
}
/*
done (0);
what_now (ed, nedit, NOUSE, drft, NULL, 0, mp,
anot ? "Forwarded" : NULL, inplace, cwd);
- return done (1);
+ done (1);
+ return 1;
}
*/
char *map_name(char *);
-static int inc_done(int);
+static void inc_done(int);
#ifdef POP
static int pop_action(char *);
static int pop_pack(char *);
seq_setunseen (mp, 0); /* set the Unseen-Sequence */
seq_save (mp); /* synchronize sequences */
context_save (); /* save the context file */
- return done (0);
+ done (0);
+ return 1;
}
#endif /* if 0 */
-static int
+static void
inc_done (int status)
{
#ifdef POP
DROPGROUPPRIVS();
}
exit (status);
- return 1; /* dead code to satisfy the compiler */
}
#ifdef POP
fprintf (out, "%s: %s\n", np->n_name, np->n_field);
}
fclose (out);
- return done (0);
+ done (0);
+ return 1;
}
context_replace (pfolder, folder); /* update current folder */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
- return done (0);
+ done (0);
+ return 1;
}
static char outfile[BUFSIZ];
static int unlink_outfile = 0;
-static int unlink_done (int);
+static void unlink_done (int);
/* mhbuildsbr.c */
CT build_mime (char *);
unlink_outfile = 0;
free_content (ct);
- return done (0);
+ done (0);
+ return 1;
}
-static int
+static void
unlink_done (int status)
{
/*
unlink (outfile);
exit (status);
- return 1; /* dead code to satisfy the compiler */
}
fflush (stdout);
fflush (stderr);
- return done (1);
+ done (1);
+ return 1;
}
void free_header (CT);
void free_ctinfo (CT);
void free_encoding (CT, int);
-int freects_done (int);
+void freects_done (int);
/*
* static prototypes
}
-int
+void
freects_done (int status)
{
CT *ctp;
free_content (*ctp);
exit (status);
- return 1; /* dead code to satisfy the compiler */
}
#ifdef LOCALE
setlocale(LC_ALL, "");
#endif
- return done (mhl (argc, argv));
+ done (mhl (argc, argv));
+ return 1;
}
/* mhfree.c */
void free_content (CT);
extern CT *cts;
-int freects_done (int);
+void freects_done (int);
/*
* static prototypes
context_save (); /* save the context file */
}
- return done (0);
+ done (0);
+ return 1;
}
/* mhfree.c */
void free_content (CT);
extern CT *cts;
-int freects_done (int);
+void freects_done (int);
/*
* static prototypes
context_save (); /* save the context file */
}
- return done (0);
+ done (0);
+ return 1;
}
}
}
- return done (missed);
+ done (missed);
+ return 1;
}
fflush (stdout);
fflush (stderr);
- return done (1);
+ done (1);
+ return 1;
}
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
- return done (0);
+ done (0);
+ return 1;
}
/* mhfree.c */
void free_content (CT);
extern CT *cts;
-int freects_done (int);
+void freects_done (int);
/*
* static prototypes
context_save (); /* save the context file */
}
- return done (0);
+ done (0);
+ return 1;
}
/* mhfree.c */
void free_content (CT);
extern CT *cts;
-int freects_done (int);
+void freects_done (int);
/*
* static prototypes
context_save (); /* save the context file */
}
- return done (0);
+ done (0);
+ return 1;
}
/* mhfree.c */
void free_content (CT);
extern CT *cts;
-int freects_done (int);
+void freects_done (int);
/*
* static prototypes
context_save (); /* save the context file */
}
- return done (0);
+ done (0);
+ return 1;
}
} /* host == NULL */
#endif
- return done (status);
+ done (status);
+ return 1;
}
m_reset ();
- return done (0);
+ done (0);
+ return 1;
}
static int mbx_style = MBOX_FORMAT;
static int mapping = 0;
-static int mbxclose_done(int);
+static void mbxclose_done(int);
char *file = NULL;
seq_save (mp);
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
- return done (0);
+ done (0);
+ return 1;
}
-static int
+static void
mbxclose_done (int status)
{
mbx_close (file, md);
exit (status);
- return 1; /* dead code to satisfy the compiler */
}
static int listsw = -1;
-static int putzero_done (int);
+static void putzero_done (int);
int
main (int argc, char **argv)
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
- return done (0);
+ done (0);
+ return 1;
}
-static int
+static void
putzero_done (int status)
{
if (listsw && status && !isatty (fileno (stdout)))
printf ("0\n");
exit (status);
- return 1; /* dead code to satisfy the compiler */
}
if (verbose)
printf (partno ? "Partial Message #%s Processed\n" : "Message Processed\n",
partno);
- return done (0);
+ done (0);
+ return 1;
}
unlink (tmpfil);
context_save (); /* save the context file */
- return done (0);
+ done (0);
+ return 1;
}
* prototypes
*/
static void rcvdistout (FILE *, char *, char *);
-static int unlink_done (int);
+static void unlink_done (int);
int
}
-static int
+static void
unlink_done (int status)
{
if (backup[0])
unlink (tmpfil);
exit (status ? RCV_MBX : RCV_MOK);
- return 1; /* dead code to satisfy the compiler */
}
if (mbx_close (file, md) == NOTOK)
done (RCV_MBX);
- return done (RCV_MOK);
+ done (RCV_MOK);
+ return 1;
}
*/
static char *tmpfilenam = NULL;
-static int unlink_done(int);
+static void unlink_done(int);
int
main (int argc, char **argv)
unlink (tmpfilenam); /* remove temporary file */
tmpfilenam = NULL;
- return done (0);
+ done (0);
+ return 1;
}
/*
* Clean up and exit
*/
-static int
+static void
unlink_done(int status)
{
if (tmpfilenam && *tmpfilenam)
unlink (tmpfilenam);
exit (status);
- return 1; /* dead code to satisfy the compiler */
}
context_replace (pfolder, folder); /* update current folder */
context_save (); /* save the context file */
folder_free (mp); /* free folder structure */
- return done (0);
+ done (0);
+ return 1;
}
done (0);
what_now (ed, nedit, NOUSE, drft, msg, 0, mp,
anot ? "Replied" : NULL, inplace, cwd);
- return done (1);
+ done (1);
+ return 1;
}
void
}
}
context_save (); /* save the context file */
- return done (0);
+ done (0);
+ return 1;
}
static int
context_replace (pfolder, folder); /* update current folder */
context_save (); /* save the context file */
folder_free (mp); /* free folder structure */
- return done (0);
+ done (0);
+ return 1;
}
if (clearflag)
clear_screen ();
- return done (0);
+ done (0);
+ return 1;
}
}
context_save (); /* save the context file */
- return done (status);
+ done (status);
+ return 1;
}
/*
* static prototypes
*/
-static int armed_done (int);
+static void armed_done (int);
static void alert (char *, int);
static int tmp_fd (void);
static void anno (int, struct stat *);
break;
}
- done=default_done;
+ done=exit;
if (distfile)
unlink (distfile);
}
-static int
+static void
armed_done (int status)
{
longjmp (env, status ? status : NOTOK);
exit (status);
- return 1; /* dead code to satisfy the compiler */
}
/* deliver the message */
status = localmail (fd, mdlvr);
- return done (status != -1 ? RCV_MOK : RCV_MBX);
+ done (status != -1 ? RCV_MOK : RCV_MBX);
+ return 1;
}
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
- return done (0);
+ done (0);
+ return 1;
}
static int
fclose (fp);
if (unlink (tmpfil) == -1)
advise (NULL, "unable to remove temp file %s", tmpfil);
- return done (status);
+ done (status);
+ return 1;
}