1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Cosmetic tweaks. Try and keep the style more consistent, catch some stray

whitespace and update a comment.
This commit is contained in:
Peter Wemm 2002-05-01 02:51:50 +00:00
parent 4924b9dd80
commit 6692ac6644
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95839
2 changed files with 42 additions and 44 deletions

View File

@ -85,7 +85,7 @@ kenv(td, uap)
char *name, *value;
size_t len, done;
int error, i;
KASSERT(dynamic_kenv, ("kenv: dynamic_kenv = 0"));
error = 0;
@ -368,16 +368,16 @@ unsetenv(const char *name)
int
getenv_string(const char *name, char *data, int size)
{
char *tmp;
char *tmp;
tmp = getenv(name);
if (tmp != NULL) {
strncpy(data, tmp, size);
freeenv(tmp);
data[size - 1] = 0;
return (1);
} else
return (0);
tmp = getenv(name);
if (tmp != NULL) {
strncpy(data, tmp, size);
freeenv(tmp);
data[size - 1] = 0;
return (1);
} else
return (0);
}
/*
@ -386,14 +386,13 @@ getenv_string(const char *name, char *data, int size)
int
getenv_int(const char *name, int *data)
{
quad_t tmp;
int rval;
quad_t tmp;
int rval;
rval = getenv_quad(name, &tmp);
if (rval) {
*data = (int) tmp;
}
return (rval);
rval = getenv_quad(name, &tmp);
if (rval)
*data = (int) tmp;
return (rval);
}
/*
@ -402,22 +401,21 @@ getenv_int(const char *name, int *data)
int
getenv_quad(const char *name, quad_t *data)
{
char *value;
char *vtp;
quad_t iv;
if ((value = getenv(name)) == NULL)
return(0);
iv = strtoq(value, &vtp, 0);
if ((vtp == value) || (*vtp != '\0')) {
freeenv(value);
return(0);
}
freeenv(value);
*data = iv;
return(1);
char *value;
char *vtp;
quad_t iv;
value = getenv(name);
if (value == NULL)
return (0);
iv = strtoq(value, &vtp, 0);
if ((vtp == value) || (*vtp != '\0')) {
freeenv(value);
return (0);
}
freeenv(value);
*data = iv;
return (1);
}
/*
@ -427,14 +425,15 @@ getenv_quad(const char *name, quad_t *data)
static char *
kernenv_next(char *cp)
{
if (cp != NULL) {
while (*cp != 0)
cp++;
cp++;
if (*cp == 0)
cp = NULL;
}
return(cp);
if (cp != NULL) {
while (*cp != 0)
cp++;
cp++;
if (*cp == 0)
cp = NULL;
}
return (cp);
}
void

View File

@ -61,7 +61,7 @@ res_find(int *line, int *startln,
if (checkmethod) {
switch (hintmode) {
case 0: /* config supplied nothing */
case 0: /* loader hints in environment only */
break;
case 1: /* static hints only */
hintp = static_hints;
@ -118,9 +118,8 @@ res_find(int *line, int *startln,
sx_sunlock(&kenv_lock);
return (ENOENT);
}
} else {
} else
cp = hintp;
}
while (cp) {
hit = 1;
(*line)++;