diff options
Diffstat (limited to 'coreutils/basename.c')
-rw-r--r-- | coreutils/basename.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/coreutils/basename.c b/coreutils/basename.c index ac371d2..fa15aa9 100644 --- a/coreutils/basename.c +++ b/coreutils/basename.c @@ -43,14 +43,7 @@ extern int basename_main(int argc, char **argv) argv++; - s1=*argv+strlen(*argv)-1; - while (s1 && *s1 == '/') { - *s1 = '\0'; - s1--; - } - s = strrchr(*argv, '/'); - if (s==NULL) s=*argv; - else s++; + s = get_last_path_component(*argv); if (argc>2) { argv++; @@ -62,4 +55,3 @@ extern int basename_main(int argc, char **argv) printf("%s\n", s); return(TRUE); } - |