2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.5 1996-01-31 21:03:59 adam
10 * Revision 1.4 1995/09/04 12:33:31 adam
11 * Various cleanup. YAZ util used instead.
13 * Revision 1.3 1994/10/04 17:46:54 adam
14 * Function options now returns arg with error option.
16 * Revision 1.2 1994/09/28 13:07:08 adam
17 * Use log_mask_str now.
19 * Revision 1.1 1994/09/16 15:39:11 adam
20 * Initial code of lookup - not tested yet.
34 int main (int argc, char **argv)
39 char *inputfile = NULL;
44 while ((ret = options ("8vh", argv, argc, &arg)) != -2)
52 logf (LOG_FATAL, "too many files specified\n");
58 log_init (log_mask_str(arg), prog, NULL);
62 fprintf (stderr, "usage:\n"
63 " %s [-8] [-h] [-v n] [file]\n", prog);
70 logf (LOG_FATAL, "Unknown option '-%s'", arg);
76 ipf = fopen (inputfile, "r");
79 logf (LOG_FATAL|LOG_ERRNO, "cannot open '%s'", inputfile);
83 while (fgets (ipf_buf, 1023, ipf))
85 char *ipf_ptr = ipf_buf;
86 for (;*ipf_ptr && *ipf_ptr != '\n';ipf_ptr++)
88 if ((use8 && *ipf_ptr<0)
89 || (*ipf_ptr > 0 && isalpha(*ipf_ptr))
93 while (ipf_ptr[i] && ((use8 && ipf_ptr[i] < 0)
94 || (ipf_ptr[i]>0 && isalnum(ipf_ptr[i]))
95 || ipf_ptr[i] == '_'))
99 printf ("%s\n", ipf_ptr);