diff options
Diffstat (limited to 'src/operetta.c')
| -rw-r--r-- | src/operetta.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/operetta.c b/src/operetta.c index 7e257f0..9b7fea3 100644 --- a/src/operetta.c +++ b/src/operetta.c @@ -28,7 +28,8 @@ int main(int argc, char** argv) { s[0] = '\0'; char* propString = write_prop(line.proposition); char* justString = write_just(line.justification); - snprintf(s, 100, "%d. %s BECAUSE: %s", i + 1, propString, justString); + char isValid = just_is_sound(line, lines); + snprintf(s, 100, "%d. %s BECAUSE: %s <%s>", i + 1, propString, justString, isValid ? "SOUND" : "UNSOUND"); free(propString); free(justString); consoleLines[i] = init_simple_consoleline(CWHITE, s); @@ -48,6 +49,12 @@ int main(int argc, char** argv) { free(content); } char* write_prop(prop_t prop) { + if (prop.isContradiction) { + char* s = tttos(CONTRADICTION); + char* sp = malloc(sizeof(char) * strlen(s) + 1); + strcpy(sp, s); + return sp; + } char* out = calloc(sizeof(char), 100); out[0] = '\0'; if (prop.isNegative) { @@ -69,7 +76,7 @@ char* write_prop(prop_t prop) { free(c2); strcat(out, ")"); } - return out; + return realloc(out, sizeof(char) * strlen(out) + 1); } char* write_just(just_t just) { char* out = calloc(sizeof(char), 50); @@ -81,7 +88,7 @@ char* write_just(just_t just) { strcat(out, n); free(n); } - return out; + return realloc(out, sizeof(char) * strlen(out) + 1); } char* read_file(char* path) { FILE* file = fopen(path, "r"); |
