diff options
author | April Chin <April.Chin@Sun.COM> | 2008-12-27 14:59:38 -0800 |
---|---|---|
committer | April Chin <April.Chin@Sun.COM> | 2008-12-27 14:59:38 -0800 |
commit | 7c2fbfb345896881c631598ee3852ce9ce33fb07 (patch) | |
tree | 4b173b5657508562dfc0aa05f7d056d1e9add505 /usr/src/lib/libcmd/common/stty.c | |
parent | 6071ac1de68fed78e1e10052045bbb5f1732a263 (diff) | |
download | illumos-joyent-7c2fbfb345896881c631598ee3852ce9ce33fb07.tar.gz |
PSARC/2008/094 ksh93 Update 1
PSARC/2008/344 ksh93 Integration Update 1 Amendments 1
PSARC/2008/589 Remove /usr/bin/printf from PSARC case 2008 094
6619428 *ksh93* RFE: Update ksh93 in Solaris to ast-ksh.2008-11-04
6788659 RFE: Update libpp in Solaris to ast-open.2008-07-25
6561901 RFE: Add "shcomp" (shell script compiler) + kernel module to exec binary sh code
6599668 RFE: Move consumers of alias.sh over to ksh93
6595183 *ksh93* RFE: Update ksh93-integration demo code
6775901 *ksh93* no C message catalogs are generated for ksh93
6451262 *sleep* RFE: /usr/bin/sleep should support floating-point values
6687139 *ksh93* command substitution, exec, and stdout redirection cause allocation loop
6703761 *ksh93* crashes in script containing uncommon output redirections
6715496 *ksh93* SEGVs on array reinitialization
6713682 *ksh93* Creating a compound variable in a subshell "bleeds through" to the calling subshell
6672350 *ksh93* causes parent shell to die when child shell is suspended
6745015 *ksh93* VARIABLE=`command substitution` assignment is not reliable on OpenSolaris
6710205 *ksh93* problem with command substitution (within back quotes) containing \$'
6737600 *ksh93* exits debugger when user presses ctrl-c
6748645 *ksh93* fc -l -e - is mis-parsed, outputs wrong error message "-e - requires single argument"
6754020 *ksh93* does weird '[' expansion
6753538 *ksh93* umask modification leaks out of a ksh93 subshell
6766246 *ksh93* bug in pattern matching
6763594 *ksh93* executes command after "command" builtin twice on failure
6762665 *ksh93* Difficult-to-reproduce SIGSEGV in ksh93
Diffstat (limited to 'usr/src/lib/libcmd/common/stty.c')
-rw-r--r-- | usr/src/lib/libcmd/common/stty.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/usr/src/lib/libcmd/common/stty.c b/usr/src/lib/libcmd/common/stty.c index ef53c61bf7..6868d3f326 100644 --- a/usr/src/lib/libcmd/common/stty.c +++ b/usr/src/lib/libcmd/common/stty.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -26,7 +26,7 @@ */ static const char usage[] = -"[-?@(#)$Id: stty (AT&T Research) 2006-10-31 $\n]" +"[-?@(#)$Id: stty (AT&T Research) 2008-04-01 $\n]" USAGE_LICENSE "[+NAME?stty - set or get terminal modes]" "[+DESCRIPTION?\bstty\b sets certain terminal I/O modes for the device " @@ -37,6 +37,7 @@ USAGE_LICENSE "[g:save?Writes the current settings to standard output in a form that can " "be used as an argument to another \bstty\b command. The \brows\b " "and \bcolumns\b values are not included.]" +"[t:terminal-group?Print the terminal group id of the device, -1 if unknown.]" "\n" "\n[mode ...]\n" "\n" @@ -57,7 +58,6 @@ USAGE_LICENSE "[+SEE ALSO?\btegetattr\b(2), \btcsetattr\b(2), \bioctl\b(2)]" ; - #include <cmd.h> #include <ccode.h> #include <ctype.h> @@ -83,6 +83,7 @@ USAGE_LICENSE /* command options */ #define A_FLAG 1 #define G_FLAG 2 +#define T_FLAG 4 /* termios fields */ #define C_FLAG 1 @@ -313,9 +314,15 @@ static const Tty_t Ttable[] = #endif #ifdef TABDLY { "tabs", TABS, O_FLAG, IG, TABDLY, TAB3, C("Preserve (expand to spaces) tabs") }, +#ifdef TAB0 { "tab0", BITS, O_FLAG, IG|SS, TABDLY, TAB0 }, +#endif +#ifdef TAB1 { "tab1", BITS, O_FLAG, US, TABDLY, TAB1 }, +#endif +#ifdef TAB2 { "tab2", BITS, O_FLAG, US, TABDLY, TAB2 }, +#endif { "tab3", BITS, O_FLAG, US, TABDLY, TAB3 }, #endif #ifdef BSDLY @@ -483,7 +490,7 @@ static void output(struct termios *sp, int flags) { case BIT: case BITS: - off = 1; + off = off2 = 1; switch(tp->field) { case C_FLAG: @@ -877,6 +884,15 @@ static int infof(Opt_t* op, Sfio_t* sp, const char* s, Optdisc_t* dp) return(1); } +#ifndef _lib_tcgetpgrp +# ifdef TIOCGPGRP + static int _i_; +# define tcgetpgrp(a) (ioctl(a, TIOCGPGRP, &_i_)>=0?_i_:-1) +# else +# define tcgetpgrp(a) (-1) +# endif /* TIOCGPGRP */ +#endif /* _lib_tcgetpgrp */ + int b_stty(int argc, char** argv, void* context) { @@ -897,6 +913,9 @@ b_stty(int argc, char** argv, void* context) { switch (n = optget(argv, usage)) { + case 't': + flags |= T_FLAG; + continue; case 'a': case 'g': if (!opt_info.offset || !argv[opt_info.index][opt_info.offset]) @@ -926,9 +945,11 @@ b_stty(int argc, char** argv, void* context) break; } argv += opt_info.index; - if (error_info.errors || (flags && *argv)) + if (error_info.errors || (flags && *argv) || (flags&(flags-1))) error(ERROR_usage(2), "%s", optusage(NiL)); - if (*argv) + if (flags & T_FLAG) + sfprintf(sfstdout, "%d\n", tcgetpgrp(0)); + else if (*argv) { if (!argv[1] && **argv == ':') gin(*argv, &tty); |