* Removed some variants of the SYS_GETINFO calls from the kernel; replaced them with new PM and utils libary functionality. Fixed bugs in utils library that used old get_kenv() variant. * Implemented a buffer in the kernel to gather random data. Memory driver periodically checks this for /dev/random. A better random algorithm can now be implemented in the driver. Removed SYS_RANDOM; the SYS_GETINFO call is used instead. * Remove SYS_KMALLOC from the kernel. Memory allocation can now be done at the process manager with new 'other' library functions.
29 lines
860 B
C
29 lines
860 B
C
#include "utils.h"
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
/*=========================================================================*
|
|
* env_prefix *
|
|
*=========================================================================*/
|
|
PUBLIC int env_prefix(env, prefix)
|
|
char *env; /* environment variable to inspect */
|
|
char *prefix; /* prefix to test for */
|
|
{
|
|
/* An environment setting may be prefixed by a word, usually "pci".
|
|
* Return TRUE if a given prefix is used.
|
|
*/
|
|
char value[EP_BUF_SIZE];
|
|
char punct[] = ":,;.";
|
|
int s;
|
|
size_t n;
|
|
|
|
if ((s = get_mon_param(env, value, sizeof(value))) != 0) {
|
|
if (s != ESRCH) /* only error allowed */
|
|
printf("WARNING: get_mon_param() failed in env_prefix(): %d\n", s);
|
|
}
|
|
n = strlen(prefix);
|
|
return(value != NULL
|
|
&& strncmp(value, prefix, n) == 0
|
|
&& strchr(punct, value[n]) != NULL);
|
|
}
|
|
|