Browse Source

make complaints about unrecognized keywords more verbose

tell the user in what section the keyword appeared, as that may help
spotting mistakes like stray empty lines.
1.4
Oswald Buddenhagen 4 years ago
parent
commit
09341c10c5
  1. 7
      src/config.c
  2. 4
      src/driver.c
  3. 2
      src/driver.h
  4. 5
      src/drv_imap.c
  5. 2
      src/drv_maildir.c

7
src/config.c

@ -425,7 +425,8 @@ load_config( const char *where )
if (*++p)
channel->boxes[fn] = nfstrdup( p );
} else if (!getopt_helper( &cfile, &cops, channel )) {
error( "%s:%d: unknown keyword '%s'\n", cfile.file, cfile.line, cfile.cmd );
error( "%s:%d: keyword '%s' is not recognized in Channel sections\n",
cfile.file, cfile.line, cfile.cmd );
cfile.err = 1;
}
}
@ -476,7 +477,7 @@ load_config( const char *where )
}
else
{
error( "%s:%d: unknown keyword '%s'\n",
error( "%s:%d: keyword '%s' is not recognized in Group sections\n",
cfile.file, cfile.line, cfile.cmd );
cfile.err = 1;
}
@ -511,7 +512,7 @@ load_config( const char *where )
}
else if (!getopt_helper( &cfile, &gcops, &global_conf ))
{
error( "%s:%d: unknown section keyword '%s'\n",
error( "%s:%d: '%s' is not a recognized section-starting or global keyword\n",
cfile.file, cfile.line, cfile.cmd );
cfile.err = 1;
while (getcline( &cfile ))

4
src/driver.c

@ -49,7 +49,7 @@ free_generic_messages( message_t *msgs )
}
void
parse_generic_store( store_conf_t *store, conffile_t *cfg )
parse_generic_store( store_conf_t *store, conffile_t *cfg, const char *type )
{
if (!strcasecmp( "Trash", cfg->cmd )) {
store->trash = nfstrdup( cfg->val );
@ -72,7 +72,7 @@ parse_generic_store( store_conf_t *store, conffile_t *cfg )
}
store->flat_delim = nfstrdup( cfg->val );
} else {
error( "%s:%d: unknown keyword '%s'\n", cfg->file, cfg->line, cfg->cmd );
error( "%s:%d: keyword '%s' is not recognized in %s sections\n", cfg->file, cfg->line, cfg->cmd, type );
cfg->err = 1;
}
}

2
src/driver.h

@ -276,7 +276,7 @@ struct driver {
uint count_generic_messages( message_t * );
void free_generic_messages( message_t * );
void parse_generic_store( store_conf_t *store, conffile_t *cfg );
void parse_generic_store( store_conf_t *store, conffile_t *cfg, const char *type );
store_t *proxy_alloc_store( store_t *real_ctx, const char *label );

5
src/drv_imap.c

@ -3529,10 +3529,11 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
}
store->delimiter = cfg->val[0];
} else
parse_generic_store( &store->gen, cfg );
parse_generic_store( &store->gen, cfg, "IMAPStore" );
continue;
} else {
error( "%s:%d: unknown/misplaced keyword '%s'\n", cfg->file, cfg->line, cfg->cmd );
error( "%s:%d: keyword '%s' is not recognized in IMAPAccount sections\n",
cfg->file, cfg->line, cfg->cmd );
cfg->err = 1;
continue;
}

2
src/drv_maildir.c

@ -1913,7 +1913,7 @@ maildir_parse_store( conffile_t *cfg, store_conf_t **storep )
cfg->err = 1;
}
} else
parse_generic_store( &store->gen, cfg );
parse_generic_store( &store->gen, cfg, "MaildirStore" );
if (!store->inbox)
store->inbox = expand_strdup( "~/Maildir" );
if (store->sub_style == SUB_MAILDIRPP && store->gen.path) {

Loading…
Cancel
Save