2
## PATCHNAME by NAME <EMAIL>
7
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
11
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
12
patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
15
-patch) patch $patch_opts -p1 < $0;;
16
-unpatch) patch $patch_opts -p1 -R < $0;;
18
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
25
--- wget-1.10.orig/src/http.c 2005/06/15 20:26:37 1.191
26
+++ wget-1.10/src/http.c 2005/06/17 22:01:53
27
@@ -1121,6 +1121,12 @@
28
request_set_header (req, "User-Agent", opt.useragent, rel_none); \
31
+/* The flags that allow clobbering the file (opening with "wb").
32
+ Defined here to avoid repetition later. #### This will require
34
+#define ALLOW_CLOBBER (opt.noclobber || opt.always_rest || opt.timestamping \
35
+ || opt.dirstruct || opt.output_document)
37
/* Retrieve a document through HTTP protocol. It recognizes status
38
code, and correctly handles redirections. It closes the network
39
socket. If it receives an error from the functions below it, it
40
@@ -1793,18 +1799,28 @@
41
text/html file. If some case-insensitive variation on ".htm[l]" isn't
42
already the file's suffix, tack on ".html". */
44
- char* last_period_in_local_filename = strrchr(*hs->local_file, '.');
45
+ char *last_period_in_local_filename = strrchr (*hs->local_file, '.');
47
if (last_period_in_local_filename == NULL
48
|| !(0 == strcasecmp (last_period_in_local_filename, ".htm")
49
|| 0 == strcasecmp (last_period_in_local_filename, ".html")))
51
- size_t local_filename_len = strlen(*hs->local_file);
53
- *hs->local_file = xrealloc(*hs->local_file,
54
- local_filename_len + sizeof(".html"));
55
+ int local_filename_len = strlen (*hs->local_file);
56
+ /* Resize the local file, allowing for ".html" preceded by
57
+ optional ".NUMBER". */
58
+ *hs->local_file = xrealloc (*hs->local_file,
59
+ local_filename_len + 24 + sizeof (".html"));
60
strcpy(*hs->local_file + local_filename_len, ".html");
62
+ /* If clobbering is not allowed and the file, as named,
63
+ exists, tack on ".NUMBER.html" instead. */
68
+ sprintf (*hs->local_file + local_filename_len,
69
+ ".%d.html", ext_num++);
70
+ while (file_exists_p (*hs->local_file));
72
*dt |= ADDED_HTML_EXTENSION;
76
rotate_backups (*hs->local_file);
78
fp = fopen (*hs->local_file, "ab");
79
- else if (opt.noclobber || opt.always_rest || opt.timestamping || opt.dirstruct
80
- || opt.output_document)
81
+ else if (ALLOW_CLOBBER)
82
fp = fopen (*hs->local_file, "wb");