160786Sps/* 2240121Sdelphij * Copyright (C) 1984-2012 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 * 7240121Sdelphij * For more information, see the README file. 860786Sps */ 960786Sps 1060786Sps 1160786Sps#define END_OPTION_STRING ('$') 1260786Sps 1360786Sps/* 1460786Sps * Types of options. 1560786Sps */ 1660786Sps#define BOOL 01 /* Boolean option: 0 or 1 */ 1760786Sps#define TRIPLE 02 /* Triple-valued option: 0, 1 or 2 */ 1860786Sps#define NUMBER 04 /* Numeric option */ 1960786Sps#define STRING 010 /* String-valued option */ 2060786Sps#define NOVAR 020 /* No associated variable */ 2160786Sps#define REPAINT 040 /* Repaint screen after toggling option */ 2260786Sps#define NO_TOGGLE 0100 /* Option cannot be toggled with "-" cmd */ 2360786Sps#define HL_REPAINT 0200 /* Repaint hilites after toggling option */ 2460786Sps#define NO_QUERY 0400 /* Option cannot be queried with "_" cmd */ 25128345Stjr#define INIT_HANDLER 01000 /* Call option handler function at startup */ 2660786Sps 2760786Sps#define OTYPE (BOOL|TRIPLE|NUMBER|STRING|NOVAR) 2860786Sps 29221715Sdelphij#define OLETTER_NONE '\1' /* Invalid option letter */ 30221715Sdelphij 3160786Sps/* 3260786Sps * Argument to a handling function tells what type of activity: 3360786Sps */ 3460786Sps#define INIT 0 /* Initialization (from command line) */ 3560786Sps#define QUERY 1 /* Query (from _ or - command) */ 3660786Sps#define TOGGLE 2 /* Change value (from - command) */ 3760786Sps 3860786Sps/* Flag to toggle_option to specify how to "toggle" */ 3960786Sps#define OPT_NO_TOGGLE 0 4060786Sps#define OPT_TOGGLE 1 4160786Sps#define OPT_UNSET 2 4260786Sps#define OPT_SET 3 4360786Sps#define OPT_NO_PROMPT 0100 4460786Sps 4560786Sps/* Error code from findopt_name */ 4660786Sps#define OPT_AMBIG 1 4760786Sps 4860786Spsstruct optname 4960786Sps{ 5060786Sps char *oname; /* Long (GNU-style) option name */ 5160786Sps struct optname *onext; /* List of synonymous option names */ 5260786Sps}; 5360786Sps 54221715Sdelphij#define OPTNAME_MAX 32 /* Max length of long option name */ 55221715Sdelphij 56128345Stjrstruct loption 5760786Sps{ 5860786Sps char oletter; /* The controlling letter (a-z) */ 5960786Sps struct optname *onames; /* Long (GNU-style) option name */ 6060786Sps int otype; /* Type of the option */ 6160786Sps int odefault; /* Default value */ 6260786Sps int *ovar; /* Pointer to the associated variable */ 6360786Sps void (*ofunc)(); /* Pointer to special handling function */ 6460786Sps char *odesc[3]; /* Description of each value */ 6560786Sps}; 6660786Sps 67