MCPcopy Create free account
hub / github.com/eggert/tz / arg2num

Function arg2num

zic.c:747–759  ·  view source on GitHub ↗

Convert ARG, a string in base BASE, to an unsigned long value no greater than MAXVAL. On failure, diagnose with MSGID and exit. */

Source from the content-addressed store, hash-verified

745
746/* Convert ARG, a string in base BASE, to an unsigned long value no
747 greater than MAXVAL. On failure, diagnose with MSGID and exit. */
748static unsigned long
749arg2num(char const *arg, int base, unsigned long maxval, char const *msgid)
750{
751 unsigned long n;
752 char *ep;
753 errno = 0;
754 n = strtoul(arg, &ep, base);
755 if (ep == arg || *ep || maxval < n || errno) {
756 fprintf(stderr, _(msgid), progname, arg);
757 exit(EXIT_FAILURE);
758 }
759 return n;
760}
761
762#ifndef MODE_T_MAX

Callers 3

mode_optionFunction · 0.85
group_optionFunction · 0.85
owner_optionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected