args.c (e026a48c34d396fe7d0e382673a69bc047c0bfca) | args.c (d005495293cb4ddf2f4690f0b74c9ae1a3ce80a8) |
---|---|
1/* 2 * Copyright (c) 1985 Sun Microsystems, Inc. 3 * Copyright (c) 1980, 1993 4 * The Regents of the University of California. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35 | 1/* 2 * Copyright (c) 1985 Sun Microsystems, Inc. 3 * Copyright (c) 1980, 1993 4 * The Regents of the University of California. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35 |
36#ifndef lint | |
37#if 0 | 36#if 0 |
37#ifndef lint |
|
38static char sccsid[] = "@(#)args.c 8.1 (Berkeley) 6/6/93"; | 38static char sccsid[] = "@(#)args.c 8.1 (Berkeley) 6/6/93"; |
39#endif | |
40#endif /* not lint */ | 39#endif /* not lint */ |
40#endif 41 |
|
41#include <sys/cdefs.h> 42__FBSDID("$FreeBSD$"); 43 44/* 45 * Argument scanning and profile reading code. Default parameters are set 46 * here as well. 47 */ 48 --- 27 unchanged lines hidden (view full) --- 76 77/* 78 * N.B.: because of the way the table here is scanned, options whose names are 79 * substrings of other options must occur later; that is, with -lp vs -l, -lp 80 * must be first. Also, while (most) booleans occur more than once, the last 81 * default value is the one actually assigned. 82 */ 83struct pro { | 42#include <sys/cdefs.h> 43__FBSDID("$FreeBSD$"); 44 45/* 46 * Argument scanning and profile reading code. Default parameters are set 47 * here as well. 48 */ 49 --- 27 unchanged lines hidden (view full) --- 77 78/* 79 * N.B.: because of the way the table here is scanned, options whose names are 80 * substrings of other options must occur later; that is, with -lp vs -l, -lp 81 * must be first. Also, while (most) booleans occur more than once, the last 82 * default value is the one actually assigned. 83 */ 84struct pro { |
84 const char *p_name; /* name, eg -bl, -cli */ | 85 const char *p_name; /* name, e.g. -bl, -cli */ |
85 int p_type; /* type (int, bool, special) */ 86 int p_default; /* the default value (if int) */ 87 int p_special; /* depends on type */ 88 int *p_obj; /* the associated variable */ 89} pro[] = { 90 91 {"T", PRO_SPECIAL, 0, KEY, 0}, 92 {"bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation}, --- 170 unchanged lines hidden (view full) --- 263 output = stdout; 264 break; 265 266 case KEY: 267 if (*param_start == 0) 268 goto need_param; 269 { 270 char *str = (char *) malloc(strlen(param_start) + 1); | 86 int p_type; /* type (int, bool, special) */ 87 int p_default; /* the default value (if int) */ 88 int p_special; /* depends on type */ 89 int *p_obj; /* the associated variable */ 90} pro[] = { 91 92 {"T", PRO_SPECIAL, 0, KEY, 0}, 93 {"bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation}, --- 170 unchanged lines hidden (view full) --- 264 output = stdout; 265 break; 266 267 case KEY: 268 if (*param_start == 0) 269 goto need_param; 270 { 271 char *str = (char *) malloc(strlen(param_start) + 1); |
272 if (str == NULL) 273 err(1, NULL); |
|
271 strcpy(str, param_start); 272 addkey(str, 4); 273 } 274 break; 275 276 default: 277 errx(1, "set_option: internal error: p_special %d", p->p_special); 278 } --- 25 unchanged lines hidden --- | 274 strcpy(str, param_start); 275 addkey(str, 4); 276 } 277 break; 278 279 default: 280 errx(1, "set_option: internal error: p_special %d", p->p_special); 281 } --- 25 unchanged lines hidden --- |