1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #ifndef lint
8: char copyright[] =
9: "@(#) Copyright (c) 1980 Regents of the University of California.\n\
10: All rights reserved.\n";
11: #endif not lint
12:
13: #ifndef lint
14: static char sccsid[] = "@(#)biff.c 5.1 (Berkeley) 5/31/85";
15: #endif not lint
16:
17: /*
18: * biff
19: */
20:
21: #include <sys/types.h>
22: #include <sys/stat.h>
23: #include <stdio.h>
24:
25: char *ttyname();
26:
27: main(argc, argv)
28: int argc;
29: char **argv;
30: {
31: char *cp = ttyname(2);
32: struct stat stb;
33:
34: argc--, argv++;
35: if (cp == 0)
36: fprintf(stderr, "Where are you?\n"), exit(1);
37: if (stat(cp, &stb) < 0)
38: perror(cp), exit(1);
39: if (argc == 0) {
40: printf("is %s\n", stb.st_mode&0100 ? "y" : "n");
41: exit((stb.st_mode&0100) ? 0 : 1);
42: }
43: switch (argv[0][0]) {
44:
45: case 'y':
46: if (chmod(cp, stb.st_mode|0100) < 0)
47: perror(cp);
48: break;
49:
50: case 'n':
51: if (chmod(cp, stb.st_mode&~0100) < 0)
52: perror(cp);
53: break;
54:
55: default:
56: fprintf(stderr, "usage: biff [y] [n]\n");
57: }
58: exit((stb.st_mode&0100) ? 0 : 1);
59: }
Defined functions
main
defined in line
27;
never used
Defined variables