aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/main.c b/main.c
index ee7a199..550cb40 100644
--- a/main.c
+++ b/main.c
@@ -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);
}