version 1.11, 2003/03/13 09:09:35 |
version 1.12, 2003/04/17 17:17:27 |
|
|
*/ |
*/ |
|
|
#ifndef lint |
#ifndef lint |
static char copyright[] = |
static const char copyright[] = |
"@(#) Copyright (c) 1983, 1993\n\ |
"@(#) Copyright (c) 1983, 1993\n\ |
The Regents of the University of California. All rights reserved.\n"; |
The Regents of the University of California. All rights reserved.\n"; |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#if 0 |
#if 0 |
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; |
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; |
#endif |
#endif |
static char rcsid[] = "$OpenBSD$"; |
static const char rcsid[] = "$OpenBSD$"; |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
/* Many bug fixes are from Jim Guyton <guyton@rand-unix> */ |
/* Many bug fixes are from Jim Guyton <guyton@rand-unix> */ |
|
|
} |
} |
/* this assumes the target is a directory */ |
/* this assumes the target is a directory */ |
/* on a remote unix system. hmmmm. */ |
/* on a remote unix system. hmmmm. */ |
cp = strchr(targ, '\0'); |
|
*cp++ = '/'; |
|
for (n = 1; n < argc - 1; n++) { |
for (n = 1; n < argc - 1; n++) { |
strcpy(cp, tail(argv[n])); |
if (asprintf(&cp, "%s/%s", targ, tail(argv[n])) == -1) |
|
err(1, "asprintf"); |
fd = open(argv[n], O_RDONLY); |
fd = open(argv[n], O_RDONLY); |
if (fd < 0) { |
if (fd < 0) { |
warn("open: %s", argv[n]); |
warn("open: %s", argv[n]); |
|
|
} |
} |
if (verbose) |
if (verbose) |
printf("putting %s to %s:%s [%s]\n", |
printf("putting %s to %s:%s [%s]\n", |
argv[n], hostname, targ, mode); |
argv[n], hostname, cp, mode); |
peeraddr.sin_port = port; |
peeraddr.sin_port = port; |
sendfile(fd, targ, mode); |
sendfile(fd, cp, mode); |
|
free(cp); |
} |
} |
} |
} |
|
|