1: /*
2: ** basename.c
3: **
4: ** return the last portion of a path name.
5: ** included by all the cxref component programs.
6: **
7: ** Arnold Robbins, Information and Computer Science, Georgia Tech
8: ** gatech!arnold
9: ** Copyright (c) 1984 by Arnold Robbins.
10: ** All rights reserved.
11: ** This program may not be sold, but may be distributed
12: ** provided this header is included.
13: */
14:
15: char *basename(str) /* return last portion of a path name */
16: char *str;
17: {
18: char *cp, *rindex(); /* change to strrchr() for USG systems */
19:
20: if((cp = rindex(str, '/')) == NULL)
21: return(str);
22: else
23: return(++cp);
24: }
Defined functions
Usage of this include