📄 mmreadcfg.h
字号:
/* $Id: mmreadcfg.h,v 1.2 2003/01/01 14:54:10 mmondor Exp $ *//* * Copyright (C) 1991-2003, Matthew Mondor * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software written by Matthew Mondor. * 4. The name of Matthew Mondor may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY MATTHEW MONDOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL MATTHEW MONDOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */#ifndef MMREADCFG_H#define MMREADCFG_H#include <sys/types.h>#include <pwd.h>#include <grp.h>#include <mmtypes.h>/* Definitions for CfgArg CA_Type */#define CAT_STR 1 /* One string, quoted if spaces */#define CAT_VAL 2 /* A signed number */#define CAT_BOOL 3 /* A boolean value (TRUE or FALSE) */#define CAT_END 0 /* End of options list *//* Definitions for CfgResult CR_Err */#define CRE_NOT_FOUND 1#define CRE_ILLEGAL_KEYWD 2#define CRE_STR_TOO_LONG 3#define CRE_STR_TOO_SHORT 4#define CRE_VAL_TOO_HIGH 5#define CRE_VAL_TOO_LOW 6#define CRE_NOT_BOOLEAN 7#define CRE_REQUIRED_KEYWD 8#define CRE_MULT_DEF_KEYWD 9#define CRE_KEYWD_TOO_LONG 10#define CRE_UNMATCHED_QUOTE 11#define CRE_NO_KEYWD_DATA 12/* Definitions for CfgArg CA_Status */#define CAS_UNTOUCHED 0#define CAS_REQUIRED 1#define CAS_TOUCHED 2/* ReadCfg needed structures */typedef struct CfgArg{ long CA_Type, CA_Min, CA_Max, CA_Status; char *CA_KW; void *CA_Data;} CARG;typedef struct CfgResult{ long CR_Number; short CR_Err; char CR_Data[255];} CRES;typedef struct CMap{ char *CM_Str; long CM_Val;} CMAP;extern char *mmreadcfg_strings[];bool mmreadcfg(char *, CARG *, CRES *);bool mmmapstring(CMAP *, char *, long *);char *mmreadcfg_strerr(short);gid_t *mmgetgidarray(int *, char *);gid_t *mmfreegidarray(gid_t *);uid_t mmgetuid(char *);gid_t mmgetgid(char *);bool mmdropprivs(uid_t, gid_t *, int);#define mmreadcfg_strerr(a) (mmreadcfg_strings[a])#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -