misc.c (134441) | misc.c (181278) |
---|---|
1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 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 --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/boot/common/misc.c 134441 2004-08-28 14:57:34Z iedowse $"); | 28__FBSDID("$FreeBSD: head/sys/boot/common/misc.c 181278 2008-08-04 06:39:52Z cperciva $"); |
29 30#include <string.h> 31#include <stand.h> 32#include <bootstrap.h> 33 34/* 35 * Concatenate the (argc) elements of (argv) into a single string, and return 36 * a copy of same. 37 */ 38char * 39unargv(int argc, char *argv[]) 40{ 41 size_t hlong; 42 int i; 43 char *cp; 44 | 29 30#include <string.h> 31#include <stand.h> 32#include <bootstrap.h> 33 34/* 35 * Concatenate the (argc) elements of (argv) into a single string, and return 36 * a copy of same. 37 */ 38char * 39unargv(int argc, char *argv[]) 40{ 41 size_t hlong; 42 int i; 43 char *cp; 44 |
45 for (hlong = 0, i = 0, hlong = 0; i < argc; i++) | 45 for (i = 0, hlong = 0; i < argc; i++) |
46 hlong += strlen(argv[i]) + 2; 47 48 if(hlong == 0) 49 return(NULL); 50 51 cp = malloc(hlong); 52 cp[0] = 0; 53 for (i = 0; i < argc; i++) { --- 160 unchanged lines hidden --- | 46 hlong += strlen(argv[i]) + 2; 47 48 if(hlong == 0) 49 return(NULL); 50 51 cp = malloc(hlong); 52 cp[0] = 0; 53 for (i = 0; i < argc; i++) { --- 160 unchanged lines hidden --- |