Annotation of 41BSD/4.0.upgrade/sys/conf/touch.c, revision 1.1

1.1     ! root        1: #include <sys/types.h>
        !             2: #include <sys/stat.h>
        !             3: main(argc, argv)
        !             4:        int argc;
        !             5:        char **argv;
        !             6: {
        !             7: 
        !             8:        argc--, argv++;
        !             9:        while (argc > 0) {
        !            10:                struct stat stb; int c, f;
        !            11:                if (stat(*argv, &stb) < 0)
        !            12:                        goto bad;
        !            13:                if (chmod(*argv, stb.st_mode | 0200) < 0)
        !            14:                        goto bad;
        !            15:                f = open(*argv, 2);
        !            16:                if (f < 0)
        !            17:                        goto bad;
        !            18:                lseek(f, 0, 0);
        !            19:                read(f, &c, 1);
        !            20:                lseek(f, 0, 0);
        !            21:                write(f, &c, 1);
        !            22:                close(f);
        !            23:                chmod(*argv, stb.st_mode);
        !            24:                argc--, argv++;
        !            25:                continue;
        !            26: bad:
        !            27:                perror(*argv);
        !            28:                argc--, argv++;
        !            29:                continue;
        !            30:        }
        !            31: }

unix.superglobalmegacorp.com

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