#include <errno.h>
#include <stdbool.h>
#include <assert.h>
+#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
exit(0);
}
+static void of_iassign(const struct cmdinfo *ci, const char *val) {
+ long v;
+ char *ep;
+ errno= 0; v= strtol(val,&ep,10);
+ if (!*val || *ep || errno || v<INT_MIN || v>INT_MAX)
+ badusage("bad integer argument `%s' for --%s",val,ci->olong);
+ *ci->iassignto = v;
+}
+
#define MAX_OPTS 5
static const struct cmdinfo cmdinfos[]= {
{ "help", 0, .call= of_help },
{ 0, 'g', 1, .sassignto= &ident },
- { 0, 'M', 1, .iassignto= &numservers },
+ { 0, 'M', 1, .call=of_iassign, .iassignto= &numservers },
{ 0 }
};