1*c7ef0cfcSnicm /* $OpenBSD: capdefaults.c,v 1.4 2023/10/17 09:52:08 nicm Exp $ */ 281d8c4e1Snicm 304dfece0Smillert /**************************************************************************** 4*c7ef0cfcSnicm * Copyright 2020,2021 Thomas E. Dickey * 5*c7ef0cfcSnicm * Copyright 1998-2000,2008 Free Software Foundation, Inc. * 604dfece0Smillert * * 704dfece0Smillert * Permission is hereby granted, free of charge, to any person obtaining a * 804dfece0Smillert * copy of this software and associated documentation files (the * 904dfece0Smillert * "Software"), to deal in the Software without restriction, including * 1004dfece0Smillert * without limitation the rights to use, copy, modify, merge, publish, * 1104dfece0Smillert * distribute, distribute with modifications, sublicense, and/or sell * 1204dfece0Smillert * copies of the Software, and to permit persons to whom the Software is * 1304dfece0Smillert * furnished to do so, subject to the following conditions: * 1404dfece0Smillert * * 1504dfece0Smillert * The above copyright notice and this permission notice shall be included * 1604dfece0Smillert * in all copies or substantial portions of the Software. * 1704dfece0Smillert * * 1804dfece0Smillert * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 1904dfece0Smillert * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 2004dfece0Smillert * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 2104dfece0Smillert * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 2204dfece0Smillert * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 2304dfece0Smillert * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 2404dfece0Smillert * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 2504dfece0Smillert * * 2604dfece0Smillert * Except as contained in this notice, the name(s) of the above copyright * 2704dfece0Smillert * holders shall not be used in advertising or otherwise to promote the * 2804dfece0Smillert * sale, use or other dealings in this Software without prior written * 2904dfece0Smillert * authorization. * 3004dfece0Smillert ****************************************************************************/ 3104dfece0Smillert 3204dfece0Smillert /**************************************************************************** 3304dfece0Smillert * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * 3404dfece0Smillert * and: Eric S. Raymond <esr@snark.thyrsus.com> * 3581d8c4e1Snicm * and: Thomas E. Dickey 1996-on * 3604dfece0Smillert ****************************************************************************/ 3704dfece0Smillert 38*c7ef0cfcSnicm /* $Id: capdefaults.c,v 1.4 2023/10/17 09:52:08 nicm Exp $ */ 3904dfece0Smillert 4004dfece0Smillert /* 41962e2679Smillert * Compute obsolete capabilities. The reason this is an include file is 42*c7ef0cfcSnicm * that the two places where it is needed require the macros to generate 43962e2679Smillert * offsets to different structures. See the file Caps for explanations of 44962e2679Smillert * these conversions. 4504dfece0Smillert * 46962e2679Smillert * Note: This code is the functional inverse of the first part of 47962e2679Smillert * postprocess_termcap(). 4804dfece0Smillert */ 4904dfece0Smillert { 50*c7ef0cfcSnicm char *strp; 5181d8c4e1Snicm short capval; 5204dfece0Smillert 5381d8c4e1Snicm #define EXTRACT_DELAY(str) \ 54*c7ef0cfcSnicm (short) (strp = strchr(str, '*'), strp ? atoi(strp+1) : 0) 5504dfece0Smillert 5604dfece0Smillert /* current (4.4BSD) capabilities marked obsolete */ 5704dfece0Smillert if (VALID_STRING(carriage_return) 5804dfece0Smillert && (capval = EXTRACT_DELAY(carriage_return))) 5904dfece0Smillert carriage_return_delay = capval; 6004dfece0Smillert if (VALID_STRING(newline) && (capval = EXTRACT_DELAY(newline))) 6104dfece0Smillert new_line_delay = capval; 6204dfece0Smillert 6304dfece0Smillert /* current (4.4BSD) capabilities not obsolete */ 64962e2679Smillert if (!VALID_STRING(termcap_init2) && VALID_STRING(init_3string)) { 6504dfece0Smillert termcap_init2 = init_3string; 66962e2679Smillert init_3string = ABSENT_STRING; 6704dfece0Smillert } 68962e2679Smillert if (!VALID_STRING(termcap_reset) 69962e2679Smillert && VALID_STRING(reset_2string) 70962e2679Smillert && !VALID_STRING(reset_1string) 71962e2679Smillert && !VALID_STRING(reset_3string)) { 7204dfece0Smillert termcap_reset = reset_2string; 73962e2679Smillert reset_2string = ABSENT_STRING; 7404dfece0Smillert } 75962e2679Smillert if (magic_cookie_glitch_ul == ABSENT_NUMERIC 76962e2679Smillert && magic_cookie_glitch != ABSENT_NUMERIC 77962e2679Smillert && VALID_STRING(enter_underline_mode)) 7804dfece0Smillert magic_cookie_glitch_ul = magic_cookie_glitch; 7904dfece0Smillert 8004dfece0Smillert /* totally obsolete capabilities */ 8181d8c4e1Snicm linefeed_is_newline = (char) (VALID_STRING(newline) 8281d8c4e1Snicm && (strcmp("\n", newline) == 0)); 8304dfece0Smillert if (VALID_STRING(cursor_left) 8404dfece0Smillert && (capval = EXTRACT_DELAY(cursor_left))) 8504dfece0Smillert backspace_delay = capval; 8604dfece0Smillert if (VALID_STRING(tab) && (capval = EXTRACT_DELAY(tab))) 8704dfece0Smillert horizontal_tab_delay = capval; 8804dfece0Smillert #undef EXTRACT_DELAY 8904dfece0Smillert } 90