diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -21,6 +21,18 @@ #include "version.h" #include "wm.h" +static void path_normalize(char *path) +{ + if (path == NULL) + return; + + size_t len = strlen(path); + while (len > 1 && path[len - 1] == '/') { + path[len - 1] = '\0'; + len--; + } +} + int main(int argc, char **argv) { if (argc > 1 && @@ -50,6 +62,7 @@ int main(int argc, char **argv) snprintf(f->cwd, sizeof(f->cwd), "%s", argv[1]); log_write(LOG_INFO, "f->cwd = %s", f->cwd); log_write(LOG_INFO, "argv[1] = %s", argv[1]); + path_normalize(f->cwd); } else { fm_getcwd(f); } |
