Annotation of 42BSD/ucb/biff.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char *sccsid ="@(#)biff.c       4.2 (Berkeley) 7/2/83";
                      3: #endif
                      4: /*
                      5:  * biff
                      6:  */
                      7: 
                      8: #include <sys/types.h>
                      9: #include <sys/stat.h>
                     10: #include <stdio.h>
                     11: 
                     12: char   *ttyname();
                     13: 
                     14: main(argc, argv)
                     15:        int argc;
                     16:        char **argv;
                     17: {
                     18:        char *cp = ttyname(2);
                     19:        struct stat stb;
                     20: 
                     21:        argc--, argv++;
                     22:        if (cp == 0)
                     23:                fprintf(stderr, "Where are you?\n"), exit(1);
                     24:        if (stat(cp, &stb) < 0)
                     25:                perror(cp), exit(1);
                     26:        if (argc == 0) {
                     27:                printf("is %s\n", stb.st_mode&0100 ? "y" : "n");
                     28:                exit((stb.st_mode&0100) ? 0 : 1);
                     29:        }
                     30:        switch (argv[0][0]) {
                     31: 
                     32:        case 'y':
                     33:                if (chmod(cp, stb.st_mode|0100) < 0)
                     34:                        perror(cp);
                     35:                break;
                     36: 
                     37:        case 'n':
                     38:                if (chmod(cp, stb.st_mode&~0100) < 0)
                     39:                        perror(cp);
                     40:                break;
                     41: 
                     42:        default:
                     43:                fprintf(stderr, "usage: biff [y] [n]\n");
                     44:        }
                     45:        exit((stb.st_mode&0100) ? 0 : 1);
                     46: }

unix.superglobalmegacorp.com

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