option.h revision 60786
160786Sps/*
260786Sps * Copyright (C) 1984-2000  Mark Nudelman
360786Sps *
460786Sps * You may distribute under the terms of either the GNU General Public
560786Sps * License or the Less License, as specified in the README file.
660786Sps *
760786Sps * For more information about less, or for information on how to
860786Sps * contact the author, see the README file.
960786Sps */
1060786Sps
1160786Sps
1260786Sps#define	END_OPTION_STRING	('$')
1360786Sps
1460786Sps/*
1560786Sps * Types of options.
1660786Sps */
1760786Sps#define	BOOL		01	/* Boolean option: 0 or 1 */
1860786Sps#define	TRIPLE		02	/* Triple-valued option: 0, 1 or 2 */
1960786Sps#define	NUMBER		04	/* Numeric option */
2060786Sps#define	STRING		010	/* String-valued option */
2160786Sps#define	NOVAR		020	/* No associated variable */
2260786Sps#define	REPAINT		040	/* Repaint screen after toggling option */
2360786Sps#define	NO_TOGGLE	0100	/* Option cannot be toggled with "-" cmd */
2460786Sps#define	HL_REPAINT	0200	/* Repaint hilites after toggling option */
2560786Sps#define	NO_QUERY	0400	/* Option cannot be queried with "_" cmd */
2660786Sps
2760786Sps#define	OTYPE		(BOOL|TRIPLE|NUMBER|STRING|NOVAR)
2860786Sps
2960786Sps/*
3060786Sps * Argument to a handling function tells what type of activity:
3160786Sps */
3260786Sps#define	INIT	0	/* Initialization (from command line) */
3360786Sps#define	QUERY	1	/* Query (from _ or - command) */
3460786Sps#define	TOGGLE	2	/* Change value (from - command) */
3560786Sps
3660786Sps/* Flag to toggle_option to specify how to "toggle" */
3760786Sps#define	OPT_NO_TOGGLE	0
3860786Sps#define	OPT_TOGGLE	1
3960786Sps#define	OPT_UNSET	2
4060786Sps#define	OPT_SET		3
4160786Sps#define OPT_NO_PROMPT	0100
4260786Sps
4360786Sps/* Error code from findopt_name */
4460786Sps#define OPT_AMBIG       1
4560786Sps
4660786Spsstruct optname
4760786Sps{
4860786Sps	char *oname;            /* Long (GNU-style) option name */
4960786Sps	struct optname *onext;  /* List of synonymous option names */
5060786Sps};
5160786Sps
5260786Spsstruct option
5360786Sps{
5460786Sps	char oletter;		/* The controlling letter (a-z) */
5560786Sps	struct optname *onames; /* Long (GNU-style) option name */
5660786Sps	int otype;		/* Type of the option */
5760786Sps	int odefault;		/* Default value */
5860786Sps	int *ovar;		/* Pointer to the associated variable */
5960786Sps	void (*ofunc)();	/* Pointer to special handling function */
6060786Sps	char *odesc[3];		/* Description of each value */
6160786Sps};
6260786Sps
63