1: #
2: char *sccsid = "@(#)mknod.c 2.3";
3:
4: main(argc, argv)
5: int argc;
6: char **argv;
7: {
8: int m, a, b;
9:
10: if(argc != 5) {
11: printf("arg count\n");
12: goto usage;
13: }
14: if(*argv[2] == 'b')
15: m = 060666; else
16: if(*argv[2] == 'c')
17: m = 020666; else
18: goto usage;
19: a = number(argv[3]);
20: if(a < 0)
21: goto usage;
22: b = number(argv[4]);
23: if(b < 0)
24: goto usage;
25: if(mknod(argv[1], m, (a<<8)|b) < 0)
26: perror("mknod");
27: exit(0);
28:
29: usage:
30: printf("usage: mknod name b/c major minor\n");
31: }
32:
33: number(s)
34: char *s;
35: {
36: int n, c;
37:
38: n = 0;
39: while(c = *s++) {
40: if(c<'0' || c>'9')
41: return(-1);
42: n = n*10 + c-'0';
43: }
44: return(n);
45: }
Defined functions
main
defined in line
4;
never used
Defined variables
sccsid
defined in line
2;
never used