Back to index

tetex-bin  3.0
capdefaults.c
Go to the documentation of this file.
00001 /****************************************************************************
00002  * Copyright (c) 1998-2000 Free Software Foundation, Inc.                   *
00003  *                                                                          *
00004  * Permission is hereby granted, free of charge, to any person obtaining a  *
00005  * copy of this software and associated documentation files (the            *
00006  * "Software"), to deal in the Software without restriction, including      *
00007  * without limitation the rights to use, copy, modify, merge, publish,      *
00008  * distribute, distribute with modifications, sublicense, and/or sell       *
00009  * copies of the Software, and to permit persons to whom the Software is    *
00010  * furnished to do so, subject to the following conditions:                 *
00011  *                                                                          *
00012  * The above copyright notice and this permission notice shall be included  *
00013  * in all copies or substantial portions of the Software.                   *
00014  *                                                                          *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
00016  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
00017  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
00018  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
00019  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
00020  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
00021  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
00022  *                                                                          *
00023  * Except as contained in this notice, the name(s) of the above copyright   *
00024  * holders shall not be used in advertising or otherwise to promote the     *
00025  * sale, use or other dealings in this Software without prior written       *
00026  * authorization.                                                           *
00027  ****************************************************************************/
00028 
00029 /****************************************************************************
00030  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
00031  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
00032  ****************************************************************************/
00033 
00034 /* $Id: capdefaults.c,v 1.12 2000/01/02 02:34:56 tom Exp $ */
00035 
00036     /*
00037      * Compute obsolete capabilities.  The reason this is an include file is
00038      * that the two places where it's needed want the macros to generate
00039      * offsets to different structures.  See the file Caps for explanations of
00040      * these conversions.
00041      *
00042      * Note:  This code is the functional inverse of the first part of
00043      * postprocess_termcap().
00044      */
00045 {
00046     char *sp;
00047     int capval;
00048 
00049 #define EXTRACT_DELAY(str)  (sp = strchr(str, '*'), sp ? atoi(sp+1) : 0)
00050 
00051     /* current (4.4BSD) capabilities marked obsolete */
00052     if (VALID_STRING(carriage_return)
00053        && (capval = EXTRACT_DELAY(carriage_return)))
00054        carriage_return_delay = capval;
00055     if (VALID_STRING(newline) && (capval = EXTRACT_DELAY(newline)))
00056        new_line_delay = capval;
00057 
00058     /* current (4.4BSD) capabilities not obsolete */
00059     if (!VALID_STRING(termcap_init2) && VALID_STRING(init_3string)) {
00060        termcap_init2 = init_3string;
00061        init_3string = ABSENT_STRING;
00062     }
00063     if (!VALID_STRING(termcap_reset)
00064      && VALID_STRING(reset_2string)
00065      && !VALID_STRING(reset_1string)
00066      && !VALID_STRING(reset_3string)) {
00067        termcap_reset = reset_2string;
00068        reset_2string = ABSENT_STRING;
00069     }
00070     if (magic_cookie_glitch_ul == ABSENT_NUMERIC
00071        && magic_cookie_glitch != ABSENT_NUMERIC
00072        && VALID_STRING(enter_underline_mode))
00073        magic_cookie_glitch_ul = magic_cookie_glitch;
00074 
00075     /* totally obsolete capabilities */
00076     linefeed_is_newline = VALID_STRING(newline)
00077        && (strcmp("\n", newline) == 0);
00078     if (VALID_STRING(cursor_left)
00079        && (capval = EXTRACT_DELAY(cursor_left)))
00080        backspace_delay = capval;
00081     if (VALID_STRING(tab) && (capval = EXTRACT_DELAY(tab)))
00082        horizontal_tab_delay = capval;
00083 #undef EXTRACT_DELAY
00084 }