Index: build_ksh93_standalone_tarball.sh =================================================================== --- build_ksh93_standalone_tarball.sh (revision 0) +++ build_ksh93_standalone_tarball.sh (revision 894) @@ -0,0 +1,31 @@ +#!/usr/bin/ksh93 + +function fatal_error +{ + print -u 2 "${progname}: $@" + exit 1 +} + +set -o xtrace +set -o errexit + +typeset progname="$(basename "$0")" + +# assertions +[[ "$ROOT" != "" ]] || fatal_error "ROOT not set." +[[ -d "$ROOT" ]] || fatal_error "ROOT is not directory." + +# build file list +files="$(find $ROOT '!' -type d | + sed "s/.*\/root_${MACH}\///" | + sort | + egrep '^(etc/ksh.*|usr/include/ast|usr/lib/locale/C/LC_MESSAGES/lib(cmd|ast|sum|shell|dll|pp)$|usr/lib(/(sparc.*|i.*86|amd64)/|/)(lib|llib-l)(cmd|ast|sum|shell|dll|pp)\.)|usr/demo/ksh|usr/ast/|(usr/bin/(.*ksh.*|rksh.*|pfksh.*|sum|printf|sleep|rev|shcomp|bg|cd|command|fc|fg|getopts|hash|jobs|kill|read|test|type|ulimit|umask|unalias|wait)$)')" + +print "# packing files..." +( + cd "$ROOT" + tar -cvf - ${files} +) | bzip2 >ksh93_integration_standalone_tarball.tar.bz2 + +print "#done." +# EOF. Index: src/pkgdefs/SUNWhea/prototype_com =================================================================== --- src/pkgdefs/SUNWhea/prototype_com (revision 866) +++ src/pkgdefs/SUNWhea/prototype_com (revision 894) @@ -144,12 +144,14 @@ f none usr/include/ast/sfio.h 644 root bin f none usr/include/ast/sfio_s.h 644 root bin f none usr/include/ast/sfio_t.h 644 root bin +f none usr/include/ast/shcmd.h 644 root bin f none usr/include/ast/shell.h 644 root bin f none usr/include/ast/sig.h 644 root bin f none usr/include/ast/stack.h 644 root bin f none usr/include/ast/stak.h 644 root bin f none usr/include/ast/stdio.h 644 root bin f none usr/include/ast/stk.h 644 root bin +f none usr/include/ast/sum.h 644 root bin f none usr/include/ast/swap.h 644 root bin f none usr/include/ast/tar.h 644 root bin f none usr/include/ast/times.h 644 root bin Index: src/pkgdefs/SUNWloc/prototype_com =================================================================== --- src/pkgdefs/SUNWloc/prototype_com (revision 866) +++ src/pkgdefs/SUNWloc/prototype_com (revision 894) @@ -53,7 +53,6 @@ f none usr/bin/locale 555 root bin f none usr/bin/mkmsgs 555 root root f none usr/bin/msgfmt 555 root bin -f none usr/bin/printf 555 root bin f none usr/bin/srchtxt 555 root bin f none usr/bin/xgettext 555 root bin d none usr/lib 755 root bin Index: src/pkgdefs/SUNWcsl/prototype_com =================================================================== --- src/pkgdefs/SUNWcsl/prototype_com (revision 866) +++ src/pkgdefs/SUNWcsl/prototype_com (revision 894) @@ -254,6 +254,7 @@ f none usr/lib/libsmbios.so.1 755 root bin s none usr/lib/libsocket.so=../../lib/libsocket.so.1 s none usr/lib/libsocket.so.1=../../lib/libsocket.so.1 +f none usr/lib/libsum.so.1 755 root bin s none usr/lib/libsys.so=./libsys.so.1 f none usr/lib/libsys.so.1 755 root bin s none usr/lib/libsysevent.so=../../lib/libsysevent.so.1 Index: src/pkgdefs/SUNWcsl/prototype_sparc =================================================================== --- src/pkgdefs/SUNWcsl/prototype_sparc (revision 866) +++ src/pkgdefs/SUNWcsl/prototype_sparc (revision 894) @@ -305,6 +305,7 @@ s none usr/lib/sparcv9/libsmbios.so=libsmbios.so.1 s none usr/lib/sparcv9/libsocket.so.1=../../../lib/sparcv9/libsocket.so.1 s none usr/lib/sparcv9/libsocket.so=../../../lib/sparcv9/libsocket.so.1 +f none usr/lib/sparcv9/libsum.so.1 755 root bin s none usr/lib/sparcv9/libsysevent.so.1=../../../lib/sparcv9/libsysevent.so.1 s none usr/lib/sparcv9/libsysevent.so=../../../lib/sparcv9/libsysevent.so.1 s none usr/lib/sparcv9/libtermcap.so=../../../lib/sparcv9/libcurses.so.1 Index: src/pkgdefs/SUNWcsl/prototype_i386 =================================================================== --- src/pkgdefs/SUNWcsl/prototype_i386 (revision 866) +++ src/pkgdefs/SUNWcsl/prototype_i386 (revision 894) @@ -317,6 +317,7 @@ f none usr/lib/amd64/libsmbios.so.1 755 root bin s none usr/lib/amd64/libsocket.so.1=../../../lib/amd64/libsocket.so.1 s none usr/lib/amd64/libsocket.so=../../../lib/amd64/libsocket.so.1 +f none usr/lib/amd64/libsum.so.1 755 root bin s none usr/lib/amd64/libsysevent.so=../../../lib/amd64/libsysevent.so.1 s none usr/lib/amd64/libsysevent.so.1=../../../lib/amd64/libsysevent.so.1 s none usr/lib/amd64/libtermcap.so=../../../lib/amd64/libcurses.so.1 Index: src/pkgdefs/SUNWcsu/prototype_com =================================================================== --- src/pkgdefs/SUNWcsu/prototype_com (revision 866) +++ src/pkgdefs/SUNWcsu/prototype_com (revision 894) @@ -220,6 +220,7 @@ f none usr/bin/pktool 555 root bin f none usr/bin/pr 555 root bin l none usr/bin/prctl=../../usr/lib/isaexec +l none usr/bin/printf=../../usr/bin/alias f none usr/bin/priocntl 555 root bin f none usr/bin/profiles 555 root bin f none usr/bin/projects 555 root bin @@ -232,6 +233,7 @@ l none usr/bin/read=../../usr/bin/alias l none usr/bin/red=../../usr/bin/ed f none usr/bin/renice 555 root bin +l none usr/bin/rev=../../usr/bin/alias l none usr/bin/rksh=../../usr/bin/ksh l none usr/bin/rksh93=../../usr/lib/isaexec f none usr/bin/rm 555 root bin @@ -248,7 +250,8 @@ f none usr/bin/settime 555 root bin l none usr/bin/setuname=../../usr/lib/isaexec s none usr/bin/sh=../../sbin/sh -f none usr/bin/sleep 555 root bin +f none usr/bin/shcomp 555 root bin +l none usr/bin/sleep=../../usr/bin/alias l none usr/bin/sparc=../../usr/bin/i286 f none usr/bin/strchg 555 root root s none usr/bin/strclean=../sbin/strclean @@ -256,6 +259,7 @@ s none usr/bin/strerr=../sbin/strerr f none usr/bin/stty 555 root bin f none usr/bin/su 4555 root sys +l none usr/bin/sum=../../usr/bin/alias l none usr/bin/sun2=../../usr/bin/i286 l none usr/bin/sun3=../../usr/bin/i286 l none usr/bin/sun3x=../../usr/bin/i286 Index: src/pkgdefs/etc/exception_list_sparc =================================================================== --- src/pkgdefs/etc/exception_list_sparc (revision 866) +++ src/pkgdefs/etc/exception_list_sparc (revision 894) @@ -889,6 +889,12 @@ usr/lib/llib-lshell.ln sparc usr/lib/sparcv9/libshell.so sparc usr/lib/sparcv9/llib-lshell.ln sparc +# libsum +usr/lib/libsum.so sparc +usr/lib/llib-lsum sparc +usr/lib/llib-lsum.ln sparc +usr/lib/sparcv9/libsum.so sparc +usr/lib/sparcv9/llib-lsum.ln sparc # # bmc (IPMI) interfaces shared within ON. # Index: src/pkgdefs/etc/exception_list_i386 =================================================================== --- src/pkgdefs/etc/exception_list_i386 (revision 866) +++ src/pkgdefs/etc/exception_list_i386 (revision 894) @@ -821,6 +821,12 @@ usr/lib/llib-lshell.ln i386 usr/lib/amd64/libshell.so i386 usr/lib/amd64/llib-lshell.ln i386 +# libsum +usr/lib/libsum.so i386 +usr/lib/llib-lsum i386 +usr/lib/llib-lsum.ln i386 +usr/lib/amd64/libsum.so i386 +usr/lib/amd64/llib-lsum.ln i386 # # bmc (IPMI) interfaces shared within ON. # Index: src/pkgdefs/SUNW0on/prototype_com =================================================================== --- src/pkgdefs/SUNW0on/prototype_com (revision 866) +++ src/pkgdefs/SUNW0on/prototype_com (revision 894) @@ -82,6 +82,7 @@ f none usr/lib/locale/C/LC_MESSAGES/libcmd 644 root sys f none usr/lib/locale/C/LC_MESSAGES/libdll 644 root sys f none usr/lib/locale/C/LC_MESSAGES/libshell 644 root sys +f none usr/lib/locale/C/LC_MESSAGES/libsum 644 root sys # # Java locale directories # Index: src/pkgdefs/SUNWesu/prototype_com =================================================================== --- src/pkgdefs/SUNWesu/prototype_com (revision 866) +++ src/pkgdefs/SUNWesu/prototype_com (revision 894) @@ -107,7 +107,6 @@ f none usr/bin/spline 555 root bin f none usr/bin/split 555 root bin s none usr/bin/strace=../sbin/strace -f none usr/bin/sum 555 root bin f none usr/bin/tcopy 555 root bin l none usr/bin/uncompress=../../usr/bin/compress f none usr/bin/unexpand 555 root bin Index: src/pkgdefs/SUNWosdem/prototype_com =================================================================== --- src/pkgdefs/SUNWosdem/prototype_com (revision 866) +++ src/pkgdefs/SUNWosdem/prototype_com (revision 894) @@ -56,18 +56,28 @@ d none usr/demo/ksh 755 root bin d none usr/demo/ksh/fun 755 root bin f none usr/demo/ksh/fun/dirs 644 root bin +f none usr/demo/ksh/fun/gnaw 644 root bin f none usr/demo/ksh/fun/mandelbrotset1 644 root bin -f none usr/demo/ksh/fun/gnaw 644 root bin -f none usr/demo/ksh/fun/rssread 644 root bin +f none usr/demo/ksh/fun/multifollow 644 root bin f none usr/demo/ksh/fun/popd 644 root bin f none usr/demo/ksh/fun/pushd 644 root bin +f none usr/demo/ksh/fun/rssread 644 root bin +f none usr/demo/ksh/fun/shman 644 root bin +f none usr/demo/ksh/fun/shnote 644 root bin +f none usr/demo/ksh/fun/shpiano 644 root bin +f none usr/demo/ksh/fun/shtinyurl 644 root bin +f none usr/demo/ksh/fun/shtwitter 644 root bin +f none usr/demo/ksh/fun/svcproptree1 644 root bin f none usr/demo/ksh/fun/termclock 644 root bin +f none usr/demo/ksh/fun/test_net_sctp 644 root bin f none usr/demo/ksh/fun/title 644 root bin +f none usr/demo/ksh/fun/xmldocumenttree1 644 root bin d none usr/demo/ksh/tests 755 root bin f none usr/demo/ksh/tests/alias.sh 644 root bin f none usr/demo/ksh/tests/append.sh 644 root bin f none usr/demo/ksh/tests/arith.sh 644 root bin f none usr/demo/ksh/tests/arrays.sh 644 root bin +f none usr/demo/ksh/tests/arrays2.sh 644 root bin f none usr/demo/ksh/tests/attributes.sh 644 root bin f none usr/demo/ksh/tests/basic.sh 644 root bin f none usr/demo/ksh/tests/bracket.sh 644 root bin @@ -87,6 +97,7 @@ f none usr/demo/ksh/tests/path.sh 644 root bin f none usr/demo/ksh/tests/quoting.sh 644 root bin f none usr/demo/ksh/tests/quoting2.sh 644 root bin +f none usr/demo/ksh/tests/restricted.sh 644 root bin f none usr/demo/ksh/tests/return.sh 644 root bin f none usr/demo/ksh/tests/select.sh 644 root bin f none usr/demo/ksh/tests/shtests 644 root bin Index: src/tools/findunref/exception_list =================================================================== --- src/tools/findunref/exception_list (revision 866) +++ src/tools/findunref/exception_list (revision 894) @@ -106,16 +106,11 @@ # Ignore ksh93/ast-related source components that are not currently # used but may be useful later. # -./src/lib/libcmd/common/cksum.c -./src/lib/libcmd/common/md5sum.c -./src/lib/libcmd/common/sum.c ./src/lib/libshell/common/bltins/mkservice.c -./src/lib/libshell/common/bltins/shopen.c ./src/lib/libshell/common/data/bash_pre_rc.sh ./src/lib/libshell/common/include/env.h ./src/lib/libshell/common/sh/bash.c ./src/lib/libshell/common/sh/env.c -./src/lib/libshell/common/sh/shcomp.c ./src/lib/libshell/common/sh/suid_exec.c # Index: src/cmd/ksh/Makefile.testshell =================================================================== --- src/cmd/ksh/Makefile.testshell (revision 866) +++ src/cmd/ksh/Makefile.testshell (revision 894) @@ -45,8 +45,8 @@ # # - "io.sh" may fail due a subtle bug in ksh93 or the test suite which # only happens when ksh93 is NOT called "ksh"; to work around the -# problem the test sequence currently uses $(SRC)/cmd/ksh/$(CMDTRANSMACH)/ksh -# instead of $(SRC)/cmd/ksh/$(CMDTRANSMACH)/$(PROG) until we+upstream figure +# problem the test sequence currently uses $(SRC)/cmd/ksh/$(LIBSHELLMACH)/ksh +# instead of $(SRC)/cmd/ksh/$(LIBSHELLMACH)/$(PROG) until we+upstream figure # out what exactly is going wrong in this case. # -- snip -- # ./close0[2]: ./close1: cannot execute [Exec format error] @@ -74,19 +74,21 @@ # be run on a quiet system with no other activity. # -TESTSRC= $(LIBSHELLSRC)/../tests +TESTSRC= $(LIBSHELLBASE)/common/tests # ON_KSH_TEST_LOCALES can be overridden via # $ export ON_KSH_TEST_LOCALES= # before $ make install # ON_KSH_TEST_LOCALES = \ C \ - en_US en_US.UTF-8 \ + en_US en_US.ISO8859-15@euro en_US.UTF-8 \ he_IL.UTF-8 \ hi_IN.UTF-8 \ - ja_JP.PCK ja_JP.UTF-8 ja_JP.eucJP \ - ko_KR.EUC \ + ja ja_JP.PCK ja_JP.UTF-8 ja_JP.eucJP \ + ko_KR.UTF-8 ko_KR.EUC \ th_TH.TIS620 \ - zh_CN.EUC zh_CN.GBK zh_CN.GB18030 zh_CN.UTF-8 \ + zh_CN.EUC zh_CN.GBK \ + zh_CN.GB18030 zh_CN.GB18030@pinyin zh_CN.GB18030@radical zh_CN.GB18030@stroke \ + zh_CN.UTF-8 zh_CN.UTF-8@pinyin zh_CN.UTF-8@radical zh_CN.UTF-8@stroke \ zh_HK.BIG5HK \ zh_TW.BIG5 zh_TW.EUC zh_TW.UTF-8 @@ -103,17 +105,18 @@ # test failures). testshell: $(PROG) @ \ + builtin basename ; \ print '# NOTE: Make sure your binaries in ROOT match your kernel!' ; \ ( \ set +o errexit ; \ - export PATH="$(SRC)/cmd/ksh/$(CMDTRANSMACH):/bin:/usr/bin" ; \ + export PATH="$(SRC)/cmd/ksh/$(LIBSHELLMACH):/bin:/usr/bin" ; \ printf "# which ksh='%s', ksh93='%s'\n" \ "$$(which ksh)" "$$(which ksh93)" ; \ ) ; \ - if [[ "$$(isalist | fgrep "$(CMDTRANSMACH)")" = "" ]] ; then \ + if [[ "$$(isalist)" != ~(E)$(LIBSHELLMACH) ]] ; then \ printf \ "# ISA='%s' not available on this system, skipping tests...\n" \ - "$(CMDTRANSMACH)" ; \ + "$(LIBSHELLMACH)" ; \ exit 0 ; \ fi ; \ exec 2>&1 ; \ @@ -133,13 +136,13 @@ set +o errexit ; \ printf \ "## Running %s test: LANG='%s' script='%s'\n" \ - "$(CMDTRANSMACH)/ksh" \ + "$(LIBSHELLMACH)/ksh" \ "$${test_lang}" \ "$$(basename "$${test_item}")"; \ ( \ test_output="$$( ( \ export \ - SHELL="$(SRC)/cmd/ksh/$(CMDTRANSMACH)/ksh" \ + SHELL="$(SRC)/cmd/ksh/$(LIBSHELLMACH)/ksh" \ LD_LIBRARY_PATH_64="$(ROOTLIB64)/" \ LD_LIBRARY_PATH_32="$(ROOTLIB)/" ; \ LD_LIBRARY_PATH="$(ROOTLIB64)/:$(ROOTLIB)/" ; \ @@ -154,8 +157,8 @@ ) 2>&1 | while read ; do \ printf "#\t%s\n" "$${REPLY}" ; \ done | tee /dev/stderr)" ; \ - [[ "$$(print "$${test_output}" | \ - egrep 'passed \[ .* tests 0 errors \]')" != "" ]] || \ + [[ "$$(print "$${test_output}" | \ + egrep 'passed \[ .* tests 0 errors \]')" != "" ]] || \ (print "##> test failed" ; exit 1) \ ) ; \ set -o errexit ; \ Index: src/cmd/ksh/sparcv9/Makefile =================================================================== --- src/cmd/ksh/sparcv9/Makefile (revision 866) +++ src/cmd/ksh/sparcv9/Makefile (revision 894) @@ -26,7 +26,7 @@ # # Specify the MACH we currently use to build and test ksh -CMDTRANSMACH= $(MACH64) +LIBSHELLMACH= $(MACH64) include ../../Makefile.cmd include ../../Makefile.cmd.64 Index: src/cmd/ksh/sparc/Makefile =================================================================== --- src/cmd/ksh/sparc/Makefile (revision 866) +++ src/cmd/ksh/sparc/Makefile (revision 894) @@ -26,7 +26,7 @@ # # Specify the MACH we currently use to build and test ksh -CMDTRANSMACH= $(MACH) +LIBSHELLMACH= $(MACH) include ../../Makefile.cmd Index: src/cmd/ksh/i386/Makefile =================================================================== --- src/cmd/ksh/i386/Makefile (revision 866) +++ src/cmd/ksh/i386/Makefile (revision 894) @@ -26,7 +26,7 @@ # # Specify the MACH we currently use to build and test ksh -CMDTRANSMACH= $(MACH) +LIBSHELLMACH= $(MACH) include ../../Makefile.cmd Index: src/cmd/ksh/Makefile.com =================================================================== --- src/cmd/ksh/Makefile.com (revision 866) +++ src/cmd/ksh/Makefile.com (revision 894) @@ -25,7 +25,7 @@ # ident "@(#)Makefile.com 1.1 07/07/17 SMI" # -SHELL=/usr/bin/ksh +SHELL=/usr/bin/ksh93 include ../../../Makefile.ksh93switch @@ -38,7 +38,8 @@ OBJECTS= \ pmain.o -LIBSHELLSRC=../../../lib/libshell/common/sh +LIBSHELLBASE=../../../lib/libshell +LIBSHELLSRC=$(LIBSHELLBASE)/common/sh SRCS= $(OBJECTS:%.o=$(LIBSHELLSRC)/%.c) @@ -63,6 +64,8 @@ $(CCVERBOSE) \ -xstrconst +pmain.o := CERRWARN += -erroff=E_NO_IMPLICIT_DECL_ALLOWED + # Set common AST build flags (e.g., needed to support the math stuff). include ../../../Makefile.ast Index: src/cmd/ksh/amd64/Makefile =================================================================== --- src/cmd/ksh/amd64/Makefile (revision 866) +++ src/cmd/ksh/amd64/Makefile (revision 894) @@ -26,7 +26,7 @@ # # Specify the MACH we currently use to build and test ksh -CMDTRANSMACH= $(MACH64) +LIBSHELLMACH= $(MACH64) include ../../Makefile.cmd include ../../Makefile.cmd.64 Index: src/cmd/ksh/Makefile =================================================================== --- src/cmd/ksh/Makefile (revision 866) +++ src/cmd/ksh/Makefile (revision 894) @@ -25,7 +25,7 @@ # ident "@(#)Makefile 1.1 07/07/10 SMI" # -SHELL=/usr/bin/ksh +SHELL=/usr/bin/ksh93 include ../../Makefile.ksh93switch Index: src/cmd/Makefile =================================================================== --- src/cmd/Makefile (revision 866) +++ src/cmd/Makefile (revision 894) @@ -60,6 +60,7 @@ adbgen \ acct \ acctadm \ + alias \ arch \ asa \ ast \ @@ -345,7 +346,7 @@ setuname \ sgs \ sh \ - sleep \ + shcomp \ smbios \ smserverd \ soelim \ @@ -362,7 +363,6 @@ strings \ su \ sulogin \ - sum \ sunpc \ svc \ swap \ @@ -448,7 +448,6 @@ $(CLOSED)/cmd/patch \ $(CLOSED)/cmd/pax \ $(CLOSED)/cmd/pcitool \ - $(CLOSED)/cmd/printf \ $(CLOSED)/cmd/sed \ $(CLOSED)/cmd/sed_xpg4 \ $(CLOSED)/cmd/smartcard \ @@ -648,7 +647,7 @@ sdpadm \ sgs \ sh \ - sleep \ + shcomp \ sort \ split \ ssh \ @@ -656,7 +655,6 @@ stmsboot \ strings \ su \ - sum \ svc \ swap \ syseventadm \ @@ -713,7 +711,6 @@ $(CLOSED)/cmd/od \ $(CLOSED)/cmd/patch \ $(CLOSED)/cmd/pax \ - $(CLOSED)/cmd/printf \ $(CLOSED)/cmd/sed \ $(CLOSED)/cmd/sed_xpg4 \ $(CLOSED)/cmd/tail \ Index: src/cmd/shcomp/Makefile =================================================================== --- src/cmd/shcomp/Makefile (revision 0) +++ src/cmd/shcomp/Makefile (revision 894) @@ -0,0 +1,98 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "@(#)Makefile 1.1 07/07/10 SMI" +# + +SHELL=/usr/bin/ksh93 + +include ../Makefile.cmd + +.KEEP_STATE: + +# Set common AST build flags (e.g., needed to support the math stuff). +include ../../Makefile.ast + +CFLAGS += \ + $(CCVERBOSE) \ + -xstrconst + +OBJECTS= \ + shcomp.o + +LIBSHELLMACH=$(MACH) +LIBSHELLBASE=../../lib/libshell +LIBSHELLSRC=$(LIBSHELLBASE)/common/sh + +SRCS= $(OBJECTS:%.o=$(LIBSHELLSRC)/%.c) + +GROUP= bin +LDLIBS += -lshell -last + +# 1. Make sure that the -D/-U defines in CFLAGS below are in sync +# with usr/src/lib/libshell/Makefile.com +# 2. We use "=" here since using $(CPPFLAGS.master) is very tricky in our +# case - it MUST come as the last element but future changes in -D options +# may then cause silent breakage in the AST sources because the last -D +# option specified overrides previous -D options so we prefer the current +# way to explicitly list each single flag. +CPPFLAGS = \ + $(DTEXTDOM) $(DTS_ERRNO) \ + $(LIBSHELLCPPFLAGS) + +CFLAGS += \ + $(CCVERBOSE) \ + -xstrconst +CFLAGS64 += \ + $(CCVERBOSE) \ + -xstrconst + +ROOTCMDDIR=$(ROOT)/usr/bin + +PROG= shcomp + +%.o: $(LIBSHELLSRC)/%.c + $(COMPILE.c) -c -o $@ $< + $(POST_PROCESS_O) + +all: $(PROG) + +# dummy file since AST/ksh/shcomp doesn't use *.po files +# (and "shcomp" is just a frontend which calls directly into libshell, +# e.g. there are no l10n strings here) +$(PROG).po: + $(RM) $(PROG).po + $(TOUCH) $(PROG).po + + +install: all $(ROOTCMD) + +$(PROG): $(OBJECTS) + $(RM) shcomp + $(LINK.c) $(OBJECTS) -o $@ $(LDLIBS) + $(POST_PROCESS) + +clean lint: + +include ../Makefile.targ Index: src/cmd/alias/alias.sh =================================================================== --- src/cmd/alias/alias.sh (revision 0) +++ src/cmd/alias/alias.sh (revision 894) @@ -0,0 +1,32 @@ +#!/usr/bin/ksh93 + +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +builtin basename +cmd="$(basename "$0")" +${cmd} "$@" Index: src/cmd/alias/Makefile =================================================================== --- src/cmd/alias/Makefile (revision 0) +++ src/cmd/alias/Makefile (revision 894) @@ -0,0 +1,81 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +SHELL=/usr/bin/ksh93 + +PROG= alias +ALIASPROG= \ + bg \ + cd \ + command \ + fc \ + fg \ + getopts \ + hash \ + jobs \ + kill \ + printf \ + read \ + rev \ + sleep \ + sum \ + test \ + type \ + ulimit \ + umask \ + unalias \ + wait + +include ../Makefile.cmd + +ROOTALIASPROG= $(ALIASPROG:%=$(ROOTBIN)/%) + +FILEMODE= 555 +OWNER= root +GROUP= bin + +.KEEP_STATE: + +all: $(PROG) + +$(ROOTBIN)/%: $(ROOTBIN)/alias + builtin rm ; \ + builtin ln ; \ + rm -f "$@" ; \ + ln "$(ROOTBIN)/alias" "$@" + +# In the future we should replace the "cat" with a call to +# "shcomp" to compile the script and get better performance. +$(PROG): alias.sh + cat "alias.sh" >"$@" + +install: all $(ROOTALIASPROG) + +clean clobber: + rm -f $(PROG) + +lint: Index: src/cmd/nsadmin/ksh.kshrc =================================================================== --- src/cmd/nsadmin/ksh.kshrc (revision 866) +++ src/cmd/nsadmin/ksh.kshrc (revision 894) @@ -30,13 +30,31 @@ # This file is sourced by interactive ksh93 shells before ${HOME}/.kshrc # -# Enable "gmacs" editor mode if the user did not set an input mode yet -# (for example via ${EDITOR}, ${VISUAL} or any "set -o" flag) +# Enable "gmacs"+"multiline" editor mode if the user did not set an +# input mode yet (for example via ${EDITOR}, ${VISUAL} or any +# "set -o" flag) if [[ "$(set +o)" != ~(E)--(gmacs|emacs|vi)( |$) ]] ; then set -o gmacs + # enable multiline input mode + set -o multiline fi +# define default prompt to @:<"($|#) "> +PS1='${LOGNAME}@$(hostname):$( + # 1. Define ellisis, either Unicode #2026 for unicode locales + # and "..." otherwise + # ([[ "${LC_ALL}/${LANG}" = ~(Elr)(.*UTF-8/.*|/.*UTF-8) ]] + # ensures that the pattern matches the leftmost sequence + # containing *.UTF-8, allowing to match either LC_ALL or + # LANG when LC_ALL is not set) + ellip="$( + [[ "${LC_ALL}/${LANG}" = ~(Elr)(.*UTF-8/.*|/.*UTF-8) ]] && + printf "\u[2026]\n" || print "..." )" + # 2. If PWD is within HOME replace value of HOME with '~' + p="${PWD/~(El)${HOME}/\~}" + # If the PWD is longer than 20 charatcers shorten it to 20 chars + (( ${#p} > 20 )) && + print -r -n "${ellip}${p:${#p}-20:20}" || print -r -n "$p" + # print '#' for user "root" and '$' for normal users + [[ "$LOGNAME" = "root" ]] && print -n "# " || print -n "\$ ")' -# enable multiline input mode -#set -o multiline - Index: src/cmd/ast/msgcc/Makefile =================================================================== --- src/cmd/ast/msgcc/Makefile (revision 866) +++ src/cmd/ast/msgcc/Makefile (revision 894) @@ -25,7 +25,7 @@ # ident "@(#)Makefile 1.1 07/07/10 SMI" # -SHELL=/usr/bin/ksh +SHELL=/usr/bin/ksh93 include ../../Makefile.cmd Index: src/cmd/ast/Makefile =================================================================== --- src/cmd/ast/Makefile (revision 866) +++ src/cmd/ast/Makefile (revision 894) @@ -25,7 +25,7 @@ # ident "@(#)Makefile 1.1 07/06/27 SMI" # -SHELL=/usr/bin/ksh +SHELL=/usr/bin/ksh93 include ../Makefile.cmd Index: src/Makefile.ast =================================================================== --- src/Makefile.ast (revision 866) +++ src/Makefile.ast (revision 894) @@ -34,8 +34,10 @@ # ... about |#pragma prototyped| ... CERRWARN += -erroff=E_UNRECOGNIZED_PRAGMA_IGNORED -# common CPP flags for libshell consumers (ksh etc.) +# common CPP flags for libshell consumers (ksh, shcomp etc.) LIBSHELLCPPFLAGS = \ + -I$(LIBSHELLBASE)/$(LIBSHELLMACH)/src/cmd/ksh93 \ + -I$(LIBSHELLBASE)/common/include \ -I$(ROOT)/usr/include/ast \ -DKSHELL \ -DSHOPT_BRACEPAT \ @@ -60,8 +62,6 @@ -DERROR_CONTEXT_T=Error_context_t \ '-DUSAGE_LICENSE=\ "[-author?David Korn ]"\ - "[-copyright?Copyright (c) 1982-2007 AT&T Knowledge Ventures]"\ + "[-copyright?Copyright (c) 1982-2007 AT&T Intellectual Property]"\ "[-license?http://www.opensource.org/licenses/cpl1.0.txt]"\ "[--catalog?libshell]"' - - Index: src/lib/libshell/Makefile.demo =================================================================== --- src/lib/libshell/Makefile.demo (revision 866) +++ src/lib/libshell/Makefile.demo (revision 894) @@ -31,16 +31,26 @@ fun/dirs \ fun/gnaw \ fun/mandelbrotset1 \ - fun/rssread \ + fun/multifollow \ fun/popd \ fun/pushd \ + fun/rssread \ + fun/shman \ + fun/shnote \ + fun/shpiano \ + fun/shtinyurl \ + fun/shtwitter \ + fun/svcproptree1 \ fun/termclock \ + fun/test_net_sctp \ fun/title \ + fun/xmldocumenttree1 \ tests/shtests \ tests/alias.sh \ tests/append.sh \ tests/arith.sh \ tests/arrays.sh \ + tests/arrays2.sh \ tests/attributes.sh \ tests/basic.sh \ tests/bracket.sh \ @@ -61,6 +71,7 @@ tests/quoting.sh \ tests/quoting2.sh \ tests/return.sh \ + tests/restricted.sh \ tests/select.sh \ tests/substring.sh \ tests/sun_solaris_getconf.sh \ Index: src/lib/libshell/sparcv9/include/ast/shcmd.h =================================================================== --- src/lib/libshell/sparcv9/include/ast/shcmd.h (revision 0) +++ src/lib/libshell/sparcv9/include/ast/shcmd.h (revision 894) @@ -0,0 +1,89 @@ + +/* : : generated by proto : : */ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1992-2007 AT&T Intellectual Property * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Intellectual Property * +* * +* A copy of the License is available at * +* http://www.opensource.org/licenses/cpl1.0.txt * +* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * +* * +* Information and Software Systems Research * +* AT&T Research * +* Florham Park NJ * +* * +* Glenn Fowler * +* David Korn * +* * +***********************************************************************/ + + +/* + * ksh builtin command api + */ + +#ifndef _SHCMD_H +#if !defined(__PROTO__) +#include +#endif +#if !defined(__LINKAGE__) +#define __LINKAGE__ /* 2004-08-11 transition */ +#endif + +#define _SHCMD_H 1 + +#ifndef SH_VERSION +# define Shell_t void +#endif +#ifndef NV_DEFAULT +# define Namval_t void +#endif +#ifndef ERROR_NOTIFY +# define ERROR_NOTIFY 1 +#endif + +typedef int (*Shbltin_f) __PROTO__((int, char**, __V_*)); + +#undef Shbltin_t +typedef struct Shbltin_s +{ + Shell_t *shp; + __V_ *ptr; + int version; + int (*shrun) __PROTO__((int, char**)); + int (*shtrap) __PROTO__((const char*, int)); + void (*shexit) __PROTO__((int)); + Namval_t *(*shbltin) __PROTO__((const char*, Shbltin_f, __V_*)); + unsigned char notify; + unsigned char sigset; + unsigned char nosfio; + Namval_t *bnode; + Namval_t *vnode; + char *data; + int flags; +} Shbltin_t; + +#if defined(SH_VERSION) || defined(_SH_PRIVATE) +# undef Shell_t +# undef Namval_t +#else +# define sh_run(c, ac, av) ((c)?(*((Shbltin_t*)(c))->shrun)(ac,av):-1) +# define sh_system(c,str) ((c)?(*((Shbltin_t*)(c))->shtrap)(str,0):system(str)) +# define sh_exit(c,n) ((c)?(*((Shbltin_t*)(c))->shexit)(n):exit(n)) +# define sh_checksig(c) ((c) && ((Shbltin_t*)(c))->sigset) +# if defined(SFIO_VERSION) || defined(_AST_H) +# define LIB_INIT(c) +# else +# define LIB_INIT(c) ((c) && (((Shbltin_t*)(c))->nosfio = 1)) +# endif +# ifndef _CMD_H +# define cmdinit(ac,av,c,cat,flg) do { if((ac)<=0) return(0); \ + (((Shbltin_t*)(c))->notify = ((flg)&ERROR_NOTIFY)?1:0);} while(0) +# endif +#endif + +#endif Index: src/lib/libshell/sparcv9/include/ast/nval.h =================================================================== --- src/lib/libshell/sparcv9/include/ast/nval.h (revision 866) +++ src/lib/libshell/sparcv9/include/ast/nval.h (revision 894) @@ -3,10 +3,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -222,6 +222,7 @@ #define NV_ADELETE 5 /* delete current subscript */ #define NV_AADD 6 /* add subscript if not found */ #define NV_ACURRENT 7 /* return current subscript Namval_t* */ +#define NV_ASETSUB 8 /* set current subscript */ /* The following are for nv_disc */ #define NV_FIRST 1 @@ -260,6 +261,7 @@ /* name-value pair function prototypes */ extern __MANGLE__ int nv_adddisc __PROTO__((Namval_t*, const char**, Namval_t**)); +extern __MANGLE__ Namarr_t *nv_arrayptr __PROTO__((Namval_t*)); extern __MANGLE__ int nv_clone __PROTO__((Namval_t*, Namval_t*, int)); extern __MANGLE__ void nv_close __PROTO__((Namval_t*)); extern __MANGLE__ __V_ *nv_context __PROTO__((Namval_t*)); Index: src/lib/libshell/sparcv9/include/ast/history.h =================================================================== --- src/lib/libshell/sparcv9/include/ast/history.h (revision 866) +++ src/lib/libshell/sparcv9/include/ast/history.h (revision 894) @@ -3,10 +3,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/sparcv9/include/ast/shell.h =================================================================== --- src/lib/libshell/sparcv9/include/ast/shell.h (revision 866) +++ src/lib/libshell/sparcv9/include/ast/shell.h (revision 894) @@ -3,10 +3,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -36,7 +36,7 @@ * */ -#include +#include #include #ifdef _SH_PRIVATE # include "name.h" @@ -44,7 +44,7 @@ # include #endif /* _SH_PRIVATE */ -#define SH_VERSION 20060510 +#define SH_VERSION 20071012 #undef NOT_USED #define NOT_USED(x) (&x,1) @@ -57,7 +57,6 @@ Shopt_t; typedef void (*Shinit_f) __PROTO__((int)); -typedef int (*Shbltin_f) __PROTO__((int, char*[], __V_*)); typedef int (*Shwait_f) __PROTO__((int, long, int)); union Shnode_u; @@ -158,6 +157,8 @@ #define SH_IOCOPROCESS (-2) #define SH_IOHISTFILE (-3) +#include + /* symbolic value for sh_fdnotify */ #define SH_FDCLOSE (-1) @@ -180,6 +181,7 @@ extern __MANGLE__ int sh_funscope __PROTO__((int,char*[],int(*)(__V_*),__V_*,int)); extern __MANGLE__ Sfio_t *sh_iogetiop __PROTO__((int,int)); extern __MANGLE__ int sh_main __PROTO__((int, char*[], void(*)(int))); +extern __MANGLE__ int sh_run __PROTO__((int, char*[])); extern __MANGLE__ void sh_menu __PROTO__((Sfio_t*, int, char*[])); extern __MANGLE__ Namval_t *sh_addbuiltin __PROTO__((const char*, int(*)(int, char*[],__V_*), __V_*)); extern __MANGLE__ char *sh_fmtq __PROTO__((const char*)); Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/locale =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/locale (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/locale (revision 894) @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/locale by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/locale by iffe version 2007-04-04 : : */ #ifndef _def_locale_ksh93 #define _def_locale_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_locale 1 /* #include ok */ #define _hdr_wchar 1 /* #include ok */ Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/execargs =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/execargs (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/execargs (revision 894) @@ -2,9 +2,9 @@ #ifndef _def_execargs_ksh93 #define _def_execargs_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #endif Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/sigfeatures =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/sigfeatures (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/sigfeatures (revision 894) @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/sigfeatures by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/sigfeatures by iffe version 2007-04-04 : : */ #ifndef _def_sigfeatures_ksh93 #define _def_sigfeatures_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_sigrelse 1 /* sigrelse() in default lib(s) */ #define _lib_sigprocmask 1 /* sigprocmask() in default lib(s) */ @@ -22,8 +22,8 @@ #endif #ifdef _lib_sigprocmask # define sh_sigaction(s,action) do { sigset_t ss;\ - sigemptyset(&ss);\ - sigaddset(&ss,(s));\ + sigemptyset(&ss); \ + if(s) sigaddset(&ss,(s)); \ sigprocmask(action,&ss,0); \ }while(0) # define sigrelease(s) sh_sigaction(s,SIG_UNBLOCK) Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/setjmp =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/setjmp (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/setjmp (revision 894) @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/setjmp by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/setjmp by iffe version 2007-04-04 : : */ #ifndef _def_setjmp_ksh93 #define _def_setjmp_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_sigsetjmp 1 /* sigsetjmp() in default lib(s) */ #define _lib__setjmp 1 /* _setjmp() in default lib(s) */ Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/rlimits =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/rlimits (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/rlimits (revision 894) @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/rlimits by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/rlimits by iffe version 2007-04-04 : : */ #ifndef _def_rlimits_ksh93 #define _def_rlimits_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _sys_resource 1 /* #include ok */ #define _lib_getrlimit 1 /* getrlimit() in default lib(s) */ Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/ttys =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/ttys (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/ttys (revision 894) @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/ttys by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/ttys by iffe version 2007-04-04 : : */ #ifndef _def_ttys_ksh93 #define _def_ttys_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_termios 1 /* #include ok */ #define _hdr_termio 1 /* #include ok */ Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/dynamic =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/dynamic (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/dynamic (revision 894) @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/dynamic by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/dynamic by iffe version 2007-04-04 : : */ #ifndef _def_dynamic_ksh93 #define _def_dynamic_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_dlfcn 1 /* #include ok */ #define _sys_dl 1 /* #include ok */ Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/cmds =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/cmds (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/cmds (revision 894) @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/cmds by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/cmds by iffe version 2007-04-04 : : */ #ifndef _def_cmds_ksh93 #define _def_cmds_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _cmd_newgrp 1 /* newgrp in ?(/usr)/(bin|etc|ucb) */ #define _bin_newgrp 1 /* /bin/newgrp found */ Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/poll =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/poll (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/poll (revision 894) @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/poll by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/poll by iffe version 2007-04-04 : : */ #ifndef _def_poll_ksh93 #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -62,10 +62,10 @@ #define _def_poll_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_poll 1 /* #include ok */ #define _hdr_netinet_in 1 /* #include ok */ Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/externs =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/externs (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/externs (revision 894) @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/externs by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/externs by iffe version 2007-04-04 : : */ #ifndef _def_externs_ksh93 #if !defined(__PROTO__) @@ -63,10 +63,10 @@ #define _def_externs_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_exec_attr 1 /* #include ok */ #define _hdr_math 1 /* #include ok */ @@ -78,4 +78,6 @@ #define _lib_fork 1 /* fork() in default lib(s) */ #define _lib_spawnveg 1 /* spawnveg() in default lib(s) */ #define _lib_fchdir 1 /* fchdir() in default lib(s) */ +#define _sys_mman 1 /* #include ok */ +#define _lib_memcntl 1 /* memcntl() in default lib(s) */ #endif Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/math =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/math (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/math (revision 894) @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/math.sh by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/math.sh by iffe version 2007-04-04 : : */ #ifndef _def_math_ksh93 #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -62,14 +62,14 @@ #define _def_math_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ -/* : : generated by iffe from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/data/math.tab : : */ +/* : : generated by iffe from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/data/math.tab : : */ typedef Sfdouble_t (*Math_f) __PROTO__((Sfdouble_t,...)); Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/acct =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/acct (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/acct (revision 894) @@ -2,10 +2,10 @@ #ifndef _def_acct_ksh93 #define _def_acct_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_acct 1 /* acct() in default lib(s) */ #define _sys_acct 1 /* #include ok */ Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/options =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/options (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/options (revision 894) @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/options by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/options by iffe version 2007-04-04 : : */ #ifndef _def_options_ksh93 #define _def_options_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define SHELLMAGIC 1 #ifndef SHOPT_DEVFD Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/pstat =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/pstat (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/pstat (revision 894) @@ -2,9 +2,9 @@ #ifndef _def_pstat_ksh93 #define _def_pstat_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #endif Index: src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/time =================================================================== --- src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/time (revision 866) +++ src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/time (revision 894) @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/src/cmd/ksh93/features/time by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/src/cmd/ksh93/features/time by iffe version 2007-04-04 : : */ #ifndef _def_time_ksh93 #define _def_time_ksh93 1 #define _sys_types 1 /* #include ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20071101/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_utime 1 /* #include ok */ #define _lib_gettimeofday 1 /* gettimeofday() in default lib(s) */ Index: src/lib/libshell/common/RELEASE =================================================================== --- src/lib/libshell/common/RELEASE (revision 866) +++ src/lib/libshell/common/RELEASE (revision 894) @@ -1,4 +1,69 @@ -07-04-18 --- Release ksh93s+ --- +07-11-01 --- Release ksh93s+ --- +07-11-01 A bug in which typeset -f fun did not display the function definition + when invoked in a subshell has been fixed. +07-10-29 The sleep builtin was fixed so that all floating point constants + are valid operands. +07-10-10 A bug in which the locale was not being restored after + LANG=value command has been fixed. +07-09-20 A bug in which a nameref to a compound variable that was local + to the calling function would not expand correctly when displaying + is value has been fixed. +07-09-19 A bug which cause cause a core dump if .sh.edchar returned + 80 characters or more from a keyboard trap has been fixed. +07-09-14 A bug in which could cause a core dump when more than 8 file + descriptors were in use has been fixed. +07-09-10 A bug in which creating a name reference to an instance of + an array when the array name is itself a reference has been fixed. +07-09-10 The file completion code has been modified so that after an = in + any word, each : will be considered a path delimiter. +07-09-06 A bug in which subprocess cleanup could corrupt the malloc() heap + has been fixed. +07-08-26 A bug in which a name reference to an associatve array instance + could cause the subscript to be evaluated as an arithmetic expression + has been fixed. +07-08-22 A bug in which the value of an array instance was of a compound + variable was not expanded correctly has been fixed. +07-08-14 A bug which could cause a core dump when a compound assignment was + made to a compound variable element with a typeset -a attribute + has been fixed. +07-08-08 A bug in which a trap ignored in a subshell caused it to be + ignored by the parent has been fixed. +07-08-07 A bug in which the set command would generated erroneous output + for a variable with the -RZ attribute if the variable name had been + passed to a function has been fixed. +07-08-02 A bug in which read x[1] could core dump has been fixed. +07-08-02 A second bug in which after read x[sub] into an associative array + of an element that hasn't been assigned could lead to a core dump + has been fixed. +07-07-31 A bug in which a pipeline that completed correctly could have + an exit status of 127 when pipefail was enabled has been fixed. +07-07-09 The SHOPT_AUDIT compile option has been added for keyboard logging. +07-06-25 In vi insert mode, ksh no longer emits a backspace character + before the carraige return when the newline is entered. +07-06-25 A bug in which pipefail would cause a command to return 0 + when the pipeline was the last command and the failure happened + on a component other than the last has been fixed. +07-06-25 A bug in the expansion of ${var/pattern/rep} when pattern or rep + contained a left parenthesis in single quotes has been fixed. +07-06-18 The braces for a subscripted variable with ${var[sub]} are now + optional when inside [[...]], ((...)) or as a subscript. +07-05-28 A bug in brace expansion in which single and double quotes did + not treat the comma as a literal character has been fixed. +07-05-24 The -p option of whence now disables -v. +07-05-23 Several bug fixes in compound variables and arrays of arrays + have been made. +07-05-15 A bug in which the %B format of printf was affected by the + locale has been fixed. +07-05-14 A bug in which \ was not removed in the replacement pattern with + ${var/pattern/rep} when it was not followed by \ or a digit has + been fixed. +07-05-10 A bug in which ksh -R file core dumped if no script was specified + has been fixed. it not displays an error message. +07-05-07 Added additional Solaris signals to signal table. +07-04-30 A bug in which a pipeline with command substitution inside a + function could cause a pipeline that invokes this function to + hang when the pipefail option is on has been fixed. +07-04-30 Added -q to whence. 07-04-18 A small memory leak with each redirection of a non-builtin has been fixed. 07-03-08 A bug in which set +o output command line options has been fixed. Index: src/lib/libshell/common/include/builtins.h =================================================================== --- src/lib/libshell/common/include/builtins.h (revision 866) +++ src/lib/libshell/common/include/builtins.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -131,7 +131,6 @@ extern const char e_histopen[]; extern const char e_condition[]; extern const char e_badrange[]; -extern const char e_numeric[]; extern const char e_trap[]; extern const char e_direct[]; extern const char e_defedit[]; Index: src/lib/libshell/common/include/path.h =================================================================== --- src/lib/libshell/common/include/path.h (revision 866) +++ src/lib/libshell/common/include/path.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/jobs.h =================================================================== --- src/lib/libshell/common/include/jobs.h (revision 866) +++ src/lib/libshell/common/include/jobs.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -64,6 +64,7 @@ pid_t p_fgrp; /* process group when stopped */ short p_job; /* job number of process */ unsigned short p_exit; /* exit value or signal number */ + unsigned short p_exitmin; /* minimum exit value for xargs */ unsigned short p_flag; /* flags - see below */ int p_env; /* subshell environment number */ #ifdef JOBS @@ -105,8 +106,19 @@ #ifdef JOBS +#if !_std_malloc +#include +#if VMALLOC_VERSION >= 20070911L +#define vmbusy() (vmstat(0,0)!=0) +#endif +#endif +#ifndef vmbusy +#define vmbusy() 0 +#endif + + #define job_lock() (job.in_critical++) -#define job_unlock() do{if(!--job.in_critical&&job.savesig)job_reap(job.savesig);}while(0) +#define job_unlock() do{if(!--job.in_critical&&job.savesig&&!vmbusy())job_reap(job.savesig);}while(0) extern const char e_jobusage[]; extern const char e_done[]; Index: src/lib/libshell/common/include/nval.h =================================================================== --- src/lib/libshell/common/include/nval.h (revision 866) +++ src/lib/libshell/common/include/nval.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -213,6 +213,7 @@ #define NV_ADELETE 5 /* delete current subscript */ #define NV_AADD 6 /* add subscript if not found */ #define NV_ACURRENT 7 /* return current subscript Namval_t* */ +#define NV_ASETSUB 8 /* set current subscript */ /* The following are for nv_disc */ #define NV_FIRST 1 @@ -249,6 +250,7 @@ /* name-value pair function prototypes */ extern int nv_adddisc(Namval_t*, const char**, Namval_t**); +extern Namarr_t *nv_arrayptr(Namval_t*); extern int nv_clone(Namval_t*, Namval_t*, int); extern void nv_close(Namval_t*); extern void *nv_context(Namval_t*); Index: src/lib/libshell/common/include/history.h =================================================================== --- src/lib/libshell/common/include/history.h (revision 866) +++ src/lib/libshell/common/include/history.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/shnodes.h =================================================================== --- src/lib/libshell/common/include/shnodes.h (revision 866) +++ src/lib/libshell/common/include/shnodes.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/ulimit.h =================================================================== --- src/lib/libshell/common/include/ulimit.h (revision 866) +++ src/lib/libshell/common/include/ulimit.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/national.h =================================================================== --- src/lib/libshell/common/include/national.h (revision 866) +++ src/lib/libshell/common/include/national.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/shell.h =================================================================== --- src/lib/libshell/common/include/shell.h (revision 866) +++ src/lib/libshell/common/include/shell.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -27,7 +27,7 @@ * */ -#include +#include #include #ifdef _SH_PRIVATE # include "name.h" @@ -35,7 +35,7 @@ # include #endif /* _SH_PRIVATE */ -#define SH_VERSION 20060510 +#define SH_VERSION 20071012 #undef NOT_USED #define NOT_USED(x) (&x,1) @@ -48,7 +48,6 @@ Shopt_t; typedef void (*Shinit_f)(int); -typedef int (*Shbltin_f)(int, char*[], void*); typedef int (*Shwait_f)(int, long, int); union Shnode_u; @@ -149,6 +148,8 @@ #define SH_IOCOPROCESS (-2) #define SH_IOHISTFILE (-3) +#include + /* symbolic value for sh_fdnotify */ #define SH_FDCLOSE (-1) @@ -170,6 +171,7 @@ extern int sh_funscope(int,char*[],int(*)(void*),void*,int); extern Sfio_t *sh_iogetiop(int,int); extern int sh_main(int, char*[], void(*)(int)); +extern int sh_run(int, char*[]); extern void sh_menu(Sfio_t*, int, char*[]); extern Namval_t *sh_addbuiltin(const char*, int(*)(int, char*[],void*), void*); extern char *sh_fmtq(const char*); Index: src/lib/libshell/common/include/io.h =================================================================== --- src/lib/libshell/common/include/io.h (revision 866) +++ src/lib/libshell/common/include/io.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/variables.h =================================================================== --- src/lib/libshell/common/include/variables.h (revision 866) +++ src/lib/libshell/common/include/variables.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/argnod.h =================================================================== --- src/lib/libshell/common/include/argnod.h (revision 866) +++ src/lib/libshell/common/include/argnod.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -123,6 +123,7 @@ #define ARG_OPTIMIZE 0x200 /* try to optimize */ #define ARG_NOGLOB 0x400 /* no file name expansion */ #define ARG_LET 0x800 /* processing let command arguments */ +#define ARG_ARRAYOK 0x1000 /* $x[sub] ==> ${x[sub]} */ extern char **sh_argbuild(int*,const struct comnod*,int); extern struct dolnod *sh_argcreate(char*[]); Index: src/lib/libshell/common/include/fault.h =================================================================== --- src/lib/libshell/common/include/fault.h (revision 866) +++ src/lib/libshell/common/include/fault.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/terminal.h =================================================================== --- src/lib/libshell/common/include/terminal.h (revision 866) +++ src/lib/libshell/common/include/terminal.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/lexstates.h =================================================================== --- src/lib/libshell/common/include/lexstates.h (revision 866) +++ src/lib/libshell/common/include/lexstates.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/fcin.h =================================================================== --- src/lib/libshell/common/include/fcin.h (revision 866) +++ src/lib/libshell/common/include/fcin.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/test.h =================================================================== --- src/lib/libshell/common/include/test.h (revision 866) +++ src/lib/libshell/common/include/test.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/name.h =================================================================== --- src/lib/libshell/common/include/name.h (revision 866) +++ src/lib/libshell/common/include/name.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -67,7 +67,6 @@ #define ARRAY_NOCLONE (16L< 255 */ #define BLT_DCL (NV_TAGGED) /* declaration command */ +#define BLT_NOSFIO (NV_IMPORT) /* doesn't use sfio */ #define nv_isref(n) (nv_isattr((n),NV_REF)==NV_REF) #define nv_istable(n) (nv_isattr((n),NV_TABLE|NV_LJUST|NV_RJUST)==NV_TABLE) #define is_abuiltin(n) (nv_isattr(n,NV_BLTIN)==NV_BLTIN) @@ -138,9 +138,6 @@ #define nv_reftree(n) ((n)->nvalue.nrp->root) #define nv_reftable(n) ((n)->nvalue.nrp->table) #define nv_refsub(n) ((n)->nvalue.nrp->sub) -#if SHOPT_OO -# define nv_class(np) (nv_isattr(np,NV_REF|NV_IMPORT)?0:(Namval_t*)((np)->nvenv)) -#endif /* SHOPT_OO */ /* ... etc */ @@ -157,7 +154,6 @@ extern int array_maxindex(Namval_t*); extern char *nv_endsubscript(Namval_t*, char*, int); extern Namfun_t *nv_cover(Namval_t*); -extern Namarr_t *nv_arrayptr(Namval_t*); extern int nv_setnotify(Namval_t*,char **); extern int nv_unsetnotify(Namval_t*,char **); extern void nv_setlist(struct argnod*, int); @@ -181,6 +177,7 @@ extern Namval_t *nv_mount(Namval_t*, const char *name, Dt_t*); extern Namval_t *nv_arraychild(Namval_t*, Namval_t*, int); extern int nv_compare(Dt_t*, Void_t*, Void_t*, Dtdisc_t*); +extern int nv_isvtree(Namval_t*); extern const Namdisc_t RESTRICTED_disc; extern char nv_local; Index: src/lib/libshell/common/include/streval.h =================================================================== --- src/lib/libshell/common/include/streval.h (revision 866) +++ src/lib/libshell/common/include/streval.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/defs.h =================================================================== --- src/lib/libshell/common/include/defs.h (revision 866) +++ src/lib/libshell/common/include/defs.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -34,6 +34,10 @@ #include #include "fault.h" #include "argnod.h" +#include "name.h" +#define _SH_PRIVATE +#include +#undef _SH_PRIVATE #ifndef pointerof #define pointerof(x) ((void*)((char*)0+(x))) @@ -52,6 +56,8 @@ * note that the first few fields have to be the same as for * Shscoped_t in */ + + struct sh_scoped { struct sh_scoped *prevst; /* pointer to previous state */ @@ -179,6 +185,7 @@ struct checkpt checkbase; \ Shinit_f userinit; \ Shbltin_f bltinfun; \ + Shbltin_t bltindata; \ Shwait_f waitevent; \ char *cur_line; \ char *rcfile; \ Index: src/lib/libshell/common/include/shtable.h =================================================================== --- src/lib/libshell/common/include/shtable.h (revision 866) +++ src/lib/libshell/common/include/shtable.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -33,20 +33,20 @@ typedef struct shtable1 { const char *sh_name; - unsigned sh_number; + const unsigned sh_number; } Shtable_t; struct shtable2 { const char *sh_name; - unsigned sh_number; + const unsigned sh_number; const char *sh_value; }; struct shtable3 { const char *sh_name; - unsigned sh_number; + const unsigned sh_number; int (*sh_value)(int, char*[], void*); }; Index: src/lib/libshell/common/include/shlex.h =================================================================== --- src/lib/libshell/common/include/shlex.h (revision 866) +++ src/lib/libshell/common/include/shlex.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/edit.h =================================================================== --- src/lib/libshell/common/include/edit.h (revision 866) +++ src/lib/libshell/common/include/edit.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/version.h =================================================================== --- src/lib/libshell/common/include/version.h (revision 866) +++ src/lib/libshell/common/include/version.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/timeout.h =================================================================== --- src/lib/libshell/common/include/timeout.h (revision 866) +++ src/lib/libshell/common/include/timeout.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/include/env.h =================================================================== --- src/lib/libshell/common/include/env.h (revision 866) +++ src/lib/libshell/common/include/env.h (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/edit/vi.c =================================================================== --- src/lib/libshell/common/edit/vi.c (revision 866) +++ src/lib/libshell/common/edit/vi.c (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -1472,6 +1472,7 @@ if( mode != SEARCH ) save_last(vp); refresh(vp,INPUT); + last_phys++; return; case '\t': /** command completion **/ Index: src/lib/libshell/common/edit/history.c =================================================================== --- src/lib/libshell/common/edit/history.c (revision 866) +++ src/lib/libshell/common/edit/history.c (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -49,13 +49,23 @@ #define HIST_BSIZE 4096 /* size of history file buffer */ #define HIST_DFLT 512 /* default size of history list */ +#if SHOPT_AUDIT +# define _HIST_AUDIT Sfio_t *auditfp; \ + char *tty; \ + int auditmask; +#else +# define _HIST_AUDIT +#endif + #define _HIST_PRIVATE \ + void *histshell; \ off_t histcnt; /* offset into history file */\ off_t histmarker; /* offset of last command marker */ \ int histflush; /* set if flushed outside of hflush() */\ int histmask; /* power of two mask for histcnt */ \ char histbuff[HIST_BSIZE+1]; /* history file buffer */ \ int histwfail; \ + _HIST_AUDIT \ off_t histcmds[2]; /* offset for recent commands, must be last */ #define hist_ind(hp,c) ((int)((c)&(hp)->histmask)) @@ -119,10 +129,10 @@ static char *logname; # include - int acctinit(void) + static int acctinit(History_t *hp) { register char *cp, *acctfile; - Namval_t *np = nv_search("ACCTFILE",sh.var_tree,0); + Namval_t *np = nv_search("ACCTFILE",((Shell_t*)hp->histshell)->var_tree,0); if(!np || !(acctfile=nv_getval(np))) return(0); @@ -135,7 +145,6 @@ cp = "unknown"; } logname = strdup(cp); - if((acctfd=sh_open(acctfile, O_BINARY|O_WRONLY|O_APPEND|O_CREAT,S_IRUSR|S_IWUSR))>=0 && (unsigned)acctfd < 10) @@ -164,6 +173,42 @@ } #endif /* SHOPT_ACCTFILE */ +#if SHOPT_AUDIT +static int sh_checkaudit(History_t *hp, const char *name, char *logbuf, size_t len) +{ + Shell_t *shp = (Shell_t*)hp->histshell; + char *buff, *cp, *last; + int id1, id2, r=0, n, fd; + if((fd=open(name, O_RDONLY)) < 0) + return(0); + if((n = read(fd, logbuf,len-1)) < 0) + goto done; + while(logbuf[n-1]=='\n') + n--; + logbuf[n] = 0; + if(!(cp=strchr(logbuf,';')) && !(cp=strchr(logbuf,' '))) + goto done; + *cp = 0; + do + { + cp++; + id1 = id2 = strtol(cp,&last,10); + if(*last=='-') + id1 = strtol(last+1,&last,10); + if(shp->euserid >=id1 && shp->euserid <= id2) + r |= 1; + if(shp->userid >=id1 && shp->userid <= id2) + r |= 2; + cp = last; + } + while(*cp==';' || *cp==' '); +done: + close(fd); + return(r); + +} +#endif /*SHOPT_AUDIT*/ + static const unsigned char hist_stamp[2] = { HIST_UNDO, HIST_VERSION }; static const Sfdisc_t hist_disc = { NULL, hist_write, NULL, hist_exceptf, NULL}; @@ -266,6 +311,7 @@ return(0); } sh.hist_ptr = hist_ptr = hp; + hp->histshell = (void*)&sh; hp->histsize = maxlines; hp->histmask = histmask; hp->histfp= sfnew(NIL(Sfio_t*),hp->histbuff,HIST_BSIZE,fd,SF_READ|SF_WRITE|SF_APPENDWR|SF_SHARE); @@ -327,8 +373,31 @@ sh_timeradd(1000L*(HIST_RECENT-30), 1, hist_touch, (void*)hp->histname); #if SHOPT_ACCTFILE if(sh_isstate(SH_INTERACTIVE)) - acctinit(); + acctinit(hp); #endif /* SHOPT_ACCTFILE */ +#if SHOPT_AUDIT + { + char buff[SF_BUFSIZE]; + hp->auditfp = 0; + if(sh_isstate(SH_INTERACTIVE) && (hp->auditmask=sh_checkaudit(hp,SHOPT_AUDITFILE, buff, sizeof(buff)))) + { + if((fd=sh_open(buff,O_BINARY|O_WRONLY|O_APPEND|O_CREAT,S_IRUSR|S_IWUSR))>=0 && fd < 10) + { + int n; + if((n = sh_fcntl(fd,F_DUPFD, 10)) >= 0) + { + sh_close(fd); + fd = n; + } + } + if(fd>=0) + { + hp->tty = strdup(ttyname(2)); + hp->auditfp = sfnew((Sfio_t*)0,NULL,-1,fd,SF_WRITE); + } + } + } +#endif return(1); } @@ -338,10 +407,19 @@ void hist_close(register History_t *hp) { + Shell_t *shp = (Shell_t*)hp->histshell; sfclose(hp->histfp); +#if SHOPT_AUDIT + if(hp->auditfp) + { + if(hp->tty) + free((void*)hp->tty); + sfclose(hp->auditfp); + } +#endif /* SHOPT_AUDIT */ free((char*)hp); hist_ptr = 0; - sh.hist_ptr = 0; + shp->hist_ptr = 0; #if SHOPT_ACCTFILE if(acctfd) { @@ -718,6 +796,15 @@ *bufptr++ = '\n'; *bufptr++ = 0; size = bufptr - (char*)buff; +#if SHOPT_AUDIT + if(hp->auditfp) + { + Shell_t *shp = (Shell_t*)hp->histshell; + time_t t=time((time_t*)0); + sfprintf(hp->auditfp,"%u;%u;%s;%*s%c",sh_isoption(SH_PRIVILEGED)?shp->euserid:shp->userid,t,hp->tty,size,buff,0); + sfsync(hp->auditfp); + } +#endif /* SHOPT_AUDIT */ #if SHOPT_ACCTFILE if(acctfd) { @@ -876,7 +963,7 @@ } #if KSHELL /* allow a search to be aborted */ - if(sh.trapnote&SH_SIGSET) + if(((Shell_t*)hp->histshell)->trapnote&SH_SIGSET) break; #endif /* KSHELL */ } @@ -986,7 +1073,7 @@ if(!hp) #if KSHELL { - strncpy(string,sh.lastarg,size); + strncpy(string,((Shell_t*)hp->histshell)->lastarg,size); return(string); } #else Index: src/lib/libshell/common/edit/edit.c =================================================================== --- src/lib/libshell/common/edit/edit.c (revision 866) +++ src/lib/libshell/common/edit/edit.c (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -583,6 +583,7 @@ void ed_setup(register Edit_t *ep, int fd, int reedit) { + Shell_t *shp = ep->sh; register char *pp; register char *last; char *ppmax; @@ -592,25 +593,28 @@ ep->e_fd = fd; ep->e_multiline = sh_isoption(SH_MULTILINE)!=0; #ifdef SIGWINCH - if(!(sh.sigflag[SIGWINCH]&SH_SIGFAULT)) + if(!(shp->sigflag[SIGWINCH]&SH_SIGFAULT)) { signal(SIGWINCH,sh_fault); - sh.sigflag[SIGWINCH] |= SH_SIGFAULT; + shp->sigflag[SIGWINCH] |= SH_SIGFAULT; } + pp = shp->st.trapcom[SIGWINCH]; + shp->st.trapcom[SIGWINCH] = 0; sh_fault(SIGWINCH); + shp->st.trapcom[SIGWINCH] = pp; #endif #if KSHELL ep->e_stkptr = stakptr(0); ep->e_stkoff = staktell(); - if(!(last = sh.prompt)) + if(!(last = shp->prompt)) last = ""; - sh.prompt = 0; + shp->prompt = 0; #else last = ep->e_prbuff; #endif /* KSHELL */ - if(sh.hist_ptr) + if(shp->hist_ptr) { - register History_t *hp = sh.hist_ptr; + register History_t *hp = shp->hist_ptr; ep->e_hismax = hist_max(hp); ep->e_hismin = hist_min(hp); } @@ -642,7 +646,7 @@ { if(pp < ppmax) *pp++ = c; - if(c=='\a') + if(c=='\a' || c==ESC || c=='\r') break; if(skip || (c>='0' && c<='9')) continue; @@ -651,6 +655,8 @@ else if(n>2 || (c!= '[' && c!= ']')) break; } + if(c==0 || c==ESC || c=='\r') + last--; qlen += (n+1); break; } @@ -703,7 +709,7 @@ if(pp-ep->e_prompt > qlen) ep->e_plen = pp - ep->e_prompt - qlen; *pp = 0; - if((ep->e_wsize -= ep->e_plen) < 7) + if(!ep->e_multiline && (ep->e_wsize -= ep->e_plen) < 7) { register int shift = 7-ep->e_wsize; ep->e_wsize = 7; @@ -736,7 +742,7 @@ #ifdef _cmd_tput char *term; if(!ep->e_term) - ep->e_term = nv_search("TERM",sh.var_tree,0); + ep->e_term = nv_search("TERM",shp->var_tree,0); if(ep->e_term && (term=nv_getval(ep->e_term)) && strlen(term)e_termname) && strcmp(term,ep->e_termname)) { sh_trap(".sh.subscript=$(tput cuu1 2>/dev/null)",0); @@ -774,8 +780,9 @@ register Edit_t *ep = (Edit_t*)context; register int rv= -1; register int delim = (ep->e_raw==RAWMODE?'\r':'\n'); + Shell_t *shp = ep->sh; int mode = -1; - int (*waitevent)(int,long,int) = sh.waitevent; + int (*waitevent)(int,long,int) = shp->waitevent; if(ep->e_raw==ALTMODE) mode = 1; if(size < 0) @@ -785,10 +792,10 @@ } sh_onstate(SH_TTYWAIT); errno = EINTR; - sh.waitevent = 0; + shp->waitevent = 0; while(rv<0 && errno==EINTR) { - if(sh.trapnote&(SH_SIGSET|SH_SIGTRAP)) + if(shp->trapnote&(SH_SIGSET|SH_SIGTRAP)) goto done; /* an interrupt that should be ignored */ errno = 0; @@ -824,7 +831,7 @@ rv = read(fd,buff,size); if(rv>=0 || errno!=EINTR) break; - if(sh.trapnote&(SH_SIGSET|SH_SIGTRAP)) + if(shp->trapnote&(SH_SIGSET|SH_SIGTRAP)) goto done; /* an interrupt that should be ignored */ fixtime(); @@ -833,7 +840,7 @@ else if(rv>=0 && mode>0) rv = read(fd,buff,rv>0?rv:1); done: - sh.waitevent = waitevent; + shp->waitevent = waitevent; sh_offstate(SH_TTYWAIT); return(rv); } @@ -960,7 +967,7 @@ /* check for possible key mapping */ if((c = ep->e_lbuf[--ep->e_lookahead]) < 0) { - if(mode<=0 && sh.st.trap[SH_KEYTRAP]) + if(mode<=0 && ep->sh->st.trap[SH_KEYTRAP]) { n=1; if((readin[0]= -c) == ESC) @@ -1075,7 +1082,14 @@ col = pos.col; } else + { pos.line = 0; + while(col > ep->e_winsz) + { + pos.line++; + col -= (ep->e_winsz+1); + } + } while(off-->0) { if(c) @@ -1122,20 +1136,22 @@ oldline = newpos.line; if(ep->e_curpos.line > newpos.line) { - int n; + int n,pline,plen=ep->e_plen; for(;ep->e_curpos.line > newpos.line; ep->e_curpos.line--) ed_putstring(ep,CURSOR_UP); - if(newpos.line==0 && (n=ep->e_plen- ep->e_curpos.col)>0) + pline = plen/(ep->e_winsz+1); + plen -= pline*(ep->e_winsz+1); + if((n=plen- ep->e_curpos.col)>0) { ep->e_curpos.col += n; ed_putchar(ep,'\r'); - if(!ep->e_crlf) + if(!ep->e_crlf && pline==0) ed_putstring(ep,ep->e_prompt); else { - int m = ep->e_winsz+1-ep->e_plen; + int m = ep->e_winsz+1-plen; ed_putchar(ep,'\n'); - n = ep->e_plen; + n = plen; if(m < ed_genlen(physical)) { while(physical[m] && n-->0) @@ -1161,10 +1177,11 @@ newpos.line=0; if(delta<0) { + int bs= newpos.line && ep->e_plen>ep->e_winsz; /*** move to left ***/ delta = -delta; /*** attempt to optimize cursor movement ***/ - if(!ep->e_crlf || (2*delta <= ((old-first)+(newpos.line?0:ep->e_plen))) ) + if(!ep->e_crlf || bs || (2*delta <= ((old-first)+(newpos.line?0:ep->e_plen))) ) { for( ; delta; delta-- ) ed_putchar(ep,'\b'); @@ -1446,6 +1463,7 @@ { register char *cp; int savexit; + Shell_t *shp = ep->sh; #if SHOPT_MULTIBYTE char buff[MAXLINE]; ed_external(ep->e_inbuf,cp=buff); @@ -1465,16 +1483,19 @@ nv_putval(ED_COLNOD,(char*)&ep->e_col,NV_NOFREE|NV_INTEGER); nv_putval(ED_TXTNOD,(char*)cp,NV_NOFREE); nv_putval(ED_MODENOD,ep->e_vi_insert,NV_NOFREE); - savexit = sh.savexit; - sh_trap(sh.st.trap[SH_KEYTRAP],0); - sh.savexit = savexit; + savexit = shp->savexit; + sh_trap(shp->st.trap[SH_KEYTRAP],0); + shp->savexit = savexit; if((cp = nv_getval(ED_CHRNOD)) == inbuff) nv_unset(ED_CHRNOD); - else + else if(bufsize>0) { strncpy(inbuff,cp,bufsize); + inbuff[bufsize-1]='\0'; insize = strlen(inbuff); } + else + insize = 0; nv_unset(ED_TXTNOD); return(insize); } Index: src/lib/libshell/common/edit/hexpand.c =================================================================== --- src/lib/libshell/common/edit/hexpand.c (revision 866) +++ src/lib/libshell/common/edit/hexpand.c (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/edit/emacs.c =================================================================== --- src/lib/libshell/common/edit/emacs.c (revision 866) +++ src/lib/libshell/common/edit/emacs.c (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * Index: src/lib/libshell/common/edit/completion.c =================================================================== --- src/lib/libshell/common/edit/completion.c (revision 866) +++ src/lib/libshell/common/edit/completion.c (revision 894) @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2007 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 * @@ -68,7 +68,8 @@ static char *find_begin(char outbuff[], char *last, int endchar, int *type) { register char *cp=outbuff, *bp, *xp; - register int c,inquote = 0; + register int c,inquote = 0, inassign=0; + int mode=*type; bp = outbuff; *type = 0; while(cp < last) @@ -94,7 +95,7 @@ if(inquote == '\'') break; c = *(unsigned char*)cp; - if(isaletter(c) || c=='{') + if(mode!='*' && (isaletter(c) || c=='{')) { int dot = '.'; if(c=='{') @@ -120,6 +121,7 @@ } else if(c=='(') { + *type = mode; xp = find_begin(cp,last,')',type); if(*(cp=xp)!=')') bp = xp; @@ -129,8 +131,15 @@ break; case '=': if(!inquote) + { bp = cp; + inassign = 1; + } break; + case ':': + if(!inquote && inassign) + bp = cp; + break; case '~': if(*cp=='(') break; @@ -139,7 +148,10 @@ if(c && c==endchar) return(xp); if(!inquote && ismeta(c)) + { bp = cp; + inassign = 0; + } break; } } @@ -207,6 +219,7 @@ register int c; char *last = out; c = *(unsigned char*)out; + var = mode; begin = out = find_begin(outbuff,last,0,&var); /* addstar set to zero if * should not be added */ if(var=='$') @@ -373,14 +386,9 @@ { Namval_t *np; /* add as tracked alias */ -#ifdef PATH_BFPATH Pathcomp_t *pp; if(*cp=='/' && (pp=path_dirfind(sh.pathlist,cp,'/')) && (np=nv_search(begin,sh.track_tree,NV_ADD))) path_alias(np,pp); -#else - if(*cp=='/' && (np=nv_search(begin,sh.track_tree,NV_ADD))) - path_alias(np,cp); -#endif out = strcopy(begin,cp); } /* add quotes if necessary */ Index: src/lib/libshell/common/fun/termclock =================================================================== --- src/lib/libshell/common/fun/termclock (revision 866) +++ src/lib/libshell/common/fun/termclock (revision 894) @@ -1,4 +1,4 @@ -#!/bin/ksh93 +#!/usr/bin/ksh93 # # CDDL HEADER START @@ -25,7 +25,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "@(#)termclock 1.1 07/06/27 SMI" +# ident "%Z%%M% %I% %E% SMI" # # @@ -35,6 +35,20 @@ # Solaris needs /usr/xpg4/bin/ because the tools in /usr/bin are not POSIX-conformant export PATH=/usr/xpg4/bin:/bin:/usr/bin +# Make sure all math stuff runs in the "C" locale to avoid problems +# with alternative # radix point representations (e.g. ',' instead of +# '.' in de_DE.*-locales). This needs to be set _before_ any +# floating-point constants are defined in this script). +if [[ "${LC_ALL}" != "" ]] ; then + export \ + LC_MONETARY="${LC_ALL}" \ + LC_MESSAGES="${LC_ALL}" \ + LC_COLLATE="${LC_ALL}" \ + LC_CTYPE="${LC_ALL}" + unset LC_ALL +fi +export LC_NUMERIC=C + function fatal_error { print -u 2 "${progname}: $@" @@ -45,9 +59,9 @@ function tput_cup { integer y="$1" x="$2" - nameref c=tput_cup_cache["${y}_${x}"] + nameref c="tput_cup_cache[\"${y}_${x}\"]" - if [ "$c" == "" ] ; then + if [[ "$c" == "" ]] ; then # fast path for known terminal types if [[ ${TERM} = ~(Elr)(vt100|vt220|xterm|xterm-color|dtterm) ]] ; then c="$(printf "\E[%d;%dH" $((y+1)) $((x+1)))" @@ -56,24 +70,40 @@ fi fi - print -n "$c" + print -n -- "$c" } +# get terminal size and put values into a compound variable with the integer +# members "columns" and "lines" +function get_term_size +{ + nameref rect=$1 + + rect.columns=$(tput cols) || return 1 + rect.lines=$(tput lines) || return 1 + + return 0 +} + function draw_clock { float angle a float x y + integer i=1 for(( angle=0.0 ; angle < 360. ; angle+=6 )) ; do - (( a=angle/360.*(2*M_PI) )) + (( + a=angle/360.*(2*M_PI) , - (( x=clock.len_x*cos(a) )) - (( y=clock.len_y*sin(a) )) + x=clock.len_x*cos(a) , + y=clock.len_y*sin(a) + )) + tput_cup $(( y+clock.middle_y )) $(( x+clock.middle_x )) # add "mark" every 30 degrees if (( int(angle)%30 == 0 )) ; then - print -n "0" + print -n "$(((++i)%12+1))" else print -n "x" fi @@ -90,11 +120,13 @@ (( a=angle/360.*(2*M_PI) )) for(( s=0.0 ; s < 10. ; s+=0.5 )) ; do - (( x=(clock.len_x*(s/10.)*(length/100.))*cos(a) )) - (( y=(clock.len_y*(s/10.)*(length/100.))*sin(a) )) + (( + x=(clock.len_x*(s/10.)*(length/100.))*cos(a) , + y=(clock.len_y*(s/10.)*(length/100.))*sin(a) + )) tput_cup $(( y+clock.middle_y )) $(( x+clock.middle_x )) - print -n "${ch}" + print -n -- "${ch}" done } @@ -122,17 +154,14 @@ if ${init_screen} ; then init_screen="false" - # "resize" is needed because older versions of ksh93 may have - # trouble with getting the right terminal size at startup - [ -x "/usr/X11/bin/resize" ] && eval "$(/usr/X11/bin/resize -u)" || - [ -x "/usr/X11R6/bin/resize" ] && eval "$(/usr/X11R6/bin/resize -u)" || - [ -x "/usr/openwin/bin/resize" ] && eval "$(/usr/openwin/bin/resize -u)" || - fatal_error "resize not found." + get_term_size termsize || fatal_error "Couldn't get terminal size." - (( clock.middle_x=COLUMNS/2.-.5 )) - (( clock.middle_y=LINES/2.-.5 )) - (( clock.len_x=COLUMNS/2-2 )) - (( clock.len_y=LINES/2-2 )) + (( + clock.middle_x=termsize.columns/2.-.5 , + clock.middle_y=termsize.lines/2.-.5 , + clock.len_x=termsize.columns/2-2 , + clock.len_y=termsize.lines/2-2 , + )) { clear @@ -144,8 +173,10 @@ (( $(date +"hours.val=%H , minutes.val=%M , seconds.val=%S") )) # small trick to get a smooth "analog" flair - (( hours.val+=minutes.val/60. )) - (( minutes.val+=seconds.val/60. )) + (( + hours.val+=minutes.val/60. , + minutes.val+=seconds.val/60. + )) draw_clock_hand seconds draw_clock_hand minutes @@ -158,10 +189,10 @@ 6<#((0)) cat <&6 - 6<&- ; rm -f "${scratchfile}" ; exec 6<>"${scratchfile}" + redirect 6<&- ; rm -f "${scratchfile}" ; redirect 6<>"${scratchfile}" - c="" ; read -t ${update_interval} -n 1 c - if [ "$c" != "" ] ; then + c="" ; read -r -t ${update_interval} -n 1 c + if [[ "$c" != "" ]] ; then case "$c" in ~(Ei)q | $'\E') return 0 ;; esac @@ -183,38 +214,47 @@ } # program start -progname="${0}" - +builtin basename builtin date +builtin printf builtin rm -builtin printf -typeset -A tput_cup_cache +typeset progname="$(basename "${0}")" float -r M_PI=3.14159265358979323846 -clock=( +# terminal size rect +typeset termsize=( + integer columns=-1 + integer lines=-1 +) + +typeset init_screen="true" + +typeset clock=( float middle_x float middle_y integer len_x integer len_y ) -typeset init_screen="true" # set clock properties -seconds=( float val - typeset ch - float scale - integer length ) -minutes=( float val - typeset ch - float scale - integer length ) -hours=( float val - typeset ch - float scale - integer length ) +typeset seconds=( + float val + typeset ch + float scale + integer length ) +typeset minutes=( + float val + typeset ch + float scale + integer length ) +typeset hours=( + float val + typeset ch + float scale + integer length ) seconds.length=90 seconds.scale=60 seconds.ch="s" minutes.length=75 minutes.scale=60 minutes.ch="m" @@ -222,10 +262,13 @@ float update_interval=0.9 +# cache for "tput_cup" +typeset -A tput_cup_cache + USAGE=$' -[-? -@(#)\$Id: termclock (Roland Mainz) 2007-06-05 \$ -] +[-?\n@(#)\$Id: termclock (Roland Mainz) 2007-09-10 \$\n] +[-author?Roland Mainz ] [+NAME?termclock - analog clock for terminals] [+DESCRIPTION?\btermclock\b is an analog clock for terminals. The termclock program displays the time in analog or digital @@ -242,7 +285,7 @@ *) usage ;; esac done -shift ${OPTIND}-1 +shift $((OPTIND-1)) # prechecks which tput >/dev/null || fatal_error "tput not found." @@ -252,9 +295,9 @@ # create temporary file for double-buffering and register an EXIT trap # to remove this file when the shell interpreter exits scratchfile="$(mktemp /tmp/termclock.pid$$.XXXXXX)" -if [ -z "${scratchfile}" ]; then exit 1; fi +if [[ -z "${scratchfile}" ]] ; then fatal_error "Could not create temporary file name." ; fi trap 'rm -f "${scratchfile}"' EXIT -rm -f "${scratchfile}" ; exec 6<>"${scratchfile}" +rm -f "${scratchfile}" ; redirect 6<>"${scratchfile}" || fatal_error "Could not create temporary file." # regiter trap to handle window size changes trap 'init_screen="true"' WINCH @@ -262,6 +305,7 @@ main_loop # exiting - put cursor below clock -tput_cup $((LINES-2)) 0 +tput_cup $((termsize.lines-2)) 0 +exit 0 # EOF. Index: src/lib/libshell/common/fun/mandelbrotset1 =================================================================== --- src/lib/libshell/common/fun/mandelbrotset1 (revision 866) +++ src/lib/libshell/common/fun/mandelbrotset1 (revision 894) @@ -1,4 +1,4 @@ -#!/bin/ksh93 +#!/usr/bin/ksh93 # # CDDL HEADER START @@ -25,7 +25,7 @@ # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "@(#)mandelbrotset1 1.1 07/06/27 SMI" +# ident "%Z%%M% %I% %E% SMI" # # @@ -34,8 +34,22 @@ # # Solaris needs /usr/xpg4/bin/ because the tools in /usr/bin are not POSIX-conformant -export PATH=/usr/xpg4/bin:/bin:/usr/bin:/usr/X11/bin:/usr/X11R6/bin:/usr/openwin/bin +export PATH=/usr/xpg4/bin:/bin:/usr/bin +# Make sure all math stuff runs in the "C" locale to avoid problems +# with alternative # radix point representations (e.g. ',' instead of +# '.' in de_DE.*-locales). This needs to be set _before_ any +# floating-point constants are defined in this script). +if [[ "${LC_ALL}" != "" ]] ; then + export \ + LC_MONETARY="${LC_ALL}" \ + LC_MESSAGES="${LC_ALL}" \ + LC_COLLATE="${LC_ALL}" \ + LC_CTYPE="${LC_ALL}" + unset LC_ALL +fi +export LC_NUMERIC=C + function printmsg { print -u 2 "$@" @@ -47,9 +61,21 @@ exit 1 } +# get terminal size and put values into a compound variable with the integer +# members "columns" and "lines" +function get_term_size +{ + nameref rect=$1 + + rect.columns=$(tput cols) || return 1 + rect.lines=$(tput lines) || return 1 + + return 0 +} + function print_color { - print -n "${symbollist:${1}:1}" + print -n -- "${symbollist:${1}:1}" } function mandelbrot @@ -65,19 +91,21 @@ float mag for (( mag=0 ; mag < max_mag && iteration < max_iteration ; iteration++ )) ; do - (( xx=x*x )) - (( yy=y*y )) - (( mag=xx+yy )) - - (( y=x*y*2+y1 )) - (( x=xx-yy+x1 )) + (( + xx=x*x , + yy=y*y , + mag=xx+yy , + y=x*y*2+y1 , + x=xx-yy+x1 + )) done - print ${iteration} + print -- ${iteration} return 0 } +# build mandelbrot image serially function loop_serial { for (( y=y_min ; y < y_max ; y+=stepwidth )) ; do @@ -87,21 +115,24 @@ print done + + return 0 } +# build mandelbrot image using parallel worker jobs function loop_parallel { integer numjobs=0 # the following calculation suffers from rounding errors integer lines_per_job=$(( ((m_height+(numcpus-1)) / numcpus) )) - printmsg "# lines_per_job=${lines_per_job}" - printmsg "# numcpus=${numcpus}" + printmsg $"# lines_per_job=${lines_per_job}" + printmsg $"# numcpus=${numcpus}" # "renice" worker jobs set -o bgnice - if [ "${TMPDIR}" = "" ] ; then + if [[ "${TMPDIR}" = "" ]] ; then TMPDIR="/tmp" fi @@ -112,7 +143,7 @@ for (( y=y_min ; y < y_max ; y+=(stepwidth*lines_per_job) )) ; do rm -f "${TMPDIR}/mandelbrot_${jobident}_child_$y.joboutput" - let numjobs++ + (( numjobs++ )) done printmsg $"## running ${numjobs} children..." @@ -133,9 +164,11 @@ printmsg $"## output:"