fs.c: replaces rindex with strrchr
parent
f4ef46aa6c
commit
71eb8b3f61
4
src/fs.c
4
src/fs.c
|
@ -1,4 +1,4 @@
|
||||||
#include <strings.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
// error_message_format
|
// error_message_format
|
||||||
|
@ -46,7 +46,7 @@ int dirname_ (const char *path, char *dname)
|
||||||
{
|
{
|
||||||
assert (dname != NULL);
|
assert (dname != NULL);
|
||||||
|
|
||||||
char *last_slash = rindex (path, '/');
|
char *last_slash = strrchr (path, '/');
|
||||||
int pathlen = last_slash - path;
|
int pathlen = last_slash - path;
|
||||||
|
|
||||||
snprintf (dname, pathlen + 1, "%s", path);
|
snprintf (dname, pathlen + 1, "%s", path);
|
||||||
|
|
Reference in New Issue