]> git.refcnt.org Git - colorize.git/commitdiff
Emit more concise error message when config file does not exist
authorSteven Schubiger <stsc@refcnt.org>
Thu, 17 Dec 2020 21:46:38 +0000 (22:46 +0100)
committerSteven Schubiger <stsc@refcnt.org>
Thu, 17 Dec 2020 21:46:38 +0000 (22:46 +0100)
colorize.c

index 8a1cb5236adc3edd3e268afe70acef24eab4a658..d527e5eff4f2f79f0b85b2bb259b69f4518779cd 100644 (file)
@@ -192,18 +192,20 @@ enum {
     FMT_ERROR,
     FMT_FILE,
     FMT_TYPE,
-    FMT_CONF
+    FMT_CONF,
+    FMT_CONF_FILE
 };
 static const char *formats[] = {
-    "%s",                     /* generic */
-    "%s '%s'",                /* string  */
-    "%s `%s' %s",             /* quote   */
-    "%s color '%s' %s",       /* color   */
-    "%s color '%s' %s '%s'",  /* random  */
-    "less than %lu bytes %s", /* error   */
-    "%s: %s",                 /* file    */
-    "%s: %s: %s",             /* type    */
-    "%s: option '%s' %s"      /* conf    */
+    "%s",                     /* generic   */
+    "%s '%s'",                /* string    */
+    "%s `%s' %s",             /* quote     */
+    "%s color '%s' %s",       /* color     */
+    "%s color '%s' %s '%s'",  /* random    */
+    "less than %lu bytes %s", /* error     */
+    "%s: %s",                 /* file      */
+    "%s: %s: %s",             /* type      */
+    "%s: option '%s' %s",     /* conf      */
+    "config file %s: %s"      /* conf file */
 };
 
 enum { GENERIC, FOREGROUND = 0, BACKGROUND };
@@ -391,7 +393,7 @@ main (int argc, char **argv)
           }
         errno = 0;
         if (access (conf_file, F_OK) == -1)
-          vfprintf_fail (formats[FMT_FILE], conf_file, strerror (errno));
+          vfprintf_fail (formats[FMT_CONF_FILE], conf_file, strerror (errno));
       }
 #endif
 #if defined(CONF_FILE_TEST) || !defined(TEST)