Commit Graph

120 Commits

Author SHA1 Message Date
Denys Vlasenko
6e8861b5f1 *: better comments on termios manipulations. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-15 23:00:13 +01:00
Denys Vlasenko
e504c245f7 getty: Hurd has no CBAUD, work around that
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-30 21:27:33 +01:00
Denys Vlasenko
e9dc354df8 getty: fix a minor problem of Ctrl-D not printing '\n'
Also removed defines for control chars which are never changed,
and added login/getty README.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-23 23:58:59 +02:00
Denys Vlasenko
ee320c6d9c getty: reset tty attrs on Ctrl-C and Ctrl-D too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-23 18:05:58 +02:00
Denys Vlasenko
e206a4de4c getty: add O_NONBLOCK to open which is used to drop ctty
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-22 08:19:42 +02:00
Denys Vlasenko
94354154c4 getty: remove now not needed resetting of ALRM to to SIG_DFL
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-22 06:30:48 +02:00
Denys Vlasenko
7449e18190 getty,login: tighten up handling of ctty, pgrp, and tty attr restoring on timeout
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-22 06:27:41 +02:00
Denys Vlasenko
ef5a2d757a getty: shrink help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-22 03:16:23 +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
726ebbaa9f fix bit rot in scripts/Makefile.IMA
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-06 23:09:42 +01:00
Denys Vlasenko
b7c9fb27cb whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-03 00:05:48 +01:00
Denys Vlasenko
4907f6ec58 getty: fix "ifdef CMSPAR"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-26 16:20:54 +01:00
Denys Vlasenko
f36368ed37 getty: restore CRTSCTS comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-26 16:14:47 +01:00
Denys Vlasenko
ffd81f2003 getty: do clear CLOCAL and CRTSCTS unless told otherwise
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-26 16:06:16 +01:00
Denys Vlasenko
cf9d33a894 getty: do not clear all c_cflag's (we were clearing baud bits!)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-26 15:56:51 +01:00
Peter Korsgaard
ddd1ec1c27 getty: wait up to 5 seconds for the output buffer to drain
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-26 15:15:19 +01:00
Denys Vlasenko
3ff9be31be getty: document bits we don't set - maybe we should set some of them?
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-26 11:28:43 +01:00
Denys Vlasenko
d7c25e98bf getty: add ECHOE explanation
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-26 03:31:23 +01:00
Denys Vlasenko
d8494934a7 getty: explain every bit in termios; remove redundant stuff in termios_final
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-26 03:26:38 +01:00
Denys Vlasenko
8d0e0cdadf move utmp.h include to libbb.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 23:21:46 +01:00
Denys Vlasenko
136091886e getty: flush _only_ input after switching to the next baud rate
It was originally like this, but at some point TCIFLUSH was
inadvertently changed to TCIOFLUSH.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 23:45:22 +01:00
Denys Vlasenko
7073964b5f getty: simplify macros; improve VSWTC[H] compat
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 18:17:19 +01:00
Denys Vlasenko
faaf8cb3fa getty: more simplifications; explain how we treat parity now
function                                             old     new   delta
getty_main                                          1471    1434     -37

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 14:35:09 +01:00
Denys Vlasenko
6596380f52 getty: simplify code by going to more straignforward G trick
function                                             old     new   delta
getty_main                                          1615    1475    -140

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 04:43:04 +01:00
Denys Vlasenko
dc6cd12569 getty: add sleep before initial tcdrain; reduce another sleep from 1 to 0.1s
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 00:28:43 +01:00
Denys Vlasenko
1f0840450e getty: use cfsetspeed to save some bytes; cosmetic fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 00:16:50 +01:00
Denys Vlasenko
006416e8fe getty: more correct check for O_RDWR
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-22 17:29:53 +01:00
Denys Vlasenko
2b57b6cd43 getty: comment out parity detection code; improve usage text
function                                             old     new   delta
packed_usage                                       28155   28191     +36
static.erase                                          12       -     -12
getty_main                                          1847    1621    -226
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 36/-238)          Total: -202 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-22 03:06:40 +01:00
Denys Vlasenko
bcdb9b8762 getty: fix -i (was ignored)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-09 21:44:51 +01:00
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko
5360059131 libbb: introduce and use strcpy_and_process_escape_sequences
function                                             old     new   delta
strcpy_and_process_escape_sequences                    -      50     +50
bb_process_escape_sequence                           148     138     -10
printf_main                                          789     776     -13
getty_main                                          1897    1831     -66
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 50/-89)            Total: -39 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-23 21:06:06 +02:00
Denys Vlasenko
9dc04124d5 getty: small code shrink
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-01 11:31:43 +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
Jeremie Koenig
f812eace18 init,loginutils: termios portability fixes
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:45:42 +02:00
Denys Vlasenko
729ecb87bf bbconfig: make it independent from printf functions
function                                             old     new   delta
full_write2_str                                        -      25     +25
full_write1_str                                        -      25     +25
clear_main                                            21      20      -1
telnet_main                                         1488    1477     -11
getty_main                                          1932    1918     -14
full_write22_str                                      25       -     -25
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/3 up/down: 50/-51)             Total: -1 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-07 14:14:26 +02:00
Denys Vlasenko
765b0eed3e getty: do not emit bogus error message on EOF
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 21:17:46 +02:00
Denys Vlasenko
3a41611bc5 telnetd: write LOGIN/DEAD_PROCESS utmp records. Closes bug 1363
function                                             old     new   delta
write_new_utmp                                         -     253    +253
skip_dev_pfx                                           -      30     +30
handle_sigchld                                        42      72     +30
telnetd_main                                        1650    1673     +23
make_new_session                                     415     438     +23
...
login_main                                          1140    1148      +8
update_utmp                                          337     313     -24
write_wtmp                                           220     154     -66
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 11/6 up/down: 406/-115)         Total: ~291 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-05 22:10:38 +02:00
Denys Vlasenko
37f5bef63c libbb: split update_utmp from login/getty in preparation to use it for telnetd
function                                             old     new   delta
update_utent                                           -     339    +339
login_main                                          1498    1128    -370
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 339/-370)          Total: -31 bytes

