diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/include/libbb.h b/include/libbb.h index ddf965fbf..5b2977fce 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -19,7 +19,9 @@ | |||
19 | #include <errno.h> | 19 | #include <errno.h> |
20 | #include <fcntl.h> | 20 | #include <fcntl.h> |
21 | #include <inttypes.h> | 21 | #include <inttypes.h> |
22 | #include <malloc.h> | ||
22 | #include <netdb.h> | 23 | #include <netdb.h> |
24 | #include <setjmp.h> | ||
23 | #include <signal.h> | 25 | #include <signal.h> |
24 | #include <stdio.h> | 26 | #include <stdio.h> |
25 | #include <stdlib.h> | 27 | #include <stdlib.h> |
@@ -27,18 +29,26 @@ | |||
27 | #include <string.h> | 29 | #include <string.h> |
28 | #include <strings.h> | 30 | #include <strings.h> |
29 | #include <sys/ioctl.h> | 31 | #include <sys/ioctl.h> |
32 | #include <sys/mman.h> | ||
30 | #include <sys/socket.h> | 33 | #include <sys/socket.h> |
31 | #include <sys/stat.h> | 34 | #include <sys/stat.h> |
35 | #include <sys/statfs.h> | ||
32 | #include <sys/time.h> | 36 | #include <sys/time.h> |
33 | #include <sys/types.h> | 37 | #include <sys/types.h> |
34 | #include <sys/wait.h> | 38 | #include <sys/wait.h> |
35 | #include <termios.h> | 39 | #include <termios.h> |
40 | #include <time.h> | ||
36 | #include <unistd.h> | 41 | #include <unistd.h> |
42 | #include <utime.h> | ||
37 | 43 | ||
38 | #ifdef CONFIG_SELINUX | 44 | #ifdef CONFIG_SELINUX |
39 | #include <selinux/selinux.h> | 45 | #include <selinux/selinux.h> |
40 | #endif | 46 | #endif |
41 | 47 | ||
48 | #ifdef CONFIG_LOCALE_SUPPORT | ||
49 | #include <locale.h> | ||
50 | #endif | ||
51 | |||
42 | #include "pwd_.h" | 52 | #include "pwd_.h" |
43 | #include "grp_.h" | 53 | #include "grp_.h" |
44 | #include "shadow_.h" | 54 | #include "shadow_.h" |
@@ -127,8 +137,8 @@ extern int bb_test(int argc, char** argv); | |||
127 | 137 | ||
128 | extern const char *bb_mode_string(int mode); | 138 | extern const char *bb_mode_string(int mode); |
129 | extern int is_directory(const char *name, int followLinks, struct stat *statBuf); | 139 | extern int is_directory(const char *name, int followLinks, struct stat *statBuf); |
130 | extern DIR *bb_opendir(const char *path); | 140 | extern DIR *warn_opendir(const char *path); |
131 | extern DIR *bb_xopendir(const char *path); | 141 | extern DIR *xopendir(const char *path); |
132 | 142 | ||
133 | extern int remove_file(const char *path, int flags); | 143 | extern int remove_file(const char *path, int flags); |
134 | extern int copy_file(const char *source, const char *dest, int flags); | 144 | extern int copy_file(const char *source, const char *dest, int flags); |
@@ -161,26 +171,24 @@ extern char *bb_get_chomped_line_from_file(FILE *file); | |||
161 | extern char *bb_get_chunk_from_file(FILE *file, int *end); | 171 | extern char *bb_get_chunk_from_file(FILE *file, int *end); |
162 | extern int bb_copyfd_size(int fd1, int fd2, const off_t size); | 172 | extern int bb_copyfd_size(int fd1, int fd2, const off_t size); |
163 | extern int bb_copyfd_eof(int fd1, int fd2); | 173 | extern int bb_copyfd_eof(int fd1, int fd2); |
164 | extern void bb_xprint_and_close_file(FILE *file); | ||
165 | extern int bb_xprint_file_by_name(const char *filename); | ||
166 | extern char bb_process_escape_sequence(const char **ptr); | 174 | extern char bb_process_escape_sequence(const char **ptr); |
167 | extern char *bb_get_last_path_component(char *path); | 175 | extern char *bb_get_last_path_component(char *path); |
168 | extern FILE *bb_wfopen(const char *path, const char *mode); | 176 | extern FILE *bb_wfopen(const char *path, const char *mode); |
169 | extern FILE *bb_wfopen_input(const char *filename); | 177 | extern FILE *bb_wfopen_input(const char *filename); |
170 | extern FILE *bb_xfopen(const char *path, const char *mode); | 178 | extern FILE *xfopen(const char *path, const char *mode); |
171 | 179 | ||
172 | extern int bb_fclose_nonstdin(FILE *f); | 180 | extern int bb_fclose_nonstdin(FILE *f); |
173 | extern void bb_fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN; | 181 | extern void bb_fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN; |
174 | 182 | ||
175 | extern void xstat(const char *filename, struct stat *buf); | 183 | extern void xstat(const char *filename, struct stat *buf); |
176 | extern int bb_xsocket(int domain, int type, int protocol); | 184 | extern int xsocket(int domain, int type, int protocol); |
177 | extern pid_t bb_spawn(char **argv); | 185 | extern pid_t spawn(char **argv); |
178 | extern pid_t bb_xspawn(char **argv); | 186 | extern pid_t xspawn(char **argv); |
179 | extern int wait4pid(int pid); | 187 | extern int wait4pid(int pid); |
180 | extern void bb_xdaemon(int nochdir, int noclose); | 188 | extern void xdaemon(int nochdir, int noclose); |
181 | extern void bb_xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); | 189 | extern void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); |
182 | extern void bb_xlisten(int s, int backlog); | 190 | extern void xlisten(int s, int backlog); |
183 | extern void bb_xchdir(const char *path); | 191 | extern void xchdir(const char *path); |
184 | extern void utoa_to_buf(unsigned n, char *buf, unsigned buflen); | 192 | extern void utoa_to_buf(unsigned n, char *buf, unsigned buflen); |
185 | extern char *utoa(unsigned n); | 193 | extern char *utoa(unsigned n); |
186 | extern void itoa_to_buf(int n, char *buf, unsigned buflen); | 194 | extern void itoa_to_buf(int n, char *buf, unsigned buflen); |
@@ -204,9 +212,9 @@ extern int bb_printf(const char * __restrict format, ...) | |||
204 | __attribute__ ((format (printf, 1, 2))); | 212 | __attribute__ ((format (printf, 1, 2))); |
205 | 213 | ||
206 | //#warning rename to xferror_filename? | 214 | //#warning rename to xferror_filename? |
207 | extern void bb_xferror(FILE *fp, const char *fn); | 215 | extern void xferror(FILE *fp, const char *fn); |
208 | extern void bb_xferror_stdout(void); | 216 | extern void xferror_stdout(void); |
209 | extern void bb_xfflush_stdout(void); | 217 | extern void xfflush_stdout(void); |
210 | 218 | ||
211 | extern void bb_warn_ignoring_args(int n); | 219 | extern void bb_warn_ignoring_args(int n); |
212 | 220 | ||
@@ -224,8 +232,8 @@ extern void *xrealloc(void *old, size_t size); | |||
224 | extern void *xzalloc(size_t size); | 232 | extern void *xzalloc(size_t size); |
225 | extern void *xcalloc(size_t nmemb, size_t size); | 233 | extern void *xcalloc(size_t nmemb, size_t size); |
226 | 234 | ||
227 | extern char *bb_xstrdup (const char *s); | 235 | extern char *xstrdup (const char *s); |
228 | extern char *bb_xstrndup (const char *s, int n); | 236 | extern char *xstrndup (const char *s, int n); |
229 | extern char *safe_strncpy(char *dst, const char *src, size_t size); | 237 | extern char *safe_strncpy(char *dst, const char *src, size_t size); |
230 | extern int safe_strtoi(char *arg, int* value); | 238 | extern int safe_strtoi(char *arg, int* value); |
231 | extern int safe_strtod(char *arg, double* value); | 239 | extern int safe_strtod(char *arg, double* value); |
@@ -321,7 +329,6 @@ char *concat_path_file(const char *path, const char *filename); | |||
321 | char *concat_subpath_file(const char *path, const char *filename); | 329 | char *concat_subpath_file(const char *path, const char *filename); |
322 | char *last_char_is(const char *s, int c); | 330 | char *last_char_is(const char *s, int c); |
323 | 331 | ||
324 | int read_package_field(const char *package_buffer, char **field_name, char **field_value); | ||
325 | //#warning yuk! | 332 | //#warning yuk! |
326 | char *fgets_str(FILE *file, const char *terminating_string); | 333 | char *fgets_str(FILE *file, const char *terminating_string); |
327 | 334 | ||
@@ -458,7 +465,8 @@ int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name); | |||
458 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); | 465 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); |
459 | void reset_ino_dev_hashtable(void); | 466 | void reset_ino_dev_hashtable(void); |
460 | 467 | ||
461 | char *bb_xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); | 468 | char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); |
469 | void xprint_and_close_file(FILE *file); | ||
462 | 470 | ||
463 | #define FAIL_DELAY 3 | 471 | #define FAIL_DELAY 3 |
464 | extern void bb_do_delay(int seconds); | 472 | extern void bb_do_delay(int seconds); |
@@ -476,8 +484,8 @@ extern int correct_password ( const struct passwd *pw ); | |||
476 | extern char *pw_encrypt(const char *clear, const char *salt); | 484 | extern char *pw_encrypt(const char *clear, const char *salt); |
477 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp); | 485 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp); |
478 | 486 | ||
479 | extern int bb_xopen(const char *pathname, int flags); | 487 | extern int xopen(const char *pathname, int flags); |
480 | extern int bb_xopen3(const char *pathname, int flags, int mode); | 488 | extern int xopen3(const char *pathname, int flags, int mode); |
481 | extern void xread(int fd, void *buf, size_t count); | 489 | extern void xread(int fd, void *buf, size_t count); |
482 | extern unsigned char xread_char(int fd); | 490 | extern unsigned char xread_char(int fd); |
483 | extern void xlseek(int fd, off_t offset, int whence); | 491 | extern void xlseek(int fd, off_t offset, int whence); |
@@ -550,7 +558,7 @@ void md5_begin(md5_ctx_t *ctx); | |||
550 | void md5_hash(const void *data, size_t length, md5_ctx_t *ctx); | 558 | void md5_hash(const void *data, size_t length, md5_ctx_t *ctx); |
551 | void *md5_end(void *resbuf, md5_ctx_t *ctx); | 559 | void *md5_end(void *resbuf, md5_ctx_t *ctx); |
552 | 560 | ||
553 | extern uint32_t *bb_crc32_filltable (int endian); | 561 | extern uint32_t *crc32_filltable (int endian); |
554 | 562 | ||
555 | #ifndef RB_POWER_OFF | 563 | #ifndef RB_POWER_OFF |
556 | /* Stop system and switch power off if possible. */ | 564 | /* Stop system and switch power off if possible. */ |