1: #
   2: /*
   3:  * ln target [ new name ]
   4:  */
   5: 
   6: struct ibuf {
   7:     int inum;
   8:     int iflags;
   9:     char    inl;
  10:     char    iuid;
  11:     int isize;
  12:     int iaddr[8];
  13:     char    *ictime[2];
  14:     char    *imtime[2];
  15:     int fill;
  16: };
  17: 
  18: #define DIR 040000
  19: #define FMT 060000
  20: 
  21: main(argc, argv)
  22: char **argv;
  23: {
  24:     static struct ibuf statb;
  25:     register char *np;
  26: 
  27:     if (argc<2) {
  28:         write(1, "Usage: ln target [ newname ]\n", 29);
  29:         exit(1);
  30:     }
  31:     if (argc==2) {
  32:         np = argv[1];
  33:         while(*np++);
  34:         while (*--np!='/' && np>argv[1]);
  35:         np++;
  36:         argv[2] = np;
  37:     }
  38:     stat(argv[1], &statb);
  39:     if ((statb.iflags&FMT) == DIR) {
  40:         write(1, "No directory link\n", 18);
  41:         exit(1);
  42:     }
  43:     if (link(argv[1], argv[2])<0) {
  44:         write(1, "Can't link\n", 11);
  45:         exit(1);
  46:     }
  47:     exit(0);
  48: }

Defined functions

main defined in line 21; never used

Defined struct's

ibuf defined in line 6; used 2 times
  • in line 24(2)

Defined macros

DIR defined in line 18; used 1 times
  • in line 39
FMT defined in line 19; used 1 times
  • in line 39
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 687
Valid CSS Valid XHTML 1.0 Strict