This is webster.c in view mode; [Download] [Up]
#include "text/webster.h"
void
main(argc,argv)
int argc;
char *argv[]; {
ReferenceBook *book;
Definition *d;
int exact = 1;
int i;
if(argc==1) {
printf("commandline webster USAGE: %s [-variant] arg [arg...]\n",argv[0]);
exit(1);
}
i=1;
if(strcmp(argv[1],"-variant")==0) {
exact=0;
i++;
}
book = referenceOpen("Webster-Dictionary");
dictionaryFoldSenses = 79; /* fold output lines to 80 chars */
while(argc>i)
if (d = getDefinition(argv[i], book, exact))
{
printf("\nMerriam-Webster database for \"%s\":\n\n",argv[i]);
do {
putDefinition(d, 0);
printf("\n");
if(d->picture!=NULL) {
if(strcmp(d->picture+strlen(d->picture)-5,".tiff")==0)
printf("There is a Tiff-Picture available for %s.\n",argv[i]);
else
if(strcmp(d->picture+strlen(d->picture)-3,".ps")==0)
printf("There is a Postscript-Picture available for %s.\n",argv[i]);
else
if(strcmp(d->picture+strlen(d->picture)-4,".eps")==0)
printf("There is a Encapsulated-Postscript-Picture available for %s.\n",argv[i]);
else printf("There is a Picture available for %s.\n",argv[i]);
printf("Review:%s\n\n", d->picture);
}
freeDefinition(d);
} while ((d=getNextDefinition(argv[i], book, exact))!=NULL);
argv[i++];
}
else
{ printf("Merriam-Webster database for %s:\n",argv[i++]);
printf("Sorry, no entry...\n");
}
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.