look.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
/*
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
* All Rights Reserved.
*/
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int fold;
int dict;
int tab;
#define WORDSIZE 257
char **argv;
{
register c;
for(;;) {
switch(*++argv[1]) {
case 'd':
dict++;
continue;
case 'f':
fold++;
continue;
case 't':
if(tab)
++argv[1];
continue;
case 0:
break;
default:
continue;
}
break;
}
argc --;
argv++;
}
if(argc<=1)
return;
if(argc==2) {
fold++;
dict++;
} else
exit(2);
}
*++ptr = '\0';
}
}
bot = 0;
for(;;) {
do {
mid++;
} while(c!=EOF && c!='\n');
break;
case -2:
case -1:
case 0:
break;
continue;
case 1:
case 2:
continue;
}
break;
}
return;
case -2:
return;
case -1:
case 0:
break;
case 1:
case 2:
continue;
}
break;
}
case -1:
case 0:
continue;
}
break;
}
exit(0);
}
compare(s,t)
register char *s,*t;
{
for(;*s==*t;s++,t++)
if(*s==0)
return(0);
return(*s==0? -1:
*t==0? 1:
*s<*t? -2:
2);
}
getword(w)
register char *w;
{
register c;
while(avail--) {
if(c==EOF)
return(0);
if(c=='\n')
break;
*w++ = c;
}
while (c != '\n')
*w = 0;
return(1);
}
{
register c;
for(;;) {
if(c==0) {
*new = 0;
break;
}
if(dict) {
if(!isalnum(c))
continue;
}
if(fold) {
if(isupper(c))
}
new++;
avail--;
if (avail <= 0) {
*new = 0;
break;
}
}
}