1 .\" $NetBSD: strsuftoll.3,v 1.6 2007/04/12 06:50:39 lukem Exp $
3 .\" Copyright (c) 2002,2007 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
36 .Nd "convert a string to a long long, with suffix parsing"
42 .Fn strsuftoll "const char *desc" "const char *val" "long long min" "long long max"
44 .Fn strsuftollx "const char *desc" "const char *val" "long long min" "long long max" "char *errbuf" "size_t errbuflen"
52 into a long long number,
53 checking that the result is not smaller than
57 Two or more decimal numbers may be separated by an
59 to indicate a product.
60 Each decimal number may have one of the following optional suffixes:
61 .Bl -tag -width 3n -offset indent -compact
63 Block; multiply by 512
65 Kibi; multiply by 1024 (1 KiB)
67 Mebi; multiply by 1048576 (1 MiB)
69 Gibi; multiply by 1073741824 (1 GiB)
71 Tebi; multiply by 1099511627776 (1 TiB)
73 Word; multiply by the number of bytes in an integer
76 In the case of an error (range overflow or an invalid number),
78 places an error message into
82 bytes long) and returns 0,
85 displays that error and terminates the process.
91 return either the result of the conversion,
92 unless the value overflows or is not a number;
95 displays an error message and terminates the process with exit code 1,
100 contains a non-empty error message.
104 The given string was out of range; the value converted has been clamped.
110 Ignores the current locale.