Annotation of 43BSDReno/share/man/tools/noso.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: #include <sys/types.h>
        !             3: #include <sys/stat.h>
        !             4: #include <sys/file.h>
        !             5: 
        !             6: main(argc, argv)
        !             7:        char *argv[];
        !             8: {
        !             9:        struct stat sb;
        !            10:        register char *cp;
        !            11:        int i, fd, count = 0;
        !            12:        char buf[10];
        !            13: 
        !            14:        for (cp = "", i = 1; i < argc; cp = " ", i++) {
        !            15:                if (lstat(argv[i], &sb) < 0)
        !            16:                        continue;
        !            17:                if ((sb.st_mode & S_IFMT) != S_IFREG)
        !            18:                        continue;
        !            19:                fd = open(argv[i], O_RDONLY);
        !            20:                if (fd < 0) {
        !            21:                        perror(argv[i]);
        !            22:                        continue;
        !            23:                }
        !            24:                if (read(fd, buf, 3) != 3) {
        !            25:                        close(fd);
        !            26:                        continue;
        !            27:                }
        !            28:                if (strncmp(buf, ".so", 3))
        !            29:                        count++, printf("%s%s", cp, argv[i]);
        !            30:                close(fd);
        !            31:        }
        !            32:        if (count > 0)
        !            33:                putchar('\n');
        !            34: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.