]> git.refcnt.org Git - colorize.git/blobdiff - colorize.c
Enhance message if attribute is invalid
[colorize.git] / colorize.c
index d947b92ffaa6bc7abc8668a4997fae14179dff3b..1e27fcae01878ea6f41c90adac3c52aa7138317b 100644 (file)
@@ -468,7 +468,14 @@ process_opt_attr (const char *p)
                   }
               }
             if (!valid_attr)
-              vfprintf_fail (formats[FMT_GENERIC], "--attr switch must be provided valid attribute names");
+              {
+                char *sep;
+                char *attr_invalid = xstrdup (s);
+                STACK_VAR (attr_invalid);
+                if ((sep = strchr (attr_invalid, ',')))
+                  *sep = '\0';
+                vfprintf_fail ("--attr switch attribute '%s' is not valid", attr_invalid);
+              }
           }
         if (*p)
           p++;
@@ -557,22 +564,23 @@ print_version (void)
 #endif
     const char *version_prefix, *version_string;
     const char *c_flags, *ld_flags, *cpp_flags;
+    const char *const desc_flags_unknown = "unknown";
     struct bytes_size bytes_size;
     bool debug;
 #ifdef CFLAGS
     c_flags = to_str (CFLAGS);
 #else
-    c_flags = "unknown";
+    c_flags = desc_flags_unknown;
 #endif
 #ifdef LDFLAGS
     ld_flags = to_str (LDFLAGS);
 #else
-    ld_flags = "unknown";
+    ld_flags = desc_flags_unknown;
 #endif
 #ifdef CPPFLAGS
     cpp_flags = to_str (CPPFLAGS);
 #else
-    cpp_flags = "unknown";
+    cpp_flags = desc_flags_unknown;
 #endif
 #if DEBUG
     debug = true;