Bump to version 1.22.1
[platform/upstream/busybox.git] / networking / ftpgetput.c
index 66316e2..8283366 100644 (file)
 //usage:#define ftpget_trivial_usage
 //usage:       "[OPTIONS] HOST [LOCAL_FILE] REMOTE_FILE"
 //usage:#define ftpget_full_usage "\n\n"
-//usage:       "Retrieve a remote file via FTP\n"
-//usage:     "\nOptions:"
+//usage:       "Download a file via FTP\n"
 //usage:       IF_FEATURE_FTPGETPUT_LONG_OPTIONS(
-//usage:     "\n       -c,--continue   Continue previous transfer"
-//usage:     "\n       -v,--verbose    Verbose"
-//usage:     "\n       -u,--username   Username"
-//usage:     "\n       -p,--password   Password"
-//usage:     "\n       -P,--port       Port number"
+//usage:     "\n       -c,--continue           Continue previous transfer"
+//usage:     "\n       -v,--verbose            Verbose"
+//usage:     "\n       -u,--username USER      Username"
+//usage:     "\n       -p,--password PASS      Password"
+//usage:     "\n       -P,--port NUM           Port"
 //usage:       )
 //usage:       IF_NOT_FEATURE_FTPGETPUT_LONG_OPTIONS(
 //usage:     "\n       -c      Continue previous transfer"
 //usage:     "\n       -v      Verbose"
-//usage:     "\n       -u      Username"
-//usage:     "\n       -p      Password"
-//usage:     "\n       -P      Port number"
+//usage:     "\n       -u USER Username"
+//usage:     "\n       -p PASS Password"
+//usage:     "\n       -P NUM  Port"
 //usage:       )
 //usage:
 //usage:#define ftpput_trivial_usage
 //usage:       "[OPTIONS] HOST [REMOTE_FILE] LOCAL_FILE"
 //usage:#define ftpput_full_usage "\n\n"
-//usage:       "Store a local file on a remote machine via FTP\n"
-//usage:     "\nOptions:"
+//usage:       "Upload a file to a FTP server\n"
 //usage:       IF_FEATURE_FTPGETPUT_LONG_OPTIONS(
-//usage:     "\n       -v,--verbose    Verbose"
-//usage:     "\n       -u,--username   Username"
-//usage:     "\n       -p,--password   Password"
-//usage:     "\n       -P,--port       Port number"
+//usage:     "\n       -v,--verbose            Verbose"
+//usage:     "\n       -u,--username USER      Username"
+//usage:     "\n       -p,--password PASS      Password"
+//usage:     "\n       -P,--port NUM           Port"
 //usage:       )
 //usage:       IF_NOT_FEATURE_FTPGETPUT_LONG_OPTIONS(
 //usage:     "\n       -v      Verbose"
-//usage:     "\n       -u      Username"
-//usage:     "\n       -p      Password"
-//usage:     "\n       -P      Port number"
+//usage:     "\n       -u USER Username"
+//usage:     "\n       -p PASS Password"
+//usage:     "\n       -P NUM  Port number"
 //usage:       )
 
 #include "libbb.h"
@@ -60,7 +58,7 @@ struct globals {
        FILE *control_stream;
        int verbose_flag;
        int do_continue;
-       char buf[1]; /* actually [BUFSZ] */
+       char buf[4]; /* actually [BUFSZ] */
 } FIX_ALIASING;
 #define G (*(struct globals*)&bb_common_bufsiz1)
 enum { BUFSZ = COMMON_BUFSIZE - offsetof(struct globals, buf) };
@@ -105,7 +103,7 @@ static int ftpcmd(const char *s1, const char *s2)
        }
 
        do {
-               strcpy(buf, "EOF");
+               strcpy(buf, "EOF"); /* for ftp_die */
                if (fgets(buf, BUFSZ - 2, control_stream) == NULL) {
                        ftp_die(NULL);
                }
@@ -316,7 +314,6 @@ static const char ftpgetput_longopts[] ALIGN1 =
 int ftpgetput_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int ftpgetput_main(int argc UNUSED_PARAM, char **argv)
 {
-       unsigned opt;
        const char *port = "ftp";
        /* socket to ftp server */
 
@@ -345,7 +342,7 @@ int ftpgetput_main(int argc UNUSED_PARAM, char **argv)
        applet_long_options = ftpgetput_longopts;
 #endif
        opt_complementary = "-2:vv:cc"; /* must have 2 to 3 params; -v and -c count */
-       opt = getopt32(argv, "cvu:p:P:", &user, &password, &port,
+       getopt32(argv, "cvu:p:P:", &user, &password, &port,
                                        &verbose_flag, &do_continue);
        argv += optind;