tty-slang.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  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. clock_init ();
  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. void
  416. tty_draw_hline (int y, int x, int ch, int len)
  417. {
  418. int x1;
  419. if (y < 0 || y >= LINES || x >= COLS)
  420. return;
  421. x1 = x;
  422. if (x < 0)
  423. {
  424. len += x;
  425. if (len <= 0)
  426. return;
  427. x = 0;
  428. }
  429. if (ch == ACS_HLINE)
  430. ch = mc_tty_frm[MC_TTY_FRM_HORIZ];
  431. if (ch == 0)
  432. ch = ACS_HLINE;
  433. SLsmg_gotorc (y, x);
  434. if (ch == ACS_HLINE)
  435. SLsmg_draw_hline (len);
  436. else
  437. while (len-- != 0)
  438. tty_print_char (ch);
  439. SLsmg_gotorc (y, x1);
  440. }
  441. /* --------------------------------------------------------------------------------------------- */
  442. void
  443. tty_draw_vline (int y, int x, int ch, int len)
  444. {
  445. int y1;
  446. if (x < 0 || x >= COLS || y >= LINES)
  447. return;
  448. y1 = y;
  449. if (y < 0)
  450. {
  451. len += y;
  452. if (len <= 0)
  453. return;
  454. y = 0;
  455. }
  456. if (ch == ACS_VLINE)
  457. ch = mc_tty_frm[MC_TTY_FRM_VERT];
  458. if (ch == 0)
  459. ch = ACS_VLINE;
  460. SLsmg_gotorc (y, x);
  461. if (ch == ACS_VLINE)
  462. SLsmg_draw_vline (len);
  463. else
  464. {
  465. int pos = 0;
  466. while (len-- != 0)
  467. {
  468. SLsmg_gotorc (y + pos, x);
  469. tty_print_char (ch);
  470. pos++;
  471. }
  472. }
  473. SLsmg_gotorc (y1, x);
  474. }
  475. /* --------------------------------------------------------------------------------------------- */
  476. void
  477. tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
  478. {
  479. SLsmg_fill_region (y, x, rows, cols, ch);
  480. }
  481. /* --------------------------------------------------------------------------------------------- */
  482. void
  483. tty_set_alt_charset (gboolean alt_charset)
  484. {
  485. SLsmg_set_char_set ((int) alt_charset);
  486. }
  487. /* --------------------------------------------------------------------------------------------- */
  488. void
  489. tty_display_8bit (gboolean what)
  490. {
  491. SLsmg_Display_Eight_Bit = what ? 128 : 160;
  492. }
  493. /* --------------------------------------------------------------------------------------------- */
  494. void
  495. tty_print_char (int c)
  496. {
  497. SLsmg_write_char ((SLwchar_Type) ((unsigned int) c));
  498. }
  499. /* --------------------------------------------------------------------------------------------- */
  500. void
  501. tty_print_alt_char (int c, gboolean single)
  502. {
  503. #define DRAW(x, y) (x == y) \
  504. ? SLsmg_draw_object (SLsmg_get_row(), SLsmg_get_column(), x) \
  505. : SLsmg_write_char ((unsigned int) y)
  506. switch (c)
  507. {
  508. case ACS_VLINE:
  509. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_VERT : MC_TTY_FRM_DVERT]);
  510. break;
  511. case ACS_HLINE:
  512. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ]);
  513. break;
  514. case ACS_LTEE:
  515. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_LEFTMIDDLE : MC_TTY_FRM_DLEFTMIDDLE]);
  516. break;
  517. case ACS_RTEE:
  518. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_RIGHTMIDDLE : MC_TTY_FRM_DRIGHTMIDDLE]);
  519. break;
  520. case ACS_ULCORNER:
  521. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_LEFTTOP : MC_TTY_FRM_DLEFTTOP]);
  522. break;
  523. case ACS_LLCORNER:
  524. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_LEFTBOTTOM : MC_TTY_FRM_DLEFTBOTTOM]);
  525. break;
  526. case ACS_URCORNER:
  527. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_RIGHTTOP : MC_TTY_FRM_DRIGHTTOP]);
  528. break;
  529. case ACS_LRCORNER:
  530. DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_RIGHTBOTTOM : MC_TTY_FRM_DRIGHTBOTTOM]);
  531. break;
  532. case ACS_PLUS:
  533. DRAW (c, mc_tty_frm[MC_TTY_FRM_CROSS]);
  534. break;
  535. default:
  536. SLsmg_write_char ((unsigned int) c);
  537. }
  538. #undef DRAW
  539. }
  540. /* --------------------------------------------------------------------------------------------- */
  541. void
  542. tty_print_anychar (int c)
  543. {
  544. char str[6 + 1];
  545. if (c > 255)
  546. {
  547. int res = g_unichar_to_utf8 (c, str);
  548. if (res == 0)
  549. {
  550. str[0] = '.';
  551. str[1] = '\0';
  552. }
  553. else
  554. {
  555. str[res] = '\0';
  556. }
  557. SLsmg_write_string ((char *) str_term_form (str));
  558. }
  559. else
  560. {
  561. if (!is_printable (c))
  562. c = '.';
  563. SLsmg_write_char ((SLwchar_Type) ((unsigned int) c));
  564. }
  565. }
  566. /* --------------------------------------------------------------------------------------------- */
  567. void
  568. tty_print_string (const char *s)
  569. {
  570. SLsmg_write_string ((char *) str_term_form (s));
  571. }
  572. /* --------------------------------------------------------------------------------------------- */
  573. void
  574. tty_printf (const char *fmt, ...)
  575. {
  576. va_list args;
  577. va_start (args, fmt);
  578. SLsmg_vprintf ((char *) fmt, args);
  579. va_end (args);
  580. }
  581. /* --------------------------------------------------------------------------------------------- */
  582. char *
  583. tty_tgetstr (const char *cap)
  584. {
  585. return SLtt_tgetstr ((char *) cap);
  586. }
  587. /* --------------------------------------------------------------------------------------------- */
  588. void
  589. tty_refresh (void)
  590. {
  591. SLsmg_refresh ();
  592. }
  593. /* --------------------------------------------------------------------------------------------- */
  594. void
  595. tty_beep (void)
  596. {
  597. SLtt_beep ();
  598. }
  599. /* --------------------------------------------------------------------------------------------- */