tty-slang.c 19 KB

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