-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) {
- print_error("%s", cdecl_get_error()->str);
- goto out;
- }
-
- for (struct cdecl *i = decl; i; i = i->next) {
- str = do_format(cdecl_explain, i);
- if (!str)
- goto out;
-
- printf("%s\n", str);
- }
-
- ret = 0;
-out:
- cdecl_free(decl);
- return ret;
-}
-
-int run_command_simplify(const char *arg)
+/*
+ * Parse the given string as either C or English (based on input_mode),
+ * then print the result as either C or English (based on output_mode).
+ */
+int run_command_cdecl(const char *s, int input_mode, int output_mode)