X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/35684c08a8429cf1c1148c74d2df8cdf4c31bbac..6cc6418811ac7b38fbe1ceed1de949d33439b51c:/src/commands.c diff --git a/src/commands.c b/src/commands.c index dea4219..fd2a5a3 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1,6 +1,6 @@ /* * Main command implementation routines for cdecl99. - * Copyright © 2011-2012, 2020-2021 Nick Bowler + * Copyright © 2011-2012, 2020-2021, 2023 Nick Bowler * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ retry: tmp = realloc(buf, rc + 1); if (!tmp) { - print_error("%s", _("failed to allocate memory)")); + print_error("%s", _("failed to allocate memory")); return NULL; } @@ -66,8 +66,7 @@ int run_command_explain(const char *arg) decl = cdecl_parse_decl(arg); if (!decl) { - err = cdecl_get_error(); - print_error("%s", err->str); + print_error("%s", cdecl_get_error()->str); goto out; } @@ -94,8 +93,7 @@ int run_command_simplify(const char *arg) decl = cdecl_parse_decl(arg); if (!decl) { - err = cdecl_get_error(); - fprintf(stderr, "%s\n", err->str); + print_error("%s", cdecl_get_error()->str); goto out; } @@ -126,7 +124,6 @@ out: int run_command_declare(const char *cmd) { - const struct cdecl_error *err; struct cdecl *decl; const char *str; int ret = -1; @@ -134,8 +131,7 @@ int run_command_declare(const char *cmd) /* The name of the command is significant here. */ decl = cdecl_parse_english(cmd); if (!decl) { - err = cdecl_get_error(); - fprintf(stderr, "%s\n", err->str); + print_error("%s", cdecl_get_error()->str); goto out; }