]> git.refcnt.org Git - colorize.git/commitdiff
Print line number when exceeding chars
authorSteven Schubiger <stsc@refcnt.org>
Fri, 30 Aug 2019 18:41:16 +0000 (20:41 +0200)
committerSteven Schubiger <stsc@refcnt.org>
Fri, 30 Aug 2019 18:41:16 +0000 (20:41 +0200)
colorize.c
t/conf/parse/fail.t

index dbeed2587ca0220bf0b7f632e2b5884ee09c3731..bf7e3d6f1038bb1b42fc46bc2b91bf79c2f21e8e 100644 (file)
@@ -663,6 +663,7 @@ init_opts_vars (void)
 static void
 parse_conf (const char *conf_file, struct conf *config)
 {
 static void
 parse_conf (const char *conf_file, struct conf *config)
 {
+    unsigned int cnt = 0;
     char line[256 + 1];
     FILE *conf;
 
     char line[256 + 1];
     FILE *conf;
 
@@ -674,8 +675,9 @@ parse_conf (const char *conf_file, struct conf *config)
         char *assign, *comment, *opt, *value;
         char *p;
 
         char *assign, *comment, *opt, *value;
         char *p;
 
+        cnt++;
         if (strlen (line) > (sizeof (line) - 2))
         if (strlen (line) > (sizeof (line) - 2))
-          vfprintf_fail ("%s: line exceeds maximum of %u characters", conf_file, (unsigned int)(sizeof (line) - 2));
+          vfprintf_fail ("%s: line %u exceeds maximum of %u characters", conf_file, cnt, (unsigned int)(sizeof (line) - 2));
         if ((p = strrchr (line, '\n')))
           *p = '\0';
 /* NAME PARSING (start) */
         if ((p = strrchr (line, '\n')))
           *p = '\0';
 /* NAME PARSING (start) */
index 673153b147113062f85418487ea997ac79eb8c6b..ea267f82fd3164bc5849d7c59bded808a117c2cf 100755 (executable)
@@ -48,7 +48,7 @@ SKIP: {
         [ 'omit-color-empty1=yes', 'option \'omit-color-empty1\' not recognized'               ],
         [ 'attr',                  'option \'attr\' not followed by ='                         ],
         [ 'attr bold',             'option \'attr\' not followed by ='                         ],
         [ 'omit-color-empty1=yes', 'option \'omit-color-empty1\' not recognized'               ],
         [ 'attr',                  'option \'attr\' not followed by ='                         ],
         [ 'attr bold',             'option \'attr\' not followed by ='                         ],
-        [ "color=$chars_exceed",   'line exceeds maximum of'                                   ],
+        [ "color=$chars_exceed",   'line 1 exceeds maximum of'                                 ],
     );
 
     foreach my $set (@set) {
     );
 
     foreach my $set (@set) {