diff options
author | Ron Yorston <rmy@pobox.com> | 2012-03-22 15:21:20 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-03-22 15:21:20 +0000 |
commit | 0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2 (patch) | |
tree | 6709ddd6071a9c238ba69233540bbcfe560c6a44 /include/libbb.h | |
parent | 67758035a4fe040c6ac69b39d61bcd6bddd7b827 (diff) | |
parent | 56a3b82e9692a25ef9c9269e88feac0d579ce8e8 (diff) | |
download | busybox-w32-0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2.tar.gz busybox-w32-0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2.tar.bz2 busybox-w32-0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2.zip |
Merge commit '56a3b82e9692a25ef9c9269e88feac0d579ce8e8' into merge
Conflicts:
coreutils/ls.c
include/platform.h
libbb/bb_basename.c
Diffstat (limited to 'include/libbb.h')
-rw-r--r-- | include/libbb.h | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/include/libbb.h b/include/libbb.h index 4f46cf8c5..ac5722c89 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -20,6 +20,12 @@ | |||
20 | #include <netdb.h> | 20 | #include <netdb.h> |
21 | #include <setjmp.h> | 21 | #include <setjmp.h> |
22 | #include <signal.h> | 22 | #include <signal.h> |
23 | #if defined __UCLIBC__ /* TODO: and glibc? */ | ||
24 | /* use inlined versions of these: */ | ||
25 | # define sigfillset(s) __sigfillset(s) | ||
26 | # define sigemptyset(s) __sigemptyset(s) | ||
27 | # define sigisemptyset(s) __sigisemptyset(s) | ||
28 | #endif | ||
23 | #include <stdint.h> | 29 | #include <stdint.h> |
24 | #include <stdio.h> | 30 | #include <stdio.h> |
25 | #include <stdlib.h> | 31 | #include <stdlib.h> |
@@ -363,6 +369,7 @@ extern void bb_copyfd_exact_size(int fd1, int fd2, off_t size) FAST_FUNC; | |||
363 | /* "short" copy can be detected by return value < size */ | 369 | /* "short" copy can be detected by return value < size */ |
364 | /* this helper yells "short read!" if param is not -1 */ | 370 | /* this helper yells "short read!" if param is not -1 */ |
365 | extern void complain_copyfd_and_die(off_t sz) NORETURN FAST_FUNC; | 371 | extern void complain_copyfd_and_die(off_t sz) NORETURN FAST_FUNC; |
372 | |||
366 | extern char bb_process_escape_sequence(const char **ptr) FAST_FUNC; | 373 | extern char bb_process_escape_sequence(const char **ptr) FAST_FUNC; |
367 | char* strcpy_and_process_escape_sequences(char *dst, const char *src) FAST_FUNC; | 374 | char* strcpy_and_process_escape_sequences(char *dst, const char *src) FAST_FUNC; |
368 | /* xxxx_strip version can modify its parameter: | 375 | /* xxxx_strip version can modify its parameter: |
@@ -371,9 +378,13 @@ char* strcpy_and_process_escape_sequences(char *dst, const char *src) FAST_FUNC; | |||
371 | * "abc/def" -> "def" | 378 | * "abc/def" -> "def" |
372 | * "abc/def/" -> "def" !! | 379 | * "abc/def/" -> "def" !! |
373 | */ | 380 | */ |
374 | extern char *bb_get_last_path_component_strip(char *path) FAST_FUNC; | 381 | char *bb_get_last_path_component_strip(char *path) FAST_FUNC; |
375 | /* "abc/def/" -> "" and it never modifies 'path' */ | 382 | /* "abc/def/" -> "" and it never modifies 'path' */ |
376 | extern char *bb_get_last_path_component_nostrip(const char *path) FAST_FUNC; | 383 | char *bb_get_last_path_component_nostrip(const char *path) FAST_FUNC; |
384 | /* Simpler version: does not special case "/" string */ | ||
385 | const char *bb_basename(const char *name) FAST_FUNC; | ||
386 | /* NB: can violate const-ness (similarly to strchr) */ | ||
387 | char *last_char_is(const char *s, int c) FAST_FUNC; | ||
377 | 388 | ||
378 | void ndelay_on(int fd) FAST_FUNC; | 389 | void ndelay_on(int fd) FAST_FUNC; |
379 | void ndelay_off(int fd) FAST_FUNC; | 390 | void ndelay_off(int fd) FAST_FUNC; |
@@ -685,7 +696,7 @@ void* xrealloc_vector_helper(void *vector, unsigned sizeof_and_shift, int idx) F | |||
685 | 696 | ||
686 | 697 | ||
687 | extern ssize_t safe_read(int fd, void *buf, size_t count) FAST_FUNC; | 698 | extern ssize_t safe_read(int fd, void *buf, size_t count) FAST_FUNC; |
688 | extern ssize_t nonblock_safe_read(int fd, void *buf, size_t count) FAST_FUNC; | 699 | extern ssize_t nonblock_immune_read(int fd, void *buf, size_t count, int loop_on_EINTR) FAST_FUNC; |
689 | // NB: will return short read on error, not -1, | 700 | // NB: will return short read on error, not -1, |
690 | // if some data was read before error occurred | 701 | // if some data was read before error occurred |
691 | extern ssize_t full_read(int fd, void *buf, size_t count) FAST_FUNC; | 702 | extern ssize_t full_read(int fd, void *buf, size_t count) FAST_FUNC; |
@@ -696,7 +707,7 @@ extern ssize_t open_read_close(const char *filename, void *buf, size_t maxsz) FA | |||
696 | // Reads one line a-la fgets (but doesn't save terminating '\n'). | 707 | // Reads one line a-la fgets (but doesn't save terminating '\n'). |
697 | // Reads byte-by-byte. Useful when it is important to not read ahead. | 708 | // Reads byte-by-byte. Useful when it is important to not read ahead. |
698 | // Bytes are appended to pfx (which must be malloced, or NULL). | 709 | // Bytes are appended to pfx (which must be malloced, or NULL). |
699 | extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p) FAST_FUNC; | 710 | extern char *xmalloc_reads(int fd, size_t *maxsz_p) FAST_FUNC; |
700 | /* Reads block up to *maxsz_p (default: INT_MAX - 4095) */ | 711 | /* Reads block up to *maxsz_p (default: INT_MAX - 4095) */ |
701 | extern void *xmalloc_read(int fd, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; | 712 | extern void *xmalloc_read(int fd, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; |
702 | /* Returns NULL if file can't be opened (default max size: INT_MAX - 4095) */ | 713 | /* Returns NULL if file can't be opened (default max size: INT_MAX - 4095) */ |
@@ -997,9 +1008,13 @@ extern uint32_t option_mask32; | |||
997 | extern uint32_t getopt32(char **argv, const char *applet_opts, ...) FAST_FUNC; | 1008 | extern uint32_t getopt32(char **argv, const char *applet_opts, ...) FAST_FUNC; |
998 | 1009 | ||
999 | 1010 | ||
1011 | /* Having next pointer as a first member allows easy creation | ||
1012 | * of "llist-compatible" structs, and using llist_FOO functions | ||
1013 | * on them. | ||
1014 | */ | ||
1000 | typedef struct llist_t { | 1015 | typedef struct llist_t { |
1001 | char *data; | ||
1002 | struct llist_t *link; | 1016 | struct llist_t *link; |
1017 | char *data; | ||
1003 | } llist_t; | 1018 | } llist_t; |
1004 | void llist_add_to(llist_t **old_head, void *data) FAST_FUNC; | 1019 | void llist_add_to(llist_t **old_head, void *data) FAST_FUNC; |
1005 | void llist_add_to_end(llist_t **list_head, void *data) FAST_FUNC; | 1020 | void llist_add_to_end(llist_t **list_head, void *data) FAST_FUNC; |
@@ -1198,10 +1213,8 @@ void config_close(parser_t *parser) FAST_FUNC; | |||
1198 | * If path is NULL, it is assumed to be "/". | 1213 | * If path is NULL, it is assumed to be "/". |
1199 | * filename should not be NULL. */ | 1214 | * filename should not be NULL. */ |
1200 | char *concat_path_file(const char *path, const char *filename) FAST_FUNC; | 1215 | char *concat_path_file(const char *path, const char *filename) FAST_FUNC; |
1216 | /* Returns NULL on . and .. */ | ||
1201 | char *concat_subpath_file(const char *path, const char *filename) FAST_FUNC; | 1217 | char *concat_subpath_file(const char *path, const char *filename) FAST_FUNC; |
1202 | const char *bb_basename(const char *name) FAST_FUNC; | ||
1203 | /* NB: can violate const-ness (similarly to strchr) */ | ||
1204 | char *last_char_is(const char *s, int c) FAST_FUNC; | ||
1205 | 1218 | ||
1206 | 1219 | ||
1207 | int bb_make_directory(char *path, long mode, int flags) FAST_FUNC; | 1220 | int bb_make_directory(char *path, long mode, int flags) FAST_FUNC; |
@@ -1269,14 +1282,19 @@ extern int correct_password(const struct passwd *pw) FAST_FUNC; | |||
1269 | #endif | 1282 | #endif |
1270 | extern char *pw_encrypt(const char *clear, const char *salt, int cleanup) FAST_FUNC; | 1283 | extern char *pw_encrypt(const char *clear, const char *salt, int cleanup) FAST_FUNC; |
1271 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp) FAST_FUNC; | 1284 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp) FAST_FUNC; |
1272 | /* rnd is additional random input. New one is returned. | 1285 | /* |
1286 | * rnd is additional random input. New one is returned. | ||
1273 | * Useful if you call crypt_make_salt many times in a row: | 1287 | * Useful if you call crypt_make_salt many times in a row: |
1274 | * rnd = crypt_make_salt(buf1, 4, 0); | 1288 | * rnd = crypt_make_salt(buf1, 4, 0); |
1275 | * rnd = crypt_make_salt(buf2, 4, rnd); | 1289 | * rnd = crypt_make_salt(buf2, 4, rnd); |
1276 | * rnd = crypt_make_salt(buf3, 4, rnd); | 1290 | * rnd = crypt_make_salt(buf3, 4, rnd); |
1277 | * (otherwise we risk having same salt generated) | 1291 | * (otherwise we risk having same salt generated) |
1278 | */ | 1292 | */ |
1279 | extern int crypt_make_salt(char *p, int cnt, int rnd) FAST_FUNC; | 1293 | extern int crypt_make_salt(char *p, int cnt /*, int rnd*/) FAST_FUNC; |
1294 | /* "$N$" + sha_salt_16_bytes + NUL */ | ||
1295 | #define MAX_PW_SALT_LEN (3 + 16 + 1) | ||
1296 | extern char* crypt_make_pw_salt(char p[MAX_PW_SALT_LEN], const char *algo) FAST_FUNC; | ||
1297 | |||
1280 | 1298 | ||
1281 | /* Returns number of lines changed, or -1 on error */ | 1299 | /* Returns number of lines changed, or -1 on error */ |
1282 | #if !(ENABLE_FEATURE_ADDUSER_TO_GROUP || ENABLE_FEATURE_DEL_USER_FROM_GROUP) | 1300 | #if !(ENABLE_FEATURE_ADDUSER_TO_GROUP || ENABLE_FEATURE_DEL_USER_FROM_GROUP) |