. service tells you which device it couldn't stat
[minix3.git] / lib / sysutil / env_prefix.c
blobb569f7ddbaee4b3e9c1e40ee8568ce5f4a8b7b16
1 #include "sysutil.h"
2 #include <stdlib.h>
3 #include <string.h>
5 /*=========================================================================*
6 * env_prefix *
7 *=========================================================================*/
8 PUBLIC int env_prefix(env, prefix)
9 char *env; /* environment variable to inspect */
10 char *prefix; /* prefix to test for */
12 /* An environment setting may be prefixed by a word, usually "pci".
13 * Return TRUE if a given prefix is used.
15 char value[EP_BUF_SIZE];
16 char punct[] = ":,;.";
17 int s;
18 size_t n;
20 if ((s = env_get_param(env, value, sizeof(value))) != 0) {
21 if (s != ESRCH) /* only error allowed */
22 printf("WARNING: get_mon_param() failed in env_prefix(): %d\n", s);
24 n = strlen(prefix);
25 return(value != NULL
26 && strncmp(value, prefix, n) == 0
27 && strchr(punct, value[n]) != NULL);