home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * UIDENT.C
- *
- * $Header: Beta:src/uucp/src/GUtil/RCS/uident.c,v 1.1 90/02/02 11:58:56 dillon Exp Locker: dillon $
- *
- * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved.
- *
- * UIDENT files...
- *
- * Searches for @($) <string> \0 and prints out
- */
-
- #include <stdio.h>
- #include <fcntl.h>
- #include "version.h"
-
- IDENT(".02");
-
- void FindIdent(char *, int);
-
- char Buf[8192];
-
- void
- main(ac, av)
- char **av;
- {
- short i;
- int fd;
-
- for (i = 1; i < ac; ++i) {
- fd = open(av[i], O_RDONLY);
- if (fd > 0)
- FindIdent(av[i], fd);
- else
- printf("%-15s (unable to open)", av[i]);
- puts("");
- fflush(stdout);
- if (fd > 0)
- close(fd);
- }
- }
-
- void
- FindIdent(file, fd)
- char *file;
- int fd;
- {
- long n;
- long i;
- long x = 0;
-
- while ((n = read(fd, Buf + x, sizeof(Buf) - x)) > 0) {
- n += x;
- for (i = n - 128; i >= 0; --i) {
- if (Buf[i] == '@' && Buf[i+1] == '(' && Buf[i+2] == '$' && Buf[i+3] == ')') {
- printf("%-15s %s\n", file, Buf + i);
- }
- }
- x = 128;
- if (n < x)
- x = n;
- movmem(Buf + n - x, Buf, x);
- }
- }
-
-