/*++ /* NAME /* cfg_parser 3 /* SUMMARY /* configuration parser utilities /* SYNOPSIS /* #include "cfg_parser.h" /* /* CFG_PARSER *cfg_parser_alloc(pname) /* const char *pname; /* /* CFG_PARSER *cfg_parser_free(parser) /* CFG_PARSER *parser; /* /* char *cfg_get_str(parser, name, defval, min, max) /* const CFG_PARSER *parser; /* const char *name; /* const char *defval; /* int min; /* int max; /* /* int cfg_get_int(parser, name, defval, min, max) /* const CFG_PARSER *parser; /* const char *name; /* int defval; /* int min; /* int max; /* /* int cfg_get_bool(parser, name, defval) /* const CFG_PARSER *parser; /* const char *name; /* int defval; /* /* DICT_OWNER cfg_get_owner(parser) /* const CFG_PARSER *parser; /* DESCRIPTION /* This module implements utilities for parsing parameters defined /* either as "\fIname\fR = \fBvalue\fR" in a file pointed to by /* \fIpname\fR (the old MySQL style), or as "\fIpname\fR_\fIname\fR = /* \fBvalue\fR" in main.cf (the old LDAP style). It unifies the /* two styles and provides support for range checking. /* /* \fIcfg_parser_alloc\fR initializes the parser. The result /* is NULL if a configuration file could not be opened. /* /* \fIcfg_parser_free\fR releases the parser. /* /* \fIcfg_get_str\fR looks up a string. /* /* \fIcfg_get_int\fR looks up an integer. /* /* \fIcfg_get_bool\fR looks up a boolean value. /* /* \fIdefval\fR is returned when no value was found. \fImin\fR is /* zero or specifies a lower limit on the integer value or string /* length; \fImax\fR is zero or specifies an upper limit on the /* integer value or string length. /* /* Conveniently, \fIcfg_get_str\fR returns \fBNULL\fR if /* \fIdefval\fR is \fBNULL\fR and no value was found. The returned /* string has to be freed by the caller if not \fBNULL\fR. /* /* cfg_get_owner() looks up the configuration file owner. /* DIAGNOSTICS /* Fatal errors: bad string length, malformed numerical value, malformed /* boolean value. /* SEE ALSO /* mail_conf_str(3) string-valued global configuration parameter support /* mail_conf_int(3) integer-valued configuration parameter support /* mail_conf_bool(3) boolean-valued configuration parameter support /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA /* /* Liviu Daia /* Institute of Mathematics of the Romanian Academy /* P.O. BOX 1-764 /* RO-014700 Bucharest, ROMANIA
/*--*/
staticint get_dict_int(conststruct CFG_PARSER *parser, constchar *name, int defval, int min, int max)
{ constchar *strval; char *end; int intval; long longval;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.