/*
 *  ARGS.C
 */

#include <string.h>
#include <stdio.h>

static char *howtouse[]= {
  "-c", "--charset-size",    "set local charset size (default is -c256)",
#ifdef DEBUG
  "-d", "--debug",           "set debug level (0..4)",
#endif
  "-E", "--stderr",          "redirect error messages",
  "-e", "--max-errors",      "set maximum #of errors until scanner aborts",
  "-f", "--file",            "set conversion scriptfile name",
  "-h", "--help",            "display this short usage information and exit",
  "-l", "--from",            "take input filenames from a file",
  "-n", "--dry-run",         "only check the scriptfile(s) -- don't convert",
  "-n", "--dryrun",          "",
  "-o", "--output",          "set output filename (%s for the input filename)",
  "-s", "--silent",          "don't print output filenames when converting",
  "-s", "--quiet",           "",
  "-t", "--temp",            "set filename for temporary data",
  "-v", "--version",         "display author version information",
  "-x", "--check-exists",    "check input file existance before converting",
  "-x", "--check-existence", "",
  (char *)0L, (char *)0L, (char *)0L
};

#ifdef UNDEFINED

  "-r", "--reverse",      "swap lhs and rhs in every rule",
  "-i", "--ignore-case",  "treat upper and lower case the same",

#endif /* UNDEFINED */

char *
convert_args(s)
char *s;
{
  char **t= howtouse;

  while(*t)
  { if(!strcmp(s,t[1]))
      break;
    t= &t[3];
  }

  return (*t) ? *t : s;
}

void
display_args(void)
{
  char **t= howtouse;

  while(*t)
  { if(t[2] && *t[2])
      printf("%2s or %-16s %s\n",t[0],t[1],t[2]);
    t= &t[3];
  }
}
