Deleted Added
full compact
kern_environment.c (40131) kern_environment.c (42706)
1/*-
2 * Copyright (c) 1998 Michael Smith
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

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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 *
1/*-
2 * Copyright (c) 1998 Michael Smith
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

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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 * $Id: kern_environment.c,v 1.2 1998/10/09 11:03:46 jkh Exp $
26 * $Id: kern_environment.c,v 1.3 1998/10/09 21:21:34 msmith Exp $
27 */
28
29/*
30 * The unified bootloader passes us a pointer to a preserved copy of
31 * bootstrap/kernel environment variables.
32 * We make these available using sysctl for both in-kernel and
33 * out-of-kernel consumers.
34 *

--- 25 unchanged lines hidden (view full) ---

60 if (*ep = '=')
61 ep++;
62 if (!strncmp(name, cp, len))
63 return(ep);
64 }
65 return(NULL);
66}
67
27 */
28
29/*
30 * The unified bootloader passes us a pointer to a preserved copy of
31 * bootstrap/kernel environment variables.
32 * We make these available using sysctl for both in-kernel and
33 * out-of-kernel consumers.
34 *

--- 25 unchanged lines hidden (view full) ---

60 if (*ep = '=')
61 ep++;
62 if (!strncmp(name, cp, len))
63 return(ep);
64 }
65 return(NULL);
66}
67
68/*
69 * Return an integer value from an environment variable.
70 */
71int
72getenv_int(char *name, int *data)
73{
74 char *value, *vtp;
75 quad_t iv;
76
77 if ((value = getenv(name)) == NULL)
78 return(0);
79
80 iv = strtoq(value, &vtp, 0);
81 if ((vtp == value) || (*vtp != 0))
82 return(0);
83
84 *data = (int)iv;
85 return(1);
86}
68
69static int
70sysctl_kernenv SYSCTL_HANDLER_ARGS
71{
72 int *name = (int *)arg1;
73 u_int namelen = arg2;
74 char *cp;
75 int i, error;

--- 43 unchanged lines hidden ---
87
88static int
89sysctl_kernenv SYSCTL_HANDLER_ARGS
90{
91 int *name = (int *)arg1;
92 u_int namelen = arg2;
93 char *cp;
94 int i, error;

--- 43 unchanged lines hidden ---