diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-11-28 01:22:08 +0000 | 
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-11-28 01:22:08 +0000 | 
| commit | 59d01330c4eb9f2727e88f6b1bba619a94f81184 (patch) | |
| tree | 0a99b7e2465c22a7c381a267d58611af2e2ed87c /lib/libc/stdlib | |
| parent | 7e302fc7a2591a1f26d7f94ef7d4292930773148 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdlib')
| -rw-r--r-- | lib/libc/stdlib/Makefile.inc | 4 | ||||
| -rw-r--r-- | lib/libc/stdlib/atol.3 | 23 | ||||
| -rw-r--r-- | lib/libc/stdlib/atoll.c | 44 | 
3 files changed, 69 insertions, 2 deletions
diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index ac2539f9c47e..d93c20e5121c 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -4,7 +4,8 @@  # machine-independent stdlib sources  .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/stdlib ${.CURDIR}/../libc/stdlib -MISRCS+=abort.c abs.c atexit.c atof.c atoi.c atol.c bsearch.c calloc.c div.c \ +MISRCS+=abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ +	bsearch.c calloc.c div.c \  	exit.c getenv.c getopt.c getsubopt.c hcreate.c heapsort.c \  	imaxabs.c imaxdiv.c labs.c ldiv.c llabs.c lldiv.c \  	malloc.c merge.c putenv.c qsort.c radixsort.c rand.c random.c \ @@ -33,6 +34,7 @@ MAN+=	abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \  	malloc.3 memory.3 qsort.3 radixsort.3 rand.3 random.3 \  	realpath.3 strfmon.3 strtod.3 strtol.3 strtoul.3 system.3 tsearch.3 +MLINKS+=atol.3 atoll.3  MLINKS+=getenv.3 putenv.3 getenv.3 setenv.3 getenv.3 unsetenv.3  MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3  MLINKS+=qsort.3 heapsort.3 qsort.3 mergesort.3 diff --git a/lib/libc/stdlib/atol.3 b/lib/libc/stdlib/atol.3 index 8e9593b286cb..5ab77904f536 100644 --- a/lib/libc/stdlib/atol.3 +++ b/lib/libc/stdlib/atol.3 @@ -40,7 +40,7 @@  .Dt ATOL 3  .Os  .Sh NAME -.Nm atol +.Nm atol , atoll  .Nd convert  .Tn ASCII  string to long integer @@ -50,6 +50,8 @@ string to long integer  .In stdlib.h  .Ft long  .Fn atol "const char *nptr" +.Ft long long +.Fn atoll "const char *nptr"  .Sh DESCRIPTION  The  .Fn atol @@ -63,6 +65,19 @@ It is equivalent to:  .Bd -literal -offset indent  strtol(nptr, (char **)NULL, 10);  .Ed +.Pp +The +.Fn atoll +function converts the initial portion of the string pointed to by +.Ar nptr +to +.Em long long integer +representation. +.Pp +It is equivalent to: +.Bd -literal -offset indent +strtoll(nptr, (char **)NULL, 10); +.Ed  .Sh SEE ALSO  .Xr atof 3 ,  .Xr atoi 3 , @@ -75,3 +90,9 @@ The  function  conforms to  .St -isoC . +.Pp +The +.Fn atoll +function +conforms to +.St -isoC-99 . diff --git a/lib/libc/stdlib/atoll.c b/lib/libc/stdlib/atoll.c new file mode 100644 index 000000000000..72ca59ae270b --- /dev/null +++ b/lib/libc/stdlib/atoll.c @@ -0,0 +1,44 @@ +/* + * Copyright (c) 1988, 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. All advertising materials mentioning features or use of this software + *    must display the following acknowledgement: + *	This product includes software developed by the University of + *	California, Berkeley and its contributors. + * 4. 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. + * + * $FreeBSD$ + */ + +#include <stddef.h> +#include <stdlib.h> + +long long +atoll(str) +	const char *str; +{ +	return(strtoll(str, (char **)NULL, 10)); +}  | 
