diff options
Diffstat (limited to 'libarmep/configuration.c')
-rwxr-xr-x | libarmep/configuration.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/libarmep/configuration.c b/libarmep/configuration.c index f6eb9aa..98070cd 100755 --- a/libarmep/configuration.c +++ b/libarmep/configuration.c @@ -126,6 +126,7 @@ int configure(struct aep_context *aep_context, struct aep *aep, const char *dev_ }; enum parser parser = ACPP_FIRST; enum parser entry_parser; + int stanza = -1; int index = 0; int copy_pos = 0; int field = 0; @@ -135,6 +136,8 @@ int configure(struct aep_context *aep_context, struct aep *aep, const char *dev_ char linebuf[1024]; int no_copy = 0; int ret = 0; + int nope = 0; + int n; if (wch) { strncpy(temp_config, config_filepath, sizeof temp_config - 2); @@ -156,6 +159,8 @@ int configure(struct aep_context *aep_context, struct aep *aep, const char *dev_ if (aep_context->count_virtual_channels >= MAX_VIRTUAL_CHANNELS) return -1; ch = &aep_context->vch[aep_context->count_virtual_channels]; + for (n = 0; n < MAX_PROBES; n++) + aep_context->device_paths[n][0] = '\0'; } if (fd < 0) { @@ -227,19 +232,22 @@ int configure(struct aep_context *aep_context, struct aep *aep, const char *dev_ break; case APCA_CHECK_DEVPATH: if (entry_parser == ACPP_FIRST) { + copy_pos = 0; + nope = 0; if (c != '/') { if (c != '\n') parser = ACPP_SKIP; continue; } - copy_pos = 1; + aep_context->device_paths[stanza++][copy_pos++] = c; + aep_context->device_paths[stanza][copy_pos] = '\0'; actions = APCA_MATCH_DEVPATH; } break; case APCA_MATCH_DEVPATH: if (parser == ACPP_FIRST) { - if (dev_filepath[copy_pos] != '\0') { + if (dev_filepath[copy_pos] != '\0' || nope) { parser = ACPP_SKIP; actions = APCA_CHECK_DEVPATH; copy_pos = 0; @@ -250,12 +258,10 @@ int configure(struct aep_context *aep_context, struct aep *aep, const char *dev_ no_copy = ch == wch; break; } - if (dev_filepath[copy_pos++] != c) { - parser = ACPP_SKIP; - actions = APCA_CHECK_DEVPATH; - copy_pos = 0; - break; - } + aep_context->device_paths[stanza][copy_pos] = c; + if (dev_filepath[copy_pos++] != c) + nope = 1; + aep_context->device_paths[stanza][copy_pos] = '\0'; break; case APCA_PULL_CHANNELS: |