capdefaults.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /****************************************************************************
  2. * Copyright (c) 1998-2000,2008 Free Software Foundation, Inc. *
  3. * *
  4. * Permission is hereby granted, free of charge, to any person obtaining a *
  5. * copy of this software and associated documentation files (the *
  6. * "Software"), to deal in the Software without restriction, including *
  7. * without limitation the rights to use, copy, modify, merge, publish, *
  8. * distribute, distribute with modifications, sublicense, and/or sell *
  9. * copies of the Software, and to permit persons to whom the Software is *
  10. * furnished to do so, subject to the following conditions: *
  11. * *
  12. * The above copyright notice and this permission notice shall be included *
  13. * in all copies or substantial portions of the Software. *
  14. * *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
  16. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
  18. * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
  19. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
  20. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
  21. * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
  22. * *
  23. * Except as contained in this notice, the name(s) of the above copyright *
  24. * holders shall not be used in advertising or otherwise to promote the *
  25. * sale, use or other dealings in this Software without prior written *
  26. * authorization. *
  27. ****************************************************************************/
  28. /****************************************************************************
  29. * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
  30. * and: Eric S. Raymond <esr@snark.thyrsus.com> *
  31. * and: Thomas E. Dickey 1996-on *
  32. ****************************************************************************/
  33. /* $Id: capdefaults.c,v 1.13 2008/08/04 12:33:42 tom Exp $ */
  34. /*
  35. * Compute obsolete capabilities. The reason this is an include file is
  36. * that the two places where it's needed want the macros to generate
  37. * offsets to different structures. See the file Caps for explanations of
  38. * these conversions.
  39. *
  40. * Note: This code is the functional inverse of the first part of
  41. * postprocess_termcap().
  42. */
  43. {
  44. char *sp;
  45. short capval;
  46. #define EXTRACT_DELAY(str) \
  47. (short) (sp = strchr(str, '*'), sp ? atoi(sp+1) : 0)
  48. /* current (4.4BSD) capabilities marked obsolete */
  49. if (VALID_STRING(carriage_return)
  50. && (capval = EXTRACT_DELAY(carriage_return)))
  51. carriage_return_delay = capval;
  52. if (VALID_STRING(newline) && (capval = EXTRACT_DELAY(newline)))
  53. new_line_delay = capval;
  54. /* current (4.4BSD) capabilities not obsolete */
  55. if (!VALID_STRING(termcap_init2) && VALID_STRING(init_3string)) {
  56. termcap_init2 = init_3string;
  57. init_3string = ABSENT_STRING;
  58. }
  59. if (!VALID_STRING(termcap_reset)
  60. && VALID_STRING(reset_2string)
  61. && !VALID_STRING(reset_1string)
  62. && !VALID_STRING(reset_3string)) {
  63. termcap_reset = reset_2string;
  64. reset_2string = ABSENT_STRING;
  65. }
  66. if (magic_cookie_glitch_ul == ABSENT_NUMERIC
  67. && magic_cookie_glitch != ABSENT_NUMERIC
  68. && VALID_STRING(enter_underline_mode))
  69. magic_cookie_glitch_ul = magic_cookie_glitch;
  70. /* totally obsolete capabilities */
  71. linefeed_is_newline = (char) (VALID_STRING(newline)
  72. && (strcmp("\n", newline) == 0));
  73. if (VALID_STRING(cursor_left)
  74. && (capval = EXTRACT_DELAY(cursor_left)))
  75. backspace_delay = capval;
  76. if (VALID_STRING(tab) && (capval = EXTRACT_DELAY(tab)))
  77. horizontal_tab_delay = capval;
  78. #undef EXTRACT_DELAY
  79. }