aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2011-10-19 14:04:14 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2011-10-19 14:04:14 -0700
commit8fc3b5563ffffa9fb669e2740e752041f57961a7 (patch)
tree8ea22ccfc6ca5a5548286624b8434fa8daa47608
parentb837ec62ff83b64de9c016846cddbb606764adb0 (diff)
parent185d3f3d8c72ecaa711deee5be6bf6f4528f1b70 (diff)
downloadkup-dir.tar.gz
kup-dir.tar.xz
kup-dir.zip
Merge branch 'master' into dirdir
Resolved Conflicts: kup.1 Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rwxr-xr-xkup13
-rw-r--r--kup.112
2 files changed, 25 insertions, 0 deletions
diff --git a/kup b/kup
index 52d60c3..bfcdac5 100755
--- a/kup
+++ b/kup
@@ -19,6 +19,7 @@ use strict;
use warnings;
use bytes;
use Encode qw(encode decode);
+use File::Spec;
my $blksiz = 1024*1024;
@@ -364,6 +365,7 @@ sub cat_file($$$)
sub cmd_put()
{
my $file = shift @args;
+ my $file_tail = undef;
if ($file eq '-t' || $file eq '--tar') {
# tar hack
@@ -429,6 +431,10 @@ sub cmd_put()
# server decompress it.
cat_file('DATA', $file, undef);
+
+ # Get the local filename without directory
+ my($vol, $dir);
+ ($vol, $dir, $file_tail) = File::Spec->splitpath($file);
}
my $sign = shift @args;
@@ -438,6 +444,13 @@ sub cmd_put()
usage(1);
}
+ # This allows the user to not specify the filename if it is
+ # the same as on the local filesystem by ending the pathname
+ # with a slash
+ if ($remote =~ m:/$: && defined($file_tail)) {
+ $remote .= $file_tail;
+ }
+
$remote = canonicalize_path($remote);
if (!is_valid_filename($remote)) {
die "$0: invalid pathname: $remote\n";
diff --git a/kup.1 b/kup.1
index 4d79ad4..bff4c62 100644
--- a/kup.1
+++ b/kup.1
@@ -115,6 +115,18 @@ compression formats are deleted together.
.TP
\fBls|dir\fP \fIpath...\fP
Lists back the contents of one or more directories on the server.
+.SH PATHNAME HANDLING
+Remote (server) pathnames all need to be absolute paths, starting with
+a slash (/). The sole exception is \fInew_path\fP for the \fBmv\fP
+and \fBlink\fP commands, which if it is not absolute is taken to be
+relative to the \fIold_path\fP minus the final component. Similarly,
+if \fInew_path\fP ends in a slash then the final component of
+\fIold_path\fP will be appended.
+.PP
+For the \fPput\fP command, except when \fB\-\-tar\fP or \fB\-\-diff\fP
+is specified, if the \fIremote_path\fP ends in a slash then the
+final (filename) component of \fIlocal_file\fP will be appended to the
+final pathname.
.SH AUTHOR
Written by H. Peter Anvin <hpa@zytor.com>.
.SH COPYRIGHT