If running ls without any arguments default to ls -C so that no newlines are added
authorRobert Pengelly <robertapengelly@hotmail.com>
Mon, 15 Sep 2025 05:25:01 +0000 (06:25 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Mon, 15 Sep 2025 05:25:01 +0000 (06:25 +0100)
xmake.c

diff --git a/xmake.c b/xmake.c
index 4b1d5af5d93da910b78ca1d1449319413dff7c65..e25b188aa85ba28a7e07246510eba3cbc6d3b7f1 100644 (file)
--- a/xmake.c
+++ b/xmake.c
@@ -447,6 +447,16 @@ static int pipe_command (const char *filename, unsigned long line_no, char *inpu
         argv[0] = prog;
         argv[argc] = 0;
         
+        if (strcmp (prog, "ls") == 0 && argc == 1) {
+        
+            argv = xrealloc (argv, sizeof (*argv) * 3);
+            argc = 2;
+            
+            argv[1] = "-C";
+            argv[2] = 0;
+        
+        }
+        
         dup2 (pipefd[1], STDOUT_FILENO);
         
         close (pipefd[0]);