xref: /minix3/external/bsd/less/dist/option.h (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc /*	$NetBSD: option.h,v 1.4 2013/09/04 19:44:21 tron Exp $	*/
2f7cf2976SLionel Sambuc 
3f7cf2976SLionel Sambuc /*
4*84d9c625SLionel Sambuc  * Copyright (C) 1984-2012  Mark Nudelman
5f7cf2976SLionel Sambuc  *
6f7cf2976SLionel Sambuc  * You may distribute under the terms of either the GNU General Public
7f7cf2976SLionel Sambuc  * License or the Less License, as specified in the README file.
8f7cf2976SLionel Sambuc  *
9*84d9c625SLionel Sambuc  * For more information, see the README file.
10f7cf2976SLionel Sambuc  */
11f7cf2976SLionel Sambuc 
12f7cf2976SLionel Sambuc 
13f7cf2976SLionel Sambuc #define	END_OPTION_STRING	('$')
14f7cf2976SLionel Sambuc 
15f7cf2976SLionel Sambuc /*
16f7cf2976SLionel Sambuc  * Types of options.
17f7cf2976SLionel Sambuc  */
18f7cf2976SLionel Sambuc #define	BOOL		01	/* Boolean option: 0 or 1 */
19f7cf2976SLionel Sambuc #define	TRIPLE		02	/* Triple-valued option: 0, 1 or 2 */
20f7cf2976SLionel Sambuc #define	NUMBER		04	/* Numeric option */
21f7cf2976SLionel Sambuc #define	STRING		010	/* String-valued option */
22f7cf2976SLionel Sambuc #define	NOVAR		020	/* No associated variable */
23f7cf2976SLionel Sambuc #define	REPAINT		040	/* Repaint screen after toggling option */
24f7cf2976SLionel Sambuc #define	NO_TOGGLE	0100	/* Option cannot be toggled with "-" cmd */
25f7cf2976SLionel Sambuc #define	HL_REPAINT	0200	/* Repaint hilites after toggling option */
26f7cf2976SLionel Sambuc #define	NO_QUERY	0400	/* Option cannot be queried with "_" cmd */
27f7cf2976SLionel Sambuc #define	INIT_HANDLER	01000	/* Call option handler function at startup */
28f7cf2976SLionel Sambuc 
29f7cf2976SLionel Sambuc #define	OTYPE		(BOOL|TRIPLE|NUMBER|STRING|NOVAR)
30f7cf2976SLionel Sambuc 
31f7cf2976SLionel Sambuc #define OLETTER_NONE    '\1'     /* Invalid option letter */
32f7cf2976SLionel Sambuc 
33f7cf2976SLionel Sambuc /*
34f7cf2976SLionel Sambuc  * Argument to a handling function tells what type of activity:
35f7cf2976SLionel Sambuc  */
36f7cf2976SLionel Sambuc #define	INIT	0	/* Initialization (from command line) */
37f7cf2976SLionel Sambuc #define	QUERY	1	/* Query (from _ or - command) */
38f7cf2976SLionel Sambuc #define	TOGGLE	2	/* Change value (from - command) */
39f7cf2976SLionel Sambuc 
40f7cf2976SLionel Sambuc /* Flag to toggle_option to specify how to "toggle" */
41f7cf2976SLionel Sambuc #define	OPT_NO_TOGGLE	0
42f7cf2976SLionel Sambuc #define	OPT_TOGGLE	1
43f7cf2976SLionel Sambuc #define	OPT_UNSET	2
44f7cf2976SLionel Sambuc #define	OPT_SET		3
45f7cf2976SLionel Sambuc #define OPT_NO_PROMPT	0100
46f7cf2976SLionel Sambuc 
47f7cf2976SLionel Sambuc /* Error code from findopt_name */
48f7cf2976SLionel Sambuc #define OPT_AMBIG       1
49f7cf2976SLionel Sambuc 
50f7cf2976SLionel Sambuc struct optname
51f7cf2976SLionel Sambuc {
52f7cf2976SLionel Sambuc 	char *oname;            /* Long (GNU-style) option name */
53f7cf2976SLionel Sambuc 	struct optname *onext;  /* List of synonymous option names */
54f7cf2976SLionel Sambuc };
55f7cf2976SLionel Sambuc 
56f7cf2976SLionel Sambuc #define OPTNAME_MAX	32	/* Max length of long option name */
57f7cf2976SLionel Sambuc 
58f7cf2976SLionel Sambuc struct loption
59f7cf2976SLionel Sambuc {
60f7cf2976SLionel Sambuc 	char oletter;		/* The controlling letter (a-z) */
61f7cf2976SLionel Sambuc 	struct optname *onames; /* Long (GNU-style) option name */
62f7cf2976SLionel Sambuc 	int otype;		/* Type of the option */
63f7cf2976SLionel Sambuc 	int odefault;		/* Default value */
64f7cf2976SLionel Sambuc 	int *ovar;		/* Pointer to the associated variable */
65f7cf2976SLionel Sambuc 	void (*ofunc)		/* Pointer to special handling function */
66f7cf2976SLionel Sambuc 	    __P((int, char *));
67f7cf2976SLionel Sambuc 	char *odesc[3];		/* Description of each value */
68f7cf2976SLionel Sambuc };
69f7cf2976SLionel Sambuc 
70