17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*19d32b9aSRobert Mustacchi * Copyright (c) 2014, Joyent, Inc. All rights reserved. 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate /* 297c478bd9Sstevel@tonic-gate * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T 307c478bd9Sstevel@tonic-gate * All Rights Reserved 317c478bd9Sstevel@tonic-gate * 327c478bd9Sstevel@tonic-gate */ 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <stdio.h> 357c478bd9Sstevel@tonic-gate #include <unistd.h> 367c478bd9Sstevel@tonic-gate #include <stdlib.h> 377c478bd9Sstevel@tonic-gate #include <libintl.h> 387c478bd9Sstevel@tonic-gate #include <sys/types.h> 397c478bd9Sstevel@tonic-gate #include <ctype.h> 407c478bd9Sstevel@tonic-gate #include <termio.h> 417c478bd9Sstevel@tonic-gate #include <sys/stermio.h> 427c478bd9Sstevel@tonic-gate #include <sys/termiox.h> 437c478bd9Sstevel@tonic-gate #ifdef EUC 447c478bd9Sstevel@tonic-gate #include <sys/param.h> 457c478bd9Sstevel@tonic-gate #include <sys/stropts.h> 467c478bd9Sstevel@tonic-gate #include <sys/eucioctl.h> 477c478bd9Sstevel@tonic-gate #include <sys/csiioctl.h> 487c478bd9Sstevel@tonic-gate #include <sys/stream.h> 497c478bd9Sstevel@tonic-gate #include <sys/termios.h> 507c478bd9Sstevel@tonic-gate #include <sys/ldterm.h> 517c478bd9Sstevel@tonic-gate #include <getwidth.h> 527c478bd9Sstevel@tonic-gate #endif /* EUC */ 537c478bd9Sstevel@tonic-gate #include "stty.h" 547c478bd9Sstevel@tonic-gate #include <locale.h> 557c478bd9Sstevel@tonic-gate #include <string.h> 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate static char *s_arg; /* s_arg: ptr to mode to be set */ 587c478bd9Sstevel@tonic-gate static int match; 597c478bd9Sstevel@tonic-gate #ifdef EUC 607c478bd9Sstevel@tonic-gate static int parse_encoded(struct termios *, ldterm_cs_data_user_t *, int); 617c478bd9Sstevel@tonic-gate #else 627c478bd9Sstevel@tonic-gate static int parse_encoded(struct termios *); 637c478bd9Sstevel@tonic-gate #endif /* EUC */ 647c478bd9Sstevel@tonic-gate static int eq(const char *string); 657c478bd9Sstevel@tonic-gate static int gct(char *cp, int term); 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate /* set terminal modes for supplied options */ 687c478bd9Sstevel@tonic-gate char * 697c478bd9Sstevel@tonic-gate sttyparse(int argc, char *argv[], int term, struct termio *ocb, 707c478bd9Sstevel@tonic-gate struct termios *cb, struct termiox *termiox, struct winsize *winsize 717c478bd9Sstevel@tonic-gate #ifdef EUC 727c478bd9Sstevel@tonic-gate /* */, eucwidth_t *wp, struct eucioc *kwp, ldterm_cs_data_user_t *cswp, 737c478bd9Sstevel@tonic-gate ldterm_cs_data_user_t *kcswp 747c478bd9Sstevel@tonic-gate #endif /* EUC */ 757c478bd9Sstevel@tonic-gate /* */) 767c478bd9Sstevel@tonic-gate { 777c478bd9Sstevel@tonic-gate int i; 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate while (--argc > 0) { 807c478bd9Sstevel@tonic-gate s_arg = *++argv; 817c478bd9Sstevel@tonic-gate match = 0; 827c478bd9Sstevel@tonic-gate if (term & ASYNC) { 837c478bd9Sstevel@tonic-gate if (eq("erase") && --argc) 847c478bd9Sstevel@tonic-gate cb->c_cc[VERASE] = gct(*++argv, term); 857c478bd9Sstevel@tonic-gate else if (eq("intr") && --argc) 867c478bd9Sstevel@tonic-gate cb->c_cc[VINTR] = gct(*++argv, term); 877c478bd9Sstevel@tonic-gate else if (eq("quit") && --argc) 887c478bd9Sstevel@tonic-gate cb->c_cc[VQUIT] = gct(*++argv, term); 897c478bd9Sstevel@tonic-gate else if (eq("eof") && --argc) 907c478bd9Sstevel@tonic-gate cb->c_cc[VEOF] = gct(*++argv, term); 917c478bd9Sstevel@tonic-gate else if (eq("min") && --argc) { 927c478bd9Sstevel@tonic-gate if (isdigit((unsigned char)argv[1][0])) 937c478bd9Sstevel@tonic-gate cb->c_cc[VMIN] = atoi(*++argv); 947c478bd9Sstevel@tonic-gate else 957c478bd9Sstevel@tonic-gate cb->c_cc[VMIN] = gct(*++argv, term); 967c478bd9Sstevel@tonic-gate } else if (eq("eol") && --argc) 977c478bd9Sstevel@tonic-gate cb->c_cc[VEOL] = gct(*++argv, term); 987c478bd9Sstevel@tonic-gate else if (eq("eol2") && --argc) 997c478bd9Sstevel@tonic-gate cb->c_cc[VEOL2] = gct(*++argv, term); 1007c478bd9Sstevel@tonic-gate else if (eq("time") && --argc) { 1017c478bd9Sstevel@tonic-gate if (isdigit((unsigned char)argv[1][0])) 1027c478bd9Sstevel@tonic-gate cb->c_cc[VTIME] = atoi(*++argv); 1037c478bd9Sstevel@tonic-gate else 1047c478bd9Sstevel@tonic-gate cb->c_cc[VTIME] = gct(*++argv, term); 1057c478bd9Sstevel@tonic-gate } else if (eq("kill") && --argc) 1067c478bd9Sstevel@tonic-gate cb->c_cc[VKILL] = gct(*++argv, term); 1077c478bd9Sstevel@tonic-gate else if (eq("swtch") && --argc) 1087c478bd9Sstevel@tonic-gate cb->c_cc[VSWTCH] = gct(*++argv, term); 1097c478bd9Sstevel@tonic-gate if (match) 1107c478bd9Sstevel@tonic-gate continue; 1117c478bd9Sstevel@tonic-gate if (term & TERMIOS) { 1127c478bd9Sstevel@tonic-gate if (eq("start") && --argc) 1137c478bd9Sstevel@tonic-gate cb->c_cc[VSTART] = gct(*++argv, term); 1147c478bd9Sstevel@tonic-gate else if (eq("stop") && --argc) 1157c478bd9Sstevel@tonic-gate cb->c_cc[VSTOP] = gct(*++argv, term); 1167c478bd9Sstevel@tonic-gate else if (eq("susp") && --argc) 1177c478bd9Sstevel@tonic-gate cb->c_cc[VSUSP] = gct(*++argv, term); 1187c478bd9Sstevel@tonic-gate else if (eq("dsusp") && --argc) 1197c478bd9Sstevel@tonic-gate cb->c_cc[VDSUSP] = gct(*++argv, term); 1207c478bd9Sstevel@tonic-gate else if (eq("rprnt") && --argc) 1217c478bd9Sstevel@tonic-gate cb->c_cc[VREPRINT] = gct(*++argv, term); 1227c478bd9Sstevel@tonic-gate else if (eq("reprint") && --argc) 1237c478bd9Sstevel@tonic-gate cb->c_cc[VREPRINT] = gct(*++argv, term); 1247c478bd9Sstevel@tonic-gate else if (eq("discard") && --argc) 1257c478bd9Sstevel@tonic-gate cb->c_cc[VDISCARD] = gct(*++argv, term); 1267c478bd9Sstevel@tonic-gate else if (eq("flush") && --argc) 1277c478bd9Sstevel@tonic-gate cb->c_cc[VDISCARD] = gct(*++argv, term); 1287c478bd9Sstevel@tonic-gate else if (eq("werase") && --argc) 1297c478bd9Sstevel@tonic-gate cb->c_cc[VWERASE] = gct(*++argv, term); 1307c478bd9Sstevel@tonic-gate else if (eq("lnext") && --argc) 1317c478bd9Sstevel@tonic-gate cb->c_cc[VLNEXT] = gct(*++argv, term); 132*19d32b9aSRobert Mustacchi else if (eq("status") && --argc) 133*19d32b9aSRobert Mustacchi cb->c_cc[VSTATUS] = gct(*++argv, term); 1347c478bd9Sstevel@tonic-gate } 1357c478bd9Sstevel@tonic-gate if (match) 1367c478bd9Sstevel@tonic-gate continue; 1377c478bd9Sstevel@tonic-gate if (eq("ek")) { 1387c478bd9Sstevel@tonic-gate cb->c_cc[VERASE] = CERASE; 1397c478bd9Sstevel@tonic-gate cb->c_cc[VKILL] = CKILL; 1407c478bd9Sstevel@tonic-gate } else if (eq("line") && 1417c478bd9Sstevel@tonic-gate !(term & TERMIOS) && --argc) { 1427c478bd9Sstevel@tonic-gate ocb->c_line = atoi(*++argv); 1437c478bd9Sstevel@tonic-gate continue; 1447c478bd9Sstevel@tonic-gate } else if (eq("raw")) { 1457c478bd9Sstevel@tonic-gate cb->c_cc[VMIN] = 1; 1467c478bd9Sstevel@tonic-gate cb->c_cc[VTIME] = 0; 1477c478bd9Sstevel@tonic-gate } else if (eq("-raw") | eq("cooked")) { 1487c478bd9Sstevel@tonic-gate cb->c_cc[VEOF] = CEOF; 1497c478bd9Sstevel@tonic-gate cb->c_cc[VEOL] = CNUL; 1507c478bd9Sstevel@tonic-gate } else if (eq("sane")) { 1517c478bd9Sstevel@tonic-gate cb->c_cc[VERASE] = CERASE; 1527c478bd9Sstevel@tonic-gate cb->c_cc[VKILL] = CKILL; 1537c478bd9Sstevel@tonic-gate cb->c_cc[VQUIT] = CQUIT; 1547c478bd9Sstevel@tonic-gate cb->c_cc[VINTR] = CINTR; 1557c478bd9Sstevel@tonic-gate cb->c_cc[VEOF] = CEOF; 1567c478bd9Sstevel@tonic-gate cb->c_cc[VEOL] = CNUL; 157*19d32b9aSRobert Mustacchi cb->c_cc[VSTATUS] = CSTATUS; 1587c478bd9Sstevel@tonic-gate /* SWTCH purposely not set */ 1597c478bd9Sstevel@tonic-gate #ifdef EUC 1607c478bd9Sstevel@tonic-gate } else if (eq("defeucw")) { 1617c478bd9Sstevel@tonic-gate kwp->eucw[0] = '\001'; 1627c478bd9Sstevel@tonic-gate kwp->eucw[1] = 1637c478bd9Sstevel@tonic-gate (unsigned char)(wp->_eucw1 & 0177); 1647c478bd9Sstevel@tonic-gate kwp->eucw[2] = 1657c478bd9Sstevel@tonic-gate (unsigned char)(wp->_eucw2 & 0177); 1667c478bd9Sstevel@tonic-gate kwp->eucw[3] = 1677c478bd9Sstevel@tonic-gate (unsigned char)(wp->_eucw3 & 0177); 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate kwp->scrw[0] = '\001'; 1707c478bd9Sstevel@tonic-gate kwp->scrw[1] = 1717c478bd9Sstevel@tonic-gate (unsigned char)(wp->_scrw1 & 0177); 1727c478bd9Sstevel@tonic-gate kwp->scrw[2] = 1737c478bd9Sstevel@tonic-gate (unsigned char)(wp->_scrw2 & 0177); 1747c478bd9Sstevel@tonic-gate kwp->scrw[3] = 1757c478bd9Sstevel@tonic-gate (unsigned char)(wp->_scrw3 & 0177); 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate (void) memcpy((void *)kcswp, (const void *)cswp, 1787c478bd9Sstevel@tonic-gate sizeof (ldterm_cs_data_user_t)); 1797c478bd9Sstevel@tonic-gate #endif /* EUC */ 1807c478bd9Sstevel@tonic-gate } else if ((term & TERMIOS) && eq("ospeed") && --argc) { 1817c478bd9Sstevel@tonic-gate s_arg = *++argv; 1827c478bd9Sstevel@tonic-gate for (match = 0, i = 0; speeds[i].string; i++) { 1837c478bd9Sstevel@tonic-gate if (eq(speeds[i].string)) { 1847c478bd9Sstevel@tonic-gate (void) cfsetospeed(cb, 1857c478bd9Sstevel@tonic-gate speeds[i].code); 1867c478bd9Sstevel@tonic-gate break; 1877c478bd9Sstevel@tonic-gate } 1887c478bd9Sstevel@tonic-gate } 1897c478bd9Sstevel@tonic-gate if (!match) 1907c478bd9Sstevel@tonic-gate return (s_arg); 1917c478bd9Sstevel@tonic-gate continue; 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate } else if ((term & TERMIOS) && eq("ispeed") && --argc) { 1947c478bd9Sstevel@tonic-gate s_arg = *++argv; 1957c478bd9Sstevel@tonic-gate for (match = 0, i = 0; speeds[i].string; i++) { 1967c478bd9Sstevel@tonic-gate if (eq(speeds[i].string)) { 1977c478bd9Sstevel@tonic-gate (void) cfsetispeed(cb, 1987c478bd9Sstevel@tonic-gate speeds[i].code); 1997c478bd9Sstevel@tonic-gate break; 2007c478bd9Sstevel@tonic-gate } 2017c478bd9Sstevel@tonic-gate } 2027c478bd9Sstevel@tonic-gate if (!match) 2037c478bd9Sstevel@tonic-gate return (s_arg); 2047c478bd9Sstevel@tonic-gate continue; 2057c478bd9Sstevel@tonic-gate 2067c478bd9Sstevel@tonic-gate } else { 2077c478bd9Sstevel@tonic-gate for (match = 0, i = 0; speeds[i].string; i++) { 2087c478bd9Sstevel@tonic-gate if (eq(speeds[i].string)) { 2097c478bd9Sstevel@tonic-gate (void) cfsetospeed(cb, 2107c478bd9Sstevel@tonic-gate speeds[i].code); 2117c478bd9Sstevel@tonic-gate (void) cfsetispeed(cb, 2127c478bd9Sstevel@tonic-gate speeds[i].code); 2137c478bd9Sstevel@tonic-gate break; 2147c478bd9Sstevel@tonic-gate } 2157c478bd9Sstevel@tonic-gate } 2167c478bd9Sstevel@tonic-gate } 2177c478bd9Sstevel@tonic-gate } 2187c478bd9Sstevel@tonic-gate if (!(term & ASYNC) && eq("ctab") && --argc) { 2197c478bd9Sstevel@tonic-gate cb->c_cc[7] = gct(*++argv, term); 2207c478bd9Sstevel@tonic-gate continue; 2217c478bd9Sstevel@tonic-gate } 2227c478bd9Sstevel@tonic-gate 2237c478bd9Sstevel@tonic-gate for (i = 0; imodes[i].string; i++) 2247c478bd9Sstevel@tonic-gate if (eq(imodes[i].string)) { 2257c478bd9Sstevel@tonic-gate cb->c_iflag &= ~imodes[i].reset; 2267c478bd9Sstevel@tonic-gate cb->c_iflag |= imodes[i].set; 2277c478bd9Sstevel@tonic-gate #ifdef EUC 2287c478bd9Sstevel@tonic-gate if (wp->_multibyte && 2297c478bd9Sstevel@tonic-gate (eq("-raw") || eq("cooked") || eq("sane"))) 2307c478bd9Sstevel@tonic-gate cb->c_iflag &= ~ISTRIP; 2317c478bd9Sstevel@tonic-gate #endif /* EUC */ 2327c478bd9Sstevel@tonic-gate } 2337c478bd9Sstevel@tonic-gate if (term & TERMIOS) { 2347c478bd9Sstevel@tonic-gate for (i = 0; nimodes[i].string; i++) 2357c478bd9Sstevel@tonic-gate if (eq(nimodes[i].string)) { 2367c478bd9Sstevel@tonic-gate cb->c_iflag &= ~nimodes[i].reset; 2377c478bd9Sstevel@tonic-gate cb->c_iflag |= nimodes[i].set; 2387c478bd9Sstevel@tonic-gate } 2397c478bd9Sstevel@tonic-gate } 2407c478bd9Sstevel@tonic-gate 2417c478bd9Sstevel@tonic-gate for (i = 0; omodes[i].string; i++) 2427c478bd9Sstevel@tonic-gate if (eq(omodes[i].string)) { 2437c478bd9Sstevel@tonic-gate cb->c_oflag &= ~omodes[i].reset; 2447c478bd9Sstevel@tonic-gate cb->c_oflag |= omodes[i].set; 2457c478bd9Sstevel@tonic-gate } 2467c478bd9Sstevel@tonic-gate if (!(term & ASYNC) && eq("sane")) { 2477c478bd9Sstevel@tonic-gate cb->c_oflag |= TAB3; 2487c478bd9Sstevel@tonic-gate continue; 2497c478bd9Sstevel@tonic-gate } 2507c478bd9Sstevel@tonic-gate for (i = 0; cmodes[i].string; i++) 2517c478bd9Sstevel@tonic-gate if (eq(cmodes[i].string)) { 2527c478bd9Sstevel@tonic-gate cb->c_cflag &= ~cmodes[i].reset; 2537c478bd9Sstevel@tonic-gate cb->c_cflag |= cmodes[i].set; 2547c478bd9Sstevel@tonic-gate #ifdef EUC 2557c478bd9Sstevel@tonic-gate if (wp->_multibyte && 256*19d32b9aSRobert Mustacchi (eq("-raw") || eq("cooked") || 257*19d32b9aSRobert Mustacchi eq("sane"))) { 2587c478bd9Sstevel@tonic-gate cb->c_cflag &= ~(CS7|PARENB); 2597c478bd9Sstevel@tonic-gate cb->c_cflag |= CS8; 2607c478bd9Sstevel@tonic-gate } 2617c478bd9Sstevel@tonic-gate #endif /* EUC */ 2627c478bd9Sstevel@tonic-gate } 2637c478bd9Sstevel@tonic-gate if (term & TERMIOS) 2647c478bd9Sstevel@tonic-gate for (i = 0; ncmodes[i].string; i++) 2657c478bd9Sstevel@tonic-gate if (eq(ncmodes[i].string)) { 2667c478bd9Sstevel@tonic-gate cb->c_cflag &= ~ncmodes[i].reset; 2677c478bd9Sstevel@tonic-gate cb->c_cflag |= ncmodes[i].set; 2687c478bd9Sstevel@tonic-gate } 2697c478bd9Sstevel@tonic-gate for (i = 0; lmodes[i].string; i++) 2707c478bd9Sstevel@tonic-gate if (eq(lmodes[i].string)) { 2717c478bd9Sstevel@tonic-gate cb->c_lflag &= ~lmodes[i].reset; 2727c478bd9Sstevel@tonic-gate cb->c_lflag |= lmodes[i].set; 2737c478bd9Sstevel@tonic-gate } 2747c478bd9Sstevel@tonic-gate if (term & TERMIOS) 2757c478bd9Sstevel@tonic-gate for (i = 0; nlmodes[i].string; i++) 2767c478bd9Sstevel@tonic-gate if (eq(nlmodes[i].string)) { 2777c478bd9Sstevel@tonic-gate cb->c_lflag &= ~nlmodes[i].reset; 2787c478bd9Sstevel@tonic-gate cb->c_lflag |= nlmodes[i].set; 2797c478bd9Sstevel@tonic-gate } 2807c478bd9Sstevel@tonic-gate if (term & FLOW) { 2817c478bd9Sstevel@tonic-gate for (i = 0; hmodes[i].string; i++) 2827c478bd9Sstevel@tonic-gate if (eq(hmodes[i].string)) { 2837c478bd9Sstevel@tonic-gate termiox->x_hflag &= ~hmodes[i].reset; 2847c478bd9Sstevel@tonic-gate termiox->x_hflag |= hmodes[i].set; 2857c478bd9Sstevel@tonic-gate } 2867c478bd9Sstevel@tonic-gate for (i = 0; clkmodes[i].string; i++) 2877c478bd9Sstevel@tonic-gate if (eq(clkmodes[i].string)) { 2887c478bd9Sstevel@tonic-gate termiox->x_cflag &= ~clkmodes[i].reset; 2897c478bd9Sstevel@tonic-gate termiox->x_cflag |= clkmodes[i].set; 2907c478bd9Sstevel@tonic-gate } 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate } 2937c478bd9Sstevel@tonic-gate 2947c478bd9Sstevel@tonic-gate if (eq("rows") && --argc) 2957c478bd9Sstevel@tonic-gate winsize->ws_row = atoi(*++argv); 2967c478bd9Sstevel@tonic-gate else if ((eq("columns") || eq("cols")) && --argc) 2977c478bd9Sstevel@tonic-gate winsize->ws_col = atoi(*++argv); 2987c478bd9Sstevel@tonic-gate else if (eq("xpixels") && --argc) 2997c478bd9Sstevel@tonic-gate winsize->ws_xpixel = atoi(*++argv); 3007c478bd9Sstevel@tonic-gate else if (eq("ypixels") && --argc) 3017c478bd9Sstevel@tonic-gate winsize->ws_ypixel = atoi(*++argv); 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate if (!match) { 3047c478bd9Sstevel@tonic-gate #ifdef EUC 3057c478bd9Sstevel@tonic-gate if (!parse_encoded(cb, kcswp, term)) { 3067c478bd9Sstevel@tonic-gate #else 3077c478bd9Sstevel@tonic-gate if (!parse_encoded(cb)) { 3087c478bd9Sstevel@tonic-gate #endif /* EUC */ 3097c478bd9Sstevel@tonic-gate return (s_arg); /* parsing failed */ 3107c478bd9Sstevel@tonic-gate } 3117c478bd9Sstevel@tonic-gate } 3127c478bd9Sstevel@tonic-gate } 3137c478bd9Sstevel@tonic-gate return ((char *)0); 3147c478bd9Sstevel@tonic-gate } 3157c478bd9Sstevel@tonic-gate 3167c478bd9Sstevel@tonic-gate static int 3177c478bd9Sstevel@tonic-gate eq(const char *string) 3187c478bd9Sstevel@tonic-gate { 3197c478bd9Sstevel@tonic-gate int i; 3207c478bd9Sstevel@tonic-gate 3217c478bd9Sstevel@tonic-gate if (!s_arg) 3227c478bd9Sstevel@tonic-gate return (0); 3237c478bd9Sstevel@tonic-gate i = 0; 3247c478bd9Sstevel@tonic-gate loop: 3257c478bd9Sstevel@tonic-gate if (s_arg[i] != string[i]) 3267c478bd9Sstevel@tonic-gate return (0); 3277c478bd9Sstevel@tonic-gate if (s_arg[i++] != '\0') 3287c478bd9Sstevel@tonic-gate goto loop; 3297c478bd9Sstevel@tonic-gate match++; 3307c478bd9Sstevel@tonic-gate return (1); 3317c478bd9Sstevel@tonic-gate } 3327c478bd9Sstevel@tonic-gate 3337c478bd9Sstevel@tonic-gate /* get pseudo control characters from terminal */ 3347c478bd9Sstevel@tonic-gate /* and convert to internal representation */ 3357c478bd9Sstevel@tonic-gate static int 3367c478bd9Sstevel@tonic-gate gct(char *cp, int term) 3377c478bd9Sstevel@tonic-gate { 3387c478bd9Sstevel@tonic-gate int c; 3397c478bd9Sstevel@tonic-gate 3407c478bd9Sstevel@tonic-gate c = *cp; 3417c478bd9Sstevel@tonic-gate if (c == '^') { 3427c478bd9Sstevel@tonic-gate c = *++cp; 3437c478bd9Sstevel@tonic-gate if (c == '?') 3447c478bd9Sstevel@tonic-gate c = 0177; /* map '^?' to 0177 */ 3457c478bd9Sstevel@tonic-gate else if (c == '-') { 3467c478bd9Sstevel@tonic-gate /* map '^-' to undefined */ 3477c478bd9Sstevel@tonic-gate c = (term & TERMIOS) ? _POSIX_VDISABLE : 0200; 3487c478bd9Sstevel@tonic-gate } else 3497c478bd9Sstevel@tonic-gate c &= 037; 3507c478bd9Sstevel@tonic-gate } else if (strcmp(cp, "undef") == 0) { 3517c478bd9Sstevel@tonic-gate /* map "undef" to undefined */ 3527c478bd9Sstevel@tonic-gate c = (term & TERMIOS) ? _POSIX_VDISABLE : 0200; 3537c478bd9Sstevel@tonic-gate } 3547c478bd9Sstevel@tonic-gate return (c); 3557c478bd9Sstevel@tonic-gate } 3567c478bd9Sstevel@tonic-gate 3577c478bd9Sstevel@tonic-gate /* get modes of tty device and fill in applicable structures */ 3587c478bd9Sstevel@tonic-gate int 3597c478bd9Sstevel@tonic-gate get_ttymode(int fd, struct termio *termio, struct termios *termios, 3607c478bd9Sstevel@tonic-gate struct stio *stermio, struct termiox *termiox, struct winsize *winsize 3617c478bd9Sstevel@tonic-gate #ifdef EUC 3627c478bd9Sstevel@tonic-gate /* */, struct eucioc *kwp, ldterm_cs_data_user_t *kcswp 3637c478bd9Sstevel@tonic-gate #endif /* EUC */ 3647c478bd9Sstevel@tonic-gate /* */) 3657c478bd9Sstevel@tonic-gate { 3667c478bd9Sstevel@tonic-gate int i; 3677c478bd9Sstevel@tonic-gate int term = 0; 3687c478bd9Sstevel@tonic-gate #ifdef EUC 3697c478bd9Sstevel@tonic-gate struct strioctl cmd; 3707c478bd9Sstevel@tonic-gate #endif /* EUC */ 3717c478bd9Sstevel@tonic-gate if (ioctl(fd, STGET, stermio) == -1) { 3727c478bd9Sstevel@tonic-gate term |= ASYNC; 3737c478bd9Sstevel@tonic-gate if (ioctl(fd, TCGETS, termios) == -1) { 3747c478bd9Sstevel@tonic-gate if (ioctl(fd, TCGETA, termio) == -1) 3757c478bd9Sstevel@tonic-gate return (-1); 3767c478bd9Sstevel@tonic-gate termios->c_lflag = termio->c_lflag; 3777c478bd9Sstevel@tonic-gate termios->c_oflag = termio->c_oflag; 3787c478bd9Sstevel@tonic-gate termios->c_iflag = termio->c_iflag; 3797c478bd9Sstevel@tonic-gate termios->c_cflag = termio->c_cflag; 3807c478bd9Sstevel@tonic-gate for (i = 0; i < NCC; i++) 3817c478bd9Sstevel@tonic-gate termios->c_cc[i] = termio->c_cc[i]; 3827c478bd9Sstevel@tonic-gate } else 3837c478bd9Sstevel@tonic-gate term |= TERMIOS; 3847c478bd9Sstevel@tonic-gate } else { 3857c478bd9Sstevel@tonic-gate termios->c_cc[7] = (unsigned)stermio->tab; 3867c478bd9Sstevel@tonic-gate termios->c_lflag = stermio->lmode; 3877c478bd9Sstevel@tonic-gate termios->c_oflag = stermio->omode; 3887c478bd9Sstevel@tonic-gate termios->c_iflag = stermio->imode; 3897c478bd9Sstevel@tonic-gate } 3907c478bd9Sstevel@tonic-gate 3917c478bd9Sstevel@tonic-gate if (ioctl(fd, TCGETX, termiox) == 0) 3927c478bd9Sstevel@tonic-gate term |= FLOW; 3937c478bd9Sstevel@tonic-gate 3947c478bd9Sstevel@tonic-gate if (ioctl(fd, TIOCGWINSZ, winsize) == 0) 3957c478bd9Sstevel@tonic-gate term |= WINDOW; 3967c478bd9Sstevel@tonic-gate #ifdef EUC 3977c478bd9Sstevel@tonic-gate cmd.ic_cmd = EUC_WGET; 3987c478bd9Sstevel@tonic-gate cmd.ic_timout = 0; 3997c478bd9Sstevel@tonic-gate cmd.ic_len = sizeof (struct eucioc); 4007c478bd9Sstevel@tonic-gate cmd.ic_dp = (char *)kwp; 4017c478bd9Sstevel@tonic-gate 4027c478bd9Sstevel@tonic-gate if (ioctl(fd, I_STR, &cmd) == 0) 4037c478bd9Sstevel@tonic-gate term |= EUCW; 4047c478bd9Sstevel@tonic-gate 4057c478bd9Sstevel@tonic-gate cmd.ic_cmd = CSDATA_GET; 4067c478bd9Sstevel@tonic-gate cmd.ic_timout = 0; 4077c478bd9Sstevel@tonic-gate cmd.ic_len = sizeof (ldterm_cs_data_user_t); 4087c478bd9Sstevel@tonic-gate cmd.ic_dp = (char *)kcswp; 4097c478bd9Sstevel@tonic-gate 4107c478bd9Sstevel@tonic-gate if (ioctl(fd, I_STR, &cmd) == 0) 4117c478bd9Sstevel@tonic-gate term |= CSIW; 4127c478bd9Sstevel@tonic-gate else 4137c478bd9Sstevel@tonic-gate (void) memset((void *)kcswp, 0, sizeof (ldterm_cs_data_user_t)); 4147c478bd9Sstevel@tonic-gate #endif /* EUC */ 4157c478bd9Sstevel@tonic-gate return (term); 4167c478bd9Sstevel@tonic-gate } 4177c478bd9Sstevel@tonic-gate 4187c478bd9Sstevel@tonic-gate /* set tty modes */ 4197c478bd9Sstevel@tonic-gate int 4207c478bd9Sstevel@tonic-gate set_ttymode(int fd, int term, struct termio *termio, struct termios *termios, 4217c478bd9Sstevel@tonic-gate struct stio *stermio, struct termiox *termiox, struct winsize *winsize, 4227c478bd9Sstevel@tonic-gate struct winsize *owinsize 4237c478bd9Sstevel@tonic-gate #ifdef EUC 4247c478bd9Sstevel@tonic-gate /* */, struct eucioc *kwp, ldterm_cs_data_user_t *kcswp, 4257c478bd9Sstevel@tonic-gate int invalid_ldterm_dat_file 4267c478bd9Sstevel@tonic-gate #endif /* EUC */ 4277c478bd9Sstevel@tonic-gate /* */) 4287c478bd9Sstevel@tonic-gate { 4297c478bd9Sstevel@tonic-gate int i; 4307c478bd9Sstevel@tonic-gate #ifdef EUC 4317c478bd9Sstevel@tonic-gate struct strioctl cmd; 4327c478bd9Sstevel@tonic-gate #endif /* EUC */ 4337c478bd9Sstevel@tonic-gate 4347c478bd9Sstevel@tonic-gate if (term & ASYNC) { 4357c478bd9Sstevel@tonic-gate if (term & TERMIOS) { 4367c478bd9Sstevel@tonic-gate if (ioctl(fd, TCSETSW, termios) == -1) 4377c478bd9Sstevel@tonic-gate return (-1); 4387c478bd9Sstevel@tonic-gate } else { 4397c478bd9Sstevel@tonic-gate termio->c_lflag = termios->c_lflag; 4407c478bd9Sstevel@tonic-gate termio->c_oflag = termios->c_oflag; 4417c478bd9Sstevel@tonic-gate termio->c_iflag = termios->c_iflag; 4427c478bd9Sstevel@tonic-gate termio->c_cflag = termios->c_cflag; 4437c478bd9Sstevel@tonic-gate for (i = 0; i < NCC; i++) 4447c478bd9Sstevel@tonic-gate termio->c_cc[i] = termios->c_cc[i]; 4457c478bd9Sstevel@tonic-gate if (ioctl(fd, TCSETAW, termio) == -1) 4467c478bd9Sstevel@tonic-gate return (-1); 4477c478bd9Sstevel@tonic-gate } 4487c478bd9Sstevel@tonic-gate 4497c478bd9Sstevel@tonic-gate } else { 4507c478bd9Sstevel@tonic-gate stermio->imode = termios->c_iflag; 4517c478bd9Sstevel@tonic-gate stermio->omode = termios->c_oflag; 4527c478bd9Sstevel@tonic-gate stermio->lmode = termios->c_lflag; 4537c478bd9Sstevel@tonic-gate stermio->tab = termios->c_cc[7]; 4547c478bd9Sstevel@tonic-gate if (ioctl(fd, STSET, stermio) == -1) 4557c478bd9Sstevel@tonic-gate return (-1); 4567c478bd9Sstevel@tonic-gate } 4577c478bd9Sstevel@tonic-gate if (term & FLOW) { 4587c478bd9Sstevel@tonic-gate if (ioctl(fd, TCSETXW, termiox) == -1) 4597c478bd9Sstevel@tonic-gate return (-1); 4607c478bd9Sstevel@tonic-gate } 4617c478bd9Sstevel@tonic-gate if ((owinsize->ws_col != winsize->ws_col || 4627c478bd9Sstevel@tonic-gate owinsize->ws_row != winsize->ws_row || 4637c478bd9Sstevel@tonic-gate owinsize->ws_xpixel != winsize->ws_xpixel || 4647c478bd9Sstevel@tonic-gate owinsize->ws_ypixel != winsize->ws_ypixel) && 4657c478bd9Sstevel@tonic-gate ioctl(0, TIOCSWINSZ, winsize) != 0) 4667c478bd9Sstevel@tonic-gate return (-1); 4677c478bd9Sstevel@tonic-gate #ifdef EUC 4687c478bd9Sstevel@tonic-gate /* 4697c478bd9Sstevel@tonic-gate * If the ldterm.dat file contains valid, non-EUC codeset info, 4707c478bd9Sstevel@tonic-gate * send downstream CSDATA_SET. Otherwise, try EUC_WSET. 4717c478bd9Sstevel@tonic-gate */ 4727c478bd9Sstevel@tonic-gate if (invalid_ldterm_dat_file) { 4737c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext( 4747c478bd9Sstevel@tonic-gate "stty: can't set codeset width due to invalid ldterm.dat.\n")); 4757c478bd9Sstevel@tonic-gate return (-1); 4767c478bd9Sstevel@tonic-gate } else if ((term & CSIW) && kcswp->version) { 4777c478bd9Sstevel@tonic-gate cmd.ic_cmd = CSDATA_SET; 4787c478bd9Sstevel@tonic-gate cmd.ic_timout = 0; 4797c478bd9Sstevel@tonic-gate cmd.ic_len = sizeof (ldterm_cs_data_user_t); 4807c478bd9Sstevel@tonic-gate cmd.ic_dp = (char *)kcswp; 4817c478bd9Sstevel@tonic-gate if (ioctl(fd, I_STR, &cmd) != 0) { 4827c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext( 4837c478bd9Sstevel@tonic-gate "stty: can't set codeset width.\n")); 4847c478bd9Sstevel@tonic-gate return (-1); 4857c478bd9Sstevel@tonic-gate } 4867c478bd9Sstevel@tonic-gate } else if (term & EUCW) { 4877c478bd9Sstevel@tonic-gate cmd.ic_cmd = EUC_WSET; 4887c478bd9Sstevel@tonic-gate cmd.ic_timout = 0; 4897c478bd9Sstevel@tonic-gate cmd.ic_len = sizeof (struct eucioc); 4907c478bd9Sstevel@tonic-gate cmd.ic_dp = (char *)kwp; 4917c478bd9Sstevel@tonic-gate if (ioctl(fd, I_STR, &cmd) != 0) { 4927c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext( 4937c478bd9Sstevel@tonic-gate "stty: can't set EUC codeset width.\n")); 4947c478bd9Sstevel@tonic-gate return (-1); 4957c478bd9Sstevel@tonic-gate } 4967c478bd9Sstevel@tonic-gate } 4977c478bd9Sstevel@tonic-gate #endif /* EUC */ 4987c478bd9Sstevel@tonic-gate return (0); 4997c478bd9Sstevel@tonic-gate } 5007c478bd9Sstevel@tonic-gate 5017c478bd9Sstevel@tonic-gate static int 5027c478bd9Sstevel@tonic-gate parse_encoded(struct termios *cb 5037c478bd9Sstevel@tonic-gate #ifdef EUC 5047c478bd9Sstevel@tonic-gate /* */, ldterm_cs_data_user_t *kcswp, int term 5057c478bd9Sstevel@tonic-gate #endif /* EUC */ 5067c478bd9Sstevel@tonic-gate /* */) 5077c478bd9Sstevel@tonic-gate { 5087c478bd9Sstevel@tonic-gate unsigned long grab[NUM_FIELDS]; 5097c478bd9Sstevel@tonic-gate int last, i; 5107c478bd9Sstevel@tonic-gate #ifdef EUC 5117c478bd9Sstevel@tonic-gate long l; 5127c478bd9Sstevel@tonic-gate char s[3]; 5137c478bd9Sstevel@tonic-gate char *t; 5147c478bd9Sstevel@tonic-gate char *r; 5157c478bd9Sstevel@tonic-gate uchar_t *g; 5167c478bd9Sstevel@tonic-gate ldterm_cs_data_user_t ecswp; 5177c478bd9Sstevel@tonic-gate #endif /* EUC */ 5187c478bd9Sstevel@tonic-gate 5197c478bd9Sstevel@tonic-gate /* 5207c478bd9Sstevel@tonic-gate * Although there are only 16 control chars defined as of April 1995, 5217c478bd9Sstevel@tonic-gate * parse_encoded() and prencode() will not have to be changed if up to 5227c478bd9Sstevel@tonic-gate * MAX_CC control chars are defined in the future. 5237c478bd9Sstevel@tonic-gate * Scan the fields of "stty -g" output into the grab array. 5247c478bd9Sstevel@tonic-gate * Set a total of NUM_FIELDS fields (NUM_MODES modes + MAX_CC 5257c478bd9Sstevel@tonic-gate * control chars). 5267c478bd9Sstevel@tonic-gate */ 5277c478bd9Sstevel@tonic-gate i = sscanf(s_arg, "%lx:%lx:%lx:%lx:%lx:%lx:%lx:%lx:%lx:%lx:%lx:%lx:%lx:" 5287c478bd9Sstevel@tonic-gate "%lx:%lx:%lx:%lx:%lx:%lx:%lx:%lx:%lx", 5297c478bd9Sstevel@tonic-gate &grab[0], &grab[1], &grab[2], &grab[3], &grab[4], &grab[5], 5307c478bd9Sstevel@tonic-gate &grab[6], &grab[7], &grab[8], &grab[9], &grab[10], &grab[11], 5317c478bd9Sstevel@tonic-gate &grab[12], &grab[13], &grab[14], &grab[15], &grab[16], &grab[17], 5327c478bd9Sstevel@tonic-gate &grab[18], &grab[19], &grab[20], &grab[21]); 5337c478bd9Sstevel@tonic-gate 5347c478bd9Sstevel@tonic-gate if (i < 12) 5357c478bd9Sstevel@tonic-gate return (0); 5367c478bd9Sstevel@tonic-gate cb->c_iflag = grab[0]; 5377c478bd9Sstevel@tonic-gate cb->c_oflag = grab[1]; 5387c478bd9Sstevel@tonic-gate cb->c_cflag = grab[2]; 5397c478bd9Sstevel@tonic-gate cb->c_lflag = grab[3]; 5407c478bd9Sstevel@tonic-gate 5417c478bd9Sstevel@tonic-gate last = i - NUM_MODES; 5427c478bd9Sstevel@tonic-gate for (i = 0; i < last; i++) 5437c478bd9Sstevel@tonic-gate cb->c_cc[i] = (unsigned char) grab[i+NUM_MODES]; 5447c478bd9Sstevel@tonic-gate 5457c478bd9Sstevel@tonic-gate #ifdef EUC 5467c478bd9Sstevel@tonic-gate /* This is to fulfill PSARC/1999/140 TCR2. */ 5477c478bd9Sstevel@tonic-gate if (term & CSIW) { 5487c478bd9Sstevel@tonic-gate r = strdup(s_arg); 5497c478bd9Sstevel@tonic-gate if (r == (char *)NULL) { 5507c478bd9Sstevel@tonic-gate (void) fprintf(stderr, gettext( 5517c478bd9Sstevel@tonic-gate "no more memory - try again later\n")); 5527c478bd9Sstevel@tonic-gate return (0); 5537c478bd9Sstevel@tonic-gate } 5547c478bd9Sstevel@tonic-gate t = strtok(r, ":"); 5557c478bd9Sstevel@tonic-gate for (i = 0; t != NULL && i < 22; i++) { 5567c478bd9Sstevel@tonic-gate t = strtok(NULL, ":"); 5577c478bd9Sstevel@tonic-gate } 5587c478bd9Sstevel@tonic-gate 5597c478bd9Sstevel@tonic-gate if (t == NULL) { 5607c478bd9Sstevel@tonic-gate free((void *)r); 5617c478bd9Sstevel@tonic-gate return (0); 5627c478bd9Sstevel@tonic-gate } 5637c478bd9Sstevel@tonic-gate ecswp.version = (uchar_t)strtol(t, (char **)NULL, 16); 5647c478bd9Sstevel@tonic-gate if (ecswp.version > LDTERM_DATA_VERSION || 5657c478bd9Sstevel@tonic-gate ecswp.version == 0) { 5667c478bd9Sstevel@tonic-gate free((void *)r); 5677c478bd9Sstevel@tonic-gate return (0); 5687c478bd9Sstevel@tonic-gate } 5697c478bd9Sstevel@tonic-gate 5707c478bd9Sstevel@tonic-gate if ((t = strtok(NULL, ":")) == NULL) { 5717c478bd9Sstevel@tonic-gate free((void *)r); 5727c478bd9Sstevel@tonic-gate return (0); 5737c478bd9Sstevel@tonic-gate } 5747c478bd9Sstevel@tonic-gate ecswp.codeset_type = (uchar_t)strtol(t, (char **)NULL, 16); 5757c478bd9Sstevel@tonic-gate if (ecswp.codeset_type < LDTERM_CS_TYPE_MIN || 5767c478bd9Sstevel@tonic-gate ecswp.codeset_type > LDTERM_CS_TYPE_MAX) { 5777c478bd9Sstevel@tonic-gate free((void *)r); 5787c478bd9Sstevel@tonic-gate return (0); 5797c478bd9Sstevel@tonic-gate } 5807c478bd9Sstevel@tonic-gate 5817c478bd9Sstevel@tonic-gate if ((t = strtok(NULL, ":")) == NULL) { 5827c478bd9Sstevel@tonic-gate free((void *)r); 5837c478bd9Sstevel@tonic-gate return (0); 5847c478bd9Sstevel@tonic-gate } 5857c478bd9Sstevel@tonic-gate ecswp.csinfo_num = (uchar_t)strtol(t, (char **)NULL, 16); 5867c478bd9Sstevel@tonic-gate if ((ecswp.codeset_type == LDTERM_CS_TYPE_EUC && 5877c478bd9Sstevel@tonic-gate ecswp.csinfo_num > 3) || 5887c478bd9Sstevel@tonic-gate (ecswp.codeset_type == LDTERM_CS_TYPE_PCCS && 5897c478bd9Sstevel@tonic-gate (ecswp.csinfo_num < 1 || ecswp.csinfo_num > 10))) { 5907c478bd9Sstevel@tonic-gate free((void *)r); 5917c478bd9Sstevel@tonic-gate return (0); 5927c478bd9Sstevel@tonic-gate } 5937c478bd9Sstevel@tonic-gate 5947c478bd9Sstevel@tonic-gate if ((t = strtok(NULL, ":")) == NULL) { 5957c478bd9Sstevel@tonic-gate free((void *)r); 5967c478bd9Sstevel@tonic-gate return (0); 5977c478bd9Sstevel@tonic-gate } 5987c478bd9Sstevel@tonic-gate s[2] = '\0'; 5997c478bd9Sstevel@tonic-gate for (i = 0; *t != 0 && i < MAXNAMELEN; i++) { 6007c478bd9Sstevel@tonic-gate if (*(t + 1) == (char)NULL) { 6017c478bd9Sstevel@tonic-gate free((void *)r); 6027c478bd9Sstevel@tonic-gate return (0); 6037c478bd9Sstevel@tonic-gate } 6047c478bd9Sstevel@tonic-gate s[0] = *t++; 6057c478bd9Sstevel@tonic-gate s[1] = *t++; 6067c478bd9Sstevel@tonic-gate ecswp.locale_name[i] = (char)strtol(s, (char **)NULL, 6077c478bd9Sstevel@tonic-gate 16); 6087c478bd9Sstevel@tonic-gate } 6097c478bd9Sstevel@tonic-gate if (i >= MAXNAMELEN) { 6107c478bd9Sstevel@tonic-gate free((void *)r); 6117c478bd9Sstevel@tonic-gate return (0); 6127c478bd9Sstevel@tonic-gate } 6137c478bd9Sstevel@tonic-gate ecswp.locale_name[i] = '\0'; 6147c478bd9Sstevel@tonic-gate 6157c478bd9Sstevel@tonic-gate g = (uchar_t *)ecswp.eucpc_data; 6167c478bd9Sstevel@tonic-gate for (i = 0; i < (LDTERM_CS_MAX_CODESETS * 4); i++) { 6177c478bd9Sstevel@tonic-gate if ((t = strtok(NULL, ":")) == NULL) { 6187c478bd9Sstevel@tonic-gate free((void *)r); 6197c478bd9Sstevel@tonic-gate return (0); 6207c478bd9Sstevel@tonic-gate } 6217c478bd9Sstevel@tonic-gate l = strtol(t, (char **)NULL, 16); 6227c478bd9Sstevel@tonic-gate if (l < 0 || l > 255) { 6237c478bd9Sstevel@tonic-gate free((void *)r); 6247c478bd9Sstevel@tonic-gate return (0); 6257c478bd9Sstevel@tonic-gate } 6267c478bd9Sstevel@tonic-gate *g++ = (uchar_t)l; 6277c478bd9Sstevel@tonic-gate } 6287c478bd9Sstevel@tonic-gate 6297c478bd9Sstevel@tonic-gate /* We got the 'ecswp' all filled up now; let's copy. */ 6307c478bd9Sstevel@tonic-gate (void) memcpy((void *)kcswp, (const void *)&ecswp, 6317c478bd9Sstevel@tonic-gate sizeof (ldterm_cs_data_user_t)); 6327c478bd9Sstevel@tonic-gate } 6337c478bd9Sstevel@tonic-gate #endif /* EUC */ 6347c478bd9Sstevel@tonic-gate 6357c478bd9Sstevel@tonic-gate return (1); 6367c478bd9Sstevel@tonic-gate } 637