tty-slang.c 19 KB

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