delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/11/02/01:12:30

Message-ID: <001401c28231$db1d3cd0$0100a8c0@p4>
From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
To: <djgpp-workers AT delorie DOT com>
Subject: LIBC 2.04 new function atoll() implementation
Date: Sat, 2 Nov 2002 16:36:21 +1100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Reply-To: djgpp-workers AT delorie DOT com

Below are atoll.c and atoll.txh, which together implement the missing
atoll() function. I copied the existing atol.c and atol.txh and made
hopefully the correct changes. Please let me know if I have made any
mistakes as I don't know if I got the compatability right.

The files are all from the src\libc\ansi\stdlib directory.
==================== START atoll.c ====================
/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
#include <stdlib.h>

long long
atoll(const char *str)
{
  return strtoll(str, 0, 10);
}

==================== END atoll.c ====================
==================== START atoll.txh ====================
@node atoll, string
@subheading Syntax

@example
#include <stdlib.h>

long long atoll(const char *string);
@end example

@subheading Description

Convert as much of the string as possible to an equivalent long long integer
value.

This function is almost like @code{strtoll(string, NULL, 10)}
(@pxref{strtol}).

@subheading Return Value

The equivalent value, or zero if the string does not represent a number.

@subheading Portability

@portability !ansi-c89, ansi-c99

@subheading Example

@example
main(int argc, char **argv)
@{
  long long l = atoll(argv[1]);
  @dots{}
@end example
==================== END atoll.txh ===================
==================== START src\libc\ansi\stdlib\makefile patch ============
*** makefile.old        Sat Nov  2 16:12:56 2002
--- makefile    Sat Nov  2 15:40:50 2002
***************
*** 10,15 ****
--- 10,16 ----
  SRC += atof.c
  SRC += atoi.c
  SRC += atol.c
+ SRC += atoll.c
  SRC += atold.c
  SRC += bsearch.c
  SRC += calloc.c
==================== END src\libc\ansi\stdlib\makefile patch ============


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019