Commit Graph

50 Commits

Author SHA1 Message Date
Denys Vlasenko
10ad622dc2 Spelling fixes in comments, documentation, tests and examples
By klemens <ka7@github.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-17 16:13:32 +02:00
Denys Vlasenko
94dcfd8cc0 nc_bloaty: use poll() instead of select()
function                                             old     new   delta
readwrite                                            829     715    -114

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-17 17:48:59 +01:00
Denys Vlasenko
237bedd499 getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST
In many cases, this aqllows to drop use of opt_complementary.
Approximately -400 bytes:

function                                             old     new   delta
getopt32                                            1423    1502     +79
opt_string                                            17      18      +1
OPT_STR                                               24      25      +1
uniq_main                                            416     406     -10
timeout_main                                         279     269     -10
sulogin_main                                         270     260     -10
readprofile_main                                    1825    1815     -10
ps_main                                              543     533     -10
pidof_main                                           245     235     -10
pgrep_main                                           611     601     -10
od_main                                             2600    2590     -10
mkfs_minix_main                                     2684    2674     -10
mkfs_ext2_main                                      2603    2593     -10
microcom_main                                        712     702     -10
makemime_main                                        315     305     -10
ionice_main                                          282     272     -10
inetd_main                                          2074    2064     -10
ifplugd_main                                        1144    1134     -10
halt_main                                            353     343     -10
getopt_main                                          636     626     -10
fdisk_main                                          2854    2844     -10
env_main                                             206     196     -10
dmesg_main                                           319     309     -10
conspy_main                                         1214    1204     -10
awk_main                                             981     971     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/22 up/down: 81/-220)         Total: -139 bytes
   text	   data	    bss	    dec	    hex	filename
 919373	    906	  14060	 934339	  e41c3	busybox_old
 918969	    906	  14060	 933935	  e402f	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-06 21:58:02 +02:00
