usage: fix horizontal alignment of options
authorJohn Koleszar <jkoleszar@google.com>
Thu, 21 Oct 2010 20:53:52 +0000 (16:53 -0400)
committerJohn Koleszar <jkoleszar@google.com>
Tue, 26 Oct 2010 02:20:32 +0000 (22:20 -0400)
When showing the command usage information for vpxenc and vpxdec,
options with both a short and long version that do not take an
argument were not properly aligned.

Change-Id: I8d65b5ab85bcb5a5dc8bc0d4b293b5189d56dedb

args.c

diff --git a/args.c b/args.c
index 5365e91..7829290 100644 (file)
--- a/args.c
+++ b/args.c
@@ -120,9 +120,13 @@ void arg_show_usage(FILE *fp, const struct arg_def *const *defs)
         char *long_val = def->has_val ? "=<arg>" : "";
 
         if (def->short_name && def->long_name)
-            snprintf(option_text, 37, "-%s%s, --%s%s",
-                     def->short_name, short_val,
+        {
+            char *comma = def->has_val ? "," : ",      ";
+
+            snprintf(option_text, 37, "-%s%s%s --%s%6s",
+                     def->short_name, short_val, comma,
                      def->long_name, long_val);
+        }
         else if (def->short_name)
             snprintf(option_text, 37, "-%s%s",
                      def->short_name, short_val);