Module Name: src
Committed By: snj
Date: Wed Apr 22 07:18:58 UTC 2015
Modified Files:
src/distrib/sets/lists/base [netbsd-7]: ad.aarch64 ad.arm ad.mips
ad.powerpc md.amd64 md.sparc64 shl.mi
src/distrib/sets/lists/comp [netbsd-7]: mi
src/distrib/sets/lists/debug [netbsd-7]: ad.aarch64 ad.arm ad.mips
ad.powerpc md.amd64 md.sparc64 shl.mi
src/include [netbsd-7]: inttypes.h
src/lib/libc [netbsd-7]: shlib_version
src/lib/libc/stdlib [netbsd-7]: Makefile.inc strtol.3 strtoul.3
src/sys/lib/libkern [netbsd-7]: Makefile.libkern libkern.h
src/tools/compat [netbsd-7]: Makefile compat_defs.h configure
configure.ac nbtool_config.h.in
Added Files:
src/common/lib/libc/stdlib [netbsd-7]: _strtoi.h strtoi.c strtou.c
Log Message:
Pull up following revision(s) (requested by roy in ticket #648):
common/lib/libc/stdlib/_strtoi.h: revisions 1.1, 1.2
common/lib/libc/stdlib/strtoi.c: revision 1.1
common/lib/libc/stdlib/strtou.c: revision 1.1
distrib/sets/lists/base/ad.aarch64: patch
distrib/sets/lists/base/ad.arm: patch
distrib/sets/lists/base/ad.mips: patch
distrib/sets/lists/base/ad.powerpc: patch
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
distrib/sets/lists/comp/mi: revision 1.1939
distrib/sets/lists/debug/ad.aarch64: patch
distrib/sets/lists/debug/ad.arm: patch
distrib/sets/lists/debug/ad.mips: patch
distrib/sets/lists/debug/ad.powerpc: patch
distrib/sets/lists/debug/md.amd64: patch
distrib/sets/lists/debug/md.sparc64: patch
distrib/sets/lists/debug/shl.mi: patch
include/inttypes.h: revision 1.11
lib/libc/shlib_version: patch
lib/libc/stdlib/Makefile.inc: revision 1.84
lib/libc/stdlib/strtol.3: revisions 1.27-1.31
lib/libc/stdlib/strtoul.3: revisions 1.26-1.29
sys/lib/libkern/Makefile.libkern: revision 1.37
sys/lib/libkern/libkern.h: revision 1.117
tools/compat/Makefile: revision 1.73
tools/compat/compat_defs.h: revision 1.101
tools/compat/configure.ac: revision 1.83
tools/compat/configure: revision 1.82
tools/compat/nbtool_config.h.in: revision 1.36
add strto{i,u} from Kamil Rytarowski as discussed in tech-userlevel.
--
strtoi and strtou additions
--
strtoi and strtou for the kernel
--
strtoi and strtou additions
--
strtoi and strtou man pages
--
strto{i,u}
--
regen
--
Remove trailing whitespace.
--
match variable names with man page (Kamil Rytarowski)
--
cleanups from (Kamil Rytarowski)
--
add strtoi strtou (Kamil Rytarowski)
--
PR/49640: Kamil Rytarowski: Improve error printing
--
Use existing month for Dd.
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.2.2.2 src/common/lib/libc/stdlib/_strtoi.h
cvs rdiff -u -r0 -r1.1.2.2 src/common/lib/libc/stdlib/strtoi.c \
src/common/lib/libc/stdlib/strtou.c
cvs rdiff -u -r1.2.2.3 -r1.2.2.4 src/distrib/sets/lists/base/ad.aarch64
cvs rdiff -u -r1.54.2.5 -r1.54.2.6 src/distrib/sets/lists/base/ad.arm
cvs rdiff -u -r1.48.2.5 -r1.48.2.6 src/distrib/sets/lists/base/ad.mips
cvs rdiff -u -r1.17.2.4 -r1.17.2.5 src/distrib/sets/lists/base/ad.powerpc
cvs rdiff -u -r1.244.2.5 -r1.244.2.6 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.232.2.5 -r1.232.2.6 src/distrib/sets/lists/base/md.sparc64
cvs rdiff -u -r1.712.2.5 -r1.712.2.6 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.1906.2.4 -r1.1906.2.5 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.2.2.4 -r1.2.2.5 src/distrib/sets/lists/debug/ad.aarch64
cvs rdiff -u -r1.42.2.5 -r1.42.2.6 src/distrib/sets/lists/debug/ad.arm
cvs rdiff -u -r1.38.2.5 -r1.38.2.6 src/distrib/sets/lists/debug/ad.mips
cvs rdiff -u -r1.18.2.5 -r1.18.2.6 src/distrib/sets/lists/debug/ad.powerpc
cvs rdiff -u -r1.63.2.5 -r1.63.2.6 src/distrib/sets/lists/debug/md.amd64
cvs rdiff -u -r1.61.2.5 -r1.61.2.6 src/distrib/sets/lists/debug/md.sparc64
cvs rdiff -u -r1.71.2.9 -r1.71.2.10 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.10 -r1.10.6.1 src/include/inttypes.h
cvs rdiff -u -r1.254 -r1.254.2.1 src/lib/libc/shlib_version
cvs rdiff -u -r1.82 -r1.82.2.1 src/lib/libc/stdlib/Makefile.inc
cvs rdiff -u -r1.26 -r1.26.24.1 src/lib/libc/stdlib/strtol.3
cvs rdiff -u -r1.25 -r1.25.24.1 src/lib/libc/stdlib/strtoul.3
cvs rdiff -u -r1.35 -r1.35.2.1 src/sys/lib/libkern/Makefile.libkern
cvs rdiff -u -r1.115 -r1.115.2.1 src/sys/lib/libkern/libkern.h
cvs rdiff -u -r1.72 -r1.72.4.1 src/tools/compat/Makefile
cvs rdiff -u -r1.97.2.1 -r1.97.2.2 src/tools/compat/compat_defs.h
cvs rdiff -u -r1.81 -r1.81.2.1 src/tools/compat/configure
cvs rdiff -u -r1.82 -r1.82.2.1 src/tools/compat/configure.ac
cvs rdiff -u -r1.35 -r1.35.2.1 src/tools/compat/nbtool_config.h.in
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/base/ad.aarch64
diff -u src/distrib/sets/lists/base/ad.aarch64:1.2.2.3 src/distrib/sets/lists/base/ad.aarch64:1.2.2.4
--- src/distrib/sets/lists/base/ad.aarch64:1.2.2.3 Fri Jan 16 08:24:50 2015
+++ src/distrib/sets/lists/base/ad.aarch64 Wed Apr 22 07:18:57 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ad.aarch64,v 1.2.2.3 2015/01/16 08:24:50 martin Exp $
+# $NetBSD: ad.aarch64,v 1.2.2.4 2015/04/22 07:18:57 snj Exp $
./lib/eabi base-compat-shlib compat
./lib/eabi/npf base-npf-shlib compat
./lib/eabi/npf/ext_log.so base-npf-shlib compat,pic
@@ -108,7 +108,7 @@
./usr/lib/eabi/libc++.so.1 base-compat-shlib compat,pic,libcxx
./usr/lib/eabi/libc++.so.1.0 base-compat-shlib compat,pic,libcxx
./usr/lib/eabi/libc.so.12 base-compat-shlib compat,pic
-./usr/lib/eabi/libc.so.12.193 base-compat-shlib compat,pic
+./usr/lib/eabi/libc.so.12.193.1 base-compat-shlib compat,pic
./usr/lib/eabi/libcom_err.so.7 base-compat-shlib compat,pic,kerberos
./usr/lib/eabi/libcom_err.so.7.0 base-compat-shlib compat,pic,kerberos
./usr/lib/eabi/libcrypt.so.1 base-compat-shlib compat,pic
@@ -422,7 +422,7 @@
#./usr/lib/eabihf/libc++.so.1 base-compat-shlib compat,pic,libcxx
#./usr/lib/eabihf/libc++.so.1.0 base-compat-shlib compat,pic,libcxx
#./usr/lib/eabihf/libc.so.12 base-compat-shlib compat,pic
-#./usr/lib/eabihf/libc.so.12.193 base-compat-shlib compat,pic
+#./usr/lib/eabihf/libc.so.12.193.1 base-compat-shlib compat,pic
#./usr/lib/eabihf/libcom_err.so.7 base-compat-shlib compat,pic,kerberos
#./usr/lib/eabihf/libcom_err.so.7.0 base-compat-shlib compat,pic,kerberos
#./usr/lib/eabihf/libcrypt.so.1 base-compat-shlib compat,pic
@@ -736,7 +736,7 @@
./usr/lib/oabi/libc++.so.1 base-compat-shlib compat,pic,libcxx
./usr/lib/oabi/libc++.so.1.0 base-compat-shlib compat,pic,libcxx
./usr/lib/oabi/libc.so.12 base-compat-shlib compat,pic
-./usr/lib/oabi/libc.so.12.193 base-compat-shlib compat,pic
+./usr/lib/oabi/libc.so.12.193.1 base-compat-shlib compat,pic
./usr/lib/oabi/libcom_err.so.7 base-compat-shlib compat,pic,kerberos
./usr/lib/oabi/libcom_err.so.7.0 base-compat-shlib compat,pic,kerberos
./usr/lib/oabi/libcrypt.so.1 base-compat-shlib compat,pic
Index: src/distrib/sets/lists/base/ad.arm
diff -u src/distrib/sets/lists/base/ad.arm:1.54.2.5 src/distrib/sets/lists/base/ad.arm:1.54.2.6
--- src/distrib/sets/lists/base/ad.arm:1.54.2.5 Sun Feb 8 22:15:02 2015
+++ src/distrib/sets/lists/base/ad.arm Wed Apr 22 07:18:57 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ad.arm,v 1.54.2.5 2015/02/08 22:15:02 snj Exp $
+# $NetBSD: ad.arm,v 1.54.2.6 2015/04/22 07:18:57 snj Exp $
./lib/oabi base-compat-shlib compat
./lib/oabi/npf base-npf-shlib compat
./lib/oabi/npf/ext_log.so base-npf-shlib compat,pic
@@ -94,7 +94,7 @@
./usr/lib/oabi/libc++.so.1 base-compat-shlib compat,pic,libcxx
./usr/lib/oabi/libc++.so.1.0 base-compat-shlib compat,pic,libcxx
./usr/lib/oabi/libc.so.12 base-compat-shlib compat,pic
-./usr/lib/oabi/libc.so.12.193 base-compat-shlib compat,pic
+./usr/lib/oabi/libc.so.12.193.1 base-compat-shlib compat,pic
./usr/lib/oabi/libc_vfp.so.0 base-compat-shlib compat,pic
./usr/lib/oabi/libc_vfp.so.0.0 base-compat-shlib compat,pic
./usr/lib/oabi/libcom_err.so.7 base-compat-shlib compat,pic,kerberos
Index: src/distrib/sets/lists/base/ad.mips
diff -u src/distrib/sets/lists/base/ad.mips:1.48.2.5 src/distrib/sets/lists/base/ad.mips:1.48.2.6
--- src/distrib/sets/lists/base/ad.mips:1.48.2.5 Sun Feb 8 22:15:02 2015
+++ src/distrib/sets/lists/base/ad.mips Wed Apr 22 07:18:57 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips,v 1.48.2.5 2015/02/08 22:15:02 snj Exp $
+# $NetBSD: ad.mips,v 1.48.2.6 2015/04/22 07:18:57 snj Exp $
./lib/64 base-compat-shlib compat,arch64
./lib/64/npf base-npf-shlib compat,arch64
./lib/64/npf/ext_log.so base-npf-shlib compat,pic,arch64
@@ -96,7 +96,7 @@
./usr/lib/64/libc++.so.1 base-compat-shlib compat,pic,libcxx,arch64
./usr/lib/64/libc++.so.1.0 base-compat-shlib compat,pic,libcxx,arch64
./usr/lib/64/libc.so.12 base-compat-shlib compat,pic,arch64
-./usr/lib/64/libc.so.12.193 base-compat-shlib compat,pic,arch64
+./usr/lib/64/libc.so.12.193.1 base-compat-shlib compat,pic,arch64
./usr/lib/64/libcom_err.so.7 base-compat-shlib compat,pic,kerberos,arch64
./usr/lib/64/libcom_err.so.7.0 base-compat-shlib compat,pic,kerberos,arch64
./usr/lib/64/libcrypt.so.1 base-compat-shlib compat,pic,arch64
@@ -444,7 +444,7 @@
./usr/lib/o32/libc++.so.1 base-compat-shlib compat,pic,libcxx,arch64
./usr/lib/o32/libc++.so.1.0 base-compat-shlib compat,pic,libcxx,arch64
./usr/lib/o32/libc.so.12 base-compat-shlib compat,pic,arch64
-./usr/lib/o32/libc.so.12.193 base-compat-shlib compat,pic,arch64
+./usr/lib/o32/libc.so.12.193.1 base-compat-shlib compat,pic,arch64
./usr/lib/o32/libcom_err.so.7 base-compat-shlib compat,pic,kerberos,arch64
./usr/lib/o32/libcom_err.so.7.0 base-compat-shlib compat,pic,kerberos,arch64
./usr/lib/o32/libcrypt.so.1 base-compat-shlib compat,pic,arch64
Index: src/distrib/sets/lists/base/ad.powerpc
diff -u src/distrib/sets/lists/base/ad.powerpc:1.17.2.4 src/distrib/sets/lists/base/ad.powerpc:1.17.2.5
--- src/distrib/sets/lists/base/ad.powerpc:1.17.2.4 Sun Jan 25 00:19:24 2015
+++ src/distrib/sets/lists/base/ad.powerpc Wed Apr 22 07:18:57 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ad.powerpc,v 1.17.2.4 2015/01/25 00:19:24 martin Exp $
+# $NetBSD: ad.powerpc,v 1.17.2.5 2015/04/22 07:18:57 snj Exp $
./lib/powerpc base-npf-shlib compat,arch64
./lib/powerpc/npf base-npf-shlib compat,arch64
./lib/powerpc/npf/ext_log.so base-npf-shlib compat,arch64,pic
@@ -85,7 +85,7 @@
./usr/lib/powerpc/libc++.so.1 base-compat-shlib compat,arch64,pic,libcxx
./usr/lib/powerpc/libc++.so.1.0 base-compat-shlib compat,arch64,pic,libcxx
./usr/lib/powerpc/libc.so.12 base-compat-shlib compat,arch64,pic
-./usr/lib/powerpc/libc.so.12.193 base-compat-shlib compat,arch64,pic
+./usr/lib/powerpc/libc.so.12.193.1 base-compat-shlib compat,arch64,pic
./usr/lib/powerpc/libcom_err.so.7 base-compat-shlib compat,arch64,pic,kerberos
./usr/lib/powerpc/libcom_err.so.7.0 base-compat-shlib compat,arch64,pic,kerberos
./usr/lib/powerpc/libcrypt.so.1 base-compat-shlib compat,arch64,pic
Index: src/distrib/sets/lists/base/md.amd64
diff -u src/distrib/sets/lists/base/md.amd64:1.244.2.5 src/distrib/sets/lists/base/md.amd64:1.244.2.6
--- src/distrib/sets/lists/base/md.amd64:1.244.2.5 Sun Feb 8 22:15:02 2015
+++ src/distrib/sets/lists/base/md.amd64 Wed Apr 22 07:18:57 2015
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.244.2.5 2015/02/08 22:15:02 snj Exp $
+# $NetBSD: md.amd64,v 1.244.2.6 2015/04/22 07:18:57 snj Exp $
./dev/lms0 base-obsolete obsolete
./dev/mms0 base-obsolete obsolete
./lib/i386 base-compat-shlib compat
@@ -88,7 +88,7 @@
./usr/lib/i386/libc++.so.1 base-compat-shlib compat,pic,libcxx
./usr/lib/i386/libc++.so.1.0 base-compat-shlib compat,pic,libcxx
./usr/lib/i386/libc.so.12 base-compat-shlib compat,pic
-./usr/lib/i386/libc.so.12.193 base-compat-shlib compat,pic
+./usr/lib/i386/libc.so.12.193.1 base-compat-shlib compat,pic
./usr/lib/i386/libcom_err.so.7 base-compat-shlib compat,pic,kerberos
./usr/lib/i386/libcom_err.so.7.0 base-compat-shlib compat,pic,kerberos
./usr/lib/i386/libcrypt.so.1 base-compat-shlib compat,pic
Index: src/distrib/sets/lists/base/md.sparc64
diff -u src/distrib/sets/lists/base/md.sparc64:1.232.2.5 src/distrib/sets/lists/base/md.sparc64:1.232.2.6
--- src/distrib/sets/lists/base/md.sparc64:1.232.2.5 Sun Feb 8 22:15:02 2015
+++ src/distrib/sets/lists/base/md.sparc64 Wed Apr 22 07:18:57 2015
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.232.2.5 2015/02/08 22:15:02 snj Exp $
+# $NetBSD: md.sparc64,v 1.232.2.6 2015/04/22 07:18:57 snj Exp $
./lib/sparc base-npf-shlib compat
./lib/sparc/npf base-npf-shlib compat
./lib/sparc/npf/ext_log.so base-npf-shlib compat,pic
@@ -86,7 +86,7 @@
./usr/lib/sparc/libc++.so.1 base-compat-shlib compat,pic,libcxx
./usr/lib/sparc/libc++.so.1.0 base-compat-shlib compat,pic,libcxx
./usr/lib/sparc/libc.so.12 base-compat-shlib compat,pic
-./usr/lib/sparc/libc.so.12.193 base-compat-shlib compat,pic
+./usr/lib/sparc/libc.so.12.193.1 base-compat-shlib compat,pic
./usr/lib/sparc/libcom_err.so.7 base-compat-shlib compat,pic,kerberos
./usr/lib/sparc/libcom_err.so.7.0 base-compat-shlib compat,pic,kerberos
./usr/lib/sparc/libcrypt.so.1 base-compat-shlib compat,pic
Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.712.2.5 src/distrib/sets/lists/base/shl.mi:1.712.2.6
--- src/distrib/sets/lists/base/shl.mi:1.712.2.5 Sun Jan 25 00:19:24 2015
+++ src/distrib/sets/lists/base/shl.mi Wed Apr 22 07:18:57 2015
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.712.2.5 2015/01/25 00:19:24 martin Exp $
+# $NetBSD: shl.mi,v 1.712.2.6 2015/04/22 07:18:57 snj Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@@ -15,7 +15,7 @@
#
./lib/libc.so base-sys-shlib dynamicroot
./lib/libc.so.12 base-sys-shlib dynamicroot
-./lib/libc.so.12.193 base-sys-shlib dynamicroot
+./lib/libc.so.12.193.1 base-sys-shlib dynamicroot
./lib/libcrypt.so base-sys-shlib dynamicroot
./lib/libcrypt.so.1 base-sys-shlib dynamicroot
./lib/libcrypt.so.1.0 base-sys-shlib dynamicroot
@@ -203,7 +203,7 @@
./usr/lib/libc++.so.1.0 base-sys-shlib libcxx
./usr/lib/libc.so base-sys-shlib
./usr/lib/libc.so.12 base-sys-shlib
-./usr/lib/libc.so.12.193 base-sys-shlib
+./usr/lib/libc.so.12.193.1 base-sys-shlib
./usr/lib/libcdk.so base-obsolete obsolete
./usr/lib/libcom_err.so base-krb5-shlib kerberos
./usr/lib/libcom_err.so.7 base-krb5-shlib kerberos
Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1906.2.4 src/distrib/sets/lists/comp/mi:1.1906.2.5
--- src/distrib/sets/lists/comp/mi:1.1906.2.4 Sun Jan 25 00:19:24 2015
+++ src/distrib/sets/lists/comp/mi Wed Apr 22 07:18:57 2015
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1906.2.4 2015/01/25 00:19:24 martin Exp $
+# $NetBSD: mi,v 1.1906.2.5 2015/04/22 07:18:57 snj Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -9171,6 +9171,7 @@
./usr/share/man/cat3/strsvisx.0 comp-c-catman .cat
./usr/share/man/cat3/strtod.0 comp-c-catman .cat
./usr/share/man/cat3/strtof.0 comp-c-catman .cat
+./usr/share/man/cat3/strtoi.0 comp-c-catman .cat
./usr/share/man/cat3/strtoimax.0 comp-c-catman .cat
./usr/share/man/cat3/strtok.0 comp-c-catman .cat
./usr/share/man/cat3/strtok_r.0 comp-c-catman .cat
@@ -9178,6 +9179,7 @@
./usr/share/man/cat3/strtold.0 comp-c-catman .cat
./usr/share/man/cat3/strtoll.0 comp-c-catman .cat
./usr/share/man/cat3/strtoq.0 comp-c-catman .cat
+./usr/share/man/cat3/strtou.0 comp-c-catman .cat
./usr/share/man/cat3/strtoul.0 comp-c-catman .cat
./usr/share/man/cat3/strtoull.0 comp-c-catman .cat
./usr/share/man/cat3/strtoumax.0 comp-c-catman .cat
@@ -15962,6 +15964,7 @@
./usr/share/man/html3/strsvisx.html comp-c-htmlman html
./usr/share/man/html3/strtod.html comp-c-htmlman html
./usr/share/man/html3/strtof.html comp-c-htmlman html
+./usr/share/man/html3/strtoi.html comp-c-htmlman html
./usr/share/man/html3/strtoimax.html comp-c-htmlman html
./usr/share/man/html3/strtok.html comp-c-htmlman html
./usr/share/man/html3/strtok_r.html comp-c-htmlman html
@@ -15969,6 +15972,7 @@
./usr/share/man/html3/strtold.html comp-c-htmlman html
./usr/share/man/html3/strtoll.html comp-c-htmlman html
./usr/share/man/html3/strtoq.html comp-c-htmlman html
+./usr/share/man/html3/strtou.html comp-c-htmlman html
./usr/share/man/html3/strtoul.html comp-c-htmlman html
./usr/share/man/html3/strtoull.html comp-c-htmlman html
./usr/share/man/html3/strtoumax.html comp-c-htmlman html
@@ -22789,6 +22793,7 @@
./usr/share/man/man3/strsvisx.3 comp-c-man .man
./usr/share/man/man3/strtod.3 comp-c-man .man
./usr/share/man/man3/strtof.3 comp-c-man .man
+./usr/share/man/man3/strtoi.3 comp-c-man .man
./usr/share/man/man3/strtoimax.3 comp-c-man .man
./usr/share/man/man3/strtok.3 comp-c-man .man
./usr/share/man/man3/strtok_r.3 comp-c-man .man
@@ -22796,6 +22801,7 @@
./usr/share/man/man3/strtold.3 comp-c-man .man
./usr/share/man/man3/strtoll.3 comp-c-man .man
./usr/share/man/man3/strtoq.3 comp-c-man .man
+./usr/share/man/man3/strtou.3 comp-c-man .man
./usr/share/man/man3/strtoul.3 comp-c-man .man
./usr/share/man/man3/strtoull.3 comp-c-man .man
./usr/share/man/man3/strtoumax.3 comp-c-man .man
Index: src/distrib/sets/lists/debug/ad.aarch64
diff -u src/distrib/sets/lists/debug/ad.aarch64:1.2.2.4 src/distrib/sets/lists/debug/ad.aarch64:1.2.2.5
--- src/distrib/sets/lists/debug/ad.aarch64:1.2.2.4 Sat Jan 17 11:16:39 2015
+++ src/distrib/sets/lists/debug/ad.aarch64 Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ad.aarch64,v 1.2.2.4 2015/01/17 11:16:39 martin Exp $
+# $NetBSD: ad.aarch64,v 1.2.2.5 2015/04/22 07:18:58 snj Exp $
-./usr/libdata/debug/usr/tests/lib/libc/gen/t_fpsetmask.debug
-./usr/libdata/debug/usr/tests/lib/libc/gen/t_fpsetround.debug
./usr/lib/eabi/libcrypto_g.a comp-c-debuglib compat,crypto,debuglib
@@ -66,7 +66,7 @@
./usr/libdata/debug/usr/lib/eabi/libbluetooth.so.4.2.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/eabi/libbsdmalloc.so.0.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/eabi/libbz2.so.1.1.debug comp-sys-debug debug,compat
-./usr/libdata/debug/usr/lib/eabi/libc.so.12.193.debug comp-sys-debug debug,compat
+./usr/libdata/debug/usr/lib/eabi/libc.so.12.193.1.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/eabi/libcom_err.so.7.0.debug comp-compat-shlib compat,pic,kerberos,debug
./usr/libdata/debug/usr/lib/eabi/libcrypt.so.1.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/eabi/libcrypto.so.8.4.debug comp-crypto-debug crypto,debug,compat
@@ -218,7 +218,7 @@
#./usr/libdata/debug/usr/lib/eabihf/libbluetooth.so.4.2.debug comp-sys-debug debug,compat
#./usr/libdata/debug/usr/lib/eabihf/libbsdmalloc.so.0.0.debug comp-sys-debug debug,compat
#./usr/libdata/debug/usr/lib/eabihf/libbz2.so.1.1.debug comp-sys-debug debug,compat
-#./usr/libdata/debug/usr/lib/eabihf/libc.so.12.193.debug comp-sys-debug debug,compat
+#./usr/libdata/debug/usr/lib/eabihf/libc.so.12.193.1.debug comp-sys-debug debug,compat
#./usr/libdata/debug/usr/lib/eabihf/libcom_err.so.7.0.debug comp-compat-shlib compat,pic,kerberos,debug
#./usr/libdata/debug/usr/lib/eabihf/libcrypt.so.1.0.debug comp-sys-debug debug,compat
#./usr/libdata/debug/usr/lib/eabihf/libcrypto.so.8.4.debug comp-crypto-debug crypto,debug,compat
@@ -370,7 +370,7 @@
./usr/libdata/debug/usr/lib/oabi/libbluetooth.so.4.2.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/oabi/libbsdmalloc.so.0.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/oabi/libbz2.so.1.1.debug comp-sys-debug debug,compat
-./usr/libdata/debug/usr/lib/oabi/libc.so.12.193.debug comp-sys-debug debug,compat
+./usr/libdata/debug/usr/lib/oabi/libc.so.12.193.1.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/oabi/libcom_err.so.7.0.debug comp-compat-shlib compat,pic,kerberos,debug
./usr/libdata/debug/usr/lib/oabi/libcrypt.so.1.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/oabi/libcrypto.so.8.4.debug comp-crypto-debug crypto,debug,compat
Index: src/distrib/sets/lists/debug/ad.arm
diff -u src/distrib/sets/lists/debug/ad.arm:1.42.2.5 src/distrib/sets/lists/debug/ad.arm:1.42.2.6
--- src/distrib/sets/lists/debug/ad.arm:1.42.2.5 Sun Feb 8 22:15:02 2015
+++ src/distrib/sets/lists/debug/ad.arm Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ad.arm,v 1.42.2.5 2015/02/08 22:15:02 snj Exp $
+# $NetBSD: ad.arm,v 1.42.2.6 2015/04/22 07:18:58 snj Exp $
./usr/lib/libarm_g.a comp-c-debuglib debuglib
./usr/lib/libc_vfp_g.a comp-c-debuglib debuglib,softfloat
./usr/lib/libpmc_g.a comp-c-debuglib debuglib
@@ -66,7 +66,7 @@
./usr/libdata/debug/usr/lib/oabi/libbsdmalloc.so.0.0.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/oabi/libbz2.so.1.1.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/oabi/libc++.so.1.0.debug comp-sys-debug debug,compat,pic,libcxx
-./usr/libdata/debug/usr/lib/oabi/libc.so.12.193.debug comp-sys-debug debug,compat
+./usr/libdata/debug/usr/lib/oabi/libc.so.12.193.1.debug comp-sys-debug debug,compat
./usr/libdata/debug/usr/lib/oabi/libc_vfp.so.0.0.debug comp-sys-debug debug,compat,pic
./usr/libdata/debug/usr/lib/oabi/libcom_err.so.6.0.debug comp-compat-shlib compat,pic,kerberos,debug,obsolete
./usr/libdata/debug/usr/lib/oabi/libcom_err.so.7.0.debug comp-compat-shlib compat,pic,kerberos,debug
Index: src/distrib/sets/lists/debug/ad.mips
diff -u src/distrib/sets/lists/debug/ad.mips:1.38.2.5 src/distrib/sets/lists/debug/ad.mips:1.38.2.6
--- src/distrib/sets/lists/debug/ad.mips:1.38.2.5 Sun Feb 8 22:15:02 2015
+++ src/distrib/sets/lists/debug/ad.mips Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips,v 1.38.2.5 2015/02/08 22:15:02 snj Exp $
+# $NetBSD: ad.mips,v 1.38.2.6 2015/04/22 07:18:58 snj Exp $
./usr/lib/64/libcrypto_g.a comp-c-debuglib compat,crypto,debuglib,arch64
./usr/lib/64/libcrypto_idea_g.a comp-obsolete obsolete
./usr/lib/64/libcrypto_mdc2_g.a comp-obsolete obsolete
@@ -72,7 +72,7 @@
./usr/libdata/debug/usr/lib/64/libbluetooth.so.4.2.debug comp-sys-debug debug,compat,arch64
./usr/libdata/debug/usr/lib/64/libbsdmalloc.so.0.0.debug comp-sys-debug debug,compat,arch64
./usr/libdata/debug/usr/lib/64/libbz2.so.1.1.debug comp-sys-debug debug,compat,arch64
-./usr/libdata/debug/usr/lib/64/libc.so.12.193.debug comp-sys-debug debug,compat,arch64
+./usr/libdata/debug/usr/lib/64/libc.so.12.193.1.debug comp-sys-debug debug,compat,arch64
./usr/libdata/debug/usr/lib/64/libcom_err.so.6.0.debug comp-compat-shlib compat,pic,kerberos,debug,obsolete,arch64
./usr/libdata/debug/usr/lib/64/libcom_err.so.7.0.debug comp-compat-shlib compat,pic,kerberos,debug,arch64
./usr/libdata/debug/usr/lib/64/libcrypt.so.1.0.debug comp-sys-debug debug,compat,arch64
@@ -250,7 +250,7 @@
./usr/libdata/debug/usr/lib/o32/libbluetooth.so.4.2.debug comp-sys-debug debug,compat,arch64
./usr/libdata/debug/usr/lib/o32/libbsdmalloc.so.0.0.debug comp-sys-debug debug,compat,arch64
./usr/libdata/debug/usr/lib/o32/libbz2.so.1.1.debug comp-sys-debug debug,compat,arch64
-./usr/libdata/debug/usr/lib/o32/libc.so.12.193.debug comp-sys-debug debug,compat,arch64
+./usr/libdata/debug/usr/lib/o32/libc.so.12.193.1.debug comp-sys-debug debug,compat,arch64
./usr/libdata/debug/usr/lib/o32/libcom_err.so.6.0.debug comp-compat-shlib compat,pic,kerberos,debug,obsolete,arch64
./usr/libdata/debug/usr/lib/o32/libcom_err.so.7.0.debug comp-compat-shlib compat,pic,kerberos,debug,arch64
./usr/libdata/debug/usr/lib/o32/libcrypt.so.1.0.debug comp-sys-debug debug,compat,arch64
Index: src/distrib/sets/lists/debug/ad.powerpc
diff -u src/distrib/sets/lists/debug/ad.powerpc:1.18.2.5 src/distrib/sets/lists/debug/ad.powerpc:1.18.2.6
--- src/distrib/sets/lists/debug/ad.powerpc:1.18.2.5 Sun Feb 8 22:15:02 2015
+++ src/distrib/sets/lists/debug/ad.powerpc Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ad.powerpc,v 1.18.2.5 2015/02/08 22:15:02 snj Exp $
+# $NetBSD: ad.powerpc,v 1.18.2.6 2015/04/22 07:18:58 snj Exp $
./usr/lib/powerpc/libamu_g.a comp-c-debuglib compat,arch64,debuglib
./usr/lib/powerpc/libarchive_g.a comp-c-debuglib compat,arch64,debuglib
./usr/lib/powerpc/libasan_g.a comp-c-debuglib compat,arch64,debuglib,gcc=48
@@ -156,7 +156,7 @@
./usr/libdata/debug/usr/lib/powerpc/libbluetooth.so.4.2.debug comp-compat-shlib compat,arch64,debug,pic
./usr/libdata/debug/usr/lib/powerpc/libbsdmalloc.so.0.0.debug comp-compat-shlib compat,arch64,debug,pic
./usr/libdata/debug/usr/lib/powerpc/libbz2.so.1.1.debug comp-compat-shlib compat,arch64,debug,pic
-./usr/libdata/debug/usr/lib/powerpc/libc.so.12.193.debug comp-compat-shlib compat,arch64,debug,pic
+./usr/libdata/debug/usr/lib/powerpc/libc.so.12.193.1.debug comp-compat-shlib compat,arch64,debug,pic
./usr/libdata/debug/usr/lib/powerpc/libcom_err.so.7.0.debug comp-compat-shlib compat,arch64,debug,pic,kerberos
./usr/libdata/debug/usr/lib/powerpc/libcrypt.so.1.0.debug comp-compat-shlib compat,arch64,debug,pic
./usr/libdata/debug/usr/lib/powerpc/libcrypto.so.8.4.debug comp-compat-shlib compat,arch64,debug,pic,crypto
Index: src/distrib/sets/lists/debug/md.amd64
diff -u src/distrib/sets/lists/debug/md.amd64:1.63.2.5 src/distrib/sets/lists/debug/md.amd64:1.63.2.6
--- src/distrib/sets/lists/debug/md.amd64:1.63.2.5 Sun Feb 8 22:15:02 2015
+++ src/distrib/sets/lists/debug/md.amd64 Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.63.2.5 2015/02/08 22:15:02 snj Exp $
+# $NetBSD: md.amd64,v 1.63.2.6 2015/04/22 07:18:58 snj Exp $
./usr/lib/i386/i18n/libBIG5_g.a comp-c-debuglib compat,debuglib
./usr/lib/i386/i18n/libDECHanyu_g.a comp-c-debuglib compat,debuglib
./usr/lib/i386/i18n/libEUCTW_g.a comp-c-debuglib compat,debuglib
@@ -202,7 +202,7 @@
./usr/libdata/debug/usr/lib/i386/libbsdmalloc.so.0.0.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/i386/libbz2.so.1.1.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/i386/libc++.so.1.0.debug comp-compat-shlib compat,pic,debug,libcxx
-./usr/libdata/debug/usr/lib/i386/libc.so.12.193.debug comp-compat-shlib compat,pic,debug
+./usr/libdata/debug/usr/lib/i386/libc.so.12.193.1.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/i386/libcom_err.so.6.0.debug comp-compat-shlib compat,pic,kerberos,debug,obsolete
./usr/libdata/debug/usr/lib/i386/libcom_err.so.7.0.debug comp-compat-shlib compat,pic,kerberos,debug
./usr/libdata/debug/usr/lib/i386/libcrypt.so.1.0.debug comp-compat-shlib compat,pic,debug
Index: src/distrib/sets/lists/debug/md.sparc64
diff -u src/distrib/sets/lists/debug/md.sparc64:1.61.2.5 src/distrib/sets/lists/debug/md.sparc64:1.61.2.6
--- src/distrib/sets/lists/debug/md.sparc64:1.61.2.5 Sun Feb 8 22:15:02 2015
+++ src/distrib/sets/lists/debug/md.sparc64 Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.61.2.5 2015/02/08 22:15:02 snj Exp $
+# $NetBSD: md.sparc64,v 1.61.2.6 2015/04/22 07:18:58 snj Exp $
./usr/lib/sparc/i18n/libBIG5_g.a comp-obsolete obsolete
./usr/lib/sparc/i18n/libDECHanyu_g.a comp-obsolete obsolete
./usr/lib/sparc/i18n/libEUCTW_g.a comp-obsolete obsolete
@@ -199,7 +199,7 @@
./usr/libdata/debug/usr/lib/sparc/libbluetooth.so.4.2.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/sparc/libbsdmalloc.so.0.0.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/sparc/libbz2.so.1.1.debug comp-compat-shlib compat,pic,debug
-./usr/libdata/debug/usr/lib/sparc/libc.so.12.193.debug comp-compat-shlib compat,pic,debug
+./usr/libdata/debug/usr/lib/sparc/libc.so.12.193.1.debug comp-compat-shlib compat,pic,debug
./usr/libdata/debug/usr/lib/sparc/libcom_err.so.6.0.debug comp-compat-shlib compat,pic,kerberos,debug,obsolete
./usr/libdata/debug/usr/lib/sparc/libcom_err.so.7.0.debug comp-compat-shlib compat,pic,kerberos,debug
./usr/libdata/debug/usr/lib/sparc/libcrypt.so.1.0.debug comp-compat-shlib compat,pic,debug
Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.71.2.9 src/distrib/sets/lists/debug/shl.mi:1.71.2.10
--- src/distrib/sets/lists/debug/shl.mi:1.71.2.9 Sun Jan 25 00:19:25 2015
+++ src/distrib/sets/lists/debug/shl.mi Wed Apr 22 07:18:58 2015
@@ -1,5 +1,5 @@
-# $NetBSD: shl.mi,v 1.71.2.9 2015/01/25 00:19:25 martin Exp $
-./usr/libdata/debug/lib/libc.so.12.193.debug comp-sys-debug debug
+# $NetBSD: shl.mi,v 1.71.2.10 2015/04/22 07:18:58 snj Exp $
+./usr/libdata/debug/lib/libc.so.12.193.1.debug comp-sys-debug debug
./usr/libdata/debug/lib/libcrypt.so.1.0.debug comp-sys-debug debug
./usr/libdata/debug/lib/libcrypto.so.8.4.debug comp-sys-debug debug
./usr/libdata/debug/lib/libdevmapper.so.1.0.debug comp-sys-debug debug
@@ -62,7 +62,7 @@
./usr/libdata/debug/usr/lib/libbsdmalloc.so.0.0.debug comp-sys-debug debug
./usr/libdata/debug/usr/lib/libbz2.so.1.1.debug comp-sys-debug debug
./usr/libdata/debug/usr/lib/libc++.so.1.0.debug comp-sys-debug debug,libcxx
-./usr/libdata/debug/usr/lib/libc.so.12.193.debug comp-sys-debug debug
+./usr/libdata/debug/usr/lib/libc.so.12.193.1.debug comp-sys-debug debug
./usr/libdata/debug/usr/lib/libcom_err.so.7.0.debug comp-krb5-debug kerberos,debug
./usr/libdata/debug/usr/lib/libcrypt.so.1.0.debug comp-sys-debug debug
./usr/libdata/debug/usr/lib/libcrypto.so.8.4.debug comp-crypto-debug crypto,debug
Index: src/include/inttypes.h
diff -u src/include/inttypes.h:1.10 src/include/inttypes.h:1.10.6.1
--- src/include/inttypes.h:1.10 Sat Apr 27 21:24:27 2013
+++ src/include/inttypes.h Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: inttypes.h,v 1.10 2013/04/27 21:24:27 joerg Exp $ */
+/* $NetBSD: inttypes.h,v 1.10.6.1 2015/04/22 07:18:58 snj Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -75,6 +75,21 @@ intmax_t wcstoimax_l(const wchar_t * __r
uintmax_t wcstoumax_l(const wchar_t * __restrict,
wchar_t ** __restrict, int, locale_t);
#endif
+
+
+#if defined(_NETBSD_SOURCE)
+intmax_t strtoi(const char * __restrict, char ** __restrict, int,
+ intmax_t, intmax_t, int *);
+uintmax_t strtou(const char * __restrict, char ** __restrict, int,
+ uintmax_t, uintmax_t, int *);
+
+/* i18n variations */
+intmax_t strtoi_l(const char * __restrict, char ** __restrict, int,
+ intmax_t, intmax_t, int *, locale_t);
+uintmax_t strtou_l(const char * __restrict, char ** __restrict, int,
+ uintmax_t, uintmax_t, int *, locale_t);
+#endif /* defined(_NETBSD_SOURCE) */
+
__END_DECLS
#endif /* !_INTTYPES_H_ */
Index: src/lib/libc/shlib_version
diff -u src/lib/libc/shlib_version:1.254 src/lib/libc/shlib_version:1.254.2.1
--- src/lib/libc/shlib_version:1.254 Fri Jul 25 08:31:06 2014
+++ src/lib/libc/shlib_version Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: shlib_version,v 1.254 2014/07/25 08:31:06 dholland Exp $
+# $NetBSD: shlib_version,v 1.254.2.1 2015/04/22 07:18:58 snj Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
# things we wish to do on next major version bump:
@@ -43,3 +43,4 @@
# - remove arc4random(3) API
major=12
minor=193
+teeny=1
Index: src/lib/libc/stdlib/Makefile.inc
diff -u src/lib/libc/stdlib/Makefile.inc:1.82 src/lib/libc/stdlib/Makefile.inc:1.82.2.1
--- src/lib/libc/stdlib/Makefile.inc:1.82 Sun Jul 20 13:34:17 2014
+++ src/lib/libc/stdlib/Makefile.inc Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.82 2014/07/20 13:34:17 christos Exp $
+# $NetBSD: Makefile.inc,v 1.82.2.1 2015/04/22 07:18:58 snj Exp $
# from: @(#)Makefile.inc 8.3 (Berkeley) 2/4/95
# stdlib sources
@@ -13,6 +13,7 @@ SRCS+= _env.c _rand48.c \
nrand48.c putenv.c qabs.c qdiv.c qsort.c posix_openpt.c pty.c \
quick_exit.c radixsort.c rand.c rand_r.c random.c remque.c \
seed48.c setenv.c srand48.c strsuftoll.c \
+ strtoi.c strtou.c \
strtoimax.c strtol.c strtoll.c strtoq.c strtoul.c strtoull.c \
strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c \
unsetenv.c strfmon.c
@@ -84,7 +85,9 @@ MLINKS+=strtod.3 strtof.3 strtod.3 strto
MLINKS+=strtol.3 strtoimax.3
MLINKS+=strtol.3 strtoll.3
MLINKS+=strtol.3 strtoq.3
+MLINKS+=strtol.3 strtoi.3
MLINKS+=strtoul.3 strtoull.3
MLINKS+=strtoul.3 strtoumax.3
MLINKS+=strtoul.3 strtouq.3
+MLINKS+=strtoul.3 strtou.3
MLINKS+=tsearch.3 tfind.3 tsearch.3 twalk.3 tsearch.3 tdelete.3
Index: src/lib/libc/stdlib/strtol.3
diff -u src/lib/libc/stdlib/strtol.3:1.26 src/lib/libc/stdlib/strtol.3:1.26.24.1
--- src/lib/libc/stdlib/strtol.3:1.26 Thu Jul 23 13:38:57 2009
+++ src/lib/libc/stdlib/strtol.3 Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: strtol.3,v 1.26 2009/07/23 13:38:57 wiz Exp $
+.\" $NetBSD: strtol.3,v 1.26.24.1 2015/04/22 07:18:58 snj Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,10 +33,11 @@
.\"
.\" from: @(#)strtol.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd July 23, 2009
+.Dd March 10, 2015
.Dt STRTOL 3
.Os
.Sh NAME
+.Nm strtoi ,
.Nm strtol ,
.Nm strtoll ,
.Nm strtoimax ,
@@ -54,6 +55,8 @@
.Pp
.In inttypes.h
.Ft intmax_t
+.Fn strtoi "const char * restrict nptr" "char ** restrict endptr" "int base" "intmax_t lo" "intmax_t hi" "int *rstatus"
+.Ft intmax_t
.Fn strtoimax "const char * restrict nptr" "char ** restrict endptr" "int base"
.Pp
.In sys/types.h
@@ -87,6 +90,30 @@ to an
.Ft intmax_t
value.
The
+.Fn strtoi
+function
+uses internally
+.Fn strtoimax
+and ensures that the result is always in the range [
+.Fa lo ..
+.Fa hi
+].
+In adddition it always places
+.Dv 0
+on success or a conversion status in the
+.Fa rstatus
+argument, avoiding the
+.Dv errno
+gymnastics the other functions require.
+The
+.Fn strtoi
+function doesn't affect errno on exit.
+The
+.Fa rstatus
+argument can be
+.Dv NULL
+if conversion status is to be ignored.
+The
.Fn strtoq
function
converts the string in
@@ -156,6 +183,15 @@ is
on return, the entire string was valid.)
.Sh RETURN VALUES
The
+.Fn strtoi
+function
+always returns the closest value in the range specified by
+the
+.Fa lo
+and
+.Fa hi
+arguments.
+The
.Fn strtol
function
returns the result of the conversion,
@@ -200,6 +236,21 @@ is left unchanged.
This behavior (which is unlike most library functions) is guaranteed
by the pertinent standards.
.Sh EXAMPLES
+The
+.Fn strtoi
+function is the simplest to use:
+.Bd -literal -offset indent
+int e;
+intmax_t lval = strtoi(buf, NULL, 0, 1, 99, &e);
+if (e)
+ warnc(e, "conversion of `%s' to a number failed, using %jd",
+ buf, lval);
+.Ed
+.Pp
+This will always return a number in
+.Dv [1..99]
+range no matter what the input is, and warn if the conversion failed.
+.Pp
Because the return value of
.Fn strtol
cannot be used unambiguously to detect an error,
@@ -269,12 +320,31 @@ is not between 2 and 36 and does not con
.It Bq Er ERANGE
The given string was out of range; the value converted has been clamped.
.El
+.Pp
+In addition to the above errors
+.Fn strtoi
+returns:
+.Bl -tag -width Er
+.It Bq Er ECANCELED
+The string did not contain any characters that were converted.
+.It Bq Er ENOTSUP
+The string contained non-numeric characters that did not get converted.
+In this case,
+.Fa endptr
+points to the first unconverted character.
+.It Bq Er ERANGE
+The range given was invalid, i.e.
+.Fa lo
+\*[Gt]
+.Fa hi .
+.El
.Sh SEE ALSO
.Xr atof 3 ,
.Xr atoi 3 ,
.Xr atol 3 ,
.Xr atoll 3 ,
.Xr strtod 3 ,
+.Xr strtou 3 ,
.Xr strtoul 3 ,
.Xr strtoull 3 ,
.Xr strtoumax 3
@@ -290,5 +360,9 @@ and
.Fn strtoimax
functions conform to
.St -isoC-99 .
+The
+.Fn strtoi
+function appeared in
+.Nx 8 .
.Sh BUGS
Ignores the current locale.
Index: src/lib/libc/stdlib/strtoul.3
diff -u src/lib/libc/stdlib/strtoul.3:1.25 src/lib/libc/stdlib/strtoul.3:1.25.24.1
--- src/lib/libc/stdlib/strtoul.3:1.25 Wed Dec 2 12:50:27 2009
+++ src/lib/libc/stdlib/strtoul.3 Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: strtoul.3,v 1.25 2009/12/02 12:50:27 pooka Exp $
+.\" $NetBSD: strtoul.3,v 1.25.24.1 2015/04/22 07:18:58 snj Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,10 +33,11 @@
.\"
.\" from: @(#)strtoul.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd December 2, 2009
+.Dd March 10, 2015
.Dt STRTOUL 3
.Os
.Sh NAME
+.Nm strtou ,
.Nm strtoul ,
.Nm strtoull ,
.Nm strtoumax ,
@@ -54,6 +55,8 @@
.Pp
.In inttypes.h
.Ft uintmax_t
+.Fn strtou "const char * restrict nptr" "char ** restrict endptr" "int base" "uintmax_t lo" "uintmax_t hi" "int *rstatus"
+.Ft uintmax_t
.Fn strtoumax "const char * restrict nptr" "char ** restrict endptr" "int base"
.Pp
.In sys/types.h
@@ -86,6 +89,26 @@ converts the string in
to an
.Ft uintmax_t
value.
+.Fn strtou
+function
+uses internally
+.Fn strtoumax
+and ensures that the result is always in the range [
+.Fa lo ..
+.Fa hi
+].
+In adddition it always places
+.Dv 0
+on success or a conversion status in the
+.Fa rstatus
+argument, avoiding the
+.Dv errno
+gymnastics the other functions require.
+The
+.Fa rstatus
+argument can be
+.Dv NULL
+if conversion status is to be ignored.
The
.Fn strtouq
function
@@ -157,6 +180,15 @@ is
on return, the entire string was valid.)
.Sh RETURN VALUES
The
+.Fn strtou
+function
+always returns the closest value in the range specified by
+the
+.Fa lo
+and
+.Fa hi
+arguments.
+The
.Fn strtoul
function
returns either the result of the conversion
@@ -201,6 +233,21 @@ is left unchanged.
This behavior (which is unlike most library functions) is guaranteed
by the pertinent standards.
.Sh EXAMPLES
+The
+.Fn strtou
+function is the simplest to use:
+.Bd -literal -offset indent
+int e;
+uintmax_t lval = strtou(buf, NULL, 0, 1, 99, &e);
+if (e)
+ warnc(e, "conversion of `%s' to a number failed, using %ju",
+ buf, lval);
+.Ed
+.Pp
+This will always return a number in
+.Dv [1..99]
+range no matter what the input is, and warn if the conversion failed.
+.Pp
Because the return value of
.Fn strtoul
cannot be used unambiguously to detect an error,
@@ -243,7 +290,26 @@ is not between 2 and 36 and does not con
.It Bq Er ERANGE
The given string was out of range; the value converted has been clamped.
.El
+.Pp
+In addition to the above errors
+.Fn strtou
+returns:
+.Bl -tag -width Er
+.It Bq Er ECANCELED
+The string did not contain any characters that were converted.
+.It Bq Er ENOTSUP
+The string contained non-numeric characters that did not get converted.
+In this case,
+.Fa endptr
+points to the first unconverted character.
+.It Bq Er ERANGE
+The range given was invalid, i.e.
+.Fa lo
+\*[Gt]
+.Fa hi .
+.El
.Sh SEE ALSO
+.Xr strtoi 3 ,
.Xr strtoimax 3 ,
.Xr strtol 3 ,
.Xr strtoll 3
@@ -259,5 +325,9 @@ and
.Fn strtoumax
functions conform to
.St -isoC-99 .
+The
+.Fn strtou
+function appeared in
+.Nx 8 .
.Sh BUGS
Ignores the current locale.
Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.35 src/sys/lib/libkern/Makefile.libkern:1.35.2.1
--- src/sys/lib/libkern/Makefile.libkern:1.35 Sun Aug 10 16:44:36 2014
+++ src/sys/lib/libkern/Makefile.libkern Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.libkern,v 1.35 2014/08/10 16:44:36 tls Exp $
+# $NetBSD: Makefile.libkern,v 1.35.2.1 2015/04/22 07:18:58 snj Exp $
#
# Variable definitions for libkern.
@@ -73,6 +73,7 @@ SRCS+= memset.c
SRCS+= popcount32.c popcount64.c
SRCS+= strtoul.c strtoll.c strtoull.c strtoimax.c strtoumax.c
+SRCS+= strtoi.c strtou.c
SRCS+= scanc.c skpc.c
SRCS+= random.c
Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.115 src/sys/lib/libkern/libkern.h:1.115.2.1
--- src/sys/lib/libkern/libkern.h:1.115 Sun Aug 10 16:44:36 2014
+++ src/sys/lib/libkern/libkern.h Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: libkern.h,v 1.115 2014/08/10 16:44:36 tls Exp $ */
+/* $NetBSD: libkern.h,v 1.115.2.1 2015/04/22 07:18:58 snj Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -403,6 +403,11 @@ long long strtoll(const char *, char **,
unsigned long long strtoull(const char *, char **, int);
intmax_t strtoimax(const char *, char **, int);
uintmax_t strtoumax(const char *, char **, int);
+intmax_t strtoi(const char * __restrict, char ** __restrict, int, intmax_t,
+ intmax_t, int *);
+uintmax_t strtou(const char * __restrict, char ** __restrict, int, uintmax_t,
+ uintmax_t, int *);
+
int snprintb(char *, size_t, const char *, uint64_t);
int snprintb_m(char *, size_t, const char *, uint64_t, size_t);
int kheapsort(void *, size_t, size_t, int (*)(const void *, const void *),
Index: src/tools/compat/Makefile
diff -u src/tools/compat/Makefile:1.72 src/tools/compat/Makefile:1.72.4.1
--- src/tools/compat/Makefile:1.72 Thu Jan 16 17:24:56 2014
+++ src/tools/compat/Makefile Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.72 2014/01/16 17:24:56 christos Exp $
+# $NetBSD: Makefile,v 1.72.4.1 2015/04/22 07:18:58 snj Exp $
HOSTLIB= nbcompat
@@ -20,6 +20,7 @@ SRCS= atoll.c basename.c cdbr.c cdbw.c
stat_flags.c strlcat.c strlcpy.c strmode.c \
strndup.c strnlen.c \
strsep.c strsuftoll.c strtoll.c \
+ strtoi.c strtou.c \
unvis.c vis.c err.c errx.c errc.c verr.c verrx.c verrc.c \
vwarn.c vwarnx.c vwarnc.c warn.c warnx.c warnc.c \
fts.c glob.c efun.c
Index: src/tools/compat/compat_defs.h
diff -u src/tools/compat/compat_defs.h:1.97.2.1 src/tools/compat/compat_defs.h:1.97.2.2
--- src/tools/compat/compat_defs.h:1.97.2.1 Wed Nov 12 18:50:55 2014
+++ src/tools/compat/compat_defs.h Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_defs.h,v 1.97.2.1 2014/11/12 18:50:55 snj Exp $ */
+/* $NetBSD: compat_defs.h,v 1.97.2.2 2015/04/22 07:18:58 snj Exp $ */
#ifndef __NETBSD_COMPAT_DEFS_H__
#define __NETBSD_COMPAT_DEFS_H__
@@ -520,6 +520,16 @@ long long strsuftollx(const char *, cons
long long strtoll(const char *, char **, int);
#endif
+#if !HAVE_STRTOI
+intmax_t strtoi(const char * __restrict, char ** __restrict, int,
+ intmax_t, intmax_t, int *);
+#endif
+
+#if !HAVE_STRTOU
+uintmax_t strtou(const char * __restrict, char ** __restrict, int,
+ uintmax_t, uintmax_t, int *);
+#endif
+
#if !HAVE_USER_FROM_UID
const char *user_from_uid(uid_t, int);
#endif
Index: src/tools/compat/configure
diff -u src/tools/compat/configure:1.81 src/tools/compat/configure:1.81.2.1
--- src/tools/compat/configure:1.81 Fri Jun 6 01:40:40 2014
+++ src/tools/compat/configure Wed Apr 22 07:18:58 2015
@@ -5047,7 +5047,7 @@ for ac_func in atoll asprintf asnprintf
pwrite raise_default_signal random setenv \
setgroupent setprogname setpassent \
snprintb_m snprintf strlcat strlcpy strmode \
- strndup strnlen strsep strsuftoll strtoll \
+ strndup strnlen strsep strsuftoll strtoi strtoll strtou \
user_from_uid uid_from_user vasprintf vasnprintf vsnprintf
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
Index: src/tools/compat/configure.ac
diff -u src/tools/compat/configure.ac:1.82 src/tools/compat/configure.ac:1.82.2.1
--- src/tools/compat/configure.ac:1.82 Fri Jun 6 01:40:40 2014
+++ src/tools/compat/configure.ac Wed Apr 22 07:18:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: configure.ac,v 1.82 2014/06/06 01:40:40 christos Exp $
+# $NetBSD: configure.ac,v 1.82.2.1 2015/04/22 07:18:58 snj Exp $
#
# Autoconf definition file for libnbcompat.
#
@@ -160,7 +160,7 @@ AC_CHECK_FUNCS(atoll asprintf asnprintf
pwrite raise_default_signal random setenv \
setgroupent setprogname setpassent \
snprintb_m snprintf strlcat strlcpy strmode \
- strndup strnlen strsep strsuftoll strtoll \
+ strndup strnlen strsep strsuftoll strtoi strtoll strtou \
user_from_uid uid_from_user vasprintf vasnprintf vsnprintf)
AC_CHECK_DECLS([user_from_uid, uid_from_user, pwcache_userdb],,,[
Index: src/tools/compat/nbtool_config.h.in
diff -u src/tools/compat/nbtool_config.h.in:1.35 src/tools/compat/nbtool_config.h.in:1.35.2.1
--- src/tools/compat/nbtool_config.h.in:1.35 Fri Jun 6 01:40:40 2014
+++ src/tools/compat/nbtool_config.h.in Wed Apr 22 07:18:58 2015
@@ -1,6 +1,6 @@
/* nbtool_config.h.in. Generated automatically from configure.ac by autoheader. */
-/* $NetBSD: nbtool_config.h.in,v 1.35 2014/06/06 01:40:40 christos Exp $ */
+/* $NetBSD: nbtool_config.h.in,v 1.35.2.1 2015/04/22 07:18:58 snj Exp $ */
#ifndef __NETBSD_NBTOOL_CONFIG_H__
#define __NETBSD_NBTOOL_CONFIG_H__
@@ -491,9 +491,15 @@
/* Define if you have the `strsuftoll' function. */
#undef HAVE_STRSUFTOLL
+/* Define if you have the `strtoi' function. */
+#undef HAVE_STRTOI
+
/* Define if you have the `strtoll' function. */
#undef HAVE_STRTOLL
+/* Define if you have the `strtou' function. */
+#undef HAVE_STRTOU
+
/* Define if `d_namlen' is member of `struct dirent'. */
#undef HAVE_STRUCT_DIRENT_D_NAMLEN
Added files:
Index: src/common/lib/libc/stdlib/_strtoi.h
diff -u /dev/null src/common/lib/libc/stdlib/_strtoi.h:1.2.2.2
--- /dev/null Wed Apr 22 07:18:59 2015
+++ src/common/lib/libc/stdlib/_strtoi.h Wed Apr 22 07:18:57 2015
@@ -0,0 +1,144 @@
+/* $NetBSD: _strtoi.h,v 1.2.2.2 2015/04/22 07:18:57 snj Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Original version ID:
+ * NetBSD: src/lib/libc/locale/_wcstoul.h,v 1.2 2003/08/07 16:43:03 agc Exp
+ *
+ * Created by Kamil Rytarowski, based on ID:
+ * NetBSD: src/common/lib/libc/stdlib/_strtoul.h,v 1.7 2013/05/17 12:55:56 joerg Exp
+ */
+
+/*
+ * function template for strtoi and strtou
+ *
+ * parameters:
+ * _FUNCNAME : function name
+ * __TYPE : return and range limits type
+ * __WRAPPED : wrapped function, strtoimax or strtoumax
+ */
+
+#define __WRAPPED_L_(x) x ## _l
+#define __WRAPPED_L__(x) __WRAPPED_L_(x)
+#define __WRAPPED_L __WRAPPED_L__(__WRAPPED)
+
+#if defined(_KERNEL) || defined(_STANDALONE) || \
+ defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY)
+__TYPE
+_FUNCNAME(const char * __restrict nptr, char ** __restrict endptr, int base,
+ __TYPE lo, __TYPE hi, int * rstatus)
+#else
+#include <locale.h>
+#include "setlocale_local.h"
+#define INT_FUNCNAME_(pre, name, post) pre ## name ## post
+#define INT_FUNCNAME(pre, name, post) INT_FUNCNAME_(pre, name, post)
+
+static __TYPE
+INT_FUNCNAME(_int_, _FUNCNAME, _l)(const char * __restrict nptr,
+ char ** __restrict endptr, int base,
+ __TYPE lo, __TYPE hi, int * rstatus, locale_t loc)
+#endif
+{
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+ int serrno;
+#endif
+ __TYPE im;
+ char *ep;
+ int rep;
+
+ _DIAGASSERT(hi >= lo);
+
+ _DIAGASSERT(nptr != NULL);
+ /* endptr may be NULL */
+
+ if (endptr == NULL)
+ endptr = &ep;
+
+ if (rstatus == NULL)
+ rstatus = &rep;
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+ serrno = errno;
+ errno = 0;
+#endif
+
+#if defined(_KERNEL) || defined(_STANDALONE) || \
+ defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY)
+ im = __WRAPPED(nptr, endptr, base);
+#else
+ im = __WRAPPED_L(nptr, endptr, base, loc);
+#endif
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+ *rstatus = errno;
+ errno = serrno;
+#endif
+
+ if (*rstatus == 0) {
+ /* No digits were found */
+ if (nptr == *endptr)
+ *rstatus = ECANCELED;
+ /* There are further characters after number */
+ else if (**endptr != '\0')
+ *rstatus = ENOTSUP;
+ }
+
+ if (im < lo) {
+ if (*rstatus == 0)
+ *rstatus = ERANGE;
+ return lo;
+ }
+ if (im > hi) {
+ if (*rstatus == 0)
+ *rstatus = ERANGE;
+ return hi;
+ }
+
+ return im;
+}
+
+#if !defined(_KERNEL) && !defined(_STANDALONE) && \
+ !defined(HAVE_NBTOOL_CONFIG_H) && !defined(BCS_ONLY)
+__TYPE
+_FUNCNAME(const char * __restrict nptr, char ** __restrict endptr, int base,
+ __TYPE lo, __TYPE hi, int * rstatus)
+{
+ return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, lo, hi,
+ rstatus, _current_locale());
+}
+
+__TYPE
+INT_FUNCNAME(, _FUNCNAME, _l)(const char * __restrict nptr,
+ char ** __restrict endptr, int base,
+ __TYPE lo, __TYPE hi, int * rstatus, locale_t loc)
+{
+ return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, lo, hi,
+ rstatus, loc);
+}
+#endif
Index: src/common/lib/libc/stdlib/strtoi.c
diff -u /dev/null src/common/lib/libc/stdlib/strtoi.c:1.1.2.2
--- /dev/null Wed Apr 22 07:18:59 2015
+++ src/common/lib/libc/stdlib/strtoi.c Wed Apr 22 07:18:57 2015
@@ -0,0 +1,62 @@
+/* $NetBSD: strtoi.c,v 1.1.2.2 2015/04/22 07:18:57 snj Exp $ */
+
+/*-
+ * Copyright (c) 2005 The DragonFly Project. All rights reserved.
+ * Copyright (c) 2003 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Created by Kamil Rytarowski, based on ID:
+ * NetBSD: src/common/lib/libc/stdlib/strtoul.c,v 1.3 2008/08/20 19:58:34 oster Exp
+ */
+
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: strtoi.c,v 1.1.2.2 2015/04/22 07:18:57 snj Exp $");
+
+#if defined(_KERNEL)
+#include <sys/param.h>
+#include <sys/types.h>
+#include <lib/libkern/libkern.h>
+#elif defined(_STANDALONE)
+#include <sys/param.h>
+#include <sys/types.h>
+#include <lib/libkern/libkern.h>
+#include <lib/libsa/stand.h>
+#else
+#include <stddef.h>
+#include <assert.h>
+#include <errno.h>
+#include <inttypes.h>
+#endif
+
+#define _FUNCNAME strtoi
+#define __TYPE intmax_t
+#define __WRAPPED strtoimax
+
+#if !HAVE_STRTOI
+#include "_strtoi.h"
+#endif
Index: src/common/lib/libc/stdlib/strtou.c
diff -u /dev/null src/common/lib/libc/stdlib/strtou.c:1.1.2.2
--- /dev/null Wed Apr 22 07:18:59 2015
+++ src/common/lib/libc/stdlib/strtou.c Wed Apr 22 07:18:57 2015
@@ -0,0 +1,62 @@
+/* $NetBSD: strtou.c,v 1.1.2.2 2015/04/22 07:18:57 snj Exp $ */
+
+/*-
+ * Copyright (c) 2005 The DragonFly Project. All rights reserved.
+ * Copyright (c) 2003 Citrus Project,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Created by Kamil Rytarowski, based on ID:
+ * NetBSD: src/common/lib/libc/stdlib/strtoul.c,v 1.3 2008/08/20 19:58:34 oster Exp
+ */
+
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: strtou.c,v 1.1.2.2 2015/04/22 07:18:57 snj Exp $");
+
+#if defined(_KERNEL)
+#include <sys/param.h>
+#include <sys/types.h>
+#include <lib/libkern/libkern.h>
+#elif defined(_STANDALONE)
+#include <sys/param.h>
+#include <sys/types.h>
+#include <lib/libkern/libkern.h>
+#include <lib/libsa/stand.h>
+#else
+#include <stddef.h>
+#include <assert.h>
+#include <errno.h>
+#include <inttypes.h>
+#endif
+
+#define _FUNCNAME strtou
+#define __TYPE uintmax_t
+#define __WRAPPED strtoumax
+
+#if !HAVE_STRTOU
+#include "_strtoi.h"
+#endif