1 /* Names v2.01 Copyright 1995 by Michael Harvey */
19 printf("Names version %s\n",VERSION
);
21 puts("Permission granted for unrestricted noncommercial use.");
24 int main(int argc
, char ** argv
)
41 while ((c
= getopt(argc
,argv
,"acCdDf:Fhlpsv")) != -1)
63 strcpy(outfile
,optarg
);
90 printf("usage: %s [-acCdFhlpsv] [-f outfile] [infile...]\n", argv
[0]);
91 puts(" -a suppress ansi control codes");
92 puts(" -c suppress capitalization");
93 puts(" -C force capitalization");
94 puts(" (default is selective capitalization)");
95 puts(" -d debug (-D full debug)");
96 printf(" -f file specify output file, default \"%s\"\n",OUTFILE
);
97 puts(" -F forever (default when reading from pipe)");
99 puts(" -l convert all data to lowercase");
100 puts(" -p suppress pluralization");
101 puts(" -s simple output");
102 puts(" -v version info");
106 /* read data files */
109 dprint("Reading from stdin:\n");
115 p
= getenv("ELE_DIR");
121 while (optind
< argc
)
123 dprint("READING [%d] '%s'\n",optind
,argv
[optind
]);
125 strcpy(path
,argv
[optind
]);
126 if ((f
= fopen(path
,"r")) != NULL
) goto okay
;
129 if ((f
= fopen(path
,"r")) != NULL
) goto okay
;
133 if (*s
!= '/') strcat(path
,"/");
134 strcat(path
,argv
[optind
]);
135 if ((f
= fopen(path
,"r")) != NULL
) goto okay
;
147 error
: fprintf(stderr
,"Unable to read %s\n",path
);
152 dprint5("DICTIONARY:\n");
153 for (c
=0; c
<NONE
; c
++)
157 dprint5("[%d] %d\n",c
,siz
[c
]);
158 for (i
=0; i
<siz
[c
]; i
++)
160 dprint5(" data[%2d][%d]=\"%s\"\n", c
,i
,data
[c
][i
]);
161 if (strlen(data
[c
][i
])==0)
162 dprint("---------> data[%2d][%d]=\"%s\"\n",