* docbook2mdoc: improve error handling and usage in main()
@ 2019-03-08 10:04 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-03-08 10:04 UTC (permalink / raw)
To: source
Log Message:
-----------
improve error handling and usage in main()
Modified Files:
--------------
docbook2mdoc:
docbook2mdoc.c
Revision Data
-------------
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.44 -r1.45
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -1654,9 +1654,10 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
- if (argc > 1)
- return(EXIT_FAILURE);
- else if (argc > 0)
+ if (argc > 1) {
+ fprintf(stderr, "%s: Too many arguments\n", argv[1]);
+ goto usage;
+ } else if (argc > 0)
fname = argv[0];
/* Read from stdin or a file. */
@@ -1685,6 +1686,6 @@ main(int argc, char *argv[])
return(rc ? EXIT_SUCCESS : EXIT_FAILURE);
usage:
- fprintf(stderr, "usage: %s [-W]\n", progname);
+ fprintf(stderr, "usage: %s [-W] [input_filename]\n", progname);
return(EXIT_FAILURE);
}
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-03-08 10:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08 10:04 docbook2mdoc: improve error handling and usage in main() schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).