aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-03-25 03:55:53 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-03-25 03:55:53 +0000
commitf9beb61a81a861d31161d086fb6dc59e01c00944 (patch)
treebf89a383d6776a0124177f6baa2e5e31768861e5 /networking
parentb2705e1652d6e89b55f9c4f701f13f28c53e499a (diff)
downloadbusybox-f9beb61a81a861d31161d086fb6dc59e01c00944.tar.gz
tftp: when we infer local name from remote (-r [/]path/path/file),
strip path. This mimics wget and is generally more intuitive.
Diffstat (limited to 'networking')
-rw-r--r--networking/tftp.c11
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)
}
#endif
- if (!local_file)
- local_file = remote_file;
- if (!remote_file)
+ if (remote_file) {
+ if (!local_file) {
+ const char *slash = strrchr(remote_file, '/');
+ local_file = slash ? slash + 1 : remote_file;
+ }
+ } else {
remote_file = local_file;
+ }
+
/* Error if filename or host is not known */
if (!remote_file || !argv[0])
bb_show_usage();