OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [stdlib/] [atoi.c] - Blame information for rev 207

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/*
2
FUNCTION
3
   <<atoi>>, <<atol>>---string to integer
4
 
5
INDEX
6
        atoi
7
INDEX
8
        atol
9
INDEX
10
        _atoi_r
11
INDEX
12
        _atol_r
13
 
14
ANSI_SYNOPSIS
15
        #include <stdlib.h>
16
        int atoi(const char *<[s]>);
17
        long atol(const char *<[s]>);
18
        int _atoi_r(struct _reent *<[ptr]>, const char *<[s]>);
19
        long _atol_r(struct _reent *<[ptr]>, const char *<[s]>);
20
 
21
TRAD_SYNOPSIS
22
        #include <stdlib.h>
23
       int atoi(<[s]>)
24
       char *<[s]>;
25
 
26
       long atol(<[s]>)
27
       char *<[s]>;
28
 
29
       int _atoi_r(<[ptr]>, <[s]>)
30
       struct _reent *<[ptr]>;
31
       char *<[s]>;
32
 
33
       long _atol_r(<[ptr]>, <[s]>)
34
       struct _reent *<[ptr]>;
35
       char *<[s]>;
36
 
37
 
38
DESCRIPTION
39
   <<atoi>> converts the initial portion of a string to an <<int>>.
40
   <<atol>> converts the initial portion of a string to a <<long>>.
41
 
42
   <<atoi(s)>> is implemented as <<(int)strtol(s, NULL, 10).>>
43
   <<atol(s)>> is implemented as <<strtol(s, NULL, 10).>>
44
 
45
   <<_atoi_r>> and <<_atol_r>> are reentrant versions of <<atoi>> and
46
   <<atol>> respectively, passing the reentrancy struct pointer.
47
 
48
RETURNS
49
   The functions return the converted value, if any. If no conversion was
50
   made, <<0>> is returned.
51
 
52
PORTABILITY
53
<<atoi>>, <<atol>> are ANSI.
54
 
55
No supporting OS subroutines are required.
56
*/
57
 
58
/*
59
 * Andy Wilson, 2-Oct-89.
60
 */
61
 
62
#include <stdlib.h>
63
#include <_ansi.h>
64
 
65
#ifndef _REENT_ONLY
66
int
67
_DEFUN (atoi, (s),
68
        _CONST char *s)
69
{
70
  return (int) strtol (s, NULL, 10);
71
}
72
#endif /* !_REENT_ONLY */
73
 
74
int
75
_DEFUN (_atoi_r, (s),
76
        struct _reent *ptr _AND
77
        _CONST char *s)
78
{
79
  return (int) _strtol_r (ptr, s, NULL, 10);
80
}
81
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.