aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-07-26 09:11:10 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-07-26 09:11:10 +0000
commit8e7fcd9ee1fbee3c955efe825d7681dfc4dd072d (patch)
tree9a043147696c9c8ea0f81d94f5e01dd16b79e9eb
parentad63e1e69849c9dfe577f013eba9ea7319fc6d2e (diff)
using #[num] with -o now make it literally used if there's no globbing for
that particular index. Reported in bug report 997536.
-rw-r--r--src/urlglob.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/urlglob.c b/src/urlglob.c
index 2ca01f046..6bb323218 100644
--- a/src/urlglob.c
+++ b/src/urlglob.c
@@ -449,10 +449,9 @@ char *glob_match_url(char *filename, URLGlob *glob)
while (*filename) {
if (*filename == '#' && isdigit((int)filename[1])) {
- /* only '#1' ... '#9' allowed */
unsigned long i;
+ char *ptr = filename;
unsigned long num = strtoul(&filename[1], &filename, 10);
-
i = num-1;
if (num && (i <= glob->size / 2)) {
@@ -482,6 +481,12 @@ char *glob_match_url(char *filename, URLGlob *glob)
return NULL;
}
}
+ else {
+ /* #[num] out of range, use the #[num] in the output */
+ filename = ptr;
+ appendthis=filename++;
+ appendlen=1;
+ }
}
else {
appendthis=filename++;