On Wed, Oct 01, 2014 at 05:41:11PM -0500, Kent R. Spillner wrote: > ok kspillner@. It would be nice to replace some of those exit(1) with > exit(EXIT_FAILURE), but that should be a separate diff that also updates the > err/errx's as well.
In general EXIT_XXX is frowned upon in OpenBSD. -Otto > > > > On Oct 1, 2014, at 13:06, Fritjof Bornebusch <frit...@alokat.org> wrote: > > > >> On Wed, Oct 01, 2014 at 06:41:25PM +0100, Nicholas Marriott wrote: > >> Looks good but you have missed out ident.c and rcsprog.c > > > > Ups, sorry. > > > >> > >> > >>> On Wed, Oct 01, 2014 at 11:19:29AM +0200, Fritjof Bornebusch wrote: > >>> On Sat, Sep 27, 2014 at 07:10:01PM +0200, Fritjof Bornebusch wrote: > >>> Hi, > >>> > >>>> Hi, > >>>> > >>>> after usage() was called, there is no where you can go. > >>> > >>> as suggested by otto@ and @nicm, the usage() functions are marked as > >>> __dead. > >>> > >>>> fritjof > >>> > >>> fritjof > > > > fritjof > > > > Index: ci.c > > =================================================================== > > RCS file: /cvs/src/usr.bin/rcs/ci.c,v > > retrieving revision 1.217 > > diff -u -p -r1.217 ci.c > > --- ci.c 19 May 2014 19:42:24 -0000 1.217 > > +++ ci.c 1 Oct 2014 08:38:31 -0000 > > @@ -89,7 +89,7 @@ static void checkin_parsekeyword(char * > > static int checkin_update(struct checkin_params *); > > static int checkin_revert(struct checkin_params *); > > > > -void > > +__dead void > > checkin_usage(void) > > { > > fprintf(stderr, > > @@ -97,6 +97,8 @@ checkin_usage(void) > > " [-j[rev]] [-k[rev]] [-l[rev]] [-M[rev]] [-mmsg]\n" > > " [-Nsymbol] [-nsymbol] [-r[rev]] [-sstate] [-t[str]]\n" > > " [-u[rev]] [-wusername] [-xsuffixes] [-ztz] file ...\n"); > > + > > + exit(1); > > } > > > > /* > > @@ -221,7 +223,6 @@ checkin_main(int argc, char **argv) > > break; > > default: > > (usage)(); > > - exit(1); > > } > > } > > > > @@ -231,7 +232,6 @@ checkin_main(int argc, char **argv) > > if (argc == 0) { > > warnx("no input file"); > > (usage)(); > > - exit(1); > > } > > > > if ((pb.username = getlogin()) == NULL) > > Index: co.c > > =================================================================== > > RCS file: /cvs/src/usr.bin/rcs/co.c,v > > retrieving revision 1.117 > > diff -u -p -r1.117 co.c > > --- co.c 16 Apr 2013 20:24:45 -0000 1.117 > > +++ co.c 1 Oct 2014 08:38:40 -0000 > > @@ -79,7 +79,6 @@ checkout_main(int argc, char **argv) > > if (RCS_KWEXP_INVAL(kflag)) { > > warnx("invalid RCS keyword substitution mode"); > > (usage)(); > > - exit(1); > > } > > break; > > case 'l': > > @@ -141,7 +140,6 @@ checkout_main(int argc, char **argv) > > break; > > default: > > (usage)(); > > - exit(1); > > } > > } > > > > @@ -151,7 +149,6 @@ checkout_main(int argc, char **argv) > > if (argc == 0) { > > warnx("no input file"); > > (usage)(); > > - exit (1); > > } > > > > if ((username = getlogin()) == NULL) > > @@ -222,13 +219,15 @@ checkout_main(int argc, char **argv) > > return (ret); > > } > > > > -void > > +__dead void > > checkout_usage(void) > > { > > fprintf(stderr, > > "usage: co [-TV] [-ddate] [-f[rev]] [-I[rev]] [-kmode] [-l[rev]]\n" > > " [-M[rev]] [-p[rev]] [-q[rev]] [-r[rev]] [-sstate]\n" > > " [-u[rev]] [-w[user]] [-xsuffixes] [-ztz] file ...\n"); > > + > > + exit(1); > > } > > > > /* > > Index: merge.c > > =================================================================== > > RCS file: /cvs/src/usr.bin/rcs/merge.c,v > > retrieving revision 1.7 > > diff -u -p -r1.7 merge.c > > --- merge.c 23 Jul 2010 21:46:05 -0000 1.7 > > +++ merge.c 1 Oct 2014 08:38:52 -0000 > > @@ -77,7 +77,6 @@ merge_main(int argc, char **argv) > > exit(0); > > default: > > (usage)(); > > - exit(D_ERROR); > > } > > } > > argc -= optind; > > @@ -86,7 +85,6 @@ merge_main(int argc, char **argv) > > if (argc != 3) { > > warnx("%s arguments", (argc < 3) ? "not enough" : "too many"); > > (usage)(); > > - exit(D_ERROR); > > } > > > > for (; labels < 3; labels++) > > @@ -113,9 +111,11 @@ merge_main(int argc, char **argv) > > return (status); > > } > > > > -void > > +__dead void > > merge_usage(void) > > { > > (void)fprintf(stderr, > > "usage: merge [-EepqV] [-L label] file1 file2 file3\n"); > > + > > + exit(D_ERROR); > > } > > Index: rcsclean.c > > =================================================================== > > RCS file: /cvs/src/usr.bin/rcs/rcsclean.c,v > > retrieving revision 1.52 > > diff -u -p -r1.52 rcsclean.c > > --- rcsclean.c 28 Jul 2010 09:07:11 -0000 1.52 > > +++ rcsclean.c 1 Oct 2014 08:39:05 -0000 > > @@ -60,7 +60,6 @@ rcsclean_main(int argc, char **argv) > > if (RCS_KWEXP_INVAL(kflag)) { > > warnx("invalid RCS keyword substitution mode"); > > (usage)(); > > - exit(1); > > } > > break; > > case 'n': > > @@ -90,7 +89,6 @@ rcsclean_main(int argc, char **argv) > > break; > > default: > > (usage)(); > > - exit(1); > > } > > } > > > > @@ -104,7 +102,6 @@ rcsclean_main(int argc, char **argv) > > if ((dirp = opendir(".")) == NULL) { > > warn("opendir"); > > (usage)(); > > - exit(1); > > } > > > > while ((dp = readdir(dirp)) != NULL) { > > @@ -121,12 +118,14 @@ rcsclean_main(int argc, char **argv) > > return (0); > > } > > > > -void > > +__dead void > > rcsclean_usage(void) > > { > > fprintf(stderr, > > "usage: rcsclean [-TV] [-kmode] [-n[rev]] [-q[rev]] [-r[rev]]\n" > > " [-u[rev]] [-xsuffixes] [-ztz] [file ...]\n"); > > + > > + exit(1); > > } > > > > static void > > Index: rcsdiff.c > > =================================================================== > > RCS file: /cvs/src/usr.bin/rcs/rcsdiff.c,v > > retrieving revision 1.79 > > diff -u -p -r1.79 rcsdiff.c > > --- rcsdiff.c 16 Apr 2013 20:24:45 -0000 1.79 > > +++ rcsdiff.c 1 Oct 2014 08:40:05 -0000 > > @@ -117,7 +117,6 @@ rcsdiff_main(int argc, char **argv) > > if (RCS_KWEXP_INVAL(kflag)) { > > warnx("invalid RCS keyword substitution mode"); > > (usage)(); > > - exit(D_ERROR); > > } > > break; > > case 'n': > > @@ -184,7 +183,6 @@ rcsdiff_main(int argc, char **argv) > > break; > > default: > > (usage)(); > > - exit(D_ERROR); > > } > > } > > > > @@ -194,7 +192,6 @@ rcsdiff_main(int argc, char **argv) > > if (argc == 0) { > > warnx("no input file"); > > (usage)(); > > - exit(D_ERROR); > > } > > > > if (diff_ignore_pats != NULL) { > > @@ -267,12 +264,14 @@ rcsdiff_main(int argc, char **argv) > > return (status); > > } > > > > -void > > +__dead void > > rcsdiff_usage(void) > > { > > fprintf(stderr, > > "usage: rcsdiff [-cnquV] [-kmode] [-rrev] [-xsuffixes] [-ztz]\n" > > " [diff_options] file ...\n"); > > + > > + exit(D_ERROR); > > } > > > > static int > > Index: rcsmerge.c > > =================================================================== > > RCS file: /cvs/src/usr.bin/rcs/rcsmerge.c,v > > retrieving revision 1.52 > > diff -u -p -r1.52 rcsmerge.c > > --- rcsmerge.c 23 Jul 2010 21:46:05 -0000 1.52 > > +++ rcsmerge.c 1 Oct 2014 08:40:14 -0000 > > @@ -68,7 +68,6 @@ rcsmerge_main(int argc, char **argv) > > if (RCS_KWEXP_INVAL(kflag)) { > > warnx("invalid RCS keyword substitution mode"); > > (usage)(); > > - exit(D_ERROR); > > } > > break; > > case 'p': > > @@ -100,7 +99,6 @@ rcsmerge_main(int argc, char **argv) > > break; > > default: > > (usage)(); > > - exit(D_ERROR); > > } > > } > > > > @@ -110,13 +108,11 @@ rcsmerge_main(int argc, char **argv) > > if (rev_str1 == NULL) { > > warnx("no base revision number given"); > > (usage)(); > > - exit(D_ERROR); > > } > > > > if (argc < 1) { > > warnx("no input file"); > > (usage)(); > > - exit(D_ERROR); > > } > > > > if (argc > 2 || (argc == 2 && argv[1] != NULL)) > > @@ -187,10 +183,12 @@ out: > > return (status); > > } > > > > -void > > +__dead void > > rcsmerge_usage(void) > > { > > fprintf(stderr, > > "usage: rcsmerge [-EV] [-kmode] [-p[rev]] [-q[rev]]\n" > > " [-xsuffixes] [-ztz] -rrev file ...\n"); > > + > > + exit(D_ERROR); > > } > > Index: rlog.c > > =================================================================== > > RCS file: /cvs/src/usr.bin/rcs/rlog.c,v > > retrieving revision 1.67 > > diff -u -p -r1.67 rlog.c > > --- rlog.c 7 Jan 2014 14:08:16 -0000 1.67 > > +++ rlog.c 1 Oct 2014 08:40:26 -0000 > > @@ -58,13 +58,15 @@ static char *wlist = NULL; > > static char *revisions = NULL; > > static char *rlog_dates = NULL; > > > > -void > > +__dead void > > rlog_usage(void) > > { > > fprintf(stderr, > > "usage: rlog [-bhLNRtV] [-ddates] [-l[lockers]] [-r[revs]]\n" > > " [-sstates] [-w[logins]] [-xsuffixes]\n" > > " [-ztz] file ...\n"); > > + > > + exit(1); > > } > > > > int > > @@ -135,7 +137,6 @@ rlog_main(int argc, char **argv) > > break; > > default: > > (usage()); > > - exit(1); > > } > > } > > > > @@ -145,7 +146,6 @@ rlog_main(int argc, char **argv) > > if (argc == 0) { > > warnx("no input file"); > > (usage)(); > > - exit(1); > > } > > > > if (hflag == 1 && tflag == 1) { > > Index: ident.c > > =================================================================== > > RCS file: /cvs/src/usr.bin/rcs/ident.c,v > > retrieving revision 1.29 > > diff -u -p -r1.29 ident.c > > --- ident.c 20 Apr 2011 19:34:16 -0000 1.29 > > +++ ident.c 1 Oct 2014 18:01:22 -0000 > > @@ -59,7 +59,6 @@ ident_main(int argc, char **argv) > > exit(0); > > default: > > (usage)(); > > - exit(1); > > } > > } > > > > @@ -161,8 +160,10 @@ out: > > buf_free(bp); > > } > > > > -void > > +__dead void > > ident_usage(void) > > { > > fprintf(stderr, "usage: ident [-qV] [file ...]\n"); > > + > > + exit(1); > > } > > Index: rcsprog.c > > =================================================================== > > RCS file: /cvs/src/usr.bin/rcs/rcsprog.c,v > > retrieving revision 1.151 > > diff -u -p -r1.151 rcsprog.c > > --- rcsprog.c 12 Jul 2011 21:00:32 -0000 1.151 > > +++ rcsprog.c 1 Oct 2014 18:01:34 -0000 > > @@ -158,13 +158,15 @@ main(int argc, char **argv) > > } > > > > > > -void > > +__dead void > > rcs_usage(void) > > { > > fprintf(stderr, > > "usage: rcs [-IiLqTUV] [-Aoldfile] [-ausers] [-b[rev]]\n" > > " [-cstring] [-e[users]] [-kmode] [-l[rev]] [-mrev:msg]\n" > > " [-orev] [-t[str]] [-u[rev]] [-xsuffixes] file ...\n"); > > + > > + exit(1); > > } > > > > /* > > @@ -225,7 +227,6 @@ rcs_main(int argc, char **argv) > > if (RCS_KWEXP_INVAL(kflag)) { > > warnx("invalid RCS keyword substitution mode"); > > (usage)(); > > - exit(1); > > } > > break; > > case 'L': > > @@ -290,7 +291,6 @@ rcs_main(int argc, char **argv) > > break; > > default: > > (usage)(); > > - exit(1); > > } > > } > > > > @@ -300,7 +300,6 @@ rcs_main(int argc, char **argv) > > if (argc == 0) { > > warnx("no input file"); > > (usage)(); > > - exit(1); > > } > > > > for (i = 0; i < argc; i++) { > > Index: rcsprog.h > > =================================================================== > > RCS file: /cvs/src/usr.bin/rcs/rcsprog.h,v > > retrieving revision 1.63 > > diff -u -p -r1.63 rcsprog.h > > --- rcsprog.h 23 Jul 2010 21:46:05 -0000 1.63 > > +++ rcsprog.h 1 Oct 2014 18:01:42 -0000 > > @@ -86,44 +86,44 @@ extern struct wklhead temp_files; > > time_t date_parse(const char *); > > > > /* ci.c */ > > -int checkin_main(int, char **); > > -void checkin_usage(void); > > +int checkin_main(int, char **); > > +__dead void checkin_usage(void); > > > > /* co.c */ > > -int checkout_main(int, char **); > > -int checkout_rev(RCSFILE *, RCSNUM *, const char *, int, const char *, > > - const char *, const char *, const char *); > > -void checkout_usage(void); > > +int checkout_main(int, char **); > > +int checkout_rev(RCSFILE *, RCSNUM *, const char *, > > + int, const char *, const char *, const char *, const char *); > > +__dead void checkout_usage(void); > > > > /* ident.c */ > > -int ident_main(int, char **); > > -void ident_usage(void); > > +int ident_main(int, char **); > > +__dead void ident_usage(void); > > > > /* merge.c */ > > -int merge_main(int, char **); > > -void merge_usage(void); > > +int merge_main(int, char **); > > +__dead void merge_usage(void); > > > > /* rcsclean.c */ > > -int rcsclean_main(int, char **); > > -void rcsclean_usage(void); > > +int rcsclean_main(int, char **); > > +__dead void rcsclean_usage(void); > > > > /* rcsdiff.c */ > > -int rcsdiff_main(int, char **); > > -void rcsdiff_usage(void); > > +int rcsdiff_main(int, char **); > > +__dead void rcsdiff_usage(void); > > > > /* rcsmerge.c */ > > -int rcsmerge_main(int, char **); > > -void rcsmerge_usage(void); > > +int rcsmerge_main(int, char **); > > +__dead void rcsmerge_usage(void); > > > > /* rcsprog.c */ > > -int build_cmd(char ***, char **, int); > > -int rcs_getopt(int, char **, const char *); > > -int rcs_main(int, char **); > > -void rcs_usage(void); > > -void (*usage)(void); > > +int build_cmd(char ***, char **, int); > > +int rcs_getopt(int, char **, const char *); > > +int rcs_main(int, char **); > > +__dead void rcs_usage(void); > > +void (*usage)(void); > > > > /* rlog.c */ > > -int rlog_main(int, char **); > > -void rlog_usage(void); > > +int rlog_main(int, char **); > > +__dead void rlog_usage(void); > > > > #endif /* RCSPROG_H */ > >