mirrored from git://git.sv.gnu.org/coreutils.git
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathstty.c
More file actions
2377 lines (2204 loc) · 62 KB
/
stty.c
File metadata and controls
2377 lines (2204 loc) · 62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* stty -- change and print terminal line settings
Copyright (C) 1990-2023 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Usage: stty [-ag] [--all] [--save] [-F device] [--file=device] [setting...]
Options:
-a, --all Write all current settings to stdout in human-readable form.
-g, --save Write all current settings to stdout in stty-readable form.
-F, --file Open and use the specified device instead of stdin
If no args are given, write to stdout the baud rate and settings that
have been changed from their defaults. Mode reading and changes
are done on the specified device, or stdin if none was specified.
David MacKenzie <djm@gnu.ai.mit.edu> */
#include <config.h>
#ifdef TERMIOS_NEEDS_XOPEN_SOURCE
# define _XOPEN_SOURCE
#endif
#include <stdio.h>
#include <sys/types.h>
#include <termios.h>
#if HAVE_STROPTS_H
# include <stropts.h>
#endif
#include <sys/ioctl.h>
#ifdef WINSIZE_IN_PTEM
# include <sys/stream.h>
# include <sys/ptem.h>
#endif
#ifdef GWINSZ_IN_SYS_PTY
# include <sys/tty.h>
# include <sys/pty.h>
#endif
#include <getopt.h>
#include <stdarg.h>
#include <assert.h>
#include "system.h"
#include "die.h"
#include "error.h"
#include "fd-reopen.h"
#include "quote.h"
#include "xdectoint.h"
#include "xstrtol.h"
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "stty"
#define AUTHORS proper_name ("David MacKenzie")
#ifndef _POSIX_VDISABLE
# define _POSIX_VDISABLE 0
#endif
#define Control(c) ((c) & 0x1f)
/* Canonical values for control characters. */
#ifndef CINTR
# define CINTR Control ('c')
#endif
#ifndef CQUIT
# define CQUIT 28
#endif
#ifndef CERASE
# define CERASE 127
#endif
#ifndef CKILL
# define CKILL Control ('u')
#endif
#ifndef CEOF
# define CEOF Control ('d')
#endif
#ifndef CEOL
# define CEOL _POSIX_VDISABLE
#endif
#ifndef CSTART
# define CSTART Control ('q')
#endif
#ifndef CSTOP
# define CSTOP Control ('s')
#endif
#ifndef CSUSP
# define CSUSP Control ('z')
#endif
#if defined VEOL2 && !defined CEOL2
# define CEOL2 _POSIX_VDISABLE
#endif
/* Some platforms have VSWTC, others VSWTCH. In both cases, this control
character is initialized by CSWTCH, if present. */
#if defined VSWTC && !defined VSWTCH
# define VSWTCH VSWTC
#endif
/* ISC renamed swtch to susp for termios, but we'll accept either name. */
#if defined VSUSP && !defined VSWTCH
# define VSWTCH VSUSP
# if defined CSUSP && !defined CSWTCH
# define CSWTCH CSUSP
# endif
#endif
#if defined VSWTCH && !defined CSWTCH
# define CSWTCH _POSIX_VDISABLE
#endif
/* SunOS >= 5.3 loses (^Z doesn't work) if 'swtch' is the same as 'susp'.
So the default is to disable 'swtch.' */
#if defined __sun
# undef CSWTCH
# define CSWTCH _POSIX_VDISABLE
#endif
#if defined VWERSE && !defined VWERASE /* AIX-3.2.5 */
# define VWERASE VWERSE
#endif
#if defined VDSUSP && !defined CDSUSP
# define CDSUSP Control ('y')
#endif
#if !defined VREPRINT && defined VRPRNT /* Irix 4.0.5 */
# define VREPRINT VRPRNT
#endif
#if defined VREPRINT && !defined CRPRNT
# define CRPRNT Control ('r')
#endif
#if defined CREPRINT && !defined CRPRNT
# define CRPRNT Control ('r')
#endif
#if defined VWERASE && !defined CWERASE
# define CWERASE Control ('w')
#endif
#if defined VLNEXT && !defined CLNEXT
# define CLNEXT Control ('v')
#endif
#if defined VDISCARD && !defined VFLUSHO
# define VFLUSHO VDISCARD
#endif
#if defined VFLUSH && !defined VFLUSHO /* Ultrix 4.2 */
# define VFLUSHO VFLUSH
#endif
#if defined CTLECH && !defined ECHOCTL /* Ultrix 4.3 */
# define ECHOCTL CTLECH
#endif
#if defined TCTLECH && !defined ECHOCTL /* Ultrix 4.2 */
# define ECHOCTL TCTLECH
#endif
#if defined CRTKIL && !defined ECHOKE /* Ultrix 4.2 and 4.3 */
# define ECHOKE CRTKIL
#endif
#if defined VFLUSHO && !defined CFLUSHO
# define CFLUSHO Control ('o')
#endif
#if defined VSTATUS && !defined CSTATUS
# define CSTATUS Control ('t')
#endif
/* Which speeds to set. */
enum speed_setting
{
input_speed, output_speed, both_speeds
};
/* What to output and how. */
enum output_type
{
changed, all, recoverable /* Default, -a, -g. */
};
/* Which member(s) of 'struct termios' a mode uses. */
enum mode_type
{
control, input, output, local, combination
};
/* Flags for 'struct mode_info'. */
#define SANE_SET 1 /* Set in 'sane' mode. */
#define SANE_UNSET 2 /* Unset in 'sane' mode. */
#define REV 4 /* Can be turned off by prepending '-'. */
#define OMIT 8 /* Don't display value. */
#define NO_SETATTR 16 /* tcsetattr not used to set mode bits. */
/* Each mode. */
struct mode_info
{
char const *name; /* Name given on command line. */
enum mode_type type; /* Which structure element to change. */
char flags; /* Setting and display options. */
unsigned long bits; /* Bits to set for this mode. */
unsigned long mask; /* Other bits to turn off for this mode. */
};
static struct mode_info const mode_info[] =
{
{"parenb", control, REV, PARENB, 0},
{"parodd", control, REV, PARODD, 0},
#ifdef CMSPAR
{"cmspar", control, REV, CMSPAR, 0},
#endif
{"cs5", control, 0, CS5, CSIZE},
{"cs6", control, 0, CS6, CSIZE},
{"cs7", control, 0, CS7, CSIZE},
{"cs8", control, 0, CS8, CSIZE},
{"hupcl", control, REV, HUPCL, 0},
{"hup", control, REV | OMIT, HUPCL, 0},
{"cstopb", control, REV, CSTOPB, 0},
{"cread", control, SANE_SET | REV, CREAD, 0},
{"clocal", control, REV, CLOCAL, 0},
#ifdef CRTSCTS
{"crtscts", control, REV, CRTSCTS, 0},
#endif
#ifdef CDTRDSR
{"cdtrdsr", control, REV, CDTRDSR, 0},
#endif
{"ignbrk", input, SANE_UNSET | REV, IGNBRK, 0},
{"brkint", input, SANE_SET | REV, BRKINT, 0},
{"ignpar", input, REV, IGNPAR, 0},
{"parmrk", input, REV, PARMRK, 0},
{"inpck", input, REV, INPCK, 0},
{"istrip", input, REV, ISTRIP, 0},
{"inlcr", input, SANE_UNSET | REV, INLCR, 0},
{"igncr", input, SANE_UNSET | REV, IGNCR, 0},
{"icrnl", input, SANE_SET | REV, ICRNL, 0},
{"ixon", input, REV, IXON, 0},
{"ixoff", input, SANE_UNSET | REV, IXOFF, 0},
{"tandem", input, REV | OMIT, IXOFF, 0},
#ifdef IUCLC
{"iuclc", input, SANE_UNSET | REV, IUCLC, 0},
#endif
#ifdef IXANY
{"ixany", input, SANE_UNSET | REV, IXANY, 0},
#endif
#ifdef IMAXBEL
{"imaxbel", input, SANE_SET | REV, IMAXBEL, 0},
#endif
#ifdef IUTF8
{"iutf8", input, SANE_UNSET | REV, IUTF8, 0},
#endif
{"opost", output, SANE_SET | REV, OPOST, 0},
#ifdef OLCUC
{"olcuc", output, SANE_UNSET | REV, OLCUC, 0},
#endif
#ifdef OCRNL
{"ocrnl", output, SANE_UNSET | REV, OCRNL, 0},
#endif
#ifdef ONLCR
{"onlcr", output, SANE_SET | REV, ONLCR, 0},
#endif
#ifdef ONOCR
{"onocr", output, SANE_UNSET | REV, ONOCR, 0},
#endif
#ifdef ONLRET
{"onlret", output, SANE_UNSET | REV, ONLRET, 0},
#endif
#ifdef OFILL
{"ofill", output, SANE_UNSET | REV, OFILL, 0},
#endif
#ifdef OFDEL
{"ofdel", output, SANE_UNSET | REV, OFDEL, 0},
#endif
#ifdef NLDLY
{"nl1", output, SANE_UNSET, NL1, NLDLY},
{"nl0", output, SANE_SET, NL0, NLDLY},
#endif
#ifdef CRDLY
{"cr3", output, SANE_UNSET, CR3, CRDLY},
{"cr2", output, SANE_UNSET, CR2, CRDLY},
{"cr1", output, SANE_UNSET, CR1, CRDLY},
{"cr0", output, SANE_SET, CR0, CRDLY},
#endif
#ifdef TABDLY
# ifdef TAB3
{"tab3", output, SANE_UNSET, TAB3, TABDLY},
# endif
# ifdef TAB2
{"tab2", output, SANE_UNSET, TAB2, TABDLY},
# endif
# ifdef TAB1
{"tab1", output, SANE_UNSET, TAB1, TABDLY},
# endif
# ifdef TAB0
{"tab0", output, SANE_SET, TAB0, TABDLY},
# endif
#else
# ifdef OXTABS
{"tab3", output, SANE_UNSET, OXTABS, 0},
# endif
#endif
#ifdef BSDLY
{"bs1", output, SANE_UNSET, BS1, BSDLY},
{"bs0", output, SANE_SET, BS0, BSDLY},
#endif
#ifdef VTDLY
{"vt1", output, SANE_UNSET, VT1, VTDLY},
{"vt0", output, SANE_SET, VT0, VTDLY},
#endif
#ifdef FFDLY
{"ff1", output, SANE_UNSET, FF1, FFDLY},
{"ff0", output, SANE_SET, FF0, FFDLY},
#endif
{"isig", local, SANE_SET | REV, ISIG, 0},
{"icanon", local, SANE_SET | REV, ICANON, 0},
#ifdef IEXTEN
{"iexten", local, SANE_SET | REV, IEXTEN, 0},
#endif
{"echo", local, SANE_SET | REV, ECHO, 0},
{"echoe", local, SANE_SET | REV, ECHOE, 0},
{"crterase", local, REV | OMIT, ECHOE, 0},
{"echok", local, SANE_SET | REV, ECHOK, 0},
{"echonl", local, SANE_UNSET | REV, ECHONL, 0},
{"noflsh", local, SANE_UNSET | REV, NOFLSH, 0},
#ifdef XCASE
{"xcase", local, SANE_UNSET | REV, XCASE, 0},
#endif
#ifdef TOSTOP
{"tostop", local, SANE_UNSET | REV, TOSTOP, 0},
#endif
#ifdef ECHOPRT
{"echoprt", local, SANE_UNSET | REV, ECHOPRT, 0},
{"prterase", local, REV | OMIT, ECHOPRT, 0},
#endif
#ifdef ECHOCTL
{"echoctl", local, SANE_SET | REV, ECHOCTL, 0},
{"ctlecho", local, REV | OMIT, ECHOCTL, 0},
#endif
#ifdef ECHOKE
{"echoke", local, SANE_SET | REV, ECHOKE, 0},
{"crtkill", local, REV | OMIT, ECHOKE, 0},
#endif
#ifdef FLUSHO
{"flusho", local, SANE_UNSET | REV, FLUSHO, 0},
#endif
#if defined TIOCEXT
{"extproc", local, SANE_UNSET | REV | NO_SETATTR, EXTPROC, 0},
#elif defined EXTPROC
{"extproc", local, SANE_UNSET | REV, EXTPROC, 0},
#endif
{"evenp", combination, REV | OMIT, 0, 0},
{"parity", combination, REV | OMIT, 0, 0},
{"oddp", combination, REV | OMIT, 0, 0},
{"nl", combination, REV | OMIT, 0, 0},
{"ek", combination, OMIT, 0, 0},
{"sane", combination, OMIT, 0, 0},
{"cooked", combination, REV | OMIT, 0, 0},
{"raw", combination, REV | OMIT, 0, 0},
{"pass8", combination, REV | OMIT, 0, 0},
{"litout", combination, REV | OMIT, 0, 0},
{"cbreak", combination, REV | OMIT, 0, 0},
#ifdef IXANY
{"decctlq", combination, REV | OMIT, 0, 0},
#endif
#if defined TABDLY || defined OXTABS
{"tabs", combination, REV | OMIT, 0, 0},
#endif
#if defined XCASE && defined IUCLC && defined OLCUC
{"lcase", combination, REV | OMIT, 0, 0},
{"LCASE", combination, REV | OMIT, 0, 0},
#endif
{"crt", combination, OMIT, 0, 0},
{"dec", combination, OMIT, 0, 0},
{NULL, control, 0, 0, 0}
};
/* Control character settings. */
struct control_info
{
char const *name; /* Name given on command line. */
cc_t saneval; /* Value to set for 'stty sane'. */
size_t offset; /* Offset in c_cc. */
};
/* Control characters. */
static struct control_info const control_info[] =
{
{"intr", CINTR, VINTR},
{"quit", CQUIT, VQUIT},
{"erase", CERASE, VERASE},
{"kill", CKILL, VKILL},
{"eof", CEOF, VEOF},
{"eol", CEOL, VEOL},
#ifdef VEOL2
{"eol2", CEOL2, VEOL2},
#endif
#ifdef VSWTCH
{"swtch", CSWTCH, VSWTCH},
#endif
{"start", CSTART, VSTART},
{"stop", CSTOP, VSTOP},
{"susp", CSUSP, VSUSP},
#ifdef VDSUSP
{"dsusp", CDSUSP, VDSUSP},
#endif
#ifdef VREPRINT
{"rprnt", CRPRNT, VREPRINT},
#else
# ifdef CREPRINT /* HPUX 10.20 needs this */
{"rprnt", CRPRNT, CREPRINT},
# endif
#endif
#ifdef VWERASE
{"werase", CWERASE, VWERASE},
#endif
#ifdef VLNEXT
{"lnext", CLNEXT, VLNEXT},
#endif
#ifdef VFLUSHO
{"flush", CFLUSHO, VFLUSHO}, /* deprecated compat option. */
{"discard", CFLUSHO, VFLUSHO},
#endif
#ifdef VSTATUS
{"status", CSTATUS, VSTATUS},
#endif
/* These must be last because of the display routines. */
{"min", 1, VMIN},
{"time", 0, VTIME},
{NULL, 0, 0}
};
static char const *visible (cc_t ch);
static unsigned long int baud_to_value (speed_t speed);
static bool recover_mode (char const *arg, struct termios *mode);
static int screen_columns (void);
static bool set_mode (struct mode_info const *info, bool reversed,
struct termios *mode);
static bool eq_mode (struct termios *mode1, struct termios *mode2);
static unsigned long int integer_arg (char const *s, unsigned long int max);
static speed_t string_to_baud (char const *arg);
static tcflag_t *mode_type_flag (enum mode_type type, struct termios *mode);
static void display_all (struct termios *mode, char const *device_name);
static void display_changed (struct termios *mode);
static void display_recoverable (struct termios *mode);
static void display_settings (enum output_type output_type,
struct termios *mode,
char const *device_name);
static void check_speed (struct termios *mode);
static void display_speed (struct termios *mode, bool fancy);
static void display_window_size (bool fancy, char const *device_name);
static void sane_mode (struct termios *mode);
static void set_control_char (struct control_info const *info,
char const *arg,
struct termios *mode);
static void set_speed (enum speed_setting type, char const *arg,
struct termios *mode);
static void set_window_size (int rows, int cols, char const *device_name);
/* The width of the screen, for output wrapping. */
static int max_col;
/* Current position, to know when to wrap. */
static int current_col;
/* Default "drain" mode for tcsetattr. */
static int tcsetattr_options = TCSADRAIN;
/* Extra info to aid stty development. */
static bool dev_debug;
/* Record last speed set for correlation. */
static speed_t last_ibaud = (speed_t) -1;
static speed_t last_obaud = (speed_t) -1;
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
DEV_DEBUG_OPTION = CHAR_MAX + 1,
};
static struct option const longopts[] =
{
{"all", no_argument, NULL, 'a'},
{"save", no_argument, NULL, 'g'},
{"file", required_argument, NULL, 'F'},
{"-debug", no_argument, NULL, DEV_DEBUG_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
/* Print format string MESSAGE and optional args.
Wrap to next line first if it won't fit.
Print a space first unless MESSAGE will start a new line. */
ATTRIBUTE_FORMAT ((printf, 1, 2))
static void
wrapf (char const *message,...)
{
va_list args;
char *buf;
int buflen;
va_start (args, message);
buflen = vasprintf (&buf, message, args);
va_end (args);
if (buflen < 0)
xalloc_die ();
if (0 < current_col)
{
if (max_col - current_col <= buflen)
{
putchar ('\n');
current_col = 0;
}
else
{
putchar (' ');
current_col++;
}
}
fputs (buf, stdout);
free (buf);
current_col += buflen;
}
void
usage (int status)
{
if (status != EXIT_SUCCESS)
emit_try_help ();
else
{
printf (_("\
Usage: %s [-F DEVICE | --file=DEVICE] [SETTING]...\n\
or: %s [-F DEVICE | --file=DEVICE] [-a|--all]\n\
or: %s [-F DEVICE | --file=DEVICE] [-g|--save]\n\
"),
program_name, program_name, program_name);
fputs (_("\
Print or change terminal characteristics.\n\
"), stdout);
emit_mandatory_arg_note ();
fputs (_("\
-a, --all print all current settings in human-readable form\n\
-g, --save print all current settings in a stty-readable form\n\
-F, --file=DEVICE open and use the specified DEVICE instead of stdin\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\
\n\
Optional - before SETTING indicates negation. An * marks non-POSIX\n\
settings. The underlying system defines which settings are available.\n\
"), stdout);
fputs (_("\
\n\
Special characters:\n"), stdout);
#ifdef VFLUSHO
fputs (_("\
* discard CHAR CHAR will toggle discarding of output\n\
"), stdout);
#endif
#ifdef VDSUSP
fputs (_("\
* dsusp CHAR CHAR will send a terminal stop signal once input flushed\n\
"), stdout);
#endif
fputs (_("\
eof CHAR CHAR will send an end of file (terminate the input)\n\
eol CHAR CHAR will end the line\n\
"), stdout);
#ifdef VEOL2
fputs (_("\
* eol2 CHAR alternate CHAR for ending the line\n\
"), stdout);
#endif
fputs (_("\
erase CHAR CHAR will erase the last character typed\n\
intr CHAR CHAR will send an interrupt signal\n\
kill CHAR CHAR will erase the current line\n\
"), stdout);
#ifdef VLNEXT
fputs (_("\
* lnext CHAR CHAR will enter the next character quoted\n\
"), stdout);
#endif
#ifdef VSTATUS
fputs (_("\
* status CHAR CHAR will send an info signal\n\
"), stdout);
#endif
fputs (_("\
quit CHAR CHAR will send a quit signal\n\
"), stdout);
#if defined CREPRINT || defined VREPRINT
fputs (_("\
* rprnt CHAR CHAR will redraw the current line\n\
"), stdout);
#endif
fputs (_("\
start CHAR CHAR will restart the output after stopping it\n\
stop CHAR CHAR will stop the output\n\
susp CHAR CHAR will send a terminal stop signal\n\
"), stdout);
#ifdef VSWTCH
fputs (_("\
* swtch CHAR CHAR will switch to a different shell layer\n\
"), stdout);
#endif
#ifdef VWERASE
fputs (_("\
* werase CHAR CHAR will erase the last word typed\n\
"), stdout);
#endif
fputs (_("\
\n\
Special settings:\n\
N set the input and output speeds to N bauds\n\
"), stdout);
#ifdef TIOCGWINSZ
fputs (_("\
* cols N tell the kernel that the terminal has N columns\n\
* columns N same as cols N\n\
"), stdout);
#endif
printf (_("\
* [-]drain wait for transmission before applying settings (%s by default)\
\n"), tcsetattr_options == TCSADRAIN ? _("on") : _("off"));
fputs (_("\
ispeed N set the input speed to N\n\
"), stdout);
#ifdef HAVE_C_LINE
fputs (_("\
* line N use line discipline N\n\
"), stdout);
#endif
fputs (_("\
min N with -icanon, set N characters minimum for a completed read\n\
ospeed N set the output speed to N\n\
"), stdout);
#ifdef TIOCGWINSZ
fputs (_("\
* rows N tell the kernel that the terminal has N rows\n\
* size print the number of rows and columns according to the kernel\n\
"), stdout);
#endif
fputs (_("\
speed print the terminal speed\n\
time N with -icanon, set read timeout of N tenths of a second\n\
"), stdout);
fputs (_("\
\n\
Control settings:\n\
[-]clocal disable modem control signals\n\
[-]cread allow input to be received\n\
"), stdout);
#ifdef CRTSCTS
fputs (_("\
* [-]crtscts enable RTS/CTS handshaking\n\
"), stdout);
#endif
#ifdef CDTRDSR
fputs (_("\
* [-]cdtrdsr enable DTR/DSR handshaking\n\
"), stdout);
#endif
fputs (_("\
csN set character size to N bits, N in [5..8]\n\
"), stdout);
fputs (_("\
[-]cstopb use two stop bits per character (one with '-')\n\
[-]hup send a hangup signal when the last process closes the tty\n\
[-]hupcl same as [-]hup\n\
[-]parenb generate parity bit in output and expect parity bit in input\n\
[-]parodd set odd parity (or even parity with '-')\n\
"), stdout);
#ifdef CMSPAR
fputs (_("\
* [-]cmspar use \"stick\" (mark/space) parity\n\
"), stdout);
#endif
fputs (_("\
\n\
Input settings:\n\
[-]brkint breaks cause an interrupt signal\n\
[-]icrnl translate carriage return to newline\n\
[-]ignbrk ignore break characters\n\
[-]igncr ignore carriage return\n\
[-]ignpar ignore characters with parity errors\n\
"), stdout);
#ifdef IMAXBEL
fputs (_("\
* [-]imaxbel beep and do not flush a full input buffer on a character\n\
"), stdout);
#endif
fputs (_("\
[-]inlcr translate newline to carriage return\n\
[-]inpck enable input parity checking\n\
[-]istrip clear high (8th) bit of input characters\n\
"), stdout);
#ifdef IUTF8
fputs (_("\
* [-]iutf8 assume input characters are UTF-8 encoded\n\
"), stdout);
#endif
#ifdef IUCLC
fputs (_("\
* [-]iuclc translate uppercase characters to lowercase\n\
"), stdout);
#endif
#ifdef IXANY
fputs (_("\
* [-]ixany let any character restart output, not only start character\n\
"), stdout);
#endif
fputs (_("\
[-]ixoff enable sending of start/stop characters\n\
[-]ixon enable XON/XOFF flow control\n\
[-]parmrk mark parity errors (with a 255-0-character sequence)\n\
[-]tandem same as [-]ixoff\n\
"), stdout);
fputs (_("\
\n\
Output settings:\n\
"), stdout);
#ifdef BSDLY
fputs (_("\
* bsN backspace delay style, N in [0..1]\n\
"), stdout);
#endif
#ifdef CRDLY
fputs (_("\
* crN carriage return delay style, N in [0..3]\n\
"), stdout);
#endif
#ifdef FFDLY
fputs (_("\
* ffN form feed delay style, N in [0..1]\n\
"), stdout);
#endif
#ifdef NLDLY
fputs (_("\
* nlN newline delay style, N in [0..1]\n\
"), stdout);
#endif
#ifdef OCRNL
fputs (_("\
* [-]ocrnl translate carriage return to newline\n\
"), stdout);
#endif
#ifdef OFDEL
fputs (_("\
* [-]ofdel use delete characters for fill instead of NUL characters\n\
"), stdout);
#endif
#ifdef OFILL
fputs (_("\
* [-]ofill use fill (padding) characters instead of timing for delays\n\
"), stdout);
#endif
#ifdef OLCUC
fputs (_("\
* [-]olcuc translate lowercase characters to uppercase\n\
"), stdout);
#endif
#ifdef ONLCR
fputs (_("\
* [-]onlcr translate newline to carriage return-newline\n\
"), stdout);
#endif
#ifdef ONLRET
fputs (_("\
* [-]onlret newline performs a carriage return\n\
"), stdout);
#endif
#ifdef ONOCR
fputs (_("\
* [-]onocr do not print carriage returns in the first column\n\
"), stdout);
#endif
fputs (_("\
[-]opost postprocess output\n\
"), stdout);
#if defined TABDLY || defined OXTABS
fputs (_("\
* tabN horizontal tab delay style, N in [0..3]\n\
* tabs same as tab0\n\
* -tabs same as tab3\n\
"), stdout);
#endif
#ifdef VTDLY
fputs (_("\
* vtN vertical tab delay style, N in [0..1]\n\
"), stdout);
#endif
fputs (_("\
\n\
Local settings:\n\
[-]crterase echo erase characters as backspace-space-backspace\n\
"), stdout);
#ifdef ECHOKE
fputs (_("\
* crtkill kill all line by obeying the echoprt and echoe settings\n\
* -crtkill kill all line by obeying the echoctl and echok settings\n\
"), stdout);
#endif
#ifdef ECHOCTL
fputs (_("\
* [-]ctlecho echo control characters in hat notation ('^c')\n\
"), stdout);
#endif
fputs (_("\
[-]echo echo input characters\n\
"), stdout);
#ifdef ECHOCTL
fputs (_("\
* [-]echoctl same as [-]ctlecho\n\
"), stdout);
#endif
fputs (_("\
[-]echoe same as [-]crterase\n\
[-]echok echo a newline after a kill character\n\
"), stdout);
#ifdef ECHOKE
fputs (_("\
* [-]echoke same as [-]crtkill\n\
"), stdout);
#endif
fputs (_("\
[-]echonl echo newline even if not echoing other characters\n\
"), stdout);
#ifdef ECHOPRT
fputs (_("\
* [-]echoprt echo erased characters backward, between '\\' and '/'\n\
"), stdout);
#endif
#if defined EXTPROC || defined TIOCEXT
fputs (_("\
* [-]extproc enable \"LINEMODE\"; useful with high latency links\n\
"), stdout);
#endif
#if defined FLUSHO
fputs (_("\
* [-]flusho discard output\n\
"), stdout);
#endif
printf (_("\
[-]icanon enable special characters: %s\n\
[-]iexten enable non-POSIX special characters\n\
"), "erase, kill"
#ifdef VWERASE
", werase"
#endif
#if defined CREPRINT || defined VREPRINT
", rprnt"
#endif
);
fputs (_("\
[-]isig enable interrupt, quit, and suspend special characters\n\
[-]noflsh disable flushing after interrupt and quit special characters\n\
"), stdout);
#ifdef ECHOPRT
fputs (_("\
* [-]prterase same as [-]echoprt\n\
"), stdout);
#endif
#ifdef TOSTOP
fputs (_("\
* [-]tostop stop background jobs that try to write to the terminal\n\
"), stdout);
#endif
#ifdef XCASE
fputs (_("\
* [-]xcase with icanon, escape with '\\' for uppercase characters\n\
"), stdout);
#endif
fputs (_("\
\n\
Combination settings:\n\
"), stdout);
#if defined XCASE && defined IUCLC && defined OLCUC
fputs (_("\
* [-]LCASE same as [-]lcase\n\
"), stdout);
#endif
fputs (_("\
cbreak same as -icanon\n\
-cbreak same as icanon\n\
"), stdout);
fputs (_("\
cooked same as brkint ignpar istrip icrnl ixon opost isig\n\
icanon, eof and eol characters to their default values\n\
-cooked same as raw\n\
"), stdout);
printf (_("\
crt same as %s\n\
"), "echoe"
#ifdef ECHOCTL
" echoctl"
#endif
#ifdef ECHOKE
" echoke"
#endif
);
printf (_("\
dec same as %s intr ^c erase 0177\n\
kill ^u\n\
"), "echoe"
#ifdef ECHOCTL
" echoctl"
#endif
#ifdef ECHOKE
" echoke"
#endif
#ifdef IXANY
" -ixany"
#endif
);
#ifdef IXANY
fputs (_("\
* [-]decctlq same as [-]ixany\n\
"), stdout);
#endif
fputs (_("\
ek erase and kill characters to their default values\n\
evenp same as parenb -parodd cs7\n\
-evenp same as -parenb cs8\n\
"), stdout);
#if defined XCASE && defined IUCLC && defined OLCUC
fputs (_("\
* [-]lcase same as xcase iuclc olcuc\n\
"), stdout);
#endif
fputs (_("\
litout same as -parenb -istrip -opost cs8\n\
-litout same as parenb istrip opost cs7\n\
"), stdout);
printf (_("\
nl same as %s\n\
-nl same as %s\n\
"), "-icrnl"
#ifdef ONLCR
" -onlcr"
#endif
, "icrnl -inlcr -igncr"
#ifdef ONLCR
" onlcr"
#endif
#ifdef OCRNL
" -ocrnl"
#endif
#ifdef ONLRET
" -onlret"
#endif
);
fputs (_("\
oddp same as parenb parodd cs7\n\
-oddp same as -parenb cs8\n\
[-]parity same as [-]evenp\n\
pass8 same as -parenb -istrip cs8\n\
-pass8 same as parenb istrip cs7\n\
"), stdout);
printf (_("\
raw same as -ignbrk -brkint -ignpar -parmrk -inpck -istrip\n\
-inlcr -igncr -icrnl -ixon -ixoff -icanon -opost\n\
-isig%s min 1 time 0\n\
-raw same as cooked\n\
"),
#ifdef IUCLC
" -iuclc"
#endif
#ifdef IXANY
" -ixany"
#endif
#ifdef IMAXBEL
" -imaxbel"
#endif
#ifdef XCASE
" -xcase"
#endif
);
printf (_("\
sane same as cread -ignbrk brkint -inlcr -igncr icrnl\n\
icanon iexten echo echoe echok -echonl -noflsh\n\
%s\n\