xref: /haiku/src/system/libroot/posix/stdlib/atoi.c (revision 93aeb8c3bc3f13cb1f282e3e749258a23790d947)
1 /*
2  *  Copyright (c) 2002, OpenBeOS Project.
3  *  All rights reserved.
4  *  Distributed under the terms of the OpenBeOS license.
5  *
6  *
7  *  atoi.c:
8  *  implements the standard C library functions:
9  *    atoi, atoui, atol, atoul, atoll
10  *  (these are all just wrappers around calls to the strto[u]l[l] functions)
11  *
12  *
13  *  Author(s):
14  *  Daniel Reinhold (danielre@users.sf.net)
15  *
16  */
17 
18 #include <stdlib.h>
19 
20 
21 int
22 atoi(const char *num)
23 {
24 	return (int) strtol(num, NULL, 10);
25 }
26 
27 
28 unsigned int
29 atoui(const char *num)
30 {
31 	return (unsigned int) strtoul(num, NULL, 10);
32 }
33 
34 
35 long
36 atol(const char *num)
37 {
38 	return strtol(num, NULL, 10);
39 }
40 
41 
42 unsigned long
43 atoul(const char *num)
44 {
45 	return strtoul(num, NULL, 10);
46 }
47 
48 
49 long long int
50 atoll(const char *num)
51 {
52 	return strtoll(num, NULL, 10);
53 }
54 
55