Revision 7159,
577 bytes
checked in by miki, 31 years ago
(diff) |
replaced rindex with strchr
|
-
Property svn:executable set to
*
|
Line | |
---|
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, *strrchr(); /* change to strrchr() for USG systems */ |
---|
19 | |
---|
20 | if((cp = strrchr(str, '/')) == NULL) |
---|
21 | return(str); |
---|
22 | else |
---|
23 | return(++cp); |
---|
24 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.