diff options
author | cracauer <cracauer@FreeBSD.org> | 1998-12-08 13:00:49 +0000 |
---|---|---|
committer | cracauer <cracauer@FreeBSD.org> | 1998-12-08 13:00:49 +0000 |
commit | c4f0cd91dfd075657106a1cf7a6b6e0b3a1712f9 (patch) | |
tree | fc3f9e64c7788a6155478c488fe7065670d41463 /usr.bin/fetch/ftp.c | |
parent | b34285d7af1280b5524d2efb346146f3bb7834e1 (diff) | |
download | FreeBSD-src-c4f0cd91dfd075657106a1cf7a6b6e0b3a1712f9.zip FreeBSD-src-c4f0cd91dfd075657106a1cf7a6b6e0b3a1712f9.tar.gz |
Add -s option, just report size of file that would be fetched.
Reviewed by: -current list
Diffstat (limited to 'usr.bin/fetch/ftp.c')
-rw-r--r-- | usr.bin/fetch/ftp.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.bin/fetch/ftp.c b/usr.bin/fetch/ftp.c index 6c6c71c..45c8ecf 100644 --- a/usr.bin/fetch/ftp.c +++ b/usr.bin/fetch/ftp.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ftp.c,v 1.9 1997/10/08 18:43:53 fenner Exp $ + * $Id: ftp.c,v 1.10 1998/09/20 00:01:26 jkh Exp $ */ #include <sys/types.h> @@ -375,6 +375,20 @@ ftp_retrieve(struct fetch_state *fs) } } size = ftpGetSize(ftp, ftps->ftp_remote_file); + + if (fs->fs_reportsize) { + fclose(ftp); + if (size == -1) { + warnx("%s: size not known\n", fs->fs_outputfile); + printf("Unknown\n"); + return 1; + } + else { + printf("%qd\n", (quad_t)size); + return 0; + } + } + if (size > 0 && fs->fs_expectedsize != -1 && size != fs->fs_expectedsize) { warnx("%s: size mismatch, expected=%lu / actual=%lu", ftps->ftp_remote_path, |