Mercurial > hg > toybox
diff lib/lib.c @ 715:3417db95f24b
Add expand command as described in POSIX-2008.
Erratum: Do not handle backspace.
author | Jonathan Clairembault <jonathan@clairembault.fr> |
---|---|
date | Fri, 23 Nov 2012 00:06:28 +0100 |
parents | 50d759f8b371 |
children | 075eaff297f8 |
line wrap: on
line diff
--- a/lib/lib.c Mon Nov 26 23:36:25 2012 -0600 +++ b/lib/lib.c Fri Nov 23 00:06:28 2012 +0100 @@ -1182,6 +1182,17 @@ return NULL; //not reached } +// strtoul with exit on error +unsigned long xstrtoul(const char *nptr, char **endptr, int base) +{ + unsigned long l; + errno = 0; + l = strtoul(nptr, endptr, base); + if (errno) + perror_exit("xstrtoul"); + return l; +} + /* * used to get the interger value. */