aboutsummaryrefslogtreecommitdiff
path: root/include/libbb.h
AgeCommit message (Collapse)Author
2009-10-23libbb.h: tidy it up a bit. no code changes (verified)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23fix isalnum and isxdigit. Unfortunately, +285 bytesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23eliminate all remaining users of ctype. ~600 byte large tables are gone.Denys Vlasenko
function old new delta skip_thing 253 278 +25 find_range 497 508 +11 ask 220 228 +8 ... setlocalenv 90 82 -8 bb_strtoll 84 76 -8 bb_strtol 85 77 -8 is_well_formed_var_name 75 66 -9 expand 651 641 -10 endofname 104 92 -12 buffer_fill_and_print 196 179 -17 isxdigit 18 - -18 httpd_main 729 711 -18 __GI_isxdigit 18 - -18 ispunct 20 - -20 isalnum 20 - -20 __GI_ispunct 20 - -20 __GI_isalnum 20 - -20 toupper 29 - -29 tolower 29 - -29 __GI_toupper 29 - -29 __GI_tolower 29 - -29 do_cmd 4454 4330 -124 ------------------------------------------------------------------------------ (add/remove: 0/12 grow/shrink: 14/29 up/down: 81/-549) Total: -468 bytes text data bss dec hex filename 823051 445 7548 831044 cae44 busybox_old 821970 441 7548 829959 caa07 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23*: optimize most of isXXXXX() macrosDenys Vlasenko
text data bss dec hex filename 824164 453 6812 831429 cafc5 busybox_old 823730 453 6812 830995 cae13 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23libbb: smaller isdigit. -95 bytesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-22*: use better isspace implementationDenys Vlasenko
function old new delta asciifile 90 106 +16 expand 653 658 +5 skip_non_whitespace 21 25 +4 bb_iswspace 25 28 +3 readcmd 1071 1072 +1 find_range 496 497 +1 singlemount 772 771 -1 ifupdown_main 2134 2133 -1 edir 370 369 -1 volume_id_set_label_string 82 79 -3 trim 85 82 -3 rtc_adjtime_is_utc 141 138 -3 rewrite 1039 1036 -3 do_cmd 4465 4462 -3 bb_dump_add 358 355 -3 awk_split 553 550 -3 fbset_main 1273 1268 -5 skip_thing 259 253 -6 get_trimmed_slice 46 39 -7 bb__parsegrent 245 238 -7 parse_file_cmd 116 108 -8 check 1532 1523 -9 bb__pgsreader 198 188 -10 dot_skip_over_ws 61 46 -15 colon 3032 3012 -20 if_readlist_proc 655 634 -21 normalize 193 165 -28 add_cmd 1162 1133 -29 get_key 528 476 -52 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 6/23 up/down: 30/-241) Total: -211 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-19randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-15move generate_uuid from mkswap to libbbVladimir Dronnikov
Signed-off-by: Vladimir Dronnikov <dronnikov@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-13libbb/human_readable.c: shrink; and reduce bss usageDenys Vlasenko
also, move smart_ulltoaN there and comment usage locations function old new delta static.unit_chars 7 9 +2 utoa_to_buf 110 108 -2 make_human_readable_str 262 258 -4 fallbackSort 1723 1719 -4 static.fmt 97 92 -5 static.fmt_tenths 10 - -10 static.str 21 4 -17 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/5 up/down: 2/-42) Total: -40 bytes text data bss dec hex filename 820981 453 6932 828366 ca3ce busybox_old 820968 453 6916 828337 ca3b1 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-05unpackers: check errors from close() tooDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-29find: -follow should not error out on dandling linksDenys Vlasenko
function old new delta recursive_action 425 465 +40 find_main 436 465 +29 test_main 247 253 +6 need_print 1 - -1 doCommands 2523 2521 -2 compare_keys 737 735 -2 xdev_dev 4 - -4 xdev_count 4 - -4 recurse_flags 4 - -4 mkfs_vfat_main 1609 1605 -4 actions 4 - -4 fileAction 588 583 -5 ------------------------------------------------------------------------------ (add/remove: 0/5 grow/shrink: 3/4 up/down: 75/-30) Total: 45 bytes text data bss dec hex filename 822711 450 7684 830845 cad7d busybox_old 822773 445 7668 830886 cada6 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-22ps: fix compile breakageDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-19ps,top: add an option to show threads. +260 bytes of codeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-12fix read_cmdline API and a small buglet where "[comm]" may be too narrowDenys Vlasenko
function old new delta func_args 25 26 +1 read_cmdline 119 114 -5 display_process_list 1462 1447 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 1/-20) Total: -19 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06documentation and typo fixes. By Dan Fandrich (dan AT coneharvesters.com)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06remove some GNUisms. by Dan Fandrich (dan AT coneharvesters.com)Denys Vlasenko
function old new delta logdirs_reopen 1310 1308 -2 read_line_input 4757 4753 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6) Total: -6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-21fix duplicate FAST_FUNC FAST_FUNCDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-29make find_pid_by_name look at /proc/PID/exe tooAlexander Shishkin
function old new delta procps_scan 1642 1709 +67 find_pid_by_name 193 223 +30 free_procps_scan 29 37 +8 Signed-off-by: Alexander Shishkin <virtuoso@slind.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-18fix mountpoint test to not prevemt mkfs_xxx from making image in any fileDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-18touch: implement -d --date (our own testsuite needs that)Denys Vlasenko
function old new delta static.uname_longopts - 137 +137 touch_main 231 360 +129 static.touch_longopts - 32 +32 validate_tm_time - 28 +28 packed_usage 26616 26624 +8 date_main 687 686 -1 static.longopts 162 - -162 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 2/1 up/down: 334/-163) Total: 171 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-18date: factor out date parsing (in preparation for touch -d)Denys Vlasenko
function old new delta parse_datestr - 391 +391 sha512_process_block128 1283 1310 +27 buffer_fill_and_print 179 196 +17 nexpr 826 840 +14 unzip_main 1931 1939 +8 popstring 134 140 +6 qrealloc 33 36 +3 builtin_umask 121 123 +2 evalvar 1365 1363 -2 changepath 194 192 -2 do_compress 1698 1688 -10 hwclock_main 340 329 -11 cmdputs 414 402 -12 identify 4343 4329 -14 date_main 1186 687 -499 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 7/7 up/down: 468/-550) Total: -82 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-16fix a thinko in lineedit completion codeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-09restore shadow.h independenceMike Frysinger
Commit ee5dce336597 made busybox require shadow.h from the toolchain even if the config opted for the internal busybox implementation. This makes building with toolchains that lack shadow support impossible. Since the merge only saved us from duplicating a simple structure (whose ABI isn't going to ever change), restore the logic for complete busybox shadow independence by reverting that previous commit slightly. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-05df: fix "df /"Denys Vlasenko
also, clean up mount checks in mkfs/fsck. function old new delta find_mount_point 243 261 +18 sha1_process_block64 497 510 +13 find_main 436 444 +8 display_speed 85 90 +5 df_main 795 793 -2 parse_command 1463 1460 -3 static.ignored_mounts 8 - -8 mkfs_minix_main 2962 2937 -25 fsck_minix_main 3065 2970 -95 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 4/4 up/down: 44/-133) Total: -89 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-05Patches to enable FreeBSD buildDenys Vlasenko
platform.h: fix wrong check for endianness, fix lchown aliasing to chown on uclibc. Code seems to not be affected in my testing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-03ps: conditionally support additional -o FIELDsDenys Vlasenko
function old new delta procps_scan 1409 1642 +233 out_spec 220 300 +80 func_ruser - 36 +36 func_rgroup - 36 +36 func_group 13 49 +36 func_nice - 29 +29 buffer_fill_and_print 179 196 +17 send_tree 355 360 +5 mkfs_vfat_main 1604 1609 +5 display_speed 85 90 +5 scriptreplay_main 194 197 +3 find_out_spec 55 58 +3 changepath 192 195 +3 sha1_process_block64 497 484 -13 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 10/1 up/down: 491/-13) Total: 478 bytes Signed-off-by: David Krakov <krakov@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-19getopt: FEATURE_GETOPT_LONG for -l; rename GETOPT_LONG to LONG_OPTSDenys Vlasenko
Signed-off-by: Colin Watson <cjwatson@ubuntu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-07stop using non-standard macro, use WEXITSTATUS insteadDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-29read_key: drop optimization where we read 3 bytes at onceDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-17line editing: add an option to emit ESC [ 6 n and use resultsDenys Vlasenko
This makes line editing able to recognize case when cursor was not at the beginning of the line. It may also be adapted later to find out display size (serial line users would love it). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-15xmalloc_[open_]read[_close]: do not ignore xrealloc return valueDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-15lineedit: use read_key to recognize ESC sequence.Denys Vlasenko
This fixes several vi mode bugs and prepares for further fixes. function old new delta read_line_input 3287 5511 +2224 remember_in_history - 499 +499 lineedit_read_key - 70 +70 read_key 321 332 +11 input_tab 2823 - -2823 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 2/0 up/down: 2804/-2823) Total: -19 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-04-22httpd: simplify insane conf file parserDenis Vlasenko
function old new delta bb_simplify_abs_path_inplace - 98 +98 parse_expr 824 832 +8 passwd_main 1025 1027 +2 evalvar 1374 1376 +2 parse_command 1463 1460 -3 bb_simplify_path 137 55 -82 parse_conf 1572 1422 -150 ------------------------------------------------------------------------------ (add/remove: 3/2 grow/shrink: 3/3 up/down: 126/-251) Total: -125 bytes
2009-04-21*: mass renaming of USE_XXXX to IF_XXXXDenis Vlasenko
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
2009-04-14*: unify concurrent-safe update of /etc/{passwd,group,[g]shadow}Denis Vlasenko
by Tito (farmatito AT tiscali.it) function old new delta update_passwd 743 1171 +428 bb_perror_nomsg - 9 +9 find_main 436 444 +8 passwd_main 1023 1027 +4 nameval 202 206 +4 chpasswd_main 315 319 +4 bb__parsespent 119 117 -2 adduser_main 654 650 -4 addgroup_main 345 341 -4 sv_main 1228 1222 -6 deluser_main 173 160 -13 bb_internal_putpwent 69 - -69 add_user_to_group 231 - -231 del_line_matching 460 31 -429 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 5/6 up/down: 457/-758) Total: -301 bytes
2009-04-13move llist_find_str from modutils to libbbDenis Vlasenko
2009-04-09*: make "pragma GCC visibility push(hidden)" less uglyDenis Vlasenko
2009-04-01trailing whitespace removalDenis Vlasenko
2009-03-28mkdosfs (aka mkfs.vfat): new applet by VladimirDenis Vlasenko
text data bss dec hex filename 821202 476 7616 829294 ca76e busybox_old 823577 476 7616 831669 cb0b5 busybox_unstripped
2009-03-23libbb: revent previous version of "concurrent history updating"Denis Vlasenko
and replace it with one which does not "snoop" history written by others. (1) it is what bug 185 needs, and (2) it is less bloaty: function old new delta load_history - 252 +252 read_line_input 3155 3287 +132 next_token 914 918 +4 qrealloc 36 33 -3 getoptscmd 713 708 -5 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/2 up/down: 388/-8) Total: 380 bytes
2009-03-22libbb: make history saving/loading concurrent-safeDenis Vlasenko
* all history writers always append (not overwrite) history files * they reload history if they detect that file length has changed since last write * they trim history file only when it grows 4 times longer than MAXLINES * they do this atomically by creating new file and renaming it to old Unfortunately, this comes at a price: function old new delta load_history - 346 +346 read_line_input 3155 3358 +203 new_line_input_t 17 31 +14 ...irrelevant small jitter... ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 5/5 up/down: 573/-13) Total: 560 bytes
2009-03-20Compatibility fixes:Denis Vlasenko
grep: support -z find: support --mindepth together +45 bytes cpio: support -p (configurable, +230 bytes) libbb: tweaks for cpio
2009-03-18ftpd: fix command fetching to not do it in 1-byte reads;Denis Vlasenko
fix command de-escaping. Tested to download files with embeeded \xff and LF. libbb: tweaks for the above function old new delta ftpd_main 2231 2321 +90 xmalloc_fgets_internal 190 222 +32 xmalloc_fgets_str_len - 27 +27 xmalloc_fgets_str 7 23 +16 xmalloc_fgetline_str 10 26 +16 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/0 up/down: 181/0) Total: 181 bytes
2009-03-15sha: fix thinko in sha512; add FAST_FUNC to sha1/sha256Denis Vlasenko
function old new delta sha512_process_block128 1334 1336 +2 sha1_hash 112 111 -1 sha256_process_block64 446 440 -6 sha1_process_block64 494 484 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 2/-17) Total: -15 bytes
2009-03-15sha: merge sha1/sha256 handling (they are similar enough for this),Denis Vlasenko
shrink sha215 code function old new delta sha1_end 129 142 +13 sha1_process_block64 486 494 +8 sha256_begin 37 44 +7 sha1_begin 49 56 +7 sha1_hash 108 112 +4 ... sha512_end 204 184 -20 sha512_process_block128 1405 1334 -71 sha256_process_block64 520 446 -74 sha256_end 147 - -147 sha512_hash 297 130 -167 sha256_hash 260 - -260 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 11/9 up/down: 59/-752) Total: -693 bytes
2009-03-12sha: reduce sha256/512 context size. Make sha1/sha256 code more similarDenis Vlasenko
function old new delta sha512_end 182 204 +22 sha256_end 137 147 +10 sha1_hash 113 108 -5 sha1_end 143 129 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 32/-19) Total: 13 bytes
2009-03-12shrink sha hashing a bit more (remove wbuflen field from ctx),Denis Vlasenko
remove the requirement for aligned buffer function old new delta sha512_hash 262 297 +35 sha1_end 136 143 +7 passwd_main 1019 1023 +4 sha256_end 135 137 +2 count_lines 72 74 +2 sha256_hash 259 260 +1 popstring 164 158 -6 sha512_begin 88 81 -7 sha256_begin 44 37 -7 parse_expr 832 824 -8 bbunpack 446 438 -8 sha256_process_block64 529 520 -9 md5_end 166 151 -15 evaltreenr 817 802 -15 evaltree 817 802 -15 sha512_end 204 182 -22 sha512_process_block128 1444 1405 -39 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 6/11 up/down: 51/-151) Total: -100 bytes
2009-03-11sha256/512: code shrink. Run-tested.Denis Vlasenko
function old new delta sha512_process_block128 - 1444 +1444 sha1_process_block64 - 542 +542 sha256_process_block64 - 529 +529 K512_lo - 320 +320 K256 - 320 +320 init512_lo - 32 +32 init256 - 32 +32 sha1_hash 99 128 +29 sha256_end 160 135 -25 sha1_end 189 160 -29 sha512_end 237 204 -33 sha256_begin 77 44 -33 sha512_begin 154 88 -66 sha256_hash 338 259 -79 sha512_hash 358 262 -96 sha1_compile 542 - -542 sha256_process_block 594 - -594 static.K 896 - -896 sha512_process_block 1861 - -1861 ------------------------------------------------------------------------------ (add/remove: 7/4 grow/shrink: 1/7 up/down: 3248/-4254) Total: -1006 bytes text data bss dec hex filename 808013 468 7856 816337 c74d1 busybox_old 807007 468 7856 815331 c70e3 busybox_unstripped
2009-03-09ftpd: reuse ls applet for LIST/NLST/STAT generationDenis Vlasenko
function old new delta popen_ls - 211 +211 ftpd_main 1760 1826 +66 handle_dir_common 199 228 +29 get_remote_transfer_fd 89 104 +15 replace_char 30 34 +4 handle_upload_common 263 265 +2 bind_for_passive_mode 129 121 -8 cmdio_write 84 62 -22 escape_text 166 136 -30 init_data_sock_params 81 - -81 ftpdataio_dispose_transfer_fd 87 - -87 write_dirstats 149 - -149 write_filestats 603 - -603 ------------------------------------------------------------------------------ (add/remove: 1/4 grow/shrink: 11/5 up/down: 384/-986) Total: -602 bytes text data bss dec hex filename 808804 476 7864 817144 c77f8 busybox_old 808156 476 7864 816496 c7570 busybox_unstripped
2009-03-09*: move get_sock_lsa and xwrite_str to libbb, use where appropriateDenis Vlasenko
function old new delta get_sock_lsa - 72 +72 buffer_fill_and_print 179 196 +17 parse_expr 824 832 +8 read_base64 343 348 +5 nameval 202 206 +4 fbset_main 1694 1698 +4 expand 1849 1853 +4 udhcp_send_kernel_packet 249 252 +3 udhcp_get_option 223 222 -1 chat_main 1246 1245 -1 pack_gzip 1661 1659 -2 doset 299 297 -2 bb__parsespent 119 117 -2 test_main 260 257 -3 qgravechar 109 106 -3 tcpudpsvd_main 1834 1830 -4 sysctl_display_all 589 580 -9 xopen_xwrite_close 44 33 -11 prs 30 18 -12 find_main 418 406 -12 full_write2_str 25 12 -13 adduser_main 667 654 -13 evaltreenr 817 802 -15 evaltree 817 802 -15 tftpd_main 526 493 -33 ftpd_main 2050 1990 -60 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 7/18 up/down: 117/-211) Total: -94 bytes