home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / text / misc / cvt / source / args.c next >
C/C++ Source or Header  |  1995-01-08  |  2KB  |  63 lines

  1. /*
  2.  *  ARGS.C
  3.  */
  4.  
  5. #include <string.h>
  6. #include <stdio.h>
  7.  
  8. static char *howtouse[]= {
  9.   "-c", "--charset-size",    "set local charset size (default is -c256)",
  10. #ifdef DEBUG
  11.   "-d", "--debug",           "set debug level (0..4)",
  12. #endif
  13.   "-E", "--stderr",          "redirect error messages",
  14.   "-e", "--max-errors",      "set maximum #of errors until scanner aborts",
  15.   "-f", "--file",            "set conversion scriptfile name",
  16.   "-h", "--help",            "display this short usage information and exit",
  17.   "-l", "--from",            "take input filenames from a file",
  18.   "-n", "--dry-run",         "only check the scriptfile(s) -- don't convert",
  19.   "-n", "--dryrun",          "",
  20.   "-o", "--output",          "set output filename (%s for the input filename)",
  21.   "-s", "--silent",          "don't print output filenames when converting",
  22.   "-s", "--quiet",           "",
  23.   "-t", "--temp",            "set filename for temporary data",
  24.   "-v", "--version",         "display author version information",
  25.   "-x", "--check-exists",    "check input file existance before converting",
  26.   "-x", "--check-existence", "",
  27.   (char *)0L, (char *)0L, (char *)0L
  28. };
  29.  
  30. #ifdef UNDEFINED
  31.  
  32.   "-r", "--reverse",      "swap lhs and rhs in every rule",
  33.   "-i", "--ignore-case",  "treat upper and lower case the same",
  34.  
  35. #endif /* UNDEFINED */
  36.  
  37. char *
  38. convert_args(s)
  39. char *s;
  40. {
  41.   char **t= howtouse;
  42.  
  43.   while(*t)
  44.   { if(!strcmp(s,t[1]))
  45.       break;
  46.     t= &t[3];
  47.   }
  48.  
  49.   return (*t) ? *t : s;
  50. }
  51.  
  52. void
  53. display_args(void)
  54. {
  55.   char **t= howtouse;
  56.  
  57.   while(*t)
  58.   { if(t[2] && *t[2])
  59.       printf("%2s or %-16s %s\n",t[0],t[1],t[2]);
  60.     t= &t[3];
  61.   }
  62. }
  63.