aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org>2020-12-17 22:46:38 +0100
committerGravatar Steven Schubiger <stsc@refcnt.org>2020-12-17 22:46:38 +0100
commitae049342a1a513093ba4f3f56af2194ef2707da0 (patch)
treef66b5bd0ee73e04dc638f3c0baf8f7e0fe4db0d2
parentda7aeb5522d20e93de866cfa236b996b96129884 (diff)
downloadcolorize-ae049342a1a513093ba4f3f56af2194ef2707da0.tar.gz
colorize-ae049342a1a513093ba4f3f56af2194ef2707da0.tar.bz2
Emit more concise error message when config file does not exist
-rw-r--r--colorize.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/colorize.c b/colorize.c
index 8a1cb52..d527e5e 100644
--- a/colorize.c
+++ b/colorize.c
@@ -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)