diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-25 03:55:53 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-25 03:55:53 +0000 |
commit | f9beb61a81a861d31161d086fb6dc59e01c00944 (patch) | |
tree | bf89a383d6776a0124177f6baa2e5e31768861e5 | |
parent | b2705e1652d6e89b55f9c4f701f13f28c53e499a (diff) | |
download | busybox-w32-f9beb61a81a861d31161d086fb6dc59e01c00944.tar.gz busybox-w32-f9beb61a81a861d31161d086fb6dc59e01c00944.tar.bz2 busybox-w32-f9beb61a81a861d31161d086fb6dc59e01c00944.zip |
tftp: when we infer local name from remote (-r [/]path/path/file),
strip path. This mimics wget and is generally more intuitive.
-rw-r--r-- | networking/tftp.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/networking/tftp.c b/networking/tftp.c index fa0851615..9c78b6e14 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -589,10 +589,15 @@ int tftp_main(int argc UNUSED_PARAM, char **argv) | |||
589 | } | 589 | } |
590 | #endif | 590 | #endif |
591 | 591 | ||
592 | if (!local_file) | 592 | if (remote_file) { |
593 | local_file = remote_file; | 593 | if (!local_file) { |
594 | if (!remote_file) | 594 | const char *slash = strrchr(remote_file, '/'); |
595 | local_file = slash ? slash + 1 : remote_file; | ||
596 | } | ||
597 | } else { | ||
595 | remote_file = local_file; | 598 | remote_file = local_file; |
599 | } | ||
600 | |||
596 | /* Error if filename or host is not known */ | 601 | /* Error if filename or host is not known */ |
597 | if (!remote_file || !argv[0]) | 602 | if (!remote_file || !argv[0]) |
598 | bb_show_usage(); | 603 | bb_show_usage(); |