4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright (c) 2014, Joyent, Inc. All rights reserved.
29 * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
37 #include <sys/types.h>
39 #include <sys/stermio.h>
40 #include <sys/termiox.h>
48 #include <sys/param.h>
49 #include <sys/stropts.h>
50 #include <sys/eucioctl.h>
51 #include <sys/csiioctl.h>
52 #include <sys/stream.h>
53 #include <sys/termios.h>
54 #include <sys/ldterm.h>
59 extern const char *not_supported
[];
61 extern char *getenv();
64 extern int get_ttymode();
65 extern int set_ttymode();
67 static char *STTY
= "stty: ";
69 static struct termios cb
;
70 static struct termio ocb
; /* for non-streams devices */
71 static struct stio stio
;
72 static struct termiox termiox
;
73 static struct winsize winsize
, owinsize
;
76 static struct eucioc kwp
;
78 static ldterm_cs_data_user_t cswp
; /* User side codeset width data */
79 static ldterm_cs_data_user_t kcswp
; /* Kernel side codeset width data */
80 static int invalid_ldterm_dat_file
;
83 static void prmodes();
84 static void pramodes();
85 static void pit(unsigned char what
, char *itsname
, char *sep
);
86 static void delay(int m
, char *s
);
87 static void prspeed(char *c
, int s
);
88 static void prencode();
91 main(int argc
, char *argv
[])
95 char *s_arg
, *sttyparse(); /* s_arg: ptr to mode to be set */
101 (void) setlocale(LC_ALL
, "");
102 #if !defined(TEXT_DOMAIN)
103 #define TEXT_DOMAIN "SYS_TEST"
105 (void) textdomain(TEXT_DOMAIN
);
108 lc
= setlocale(LC_CTYPE
, (const char *)NULL
);
110 sprintf(tmps
, _LDTERM_DAT_PATH
, lc
);
112 fd
= open(tmps
, O_RDONLY
, 0);
114 if (read(fd
, (void *)&cswp
, sizeof (cswp
)) <
116 (void) fprintf(stderr
, gettext(
117 "cannot read entire %s file\n"), tmps
);
124 * If the ldterm.dat contains invalid data or
125 * the current locale name is too long, we clear
126 * the 'cswp' and flag the invalid ldterm.dat since
127 * we are not going to use the data.
129 if (cswp
.version
> LDTERM_DATA_VERSION
||
130 cswp
.codeset_type
< LDTERM_CS_TYPE_MIN
||
131 cswp
.codeset_type
> LDTERM_CS_TYPE_MAX
||
132 strlen(lc
) >= MAXNAMELEN
||
133 (cswp
.codeset_type
== LDTERM_CS_TYPE_EUC
&&
134 cswp
.csinfo_num
> LDTERM_CS_TYPE_EUC_MAX_SUBCS
) ||
135 (cswp
.codeset_type
== LDTERM_CS_TYPE_PCCS
&&
136 (cswp
.csinfo_num
< LDTERM_CS_TYPE_PCCS_MIN_SUBCS
||
137 cswp
.csinfo_num
> LDTERM_CS_TYPE_PCCS_MAX_SUBCS
))) {
138 (void) memset((void *)&cswp
, 0, sizeof (cswp
));
139 invalid_ldterm_dat_file
= 1;
141 (void) strcpy(cswp
.locale_name
, lc
);
149 if ((term
= get_ttymode(0, &ocb
, &cb
, &stio
, &termiox
, &winsize
162 if ((argc
== 2) && (argv
[1][0] == '-') && (argv
[1][2] == '\0'))
163 switch (argv
[1][1]) {
171 prmodes(); /* stty -- */
174 (void) fprintf(stderr
, gettext(
175 "usage: stty [-a| -g]\n"));
176 (void) fprintf(stderr
, gettext(
181 if ((argc
== 3) && (argv
[1][0] == '-') && (argv
[1][2] == '\0') &&
182 (argv
[2][0] == '-') && (argv
[2][1] == '-') && (argv
[2][2] == '\0'))
183 switch (argv
[1][1]) {
191 (void) fprintf(stderr
, gettext(
192 "usage: stty [-a| -g]\n"));
193 (void) fprintf(stderr
, gettext(
197 if ((argc
>= 3) && (argv
[1][0] == '-') && (argv
[1][1] == '-') &&
198 (argv
[1][2] == '\0')) {
203 if (s_arg
= sttyparse(argc
, argv
, term
, &ocb
, &cb
, &termiox
, &winsize
205 /* */, &wp
, &kwp
, &cswp
, &kcswp
210 for (i
= 0; not_supported
[i
]; i
++) {
211 if (strcmp(not_supported
[i
], s
) == 0) {
212 (void) fprintf(stderr
,
214 "mode not supported on this device: %s\n"),
219 (void) fprintf(stderr
, gettext("unknown mode: %s\n"), s_arg
);
223 if (set_ttymode(0, term
, &ocb
, &cb
, &stio
, &termiox
, &winsize
, &owinsize
225 /* */, &kwp
, &kcswp
, invalid_ldterm_dat_file
235 prmodes(void) /* print modes, no options, argc is 1 */
239 if (!(term
& ASYNC
)) {
242 (void) printf("iuclc ");
244 (void) printf("-iuclc ");
247 (void) printf("olcuc ");
249 (void) printf("-olcuc ");
251 (void) printf("tab3 ");
254 (void) printf("xcase ");
256 (void) printf("-xcase ");
258 (void) printf("stflush ");
260 (void) printf("-stflush ");
262 (void) printf("stwrap ");
264 (void) printf("-stwrap ");
266 (void) printf("stappl ");
268 (void) printf("-stappl ");
273 if ((term
& TERMIOS
) && cfgetispeed(&cb
) != 0 &&
274 cfgetispeed(&cb
) != cfgetospeed(&cb
)) {
275 prspeed("ispeed ", cfgetispeed(&cb
));
276 prspeed("ospeed ", cfgetospeed(&cb
));
278 prspeed("speed ", cfgetospeed(&cb
));
280 if ((m
&PAREXT
) && (term
& TERMIOS
)) {
282 (void) printf("markp ");
284 (void) printf("spacep ");
287 (void) printf("oddp ");
289 (void) printf("evenp ");
292 (void) printf("-parity ");
293 if (((m
&PARENB
) && !(m
&CS7
)) || (!(m
&PARENB
) && !(m
&CS8
)))
294 (void) printf("cs%c ", '5'+(m
&CSIZE
)/CS6
);
296 (void) printf("cstopb ");
298 (void) printf("hupcl ");
300 (void) printf("-cread ");
302 (void) printf("clocal ");
304 (void) printf("loblk ");
307 (void) printf(gettext("line = %d; "), ocb
.c_line
);
309 (void) printf(gettext("rows = %d; columns = %d;"),
310 winsize
.ws_row
, winsize
.ws_col
);
311 (void) printf(gettext(
312 " ypixels = %d; xpixels = %d;\n"),
313 winsize
.ws_ypixel
, winsize
.ws_xpixel
);
315 if ((cb
.c_lflag
&ICANON
) == 0)
316 (void) printf(gettext("min = %d; time = %d;\n"),
317 cb
.c_cc
[VMIN
], cb
.c_cc
[VTIME
]);
318 if (cb
.c_cc
[VINTR
] != CINTR
)
319 pit(cb
.c_cc
[VINTR
], "intr", "; ");
320 if (cb
.c_cc
[VQUIT
] != CQUIT
)
321 pit(cb
.c_cc
[VQUIT
], "quit", "; ");
322 if (cb
.c_cc
[VERASE
] != CERASE
)
323 pit(cb
.c_cc
[VERASE
], "erase", "; ");
324 if (term
& TERMIOS
) {
325 if (cb
.c_cc
[VERASE2
] != CERASE2
)
326 pit(cb
.c_cc
[VERASE
], "erase2", "; ");
328 if (cb
.c_cc
[VKILL
] != CKILL
)
329 pit(cb
.c_cc
[VKILL
], "kill", "; ");
330 if (cb
.c_cc
[VEOF
] != CEOF
)
331 pit(cb
.c_cc
[VEOF
], "eof", "; ");
332 if (cb
.c_cc
[VEOL
] != CNUL
)
333 pit(cb
.c_cc
[VEOL
], "eol", "; ");
334 if (cb
.c_cc
[VEOL2
] != CNUL
)
335 pit(cb
.c_cc
[VEOL2
], "eol2", "; ");
336 if (cb
.c_cc
[VSWTCH
] != CSWTCH
)
337 pit(cb
.c_cc
[VSWTCH
], "swtch", "; ");
338 if (term
& TERMIOS
) {
339 if (cb
.c_cc
[VSTART
] != CSTART
)
340 pit(cb
.c_cc
[VSTART
], "start", "; ");
341 if (cb
.c_cc
[VSTOP
] != CSTOP
)
342 pit(cb
.c_cc
[VSTOP
], "stop", "; ");
343 if (cb
.c_cc
[VSUSP
] != CSUSP
)
344 pit(cb
.c_cc
[VSUSP
], "susp", "; ");
345 if (cb
.c_cc
[VDSUSP
] != CDSUSP
)
346 pit(cb
.c_cc
[VDSUSP
], "dsusp", "; ");
347 if (cb
.c_cc
[VREPRINT
] != CRPRNT
)
348 pit(cb
.c_cc
[VREPRINT
], "rprnt", "; ");
349 if (cb
.c_cc
[VDISCARD
] != CFLUSH
)
350 pit(cb
.c_cc
[VDISCARD
], "flush", "; ");
351 if (cb
.c_cc
[VWERASE
] != CWERASE
)
352 pit(cb
.c_cc
[VWERASE
], "werase", "; ");
353 if (cb
.c_cc
[VLNEXT
] != CLNEXT
)
354 pit(cb
.c_cc
[VLNEXT
], "lnext", "; ");
355 if (cb
.c_cc
[VSTATUS
] != CSTATUS
)
356 pit(cb
.c_cc
[VSTATUS
], "status", "; ");
358 if (pitt
) (void) printf("\n");
361 (void) printf("ignbrk ");
363 (void) printf("brkint ");
365 (void) printf("-inpck ");
367 (void) printf("ignpar ");
369 (void) printf("parmrk ");
371 (void) printf("-istrip ");
373 (void) printf("inlcr ");
375 (void) printf("igncr ");
377 (void) printf("icrnl ");
379 (void) printf("iuclc ");
381 (void) printf("-ixon ");
383 (void) printf("-ixany ");
385 (void) printf("ixoff ");
386 if ((term
& TERMIOS
) && (m
&IMAXBEL
))
387 (void) printf("imaxbel ");
390 (void) printf("-opost ");
393 (void) printf("olcuc ");
395 (void) printf("onlcr ");
397 (void) printf("ocrnl ");
399 (void) printf("onocr ");
401 (void) printf("onlret ");
404 (void) printf("del-fill ");
406 (void) printf("nul-fill ");
407 delay((m
&CRDLY
)/CR1
, "cr");
408 delay((m
&NLDLY
)/NL1
, "nl");
409 delay((m
&TABDLY
)/TAB1
, "tab");
410 delay((m
&BSDLY
)/BS1
, "bs");
411 delay((m
&VTDLY
)/VT1
, "vt");
412 delay((m
&FFDLY
)/FF1
, "ff");
417 (void) printf("-isig ");
419 (void) printf("-icanon ");
421 (void) printf("xcase ");
422 (void) printf("-echo "+((m
&ECHO
) != 0));
423 (void) printf("-echoe "+((m
&ECHOE
) != 0));
424 (void) printf("-echok "+((m
&ECHOK
) != 0));
426 (void) printf("echonl ");
428 (void) printf("noflsh ");
430 (void) printf("tostop ");
432 (void) printf("echoctl ");
434 (void) printf("echoprt ");
436 (void) printf("echoke ");
438 (void) printf("defecho ");
440 (void) printf("flusho ");
442 (void) printf("pendin ");
444 (void) printf("iexten ");
450 (void) printf("rtsxoff ");
452 (void) printf("ctsxon ");
454 (void) printf("dtrxoff ");
456 (void) printf("cdxon ");
458 (void) printf("isxoff ");
460 switch (m
& XMTCLK
) {
461 case XCIBRG
: (void)printf("xcibrg ");
463 case XCTSET
: (void)printf("xctset ");
465 case XCRSET
: (void)printf("xcrset ");
468 switch (m
& RCVCLK
) {
469 case RCIBRG
: (void)printf("rcibrg ");
471 case RCTSET
: (void)printf("rctset ");
473 case RCRSET
: (void)printf("rcrset ");
476 switch (m
& TSETCLK
) {
477 case TSETCOFF
: (void)printf("tsetcoff ");
479 case TSETCRBRG
: (void)printf("tsetcrbrg ");
481 case TSETCTBRG
: (void)printf("tsetctbrg ");
483 case TSETCTSET
: (void)printf("tsetctset ");
485 case TSETCRSET
: (void)printf("tsetcrset ");
488 switch (m
& RSETCLK
) {
489 case RSETCOFF
: (void)printf("rsetcoff ");
491 case RSETCRBRG
: (void)printf("rsetcrbrg ");
493 case RSETCTBRG
: (void)printf("rsetctbrg ");
495 case RSETCTSET
: (void)printf("rsetctset ");
497 case RSETCRSET
: (void)printf("rsetcrset ");
504 pramodes(void) /* print all modes, -a option */
510 if ((term
& TERMIOS
) && cfgetispeed(&cb
) != 0 &&
511 cfgetispeed(&cb
) != cfgetospeed(&cb
)) {
512 prspeed("ispeed ", cfgetispeed(&cb
));
513 prspeed("ospeed ", cfgetospeed(&cb
));
515 prspeed("speed ", cfgetospeed(&cb
));
516 if (!(term
& TERMIOS
))
517 (void) printf(gettext("line = %d; "), ocb
.c_line
);
520 (void) printf(gettext("rows = %d; columns = %d;"),
521 winsize
.ws_row
, winsize
.ws_col
);
522 (void) printf(gettext(
523 " ypixels = %d; xpixels = %d;\n"),
524 winsize
.ws_ypixel
, winsize
.ws_xpixel
);
527 if ((term
& CSIW
) && kcswp
.locale_name
[0]) {
528 (void) printf("csdata %s\n", kcswp
.locale_name
);
530 (void) printf("csdata ?\n");
533 * If kwp.eucw[0] is zero, it means the current codeset type
534 * in the ldterm is not EUC.
536 if ((term
& EUCW
) && kwp
.eucw
[0]) {
537 (void) printf("eucw %d:%d:%d:%d, ", kwp
.eucw
[0],
538 kwp
.eucw
[1], kwp
.eucw
[2], kwp
.eucw
[3]);
539 (void) printf("scrw %d:%d:%d:%d\n", kwp
.scrw
[0],
540 kwp
.scrw
[1], kwp
.scrw
[2], kwp
.scrw
[3]);
542 (void) printf("eucw ?, scrw ?\n");
544 if ((cb
.c_lflag
&ICANON
) == 0)
545 (void) printf(gettext("min = %d; time = %d;\n"),
546 cb
.c_cc
[VMIN
], cb
.c_cc
[VTIME
]);
547 pit(cb
.c_cc
[VINTR
], "intr", "; ");
548 pit(cb
.c_cc
[VQUIT
], "quit", "; ");
549 pit(cb
.c_cc
[VERASE
], "erase", "; ");
551 pit(cb
.c_cc
[VERASE2
], "erase2", "; ");
552 pit(cb
.c_cc
[VKILL
], "kill", ";\n");
553 pit(cb
.c_cc
[VEOF
], "eof", "; ");
554 pit(cb
.c_cc
[VEOL
], "eol", "; ");
555 pit(cb
.c_cc
[VEOL2
], "eol2", "; ");
556 pit(cb
.c_cc
[VSWTCH
], "swtch", ";\n");
557 if (term
& TERMIOS
) {
558 pit(cb
.c_cc
[VSTART
], "start", "; ");
559 pit(cb
.c_cc
[VSTOP
], "stop", "; ");
560 pit(cb
.c_cc
[VSUSP
], "susp", "; ");
561 pit(cb
.c_cc
[VDSUSP
], "dsusp", ";\n");
562 pit(cb
.c_cc
[VREPRINT
], "rprnt", "; ");
563 pit(cb
.c_cc
[VDISCARD
], "flush", "; ");
564 pit(cb
.c_cc
[VWERASE
], "werase", "; ");
565 pit(cb
.c_cc
[VLNEXT
], "lnext", ";\n");
566 pit(cb
.c_cc
[VSTATUS
], "status", ";\n");
569 pit((unsigned)stio
.tab
, "ctab", "\n");
571 (void) printf("-parenb "+((m
&PARENB
) != 0));
572 (void) printf("-parodd "+((m
&PARODD
) != 0));
573 (void) printf("cs%c ", '5'+(m
&CSIZE
)/CS6
);
574 (void) printf("-cstopb "+((m
&CSTOPB
) != 0));
575 (void) printf("-hupcl "+((m
&HUPCL
) != 0));
576 (void) printf("-cread "+((m
&CREAD
) != 0));
577 (void) printf("-clocal "+((m
&CLOCAL
) != 0));
579 (void) printf("-loblk "+((m
&LOBLK
) != 0));
580 (void) printf("-crtscts "+((m
&CRTSCTS
) != 0));
581 (void) printf("-crtsxoff "+((m
&CRTSXOFF
) != 0));
583 (void) printf("-parext "+((m
&PAREXT
) != 0));
587 (void) printf("-ignbrk "+((m
&IGNBRK
) != 0));
588 (void) printf("-brkint "+((m
&BRKINT
) != 0));
589 (void) printf("-ignpar "+((m
&IGNPAR
) != 0));
590 (void) printf("-parmrk "+((m
&PARMRK
) != 0));
591 (void) printf("-inpck "+((m
&INPCK
) != 0));
592 (void) printf("-istrip "+((m
&ISTRIP
) != 0));
593 (void) printf("-inlcr "+((m
&INLCR
) != 0));
594 (void) printf("-igncr "+((m
&IGNCR
) != 0));
595 (void) printf("-icrnl "+((m
&ICRNL
) != 0));
596 (void) printf("-iuclc "+((m
&IUCLC
) != 0));
598 (void) printf("-ixon "+((m
&IXON
) != 0));
599 (void) printf("-ixany "+((m
&IXANY
) != 0));
600 (void) printf("-ixoff "+((m
&IXOFF
) != 0));
602 (void) printf("-imaxbel "+((m
&IMAXBEL
) != 0));
605 (void) printf("-isig "+((m
&ISIG
) != 0));
606 (void) printf("-icanon "+((m
&ICANON
) != 0));
607 (void) printf("-xcase "+((m
&XCASE
) != 0));
608 (void) printf("-echo "+((m
&ECHO
) != 0));
609 (void) printf("-echoe "+((m
&ECHOE
) != 0));
610 (void) printf("-echok "+((m
&ECHOK
) != 0));
611 (void) printf("-echonl "+((m
&ECHONL
) != 0));
612 (void) printf("-noflsh "+((m
&NOFLSH
) != 0));
613 if (term
& TERMIOS
) {
615 (void) printf("-tostop "+((m
&TOSTOP
) != 0));
616 (void) printf("-echoctl "+((m
&ECHOCTL
) != 0));
617 (void) printf("-echoprt "+((m
&ECHOPRT
) != 0));
618 (void) printf("-echoke "+((m
&ECHOKE
) != 0));
619 (void) printf("-defecho "+((m
&DEFECHO
) != 0));
620 (void) printf("-flusho "+((m
&FLUSHO
) != 0));
621 (void) printf("-pendin "+((m
&PENDIN
) != 0));
622 (void) printf("-iexten "+((m
&IEXTEN
) != 0));
624 if (!(term
& ASYNC
)) {
625 (void) printf("-stflush "+((m
&STFLUSH
) != 0));
626 (void) printf("-stwrap "+((m
&STWRAP
) != 0));
627 (void) printf("-stappl "+((m
&STAPPL
) != 0));
631 (void) printf("-opost "+((m
&OPOST
) != 0));
632 (void) printf("-olcuc "+((m
&OLCUC
) != 0));
633 (void) printf("-onlcr "+((m
&ONLCR
) != 0));
634 (void) printf("-ocrnl "+((m
&OCRNL
) != 0));
635 (void) printf("-onocr "+((m
&ONOCR
) != 0));
636 (void) printf("-onlret "+((m
&ONLRET
) != 0));
637 (void) printf("-ofill "+((m
&OFILL
) != 0));
638 (void) printf("-ofdel "+((m
&OFDEL
) != 0));
639 delay((m
&CRDLY
)/CR1
, "cr");
640 delay((m
&NLDLY
)/NL1
, "nl");
641 delay((m
&TABDLY
)/TAB1
, "tab");
642 delay((m
&BSDLY
)/BS1
, "bs");
643 delay((m
&VTDLY
)/VT1
, "vt");
644 delay((m
&FFDLY
)/FF1
, "ff");
648 (void) printf("-rtsxoff "+((m
&RTSXOFF
) != 0));
649 (void) printf("-ctsxon "+((m
&CTSXON
) != 0));
650 (void) printf("-dtrxoff "+((m
&DTRXOFF
) != 0));
651 (void) printf("-cdxon "+((m
&CDXON
) != 0));
652 (void) printf("-isxoff "+((m
&ISXOFF
) != 0));
654 switch (m
& XMTCLK
) {
655 case XCIBRG
: (void)printf("xcibrg ");
657 case XCTSET
: (void)printf("xctset ");
659 case XCRSET
: (void)printf("xcrset ");
662 switch (m
& RCVCLK
) {
663 case RCIBRG
: (void)printf("rcibrg ");
665 case RCTSET
: (void)printf("rctset ");
667 case RCRSET
: (void)printf("rcrset ");
670 switch (m
& TSETCLK
) {
671 case TSETCOFF
: (void)printf("tsetcoff ");
673 case TSETCRBRG
: (void)printf("tsetcrbrg ");
675 case TSETCTBRG
: (void)printf("tsetctbrg ");
677 case TSETCTSET
: (void)printf("tsetctset ");
679 case TSETCRSET
: (void)printf("tsetcrset ");
682 switch (m
& RSETCLK
) {
683 case RSETCOFF
: (void)printf("rsetcoff ");
685 case RSETCRBRG
: (void)printf("rsetcrbrg ");
687 case RSETCTBRG
: (void)printf("rsetctbrg ");
689 case RSETCTSET
: (void)printf("rsetctset ");
691 case RSETCRSET
: (void)printf("rsetcrset ");
697 /* print function for prmodes() and pramodes() */
699 pit(unsigned char what
, char *itsname
, char *sep
)
703 (void) printf("%s", itsname
);
704 if ((term
& TERMIOS
) && what
== _POSIX_VDISABLE
||
705 !(term
& TERMIOS
) && what
== 0200) {
706 (void) printf(" = <undef>%s", sep
);
709 (void) printf(" = ");
710 if (what
& 0200 && !isprint(what
)) {
715 (void) printf("^?%s", sep
);
717 } else if (what
< ' ') {
723 (void) printf("%c%s", what
, sep
);
727 delay(int m
, char *s
)
730 (void) printf("%s%d ", s
, m
);
734 prspeed(char *c
, int scode
)
739 for (i
= 0; speeds
[i
].string
; i
++) {
740 if (speeds
[i
].code
== scode
) {
741 sval
= speeds
[i
].value
;
746 (void) printf("%s%d baud; ", c
, sval
);
749 /* print current settings for use with */
751 prencode(void) /* another stty cmd, used for -g option */
756 * Although there are only 16 control chars defined as of April 1995,
757 * prencode() and encode() will not have to be changed if up to MAX_CC
758 * control chars are defined in the future. A maximum of MAX_CC rather
759 * than NCCS control chars are printed because the last control slot
760 * is unused. "stty -g" prints out a total of NUM_FIELDS fields
761 * (NUM_MODES modes + MAX_CC control chars). First print the input,
762 * output, control, and line discipline modes.
764 (void) printf("%x:%x:%x:%x", cb
.c_iflag
, cb
.c_oflag
, cb
.c_cflag
,
767 /* Print the control character fields. */
774 for (i
= 0; i
< MAX_CC
; i
++)
775 (void) printf(":%x", (i
>= last
) ? 0 : cb
.c_cc
[i
]);
777 * Print out ldterm_cs_data_user_t data fields for
778 * PSARC/1999/140 TCR2. This change introduces additional
779 * 44 fields that come from the ldterm_cs_data_user_t data
782 (void) printf(":%x:%x:%x:", kcswp
.version
, kcswp
.codeset_type
,
784 if (*kcswp
.locale_name
== '\0') {
787 for (i
= 0; kcswp
.locale_name
[i
] && i
< MAXNAMELEN
; i
++)
788 (void) printf("%02x", kcswp
.locale_name
[i
]);
790 for (i
= 0; i
< LDTERM_CS_MAX_CODESETS
; i
++)
791 (void) printf(":%x:%x:%x:%x",
792 kcswp
.eucpc_data
[i
].byte_length
,
793 kcswp
.eucpc_data
[i
].screen_width
,
794 kcswp
.eucpc_data
[i
].msb_start
,
795 kcswp
.eucpc_data
[i
].msb_end
);
798 for (i
= 0; i
< last
; i
++)
799 (void) printf(":%x", cb
.c_cc
[i
]);