CVS: libraries/commandline tabcomplete.c,1.2,1.3

Chris Liechti <[email protected]> Wed, 11 Oct 2006 13:45:57 -0700
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.cvs
Message-ID <[email protected]>
Update of /cvsroot/mspgcc/libraries/commandline
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28929/libraries/commandline

Modified Files:
	tabcomplete.c 
Log Message:
- support for separator entries in command list
- switch to case insensitive string compares

Index: tabcomplete.c
===================================================================
RCS file: /cvsroot/mspgcc/libraries/commandline/tabcomplete.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- tabcomplete.c	11 Oct 2006 18:47:28 -0000	1.2
+++ tabcomplete.c	11 Oct 2006 20:45:55 -0000	1.3
@@ -24,7 +24,7 @@
                 append_space = true;
             } else {
                 // n'th match, find shortest common part
-                while (length && strncmp(match->name, entry->name, length) != 0) {
+                while (length && strncasecmp(match->name, entry->name, length) != 0) {
                     length--;
                 }
                 append_space = false;
@@ -49,7 +49,8 @@
         // print a list of possible values, then print the prompt and command line again
         printf("\n");
         for (const COMMANDLINE_TABLE *entry=commandline_table; entry->name; entry++) {
-            if (strncmp(lineeditor->line, entry->name, lineeditor->position) == 0) {
+            // if its not a separator and the first characters match...
+            if (entry->name[0] != '\0' && strncasecmp(lineeditor->line, entry->name, lineeditor->position) == 0) {
                 printf("%s ", entry->name);
             }
         }


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642