{
if (errctx)
*errctx = NULL;
+ assert(min_argc <= max_argc);
if (lpr->num_inputs < min_argc) {
- xasprintf(errctx, "at least %u non-option args required, "
- "%u given", min_argc, lpr->num_inputs);
+ xasprintf(errctx, "%s %u non-option args required, %u given",
+ min_argc < max_argc? "at least" : "exactly",
+ min_argc, lpr->num_inputs);
return -E_LLS_BAD_ARG_COUNT;
}
if (lpr->num_inputs > max_argc) {
xasprintf(errctx, "no non-option args allowed, "
"%u given", lpr->num_inputs);
else
- xasprintf(errctx, "at most %u non-option args allowed, "
- "%u given", max_argc, lpr->num_inputs);
+ xasprintf(errctx, "%s %u non-option args allowed, "
+ "%u given", min_argc < max_argc?
+ "at most" : "exactly",
+ max_argc, lpr->num_inputs);
return -E_LLS_BAD_ARG_COUNT;
}
return 1;