sysctl was seriously broken. And since in some cases 'CONFIG_SYSCTL'
[oweals/busybox.git] / networking / wget.c
index 3fbf6b4c279365d62351b8c06becacb6dc2e09c5..0a4ccaddd0b24092b6be78c5f0c5fb32c9552df3 100644 (file)
@@ -117,9 +117,9 @@ static char *safe_fgets(char *s, int size, FILE *stream)
 /*
  *  Base64-encode character string
  *  oops... isn't something similar in uuencode.c?
- *  It would be better to use already existing code
+ *  XXX: It would be better to use already existing code
  */
-char *base64enc(unsigned char *p, char *buf, int len) {
+static char *base64enc(unsigned char *p, char *buf, int len) {
 
         char al[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
                     "0123456789+/";
@@ -191,7 +191,7 @@ int wget_main(int argc, char **argv)
        /*
         * Crack command line.
         */
-       bb_opt_complementaly = "\203*";
+       bb_opt_complementally = "\203*";
        bb_applet_long_options = wget_long_options;
        opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:", &fname_out, &headers_llist, &dir_prefix, &proxy_flag);
        if (opt & WGET_OPT_CONTINUE) {
@@ -239,11 +239,15 @@ int wget_main(int argc, char **argv)
 
        /* Guess an output filename */
        if (!fname_out) {
-               fname_out =
+               // Dirty hack. Needed because bb_get_last_path_component
+               // will destroy trailing / by storing '\0' in last byte!
+               if(target.path[strlen(target.path)-1]!='/') {
+                       fname_out =
 #ifdef CONFIG_FEATURE_WGET_STATUSBAR
-                       curfile =
+                               curfile =
 #endif
-                       bb_get_last_path_component(target.path);
+                               bb_get_last_path_component(target.path);
+               }
                if (fname_out==NULL || strlen(fname_out)<1) {
                        fname_out =
 #ifdef CONFIG_FEATURE_WGET_STATUSBAR
@@ -816,7 +820,7 @@ progressmeter(int flag)
 #endif
 
 /* Original copyright notice which applies to the CONFIG_FEATURE_WGET_STATUSBAR stuff,
- * much of which was blatently stolen from openssh.  */
+ * much of which was blatantly stolen from openssh.  */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -850,7 +854,7 @@ progressmeter(int flag)
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     $Id: wget.c,v 1.73 2004/04/08 10:27:11 bug1 Exp $
+ *     $Id: wget.c,v 1.75 2004/10/08 08:27:40 andersen Exp $
  */