/*
* 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
tmp = realloc(buf, rc + 1);
if (!tmp) {
- fprintf(stderr, "%s\n", _("failed to allocate memory"));
+ print_error("%s", _("failed to allocate memory"));
return NULL;
}
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;
}
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;
}
int run_command_declare(const char *cmd)
{
- const struct cdecl_error *err;
struct cdecl *decl;
const char *str;
int ret = -1;
/* 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;
}