tty-slang.c 19 KB

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