function                                             old     new   delta
update_utmp                                          246     337     +91
login_main                                          1128    1140     +12
getty_main                                          1908    1918     +10
...
update_utent                                         339       -    -339
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 5/6 up/down: 119/-368)         Total: -249 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-05 03:18:40 +02:00
Denys Vlasenko
8684cbb5cc libbb: robustify isXXXX(). +39 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-18 11:34:43 +01:00
Denys Vlasenko
adf922ec28 *: a few more NOINLINEs
function                                             old     new   delta
print_linkinfo                                         -     815    +815
do_msg                                                 -     783    +783
INET_setroute                                          -     757    +757
varvalue                                               -     746    +746
do_sem                                                 -     637    +637
inflate_codes                                          -     617    +617
INET6_setroute                                         -     491    +491
edir                                                   -     370    +370
sync_cursor                                            -     298    +298
update_utmp                                            -     246    +246
searchLines                                            -     165    +165
setup_alarm                                            -     144    +144
may_wakeup                                             -     101    +101
getNum                                               566     371    -195
refresh                                             1166     848    -318
rtcwake_main                                         809     479    -330
getty_main                                          2396    1921    -475
chpst_main                                          1373     746    -627
inflate_unzip_internal                              1335     567    -768
evalvar                                             1384     612    -772
ipaddr_list_or_flush                                2160    1246    -914
route_main                                          1585     245   -1340
ipcs_main                                           2523    1049   -1474
------------------------------------------------------------------------------
(add/remove: 13/0 grow/shrink: 0/10 up/down: 6170/-7213)    Total: -1043 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-08 14:35:37 +02:00
Denys Vlasenko
09e63bb81f df: fix "df /"
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-05 04:50:36 +02:00
Denys Vlasenko
9b1b62adc4 Patches to enable FreeBSD build
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-05 03:34:12 +02:00
Denis Vlasenko
32a385f5b0 getty: fix handling of speed 0;
stop using non-portable way of setting speeds.

function                                             old     new   delta
cfsetispeed                                            -      76     +76
cfsetospeed                                            -      57     +57
cfgetispeed                                            -      20     +20
2009-04-12 13:05:40 +00:00
Mike Frysinger
fe013a74ff patch by Stuart Hughes <seh@zee2.com> and Guenter <lists@gknw.net> to make "0" a special baud rate for getty where it uses this as "leave baud rate unchanged" 2009-04-09 07:08:04 +00:00
Denis Vlasenko
73c571a5ff *: move get_sock_lsa and xwrite_str to libbb, use where appropriate
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
2009-03-09 00:12:37 +00:00
Bernhard Reutner-Fischer
e44a4e316d - isascii() is obsolescent in SUSv4 and furthermore looks redundant in this spot 2009-01-09 14:49:11 +00:00
Denis Vlasenko
9e0a7c9c41 remove a few superfluous includes 2008-11-25 13:33:11 +00:00
Denis Vlasenko
202ac504e1 *: code shrink by adding a wrapper around very common tcsetattr(0, TCSANOW, xx) op
function                                             old     new   delta
tcsetattr_stdin_TCSANOW                                -      14     +14
set_sane_term                                        116     113      -3
top_main                                            1277    1273      -4
make_new_session                                     421     415      -6
rawmode                                              133     126      -7
reset_term                                            18      10      -8
die                                                   43      35      -8
cookmode                                              62      54      -8
vlock_main                                           425     415     -10
read_line_input                                     3165    3155     -10
bb_askpass                                           357     347     -10
fsck_minix_main                                     3079    3065     -14
getty_main                                          2375    2332     -43
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/12 up/down: 14/-131)         Total: -117 bytes
2008-11-05 13:20:58 +00:00
Denis Vlasenko
9725daa03a halt: reinstate -w even if !FEATURE_WTMP; beautify code in halt.c 2008-09-11 09:54:23 +00:00
Denis Vlasenko
5415c856ea libbb: [x]fopen_for_{read,write} introduced and used.
(by Valdimir)

function                                             old     new   delta
config_open2                                           -      41     +41
config_read                                          507     542     +35
find_pair                                            169     187     +18
fopen_for_write                                        -      14     +14
fopen_for_read                                         -      14     +14
find_main                                            406     418     +12
xfopen_for_write                                       -      10     +10
xfopen_for_read                                        -      10     +10
popstring                                            134     140      +6
parse_inittab                                        396     401      +5
next_token                                           923     928      +5
pack_gzip                                           1659    1661      +2
bb__parsespent                                       117     119      +2
fallbackSort                                        1719    1717      -2
evalvar                                             1376    1374      -2
qrealloc                                              36      33      -3
...
...
...
...
singlemount                                         4579    4569     -10
process_stdin                                        443     433     -10
patch_main                                          1111    1101     -10
ifupdown_main                                       2175    2165     -10
file_action_grep                                      90      80     -10
uuidcache_init                                       649     637     -12
hush_main                                            797     785     -12
read_config                                          230     217     -13
dpkg_main                                           3835    3820     -15
read_line_input                                     3134    3110     -24
sysctl_main                                          232     203     -29
config_open                                           40      10     -30
WARN_BAD_LINE                                         44       -     -44
login_main                                          1714    1575    -139
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737)        Total: -563 bytes
2008-07-21 23:05:26 +00:00