Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4349 Serge 1
/*
2
FUNCTION
3
   <>, <>---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 
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 
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
   <> converts the initial portion of a string to an <>.
40
   <> converts the initial portion of a string to a <>.
41
 
42
   <> is implemented as <<(int)strtol(s, NULL, 10).>>
43
   <> is implemented as <>
44
 
45
   <<_atoi_r>> and <<_atol_r>> are reentrant versions of <> and
46
   <> 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
<>, <> are ANSI.
54
 
55
No supporting OS subroutines are required.
56
*/
57
 
58
/*
59
 * Andy Wilson, 2-Oct-89.
60
 */
61
 
62
#include 
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