1 diff -ur wget-1.8.2.orig/src/init.c wget-1.8.2/src/init.c
2 --- wget-1.8.2.orig/src/init.c Wed Jan 15 19:23:23 2003
3 +++ wget-1.8.2/src/init.c Wed Jan 15 21:54:32 2003
6 { "input", &opt.input_filename, cmd_file },
7 { "killlonger", &opt.kill_longer, cmd_boolean },
8 + { "lamefs", &opt.lame_fs, cmd_boolean },
9 { "limitrate", &opt.limit_rate, cmd_bytes },
10 { "loadcookies", &opt.cookies_input, cmd_file },
11 { "logfile", &opt.lfilename, cmd_file },
12 diff -ur wget-1.8.2.orig/src/main.c wget-1.8.2/src/main.c
13 --- wget-1.8.2.orig/src/main.c Wed Jan 15 19:23:23 2003
14 +++ wget-1.8.2/src/main.c Wed Jan 15 21:52:47 2003
16 -Y, --proxy=on/off turn proxy on or off.\n\
17 -Q, --quota=NUMBER set retrieval quota to NUMBER.\n\
18 --limit-rate=RATE limit download rate to RATE.\n\
19 + -f, --lame-fs create files with simple names.\n\
24 { "inet", no_argument, NULL, '4' },
25 { "inet6", no_argument, NULL, '6' },
27 + { "lame-fs", no_argument, NULL, 'f' },
28 { "mirror", no_argument, NULL, 'm' },
29 { "no-clobber", no_argument, NULL, 141 },
30 { "no-directories", no_argument, NULL, 147 },
32 that the options with required arguments must be followed by a ':'.
33 -- Dan Harkless <wget@harkless.org>] */
34 while ((c = getopt_long (argc, argv, "\
35 -hpVqvdkKsxmNWrHSLcFbEY:G:g:T:U:O:l:n:i:o:a:t:D:A:R:P:B:e:Q:X:I:w:C:",
36 +hpVqvdkKsxmNWrHSLcFbEfY:G:g:T:U:O:l:n:i:o:a:t:D:A:R:P:B:e:Q:X:I:w:C:",
37 long_options, (int *)0)) != EOF)
42 setval ("dirstruct", "on");
45 + setval ("lamefs", "on");
48 /* Options accepting an argument: */
50 diff -ur wget-1.8.2.orig/src/options.h wget-1.8.2/src/options.h
51 --- wget-1.8.2.orig/src/options.h Wed Jan 15 19:23:23 2003
52 +++ wget-1.8.2/src/options.h Wed Jan 15 21:34:10 2003
57 + int lame_fs; /* create files storable on file system with
61 #ifndef OPTIONS_DEFINED_HERE
62 diff -ur wget-1.8.2.orig/src/url.c wget-1.8.2/src/url.c
63 --- wget-1.8.2.orig/src/url.c Wed Jan 15 19:23:23 2003
64 +++ wget-1.8.2/src/url.c Wed Jan 15 21:55:43 2003
65 @@ -1389,12 +1389,47 @@
66 return xstrdup (result);
69 +/* Modify file name so it can be stored on lame file system such as
70 + * FAT used in some odd operating systems. */
72 +filename_for_lame_fs(char *name) {
73 + const char allowed_chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890/_.-";
75 + unsigned char *p1, *p2, *lame_name;
79 + if(strchr(allowed_chars, *p1) == NULL)
84 + lame_name = xmalloc(strlen(name)+size_diff+1);
89 + if(strchr(allowed_chars, *p1) == NULL) {
91 + *p2++ = XDIGIT_TO_XCHAR (*p1 >> 4);
92 + *p2++ = XDIGIT_TO_XCHAR (*p1 & 0xf);
104 /* Create a unique filename, corresponding to a given URL. Calls
105 mkstruct if necessary. Does *not* actually create any directories. */
107 url_filename (const struct url *u)
110 + char *file, *name, *tmp;
111 int have_prefix = 0; /* whether we must prepend opt.dir_prefix */
114 @@ -1408,7 +1444,11 @@
115 char *query = u->query && *u->query ? u->query : NULL;
116 file = compose_file_name (base, query);
121 + file = filename_for_lame_fs(file);
122 + /* xfree(tmp); shouldn't we free this? But it segfaults then. */
126 /* Check whether the prefix directory is something other than "."