]> git.refcnt.org Git - colorize.git/blobdiff - colorize.c
Enhance message if color string exists as file
[colorize.git] / colorize.c
index 7bf77b81863c6ca4db0d8d899290f692b156efc2..2f02bf49ba0bbbcc1e5e564836d11c5e145df8a7 100644 (file)
@@ -65,7 +65,7 @@
 
 #if DEBUG
 # define MEM_ALLOC_FAIL(file, line) do {                                                    \
-    fprintf (stderr, "memory allocation failure in source file %s, line %d\n", file, line); \
+    fprintf (stderr, "Memory allocation failure in source file %s, line %d\n", file, line); \
     exit (2);                                                                               \
 } while (false);
 #else
@@ -76,7 +76,7 @@
 #endif
 
 #define ABORT_TRACE()                                                              \
-    fprintf (stderr, "aborting in source file %s, line %d\n", __FILE__, __LINE__); \
+    fprintf (stderr, "Aborting in source file %s, line %d\n", __FILE__, __LINE__); \
     abort ();                                                                      \
 
 #define CHECK_COLORS_RANDOM(color1, color2)        \
@@ -403,7 +403,12 @@ process_options (unsigned int arg_cnt, char **option_strings, bool *bold, const
         have_file = (*color != '\0');
 
         if (have_file)
-          vfprintf_fail (formats[FMT_GENERIC], "file must be preceeded by color string");
+          {
+            if (file_string)
+              vfprintf_fail (formats[FMT_GENERIC], "file cannot be used as color string");
+            else
+              vfprintf_fail (formats[FMT_GENERIC], "file must be preceeded by color string");
+          }
       }
 
     if ((p = strchr (color_string, '/')))