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
number defined in line 33; used 2 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 661
Valid CSS Valid XHTML 1.0 Strict