r65: *** empty log message ***
[ctsim.git] / src / sdf-1.c
index b95deb811e32013cc269179cf4c28d911edc1109..0b591c784efbf5c87738652893f6dbbec83f77c0 100644 (file)
@@ -2,8 +2,14 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: sdf-1.c,v 1.4 2000/05/09 14:52:27 kevin Exp $
+**  $Id: sdf-1.c,v 1.6 2000/05/24 22:50:04 kevin Exp $
 **  $Log: sdf-1.c,v $
+**  Revision 1.6  2000/05/24 22:50:04  kevin
+**  Added support for new SGP library
+**
+**  Revision 1.5  2000/05/16 04:33:59  kevin
+**  Improved option processing
+**
 **  Revision 1.4  2000/05/09 14:52:27  kevin
 **  added sqr and sqrt functions
 **
@@ -31,6 +37,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-1.c             Filter a single SDF file
  */
@@ -53,9 +60,9 @@ static struct option my_options[] =
 };
 
 void 
-usage (const char *program)
+sdf1_usage (const char *program)
 {
-  fprintf(stdout, "usage: %s infile outfile [OPTIONS]\n", kbasename(program));
+  fprintf(stdout, "sdf1_usage: %s infile outfile [OPTIONS]\n", kbasename(program));
   fprintf(stdout, "Generate a SDF2D file from a SDF2D file\n");
   fprintf(stdout, "\n");
   fprintf(stdout, "     --invert   Invert image\n");
@@ -66,11 +73,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[])
+sdf1_main (int argc, char *const argv[])
 {
   IMAGE *im_in;
   IMAGE *im_out;
@@ -119,25 +125,25 @@ main (int argc, char *const argv[])
          exit(0);
        case O_HELP:
        case '?':
-         usage(argv[0]);
-         exit(0);
+         sdf1_usage(argv[0]);
+         return (0);
        default:
-         usage(argv[0]);
-         exit(1);
+         sdf1_usage(argv[0]);
+         return (1);
        }
     }
 
   if (optind + 2 != argc)
     {
-      usage(argv[0]);
-      exit(1);
+      sdf1_usage(argv[0]);
+      return (1);
     }
   
   in_file = argv[optind];
   out_file = argv[optind + 1];
 
 
-  if (opt_invert || opt_log || opt_exp) {
+  if (opt_invert || opt_log || opt_exp || opt_sqr || opt_sqrt) {
     int ix, iy;
 
     im_in = image_load (in_file);
@@ -174,3 +180,12 @@ main (int argc, char *const argv[])
 
   return (0);
 }
+
+#ifndef NO_MAIN
+int 
+main (int argc, char *const argv[])
+{
+  return (sdf1_main(argc, argv));
+}
+#endif
+