3 * Copyright (C) 2007, 2008, 2009, 2011 Sebastien Bourdeauducq
4 * Copyright (C) Linux kernel developers
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, version 3 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 #define PRINTF_ZEROPAD 1 /* pad with zero */
29 #define PRINTF_SIGN 2 /* unsigned/signed long */
30 #define PRINTF_PLUS 4 /* show plus */
31 #define PRINTF_SPACE 8 /* space if plus */
32 #define PRINTF_LEFT 16 /* left justified */
33 #define PRINTF_SPECIAL 32 /* 0x */
34 #define PRINTF_LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
39 static inline int abs(int x
)
41 return x
> 0 ? x
: -x
;
44 static inline long int labs(long int x
)
46 return x
> 0 ? x
: -x
;
49 unsigned long strtoul(const char *nptr
, char **endptr
, int base
);
50 long strtol(const char *nptr
, char **endptr
, int base
);
51 double strtod(const char *str
, char **endptr
);
53 int skip_atoi(const char **s
);
54 static inline int atoi(const char *nptr
) {
55 return strtol(nptr
, NULL
, 10);
57 static inline long atol(const char *nptr
) {
58 return (long)atoi(nptr
);
60 char *number(char *buf
, char *end
, unsigned long num
, int base
, int size
, int precision
, int type
);
62 #define RAND_MAX 2147483647
64 unsigned int rand(void);
65 void srand(unsigned int seed
);
66 void abort(void) __attribute__((noreturn
));
68 void qsort(void *base
, size_t nmemb
, size_t size
, int(*compar
)(const void *, const void *));
71 * The following functions are not provided by this library.
74 char *getenv(const char *name
);
76 void *malloc(size_t size
);
78 void *realloc(void *ptr
, size_t size
);
84 #endif /* __STDLIB_H */