Denys Vlasenko
c52cbea2bb libbb: add setsockopt_foo helpers
function                                             old     new   delta
setsockopt_int                                         -      23     +23
do_load                                              918     934     +16
setsockopt_SOL_SOCKET_int                              -      14     +14
setsockopt_keepalive                                   -      10     +10
setsockopt_SOL_SOCKET_1                                -      10     +10
buffer_fill_and_print                                169     178      +9
setsockopt_1                                           -       8      +8
nfsmount                                            3560    3566      +6
redirect                                            1277    1282      +5
tcpudpsvd_main                                      1782    1786      +4
d6_send_kernel_packet                                272     275      +3
i2cget_main                                          380     382      +2
ed_main                                             2544    2545      +1
scan_recursive                                       380     378      -2
nbdclient_main                                       492     490      -2
hash_find                                            235     233      -2
cmdputs                                              334     332      -2
parse_command                                       1443    1440      -3
static.two                                             4       -      -4
ntpd_main                                           1039    1035      -4
const_int_1                                            4       -      -4
const_IPTOS_LOWDELAY                                   4       -      -4
RCVBUF                                                 4       -      -4
ntp_init                                             474     469      -5
change_listen_mode                                   316     310      -6
uevent_main                                          416     409      -7
arping_main                                         1697    1690      -7
telnet_main                                         1612    1603      -9
socket_want_pktinfo                                   42      33      -9
setsockopt_reuseaddr                                  21      10     -11
setsockopt_broadcast                                  21      10     -11
httpd_main                                           772     757     -15
get_remote_transfer_fd                               109      94     -15
make_new_session                                     503     487     -16
ftpd_main                                           2177    2160     -17
read_bunzip                                         1896    1866     -30
common_traceroute_main                              4099    4058     -41
common_ping_main                                    1836    1783     -53
------------------------------------------------------------------------------
(add/remove: 5/4 grow/shrink: 8/21 up/down: 111/-283)        Total: -172 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24 20:00:17 +02:00
Denys Vlasenko
c472898eaa nc: fix option bit positions. Closes 6926
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-26 13:58:59 +01:00
Denys Vlasenko
05965cbb75 nc: remove unnecessary "errno = 0"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-29 14:18:32 +02:00
Denys Vlasenko
fd3ac96c0f nc: remove some dead code
function                                             old     new   delta
readwrite                                            887     841     -46

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-28 22:24:51 +02:00
Denys Vlasenko
ffeeb7a96c nc: exit when both stdin and network are closed.
function                                             old     new   delta
nc_main                                             1051    1042      -9
readwrite                                            943     887     -56

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-28 22:23:12 +02:00
Denys Vlasenko
de6f148006 nc_bloaty: support -ll and -lk. Closes 2245
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-28 12:20:06 +01:00
Denys Vlasenko
5e896481eb nc: support "-<other_opts>e PROG" form of -e option
function                                             old     new   delta
nc_main                                              975    1033     +58
doexec                                                31      45     +14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 72/0)               Total: 72 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-19 01:17:36 +01:00
Denys Vlasenko
2ea73b513d nc: small code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-19 22:31:01 +02:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Denys Vlasenko
ca18311d0a libbb: make set_nport accept pointer to sockaddr, not to len_and_sockaddr.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-07 17:52:20 +02:00
Denys Vlasenko
1c31e9e82b use BB_EXECVP_or_die where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 04:34:09 +01:00
Denys Vlasenko
1e23f32453 nc: fix SEGV on -v when NC_EXTRA is off
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-22 05:30:54 +01:00
Denys Vlasenko
3b2acb759c tweak help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-09 21:10:32 +02:00
Denys Vlasenko
b103fb10cf nc: show help text on bad parameters
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 18:41:56 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
7d1201c5d7 nc: better comments. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-28 04:17:06 +02:00
Denys Vlasenko
77cc2c5738 nc: introduce CONFIG_NC_110_COMPAT option.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-27 04:22:02 +02:00
Denys Vlasenko
41ddd9f606 *: make exec failure message more consistent
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-25 01:46:53 +02:00
Denys Vlasenko
866710a056 nc: fix "nc -nl -p LPORT RHOST" case (was expecting remote port 0). closes bug 837
function                                             old     new   delta
dolisten                                             742     830     +88

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-08 16:09:45 +01:00
Denys Vlasenko
2ec91aead5 *: remove some uses of argc
function                                             old     new   delta
whoami_main                                           34      37      +3
logname_main                                          60      63      +3
hostid_main                                           35      38      +3
ttysize_main                                         136     135      -1
nmeter_main                                          673     672      -1
logger_main                                          387     386      -1
uuencode_main                                        330     328      -2
ifupdown_main                                       2125    2123      -2
mesg_main                                            158     155      -3
free_main                                            333     330      -3
cal_main                                             902     899      -3
acpid_main                                           443     440      -3
ar_main                                              196     189      -7
find_main                                            476     467      -9
ifconfig_main                                       1235    1221     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/12 up/down: 9/-49)            Total: -40 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 14:15:38 +01:00
Denys Vlasenko
8131eea3dc *: introduce and use ffulsh_all()
function                                             old     new   delta
buffer_fill_and_print                                179     196     +17
fflush_all                                             -       9      +9
spawn                                                 87      92      +5
rtcwake_main                                         455     453      -2
...
alarm_intr                                            93      84      -9
readcmd                                             1072    1062     -10
bb_ask                                               345     333     -12
more_main                                            845     832     -13
flush_stdout_stderr                                   42      23     -19
xfflush_stdout                                        27       -     -27
flush_stderr                                          30       -     -30
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397)         Total: -366 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02 14:19:51 +01:00
Denis Vlasenko
f6b4685691 add FEATURE_UNIX_LOCAL. By Ingo van Lil (inguin AT gmx.de) 2009-04-25 13:16:53 +00:00
Denis Vlasenko
a771e7c005 *: remove check for errors on getsockaddr in cases we know they can't happen
libbb: make get_sock_lsa use only one getsockaddr syscall, not two

