]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_argparse: ignore dashes after equals sign
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 5 May 2011 23:17:34 +0000 (16:17 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 5 May 2011 23:24:53 +0000 (16:24 -0700)
When parsing argv, ignore dashes after equals signs. This is so that
things like --log-file=/tmp/foo-file will work correctly.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/common/ceph_argparse.cc

index 6a7b6253a5a5facc64dcc50f5898210b860bd136..c6f7cdcd9dcc7ab64ccfaf258864d39821765129 100644 (file)
@@ -250,10 +250,14 @@ static void dashes_to_underscores(const char *input, char *output)
   if (*o++ == '\0')
     return;
   for (; ((c = *i)); ++i) {
-     if (c == '-')
-       *o++ = '_';
-     else
-       *o++ = c;
+    if (c == '=') {
+      strcpy(o, i);
+      return;
+    }
+    if (c == '-')
+      *o++ = '_';
+    else
+      *o++ = c;
   }
   *o++ = '\0';
 }