X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fsdf-2.c;h=29ccc34ac570c665c5d59d0060231f5249991434;hp=89e9bf41f205f693335d8c0ef9324a9a9938fe7e;hb=c95a927599e20c3d7762073450e3126d9694107d;hpb=1e8e203f6b646a69235589d3b8f931da12e77b91 diff --git a/src/sdf-2.c b/src/sdf-2.c index 89e9bf4..29ccc34 100644 --- a/src/sdf-2.c +++ b/src/sdf-2.c @@ -2,8 +2,11 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: sdf-2.c,v 1.3 2000/05/11 01:06:30 kevin Exp $ +** $Id: sdf-2.c,v 1.4 2000/05/16 04:33:59 kevin Exp $ ** $Log: sdf-2.c,v $ +** Revision 1.4 2000/05/16 04:33:59 kevin +** Improved option processing +** ** Revision 1.3 2000/05/11 01:06:30 kevin ** Changed sprintf to snprintf ** @@ -28,6 +31,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 * sdf-2.c Generate a SDF file from two input SDF files */ @@ -49,9 +53,9 @@ static struct option my_options[] = }; void -usage (const char *program) +sdf2_usage (const char *program) { - fprintf(stdout, "usage: %s infile1 infile2 outfile [OPTIONS]\n", kbasename(program)); + fprintf(stdout, "sdf2_usage: %s infile1 infile2 outfile [OPTIONS]\n", kbasename(program)); fprintf(stdout, "Generate an SDF2D file from two input SDF2D files\n"); fprintf(stdout, "\n"); fprintf(stdout, " infile1 Name of first input SDF file\n"); @@ -64,11 +68,10 @@ usage (const char *program) fprintf(stdout, " --verbose Verbose modem\n"); fprintf(stdout, " --version Print version\n"); fprintf(stdout, " --help Print this help message\n"); - exit(1); } int -main (int argc, char *const argv[]) +sdf2_main (int argc, char *const argv[]) { IMAGE *im_in1; IMAGE *im_in2; @@ -115,18 +118,18 @@ main (int argc, char *const argv[]) exit(0); case O_HELP: case '?': - usage(argv[0]); - exit(0); + sdf2_usage(argv[0]); + return (0); default: - usage(argv[0]); - exit(1); + sdf2_usage(argv[0]); + return (1); } } if (optind + 3 != argc) { - usage(argv[0]); - exit(1); + sdf2_usage(argv[0]); + return (1); } in_file1 = argv[optind]; @@ -195,3 +198,12 @@ main (int argc, char *const argv[]) return (0); } + +#ifndef NO_MAIN +int +main (int argc, char *const argv[]) +{ + return (sdf2_main(argc, argv)); +} +#endif +