xref: /csrg-svn/sys/tahoe/stand/vdformat/cmd.h (revision 29528)
1*29528Ssam /*	cmd.h	1.1	86/07/05	*/
2*29528Ssam 
3*29528Ssam #define	QUIT	-1
4*29528Ssam 
5*29528Ssam typedef struct {
6*29528Ssam 	int	cmd_token;
7*29528Ssam 	char	*cmd_text;
8*29528Ssam 	char	*cmd_help;
9*29528Ssam } cmd_text_element;
10*29528Ssam 
11*29528Ssam typedef struct {
12*29528Ssam 	int	cmd_min;
13*29528Ssam 	int	cmd_max;
14*29528Ssam } cmd_digit_element;
15*29528Ssam 
16*29528Ssam #define ismustmatch(c)	((((c)>' ')&&((c)<'a')) || (((c)>'z')&&((c)<='~')))
17*29528Ssam #define isupper(c)	(((c) >= 'A') && ((c) <= 'Z'))
18*29528Ssam #define islower(c)	(((c) >= 'a') && ((c) <= 'z'))
19*29528Ssam #define toupper(c)	(islower(c) ? ((c) & ~040) : c)
20*29528Ssam #define tolower(c)	(isupper(c) ? ((c) | 040) : c)
21*29528Ssam 
22*29528Ssam 
23*29528Ssam #define skipdigits(ptr)	while(is_digit(*ptr)) ptr++
24*29528Ssam #define skip_junk(ptr)	while(*ptr && !is_digit(*ptr) &&\
25*29528Ssam 			    (*ptr != '-') && (*ptr != '~')) ptr++
26*29528Ssam #define is_digit(c)	(((c) >= '0') && ((c) <= '9'))
27*29528Ssam #define	finddigit(ptr)	while(*ptr && !is_digit(*ptr)) ptr++
28*29528Ssam 
29*29528Ssam #define trim_white(ptr) while((*ptr == ' ') || (*ptr == '\t')) ptr++
30*29528Ssam 
31