X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fsdfinfo.c;fp=src%2Fsdfinfo.c;h=568c951aa09c421c70163af6b68118c5eb9d4bbc;hb=c95a927599e20c3d7762073450e3126d9694107d;hp=49cfd9f7d3c4e04f1d69c518c56cc328eb8e0d87;hpb=1e8e203f6b646a69235589d3b8f931da12e77b91;p=ctsim.git diff --git a/src/sdfinfo.c b/src/sdfinfo.c index 49cfd9f..568c951 100644 --- a/src/sdfinfo.c +++ b/src/sdfinfo.c @@ -2,8 +2,11 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: sdfinfo.c,v 1.2 2000/05/08 20:02:32 kevin Exp $ +** $Id: sdfinfo.c,v 1.3 2000/05/16 04:33:59 kevin Exp $ ** $Log: sdfinfo.c,v $ +** Revision 1.3 2000/05/16 04:33:59 kevin +** Improved option processing +** ** Revision 1.2 2000/05/08 20:02:32 kevin ** ANSI C changes ** @@ -25,6 +28,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ******************************************************************************/ + /* FILE * sdfinfo.c Display info on sdf files */ @@ -47,9 +51,9 @@ static struct option my_options[] = }; void -usage (const char *program) +sdfinfo_usage (const char *program) { - fprintf(stdout, "usage: %s infile [OPTIONS]\n", kbasename(program)); + fprintf(stdout, "sdfinfo_usage: %s infile [OPTIONS]\n", kbasename(program)); fprintf(stdout, "Analyze an SDF2D file\n"); fprintf(stdout, "\n"); fprintf(stdout, " infile Name of input SDF file\n"); @@ -62,11 +66,10 @@ usage (const char *program) fprintf(stdout, " --verbose Verbose mode\n"); fprintf(stdout, " --version Print version\n"); fprintf(stdout, " --help Print this help message\n"); - exit(1); } int -main (int argc, char *const argv[]) +sdfinfo_main (int argc, char *const argv[]) { IMAGE *im; char *in_file; @@ -111,18 +114,18 @@ main (int argc, char *const argv[]) exit(0); case O_HELP: case '?': - usage(argv[0]); - exit(0); + sdfinfo_usage(argv[0]); + return (0); default: - usage(argv[0]); - exit(1); + sdfinfo_usage(argv[0]); + return (1); } } if (optind + 1 != argc) { - usage(argv[0]); - exit(1); + sdfinfo_usage(argv[0]); + return (1); } in_file = argv[optind]; @@ -225,3 +228,11 @@ main (int argc, char *const argv[]) return (0); } + +#ifndef NO_MAIN +int +main (int argc, char *const argv[]) +{ + return (sdfinfo_main(argc, argv)); +} +#endif