]> www.infradead.org Git - users/rw/ppcboot.git/commitdiff
Allow to use '\' to escape control characters (';' and '$') while
authorwdenk <wdenk>
Wed, 1 Nov 2000 10:49:44 +0000 (10:49 +0000)
committerwdenk <wdenk>
Wed, 1 Nov 2000 10:49:44 +0000 (10:49 +0000)
parsing input - needed to be able to enter a `bootcmd' which
contains more than one command and/or references to variables.

CHANGELOG
README
common/main.c
include/config_TQM850L.h

index 345c2b0fa9d5dafbd8a7bd96049d5c8f7da7c013..0909c4e3d1f09044158cf990ec7912ff1815273e 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -56,6 +56,11 @@ To do:
 Modifications since 0.6.0:
 ======================================================================
 
+* Allow to use '\' to escape control characters (';' and '$') while
+  parsing input - needed to be able to enter a `bootcmd' which
+  contains more than one command and/or references to variables,
+  which are resolved not before when running the command.
+
 * MBX8xx support (thanks to Marius Gröger)
 
 * Fix violation of BOOTP message format.
diff --git a/README b/README
index 821f4fb3942fca2f5a4fadd9a2b4cf74c86867ce..a1f77fc5d8bcdf7f145b39f540ef2caf579ee7be 100644 (file)
--- a/README
+++ b/README
@@ -76,6 +76,7 @@ Directory Hierarchy:
 - cogent       Files specific to Cogent   boards
                (need further configuration)
 - fads         Files specific to Motorola FADS boards
+- mbx8xx       Files specific to Motorola MBX  boards
 
 
 Software Configuration:
@@ -139,9 +140,9 @@ The following options need to be configured:
                CONFIG_TQM823L, CONFIG_TQM850L, CONFIG_TQM855L,
                CONFIG_TQM860L, CONFIG_ETX094,  CONFIG_ADCIOP,
                CONFIG_CPCI405, CONFIG_COGENT,  CONFIG_FADS,
-               CONFIG_SPD823TS,CONFIG_FPS850L
+               CONFIG_SPD823TS,CONFIG_FPS850L, CONFIG_MBX
 --- FIXME --- not tested yet:
-               CONFIG_TQM860,  CONFIG_MBX,     CONFIG_ADS,
+               CONFIG_TQM860,  CONFIG_ADS,
                CONFIG_RPXLITE, CONFIG_RPXCLASSIC, CONFIG_BSEIP
 
 
@@ -379,6 +380,7 @@ configurations; the following names are suported:
        FADS850SAR_config
        SPD823TS_config
        cogent_mpc8xx_config
+       MBX_config
 
 
 If the system board that you have is not listed, then you will need
index 53ae69013fae0215b1fc5e566a38dea38073e8d2..b7ac76cdd795c113cedd2c993cb23e8777d68b07 100644 (file)
@@ -253,7 +253,7 @@ int parse_line (char *line, char *argv[])
 
 static void process_macros (char *input, char *output)
 {
-       char c, *varname_start;
+       char c, prev, *varname_start;
        int inputcnt  = strlen (input);
        int outputcnt = CFG_CBSIZE;
        int state = 0;  /* 0 = waiting for '$'  */
@@ -266,13 +266,23 @@ static void process_macros (char *input, char *output)
        printf ("[PROCESS_MACROS] INPUT=%s\n", input);
 #endif
 
+       prev = '\0';                    /* previous character   */
+
        while (inputcnt && outputcnt) {
            c = *input++;
            inputcnt--;
 
+           /* remove one level of escape characters */
+           if ((c == '\\') && (prev != '\\')) {
+               if (inputcnt-- == 0)
+                       break;
+               prev = c;
+               c = *input++;
+           }
+
            switch (state) {
-           case 0:                     /* Waiting for $        */
-               if (c == '$') {
+           case 0:                     /* Waiting for (unescaped) $    */
+               if ((c == '$') && (prev != '\\')) {
                        state++;
                } else {
                        *(output++) = c;
@@ -320,6 +330,8 @@ static void process_macros (char *input, char *output)
                }
                break;
            }
+
+           prev = c;
        }
 
        if (outputcnt)
@@ -353,19 +365,29 @@ static int process_separators (char *s, int len,
                char *sep;
                char *t;
 
-               /* find separator, or string end */
+               /*
+                * Find separator, or string end
+                * Allow simple escape of ';' by writing "\;"
+                */
                for (sep = str; *sep; sep++) {
-                       if (*sep == ';')
+                       if ((*sep == ';') &&    /* separator            */
+                           ( sep != str) &&    /* past string start    */
+                           (*(sep-1) != '\\')) /* and NOT escaped      */
                                break;
                }
 
-               /* extract the token between separators */
+               /*
+                * Extract the token between separators
+                */
                for (t = token; str < sep;) {
                        *t++ = *str++;
                        if (t >= token + CFG_CBSIZE - 1)
                                break;                  /* just in case */
                }
                *t = '\0';
+#ifdef DEBUG_PARSER
+               printf ("token: \"%s\"\n", token);
+#endif
 
                /* Process macros into this token and replace them */
                process_macros (token, finaltoken);
index 3a074645a4ecce4585bfb5265d992c929639a7b5..35a26840ac3e17adc41c0180e4aa3237b8e223c3 100644 (file)
@@ -49,7 +49,7 @@
 #undef CONFIG_BOOTARGS 
 #define CONFIG_BOOTCOMMAND                                                     \
        "bootp; "                                                               \
-       "setenv bootargs root=/dev/nfs nfsroot=$(serverip):$(rootpath) "        \
+       "setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) "     \
        "ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off; "   \
        "bootm"