static int cmd_explain(const char *cmd, const char *arg)
{
+ const struct cdecl_error *err;
struct cdecl *decl;
const char *str;
int ret = -1;
decl = cdecl_parse_decl(arg);
- if (!decl)
+ if (!decl) {
+ err = cdecl_get_error();
+ fprintf(stderr, "%s\n", err->str);
goto out;
+ }
for (struct cdecl *i = decl; i; i = i->next) {
str = do_format(cdecl_explain, i);
static int cmd_simplify(const char *cmd, const char *arg)
{
+ const struct cdecl_error *err;
struct cdecl *decl;
const char *str;
int ret = -1;
decl = cdecl_parse_decl(arg);
- if (!decl)
+ if (!decl) {
+ err = cdecl_get_error();
+ fprintf(stderr, "%s\n", err->str);
goto out;
+ }
for (struct cdecl *i = decl; i; i = i->next) {
struct cdecl_declspec *s = i->specifiers;
static int cmd_declare(const char *cmd, const char *arg)
{
+ 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)
+ if (!decl) {
+ err = cdecl_get_error();
+ fprintf(stderr, "%s\n", err->str);
goto out;
+ }
/*
* English parses have at most one full declarator, so no loop is