1/*
2 * $Source: /Volumes/backup/dsmigrate/Dumps/../CVS/passwordserver_sasl/cyrus_sasl/mac/kerberos_includes/kparse.h,v $
3 * $Author: snsimon $
4 * $Header: /Volumes/backup/dsmigrate/Dumps/../CVS/passwordserver_sasl/cyrus_sasl/mac/kerberos_includes/kparse.h,v 1.4 2005/01/10 19:13:36 snsimon Exp $
5 *
6 * Copyright 1988 by the Massachusetts Institute of Technology.
7 *
8 * For copying and distribution information, please see the file
9 * <mit-copyright.h>.
10 *
11 * Include file for kparse routines.
12 */
13
14#ifndef	_KERBEROS_KPARSE_H
15#define	_KERBEROS_KPARSE_H
16
17#pragma ident	"@(#)kparse.h	1.4	93/11/01 SMI"
18
19#include <kerberos/mit-copyright.h>
20
21#ifdef	__cplusplus
22extern "C" {
23#endif
24
25/*
26 * values returned by fGetParameterSet()
27 */
28
29#define	PS_BAD_KEYWORD	  -2	/* unknown or duplicate keyword */
30#define	PS_SYNTAX	  -1	/* syntax error */
31#define	PS_OKAY		   0	/* got a complete parameter set */
32#define	PS_EOF		   1	/* nothing more in the file */
33
34/*
35 * values returned by fGetKeywordValue()
36 */
37
38#define	KV_SYNTAX	 -2	/* syntax error */
39#define	KV_EOF		 -1	/* nothing more in the file */
40#define	KV_OKAY		  0	/* got a keyword/value pair */
41#define	KV_EOL		  1	/* nothing more on this line */
42
43/*
44 * values returned by fGetToken()
45 */
46
47#define	GTOK_BAD_QSTRING -1	/* newline found in quoted string */
48#define	GTOK_EOF	  0	/* end of file encountered */
49#define	GTOK_QSTRING	  1	/* quoted string */
50#define	GTOK_STRING	  2	/* unquoted string */
51#define	GTOK_NUMBER	  3	/* one or more digits */
52#define	GTOK_PUNK	  4	/* punks are punctuation, newline, etc. */
53#define	GTOK_WHITE	  5	/* one or more whitespace chars */
54
55/*
56 * extended character classification macros
57 */
58
59#define	ISOCTAL(CH)	((CH >= '0') && (CH <= '7'))
60#define	ISQUOTE(CH)	((CH == '\"') || (CH == '\'') || (CH == '`'))
61#define	ISWHITESPACE(C)	((C == ' ') || (C == '\t'))
62#define	ISLINEFEED(C)	((C == '\n') || (C == '\r') || (C == '\f'))
63
64/*
65 * tokens consist of any printable charcacter except comma, equal, or
66 * whitespace
67 */
68
69#define	ISTOKENCHAR(C) ((C > 040) && (C < 0177) && (C != ',') && (C != '='))
70
71/*
72 * the parameter table defines the keywords that will be recognized by
73 * fGetParameterSet, and their default values if not specified.
74 */
75
76typedef struct {
77	char *keyword;
78	char *defvalue;
79	char *value;
80} parmtable;
81
82#define	PARMCOUNT(P) (sizeof (P)/sizeof (P[0]))
83
84extern int LineNbr;		/* current line # in parameter file */
85
86extern char ErrorMsg[];		/* meaningful only when KV_SYNTAX, */
87				/* PS_SYNTAX,  or PS_BAD_KEYWORD is */
88				/* returned by fGetKeywordValue or */
89				/* fGetParameterSet */
90
91extern char *strsave();		/* defined in this module */
92extern char *strutol();		/* defined in this module */
93
94#ifdef	__cplusplus
95}
96#endif
97
98#endif	/* _KERBEROS_KPARSE_H */
99