Explorar el Código

parse argument

ruki hace 2 años
padre
commit
19f068b62e
Se han modificado 1 ficheros con 14 adiciones y 2 borrados
  1. 14 2
      configure

+ 14 - 2
configure

@@ -431,11 +431,23 @@ _show_version()
     exit 2
 }
 
+# --foo=yes => foo
+_parse_argument_name()
+{
+    echo "${1#*--}" | sed "s/${2-=[^=]*}$//"
+}
+
+# --foo=yes => yes
+_parse_argument_value()
+{
+    echo "$1" | sed "s/^${2-[^=]*=}//"
+}
+
 # parse input arguments
 _handle_option()
 {
-    local name=${1}
-    name=${name#*--}
+    local name=`_parse_argument_name ${1}`
+    local value=`_parse_argument_value ${1}`
     if test "x${name}" = "xhelp"; then
         _show_usage
         return 0