2 /***************************************************************************
4 ****************************************************************************
5 * ncurses is copyright (C) 1992-1995 *
7 * zmbenhal@netcom.com *
9 * esr@snark.thyrsus.com *
11 * Permission is hereby granted to reproduce and distribute ncurses *
12 * by any means and for any fee, whether alone or as part of a *
13 * larger distribution, in source or in binary form, PROVIDED *
14 * this notice is included with any such distribution, and is not *
15 * removed from any of its header files. Mention of ncurses in any *
16 * applications linked with it is highly appreciated. *
18 * ncurses comes AS IS with no warranty, implied or expressed. *
20 ***************************************************************************/
22 /* $Id: capdefaults.c,v 1.4 1996/08/18 00:56:09 tom Exp $ */
25 * Compute obsolete capabilities. The reason this is an include file
26 * is that the two places where it's needed want the macros to
27 * generate offsets to different structures. See the file Caps for
28 * explanations of these conversions.
30 * Note: This code is the functional inverse of the first part
31 * of postprocess_entry().
37 #define VALID_STRING(s) ((s) && s != CANCELLED_STRING)
38 #define EXTRACT_DELAY(str) (sp = strchr(str, '*'), sp ? atoi(sp+1) : 0)
40 /* current (4.4BSD) capabilities marked obsolete */
41 if (VALID_STRING(carriage_return)
42 && (capval = EXTRACT_DELAY(carriage_return)))
43 carriage_return_delay = capval;
44 if (VALID_STRING(newline) && (capval = EXTRACT_DELAY(newline)))
45 new_line_delay = capval;
47 /* current (4.4BSD) capabilities not obsolete */
48 if (!VALID_STRING(termcap_init2) && VALID_STRING(init_3string))
50 termcap_init2 = init_3string;
51 init_3string = (char *)NULL;
53 if (VALID_STRING(reset_1string)
54 && !VALID_STRING(reset_2string)
55 && VALID_STRING(reset_3string))
57 termcap_reset = reset_1string;
58 reset_1string = (char *)NULL;
60 if (magic_cookie_glitch_ul < 0 && magic_cookie_glitch && VALID_STRING(enter_underline_mode))
61 magic_cookie_glitch_ul = magic_cookie_glitch;
63 /* totally obsolete capabilities */
64 linefeed_is_newline = VALID_STRING(newline)
65 && (strcmp("\n", newline) == 0);
66 if (VALID_STRING(cursor_left)
67 && (capval = EXTRACT_DELAY(cursor_left)))
68 backspace_delay = capval;
69 if (VALID_STRING(tab) && (capval = EXTRACT_DELAY(tab)))
70 horizontal_tab_delay = capval;