From a4bc0ab74f23ef4e208a8a86769d8f1a797180ab Mon Sep 17 00:00:00 2001 From: Rangi Date: Sun, 13 Mar 2022 14:04:36 -0400 Subject: [PATCH] Error messages end with newlines --- tools/gfx.c | 2 +- tools/make_patch.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/gfx.c b/tools/gfx.c index 4264e669c..c8f0b03f4 100644 --- a/tools/gfx.c +++ b/tools/gfx.c @@ -271,7 +271,7 @@ int main(int argc, char *argv[]) { } if (options.interleave) { if (!options.png_file) { - error_exit("--interleave needs --png to infer dimensions"); + error_exit("--interleave needs --png to infer dimensions\n"); } int width = read_png_width(options.png_file); interleave(&graphic, width); diff --git a/tools/make_patch.c b/tools/make_patch.c index d83ffc76c..136de0d54 100644 --- a/tools/make_patch.c +++ b/tools/make_patch.c @@ -94,7 +94,7 @@ int parse_number(const char *input, int base) { char *endptr; int n = (int)strtol(input, &endptr, base); if (endptr == input || *endptr || n < 0) { - error_exit("Error: Cannot parse number: \"%s\"", input); + error_exit("Error: Cannot parse number: \"%s\"\n", input); } return n; } @@ -102,7 +102,7 @@ int parse_number(const char *input, int base) { void parse_symbol_value(char *input, int *restrict bank, int *restrict address) { char *colon = strchr(input, ':'); if (!colon) { - error_exit("Error: Cannot parse bank+address: \"%s\"", input); + error_exit("Error: Cannot parse bank+address: \"%s\"\n", input); } *colon++ = '\0'; *bank = parse_number(input, 16); @@ -215,10 +215,10 @@ void interpret_command(char *command, const struct Symbol *current_hook, const s // Use the arguments if (!strcmp(command, "patch") || !strcmp(command, "PATCH") || !strcmp(command, "patch_") || !strcmp(command, "PATCH_")) { if (argc > 2) { - error_exit("Error: Invalid arguments for command: \"%s\"", command); + error_exit("Error: Invalid arguments for command: \"%s\"\n", command); } if (!current_hook) { - error_exit("Error: No current patch for command: \"%s\"", command); + error_exit("Error: No current patch for command: \"%s\"\n", command); } int current_offset = current_hook->offset + (argc > 0 ? parse_number(argv[0], 0) : 0); if (fseek(orig_rom, current_offset, SEEK_SET)) { @@ -257,13 +257,13 @@ void interpret_command(char *command, const struct Symbol *current_hook, const s } else if (!strcmp(command, "dws") || !strcmp(command, "DWS") || !strcmp(command, "dws_") || !strcmp(command, "DWS_")) { if (argc < 1) { - error_exit("Error: Invalid arguments for command: \"%s\"", command); + error_exit("Error: Invalid arguments for command: \"%s\"\n", command); } fprintf(output, command[strlen(command) - 1] == '_' ? "a%d: " : "a%d:", argc * 2); for (int i = 0; i < argc; i++) { int value = parse_arg_value(argv[i], false, symbols, current_hook->name); if (value > 0xffff) { - error_exit("Error: Invalid value for \"%s\" argument: 0x%x", command, value); + error_exit("Error: Invalid value for \"%s\" argument: 0x%x\n", command, value); } if (i) { putc(' ', output); @@ -273,18 +273,18 @@ void interpret_command(char *command, const struct Symbol *current_hook, const s } else if (!strcmp(command, "db") || !strcmp(command, "DB") || !strcmp(command, "db_") || !strcmp(command, "DB_")) { if (argc != 1) { - error_exit("Error: Invalid arguments for command: \"%s\"", command); + error_exit("Error: Invalid arguments for command: \"%s\"\n", command); } int value = parse_arg_value(argv[0], false, symbols, current_hook->name); if (value > 0xff) { - error_exit("Error: Invalid value for \"%s\" argument: 0x%x", command, value); + error_exit("Error: Invalid value for \"%s\" argument: 0x%x\n", command, value); } fputs(command[strlen(command) - 1] == '_' ? "a1: " : "a1:", output); fprintf(output, isupper((unsigned)command[0]) ? "%02X" : "%02x", value); } else if (!strcmp(command, "hex") || !strcmp(command, "HEX") || !strcmp(command, "HEx") || !strcmp(command, "Hex") || !strcmp(command, "heX") || !strcmp(command, "hEX")) { if (argc != 1 && argc != 2) { - error_exit("Error: Invalid arguments for command: \"%s\"", command); + error_exit("Error: Invalid arguments for command: \"%s\"\n", command); } int value = parse_arg_value(argv[0], true, symbols, current_hook->name); int padding = argc > 1 ? parse_number(argv[1], 0) : 2;