OSSP CVS Repository

ossp - Check-in [1312]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1312
Date: 2001-Nov-13 14:29:50 (local)
2001-Nov-13 13:29:50 (UTC)
User:simons
Branch:
Comment: Changed the semantics of var_unescape(): It will only recognize a named character as being an octal if there are three digits following the backslash. Anything else will be interpreted as an ordinary quoted character that's copied verbatimly. Added a test case to verify that behavior.
Tickets:
Inspections:
Files:
ossp-pkg/var/var.c      1.4 -> 1.5     1 inserted, 10 deleted
ossp-pkg/var/var_test.c      1.3 -> 1.4     46 inserted, 45 deleted

ossp-pkg/var/var.c 1.4 -> 1.5

--- var.c        2001/11/13 13:25:18     1.4
+++ var.c        2001/11/13 13:29:50     1.5
@@ -364,16 +364,7 @@
                 case '7':
                 case '8':
                 case '9':
-                    if (!unescape_all)
-                        {
-                        if (end - src >= 3 && isdigit(src[1]) && isdigit(src[2]))
-                            {
-                            if ((rc = expand_octal(&src, &dst, end)) != 0)
-                                return rc;
-                            break;
-                            }
-                        }
-                    else
+                    if (end - src >= 3 && isdigit(src[1]) && isdigit(src[2]))
                         {
                         if ((rc = expand_octal(&src, &dst, end)) != 0)
                             return rc;


ossp-pkg/var/var_test.c 1.3 -> 1.4

--- var_test.c   2001/11/13 13:25:18     1.3
+++ var_test.c   2001/11/13 13:29:50     1.4
@@ -36,51 +36,52 @@
     {
     const struct test_case tests[] =
         {
-        { "$HOME",                      "/home/regression-tests"          },
-        { "${FOO}",                     "os"                              },
-        { "${BAR}",                     "type"                            },
-        { "${${FOO:u}${BAR:u}:l:u}",    "REGRESSION-OS"                   },
-        { "${UNDEFINED}",               "${UNDEFINED}"                    },
-        { "${OSTYPE:#}",                "13"                              },
-        { "${EMPTY:-test${FOO}test}",   "testostest"                      },
-        { "${EMPTY:-test${FOO:u}test}", "testOStest"                      },
-        { "${TERM:-test${FOO}test}",    "regression-term"                 },
-        { "${EMPTY:+FOO}",              ""                                },
-        { "${HOME:+test${FOO}test}",    "testostest"                      },
-        { "${HOME:+${OS${BAR:u}}}",     "regression-os"                   },
-        { "${HOME:+OS${UNDEFINED:u}}",  "OS${UNDEFINED:u}"                },
-        { "${UNDEFINED:+OS${BAR:u}}",   "${UNDEFINED:+OS${BAR:u}}"        },
-        { "${HOME:*heinz}",             ""                                },
-        { "${EMPTY:*claus}",            "claus"                           },
-        { "${TERM}",                    "regression-term"                 },
-        { "${HOME:s/reg/bla/}",         "/home/blaression-tests"          },
-        { "${HOME:s/e/bla/}",           "/hombla/regression-tests"        },
-        { "${HOME:s/e/bla/g}",          "/hombla/rblagrblassion-tblasts"  },
-        { "${HOME:s/\\//_/g}",          "_home_regression-tests"          },
-        { "${HOME:s/[eso]/_/g}",        "/h_m_/r_gr___i_n-t__t_"          },
-        { "${HOME:s/[esO]/_/g}",        "/hom_/r_gr___ion-t__t_"          },
-        { "${HOME:s/[esO]/_/gi}",       "/h_m_/r_gr___i_n-t__t_"          },
-        { "${OSTYPE:s/^[re]/_/g}",      "_egression-os"                   },
-        { "${EMPTY:s/^[re]/_/g}",       ""                                },
-        { "${HOME:s/.*/heinz/}",        "heinz"                           },
-        { "${HOME:s/e/bla/t}",          "/hombla/regression-tests"        },
-        { "${HOME:s/E/bla/t}",          "/home/regression-tests"          },
-        { "${HOME:s/E/bla/ti}",         "/hombla/regression-tests"        },
-        { "${HOME:s/E/bla/tig}",        "/hombla/rblagrblassion-tblasts"  },
-        { "${HOME:o1-5}",               "home/"                           },
-        { "${HOME:o1,5}",               "home"                            },
-        { "${HOME:o5,}",                "/regression-tests"               },
-        { "${HOME:o5-}",                "/regression-tests"               },
-        { "${HOME:o7,13}",              "egress"                          },
-        { "${HOME:y/a-z/A-YZ/}",        "/HOME/REGRESSION-TESTS"          },
-        { "${HOME:y/e-g/a-c/}",         "/homa/racrassion-tasts"          },
-        { "${FOO:p/15/../l}",           "os............."                 },
-        { "${FOO:p/15/12345/l}",        "os1234512345123"                 },
-        { "${FOO:p/15/../r}",           ".............os"                 },
-        { "${FOO:p/15/12345/r}",        "1234512345123os"                 },
-        { "${FOO:p/15/../c}",           "......os......."                 },
-        { "${FOO:p/15/12345/c}",        "123451os1234512"                 },
-        { "${FOO:s/os/\\x{4F}\\123/g}", "OS"                              }
+        { "$HOME",                       "/home/regression-tests"          },
+        { "${FOO}",                      "os"                              },
+        { "${BAR}",                      "type"                            },
+        { "${${FOO:u}${BAR:u}:l:u}",     "REGRESSION-OS"                   },
+        { "${UNDEFINED}",                "${UNDEFINED}"                    },
+        { "${OSTYPE:#}",                 "13"                              },
+        { "${EMPTY:-test${FOO}test}",    "testostest"                      },
+        { "${EMPTY:-test${FOO:u}test}",  "testOStest"                      },
+        { "${TERM:-test${FOO}test}",     "regression-term"                 },
+        { "${EMPTY:+FOO}",               ""                                },
+        { "${HOME:+test${FOO}test}",     "testostest"                      },
+        { "${HOME:+${OS${BAR:u}}}",      "regression-os"                   },
+        { "${HOME:+OS${UNDEFINED:u}}",   "OS${UNDEFINED:u}"                },
+        { "${UNDEFINED:+OS${BAR:u}}",    "${UNDEFINED:+OS${BAR:u}}"        },
+        { "${HOME:*heinz}",              ""                                },
+        { "${EMPTY:*claus}",             "claus"                           },
+        { "${TERM}",                     "regression-term"                 },
+        { "${HOME:s/reg/bla/}",          "/home/blaression-tests"          },
+        { "${HOME:s/e/bla/}",            "/hombla/regression-tests"        },
+        { "${HOME:s/e/bla/g}",           "/hombla/rblagrblassion-tblasts"  },
+        { "${HOME:s/\\//_/g}",           "_home_regression-tests"          },
+        { "${HOME:s/[eso]/_/g}",         "/h_m_/r_gr___i_n-t__t_"          },
+        { "${HOME:s/[esO]/_/g}",         "/hom_/r_gr___ion-t__t_"          },
+        { "${HOME:s/[esO]/_/gi}",        "/h_m_/r_gr___i_n-t__t_"          },
+        { "${OSTYPE:s/^[re]/_/g}",       "_egression-os"                   },
+        { "${EMPTY:s/^[re]/_/g}",        ""                                },
+        { "${HOME:s/.*/heinz/}",         "heinz"                           },
+        { "${HOME:s/e/bla/t}",           "/hombla/regression-tests"        },
+        { "${HOME:s/E/bla/t}",           "/home/regression-tests"          },
+        { "${HOME:s/E/bla/ti}",          "/hombla/regression-tests"        },
+        { "${HOME:s/E/bla/tig}",         "/hombla/rblagrblassion-tblasts"  },
+        { "${HOME:o1-5}",                "home/"                           },
+        { "${HOME:o1,5}",                "home"                            },
+        { "${HOME:o5,}",                 "/regression-tests"               },
+        { "${HOME:o5-}",                 "/regression-tests"               },
+        { "${HOME:o7,13}",               "egress"                          },
+        { "${HOME:y/a-z/A-YZ/}",         "/HOME/REGRESSION-TESTS"          },
+        { "${HOME:y/e-g/a-c/}",          "/homa/racrassion-tasts"          },
+        { "${FOO:p/15/../l}",            "os............."                 },
+        { "${FOO:p/15/12345/l}",         "os1234512345123"                 },
+        { "${FOO:p/15/../r}",            ".............os"                 },
+        { "${FOO:p/15/12345/r}",         "1234512345123os"                 },
+        { "${FOO:p/15/../c}",            "......os......."                 },
+        { "${FOO:p/15/12345/c}",         "123451os1234512"                 },
+        { "${FOO:s/os/\\x{4F}\\123/g}",  "OS"                              },
+        { "${FOO:s/os/\\1\\x4F\\123/t}", "\\1OS"                           }
         };
     /*
         { "${HOME:s/g(res)s/x\\\\1x/g}","/homE/rEgrEssion-tEsts"          }

CVSTrac 2.0.1