fetch.c (109694) | fetch.c (109967) |
---|---|
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/fetch.c 109694 2003-01-22 17:53:15Z des $"); | 30__FBSDID("$FreeBSD: head/lib/libfetch/fetch.c 109967 2003-01-28 08:04:40Z des $"); |
31 32#include <sys/param.h> 33#include <sys/errno.h> 34 35#include <ctype.h> 36#include <stdio.h> 37#include <stdlib.h> 38#include <string.h> --- 230 unchanged lines hidden (view full) --- 269 } 270 271 if (port < 0 || port > 65535) { 272 _url_seterr(URL_BAD_PORT); 273 return (NULL); 274 } 275 276 /* allocate struct url */ | 31 32#include <sys/param.h> 33#include <sys/errno.h> 34 35#include <ctype.h> 36#include <stdio.h> 37#include <stdlib.h> 38#include <string.h> --- 230 unchanged lines hidden (view full) --- 269 } 270 271 if (port < 0 || port > 65535) { 272 _url_seterr(URL_BAD_PORT); 273 return (NULL); 274 } 275 276 /* allocate struct url */ |
277 if ((u = calloc(1, sizeof *u)) == NULL) { | 277 if ((u = calloc(1, sizeof(*u))) == NULL) { |
278 _fetch_syserr(); 279 return (NULL); 280 } 281 282 if ((u->doc = strdup(doc ? doc : "/")) == NULL) { 283 _fetch_syserr(); 284 free(u); 285 return (NULL); 286 } 287 | 278 _fetch_syserr(); 279 return (NULL); 280 } 281 282 if ((u->doc = strdup(doc ? doc : "/")) == NULL) { 283 _fetch_syserr(); 284 free(u); 285 return (NULL); 286 } 287 |
288#define seturl(x) snprintf(u->x, sizeof u->x, "%s", x) | 288#define seturl(x) snprintf(u->x, sizeof(u->x), "%s", x) |
289 seturl(scheme); 290 seturl(host); 291 seturl(user); 292 seturl(pwd); 293#undef seturl 294 u->port = port; 295 296 return (u); --- 8 unchanged lines hidden (view full) --- 305fetchParseURL(const char *URL) 306{ 307 char *doc; 308 const char *p, *q; 309 struct url *u; 310 int i; 311 312 /* allocate struct url */ | 289 seturl(scheme); 290 seturl(host); 291 seturl(user); 292 seturl(pwd); 293#undef seturl 294 u->port = port; 295 296 return (u); --- 8 unchanged lines hidden (view full) --- 305fetchParseURL(const char *URL) 306{ 307 char *doc; 308 const char *p, *q; 309 struct url *u; 310 int i; 311 312 /* allocate struct url */ |
313 if ((u = calloc(1, sizeof *u)) == NULL) { | 313 if ((u = calloc(1, sizeof(*u))) == NULL) { |
314 _fetch_syserr(); 315 return (NULL); 316 } 317 318 /* scheme name */ 319 if ((p = strstr(URL, ":/"))) { 320 snprintf(u->scheme, URL_SCHEMELEN+1, 321 "%.*s", (int)(p - URL), URL); --- 117 unchanged lines hidden --- | 314 _fetch_syserr(); 315 return (NULL); 316 } 317 318 /* scheme name */ 319 if ((p = strstr(URL, ":/"))) { 320 snprintf(u->scheme, URL_SCHEMELEN+1, 321 "%.*s", (int)(p - URL), URL); --- 117 unchanged lines hidden --- |