glue1.c revision 11a8fa6cb17403e630122ac19b39a323c6e64142
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
extern char refdir[];
int lmaster = 1000;
int reached = 0;
int colevel = 0;
static union firetruck {
unsigned *a;
long *b;
} master;
int iflong;
int prfreqs = 0;
int typeindex = 0;
char usedir[100];
static int full = 1000;
static int tags = 0;
int soutlen = 1000;
int taglen = 1000;
extern int baddrop();
extern int ckexist();
extern int doquery();
extern void err();
extern int getq();
extern void grepcall();
extern int makefgrep();
extern void restodir();
extern void result();
extern void savedir();
extern void *zalloc();
static int setfrom(char);
char *todir(char *);
void
{
/* read query from stdin, expect name of indexes in argv[1] */
char grepquery[200];
static char oldname[30];
static int nhash = 0;
static int maxhash = 0;
static long *hpt = 0;
unsigned *masterp;
#if D1
#endif
savedir();
#if D1
#endif
case 'a': /* all output, incl. false drops */
falseflg = 1;
break;
case 'r':
argc--;
argv++;
break;
case 'F': /* put out full text */
break;
case 'T': /* put out tags */
break;
case 'i': /* input in argument string */
argc--;
argv++;
break;
case 's': /* text output to string */
case 'o':
argc--;
argv++;
argc--;
argv++;
}
break;
case 't': /* tag output to string */
argc--;
argv++;
argc--;
argv++;
}
break;
case 'l': /* specify length of lists */
argc--;
argv++;
#if D1
#endif
break;
case 'C':
argc--;
argv++;
break;
}
argc--;
argv++;
}
#if D1
#endif
#if D1
#endif
typeindex = 1;
#if D1
#endif
if (hpt)
hpt = 0;
if (hfreq)
hfreq = 0;
#if D1
maxhash);
#endif
}
if (hpt == 0)
#if D1
#endif
/*
* TRANSLATION_NOTE
* %d is the size of the hash table - not
* very interesting info for the end users.
* Hash is a computer science terminology.
*/
nhash);
if (hfreq == 0)
/*
* TRANSLATION_NOTE
* %d is the size of the hash table.
*/
"No space for hash frequencies (%d)"),
nhash);
#if D1
#endif
if (iflong)
sizeof (long));
else
sizeof (int));
} else
typeindex = 2;
else {
exit(1);
}
}
if (iflong)
else
#if D1
#endif
tagout[0] = 0;
if (typeindex == 2) {
#if D1
#endif
restodir();
return;
}
#if D1
#endif
#ifdef D1
#endif
if (falseflg == 0)
#ifdef D1
#endif
if (tags)
#if D1
#endif
char **fgp;
int k;
#if D1
#endif
grepquery[0] = 0;
for (k = 0; k < nitem; k++) {
}
#if D1
#endif
#if D1
#endif
}
}
restodir();
}
char *
todir(char *t)
{
char *s;
usedir[0] = 0;
s = t;
while (*s) s++;
while (s >= t && *s != '/') s--;
if (s < t)
return (t);
*s++ = 0;
t = (*t ? t : "/");
chdir(t);
return (s);
}
static int
setfrom(char c)
{
switch (c) {
case 'y':
case '\0':
default:
return (1000);
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
return (c-'0');
case 'n':
case '0':
return (0);
}
}