Annotation of src/usr.bin/less/option.h, Revision 1.1
1.1 ! etheisen 1: /*
! 2: * Copyright (c) 1984,1985,1989,1994,1995 Mark Nudelman
! 3: * All rights reserved.
! 4: *
! 5: * Redistribution and use in source and binary forms, with or without
! 6: * modification, are permitted provided that the following conditions
! 7: * are met:
! 8: * 1. Redistributions of source code must retain the above copyright
! 9: * notice, this list of conditions and the following disclaimer.
! 10: * 2. Redistributions in binary form must reproduce the above copyright
! 11: * notice in the documentation and/or other materials provided with
! 12: * the distribution.
! 13: *
! 14: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
! 15: * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 16: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! 17: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
! 18: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! 19: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
! 20: * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
! 21: * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
! 22: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
! 23: * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
! 24: * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! 25: */
! 26:
! 27:
! 28: #define END_OPTION_STRING ('$')
! 29:
! 30: /*
! 31: * Types of options.
! 32: */
! 33: #define BOOL 01 /* Boolean option: 0 or 1 */
! 34: #define TRIPLE 02 /* Triple-valued option: 0, 1 or 2 */
! 35: #define NUMBER 04 /* Numeric option */
! 36: #define STRING 010 /* String-valued option */
! 37: #define NOVAR 020 /* No associated variable */
! 38: #define REPAINT 040 /* Repaint screen after toggling option */
! 39: #define NO_TOGGLE 0100 /* Option cannot be toggled with "-" cmd */
! 40: #define HL_REPAINT 0200 /* Repaint hilites after toggling option */
! 41: #define NO_QUERY 0400 /* Option cannot be queried with "_" cmd */
! 42:
! 43: #define OTYPE (BOOL|TRIPLE|NUMBER|STRING|NOVAR)
! 44:
! 45: /*
! 46: * Argument to a handling function tells what type of activity:
! 47: */
! 48: #define INIT 0 /* Initialization (from command line) */
! 49: #define QUERY 1 /* Query (from _ or - command) */
! 50: #define TOGGLE 2 /* Change value (from - command) */
! 51:
! 52: /* Flag to toggle_option to specify how to "toggle" */
! 53: #define OPT_NO_TOGGLE 0
! 54: #define OPT_TOGGLE 1
! 55: #define OPT_UNSET 2
! 56: #define OPT_SET 3
! 57:
! 58: struct option
! 59: {
! 60: char oletter; /* The controlling letter (a-z) */
! 61: int otype; /* Type of the option */
! 62: int odefault; /* Default value */
! 63: int *ovar; /* Pointer to the associated variable */
! 64: void (*ofunc)(); /* Pointer to special handling function */
! 65: char *odesc[3]; /* Description of each value */
! 66: };
! 67: