diff options
author | Sven Eden <yamakuzure@gmx.net> | 2013-09-10 08:19:00 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2013-09-10 08:19:00 +0200 |
commit | 7fe7d5d8618b1adfcd5f95b529dfcb4843f5b363 (patch) | |
tree | 4f11040462ee57b1cc7be8d49c512fed2eb2fefa /ufed-curses-checklist.c | |
parent | The new alternative description line is now freed when a flag gets destroyed. (diff) | |
download | ufed-7fe7d5d8618b1adfcd5f95b529dfcb4843f5b363.tar.gz ufed-7fe7d5d8618b1adfcd5f95b529dfcb4843f5b363.tar.bz2 ufed-7fe7d5d8618b1adfcd5f95b529dfcb4843f5b363.zip |
Added reading of the new incoming alternative description line and its addition to the flag descriptions.
Diffstat (limited to 'ufed-curses-checklist.c')
-rw-r--r-- | ufed-curses-checklist.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c index 5d7179e..978e2f5 100644 --- a/ufed-curses-checklist.c +++ b/ufed-curses-checklist.c @@ -91,7 +91,7 @@ static void read_flags(void) size_t fullWidth = 0; struct { int start, end; - } name, desc, pkg, state; + } name, desc, desc_alt, pkg, state; if(input == NULL) ERROR_EXIT(-1, "fdopen failed with error %d\n", errno); @@ -126,15 +126,17 @@ static void read_flags(void) /* read description(s) and determine flag status */ for (int i = 0; i < ndescr; ++i) { - desc.start = desc.end = -1; - pkg.start = pkg.end = -1; - state.start = state.end = -1; + desc.start = desc.end = -1; + desc_alt.start = desc_alt.end = -1; + pkg.start = pkg.end = -1; + state.start = state.end = -1; line = getline(input); if (!line) break; - if ( (sscanf(line, "\t%n%*[^\t]%n\t (%n%*[^)]%n) [%n%*[ +-]%n%c", + if ( (sscanf(line, "\t%n%*[^\t]%n\t%n%*[^\t]%n\t (%n%*[^)]%n) [%n%*[ +-]%n%c", &desc.start, &desc.end, + &desc_alt.start, &desc_alt.end, &pkg.start, &pkg.end, &state.start, &state.end, &endChar) != 1) @@ -146,13 +148,16 @@ static void read_flags(void) ERROR_EXIT(-1, "Illegal description stats on line %d:\n\"%s\"\n", lineNum + 1, line); // Add description line to flag: - line[desc.end] = '\0'; - line[state.end] = '\0'; + line[desc.end] = '\0'; + line[desc_alt.end] = '\0'; + line[state.end] = '\0'; if ( (pkg.end - pkg.start) > 1) { line[pkg.end] = '\0'; - fullWidth = addFlagDesc(newFlag, &line[pkg.start], &line[desc.start], &line[state.start]); + fullWidth = addFlagDesc(newFlag, &line[pkg.start], &line[desc.start], + &line[desc_alt.start], &line[state.start]); } else - fullWidth = addFlagDesc(newFlag, NULL, &line[desc.start], &line[state.start]); + fullWidth = addFlagDesc(newFlag, NULL, &line[desc.start], + &line[desc_alt.start], &line[state.start]); // Note new max length if this line is longest: if (fullWidth > maxDescWidth) |