1: static char *sccsid = "@(#)basename.c	4.2 (Berkeley) 10/20/82";
   2: 
   3: #include    <stdio.h>
   4: 
   5: main(argc, argv)
   6: char **argv;
   7: {
   8:     register char *p1, *p2, *p3;
   9: 
  10:     if (argc < 2) {
  11:         putchar('\n');
  12:         exit(1);
  13:     }
  14:     p1 = argv[1];
  15:     p2 = p1;
  16:     while (*p1) {
  17:         if (*p1++ == '/')
  18:             p2 = p1;
  19:     }
  20:     if (argc>2) {
  21:         for(p3=argv[2]; *p3; p3++)
  22:             ;
  23:         while(p1>p2 && p3>argv[2])
  24:             if(*--p3 != *--p1)
  25:                 goto output;
  26:         *p1 = '\0';
  27:     }
  28: output:
  29:     puts(p2, stdout);
  30:     exit(0);
  31: }

Defined functions

main defined in line 5; never used

Defined variables

sccsid defined in line 1; never used
Last modified: 1982-10-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 798
Valid CSS Valid XHTML 1.0 Strict