ftp.c (87315) | ftp.c (88769) |
---|---|
1/*- 2 * Copyright (c) 1998 Dag-Erling Co�dan Sm�rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1998 Dag-Erling Co�dan Sm�rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/lib/libfetch/ftp.c 87315 2001-12-04 01:09:19Z des $"); | 30__FBSDID("$FreeBSD: head/lib/libfetch/ftp.c 88769 2002-01-01 14:48:09Z des $"); |
31 32/* 33 * Portions of this code were taken from or based on ftpio.c: 34 * 35 * ---------------------------------------------------------------------------- 36 * "THE BEER-WARE LICENSE" (Revision 42): 37 * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you 38 * can do whatever you want with this stuff. If we meet some day, and you think --- 223 unchanged lines hidden (view full) --- 262 us->size = us->size * 10 + *ln - '0'; 263 if (*ln && !isspace(*ln)) { 264 _ftp_seterr(FTP_PROTOCOL_ERROR); 265 us->size = -1; 266 return -1; 267 } 268 if (us->size == 0) 269 us->size = -1; | 31 32/* 33 * Portions of this code were taken from or based on ftpio.c: 34 * 35 * ---------------------------------------------------------------------------- 36 * "THE BEER-WARE LICENSE" (Revision 42): 37 * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you 38 * can do whatever you want with this stuff. If we meet some day, and you think --- 223 unchanged lines hidden (view full) --- 262 us->size = us->size * 10 + *ln - '0'; 263 if (*ln && !isspace(*ln)) { 264 _ftp_seterr(FTP_PROTOCOL_ERROR); 265 us->size = -1; 266 return -1; 267 } 268 if (us->size == 0) 269 us->size = -1; |
270 DEBUG(fprintf(stderr, "size: [\033[1m%lld\033[m]\n", (long long)us->size)); | 270 DEBUG(fprintf(stderr, "size: [%lld]\n", (long long)us->size)); |
271 272 if ((e = _ftp_cmd(cd, "MDTM %s", s)) != FTP_FILE_STATUS) { 273 _ftp_seterr(e); 274 return -1; 275 } 276 for (ln = last_reply + 4; *ln && isspace(*ln); ln++) 277 /* nothing */ ; 278 switch (strspn(ln, "0123456789")) { --- 17 unchanged lines hidden (view full) --- 296 tm.tm_mon--; 297 tm.tm_year -= 1900; 298 tm.tm_isdst = -1; 299 t = timegm(&tm); 300 if (t == (time_t)-1) 301 t = time(NULL); 302 us->mtime = t; 303 us->atime = t; | 271 272 if ((e = _ftp_cmd(cd, "MDTM %s", s)) != FTP_FILE_STATUS) { 273 _ftp_seterr(e); 274 return -1; 275 } 276 for (ln = last_reply + 4; *ln && isspace(*ln); ln++) 277 /* nothing */ ; 278 switch (strspn(ln, "0123456789")) { --- 17 unchanged lines hidden (view full) --- 296 tm.tm_mon--; 297 tm.tm_year -= 1900; 298 tm.tm_isdst = -1; 299 t = timegm(&tm); 300 if (t == (time_t)-1) 301 t = time(NULL); 302 us->mtime = t; 303 us->atime = t; |
304 DEBUG(fprintf(stderr, "last modified: [\033[1m%04d-%02d-%02d " 305 "%02d:%02d:%02d\033[m]\n", | 304 DEBUG(fprintf(stderr, "last modified: [%04d-%02d-%02d %02d:%02d:%02d]\n", |
306 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 307 tm.tm_hour, tm.tm_min, tm.tm_sec)); 308 return 0; 309} 310 311/* 312 * I/O functions for FTP 313 */ --- 690 unchanged lines hidden --- | 305 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 306 tm.tm_hour, tm.tm_min, tm.tm_sec)); 307 return 0; 308} 309 310/* 311 * I/O functions for FTP 312 */ --- 690 unchanged lines hidden --- |