X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fsdf-2.c;h=29ccc34ac570c665c5d59d0060231f5249991434;hb=c95a927599e20c3d7762073450e3126d9694107d;hp=3a1843848bae049e4cb199570fcbf4393163ef52;hpb=13838bda88b63a2535b5baaf7197006767de4b8e;p=ctsim.git diff --git a/src/sdf-2.c b/src/sdf-2.c index 3a18438..29ccc34 100644 --- a/src/sdf-2.c +++ b/src/sdf-2.c @@ -2,10 +2,20 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: sdf-2.c,v 1.1 2000/04/28 13:02:44 kevin Exp $ +** $Id: sdf-2.c,v 1.4 2000/05/16 04:33:59 kevin Exp $ ** $Log: sdf-2.c,v $ -** Revision 1.1 2000/04/28 13:02:44 kevin -** Initial revision +** 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 +** +** Revision 1.2 2000/05/08 20:02:32 kevin +** ANSI C changes +** +** Revision 1.1.1.1 2000/04/28 13:02:44 kevin +** Initial CVS import for first public release +** ** ** ** This program is free software; you can redistribute it and/or modify @@ -21,19 +31,14 @@ ** 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 */ #include "ct.h" -#define O_ADD 1 -#define O_SUB 2 -#define O_MUL 3 -#define O_COMP 4 -#define O_VERBOSE 7 -#define O_HELP 8 -#define O_VERSION 9 +enum {O_ADD, O_SUB, O_MUL, O_COMP, O_VERBOSE, O_HELP, O_VERSION}; static struct option my_options[] = { @@ -48,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"); @@ -61,13 +66,12 @@ usage (const char *program) fprintf(stdout, " --mul Multiply images\n"); fprintf(stdout, " --comp Compare images\n"); fprintf(stdout, " --verbose Verbose modem\n"); - fprintf(stdout," --version Print version\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; @@ -114,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]; @@ -194,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 +