ftpd: code chrink, fixed some minor bugs

ls: update comment
*: openlog fixes (added LOG_PID, set LOG_DAEMON as appropriate)

function                                             old     new   delta
xwrite_str                                             -      26     +26
cmdio_write_ok                                         -      15     +15
handle_cwd                                            40      45      +5
packed_usage                                       25668   25670      +2
cmdio_write_raw                                        7       9      +2
handle_upload_common                                 322     320      -2
udhcpd_main                                         1375    1372      -3
udhcpc_main                                         2362    2359      -3
port_cleanup                                          27      23      -4
handle_dir_common                                    221     209     -12
str_netfd_write                                       26       -     -26
cmdio_get_cmd_and_arg                                122       -    -122
ftpd_main                                           2208    2050    -158
------------------------------------------------------------------------------
   text    data     bss     dec     hex filename
 809933     476    7864  818273   c7c61 busybox_old
 809199     476    7864  817539   c7983 busybox_unstripped
This commit is contained in:
Denis Vlasenko 2009-03-08 23:46:48 +00:00
parent bf9d17949e
commit 5e4fda0aff
8 changed files with 443 additions and 424 deletions

View File

@ -6,7 +6,7 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
/*
/* [date unknown. Perhaps before year 2000]
* To achieve a small memory footprint, this version of 'ls' doesn't do any
* file sorting, and only has the most essential command line switches
* (i.e., the ones I couldn't live without :-) All features which involve
@ -18,8 +18,7 @@
*
* KNOWN BUGS:
* 1. ls -l of a directory doesn't give "total <blocks>" header
* 2. ls of a symlink to a directory doesn't list directory contents
* 3. hidden files can make column width too large
* 2. hidden files can make column width too large
*
* NON-OPTIMAL BEHAVIOUR:
* 1. autowidth reads directories twice
@ -27,6 +26,9 @@
* appended, there's no need to stat each one
* PORTABILITY:
* 1. requires lstat (BSD) - how do you do it without?
*
* [2009-03]
* ls sorts listing now, and supports almost all options.
*/
#include "libbb.h"

View File

@ -1281,7 +1281,7 @@
"\n -f Force file system check" \
#define ftpd_trivial_usage \
"[-w] [DIR]"
"[-vw] [DIR]"
#define ftpd_full_usage "\n\n" \
"FTP server\n" \
"\n" \
@ -1291,6 +1291,7 @@
"It also can be ran from tcpsvd:\n" \
" tcpsvd -vE 0.0.0.0 21 ftpd /files/to/serve\n" \
"\nOptions:" \
"\n -v Log also to stderr" \
"\n -w Allow upload" \
"\n DIR Change root to ths directory" \

View File

@ -100,11 +100,11 @@ config FTPD
simple FTP daemon. You have to run it via inetd.
config FEATURE_FTP_WRITE
bool "enable write"
bool "Enable upload commands"
default y
depends on FTPD
help
Enable all kinds of FTP write commands (you have to add -w parameter)
Enable all kinds of FTP upload commands (-w option)
config FTPGET
bool "ftpget"

File diff suppressed because it is too large Load Diff

View File

@ -122,7 +122,7 @@ int fakeidentd_main(int argc UNUSED_PARAM, char **argv)
* log to stderr. I like daemontools more. Go their way.
* (Or maybe we need yet another option "log to syslog") */
if (!(opt & OPT_fiw) /* || (opt & OPT_syslog) */) {
openlog(applet_name, 0, LOG_DAEMON);
openlog(applet_name, LOG_PID, LOG_DAEMON);
logmode = LOGMODE_SYSLOG;
}

View File

@ -452,7 +452,7 @@ int telnetd_main(int argc UNUSED_PARAM, char **argv)
}
/* Redirect log to syslog early, if needed */
if (IS_INETD || !(opt & OPT_FOREGROUND)) {
openlog(applet_name, 0, LOG_USER);
openlog(applet_name, LOG_PID, LOG_DAEMON);
logmode = LOGMODE_SYSLOG;
}
USE_FEATURE_TELNETD_STANDALONE(

View File

@ -284,7 +284,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
}
#endif
if (opt & OPT_S) {
openlog(applet_name, LOG_PID, LOG_LOCAL0);
openlog(applet_name, LOG_PID, LOG_DAEMON);
logmode |= LOGMODE_SYSLOG;
}

View File

@ -53,7 +53,7 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
}
if (opt & 2) { /* -S */
openlog(applet_name, LOG_PID, LOG_LOCAL0);
openlog(applet_name, LOG_PID, LOG_DAEMON);
logmode |= LOGMODE_SYSLOG;
}
#if ENABLE_FEATURE_UDHCP_PORT