1 /* $NetBSD: lesskey.h,v 1.4 2023/10/06 05:49:49 simonb Exp $ */ 2 3 /* 4 * Copyright (C) 1984-2023 Mark Nudelman 5 * 6 * You may distribute under the terms of either the GNU General Public 7 * License or the Less License, as specified in the README file. 8 * 9 * For more information, see the README file. 10 */ 11 12 #include "xbuf.h" 13 14 /* 15 * Format of a lesskey file: 16 * 17 * LESSKEY_MAGIC (4 bytes) 18 * sections... 19 * END_LESSKEY_MAGIC (4 bytes) 20 * 21 * Each section is: 22 * 23 * section_MAGIC (1 byte) 24 * section_length (2 bytes) 25 * key table (section_length bytes) 26 */ 27 #define C0_LESSKEY_MAGIC '\0' 28 #define C1_LESSKEY_MAGIC 'M' 29 #define C2_LESSKEY_MAGIC '+' 30 #define C3_LESSKEY_MAGIC 'G' 31 32 #define CMD_SECTION 'c' 33 #define EDIT_SECTION 'e' 34 #define VAR_SECTION 'v' 35 #define END_SECTION 'x' 36 37 #define C0_END_LESSKEY_MAGIC 'E' 38 #define C1_END_LESSKEY_MAGIC 'n' 39 #define C2_END_LESSKEY_MAGIC 'd' 40 41 /* */ 42 #define KRADIX 64 43 44 struct lesskey_cmdname 45 { 46 char *cn_name; 47 int cn_action; 48 }; 49 50 struct lesskey_table 51 { 52 struct lesskey_cmdname *names; 53 struct xbuffer buf; 54 int is_var; 55 }; 56 57 struct lesskey_tables 58 { 59 struct lesskey_table *currtable; 60 struct lesskey_table cmdtable; 61 struct lesskey_table edittable; 62 struct lesskey_table vartable; 63 }; 64 65 extern int parse_lesskey(char *infile, struct lesskey_tables *tables); 66