#include <string.h>
#include <libgen.h>
Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| char * | basename (char *path) |
| Return base name from path. | |
| char * | dirname (char *path) |
| Return directory name from path. | |
Definition in file basename.c.
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| char* basename | ( | char * | path | ) |
Return base name from path.
| path | Full path |
| basename | Base name |
Definition at line 37 of file basename.c.
References basename(), and strrchr().
Referenced by basename(), image_set_uri(), and imgfetch_core_exec().
00037 { 00038 char *basename; 00039 00040 basename = strrchr ( path, '/' ); 00041 return ( basename ? ( basename + 1 ) : path ); 00042 }
| char* dirname | ( | char * | path | ) |
Return directory name from path.
| path | Full path |
| dirname | Directory name |
Definition at line 52 of file basename.c.
References strrchr().
Referenced by resolve_path().
00052 { 00053 char *separator; 00054 00055 separator = strrchr ( path, '/' ); 00056 if ( separator == path ) { 00057 return "/"; 00058 } else if ( separator ) { 00059 *separator = 0; 00060 return path; 00061 } else { 00062 return "."; 00063 } 00064 }
1.5.7.1