summaryrefslogtreecommitdiff
path: root/usr.bin/tftp
diff options
context:
space:
mode:
authorJason McIntyre <jmc@cvs.openbsd.org>2003-09-25 09:45:47 +0000
committerJason McIntyre <jmc@cvs.openbsd.org>2003-09-25 09:45:47 +0000
commitd85bab6fdcac293a0099610eee241d0654939a61 (patch)
treef9799e0a85c464aa59bc9a774f142f4525aeb4ae /usr.bin/tftp
parent966b373664aa38d38a682e503a56a277d490ad9a (diff)
- clarify "put" and "get" commands. This is based on a FreeBSD PR submitted
by Gary W. Swearingen and fixed by Simon L. Nielsen in rev. 1.15; - some other small clarifications to the man page - sync usage()'s with the man page
Diffstat (limited to 'usr.bin/tftp')
-rw-r--r--usr.bin/tftp/main.c14
-rw-r--r--usr.bin/tftp/tftp.1116
2 files changed, 84 insertions, 46 deletions
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
index 1a50a844f2b..16d04510fe1 100644
--- a/usr.bin/tftp/main.c
+++ b/usr.bin/tftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.18 2003/09/24 20:21:40 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.19 2003/09/25 09:45:46 jmc Exp $ */
/* $NetBSD: main.c,v 1.6 1995/05/21 16:54:10 mycroft Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: main.c,v 1.18 2003/09/24 20:21:40 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: main.c,v 1.19 2003/09/25 09:45:46 jmc Exp $";
#endif /* not lint */
/* Many bug fixes are from Jim Guyton <guyton@rand-unix> */
@@ -196,7 +196,7 @@ setpeer(int argc, char *argv[])
argv = margv;
}
if ((argc < 2) || (argc > 3)) {
- printf("usage: %s host-name [port]\n", argv[0]);
+ printf("usage: %s [host] [port]\n", argv[0]);
return;
}
if (inet_aton(argv[1], &peeraddr.sin_addr) != 0) {
@@ -384,8 +384,8 @@ put(int argc, char *argv[])
static void
putusage(char *s)
{
- printf("usage: %s file ... host:target, or\n", s);
- printf(" %s file ... target (when already connected)\n", s);
+ printf("usage: %s file [[host:]remotename]\n", s);
+ printf(" %s file1 file2 ... fileN [[host:]remote-directory]\n", s);
}
/*
@@ -469,8 +469,8 @@ get(int argc, char *argv[])
static void
getusage(char *s)
{
- printf("usage: %s host:file host:file ... file, or\n", s);
- printf(" %s file file ... file if connected\n", s);
+ printf("usage: %s [host:]file [localname]\n", s);
+ printf(" %s [host1:]file1 [host2:]file2 ... [hostN:]fileN\n", s);
}
int rexmtval = TIMEOUT;
diff --git a/usr.bin/tftp/tftp.1 b/usr.bin/tftp/tftp.1
index fc00b72eaf0..4e94ea28a3c 100644
--- a/usr.bin/tftp/tftp.1
+++ b/usr.bin/tftp/tftp.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tftp.1,v 1.7 2003/06/03 02:56:18 millert Exp $
+.\" $OpenBSD: tftp.1,v 1.8 2003/09/25 09:45:46 jmc Exp $
.\" $NetBSD: tftp.1,v 1.5 1995/08/18 14:45:44 pk Exp $
.\"
.\" Copyright (c) 1990, 1993, 1994
@@ -39,6 +39,7 @@
.Sh SYNOPSIS
.Nm tftp
.Op Ar host
+.Op Ar port
.Sh DESCRIPTION
.Nm
is the user interface to the Internet
@@ -47,11 +48,11 @@ is the user interface to the Internet
which allows users to transfer files to and from a remote machine.
The remote
.Ar host
+and
+.Ar port
may be specified on the command line, in which case
.Nm
-uses
-.Ar host
-as the default host for future transfers (see the
+uses them as the default for future transfers (see the
.Ic connect
command below).
.Sh COMMANDS
@@ -67,11 +68,11 @@ Print help information.
.Pp
.It Ic ascii
Shorthand for
-.Ic mode ascii .
+.Ic mode Ar ascii .
.Pp
.It Ic binary
Shorthand for
-.Ic mode binary .
+.Ic mode Ar binary .
.Pp
.It Ic connect Ar host Op Ar port
Set the
@@ -96,48 +97,79 @@ or
.Ic put
commands.
.Pp
-.It Ic get Ar filename
-.It Ic get Ar remotename localname
-.It Ic get Ar file Op Ar ...
-Get a file or set of files from the specified
-.Ar sources .
-.Ar source
-can be in one of two forms:
-a filename on the remote host, if the host has already been specified,
-or a string of the form
-.Ar hosts:filename
-to specify both a host and filename at the same time.
-If the latter form is used,
-the last hostname specified becomes the default for future transfers.
+.It Xo
+.Ic get Oo Ar host Ns : Oc Ns
+.Ar file Op Ar localname
+.Xc
+.It Xo
+.Ic get Oo Ar host1 Ns : Oc Ns
+.Ar file1
+.Oo Ar host2 Ns : Oc Ns
+.Ar file2
+.Ar ...
+.Oo Ar hostN Ns : Oc Ns
+.Ar fileN
+.Xc
+Get a file or set of files from the remote host.
+When using the
+.Ar host
+argument, the
+.Ar host
+will be used as the default host for future transfers.
+If
+.Ar localname
+is specified,
+the file is stored locally as
+.Ar localname ,
+otherwise the original filename is used.
+.Pp
+Note that it is not possible to download two files at the same time;
+only one, three, or more than three files
+can be downloaded at the same time.
.Pp
.It Ic mode Ar transfer-mode
Set the mode for transfers;
.Ar transfer-mode
may be one of
-.Ic ascii
+.Ar ascii
or
-.Ic binary .
+.Ar binary .
The default is
-.Ic ascii .
-.Pp
-.It Ic put Ar file
-.It Ic put Ar localfile remotefile
-.It Ic put Ar file1 file2 ... fileN remote-directory
-Put a file or set of files to the specified
-remote file or directory.
-The destination
-can be in one of two forms:
-a filename on the remote host, if the host has already been specified,
-or a string of the form
-.Ar hosts:filename
-to specify both a host and filename at the same time.
-If the latter form is used,
-the hostname specified becomes the default for future transfers.
-If the remote-directory form is used, the remote host is
-assumed to be a
+.Ar ascii .
+.Pp
+.It Xo
+.Ic put Ar file
+.Oo Oo Ar host Ns : Oc Ns
+.Ar remotename Oc
+.Xc
+.It Xo
+.Ic put Ar file1 file2 ... fileN
+.Oo Oo Ar host Ns : Oc Ns
+.Ar remote-directory Oc
+.Xc
+Put a file or set of files to the remote host.
+When using the
+.Ar host
+argument, the
+.Ar host
+will be used as the default host for future transfers.
+If
+.Ar remotename
+is specified, the file is stored remotely as
+.Ar remotename ,
+otherwise the original filename is used.
+If the
+.Ar remote-directory
+argument is used, the remote host is assumed to be a
.Tn UNIX
machine.
.Pp
+Note that files may only be written to if they already exist on the
+remote host and are publicly writable.
+See
+.Xr tftpd 8
+for further details.
+.Pp
.It Ic quit
Exit
.Nm tftp .
@@ -159,7 +191,8 @@ Toggle packet tracing.
Toggle verbose mode.
.El
.Sh SEE ALSO
-.Xr ftp 1
+.Xr ftp 1 ,
+.Xr tftpd 8
.Sh HISTORY
The
.Nm
@@ -173,3 +206,8 @@ protocol, the remote site will probably have some
sort of file access restrictions in place.
The exact methods are specific to each site and therefore
difficult to document here.
+.Pp
+Files larger than 33488896 octets (65535 blocks) cannot be transferred
+without client and server supporting blocksize negotiation (RFC 1783).
+.Pp
+Many tftp clients will not transfer files over 16744448 octets (32767 blocks).