home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume24
/
mkid2
/
part01
/
idx.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-09
|
1KB
|
80 lines
static char copyright[] = "@(#)Copyright (c) 1986, Greg McGary";
static char sccsid[] = "@(#)idx.c 1.2 86/10/17";
#include <stdio.h>
#include <string.h>
#include <id.h>
#include <extern.h>
void idxtract();
char *MyName;
static void
usage()
{
fprintf(stderr, "Usage: %s [-u] [+/-a<ccc>] [-c<ccc>] files\n", MyName);
exit(1);
}
main(argc, argv)
int argc;
char **argv;
{
char *arg;
int op;
char *sccsDir = NULL;
char *rcsDir = NULL;
MyName = basename(GETARG(argc, argv));
while (argc) {
arg = GETARG(argc, argv);
switch (op = *arg++)
{
case '-':
case '+':
break;
default:
UNGETARG(argc, argv);
goto argsdone;
}
switch (*arg++)
{
case 's': sccsDir = arg; break;
case 'r': rcsDir = arg; break;
case 'S': setScanArgs(op, arg); break;
default: usage();
}
}
argsdone:
if (argc == 0)
usage();
while (argc)
idxtract(GETARG(argc, argv), sccsDir, rcsDir);
exit(0);
}
void
idxtract(path, sccsDir, rcsDir)
char *path;
char *sccsDir;
char *rcsDir;
{
register char *key;
register char *(*getId)();
register FILE *srcFILE;
char *(*getScanner())();
int flags;
char *suffix;
char *filter;
if ((getId = getScanner(getLanguage(suffix=strrchr(path, '.')))) == NULL)
return;
if ((srcFILE = openSrcFILE(path, sccsDir, rcsDir, filter=getFilter(suffix))) == NULL)
return;
while ((key = (*getId)(srcFILE, &flags)) != NULL)
puts(key);
closeSrcFILE(srcFILE, filter);
}