+static int ubus_cli_error(char *cmd, int argc, char **argv, int err)
+{
+ int i;
+
+ if (!simple_output && !isatty(fileno(stderr))) {
+ fprintf(stderr, "Command failed: ubus %s ", cmd);
+ for (i = 0; i < argc; i++) {
+ fprintf(stderr, "%s ", argv[i]);
+ }
+ fprintf(stderr, "(%s)\n", ubus_strerror(err));
+
+ return -err;
+ }
+
+ return err;
+}
+