]> git.ipfire.org Git - thirdparty/bash.git/blame - lib/readline/signals.c
Imported from ../bash-4.0.tar.gz.
[thirdparty/bash.git] / lib / readline / signals.c
CommitLineData
726f6388
JA
1/* signals.c -- signal handling support for readline. */
2
3185942a 3/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
726f6388 4
3185942a
JA
5 This file is part of the GNU Readline Library (Readline), a library
6 for reading lines of text with interactive input and history editing.
726f6388 7
3185942a
JA
8 Readline is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
726f6388
JA
11 (at your option) any later version.
12
3185942a
JA
13 Readline is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
726f6388
JA
16 GNU General Public License for more details.
17
3185942a
JA
18 You should have received a copy of the GNU General Public License
19 along with Readline. If not, see <http://www.gnu.org/licenses/>.
20*/
21
726f6388
JA
22#define READLINE_LIBRARY
23
ccc6cda3
JA
24#if defined (HAVE_CONFIG_H)
25# include <config.h>
26#endif
27
28#include <stdio.h> /* Just for NULL. Yuck. */
726f6388 29#include <sys/types.h>
726f6388
JA
30#include <signal.h>
31
32#if defined (HAVE_UNISTD_H)
33# include <unistd.h>
34#endif /* HAVE_UNISTD_H */
35
726f6388
JA
36/* System-specific feature definitions and include files. */
37#include "rldefs.h"
38
39#if defined (GWINSZ_IN_SYS_IOCTL)
40# include <sys/ioctl.h>
41#endif /* GWINSZ_IN_SYS_IOCTL */
42
43/* Some standard library routines. */
44#include "readline.h"
45#include "history.h"
46
bb70624e
JA
47#include "rlprivate.h"
48
3185942a
JA
49#if defined (HANDLE_SIGNALS)
50
ccc6cda3
JA
51#if !defined (RETSIGTYPE)
52# if defined (VOID_SIGHANDLER)
53# define RETSIGTYPE void
54# else
55# define RETSIGTYPE int
56# endif /* !VOID_SIGHANDLER */
57#endif /* !RETSIGTYPE */
726f6388
JA
58
59#if defined (VOID_SIGHANDLER)
ccc6cda3 60# define SIGHANDLER_RETURN return
726f6388 61#else
ccc6cda3
JA
62# define SIGHANDLER_RETURN return (0)
63#endif
726f6388 64
28ef6c31 65/* This typedef is equivalent to the one for Function; it allows us
726f6388 66 to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
ccc6cda3 67typedef RETSIGTYPE SigHandler ();
726f6388 68
bb70624e
JA
69#if defined (HAVE_POSIX_SIGNALS)
70typedef struct sigaction sighandler_cxt;
71# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
72#else
73typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt;
74# define sigemptyset(m)
75#endif /* !HAVE_POSIX_SIGNALS */
b72432fd 76
b80f6443
JA
77#ifndef SA_RESTART
78# define SA_RESTART 0
79#endif
80
f73dda09 81static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
7117c2d2 82static void rl_maybe_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
726f6388 83
17345e5a
JA
84static RETSIGTYPE rl_signal_handler PARAMS((int));
85static RETSIGTYPE _rl_handle_signal PARAMS((int));
86
b72432fd
JA
87/* Exported variables for use by applications. */
88
89/* If non-zero, readline will install its own signal handlers for
90 SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
91int rl_catch_signals = 1;
92
93/* If non-zero, readline will install a signal handler for SIGWINCH. */
94#ifdef SIGWINCH
95int rl_catch_sigwinch = 1;
b80f6443
JA
96#else
97int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */
b72432fd
JA
98#endif
99
3185942a 100/* Private variables. */
17345e5a
JA
101int _rl_interrupt_immediately = 0;
102int volatile _rl_caught_signal = 0; /* should be sig_atomic_t, but that requires including <signal.h> everywhere */
103
3185942a
JA
104/* If non-zero, print characters corresponding to received signals. */
105int _rl_echoctl = 0;
106
107int _rl_intr_char = 0;
108int _rl_quit_char = 0;
109int _rl_susp_char = 0;
110
b72432fd
JA
111static int signals_set_flag;
112static int sigwinch_set_flag;
113
726f6388
JA
114/* **************************************************************** */
115/* */
116/* Signal Handling */
117/* */
118/* **************************************************************** */
119
b72432fd
JA
120static sighandler_cxt old_int, old_term, old_alrm, old_quit;
121#if defined (SIGTSTP)
d166f048 122static sighandler_cxt old_tstp, old_ttou, old_ttin;
d166f048 123#endif
ccc6cda3
JA
124#if defined (SIGWINCH)
125static sighandler_cxt old_winch;
126#endif
127
128/* Readline signal handler functions. */
129
17345e5a
JA
130/* Called from RL_CHECK_SIGNALS() macro */
131RETSIGTYPE
132_rl_signal_handler (sig)
133{
134 _rl_caught_signal = 0; /* XXX */
135
136 _rl_handle_signal (sig);
137 SIGHANDLER_RETURN;
138}
139
ccc6cda3 140static RETSIGTYPE
726f6388
JA
141rl_signal_handler (sig)
142 int sig;
17345e5a
JA
143{
144 if (_rl_interrupt_immediately)
145 {
146 _rl_interrupt_immediately = 0;
147 _rl_handle_signal (sig);
148 }
149
150 _rl_caught_signal = sig;
151 SIGHANDLER_RETURN;
152}
153
154static RETSIGTYPE
155_rl_handle_signal (sig)
156 int sig;
726f6388
JA
157{
158#if defined (HAVE_POSIX_SIGNALS)
159 sigset_t set;
160#else /* !HAVE_POSIX_SIGNALS */
161# if defined (HAVE_BSD_SIGNALS)
162 long omask;
d166f048
JA
163# else /* !HAVE_BSD_SIGNALS */
164 sighandler_cxt dummy_cxt; /* needed for rl_set_sighandler call */
165# endif /* !HAVE_BSD_SIGNALS */
726f6388
JA
166#endif /* !HAVE_POSIX_SIGNALS */
167
28ef6c31
JA
168 RL_SETSTATE(RL_STATE_SIGHANDLER);
169
726f6388
JA
170#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
171 /* Since the signal will not be blocked while we are in the signal
172 handler, ignore it until rl_clear_signals resets the catcher. */
95732b49 173# if defined (SIGALRM)
ccc6cda3 174 if (sig == SIGINT || sig == SIGALRM)
95732b49
JA
175# else
176 if (sig == SIGINT)
177# endif
d166f048 178 rl_set_sighandler (sig, SIG_IGN, &dummy_cxt);
ccc6cda3 179#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
726f6388
JA
180
181 switch (sig)
182 {
183 case SIGINT:
3185942a 184 _rl_reset_completion_state ();
b72432fd
JA
185 rl_free_line_state ();
186 /* FALLTHROUGH */
726f6388 187
95732b49 188 case SIGTERM:
726f6388
JA
189#if defined (SIGTSTP)
190 case SIGTSTP:
191 case SIGTTOU:
192 case SIGTTIN:
193#endif /* SIGTSTP */
95732b49 194#if defined (SIGALRM)
726f6388 195 case SIGALRM:
95732b49
JA
196#endif
197#if defined (SIGQUIT)
b72432fd 198 case SIGQUIT:
95732b49 199#endif
3185942a 200 rl_echo_signal_char (sig);
b72432fd 201 rl_cleanup_after_signal ();
726f6388
JA
202
203#if defined (HAVE_POSIX_SIGNALS)
0628567a 204 sigemptyset (&set);
726f6388
JA
205 sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
206 sigdelset (&set, sig);
207#else /* !HAVE_POSIX_SIGNALS */
208# if defined (HAVE_BSD_SIGNALS)
209 omask = sigblock (0);
210# endif /* HAVE_BSD_SIGNALS */
211#endif /* !HAVE_POSIX_SIGNALS */
212
bb70624e
JA
213#if defined (__EMX__)
214 signal (sig, SIG_ACK);
215#endif
216
95732b49 217#if defined (HAVE_KILL)
726f6388 218 kill (getpid (), sig);
95732b49
JA
219#else
220 raise (sig); /* assume we have raise */
221#endif
726f6388
JA
222
223 /* Let the signal that we just sent through. */
224#if defined (HAVE_POSIX_SIGNALS)
225 sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL);
226#else /* !HAVE_POSIX_SIGNALS */
227# if defined (HAVE_BSD_SIGNALS)
228 sigsetmask (omask & ~(sigmask (sig)));
229# endif /* HAVE_BSD_SIGNALS */
230#endif /* !HAVE_POSIX_SIGNALS */
231
b72432fd 232 rl_reset_after_signal ();
726f6388
JA
233 }
234
28ef6c31 235 RL_UNSETSTATE(RL_STATE_SIGHANDLER);
ccc6cda3 236 SIGHANDLER_RETURN;
726f6388
JA
237}
238
ccc6cda3
JA
239#if defined (SIGWINCH)
240static RETSIGTYPE
b72432fd 241rl_sigwinch_handler (sig)
ccc6cda3
JA
242 int sig;
243{
244 SigHandler *oh;
245
d166f048
JA
246#if defined (MUST_REINSTALL_SIGHANDLERS)
247 sighandler_cxt dummy_winch;
248
249 /* We don't want to change old_winch -- it holds the state of SIGWINCH
250 disposition set by the calling application. We need this state
251 because we call the application's SIGWINCH handler after updating
252 our own idea of the screen size. */
b72432fd 253 rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch);
d166f048
JA
254#endif
255
28ef6c31 256 RL_SETSTATE(RL_STATE_SIGHANDLER);
b72432fd 257 rl_resize_terminal ();
ccc6cda3
JA
258
259 /* If another sigwinch handler has been installed, call it. */
260 oh = (SigHandler *)old_winch.sa_handler;
261 if (oh && oh != (SigHandler *)SIG_IGN && oh != (SigHandler *)SIG_DFL)
262 (*oh) (sig);
263
28ef6c31 264 RL_UNSETSTATE(RL_STATE_SIGHANDLER);
ccc6cda3
JA
265 SIGHANDLER_RETURN;
266}
267#endif /* SIGWINCH */
268
269/* Functions to manage signal handling. */
270
271#if !defined (HAVE_POSIX_SIGNALS)
272static int
273rl_sigaction (sig, nh, oh)
274 int sig;
275 sighandler_cxt *nh, *oh;
276{
277 oh->sa_handler = signal (sig, nh->sa_handler);
278 return 0;
279}
280#endif /* !HAVE_POSIX_SIGNALS */
281
282/* Set up a readline-specific signal handler, saving the old signal
283 information in OHANDLER. Return the old signal handler, like
284 signal(). */
726f6388 285static SigHandler *
ccc6cda3 286rl_set_sighandler (sig, handler, ohandler)
726f6388
JA
287 int sig;
288 SigHandler *handler;
ccc6cda3 289 sighandler_cxt *ohandler;
726f6388 290{
bb70624e 291 sighandler_cxt old_handler;
ccc6cda3
JA
292#if defined (HAVE_POSIX_SIGNALS)
293 struct sigaction act;
726f6388
JA
294
295 act.sa_handler = handler;
3185942a 296# if defined (SIGWINCH)
b80f6443 297 act.sa_flags = (sig == SIGWINCH) ? SA_RESTART : 0;
3185942a
JA
298# else
299 act.sa_flags = 0;
300# endif /* SIGWINCH */
726f6388 301 sigemptyset (&act.sa_mask);
ccc6cda3 302 sigemptyset (&ohandler->sa_mask);
bb70624e 303 sigaction (sig, &act, &old_handler);
ccc6cda3 304#else
bb70624e 305 old_handler.sa_handler = (SigHandler *)signal (sig, handler);
726f6388 306#endif /* !HAVE_POSIX_SIGNALS */
bb70624e
JA
307
308 /* XXX -- assume we have memcpy */
309 /* If rl_set_signals is called twice in a row, don't set the old handler to
310 rl_signal_handler, because that would cause infinite recursion. */
311 if (handler != rl_signal_handler || old_handler.sa_handler != rl_signal_handler)
312 memcpy (ohandler, &old_handler, sizeof (sighandler_cxt));
313
ccc6cda3
JA
314 return (ohandler->sa_handler);
315}
726f6388 316
b72432fd
JA
317static void
318rl_maybe_set_sighandler (sig, handler, ohandler)
319 int sig;
320 SigHandler *handler;
321 sighandler_cxt *ohandler;
726f6388 322{
ccc6cda3
JA
323 sighandler_cxt dummy;
324 SigHandler *oh;
325
ccc6cda3 326 sigemptyset (&dummy.sa_mask);
b72432fd 327 oh = rl_set_sighandler (sig, handler, ohandler);
ccc6cda3 328 if (oh == (SigHandler *)SIG_IGN)
b72432fd
JA
329 rl_sigaction (sig, ohandler, &dummy);
330}
ccc6cda3 331
b72432fd
JA
332int
333rl_set_signals ()
334{
335 sighandler_cxt dummy;
336 SigHandler *oh;
0628567a
JA
337#if defined (HAVE_POSIX_SIGNALS)
338 static int sigmask_set = 0;
339 static sigset_t bset, oset;
340#endif
341
342#if defined (HAVE_POSIX_SIGNALS)
343 if (rl_catch_signals && sigmask_set == 0)
344 {
345 sigemptyset (&bset);
346
347 sigaddset (&bset, SIGINT);
3185942a 348 sigaddset (&bset, SIGTERM);
0628567a
JA
349#if defined (SIGQUIT)
350 sigaddset (&bset, SIGQUIT);
351#endif
352#if defined (SIGALRM)
353 sigaddset (&bset, SIGALRM);
354#endif
355#if defined (SIGTSTP)
356 sigaddset (&bset, SIGTSTP);
357#endif
358#if defined (SIGTTIN)
359 sigaddset (&bset, SIGTTIN);
360#endif
361#if defined (SIGTTOU)
362 sigaddset (&bset, SIGTTOU);
363#endif
364 sigmask_set = 1;
365 }
366#endif /* HAVE_POSIX_SIGNALS */
b72432fd
JA
367
368 if (rl_catch_signals && signals_set_flag == 0)
369 {
0628567a
JA
370#if defined (HAVE_POSIX_SIGNALS)
371 sigemptyset (&oset);
372 sigprocmask (SIG_BLOCK, &bset, &oset);
373#endif
374
b72432fd
JA
375 rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
376 rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
95732b49 377#if defined (SIGQUIT)
b72432fd 378 rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
95732b49 379#endif
b72432fd 380
95732b49 381#if defined (SIGALRM)
b72432fd
JA
382 oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);
383 if (oh == (SigHandler *)SIG_IGN)
384 rl_sigaction (SIGALRM, &old_alrm, &dummy);
ccc6cda3 385#if defined (HAVE_POSIX_SIGNALS) && defined (SA_RESTART)
b72432fd
JA
386 /* If the application using readline has already installed a signal
387 handler with SA_RESTART, SIGALRM will cause reads to be restarted
388 automatically, so readline should just get out of the way. Since
389 we tested for SIG_IGN above, we can just test for SIG_DFL here. */
390 if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART))
391 rl_sigaction (SIGALRM, &old_alrm, &dummy);
ccc6cda3 392#endif /* HAVE_POSIX_SIGNALS */
95732b49 393#endif /* SIGALRM */
726f6388 394
726f6388 395#if defined (SIGTSTP)
b72432fd 396 rl_maybe_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
726f6388 397#endif /* SIGTSTP */
ccc6cda3 398
726f6388 399#if defined (SIGTTOU)
b72432fd 400 rl_maybe_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou);
726f6388
JA
401#endif /* SIGTTOU */
402
b72432fd
JA
403#if defined (SIGTTIN)
404 rl_maybe_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin);
405#endif /* SIGTTIN */
d166f048 406
b72432fd 407 signals_set_flag = 1;
0628567a
JA
408
409#if defined (HAVE_POSIX_SIGNALS)
410 sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
411#endif
b72432fd 412 }
726f6388
JA
413
414#if defined (SIGWINCH)
b72432fd
JA
415 if (rl_catch_sigwinch && sigwinch_set_flag == 0)
416 {
417 rl_maybe_set_sighandler (SIGWINCH, rl_sigwinch_handler, &old_winch);
418 sigwinch_set_flag = 1;
419 }
726f6388 420#endif /* SIGWINCH */
ccc6cda3 421
726f6388
JA
422 return 0;
423}
424
ccc6cda3 425int
726f6388
JA
426rl_clear_signals ()
427{
ccc6cda3
JA
428 sighandler_cxt dummy;
429
b72432fd
JA
430 if (rl_catch_signals && signals_set_flag == 1)
431 {
432 sigemptyset (&dummy.sa_mask);
726f6388 433
b72432fd
JA
434 rl_sigaction (SIGINT, &old_int, &dummy);
435 rl_sigaction (SIGTERM, &old_term, &dummy);
95732b49 436#if defined (SIGQUIT)
b72432fd 437 rl_sigaction (SIGQUIT, &old_quit, &dummy);
95732b49
JA
438#endif
439#if defined (SIGALRM)
b72432fd 440 rl_sigaction (SIGALRM, &old_alrm, &dummy);
95732b49 441#endif
726f6388
JA
442
443#if defined (SIGTSTP)
b72432fd
JA
444 rl_sigaction (SIGTSTP, &old_tstp, &dummy);
445#endif /* SIGTSTP */
726f6388
JA
446
447#if defined (SIGTTOU)
b72432fd 448 rl_sigaction (SIGTTOU, &old_ttou, &dummy);
726f6388
JA
449#endif /* SIGTTOU */
450
b72432fd
JA
451#if defined (SIGTTIN)
452 rl_sigaction (SIGTTIN, &old_ttin, &dummy);
453#endif /* SIGTTIN */
ccc6cda3 454
b72432fd
JA
455 signals_set_flag = 0;
456 }
726f6388
JA
457
458#if defined (SIGWINCH)
b72432fd
JA
459 if (rl_catch_sigwinch && sigwinch_set_flag == 1)
460 {
461 sigemptyset (&dummy.sa_mask);
462 rl_sigaction (SIGWINCH, &old_winch, &dummy);
463 sigwinch_set_flag = 0;
464 }
726f6388
JA
465#endif
466
467 return 0;
468}
b72432fd
JA
469
470/* Clean up the terminal and readline state after catching a signal, before
471 resending it to the calling application. */
472void
473rl_cleanup_after_signal ()
474{
475 _rl_clean_up_for_exit ();
95732b49
JA
476 if (rl_deprep_term_function)
477 (*rl_deprep_term_function) ();
28ef6c31 478 rl_clear_pending_input ();
0628567a 479 rl_clear_signals ();
b72432fd
JA
480}
481
482/* Reset the terminal and readline state after a signal handler returns. */
483void
484rl_reset_after_signal ()
485{
95732b49
JA
486 if (rl_prep_term_function)
487 (*rl_prep_term_function) (_rl_meta_flag);
b72432fd
JA
488 rl_set_signals ();
489}
490
491/* Free up the readline variable line state for the current line (undo list,
492 any partial history entry, any keyboard macros in progress, and any
493 numeric arguments in process) after catching a signal, before calling
494 rl_cleanup_after_signal(). */
495void
496rl_free_line_state ()
497{
498 register HIST_ENTRY *entry;
499
28ef6c31 500 rl_free_undo_list ();
b72432fd
JA
501
502 entry = current_history ();
503 if (entry)
504 entry->data = (char *)NULL;
505
506 _rl_kill_kbd_macro ();
507 rl_clear_message ();
95732b49 508 _rl_reset_argument ();
b72432fd
JA
509}
510
726f6388 511#endif /* HANDLE_SIGNALS */
3185942a
JA
512
513/* **************************************************************** */
514/* */
515/* SIGINT Management */
516/* */
517/* **************************************************************** */
518
519#if defined (HAVE_POSIX_SIGNALS)
520static sigset_t sigint_set, sigint_oset;
521#else /* !HAVE_POSIX_SIGNALS */
522# if defined (HAVE_BSD_SIGNALS)
523static int sigint_oldmask;
524# endif /* HAVE_BSD_SIGNALS */
525#endif /* !HAVE_POSIX_SIGNALS */
526
527static int sigint_blocked;
528
529/* Cause SIGINT to not be delivered until the corresponding call to
530 release_sigint(). */
531void
532_rl_block_sigint ()
533{
534 if (sigint_blocked)
535 return;
536
537#if defined (HAVE_POSIX_SIGNALS)
538 sigemptyset (&sigint_set);
539 sigemptyset (&sigint_oset);
540 sigaddset (&sigint_set, SIGINT);
541 sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset);
542#else /* !HAVE_POSIX_SIGNALS */
543# if defined (HAVE_BSD_SIGNALS)
544 sigint_oldmask = sigblock (sigmask (SIGINT));
545# else /* !HAVE_BSD_SIGNALS */
546# if defined (HAVE_USG_SIGHOLD)
547 sighold (SIGINT);
548# endif /* HAVE_USG_SIGHOLD */
549# endif /* !HAVE_BSD_SIGNALS */
550#endif /* !HAVE_POSIX_SIGNALS */
551
552 sigint_blocked = 1;
553}
554
555/* Allow SIGINT to be delivered. */
556void
557_rl_release_sigint ()
558{
559 if (sigint_blocked == 0)
560 return;
561
562#if defined (HAVE_POSIX_SIGNALS)
563 sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
564#else
565# if defined (HAVE_BSD_SIGNALS)
566 sigsetmask (sigint_oldmask);
567# else /* !HAVE_BSD_SIGNALS */
568# if defined (HAVE_USG_SIGHOLD)
569 sigrelse (SIGINT);
570# endif /* HAVE_USG_SIGHOLD */
571# endif /* !HAVE_BSD_SIGNALS */
572#endif /* !HAVE_POSIX_SIGNALS */
573
574 sigint_blocked = 0;
575}
576
577/* **************************************************************** */
578/* */
579/* Echoing special control characters */
580/* */
581/* **************************************************************** */
582void
583rl_echo_signal_char (sig)
584 int sig;
585{
586 char cstr[3];
587 int cslen, c;
588
589 if (_rl_echoctl == 0)
590 return;
591
592 switch (sig)
593 {
594 case SIGINT: c = _rl_intr_char; break;
595 case SIGQUIT: c = _rl_quit_char; break;
596 case SIGTSTP: c = _rl_susp_char; break;
597 default: return;
598 }
599
600 if (CTRL_CHAR (c) || c == RUBOUT)
601 {
602 cstr[0] = '^';
603 cstr[1] = CTRL_CHAR (c) ? UNCTRL (c) : '?';
604 cstr[cslen = 2] = '\0';
605 }
606 else
607 {
608 cstr[0] = c;
609 cstr[cslen = 1] = '\0';
610 }
611
612 _rl_output_some_chars (cstr, cslen);
613}