]> git.draconx.ca Git - cdecl99.git/blobdiff - src/commands.c
cdecl99: Fix some improper error message formatting.
[cdecl99.git] / src / commands.c
index 29184d5ac4641b37119d64e851bdfca39c36f842..fd2a5a38349b8ec6c3cb423cd5fef4820697b42c 100644 (file)
@@ -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
@@ -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;
        }