afs_event(AUDIO_FILE_REMOVE, &crd->pb, row);
ret = osl(osl_del_row(audio_file_table, row));
if (ret < 0)
- para_printf(&crd->pb, "%s: %s\n", name, para_strerror(-ret));
+ para_printf(&crd->pb, "cannot remove %s\n", name);
return ret;
}
if (crd.flags & RM_FLAG_FNM_PATHNAME)
pmd.fnmatch_flags |= FNM_PATHNAME;
ret = for_each_matching_row(&pmd);
- if (ret < 0) {
- para_printf(&crd.pb, "%s\n", para_strerror(-ret));
- return 0;
- }
- if ((pmd.num_matches == 0) && !(crd.flags & RM_FLAG_FORCE))
- para_printf(&crd.pb, "no matches -- nothing removed\n");
+ if (ret < 0)
+ goto out;
+ if (pmd.num_matches == 0)
+ ret = -E_NO_MATCH;
else if (crd.flags & RM_FLAG_VERBOSE)
- para_printf(&crd.pb, "removed %u files\n", pmd.num_matches);
+ para_printf(&crd.pb, "removed %u file(s)\n", pmd.num_matches);
+out:
flush_and_free_pb(&crd.pb);
- return 0;
+ return ret;
}
/* TODO options: -r (recursive) */
{
uint32_t flags = 0;
struct osl_object query = {.data = &flags, .size = sizeof(flags)};
- int i, ret;
+ int i;
for (i = 1; i < cc->argc; i++) {
const char *arg = cc->argv[i];
}
if (i >= cc->argc)
return -E_AFT_SYNTAX;
- ret = send_option_arg_callback_request(&query, cc->argc - i,
+ return send_option_arg_callback_request(&query, cc->argc - i,
cc->argv + i, com_rm_callback, afs_cb_result_handler, cc);
- if (ret < 0)
- send_strerror(cc, -ret);
- return ret;
}
/**