diff options
author | des <des@FreeBSD.org> | 2000-07-11 23:50:22 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2000-07-11 23:50:22 +0000 |
commit | d908f153d0c1a01bdb580b8029f8c40dc1263ff6 (patch) | |
tree | c9046e2b1469400248ee169dfc0d79c2afc7598c | |
parent | 848e1688b8b197884a50800324df1f3d1399c2b4 (diff) | |
download | FreeBSD-src-d908f153d0c1a01bdb580b8029f8c40dc1263ff6.zip FreeBSD-src-d908f153d0c1a01bdb580b8029f8c40dc1263ff6.tar.gz |
Use fetch_putln()
-rw-r--r-- | lib/libfetch/ftp.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c index cb12eaa..60ffe96 100644 --- a/lib/libfetch/ftp.c +++ b/lib/libfetch/ftp.c @@ -57,7 +57,6 @@ #include <sys/param.h> #include <sys/socket.h> -#include <sys/uio.h> #include <netinet/in.h> #include <ctype.h> @@ -92,8 +91,6 @@ #define FTP_FILE_OK 350 #define FTP_SYNTAX_ERROR 500 -static char ENDL[2] = "\r\n"; - static struct url cached_host; static int cached_socket; @@ -170,12 +167,12 @@ static int _ftp_cmd(int cd, char *fmt, ...) { va_list ap; - struct iovec iov[2]; + size_t len; char *msg; int r; va_start(ap, fmt); - vasprintf(&msg, fmt, ap); + len = vasprintf(&msg, fmt, ap); va_end(ap); if (msg == NULL) { @@ -183,13 +180,10 @@ _ftp_cmd(int cd, char *fmt, ...) _fetch_syserr(); return -1; } - DEBUG(fprintf(stderr, "\033[1m>>> %s\n\033[m", msg)); - iov[0].iov_base = msg; - iov[0].iov_len = strlen(msg); - iov[1].iov_base = ENDL; - iov[1].iov_len = sizeof ENDL; - r = writev(cd, iov, 2); + + r = _fetch_putln(cd, msg, len); free(msg); + if (r == -1) { _fetch_syserr(); return -1; |