Manual pages: mcmcdiffmceditmcview

root/lib/tty/tty-slang.c

/* [previous][next][first][last][top][bottom][index][help]  */

DEFINITIONS

This source file includes following definitions.
  1. tty_setup_sigwinch
  2. sigwinch_handler
  3. do_define_key
  4. load_terminfo_keys
  5. get_maybe_acs
  6. tty_init
  7. tty_shutdown
  8. tty_enter_ca_mode
  9. tty_exit_ca_mode
  10. tty_change_screen_size
  11. tty_reset_prog_mode
  12. tty_reset_shell_mode
  13. tty_raw_mode
  14. tty_noraw_mode
  15. tty_noecho
  16. tty_flush_input
  17. tty_keypad
  18. tty_nodelay
  19. tty_baudrate
  20. tty_lowlevel_getch
  21. tty_reset_screen
  22. tty_touch_screen
  23. tty_gotoyx
  24. tty_getyx
  25. tty_draw_hline
  26. tty_draw_vline
  27. tty_fill_region
  28. tty_colorize_area
  29. tty_display_8bit
  30. tty_print_char
  31. tty_print_anychar
  32. tty_print_string
  33. tty_printf
  34. tty_tigetflag
  35. tty_tigetnum
  36. tty_tigetstr
  37. tty_refresh
  38. tty_beep

   1 /*
   2    Interface to the terminal controlling library.
   3    Slang wrapper.
   4 
   5    Copyright (C) 2005-2025
   6    Free Software Foundation, Inc.
   7 
   8    Written by:
   9    Andrew Borodin <aborodin@vmail.ru>, 2009
  10    Egmont Koblinger <egmont@gmail.com>, 2010
  11 
  12    This file is part of the Midnight Commander.
  13 
  14    The Midnight Commander is free software: you can redistribute it
  15    and/or modify it under the terms of the GNU General Public License as
  16    published by the Free Software Foundation, either version 3 of the License,
  17    or (at your option) any later version.
  18 
  19    The Midnight Commander is distributed in the hope that it will be useful,
  20    but WITHOUT ANY WARRANTY; without even the implied warranty of
  21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  22    GNU General Public License for more details.
  23 
  24    You should have received a copy of the GNU General Public License
  25    along with this program.  If not, see <https://www.gnu.org/licenses/>.
  26  */
  27 
  28 /** \file
  29  *  \brief Source: S-Lang-based tty layer of Midnight Commander
  30  */
  31 
  32 #include <config.h>
  33 
  34 #include <limits.h>  // MB_LEN_MAX
  35 #include <stdio.h>
  36 #include <stdlib.h>
  37 #include <string.h>
  38 #include <sys/types.h>  // size_t
  39 #include <unistd.h>
  40 #ifdef HAVE_SYS_IOCTL_H
  41 #include <sys/ioctl.h>
  42 #endif
  43 #include <termios.h>
  44 
  45 #include "lib/global.h"
  46 #include "lib/strutil.h"  // str_term_form
  47 #include "lib/util.h"     // is_printable()
  48 
  49 #include "tty-internal.h"  // mc_tty_normalize_from_utf8()
  50 #include "tty.h"
  51 #include "color.h"
  52 #include "color-slang.h"
  53 #include "color-internal.h"
  54 #include "mouse.h"  // Gpm_Event is required in key.h
  55 #include "key.h"    // define_sequence
  56 #include "win.h"
  57 
  58 /*** global variables ****************************************************************************/
  59 
  60 /*** file scope macro definitions ****************************************************************/
  61 
  62 #ifndef SLTT_MAX_SCREEN_COLS
  63 #define SLTT_MAX_SCREEN_COLS 512
  64 #endif
  65 
  66 #ifndef SLTT_MAX_SCREEN_ROWS
  67 #define SLTT_MAX_SCREEN_ROWS 512
  68 #endif
  69 
  70 /*** file scope type declarations ****************************************************************/
  71 
  72 /*** forward declarations (file scope functions) *************************************************/
  73 
  74 /*** file scope variables ************************************************************************/
  75 
  76 /* Various saved termios settings that we control here */
  77 static struct termios boot_mode;
  78 static struct termios new_mode;
  79 
  80 /* Controls whether we should wait for input in tty_lowlevel_getch */
  81 static gboolean no_slang_delay;
  82 
  83 static gboolean slsmg_active = FALSE;
  84 
  85 /* This table describes which capabilities we want and which values we
  86  * assign to them.
  87  */
  88 static const struct
  89 {
  90     int key_code;
  91     const char *key_name;
  92 } key_table[] = {
  93     { KEY_F (0), "k0" },
  94     { KEY_F (1), "k1" },
  95     { KEY_F (2), "k2" },
  96     { KEY_F (3), "k3" },
  97     { KEY_F (4), "k4" },
  98     { KEY_F (5), "k5" },
  99     { KEY_F (6), "k6" },
 100     { KEY_F (7), "k7" },
 101     { KEY_F (8), "k8" },
 102     { KEY_F (9), "k9" },
 103     { KEY_F (10), "k;" },
 104     { KEY_F (11), "F1" },
 105     { KEY_F (12), "F2" },
 106     { KEY_F (13), "F3" },
 107     { KEY_F (14), "F4" },
 108     { KEY_F (15), "F5" },
 109     { KEY_F (16), "F6" },
 110     { KEY_F (17), "F7" },
 111     { KEY_F (18), "F8" },
 112     { KEY_F (19), "F9" },
 113     { KEY_F (20), "FA" },
 114     { KEY_IC, "kI" },
 115     { KEY_NPAGE, "kN" },
 116     { KEY_PPAGE, "kP" },
 117     { KEY_LEFT, "kl" },
 118     { KEY_RIGHT, "kr" },
 119     { KEY_UP, "ku" },
 120     { KEY_DOWN, "kd" },
 121     { KEY_DC, "kD" },
 122     { KEY_BACKSPACE, "kb" },
 123     { KEY_HOME, "kh" },
 124     { KEY_END, "@7" },
 125     {
 126         0,
 127         NULL,
 128     },
 129 };
 130 
 131 /* --------------------------------------------------------------------------------------------- */
 132 /*** file scope functions ************************************************************************/
 133 /* --------------------------------------------------------------------------------------------- */
 134 
 135 static void
 136 tty_setup_sigwinch (void (*handler) (int))
     /* [previous][next][first][last][top][bottom][index][help]  */
 137 {
 138     (void) SLsignal (SIGWINCH, handler);
 139     tty_create_winch_pipe ();
 140 }
 141 
 142 /* --------------------------------------------------------------------------------------------- */
 143 
 144 static void
 145 sigwinch_handler (int dummy)
     /* [previous][next][first][last][top][bottom][index][help]  */
 146 {
 147     ssize_t n = 0;
 148 
 149     (void) dummy;
 150 
 151     n = write (sigwinch_pipe[1], "", 1);
 152     (void) n;
 153 
 154     (void) SLsignal (SIGWINCH, sigwinch_handler);
 155 }
 156 
 157 /* --------------------------------------------------------------------------------------------- */
 158 
 159 static void
 160 do_define_key (int code, const char *strcap)
     /* [previous][next][first][last][top][bottom][index][help]  */
 161 {
 162     char *seq;
 163 
 164     seq = SLtt_tgetstr ((SLFUTURE_CONST char *) strcap);
 165     if (seq != NULL)
 166         define_sequence (code, seq, MCKEY_NOACTION);
 167 }
 168 
 169 /* --------------------------------------------------------------------------------------------- */
 170 
 171 static void
 172 load_terminfo_keys (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 173 {
 174     int i;
 175 
 176     for (i = 0; key_table[i].key_code; i++)
 177         do_define_key (key_table[i].key_code, key_table[i].key_name);
 178 }
 179 
 180 /* --------------------------------------------------------------------------------------------- */
 181 
 182 static int
 183 get_maybe_acs (mc_tty_char_t c, gboolean *alt_char)
     /* [previous][next][first][last][top][bottom][index][help]  */
 184 {
 185     *alt_char = TRUE;
 186 
 187     switch (c)
 188     {
 189     case MC_ACS_HLINE:
 190         return SLSMG_HLINE_CHAR;
 191     case MC_ACS_VLINE:
 192         return SLSMG_VLINE_CHAR;
 193     case MC_ACS_ULCORNER:
 194         return SLSMG_ULCORN_CHAR;
 195     case MC_ACS_URCORNER:
 196         return SLSMG_URCORN_CHAR;
 197     case MC_ACS_LLCORNER:
 198         return SLSMG_LLCORN_CHAR;
 199     case MC_ACS_LRCORNER:
 200         return SLSMG_LRCORN_CHAR;
 201     case MC_ACS_LTEE:
 202         return SLSMG_LTEE_CHAR;
 203     case MC_ACS_RTEE:
 204         return SLSMG_RTEE_CHAR;
 205     case MC_ACS_TTEE:
 206         return SLSMG_UTEE_CHAR;
 207     case MC_ACS_BTEE:
 208         return SLSMG_DTEE_CHAR;
 209     case MC_ACS_PLUS:
 210         return SLSMG_PLUS_CHAR;
 211 
 212     default:
 213         *alt_char = FALSE;
 214         return c;
 215     }
 216 }
 217 
 218 /* --------------------------------------------------------------------------------------------- */
 219 /*** public functions ****************************************************************************/
 220 /* --------------------------------------------------------------------------------------------- */
 221 
 222 void
 223 tty_init (gboolean mouse_enable, gboolean is_xterm)
     /* [previous][next][first][last][top][bottom][index][help]  */
 224 {
 225     SLtt_Ignore_Beep = 1;
 226 
 227     SLutf8_enable (-1);  // has to be called first before any of the other functions.
 228     SLtt_get_terminfo ();
 229     /*
 230      * If the terminal in not in terminfo but begins with a well-known
 231      * string such as "linux" or "xterm" S-Lang will go on, but the
 232      * terminal size and several other variables won't be initialized
 233      * (as of S-Lang 1.4.4). Detect it and abort. Also detect extremely
 234      * small screen dimensions.
 235      */
 236     if ((COLS < 10)
 237         || (LINES < 5)
 238 #if SLANG_VERSION < 20303
 239         /* Beginning from pre2.3.3-8 (55f58798c267d76a1b93d0d916027b71a10ac1ee),
 240            these limitations were eliminated. */
 241         || (COLS > SLTT_MAX_SCREEN_COLS) || (LINES > SLTT_MAX_SCREEN_ROWS)
 242 #endif
 243     )
 244     {
 245         fprintf (stderr,
 246                  _ ("Screen size %dx%d is not supported.\n"
 247                     "Check the TERM environment variable.\n"),
 248                  COLS, LINES);
 249         exit (EXIT_FAILURE);
 250     }
 251 
 252     tcgetattr (fileno (stdin), &boot_mode);
 253     // 255 = ignore abort char; XCTRL('g') for abort char = ^g
 254     SLang_init_tty (XCTRL ('g'), 1, 0);
 255 
 256     if (mc_global.tty.ugly_line_drawing)
 257         SLtt_Has_Alt_Charset = 0;
 258 
 259     tcgetattr (SLang_TT_Read_FD, &new_mode);
 260 
 261     tty_reset_prog_mode ();
 262     load_terminfo_keys ();
 263 
 264     SLtt_Blink_Mode = (tty_use_256colors (NULL) || tty_use_truecolors (NULL)) ? 1 : 0;
 265 
 266     tty_start_interrupt_key ();
 267 
 268     // It's the small part from the previous init_key()
 269     init_key_input_fd ();
 270 
 271     /* For 8-bit locales, NCurses handles 154 (0x9A) symbol properly, while S-Lang
 272      * requires SLsmg_Display_Eight_Bit >= 154 (OR manual filtering if xterm display
 273      * detected - but checking TERM would fail under screen, OR running xterm
 274      * with allowC1Printable).
 275      */
 276     tty_display_8bit (FALSE);
 277 
 278     SLsmg_init_smg ();
 279     slsmg_active = TRUE;
 280     if (!mouse_enable)
 281         use_mouse_p = MOUSE_DISABLED;
 282     tty_init_xterm_support (is_xterm);  // do it before tty_enter_ca_mode() call
 283     tty_enter_ca_mode ();
 284     tty_keypad (TRUE);
 285     tty_nodelay (FALSE);
 286 
 287     tty_setup_sigwinch (sigwinch_handler);
 288 }
 289 
 290 /* --------------------------------------------------------------------------------------------- */
 291 
 292 void
 293 tty_shutdown (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 294 {
 295     char *op_cap;
 296 
 297     tty_destroy_winch_pipe ();
 298     tty_reset_shell_mode ();
 299     tty_noraw_mode ();
 300     tty_keypad (FALSE);
 301     tty_reset_screen ();
 302     tty_exit_ca_mode ();
 303     SLang_reset_tty ();
 304     slsmg_active = FALSE;
 305 
 306     /* Load the op capability to reset the colors to those that were
 307      * active when the program was started up
 308      */
 309     op_cap = SLtt_tgetstr ((SLFUTURE_CONST char *) "op");
 310     if (op_cap != NULL)
 311     {
 312         fputs (op_cap, stdout);
 313         fflush (stdout);
 314     }
 315 }
 316 
 317 /* --------------------------------------------------------------------------------------------- */
 318 
 319 void
 320 tty_enter_ca_mode (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 321 {
 322     // S-Lang handles alternate screen switching and cursor position saving
 323 }
 324 
 325 /* --------------------------------------------------------------------------------------------- */
 326 
 327 void
 328 tty_exit_ca_mode (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 329 {
 330     // S-Lang handles alternate screen switching and cursor position restoring
 331 }
 332 
 333 /* --------------------------------------------------------------------------------------------- */
 334 
 335 void
 336 tty_change_screen_size (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 337 {
 338     SLtt_get_screen_size ();
 339     if (slsmg_active)
 340         SLsmg_reinit_smg ();
 341 
 342 #ifdef ENABLE_SUBSHELL
 343     if (mc_global.tty.use_subshell)
 344         tty_resize (mc_global.tty.subshell_pty);
 345 #endif
 346 }
 347 
 348 /* --------------------------------------------------------------------------------------------- */
 349 /* Done each time we come back from done mode */
 350 
 351 void
 352 tty_reset_prog_mode (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 353 {
 354     tcsetattr (SLang_TT_Read_FD, TCSANOW, &new_mode);
 355     SLsmg_init_smg ();
 356     slsmg_active = TRUE;
 357     SLsmg_touch_lines (0, LINES);
 358 }
 359 
 360 /* --------------------------------------------------------------------------------------------- */
 361 /* Called each time we want to shutdown slang screen manager */
 362 
 363 void
 364 tty_reset_shell_mode (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 365 {
 366     tcsetattr (SLang_TT_Read_FD, TCSANOW, &boot_mode);
 367 }
 368 
 369 /* --------------------------------------------------------------------------------------------- */
 370 
 371 void
 372 tty_raw_mode (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 373 {
 374     tcsetattr (SLang_TT_Read_FD, TCSANOW, &new_mode);
 375 }
 376 
 377 /* --------------------------------------------------------------------------------------------- */
 378 
 379 void
 380 tty_noraw_mode (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 381 {
 382 }
 383 
 384 /* --------------------------------------------------------------------------------------------- */
 385 
 386 void
 387 tty_noecho (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 388 {
 389 }
 390 
 391 /* --------------------------------------------------------------------------------------------- */
 392 
 393 int
 394 tty_flush_input (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 395 {
 396     return 0;  // OK
 397 }
 398 
 399 /* --------------------------------------------------------------------------------------------- */
 400 
 401 void
 402 tty_keypad (gboolean set)
     /* [previous][next][first][last][top][bottom][index][help]  */
 403 {
 404     char *keypad_string;
 405 
 406     keypad_string = SLtt_tgetstr ((SLFUTURE_CONST char *) (set ? "ks" : "ke"));
 407 
 408     if (keypad_string != NULL)
 409         SLtt_write_string (keypad_string);
 410 }
 411 
 412 /* --------------------------------------------------------------------------------------------- */
 413 
 414 void
 415 tty_nodelay (gboolean set)
     /* [previous][next][first][last][top][bottom][index][help]  */
 416 {
 417     no_slang_delay = set;
 418 }
 419 
 420 /* --------------------------------------------------------------------------------------------- */
 421 
 422 int
 423 tty_baudrate (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 424 {
 425     return SLang_TT_Baud_Rate;
 426 }
 427 
 428 /* --------------------------------------------------------------------------------------------- */
 429 
 430 int
 431 tty_lowlevel_getch (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 432 {
 433     int c;
 434 
 435     if (no_slang_delay && (SLang_input_pending (0) == 0))
 436         return -1;
 437 
 438     c = SLang_getkey ();
 439     if (c == SLANG_GETKEY_ERROR)
 440     {
 441         fprintf (stderr,
 442                  "SLang_getkey returned SLANG_GETKEY_ERROR\n"
 443                  "Assuming EOF on stdin and exiting\n");
 444         exit (EXIT_FAILURE);
 445     }
 446 
 447     return c;
 448 }
 449 
 450 /* --------------------------------------------------------------------------------------------- */
 451 
 452 int
 453 tty_reset_screen (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 454 {
 455     SLsmg_reset_smg ();
 456     slsmg_active = FALSE;
 457     return 0;  // OK
 458 }
 459 
 460 /* --------------------------------------------------------------------------------------------- */
 461 
 462 void
 463 tty_touch_screen (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 464 {
 465     SLsmg_touch_lines (0, LINES);
 466 }
 467 
 468 /* --------------------------------------------------------------------------------------------- */
 469 
 470 void
 471 tty_gotoyx (int y, int x)
     /* [previous][next][first][last][top][bottom][index][help]  */
 472 {
 473     SLsmg_gotorc (y, x);
 474 }
 475 
 476 /* --------------------------------------------------------------------------------------------- */
 477 
 478 void
 479 tty_getyx (int *py, int *px)
     /* [previous][next][first][last][top][bottom][index][help]  */
 480 {
 481     *py = SLsmg_get_row ();
 482     *px = SLsmg_get_column ();
 483 }
 484 
 485 /* --------------------------------------------------------------------------------------------- */
 486 
 487 void
 488 tty_draw_hline (int y, int x, mc_tty_char_t ch, int len)
     /* [previous][next][first][last][top][bottom][index][help]  */
 489 {
 490     int x1;
 491 
 492     if (y < 0 || y >= LINES || x >= COLS)
 493         return;
 494 
 495     x1 = x;
 496 
 497     if (x < 0)
 498     {
 499         len += x;
 500         if (len <= 0)
 501             return;
 502         x = 0;
 503     }
 504 
 505     SLsmg_gotorc (y, x);
 506 
 507     if ((mc_global.utf8_display && ch == 0x2500) || ch == MC_ACS_HLINE)
 508         SLsmg_draw_hline (len);
 509     else
 510         while (len-- != 0)
 511             tty_print_char (ch);
 512 
 513     SLsmg_gotorc (y, x1);
 514 }
 515 
 516 /* --------------------------------------------------------------------------------------------- */
 517 
 518 void
 519 tty_draw_vline (int y, int x, mc_tty_char_t ch, int len)
     /* [previous][next][first][last][top][bottom][index][help]  */
 520 {
 521     int y1;
 522 
 523     if (x < 0 || x >= COLS || y >= LINES)
 524         return;
 525 
 526     y1 = y;
 527 
 528     if (y < 0)
 529     {
 530         len += y;
 531         if (len <= 0)
 532             return;
 533         y = 0;
 534     }
 535 
 536     SLsmg_gotorc (y, x);
 537 
 538     if ((mc_global.utf8_display && ch == 0x2502) || ch == MC_ACS_VLINE)
 539         SLsmg_draw_vline (len);
 540     else
 541     {
 542         int pos = 0;
 543 
 544         while (len-- != 0)
 545         {
 546             SLsmg_gotorc (y + pos, x);
 547             tty_print_char (ch);
 548             pos++;
 549         }
 550     }
 551 
 552     SLsmg_gotorc (y1, x);
 553 }
 554 
 555 /* --------------------------------------------------------------------------------------------- */
 556 
 557 void
 558 tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
     /* [previous][next][first][last][top][bottom][index][help]  */
 559 {
 560     SLsmg_fill_region (y, x, rows, cols, ch);
 561 }
 562 
 563 /* --------------------------------------------------------------------------------------------- */
 564 
 565 void
 566 tty_colorize_area (int y, int x, int rows, int cols, int color)
     /* [previous][next][first][last][top][bottom][index][help]  */
 567 {
 568     if (use_colors)
 569         SLsmg_set_color_in_region (color, y, x, rows, cols);
 570 }
 571 
 572 /* --------------------------------------------------------------------------------------------- */
 573 
 574 void
 575 tty_display_8bit (gboolean what)
     /* [previous][next][first][last][top][bottom][index][help]  */
 576 {
 577     SLsmg_Display_Eight_Bit = what ? 128 : 160;
 578 }
 579 
 580 /* --------------------------------------------------------------------------------------------- */
 581 
 582 void
 583 tty_print_char (mc_tty_char_t c)
     /* [previous][next][first][last][top][bottom][index][help]  */
 584 {
 585     gboolean alt_char = FALSE;
 586     int char_maybe_acs = c;
 587 
 588     if (!mc_global.utf8_display)
 589         char_maybe_acs = get_maybe_acs (char_maybe_acs, &alt_char);
 590 
 591     if (alt_char)
 592         SLsmg_draw_object (SLsmg_get_row (), SLsmg_get_column (), char_maybe_acs);
 593     else
 594         SLsmg_write_char ((SLwchar_Type) ((unsigned int) char_maybe_acs));
 595 }
 596 
 597 /* --------------------------------------------------------------------------------------------- */
 598 
 599 void
 600 tty_print_anychar (mc_tty_char_t c)
     /* [previous][next][first][last][top][bottom][index][help]  */
 601 {
 602     if (c > 255)
 603     {
 604         char str[MB_LEN_MAX + 1];
 605         int res;
 606 
 607         res = g_unichar_to_utf8 (c, str);
 608         if (res == 0)
 609         {
 610             str[0] = '.';
 611             str[1] = '\0';
 612         }
 613         else
 614         {
 615             str[res] = '\0';
 616         }
 617         SLsmg_write_string ((char *) str_term_form (str));
 618     }
 619     else
 620     {
 621         if (!is_printable (c))
 622             c = '.';
 623         SLsmg_write_char ((SLwchar_Type) ((unsigned int) c));
 624     }
 625 }
 626 
 627 /* --------------------------------------------------------------------------------------------- */
 628 
 629 void
 630 tty_print_string (const char *s)
     /* [previous][next][first][last][top][bottom][index][help]  */
 631 {
 632     SLsmg_write_string ((char *) str_term_form (s));
 633 }
 634 
 635 /* --------------------------------------------------------------------------------------------- */
 636 
 637 void
 638 tty_printf (const char *fmt, ...)
     /* [previous][next][first][last][top][bottom][index][help]  */
 639 {
 640     va_list args;
 641 
 642     va_start (args, fmt);
 643     SLsmg_vprintf ((char *) fmt, args);
 644     va_end (args);
 645 }
 646 
 647 /* --------------------------------------------------------------------------------------------- */
 648 
 649 /* Although S-Lang uses the terminfo database by default (through its own parser), it expects
 650  * termcap codes to access standard capabilities. Nevertheless, it can also access extended
 651  * terminfo capabilities (including those that have no termcap equivalent, i.e., whose names
 652  * are longer than two characters).
 653  */
 654 
 655 /* --------------------------------------------------------------------------------------------- */
 656 
 657 int
 658 tty_tigetflag (const char *terminfo_cap, const char *termcap_cap)
     /* [previous][next][first][last][top][bottom][index][help]  */
 659 {
 660     return SLtt_tgetflag ((SLFUTURE_CONST char *) (termcap_cap ? termcap_cap : terminfo_cap));
 661 }
 662 
 663 /* --------------------------------------------------------------------------------------------- */
 664 
 665 int
 666 tty_tigetnum (const char *terminfo_cap, const char *termcap_cap)
     /* [previous][next][first][last][top][bottom][index][help]  */
 667 {
 668     return SLtt_tgetnum ((SLFUTURE_CONST char *) (termcap_cap ? termcap_cap : terminfo_cap));
 669 }
 670 
 671 /* --------------------------------------------------------------------------------------------- */
 672 
 673 char *
 674 tty_tigetstr (const char *terminfo_cap, const char *termcap_cap)
     /* [previous][next][first][last][top][bottom][index][help]  */
 675 {
 676     return SLtt_tgetstr ((SLFUTURE_CONST char *) (termcap_cap ? termcap_cap : terminfo_cap));
 677 }
 678 
 679 /* --------------------------------------------------------------------------------------------- */
 680 
 681 void
 682 tty_refresh (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 683 {
 684     SLsmg_refresh ();
 685 }
 686 
 687 /* --------------------------------------------------------------------------------------------- */
 688 
 689 void
 690 tty_beep (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 691 {
 692     SLtt_beep ();
 693 }
 694 
 695 /* --------------------------------------------------------------------------------------------- */

/* [previous][next][first][last][top][bottom][index][help]  */