Annotation of coherent/d/usr/src/examples/rindex.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: #define PATHSEP '/'    /* path name separator */
        !             3: 
        !             4: extern char *rindex();
        !             5: char *basename();
        !             6: 
        !             7: main()
        !             8: {
        !             9:        char *testpath = "/foo/bar/baz"; 
        !            10: 
        !            11:        printf("Before massaging: %s\n", testpath);
        !            12:        printf("After massaging: %s\n", basename(testpath));
        !            13: }
        !            14: 
        !            15: char *basename(path)
        !            16: char *path;
        !            17: {
        !            18:        char *cp;
        !            19:        return (((cp = rindex(path, PATHSEP)) == NULL)
        !            20:                 ? path : ++cp);
        !            21: }
        !            22: 

unix.superglobalmegacorp.com

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