summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2022-08-08 22:11:42 +0200
committerHelge Deller <deller@gmx.de>2022-08-08 22:11:42 +0200
commit8c689011791f0795bac0aa3e930f47b20247b9f3 (patch)
tree8ebbfb7320fb26d6efdfc90b6dbeed59083fcf40
parent587814cddebceffc387cef6058330b6b9d0ff3f1 (diff)
downloadpalo-8c689011791f0795bac0aa3e930f47b20247b9f3.tar.gz
ipl: Add trailing "/" when listing directories
If user runs "ls 6/var", then he actually wants the contents of directory /var. Add a trailing slash to make this happen. Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r--ipl/ipl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ipl/ipl.c b/ipl/ipl.c
index b69cfb6..22abca6 100644
--- a/ipl/ipl.c
+++ b/ipl/ipl.c
@@ -426,9 +426,13 @@ interact(int *ok)
if (numbuf[0] == 'l')
{
join(commandline, argc, argv, ok);
- if (numbuf[1] == ' ')
+ if (numbuf[1] == ' ') {
+ /* add trailing slash */
+ p = strrchr(numbuf, '/');
+ if (p && p[1] != 0)
+ strcat(numbuf, "/");
ls(&numbuf[2]);
- else
+ } else
ls(argv[0]);
continue;
}