#ident "@(#)stty-euc-dependency.txt 1.1 98/03/25 SMI" 1/14/1998 Ienup Sung is@eng.sun.com Brief analysis of EUC dependency in stty(1) ------------------------------------------- 0. Overview This memo is to provide a brief analysis result. The scope of the analysis is restricted to I18N and EUC dependency. 1. Header files The stty.c and sttyparse.c includes following EUC specific headers: /usr/include/sys/eucioctl.h /usr/include/getwidth.h The first one is to have 'eucioc_t' data structure type and necessary macros. The second one is to have getwidth() function prototype which is only for the locales that have EUC as its codeset. Also, stty.h header file at the same directory contains EUCW flag definitnion. 2. stty.c and sttyparse.c The version number of stty.c is 1.18 and last modified at 7/1/1996. The version number of sttyparse.c is 1.18 and last modified at 4/13/1995. After setlocale() invocation, the main() calls 'getwidth(&wp)' so that 'wp' will contain necessary EUC codeset specific information. And then it calls 'get_ttymode()' that will collect the current EUC settings for the ldterm. If user specified -a option with the stty(1) command, 'pramodes()' function will be invoked so that "eucw" and "scrw" can be printed. After that, the main() routine calls 'sttyparse()' that parses and processes user specified modes. Especially if the user specified "defeucw", it will save the current locale's EUC codeset info, i.e., byte length and screen width of each EUC codeset, into the 'wp'. Also, if the current locale is a multibyte one and one or more of -raw, cooked or sane is specified, the ISTRIP flag will be cleared from the input mode flag and, from the control mode flag, CS7 and PARENB will be cleared and instead CS8 will be set. After that, the main() rountine calls 'set_ttymode()' that checks whether EUCW flag has set for this terminal and if so, it will send EUC_WSET ioctl command downstream with the 'kwp' that is retrived or changed from the 'get_ttymode()' and/or 'sttyparse()'. 3. Related functions in stty.c and sttyparse.c int main(int argc, char *argv[]) int get_ttymode(int fd, struct termio *termio, struct termios *termios, struct stio *stermio, struct winsize *winsize, struct eucioc *kwp) void pramodes() char * sttyparse(int argc, char *argv[], int term, struct termio *ocb, struct termios *cb, struct termiox *termiox, struct winsize *winsize, eucwidth_t *wp, struct eucioc *kwp) int set_sttymode(int fd, struct termio *termio, struct termios *termios, struct stio *stermio, struct termiox *termiox, struct winsize *winsize, struct winsize *owinsize, struct eucioc *kwp)