コード例 #1
0
ファイル: Funs.c プロジェクト: asdhubin/xgcom
int do_read_config(struct xcomdata *xcomdata, char *path)
{
	int fd = 0;
	int ret = 0;
	char bufv[256];
	fd = open(path, O_RDONLY);
	if(fd < 0)
		return -1;
	ret = read_line(fd, bufv);
	while(ret != EOF){
		if(ret == 1){
			do_setconfig(xcomdata, bufv);
		}
		ret =  read_line(fd, bufv);
	}
	return 0;
}
コード例 #2
0
ファイル: config.c プロジェクト: commshare/xhttpd
/*
 * read_config : read config file
 *
 * read_config(struct server_env *server_env)
 * @ *server_env : the point of server_env that used in all files
 *
 * return : 0 is ok ,-1 is error
 */
static int read_config(struct server_env *s_env)
{
	int fd = 0;
	int ret = 0;
	char bufv[256];
	fd = open(CONFIG_FILE, O_RDONLY);
	if(fd < 0)
		return -1;
	ret = read_line(fd, bufv);
	while(ret != EOF){
		if(ret == 1){
			do_setconfig(s_env, bufv);
		}
		ret =  read_line(fd, bufv);
	}

	return 0;
}