function                                             old     new   delta
get_sock_lsa                                          72     101     +29
do_iplink                                           1151    1137     -14
arping_main                                         1585    1569     -16
dolisten                                             789     755     -34
xrtnl_open                                           161      94     -67
2009-04-21 23:48:38 +00:00
Denis Vlasenko
5e34ff29bc *: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
2009-04-21 11:09:40 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Bernhard Reutner-Fischer
5e25ddb7d3 - use STD*_FILENO some more. No object-code changes 2008-05-19 09:48:17 +00:00
Denis Vlasenko
c4f12f59cc -Wall fixes by Cristian Ionescu-Idbohrn. No object code changes. 2008-05-12 14:35:56 +00:00
Denis Vlasenko
1d42665b6b *: shrink: use Vladimir's "o+" specifier instead of xatou(opt_param)
function                                             old     new   delta
getopt32                                            1370    1385     +15
sulogin_main                                         490     494      +4
realpath_main                                         84      86      +2
sleep_main                                            76      77      +1
mt_main                                              256     257      +1
printenv_main                                         75      74      -1
fdformat_main                                        546     545      -1
usleep_main                                           44      42      -2
setlogcons_main                                       77      75      -2
ed_main                                             2654    2649      -5
deallocvt_main                                        69      64      -5
addgroup_main                                        373     368      -5
mkfs_minix_main                                     2989    2982      -7
tail_main                                           1221    1213      -8
sv_main                                             1254    1241     -13
du_main                                              348     328     -20
tftp_main                                            325     302     -23
split_main                                           581     558     -23
nc_main                                             1000     977     -23
diff_main                                            891     868     -23
arping_main                                         1797    1770     -27
ls_main                                              893     847     -46
od_main                                             2797    2750     -47
readprofile_main                                    1944    1895     -49
tcpudpsvd_main                                      1973    1922     -51
udhcpc_main                                         2590    2513     -77
grep_main                                            824     722    -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/22 up/down: 23/-560)         Total: -537 bytes
   text    data     bss     dec     hex filename
 796973     658    7428  805059   c48c3 busybox_old
 796479     662    7420  804561   c46d1 busybox_unstripped
2008-03-17 09:09:09 +00:00
Denis Vlasenko
68404f13d4 *: add -Wunused-parameter; fix resulting breakage
function                                             old     new   delta
procps_scan                                         1265    1298     +33
aliascmd                                             278     283      +5
parse_file_cmd                                       116     120      +4
dname_enc                                            373     377      +4
setcmd                                                90      93      +3
execcmd                                               57      60      +3
count_lines                                           72      74      +2
process_command_subs                                 340     339      -1
test_main                                            409     407      -2
mknod_main                                           179     177      -2
handle_incoming_and_exit                            2653    2651      -2
argstr                                              1312    1310      -2
shiftcmd                                             131     128      -3
exitcmd                                               46      43      -3
dotcmd                                               297     294      -3
breakcmd                                              86      83      -3
evalpipe                                             353     349      -4
evalcommand                                         1180    1176      -4
evalcmd                                              109     105      -4
send_tree                                            374     369      -5
mkfifo_main                                           82      77      -5
evalsubshell                                         152     147      -5
typecmd                                               75      69      -6
letcmd                                                61      55      -6
add_cmd                                             1190    1183      -7
main                                                 891     883      -8
ash_main                                            1415    1407      -8
parse_stream                                        1377    1367     -10
alloc_procps_scan                                     55       -     -55
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148)          Total: -94 bytes
   text    data     bss     dec     hex filename
 797195     658    7428  805281   c49a1 busybox_old
 797101     658    7428  805187   c4943 busybox_unstripped
2008-03-17 09:00:54 +00:00
Denis Vlasenko
4cf1d08fc2 nc: remove a bit of bloat
inetd: more NOMMU fixes
rx: shrink
devfsd: minor shrink
vlock: shrink
tcpudp: narrow down window where we have no wildcard socket

parse_one_line                                      1015    1102     +87
init_ring                                              -      53     +53
xzalloc_lsa                                            -      48     +48
read_byte                                             51      50      -1
rearm_alarm                                           28      25      -3
nc_main                                             1028    1000     -28
initring                                              53       -     -53
vlock_main                                           583     496     -87
reread_config_file                                  1089     991     -98
rx_main                                             1046     912    -134
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/6 up/down: 188/-404)         Total: -216 bytes
   text    data     bss     dec     hex filename
 800120     661    7428  808209   c5511 busybox_old
 799796     661    7428  807885   c53cd busybox_unstripped
2008-03-12 23:13:50 +00:00
Denis Vlasenko
4e6d5117b8 inetd: make it NOMMU-capable and IPv6-friendly. Lots of renames
of variable/function names

Total: -2474 bytes
   text    data     bss     dec     hex filename
 802215     661    7452  810328   c5d58 busybox_old
 800120     661    7428  808209   c5511 busybox_unstripped
2008-03-12 22:14:34 +00:00
Denis Vlasenko
574f2f4394 *: add optimization barrier to all "G trick" locations 2008-02-27 18:41:59 +00:00
Denis Vlasenko
400d8bb45e less,klogd,syslogd,nc,tcpudp: exit on signal by killing itself, not exit(1)
*: minor shrink
2008-02-24 13:36:01 +00:00
Denis Vlasenko
25591c322c libbb: introduce bb_signals and bb_signals_recursive,
which sets same handler for many signals. sig_catch is nuked
(bb_signals_recursive is more descriptive name).
*: use them as appropriate. 

