⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cfg.h

📁 PPP服务端实现例子
💻 H
字号:
////// File: cfg.h// Desc: See cfg.c//////Copyright (C) Chris Barnaby 2002 

//This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License 
//as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
//This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
//warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//You should have received a copy of the GNU General Public License along with this program; if not, write to the 
//Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA#ifndef _CFG_H_#define _CFG_H_extern "C" {#include <stdio.h>#include <string.h>#include <stdlib.h>// Parser states#define STATE_GLOBAL	0#define STATE_CATEGORY	1#define STATE_ENTRY		2#define STATE_VALUE		3// A variable entry under a categorytypedef struct cfgentry_t{	char name[16];	char val[16];	struct cfgentry_t *next;	struct cfgentry_t *prev;}cfgentry_t, *cfgentry_ptr;// A category for variablestypedef struct cfgcategory_t{	char name[16];	cfgentry_t *entries;	struct cfgcategory_t *next;	struct cfgcategory_t *prev;}cfgcategory_t, *cfgcategory_ptr;// Main config structuretypedef struct cfg_t{	char filename[30];	cfgcategory_t *categories;}cfg_t, *cfg_ptr;const char *cfgGetString( cfg_ptr cfg, const char *category, const char *variable, const char *def );
void cfgSetString( cfg_ptr cfg, const char *category, const char *variable, const char *val );int cfgGetBoolean( cfg_ptr cfg, const char *category, const char *variable, int def );
void cfgSetBoolean( cfg_ptr cfg, const char *category, const char *variable, int val );int cfgGetInt( cfg_ptr cfg, const char *category, const char *variable, int def );
void cfgSetInt( cfg_ptr cfg, const char *category, const char *variable, int val );cfg_ptr cfgParse( const char *filename );cfgentry_ptr _cfgFindEntry( cfg_ptr cfg, const char *category, const char *variable );void cfgRelease( cfg_ptr cfg );void cfgWrite( cfg_ptr cfg );
}#endif

⌨️ 快捷键说明

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