This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Redboot parser


On Thu, 2001-10-18 at 15:53, Jordi Colomer wrote:
> 
> Hi, all.
> 
> When I try to define an alias in the redboot command line,
> which has quotes embedded in it, the parser reports an
> "unbalanced string" error. For instance :
> 
> RedBoot> alias ek "exec -b 0x100000 -l 0xc0000 -c \"noinitrd
> root=/dev/mtdblock2\""
> 
> If I am not wrong, the escaped quotes were accepted in
> previous versions. Does anyone know if this syntax is correct?
> In case it is, perhaps I could have a look at the parser code
> and see what happens.

Indeed it is supposed to work.  Somehow it got broken with a
change we made in how the '$' (GDB escape) is handled.

This patch will fix it:

Index: redboot/current/src/io.c
===================================================================
RCS file: /home/cvs/ecc/ecc/redboot/current/src/io.c,v
retrieving revision 1.37
diff -u -5 -p -r1.37 io.c
--- redboot/current/src/io.c	15 Oct 2001 23:49:37 -0000	1.37
+++ redboot/current/src/io.c	18 Oct 2001 07:18:18 -0000
@@ -348,27 +348,21 @@ _rb_gets(char *buf, int buflen, int time
                     mon_write_char('\b');
                 }
                 ptr--;
             }
             break;
-        case '\\':                 // escape character
-            if (console_echo) {
-                mon_write_char(c);
-            }
-            if (last_ch != '\\') // if last was also an escape, 
-                break;             // don't add to buffer, just move on
-            *ptr++ = c;
-            c = '\0';    // cheat so that the "shift" state resets
-            break;
 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
         case '+': // fall through
         case '$':
             if (ptr == buf || last_ch != '\\')
             {
                 // Give up and try GDB protocol
                 ungetDebugChar(c);  // Push back character so stubs will see it
                 return _GETS_GDB;
+            }
+            if (last_ch == '\\') {
+                ptr--;  // Save \$ as $
             }
             // else fall through
 #endif
         default:
             if (console_echo) {



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]