tty-slang.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. /*
  2. Interface to the terminal controlling library.
  3. Slang wrapper.
  4. Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
  5. Written by:
  6. Andrew Borodin <aborodin@vmail.ru>, 2009
  7. Egmont Koblinger <egmont@gmail.com>, 2010
  8. This file is part of the Midnight Commander.
  9. The Midnight Commander is free software; you can redistribute it
  10. and/or modify it under the terms of the GNU General Public License as
  11. published by the Free Software Foundation; either version 2 of the
  12. License, or (at your option) any later version.
  13. The Midnight Commander is distributed in the hope that it will be
  14. useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  15. of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. General Public License for more details.
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  20. MA 02110-1301, USA.
  21. */
  22. /** \file
  23. * \brief Source: S-Lang-based tty layer of Midnight Commander
  24. */
  25. #include <config.h>
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28. #include <string.h>
  29. #include <termios.h>
  30. #include <sys/types.h> /* size_t */
  31. #include <unistd.h>
  32. #include <signal.h>
  33. #include "lib/global.h"
  34. #include "lib/strutil.h" /* str_term_form */
  35. #include "lib/util.h" /* is_printable() */
  36. #include "tty-internal.h" /* mc_tty_normalize_from_utf8() */
  37. #include "tty.h"
  38. #include "color.h"
  39. #include "color-slang.h"
  40. #include "color-internal.h"
  41. #include "mouse.h" /* Gpm_Event is required in key.h */
  42. #include "key.h" /* define_sequence */
  43. #include "win.h"
  44. /*** global variables ****************************************************************************/
  45. extern int reset_hp_softkeys;
  46. /*** file scope macro definitions ****************************************************************/
  47. #ifndef SA_RESTART
  48. #define SA_RESTART 0
  49. #endif
  50. #ifndef SLTT_MAX_SCREEN_COLS
  51. #define SLTT_MAX_SCREEN_COLS 512
  52. #endif
  53. #ifndef SLTT_MAX_SCREEN_ROWS
  54. #define SLTT_MAX_SCREEN_ROWS 512
  55. #endif
  56. /*** file scope type declarations ****************************************************************/
  57. /*** file scope variables ************************************************************************/
  58. /* Various saved termios settings that we control here */
  59. static struct termios boot_mode;
  60. static struct termios new_mode;
  61. /* Controls whether we should wait for input in tty_lowlevel_getch */
  62. static gboolean no_slang_delay;
  63. /* This table describes which capabilities we want and which values we
  64. * assign to them.
  65. */
  66. static const struct
  67. {
  68. int key_code;
  69. const char *key_name;
  70. } key_table[] =
  71. {
  72. /* *INDENT-OFF* */
  73. { KEY_F (0), "k0" },
  74. { KEY_F (1), "k1" },
  75. { KEY_F (2), "k2" },
  76. { KEY_F (3), "k3" },
  77. { KEY_F (4), "k4" },
  78. { KEY_F (5), "k5" },
  79. { KEY_F (6), "k6" },
  80. { KEY_F (7), "k7" },
  81. { KEY_F (8), "k8" },
  82. { KEY_F (9), "k9" },
  83. { KEY_F (10), "k;" },
  84. { KEY_F (11), "F1" },
  85. { KEY_F (12), "F2" },
  86. { KEY_F (13), "F3" },
  87. { KEY_F (14), "F4" },
  88. { KEY_F (15), "F5" },
  89. { KEY_F (16), "F6" },
  90. { KEY_F (17), "F7" },
  91. { KEY_F (18), "F8" },
  92. { KEY_F (19), "F9" },
  93. { KEY_F (20), "FA" },
  94. { KEY_IC, "kI" },
  95. { KEY_NPAGE, "kN" },
  96. { KEY_PPAGE, "kP" },
  97. { KEY_LEFT, "kl" },
  98. { KEY_RIGHT, "kr" },
  99. { KEY_UP, "ku" },
  100. { KEY_DOWN, "kd" },
  101. { KEY_DC, "kD" },
  102. { KEY_BACKSPACE, "kb" },
  103. { KEY_HOME, "kh" },
  104. { KEY_END, "@7" },
  105. { 0, NULL }
  106. /* *INDENT-ON* */
  107. };
  108. /*** file scope functions ************************************************************************/
  109. /* --------------------------------------------------------------------------------------------- */
  110. static void
  111. tty_setup_sigwinch (void (*handler) (int))
  112. {
  113. #ifdef SIGWINCH
  114. struct sigaction act, oact;
  115. act.sa_handler = handler;
  116. sigemptyset (&act.sa_mask);
  117. act.sa_flags = 0;
  118. #ifdef SA_RESTART
  119. act.sa_flags |= SA_RESTART;
  120. #endif /* SA_RESTART */
  121. sigaction (SIGWINCH, &act, &oact);
  122. #endif /* SIGWINCH */
  123. }
  124. /* --------------------------------------------------------------------------------------------- */
  125. static void
  126. sigwinch_handler (int dummy)
  127. {
  128. (void) dummy;
  129. tty_change_screen_size ();
  130. mc_global.tty.winch_flag = TRUE;
  131. }
  132. /* --------------------------------------------------------------------------------------------- */
  133. /* HP Terminals have capabilities (pfkey, pfloc, pfx) to program function keys.
  134. elm 2.4pl15 invoked with the -K option utilizes these softkeys and the
  135. consequence is that function keys don't work in MC sometimes...
  136. Unfortunately I don't now the one and only escape sequence to turn off.
  137. softkeys (elm uses three different capabilities to turn on softkeys and two.
  138. capabilities to turn them off)..
  139. Among other things elm uses the pair we already use in slang_keypad. That's.
  140. the reason why I call slang_reset_softkeys from slang_keypad. In lack of
  141. something better the softkeys are programmed to their defaults from the
  142. termcap/terminfo database.
  143. The escape sequence to program the softkeys is taken from elm and it is.
  144. hardcoded because neither slang nor ncurses 4.1 know how to 'printf' this.
  145. sequence. -- Norbert
  146. */
  147. static void
  148. slang_reset_softkeys (void)
  149. {
  150. int key;
  151. char *send;
  152. static const char display[] = " ";
  153. char tmp[BUF_SMALL];
  154. for (key = 1; key < 9; key++)
  155. {
  156. g_snprintf (tmp, sizeof (tmp), "k%d", key);
  157. send = (char *) SLtt_tgetstr (tmp);
  158. if (send != NULL)
  159. {
  160. g_snprintf (tmp, sizeof (tmp), ESC_STR "&f%dk%dd%dL%s%s", key,
  161. (int) (sizeof (display) - 1), (int) strlen (send), display, send);
  162. SLtt_write_string (tmp);
  163. }
  164. }
  165. }
  166. /* --------------------------------------------------------------------------------------------- */
  167. static void
  168. do_define_key (int code, const char *strcap)
  169. {
  170. char *seq;
  171. seq = (char *) SLtt_tgetstr ((char *) strcap);
  172. if (seq != NULL)
  173. define_sequence (code, seq, MCKEY_NOACTION);
  174. }
  175. /* --------------------------------------------------------------------------------------------- */
  176. static void
  177. load_terminfo_keys (void)
  178. {
  179. int i;
  180. for (i = 0; key_table[i].key_code; i++)
  181. do_define_key (key_table[i].key_code, key_table[i].key_name);
  182. }
  183. /* --------------------------------------------------------------------------------------------- */
  184. /*** public functions ****************************************************************************/
  185. /* --------------------------------------------------------------------------------------------- */
  186. int
  187. mc_tty_normalize_lines_char (const char *str)
  188. {
  189. char *str2;
  190. int res;
  191. struct mc_tty_lines_struct
  192. {
  193. const char *line;
  194. int line_code;
  195. } const lines_codes[] = {
  196. {"\342\224\214", SLSMG_ULCORN_CHAR},
  197. {"\342\224\220", SLSMG_URCORN_CHAR},
  198. {"\342\224\224", SLSMG_LLCORN_CHAR},
  199. {"\342\224\230", SLSMG_LRCORN_CHAR},
  200. {"\342\224\234", SLSMG_LTEE_CHAR},
  201. {"\342\224\244", SLSMG_RTEE_CHAR},
  202. {"\342\224\254", SLSMG_UTEE_CHAR},
  203. {"\342\224\264", SLSMG_DTEE_CHAR},
  204. {"\342\224\200", SLSMG_HLINE_CHAR},
  205. {"\342\224\202", SLSMG_VLINE_CHAR},
  206. {"\342\224\274", SLSMG_PLUS_CHAR},
  207. {NULL, 0}
  208. };
  209. if (!str)
  210. return (int) ' ';
  211. for (res = 0; lines_codes[res].line; res++)
  212. {
  213. if (strcmp (str, lines_codes[res].line) == 0)
  214. return lines_codes[res].line_code;
  215. }
  216. str2 = mc_tty_normalize_from_utf8 (str);
  217. res = g_utf8_get_char_validated (str2, -1);
  218. if (res < 0)
  219. res = (unsigned char) str2[0];
  220. g_free (str2);
  221. return res;
  222. }
  223. /* --------------------------------------------------------------------------------------------- */
  224. void
  225. tty_init (gboolean mouse_enable, gboolean is_xterm)
  226. {
  227. SLtt_Ignore_Beep = 1;
  228. SLutf8_enable (-1); /* has to be called first before any of the other functions. */
  229. SLtt_get_terminfo ();
  230. /*
  231. * If the terminal in not in terminfo but begins with a well-known
  232. * string such as "linux" or "xterm" S-Lang will go on, but the
  233. * terminal size and several other variables won't be initialized
  234. * (as of S-Lang 1.4.4). Detect it and abort. Also detect extremely
  235. * small, large and negative screen dimensions.
  236. */
  237. if ((COLS < 10) || (LINES < 5)
  238. || (COLS > SLTT_MAX_SCREEN_COLS) || (LINES > SLTT_MAX_SCREEN_ROWS))
  239. {
  240. fprintf (stderr,
  241. _("Screen size %dx%d is not supported.\n"
  242. "Check the TERM environment variable.\n"), COLS, LINES);
  243. exit (EXIT_FAILURE);
  244. }
  245. tcgetattr (fileno (stdin), &boot_mode);
  246. /* 255 = ignore abort char; XCTRL('g') for abort char = ^g */
  247. SLang_init_tty (XCTRL ('g'), 1, 0);
  248. if (mc_global.tty.ugly_line_drawing)
  249. SLtt_Has_Alt_Charset = 0;
  250. /* If SLang uses fileno(stderr) for terminal input MC will hang
  251. if we call SLang_getkey between calls to open_error_pipe and
  252. close_error_pipe, e.g. when we do a growing view of an gzipped
  253. file. */
  254. if (SLang_TT_Read_FD == fileno (stderr))
  255. SLang_TT_Read_FD = fileno (stdin);
  256. if (tcgetattr (SLang_TT_Read_FD, &new_mode) == 0)
  257. {
  258. #ifdef VDSUSP
  259. new_mode.c_cc[VDSUSP] = NULL_VALUE; /* to ignore ^Y */
  260. #endif
  261. #ifdef VLNEXT
  262. new_mode.c_cc[VLNEXT] = NULL_VALUE; /* to ignore ^V */
  263. #endif
  264. tcsetattr (SLang_TT_Read_FD, TCSADRAIN, &new_mode);
  265. }
  266. tty_reset_prog_mode ();
  267. load_terminfo_keys ();
  268. SLtt_Blink_Mode = tty_use_256colors ()? 1 : 0;
  269. tty_start_interrupt_key ();
  270. /* It's the small part from the previous init_key() */
  271. init_key_input_fd ();
  272. /* For 8-bit locales, NCurses handles 154 (0x9A) symbol properly, while S-Lang
  273. * requires SLsmg_Display_Eight_Bit >= 154 (OR manual filtering if xterm display
  274. * detected - but checking TERM would fail under screen, OR running xterm
  275. * with allowC1Printable).
  276. */
  277. tty_display_8bit (FALSE);
  278. SLsmg_init_smg ();
  279. if (!mouse_enable)
  280. use_mouse_p = MOUSE_DISABLED;
  281. tty_init_xterm_support (is_xterm); /* do it before do_enter_ca_mode() call */
  282. init_mouse ();
  283. do_enter_ca_mode ();
  284. tty_keypad (TRUE);
  285. tty_nodelay (FALSE);
  286. tty_setup_sigwinch (sigwinch_handler);
  287. }
  288. /* --------------------------------------------------------------------------------------------- */
  289. void
  290. tty_shutdown (void)
  291. {
  292. char *op_cap;
  293. disable_mouse ();
  294. tty_reset_shell_mode ();
  295. tty_noraw_mode ();
  296. tty_keypad (FALSE);
  297. tty_reset_screen ();
  298. do_exit_ca_mode ();
  299. SLang_reset_tty ();
  300. /* Load the op capability to reset the colors to those that were
  301. * active when the program was started up
  302. */
  303. op_cap = SLtt_tgetstr ((char *) "op");
  304. if (op_cap != NULL)
  305. {
  306. fputs (op_cap, stdout);
  307. fflush (stdout);
  308. }
  309. }
  310. /* --------------------------------------------------------------------------------------------- */
  311. /* Done each time we come back from done mode */
  312. void
  313. tty_reset_prog_mode (void)
  314. {
  315. tcsetattr (SLang_TT_Read_FD, TCSANOW, &new_mode);
  316. SLsmg_init_smg ();
  317. SLsmg_touch_lines (0, LINES);
  318. }
  319. /* --------------------------------------------------------------------------------------------- */
  320. /* Called each time we want to shutdown slang screen manager */
  321. void
  322. tty_reset_shell_mode (void)
  323. {
  324. tcsetattr (SLang_TT_Read_FD, TCSANOW, &boot_mode);
  325. }
  326. /* --------------------------------------------------------------------------------------------- */
  327. void
  328. tty_raw_mode (void)
  329. {
  330. tcsetattr (SLang_TT_Read_FD, TCSANOW, &new_mode);
  331. }
  332. /* --------------------------------------------------------------------------------------------- */
  333. void
  334. tty_noraw_mode (void)
  335. {
  336. }
  337. /* --------------------------------------------------------------------------------------------- */
  338. void
  339. tty_noecho (void)
  340. {
  341. }
  342. /* --------------------------------------------------------------------------------------------- */
  343. int
  344. tty_flush_input (void)
  345. {
  346. return 0; /* OK */
  347. }
  348. /* --------------------------------------------------------------------------------------------- */
  349. void
  350. tty_keypad (gboolean set)
  351. {
  352. char *keypad_string;
  353. keypad_string = (char *) SLtt_tgetstr ((char *) (set ? "ks" : "ke"));
  354. if (keypad_string != NULL)
  355. SLtt_write_string (keypad_string);
  356. if (set && reset_hp_softkeys)
  357. slang_reset_softkeys ();
  358. }
  359. /* --------------------------------------------------------------------------------------------- */
  360. void
  361. tty_nodelay (gboolean set)
  362. {
  363. no_slang_delay = set;
  364. }
  365. /* --------------------------------------------------------------------------------------------- */
  366. int
  367. tty_baudrate (void)
  368. {
  369. return SLang_TT_Baud_Rate;
  370. }
  371. /* --------------------------------------------------------------------------------------------- */
  372. int
  373. tty_lowlevel_getch (void)
  374. {
  375. int c;
  376. if (no_slang_delay && (SLang_input_pending (0) == 0))
  377. return -1;
  378. c = SLang_getkey ();
  379. if (c == SLANG_GETKEY_ERROR)
  380. {
  381. fprintf (stderr,
  382. "SLang_getkey returned SLANG_GETKEY_ERROR\n"
  383. "Assuming EOF on stdin and exiting\n");
  384. exit (EXIT_FAILURE);
  385. }
  386. return c;
  387. }
  388. /* --------------------------------------------------------------------------------------------- */
  389. int
  390. tty_reset_screen (void)
  391. {
  392. SLsmg_reset_smg ();
  393. return 0; /* OK */
  394. }
  395. /* --------------------------------------------------------------------------------------------- */
  396. void
  397. tty_touch_screen (void)
  398. {
  399. SLsmg_touch_lines (0, LINES);
  400. }
  401. /* --------------------------------------------------------------------------------------------- */
  402. void
  403. tty_gotoyx (int y, int x)
  404. {
  405. SLsmg_gotorc (y, x);
  406. }
  407. /* --------------------------------------------------------------------------------------------- */
  408. void
  409. tty_getyx (int *py, int *px)
  410. {
  411. *py = SLsmg_get_row ();
  412. *px = SLsmg_get_column ();
  413. }
  414. /* --------------------------------------------------------------------------------------------- */
  415. /* if x < 0 or y < 0, draw line staring from current position */
  416. void
  417. tty_draw_hline (int y, int x, int ch, int len)
  418. {
  419. if (ch == ACS_HLINE)
  420. ch = mc_tty_frm[MC_TTY_FRM_HORIZ];
  421. if ((y < 0) || (x < 0))
  422. {
  423. y = SLsmg_get_row ();
  424. x = SLsmg_get_column ();
  425. }
  426. else
  427. SLsmg_gotorc (y, x);
  428. if (ch == 0)
  429. ch = ACS_HLINE;
  430. if (ch == ACS_HLINE)
  431. SLsmg_draw_hline (len);
  432. else
  433. while (len-- != 0)
  434. tty_print_char (ch);
  435. SLsmg_gotorc (y, x);
  436. }
  437. /* --------------------------------------------------------------------------------------------- */
  438. /* if x < 0 or y < 0, draw line staring from current position */
  439. void
  440. tty_draw_vline (int y, int x, int ch, int len)
  441. {
  442. if (ch == ACS_VLINE)
  443. ch = mc_tty_frm[MC_TTY_FRM_VERT];
  444. if ((y < 0) || (x < 0))
  445. {
  446. y = SLsmg_get_row ();
  447. x = SLsmg_get_column ();
  448. }
  449. else
  450. SLsmg_gotorc (y, x);
  451. if (ch == 0)
  452. ch = ACS_VLINE;
  453. if (ch == ACS_VLINE)
  454. SLsmg_draw_vline (len);
  455. else
  456. {
  457. int pos = 0;
  458. while (len-- != 0)
  459. {
  460. SLsmg_gotorc (y + pos, x);
  461. tty_print_char (ch);
  462. pos++;
  463. }
  464. }
  465. SLsmg_gotorc (y, x);
  466. }
  467. /* --------------------------------------------------------------------------------------------- */
  468. void
  469. tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
  470. {
  471. SLsmg_fill_region (y, x, rows, cols, ch);
  472. }
  473. /* --------------------------------------------------------------------------------------------- */
  474. void
  475. tty_set_alt_charset (gboolean alt_charset)
  476. {
  477. SLsmg_set_char_set ((int) alt_charset);
  478. }
  479. /* --------------------------------------------------------------------------------------------- */
  480. void
  481. tty_display_8bit (gboolean what)
  482. {
  483. SLsmg_Display_Eight_Bit = what ? 128 : 160;
  484. }
  485. /* --------------------------------------------------------------------------------------------- */
  486. void
  487. tty_print_char (int c)
  488. {
  489. SLsmg_write_char ((SLwchar_Type) ((unsigned int) c));
  490. }
  491. /* --------------------------------------------------------------------------------------------- */
  492. void
  493. tty_print_alt_char (int c, gboolean single)
  494. {
  495. #define DRAW(x, y) (x == y) \
  496. ? SLsmg_draw_object (SLsmg_get_row(), SLsmg_get_column(), x) \
  497. : SLsmg_write_char ((unsigned int) y)
  498. switch (c)
  499. {
  500. case ACS_VLINE:
  501. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_VERT : MC_TTY_FRM_DVERT]);
  502. break;
  503. case ACS_HLINE:
  504. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ]);
  505. break;
  506. case ACS_LTEE:
  507. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_LEFTMIDDLE : MC_TTY_FRM_DLEFTMIDDLE]);
  508. break;
  509. case ACS_RTEE:
  510. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_RIGHTMIDDLE : MC_TTY_FRM_DRIGHTMIDDLE]);
  511. break;
  512. case ACS_ULCORNER:
  513. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_LEFTTOP : MC_TTY_FRM_DLEFTTOP]);
  514. break;
  515. case ACS_LLCORNER:
  516. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_LEFTBOTTOM : MC_TTY_FRM_DLEFTBOTTOM]);
  517. break;
  518. case ACS_URCORNER:
  519. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_RIGHTTOP : MC_TTY_FRM_DRIGHTTOP]);
  520. break;
  521. case ACS_LRCORNER:
  522. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_RIGHTBOTTOM : MC_TTY_FRM_DRIGHTBOTTOM]);
  523. break;
  524. case ACS_PLUS:
  525. DRAW (c, mc_tty_frm[MC_TTY_FRM_CROSS]);
  526. break;
  527. default:
  528. SLsmg_write_char ((unsigned int) c);
  529. }
  530. #undef DRAW
  531. }
  532. /* --------------------------------------------------------------------------------------------- */
  533. void
  534. tty_print_anychar (int c)
  535. {
  536. char str[6 + 1];
  537. if (c > 255)
  538. {
  539. int res = g_unichar_to_utf8 (c, str);
  540. if (res == 0)
  541. {
  542. str[0] = '.';
  543. str[1] = '\0';
  544. }
  545. else
  546. {
  547. str[res] = '\0';
  548. }
  549. SLsmg_write_string ((char *) str_term_form (str));
  550. }
  551. else
  552. {
  553. if (!is_printable (c))
  554. c = '.';
  555. SLsmg_write_char ((SLwchar_Type) ((unsigned int) c));
  556. }
  557. }
  558. /* --------------------------------------------------------------------------------------------- */
  559. void
  560. tty_print_string (const char *s)
  561. {
  562. SLsmg_write_string ((char *) str_term_form (s));
  563. }
  564. /* --------------------------------------------------------------------------------------------- */
  565. void
  566. tty_printf (const char *fmt, ...)
  567. {
  568. va_list args;
  569. va_start (args, fmt);
  570. SLsmg_vprintf ((char *) fmt, args);
  571. va_end (args);
  572. }
  573. /* --------------------------------------------------------------------------------------------- */
  574. char *
  575. tty_tgetstr (const char *cap)
  576. {
  577. return SLtt_tgetstr ((char *) cap);
  578. }
  579. /* --------------------------------------------------------------------------------------------- */
  580. void
  581. tty_refresh (void)
  582. {
  583. SLsmg_refresh ();
  584. }
  585. /* --------------------------------------------------------------------------------------------- */
  586. void
  587. tty_beep (void)
  588. {
  589. SLtt_beep ();
  590. }
  591. /* --------------------------------------------------------------------------------------------- */