|
@ -13,7 +13,7 @@ |
|
|
static void usage() { |
|
|
static void usage() { |
|
|
// clang-format off
|
|
|
// clang-format off
|
|
|
fprintf(stderr, |
|
|
fprintf(stderr, |
|
|
"Usage: ui [options] infile\n\n" |
|
|
"Usage: ui [options] [file]\n\n" |
|
|
"Options:\n" |
|
|
"Options:\n" |
|
|
" -h or --help Print this message and exit.\n" |
|
|
" -h or --help Print this message and exit.\n" |
|
|
); |
|
|
); |
|
@ -247,39 +247,39 @@ int main(int argc, char** argv) { |
|
|
fprintf(stderr, "Expected only 1 file argument.\n"); |
|
|
fprintf(stderr, "Expected only 1 file argument.\n"); |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
if (input_file == NULL) { |
|
|
|
|
|
fprintf(stderr, "No input file.\n"); |
|
|
|
|
|
usage(); |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Field field; |
|
|
Field field; |
|
|
field_init(&field); |
|
|
if (input_file) { |
|
|
Field_load_error fle = field_load_file(input_file, &field); |
|
|
field_init(&field); |
|
|
if (fle != Field_load_error_ok) { |
|
|
Field_load_error fle = field_load_file(input_file, &field); |
|
|
field_deinit(&field); |
|
|
if (fle != Field_load_error_ok) { |
|
|
char const* errstr = "Unknown"; |
|
|
field_deinit(&field); |
|
|
switch (fle) { |
|
|
char const* errstr = "Unknown"; |
|
|
case Field_load_error_ok: |
|
|
switch (fle) { |
|
|
break; |
|
|
case Field_load_error_ok: |
|
|
case Field_load_error_cant_open_file: |
|
|
break; |
|
|
errstr = "Unable to open file"; |
|
|
case Field_load_error_cant_open_file: |
|
|
break; |
|
|
errstr = "Unable to open file"; |
|
|
case Field_load_error_too_many_columns: |
|
|
break; |
|
|
errstr = "Grid file has too many columns"; |
|
|
case Field_load_error_too_many_columns: |
|
|
break; |
|
|
errstr = "Grid file has too many columns"; |
|
|
case Field_load_error_too_many_rows: |
|
|
break; |
|
|
errstr = "Grid file has too many rows"; |
|
|
case Field_load_error_too_many_rows: |
|
|
break; |
|
|
errstr = "Grid file has too many rows"; |
|
|
case Field_load_error_no_rows_read: |
|
|
break; |
|
|
errstr = "Grid file has no rows"; |
|
|
case Field_load_error_no_rows_read: |
|
|
break; |
|
|
errstr = "Grid file has no rows"; |
|
|
case Field_load_error_not_a_rectangle: |
|
|
break; |
|
|
errstr = "Grid file is not a rectangle"; |
|
|
case Field_load_error_not_a_rectangle: |
|
|
break; |
|
|
errstr = "Grid file is not a rectangle"; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
fprintf(stderr, "File load error: %s.\n", errstr); |
|
|
|
|
|
return 1; |
|
|
} |
|
|
} |
|
|
fprintf(stderr, "File load error: %s.\n", errstr); |
|
|
} else { |
|
|
return 1; |
|
|
input_file = "unnamed"; |
|
|
|
|
|
field_init_fill(&field, 25, 57, '.'); |
|
|
} |
|
|
} |
|
|
Markmap_reusable markmap_r; |
|
|
Markmap_reusable markmap_r; |
|
|
markmap_reusable_init(&markmap_r); |
|
|
markmap_reusable_init(&markmap_r); |
|
|