X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/631a4eac63aff6cc22ef8ec44bf7595af9a05562..96b00735351dd8e39fc5d71ff31afbdddd83ecba:/src/commands.c diff --git a/src/commands.c b/src/commands.c index 29184d5..faaf607 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 @@ -59,15 +59,13 @@ retry: int run_command_explain(const char *arg) { - const struct cdecl_error *err; struct cdecl *decl; const char *str; int ret = -1; 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; } @@ -87,15 +85,13 @@ out: int run_command_simplify(const char *arg) { - const struct cdecl_error *err; struct cdecl *decl; const char *str; int ret = -1; 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 +122,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 +129,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; }