env_prefix.c

来自「minix操作系统最新版本(3.1.1)的源代码」· C语言 代码 · 共 31 行

C
31
字号
#include "sysutil.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 i, s, keylen;  char *val;  size_t n;  if ((s = env_get_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);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?