2019-08-09 16:12:19 -04:00
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2019-08-13 18:15:29 -04:00
|
|
|
#include "os.h"
|
2019-08-09 16:12:19 -04:00
|
|
|
|
|
|
|
void path_to_dirname(char *path)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
if (!(p = strrchr(path, '/'))) {
|
|
|
|
p = path;
|
|
|
|
}
|
|
|
|
*p = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
void get_cwd(char *buf, size_t size) { getcwd(buf, size); }
|
|
|
|
|
|
|
|
int set_cwd(char *buf)
|
|
|
|
{
|
|
|
|
if (chdir(buf) == -1)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|