Annotation of researchv10no/cmd/basename.c, revision 1.1

1.1     ! root        1: main(argc,argv)
        !             2: char **argv;
        !             3: {
        !             4:        char *p, *q;
        !             5:        if(argc < 2) {
        !             6:                printf("\n");
        !             7:                return 0;
        !             8:        }
        !             9:        for(p = argv[1]; *p; ) 
        !            10:                if(*p++ == '/')
        !            11:                        argv[1] = p;
        !            12:        if(argc > 2) {
        !            13:                for(q = argv[2]; *q; q++) ;
        !            14:                while(--q>=argv[2] && --p>=argv[1] && *p==*q) ;
        !            15:                if(q < argv[2])
        !            16:                        *p = 0;
        !            17:        }
        !            18:        printf("%s\n", argv[1]);
        !            19:        return 0;
        !            20: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.