Commit Graph

30 Commits

Author SHA1 Message Date
Jim Meyering
f0ed17134a (__xstrtol): If there is no number but there
is a valid suffix, assume 1.  "MB" now means decimal, "MiB" binary.
Accept 'K' as well as 'k'.
2001-12-19 10:41:27 +00:00
Jim Meyering
9a8547bc45 (strtol): Do not declare if HAVE_DECL_STRTOL.
(strtoul): Do not declare if HAVE_DECL_STRTOUL.
(strtoimax, strtoumax): Do not declare if already defined as a macro.
2001-09-28 19:34:31 +00:00
Jim Meyering
b5fd786410 (strtoimax): Guard declaration with
`#if !HAVE_DECL_STRTOIMAX', rather than just `#ifndef strtoimax'.
The latter fails because some systems (at least rs6000-ibm-aix4.3.3.0)
have their own, conflicting declaration of strtoimax in sys/inttypes.h.
(strtoumax): Likewise, for completeness (it wasn't necessary).
2001-09-20 14:46:55 +00:00
Jim Meyering
2fb1f177d9 (strtoimax): New decl. 2001-08-31 08:17:45 +00:00
Jim Meyering
166c00189a (__xstrtol): Add undocumented suffixes 'g' and
't' for compatibility with Solaris 8 sort.
2000-12-19 08:35:20 +00:00
Jim Meyering
4e4c0e24d5 tweak copyright line 2000-01-07 07:03:01 +00:00
Jim Meyering
376c3fe740 [!defined strtoumax]: Declare strtoumax. 1999-07-04 10:40:04 +00:00
Jim Meyering
589cf443b9 (__strtol): Remove decl; it doesn't work if __strtol
expands to a macro, which occurs in HP-UX 10.20 with strtoumax.
(strtol, strtoul): New decls (for pre-ANSI hosts), to replace
the above decl.
1999-07-04 08:34:31 +00:00
Jim Meyering
f8474e2421 (__strtol, __strtol_t, __xstrtol):
New macros to specify the
underlying function, its returned type, and our function.  Default to
values suitable for xstrtol.

Include <ctype.h>, since we use its macros.

(ULONG_MAX, LONG_MAX, ISBLANK): Remove: no longer needed.
(ISSPACE): New macro.

(bkm_scale, bkm_scale_by_power, __xstrtol, main): __unsigned long int
-> __strtol_t.

(__xstrtol): Depend on whether __strtol_t is an unsigned type, not on
whether STRING_TO_UNSIGNED is defined.  Skip isspace chars, not
isblank chars, to match strtol.  When returning
LONGINT_INVALID_SUFFIX_CHAR, store the value that we computed into
*val.
1999-04-18 23:15:34 +00:00
Jim Meyering
72f8c0a17c (__xstrtol) [STRING_TO_UNSIGNED]: Return
LONGINT_INVALID for strings that begin with `-'.
1998-09-26 19:11:23 +00:00
Jim Meyering
3cf7eece6f Remove duplicate include of <stdio.h>. 1998-07-29 04:00:36 +00:00
Jim Meyering
19c23eefb7 Include <stdio.h> if NDEBUG is not defined; needed on SunOS 4.
From Paul Eggert.
1998-07-22 16:57:15 +00:00
Jim Meyering
bca292d9e6 Include stdio.h. Required on some systems when using assert.
From Kaveh Ghazi.
1998-07-04 17:15:08 +00:00
Jim Meyering
d05618c5c2 Don't define NDEBUG, now that it's done via configure's --disable-assert option. 1998-07-01 12:44:22 +00:00
Jim Meyering
1d2074e02a protoize 1998-06-29 20:29:28 +00:00
Jim Meyering
476cb02516 * lib/xstrtol.c (bkm_scale): Don't assume that you can convert
unsigned long to double without losing information.
	(bkm_scale_by_power): New function.

	* lib/xstrtol.c (__xstrtol), src/dd.c (parse_integer):
	Add support for SI-like suffixes like "GB" and "TD".
	* src/dd.c (usage): Describe it.
1998-06-29 15:24:43 +00:00
Jim Meyering
45e8e5c550 Merge with the version from textutils. 1998-03-31 13:14:22 +00:00
Jim Meyering
84ad5c47c8 (TYPE_SIGNED): Define.
(TYPE_MAXIMUM): Define.
(ULONG_MAX): Use TYPE_MAXIMUM.
(LONG_MAX): Use TYPE_MAXIMUM.
1998-02-24 23:33:41 +00:00
Jim Meyering
186d893f27 (__xstrtol): Change interpretation of
VALID_SUFFIXES == NULL vs VALID_SUFFIXES == "".  Use the former
when any suffix is valid, the later when no suffix is allowed.
1997-01-25 06:13:46 +00:00
Jim Meyering
33b2a8a1ae . 1996-10-29 13:57:43 +00:00
Jim Meyering
9b3498acb2 . 1996-10-17 02:46:33 +00:00
Jim Meyering
ffc5c802c4 libitize 1996-10-17 02:45:32 +00:00
Jim Meyering
41dfaf296a (__xstrtol): Return an error for invalid suffix.
Before, e.g., `split -b 1M' would be silently accepted and treated
like `split -b 1'.  Reported by Franc,ois.
1996-10-13 17:58:50 +00:00
Jim Meyering
2df44bba5b Add copyright header. 1996-05-22 12:37:29 +00:00
Jim Meyering
b5c8c81d4d Indent cpp directives to reflect nesting. 1995-10-09 03:48:08 +00:00
Jim Meyering
ec651d2263 (__strtol): Remove prototype altogether.
Move inclusion of xstrtol.h back so that it follows system headers.
1995-05-22 04:43:36 +00:00
Jim Meyering
7f9311c20e merge with 1.11.1b 1995-05-21 11:44:22 +00:00
Jim Meyering
b554fee401 . 1995-01-27 05:22:23 +00:00
Jim Meyering
72bb9e6307 Rearrange to accept a user-specified set of suffix chars (must be
a subset of master list), each with a hard-coded value.
1994-12-22 05:10:32 +00:00
Jim Meyering
3205d087e2 . 1994-12-20 04:17:23 +00:00