diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-01-06 18:23:44 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-01-06 18:23:44 +0100 |
commit | fb83842efba5b4f08a151d2f8a0fd43de6c62778 (patch) | |
tree | d9053cf4804b062bb31b343d16ccd8cb0cfe2e8d /guix/ftp-client.scm | |
parent | a9f8b72ee1d0a6b2837a49d89698304792b39b4b (diff) | |
download | gnu-guix-fb83842efba5b4f08a151d2f8a0fd43de6c62778.tar gnu-guix-fb83842efba5b4f08a151d2f8a0fd43de6c62778.tar.gz |
ftp-client: Add `ftp-size'.
* guix/ftp-client.scm (ftp-size): New procedure.
Diffstat (limited to 'guix/ftp-client.scm')
-rw-r--r-- | guix/ftp-client.scm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/guix/ftp-client.scm b/guix/ftp-client.scm index 7e241f37b2..e3bacc3720 100644 --- a/guix/ftp-client.scm +++ b/guix/ftp-client.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2010, 2011, 2012 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2010, 2011, 2012, 2013 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -33,6 +33,7 @@ ftp-open ftp-close ftp-chdir + ftp-size ftp-list ftp-retr)) @@ -133,6 +134,12 @@ or a TCP port number), and return it." (%ftp-command (string-append "CWD " dir) 250 (ftp-connection-socket conn))) +(define (ftp-size conn file) + "Return the size in bytes of FILE." + (let ((message (%ftp-command (string-append "SIZE " file) 213 + (ftp-connection-socket conn)))) + (string->number (string-trim-both message)))) + (define (ftp-pasv conn) (define %pasv-rx (make-regexp "([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+)")) |