Allow comments in config files.

This commit is contained in:
Roger A. Light 2014-05-25 11:07:01 +01:00
parent 7e410eb7f0
commit 0bbdda2c4e
3 changed files with 8 additions and 2 deletions

View File

@ -92,6 +92,8 @@ int client_config_load(struct mosq_config *cfg, int pub_or_sub, int argc, char *
fptr = fopen(loc, "rt");
if(fptr){
while(fgets(line, 1024, fptr)){
if(line[0] == '#') continue; /* Comments */
while(line[strlen(line)-1] == 10 || line[strlen(line)-1] == 13){
line[strlen(line)-1] = 0;
}

View File

@ -89,7 +89,9 @@
and can be overridden by using the command line. The exceptions to
this are the message type options, of which only one can be
specified. Note also that currently some options cannot be negated,
e.g. <option>-S</option>.</para>
e.g. <option>-S</option>. Config file lines that have a
<option>#</option> as the first character are treated as comments
and not processed any further.</para>
<variablelist>
<varlistentry>
<term><option>-A</option></term>

View File

@ -89,7 +89,9 @@
this are <option>-t</option> and <option>-T</option>, which if
given in the config file will not be overridden. Note also that
currently some options cannot be negated, e.g.
<option>-S</option>.</para>
<option>-S</option>. Config file lines that have a
<option>#</option> as the first character are treated as comments
and not processed any further.</para>
<variablelist>
<varlistentry>
<term><option>-1</option></term>