function                                             old     new   delta
bb_signals_recursive                                   -      95     +95
bb_signals                                             -      52     +52
run_command                                          258     273     +15
svlogd_main                                         1368    1377      +9
runsv_main                                          1746    1752      +6
runsvdir_main                                       1643    1646      +3
UNSPEC_print                                          64      66      +2
time_main                                           1128    1127      -1
...
resize_main                                          246     210     -36
sig_catch                                             63       -     -63
set_fatal_sighandler                                  85      14     -71
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 5/24 up/down: 182/-548)        Total: -366 bytes
2008-02-16 22:58:56 +00:00
Bernhard Reutner-Fischer
a985d306a1 - spelling fixes 2008-02-11 11:44:38 +00:00
Denis Vlasenko
7cff01ec2d nc: fix fallout from C99 standard compliance change 2008-02-02 16:23:43 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
fe7cd642b0 don't pass argc in getopt32, it's superfluous
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes
   text    data     bss     dec     hex filename
 773469    1058   11092  785619   bfcd3 busybox_old
 772644    1058   11092  784794   bf99a busybox_unstripped
2007-08-18 15:32:12 +00:00
Denis Vlasenko
a27a11bb2c introduce and use xdup2(int, int)
stop checking whether setsockopt_reuseaddr(int fd) was successful (it always is)
remove second parameter (sockllen) from xmalloc_sockaddr2xxxxx functions

sockaddr2str                                         142     156     +14
collect_blk                                          467     474      +7
xdup2                                                 28      33      +5
singlemount                                         4456    4454      -2
print_host                                           214     212      -2
nslookup_main                                        139     137      -2
ftpgetput_main                                       414     412      -2
udhcpd_main                                         1258    1255      -3
udhcpc_main                                         2405    2402      -3
traceroute_main                                     4125    4122      -3
nc_main                                             1072    1069      -3
buffer_fill_and_print                                 76      73      -3
xmalloc_sockaddr2hostonly_noport                      18      14      -4
xmalloc_sockaddr2host_noport                          18      14      -4
xmalloc_sockaddr2host                                 15      11      -4
xmalloc_sockaddr2dotted_noport                        18      14      -4
xmalloc_sockaddr2dotted                               18      14      -4
wget_main                                           2618    2614      -4
ping_main                                            393     389      -4
ip_port_str                                          120     115      -5
dhcprelay_main                                      1146    1141      -5
dnsd_main                                           1531    1525      -6
passwd_main                                         1110    1102      -8
udhcp_kernel_packet                                  206     197      -9
udhcp_listen_socket                                  154     144     -10
getty_main                                          2576    2566     -10
setup                                                655     640     -15
xmove_fd                                              51      34     -17
dolisten                                             759     742     -17
tcpudpsvd_main                                      1866    1836     -30
startservice                                         339     299     -40
2007-08-18 14:16:39 +00:00
Denis Vlasenko
828e2a95da nc: minor code shrink
function                                             old     new   delta
dolisten                                             731     737      +6
tmtravel                                              32      21     -11
catch                                                 75      64     -11
oprint                                               272     229     -43
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 6/-65)             Total: -59 bytes
   text    data     bss     dec     hex filename
 676698    3340   13936  693974   a96d6 busybox_old
 676650    3340   13936  693926   a96a6 busybox_unstripped
2007-07-13 12:37:31 +00:00
Denis Vlasenko
5c51a7ca52 nc: make connecting to IPv4 from IPv6-enabled hosts easier
(was requiring -s <local addr>)
2007-06-05 20:08:11 +00:00
Denis Vlasenko
4b924f3a5c whitespace fixes 2007-05-30 00:29:55 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
51742f4bb0 style fixes. No code changes 2007-04-12 00:32:05 +00:00
Denis Vlasenko
19507f0869 nc: code shrinkage, bugfixes. -50 bytes code size 2007-04-06 10:41:05 +00:00
Denis Vlasenko
5f42d26865 nc: missed exit() in signal handler 2007-04-05 20:57:10 +00:00
Denis Vlasenko
29fe7265b8 nc: port nc 1.10 to busybox 2007-04-05 20:26:28 +00:00