Skip to content

Commit

Permalink
Ignore [section] in conf files
Browse files Browse the repository at this point in the history
  • Loading branch information
andy5995 committed Feb 28, 2024
1 parent 8a4bcc6 commit 9c0e81e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion canfigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ canfigger_parse_file(const char *file, const int delimiter)
while (isspace(*line_ptr))
line_ptr = erase_lead_char(*line_ptr, line_ptr);

if (*line_ptr == '\0' || *line_ptr == '#')
if (*line_ptr == '\0' || *line_ptr == '#' || *line_ptr == '[')
continue;

node_complete = false;
Expand Down
5 changes: 4 additions & 1 deletion examplerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ Place = World, Earth

FeatureEnabled

IP = 192.168.1.200
IP = 192.168.1.200

# a section to ignore
[section]

mx-host=maildomain.com,servermachine.com,50

Expand Down
5 changes: 4 additions & 1 deletion tests/test_canfigger.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ blue=color,shiny
# Leading tabs will be ignored.
statement = hello world , obvious

leadingSpace = nullified
leadingSpace = nullified

# Test if there is no attribute but spaces are used between
# key and value
fookey = bar-value

# An option with no value or attributes
FeatureFooEnabled

# ini section should be ignored
[section]

0 comments on commit 9c0e81e

Please sign in to comment.