poldek: poldek/cli/shell.c - preserve trailing whitespaces in hist...

mis mis at pld-linux.org
Thu May 11 11:51:58 CEST 2006


Author: mis                          Date: Thu May 11 09:51:58 2006 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- preserve trailing whitespaces in history (#5777)

---- Files affected:
poldek/poldek/cli:
   shell.c (1.28 -> 1.29) 

---- Diffs:

================================================================
Index: poldek/poldek/cli/shell.c
diff -u poldek/poldek/cli/shell.c:1.28 poldek/poldek/cli/shell.c:1.29
--- poldek/poldek/cli/shell.c:1.28	Sat Jan  7 02:06:48 2006
+++ poldek/poldek/cli/shell.c	Thu May 11 11:51:53 2006
@@ -356,22 +356,34 @@
         snprintf(prompt, sizeof(prompt), "poldek:%s%s> ",
                  currdir == NULL ? "/" : *currdir->name == '/' ? "" : "/",
                  currdir == NULL ? "" : currdir->name);
+
         if ((line = readline(prompt)) == NULL)
             break;
 
+        /* add to history? */
+        s = line;
+        while (isspace(*s))
+            s++;
+        
+        if (*s)
+            add_history(line);
+                
         s = n_str_strip_ws(line);
         if (*s) {
             int _verbose = poldek_verbose();
-            add_history(s);
-            //print_mem_info("BEFORE");
+            
             shInCmd = 1;
             DBGF("(%s)\n", s);
+
+            MEMINF("BEFORE %s\n", s);
             poclidek_execline(cctx, NULL, s);
+            MEMINF("AFTER  %s\n", s);
+            
             sigint_reset();
             shDone = 0;
             shInCmd = 0;
+
             poldek_set_verbose(_verbose);
-            //print_mem_info("AFTER ");
         }
         free(line);
         
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/poldek/poldek/cli/shell.c?r1=1.28&r2=1.29&f=u



More information about the pld-cvs-commit mailing list