diff options
author | Roland Mainz <roland.mainz@nrubsig.org> | 2009-10-28 10:36:39 -0700 |
---|---|---|
committer | Roland Mainz <roland.mainz@nrubsig.org> | 2009-10-28 10:36:39 -0700 |
commit | 34f9b3eef6fdadbda0a846aa4d68691ac40eace5 (patch) | |
tree | 0b0fdfb35f8eb9324728de5a99e50e939aca650f /usr | |
parent | 14969419acb89bb74e6c95fa472119b710224440 (diff) | |
download | illumos-gate-34f9b3eef6fdadbda0a846aa4d68691ac40eace5.tar.gz |
Portions contributed by Olga Kryzhanovska <olga.kryzhanovska@gmail.com>
PSARC/2009/063 ksh93 update 2
PSARC/2009/248 ksh93 update to 2009-03-10
PSARC/2009/249 more ksh93 command conversions
6888396 libast sources should not include localedef.h
6605478 ksh93 profile shell option does not work
6631006 ksh93 hangs in situations that ksh handles okay
6661487 logname reports nothing after running the script command
6705126 first call to read doesn't honor new setting of HISTFILE
6764665 *libpp* Array overrun in libpp
6765756 *libast* Array overruns in libast
6769332 Recursive function+command substitutions terminate shell after 257 iterations
6777491 *ksh93* lacks arithmetric function iszero()
6778077 *ksh93* does not understand "THAW" as a signal for use with trap
6789247 [ku1] libast/ksh93 1-digit hexfloat base conversion rounds incorrectly
6791838 *ksh93* unset of a variable which is not set should return 0
6793714 RFE: Update /usr/bin/comm to AT&T AST "comm"
6793719 RFE: Update /usr/bin/cut to AT&T AST "cut"
6793721 RFE: Update /usr/bin/paste to AT&T AST "paste"
6793722 RFE: Update /usr/bin/cmp to AT&T AST "cmp"
6793726 RFE: Update /usr/bin/uniq to AT&T AST "uniq"
6793735 RFE: Update /usr/bin/wc to AT&T AST "wc"
6793744 RFE: Add /usr/share/doc/ksh/ for ksh93 documentation
6793747 RFE: Provide "print" builtin as /usr/bin/print for external applications
6793763 RFE: Update /usr/bin/ksh93 to ast-ksh.2009-05-05
6794952 RFE: Enable "globstar" mode in /etc/ksh.kshrc (= interactive ksh93 shells)
6805792 [ku1] Moving local compound var into array does not work
6805794 [ku1] printf returns "invalid character constant" for $ printf "%d\n" "'<euro>"
6805795 [ku1] ksh93 does not differ between -0 and +0
6805797 [ku1]Can't append to nodes of an array of compound vars if addressing them via nameref
6805799 Indexed compound variable arrays do not work...
6805800 [ku1] Declaring associative compound array does not work
6805813 RFE: Update /usr/bin/join to AT&T AST "join".
6805819 RFE: Update /usr/bin/tee to AT&T AST "tee".
6809663 shlint missing ending newline on errors
6811916 ksh93 repeatedly segfaults when "tee" builtin is interrupted via <ctrl-c> in interactive mode
6821113 SUNWosdem package issues
6828644 RFE: Update /usr/bin/logname to AT&T AST "logname".
6828692 RFE: Update /usr/bin/cksum to AT&T AST "cksum".
6834184 ksh93 gets SIGSEGV if HISTFILE is changed in place.
6834207 ksh93 gets SIGSEGV on interactive function definition with HISTSIZE unset
6835835 ksh93 "cat" builtin does not handle "-n" correctly
6841442 Need exception list for OS/Net trees managed via Subversion
6848486 "echo ${test}" with test undefined crashes the shell
6850672 ksh93 (VISUAL=vi) crashes with memory fault while scrolling through history
6855875 typeset -X x ; print $x # does not print sufficient digits to restore value
6857344 /usr/bin/hash core dump with invalid arguments
6866676 Need test suite module to test the kernel support for compiled shell scripts
6881017 Subshell doesn't exit, holds pipe open preventing callers from exiting
6884409 fts functions in libast library can result in segv with deep dir trees (similar to CERT VU#590371)
Diffstat (limited to 'usr')
1869 files changed, 21560 insertions, 11038 deletions
diff --git a/usr/src/Makefile.ast b/usr/src/Makefile.ast index d82c027007..fe45dd7574 100644 --- a/usr/src/Makefile.ast +++ b/usr/src/Makefile.ast @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -38,7 +38,9 @@ LIBSHELLCPPFLAGS = \ -I$(LIBSHELLBASE)/$(LIBSHELLMACH)/src/cmd/ksh93 \ -I$(LIBSHELLBASE)/common/include \ -I$(ROOT)/usr/include/ast \ + -I$(ROOT)/usr/include \ -DKSHELL \ + -DSHOPT_BGX \ -DSHOPT_BRACEPAT \ -DSHOPT_CMDLIB_BLTIN=0 \ '-DSH_CMDLIB_DIR="/usr/ast/bin"' \ @@ -64,7 +66,7 @@ LIBSHELLCPPFLAGS = \ -DERROR_CONTEXT_T=Error_context_t \ '-DUSAGE_LICENSE=\ "[-author?David Korn <dgk@research.att.com>]"\ - "[-copyright?Copyright (c) 1982-2008 AT&T Intellectual Property]"\ + "[-copyright?Copyright (c) 1982-2009 AT&T Intellectual Property]"\ "[-license?http://www.opensource.org/licenses/cpl1.0.txt]"\ "[--catalog?libshell]"' diff --git a/usr/src/Makefile.lint b/usr/src/Makefile.lint index 43915a4790..e65728b327 100644 --- a/usr/src/Makefile.lint +++ b/usr/src/Makefile.lint @@ -65,7 +65,6 @@ COMMON_SUBDIRS = \ cmd/chmod \ cmd/chown \ cmd/chroot \ - cmd/cksum \ cmd/clinfo \ cmd/cmd-crypto \ cmd/cmd-inet/lib \ @@ -83,9 +82,7 @@ COMMON_SUBDIRS = \ cmd/cmd-inet/usr.lib/wanboot \ cmd/cmd-inet/usr.sadm \ cmd/cmd-inet/usr.sbin \ - cmd/cmp \ cmd/col \ - cmd/comm \ cmd/compress \ cmd/consadm \ cmd/coreadm \ @@ -96,7 +93,6 @@ COMMON_SUBDIRS = \ cmd/ctrun \ cmd/ctstat \ cmd/ctwatch \ - cmd/cut \ cmd/date \ cmd/dd \ cmd/deroff \ @@ -173,7 +169,6 @@ COMMON_SUBDIRS = \ cmd/iscsitsvc \ cmd/isns \ cmd/itadm \ - cmd/join \ cmd/kbd \ cmd/killall \ cmd/last \ @@ -188,7 +183,6 @@ COMMON_SUBDIRS = \ cmd/logger \ cmd/login \ cmd/logins \ - cmd/logname \ cmd/ls \ cmd/luxadm \ cmd/lvm \ @@ -289,7 +283,6 @@ COMMON_SUBDIRS = \ cmd/syseventd \ cmd/syslogd \ cmd/tabs \ - cmd/tee \ cmd/th_tools \ cmd/tip \ cmd/touch \ @@ -304,7 +297,6 @@ COMMON_SUBDIRS = \ cmd/vt \ cmd/wall \ cmd/wbem \ - cmd/wc \ cmd/who \ cmd/whodo \ cmd/wracct \ diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile index c6fa8fe4f0..e9423852de 100644 --- a/usr/src/cmd/Makefile +++ b/usr/src/cmd/Makefile @@ -88,14 +88,11 @@ COMMON_SUBDIRS= \ chmod \ chown \ chroot \ - cksum \ clear \ clinfo \ cmd-crypto \ cmd-inet \ - cmp \ col \ - comm \ compress \ consadm \ coreadm \ @@ -108,7 +105,6 @@ COMMON_SUBDIRS= \ ctrun \ ctstat \ ctwatch \ - cut \ datadm \ date \ dc \ @@ -218,7 +214,6 @@ COMMON_SUBDIRS= \ isns \ itadm \ java \ - join \ kbd \ keyserv \ killall \ @@ -244,7 +239,6 @@ COMMON_SUBDIRS= \ logger \ login \ logins \ - logname \ look \ ls \ luxadm \ @@ -294,7 +288,6 @@ COMMON_SUBDIRS= \ pagesize \ passmgmt \ passwd \ - paste \ pathchk \ pbind \ pcidr \ @@ -403,7 +396,6 @@ COMMON_SUBDIRS= \ tbl \ tcopy \ tcpd \ - tee \ terminfo \ th_tools \ tic \ @@ -423,7 +415,6 @@ COMMON_SUBDIRS= \ uadmin \ ul \ uname \ - uniq \ units \ unlink \ unpack \ @@ -440,7 +431,6 @@ COMMON_SUBDIRS= \ w \ wall \ wbem \ - wc \ which \ who \ whodo \ @@ -547,12 +537,9 @@ MSGSUBDIRS= \ chgrp \ chmod \ chown \ - cksum \ cmd-crypto \ cmd-inet \ - cmp \ col \ - comm \ compress \ consadm \ coreadm \ @@ -564,7 +551,6 @@ MSGSUBDIRS= \ ctrun \ ctstat \ ctwatch \ - cut \ datadm \ date \ dc \ @@ -615,7 +601,6 @@ MSGSUBDIRS= \ iscsid \ isns \ itadm \ - join \ kbd \ krb5 \ ksh \ @@ -629,7 +614,6 @@ MSGSUBDIRS= \ logadm \ logger \ logins \ - logname \ ls \ luxadm \ lvm \ @@ -653,7 +637,6 @@ MSGSUBDIRS= \ pack \ passwd \ passmgmt \ - paste \ pathchk \ pfexec \ pg \ @@ -714,7 +697,6 @@ MSGSUBDIRS= \ tabs \ tar \ tbl \ - tee \ time \ tnf \ touch \ @@ -725,7 +707,6 @@ MSGSUBDIRS= \ ttymon \ ul \ uname \ - uniq \ units \ unlink \ unpack \ @@ -736,7 +717,6 @@ MSGSUBDIRS= \ volrmmount \ w \ wbem \ - wc \ who \ whodo \ wracct \ diff --git a/usr/src/cmd/ast/msgcc/Makefile b/usr/src/cmd/ast/msgcc/Makefile index 88713d23dd..a5f1f24df5 100644 --- a/usr/src/cmd/ast/msgcc/Makefile +++ b/usr/src/cmd/ast/msgcc/Makefile @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -36,10 +36,11 @@ include ../../../Makefile.ast CPPFLAGS = \ $(DTEXTDOM) $(DTS_ERRNO) \ -I$(ROOT)/usr/include/ast \ + -I$(ROOT)/usr/include \ -D_PACKAGE_ast \ '-DUSAGE_LICENSE=\ "[-author?Glenn Fowler <gsf@research.att.com>]"\ - "[-copyright?Copyright (c) 1986-2008 AT&T Intellectual Property]"\ + "[-copyright?Copyright (c) 1986-2009 AT&T Intellectual Property]"\ "[-license?http://www.opensource.org/licenses/cpl1.0.txt]"\ "[--catalog?msgcc]"' diff --git a/usr/src/cmd/ast/msgcc/msgcc.sh b/usr/src/cmd/ast/msgcc/msgcc.sh index 3ea55b8dd8..209cbda167 100644 --- a/usr/src/cmd/ast/msgcc/msgcc.sh +++ b/usr/src/cmd/ast/msgcc/msgcc.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 2000-2008 AT&T Intellectual Property # +# Copyright (c) 2000-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/cmd/ast/msgcc/msgcpp.c b/usr/src/cmd/ast/msgcc/msgcpp.c index a9bc934313..a9ac00b52f 100644 --- a/usr/src/cmd/ast/msgcc/msgcpp.c +++ b/usr/src/cmd/ast/msgcc/msgcpp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 2000-2008 AT&T Intellectual Property * +* Copyright (c) 2000-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/cmd/ast/msgcc/msgcvt.c b/usr/src/cmd/ast/msgcc/msgcvt.c index d7afe93c82..329fce0d83 100644 --- a/usr/src/cmd/ast/msgcc/msgcvt.c +++ b/usr/src/cmd/ast/msgcc/msgcvt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 2000-2008 AT&T Intellectual Property * +* Copyright (c) 2000-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/cmd/ast/msgcc/msggen.c b/usr/src/cmd/ast/msgcc/msggen.c index 7961530dc7..d6999c8b2c 100644 --- a/usr/src/cmd/ast/msgcc/msggen.c +++ b/usr/src/cmd/ast/msgcc/msggen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 2000-2008 AT&T Intellectual Property * +* Copyright (c) 2000-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/cmd/ast/msgcc/msgget.c b/usr/src/cmd/ast/msgcc/msgget.c index 10a389bfeb..d4c8798fa2 100644 --- a/usr/src/cmd/ast/msgcc/msgget.c +++ b/usr/src/cmd/ast/msgcc/msgget.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 2000-2008 AT&T Intellectual Property * +* Copyright (c) 2000-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/cmd/cksum/Makefile b/usr/src/cmd/cksum/Makefile deleted file mode 100644 index 7b1e59e17c..0000000000 --- a/usr/src/cmd/cksum/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# cmd/cksum/Makefile - -PROG= cksum - -include ../Makefile.cmd - -CFLAGS += $(CCVERBOSE) -CPPFLAGS += -D_FILE_OFFSET_BITS=64 - -.KEEP_STATE: - -all: $(PROG) - -install: all $(ROOTPROG) - -clean: - -lint: lint_PROG - -include ../Makefile.targ diff --git a/usr/src/cmd/cksum/cksum.c b/usr/src/cmd/cksum/cksum.c deleted file mode 100644 index 000a1649d7..0000000000 --- a/usr/src/cmd/cksum/cksum.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <locale.h> -#include <libgen.h> - -#define NBUF 4096 /* Read this much at a time */ -#define BSIZE 512 /* Bytes per block */ - -typedef unsigned long CRC; /* 32 bit (at least) crc size */ - -static uchar_t buf[NBUF]; /* Input buffer */ -static uchar_t tflag; /* More than one input file */ -static uchar_t many; -static CRC filecrc; /* CRC for this file */ -static CRC totcrc; /* Total of all files */ -static long long totbytes; /* Total bytes read */ -static ulong_t bsize = 1; /* block size */ - -static int sum(const char *fn); -static int usage(void); -static CRC docrcposix(CRC crcval, uchar_t *bp, ulong_t n); -static CRC postprocess(CRC S, long long n); - -static CRC (*crcfunc)(CRC crcval, uchar_t *bp, ulong_t n) = docrcposix; -static void m_crcposix(ulong_t *, const uchar_t *, size_t); - -/* - * Mainline for cksum. - */ -int -main(int argc, char *argv[]) -{ - int c; - int exstat = 0; - - (void) setlocale(LC_ALL, ""); - -#if !defined(TEXT_DOMAIN) -#define TEXT_DOMAIN "SYS_TEST" -#endif - (void) textdomain(TEXT_DOMAIN); - - tflag = many = 0; - totbytes = totcrc = 0; - while ((c = getopt(argc, argv, "")) != -1) { - switch (c) { - case 't': /* this is non-functional for now */ - tflag++; - break; - default: - return (usage()); - } - } - - /* Sum from standard input? */ - if ((many = optind < argc) == 0) - return (sum(NULL)); - - /* Sum each file argument. */ - for (; optind < argc; ++optind) - exstat |= sum(argv[optind]); - - if (tflag) { - (void) printf("%lu", postprocess(totcrc, totbytes)); - (void) printf(gettext("\t%lld\t Total\n"), - (long long)((totbytes + bsize - 1) / bsize)); - } - return (exstat); -} - -/* - * Compute checksum for one file. - */ -static int -sum(const char *fn) -{ - int n; - int fd; - long long bytes = 0; - - if (fn == NULL || (fn[0] == '-' && fn[1] == '\0')) - fd = 0; - else if ((fd = open(fn, O_RDONLY)) < 0) { - (void) fprintf(stderr, gettext("cksum: input file \"%s\": "), - fn); - perror(""); - return (1); - } - filecrc = 0; - while ((n = read(fd, (char *)buf, sizeof (buf))) > 0) { - bytes += n; - filecrc = (*crcfunc) (filecrc, buf, n); - if (tflag) - totcrc = (*crcfunc) (totcrc, buf, n); - } - (void) close(fd); - totbytes += bytes; - (void) printf("%lu", postprocess(filecrc, bytes)); - (void) printf("\t%lld", (long long)((bytes + bsize - 1) / bsize)); - if (many) { - (void) printf("\t%s", (fn[0] == '-' && fn[1] == '\0') ? - gettext("[standard input]") : fn); - } - if (n < 0) - (void) fputs(gettext(" [read error]"), stdout); - (void) putchar('\n'); - return (n == 0 ? 0 : 1); -} - - -/* - * Do CRC-POSIX function by calling a library entry point that has a - * slightly different calling sequence. - */ -static CRC -docrcposix(CRC crcval, uchar_t *bp, ulong_t n) -{ - m_crcposix(&crcval, bp, n); - return (crcval); -} - -/* - * Sum algorithms require various kinds of post-processing. - * The 'S' and 'R' variables are from the POSIX.2 (Draft 8?) description - * of the "sum" utility. - * This code makes no assumption about word size except that a - * "CRC" type holds at least 32 bits. - */ -static CRC -postprocess(CRC S, long long n) -{ - /* - * POSIX tacks on significant bytes of the length so that - * different length sequences of '\0' have different sums; - * then it complements sum. - */ - uchar_t char_n[sizeof (n)]; - ulong_t i; - - for (i = 0; n != 0; n >>= 8, ++i) - char_n[i] = n & 0xFF; - return (~docrcposix(S, char_n, i)); -} - -/* - * usage message for cksum - */ -static int -usage() -{ - (void) fprintf(stderr, gettext("Usage: cksum [file ...]\n")); - return (2); -} - -/* - * crcposix -- compute posix.2 compatable 32 bit CRC - * - * The POSIX.2 (draft 10) CRC algorithm. - * This is a 32 bit CRC with polynomial - * x**32 + x**26 + x**23 + x**22 + x**16 + x**12 + x**11 + x**10 + - * x**8 + x**7 + x**5 + x**4 + x**2 + x**1 + x**0 - */ - -/* layout is from the POSIX.2 Rationale */ -static ulong_t crctab_posix[256] = { - 0x00000000, - 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, - 0x1A864DB2, 0x1E475005, 0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, - 0x2B4BCB61, 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD, - 0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9, 0x5F15ADAC, - 0x5BD4B01B, 0x569796C2, 0x52568B75, 0x6A1936C8, 0x6ED82B7F, - 0x639B0DA6, 0x675A1011, 0x791D4014, 0x7DDC5DA3, 0x709F7B7A, - 0x745E66CD, 0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039, - 0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5, 0xBE2B5B58, - 0xBAEA46EF, 0xB7A96036, 0xB3687D81, 0xAD2F2D84, 0xA9EE3033, - 0xA4AD16EA, 0xA06C0B5D, 0xD4326D90, 0xD0F37027, 0xDDB056FE, - 0xD9714B49, 0xC7361B4C, 0xC3F706FB, 0xCEB42022, 0xCA753D95, - 0xF23A8028, 0xF6FB9D9F, 0xFBB8BB46, 0xFF79A6F1, 0xE13EF6F4, - 0xE5FFEB43, 0xE8BCCD9A, 0xEC7DD02D, 0x34867077, 0x30476DC0, - 0x3D044B19, 0x39C556AE, 0x278206AB, 0x23431B1C, 0x2E003DC5, - 0x2AC12072, 0x128E9DCF, 0x164F8078, 0x1B0CA6A1, 0x1FCDBB16, - 0x018AEB13, 0x054BF6A4, 0x0808D07D, 0x0CC9CDCA, 0x7897AB07, - 0x7C56B6B0, 0x71159069, 0x75D48DDE, 0x6B93DDDB, 0x6F52C06C, - 0x6211E6B5, 0x66D0FB02, 0x5E9F46BF, 0x5A5E5B08, 0x571D7DD1, - 0x53DC6066, 0x4D9B3063, 0x495A2DD4, 0x44190B0D, 0x40D816BA, - 0xACA5C697, 0xA864DB20, 0xA527FDF9, 0xA1E6E04E, 0xBFA1B04B, - 0xBB60ADFC, 0xB6238B25, 0xB2E29692, 0x8AAD2B2F, 0x8E6C3698, - 0x832F1041, 0x87EE0DF6, 0x99A95DF3, 0x9D684044, 0x902B669D, - 0x94EA7B2A, 0xE0B41DE7, 0xE4750050, 0xE9362689, 0xEDF73B3E, - 0xF3B06B3B, 0xF771768C, 0xFA325055, 0xFEF34DE2, 0xC6BCF05F, - 0xC27DEDE8, 0xCF3ECB31, 0xCBFFD686, 0xD5B88683, 0xD1799B34, - 0xDC3ABDED, 0xD8FBA05A, 0x690CE0EE, 0x6DCDFD59, 0x608EDB80, - 0x644FC637, 0x7A089632, 0x7EC98B85, 0x738AAD5C, 0x774BB0EB, - 0x4F040D56, 0x4BC510E1, 0x46863638, 0x42472B8F, 0x5C007B8A, - 0x58C1663D, 0x558240E4, 0x51435D53, 0x251D3B9E, 0x21DC2629, - 0x2C9F00F0, 0x285E1D47, 0x36194D42, 0x32D850F5, 0x3F9B762C, - 0x3B5A6B9B, 0x0315D626, 0x07D4CB91, 0x0A97ED48, 0x0E56F0FF, - 0x1011A0FA, 0x14D0BD4D, 0x19939B94, 0x1D528623, 0xF12F560E, - 0xF5EE4BB9, 0xF8AD6D60, 0xFC6C70D7, 0xE22B20D2, 0xE6EA3D65, - 0xEBA91BBC, 0xEF68060B, 0xD727BBB6, 0xD3E6A601, 0xDEA580D8, - 0xDA649D6F, 0xC423CD6A, 0xC0E2D0DD, 0xCDA1F604, 0xC960EBB3, - 0xBD3E8D7E, 0xB9FF90C9, 0xB4BCB610, 0xB07DABA7, 0xAE3AFBA2, - 0xAAFBE615, 0xA7B8C0CC, 0xA379DD7B, 0x9B3660C6, 0x9FF77D71, - 0x92B45BA8, 0x9675461F, 0x8832161A, 0x8CF30BAD, 0x81B02D74, - 0x857130C3, 0x5D8A9099, 0x594B8D2E, 0x5408ABF7, 0x50C9B640, - 0x4E8EE645, 0x4A4FFBF2, 0x470CDD2B, 0x43CDC09C, 0x7B827D21, - 0x7F436096, 0x7200464F, 0x76C15BF8, 0x68860BFD, 0x6C47164A, - 0x61043093, 0x65C52D24, 0x119B4BE9, 0x155A565E, 0x18197087, - 0x1CD86D30, 0x029F3D35, 0x065E2082, 0x0B1D065B, 0x0FDC1BEC, - 0x3793A651, 0x3352BBE6, 0x3E119D3F, 0x3AD08088, 0x2497D08D, - 0x2056CD3A, 0x2D15EBE3, 0x29D4F654, 0xC5A92679, 0xC1683BCE, - 0xCC2B1D17, 0xC8EA00A0, 0xD6AD50A5, 0xD26C4D12, 0xDF2F6BCB, - 0xDBEE767C, 0xE3A1CBC1, 0xE760D676, 0xEA23F0AF, 0xEEE2ED18, - 0xF0A5BD1D, 0xF464A0AA, 0xF9278673, 0xFDE69BC4, 0x89B8FD09, - 0x8D79E0BE, 0x803AC667, 0x84FBDBD0, 0x9ABC8BD5, 0x9E7D9662, - 0x933EB0BB, 0x97FFAD0C, 0xAFB010B1, 0xAB710D06, 0xA6322BDF, - 0xA2F33668, 0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4 -}; - -/* - * crcposix -- compute posix.2 compatible 32 bit CRC - */ -void -m_crcposix(crcp, bp, n) -ulong_t *crcp; -const uchar_t *bp; -size_t n; -{ - while (n-- > 0) - *crcp = (*crcp<<8) ^ crctab_posix[(uchar_t)((*crcp>>24)^*bp++)]; -} diff --git a/usr/src/cmd/cmp/Makefile b/usr/src/cmd/cmp/Makefile deleted file mode 100644 index 5a74c59d76..0000000000 --- a/usr/src/cmd/cmp/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1989, 1996 by Sun Microsystems, Inc. -# All rights reserved. -# - -PROG= cmp - -include ../Makefile.cmd - -CPPFLAGS += -D_FILE_OFFSET_BITS=64 - -.KEEP_STATE: - -all: $(PROG) - -install: all $(ROOTPROG) - -clean: - -lint: lint_PROG - -include ../Makefile.targ diff --git a/usr/src/cmd/cmp/cmp.c b/usr/src/cmd/cmp/cmp.c deleted file mode 100644 index 37ede810eb..0000000000 --- a/usr/src/cmd/cmp/cmp.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * 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 - */ -/* Portions Copyright 2006 Stephen P. Potter */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * compare two files - */ - -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <locale.h> -#include <sys/types.h> - -FILE *file1, *file2; - -char *arg; - -int eflg; -int lflg = 1; - -offset_t line = 1; -offset_t chr = 0; -offset_t skip1; -offset_t skip2; - -offset_t otoi(char *); - -static void narg(void); -static void barg(void); -static void earg(void); - -int -main(int argc, char **argv) -{ - int c; - int c1, c2; - - (void) setlocale(LC_ALL, ""); -#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ -#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ -#endif - (void) textdomain(TEXT_DOMAIN); - - while ((c = getopt(argc, argv, "ls")) != EOF) - switch (c) { - case 'l': - lflg = 2; - break; - case 's': - lflg = 0; - break; - case '?': - default: - narg(); - } - argv += optind; - argc -= optind; - if (argc < 2 || argc > 4) - narg(); - - arg = argv[0]; - if (arg[0] == '-' && arg[1] == 0) - file1 = stdin; - else if ((file1 = fopen(arg, "r")) == NULL) - barg(); - - arg = argv[1]; - if (arg[0] == '-' && arg[1] == 0) - file2 = stdin; - else if ((file2 = fopen(arg, "r")) == NULL) - barg(); - - if (file1 == stdin && file2 == stdin) - narg(); - - if (argc > 2) - skip1 = otoi(argv[2]); - if (argc > 3) - skip2 = otoi(argv[3]); - while (skip1) { - if ((c1 = getc(file1)) == EOF) { - arg = argv[0]; - earg(); - } - skip1--; - } - while (skip2) { - if ((c2 = getc(file2)) == EOF) { - arg = argv[1]; - earg(); - } - skip2--; - } - - for (;;) { - chr++; - c1 = getc(file1); - c2 = getc(file2); - if (c1 == c2) { - if (c1 == '\n') - line++; - if (c1 == EOF) { - if (eflg) - return (1); - return (0); - } - continue; - } - if (lflg == 0) - return (1); - if (c1 == EOF) { - arg = argv[0]; - earg(); - } - if (c2 == EOF) - earg(); - if (lflg == 1) { - (void) printf( - gettext("%s %s differ: char %lld, line %lld\n"), - argv[0], arg, chr, line); - return (1); - } - eflg = 1; - (void) printf("%6lld %3o %3o\n", chr, c1, c2); - } -} - -offset_t -otoi(s) -char *s; -{ - offset_t v; - int base; - - v = 0; - base = 10; - if (*s == '0') - base = 8; - while (isdigit(*s)) - v = v*base + *s++ - '0'; - return (v); -} - -static void -narg() -{ - (void) fprintf(stderr, - gettext("usage: cmp [-l | -s] file1 file2 [skip1] [skip2]\n")); - exit(2); -} - -static void -barg() -{ - if (lflg) - (void) fprintf(stderr, gettext("cmp: cannot open %s\n"), arg); - exit(2); -} - -static void -earg() -{ - (void) fprintf(stderr, gettext("cmp: EOF on %s\n"), arg); - exit(1); -} diff --git a/usr/src/cmd/comm/Makefile b/usr/src/cmd/comm/Makefile deleted file mode 100644 index a07e14d6a7..0000000000 --- a/usr/src/cmd/comm/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -PROG= comm - -include ../Makefile.cmd - -CFLAGS += $(CCVERBOSE) - -.KEEP_STATE: - -all: $(PROG) - -install: all $(ROOTPROG) - -clean: - -lint: lint_PROG - -include ../Makefile.targ diff --git a/usr/src/cmd/comm/comm.c b/usr/src/cmd/comm/comm.c deleted file mode 100644 index 00f8caa932..0000000000 --- a/usr/src/cmd/comm/comm.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * process common lines of two files - */ - -#include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -static int compare(char *, char *); -static int rd(FILE *, char *); -static FILE *openfil(char *); -static void copy(FILE *, char *, int); -static void usage(void); -static void wr(char *, int); - -#define LB 2050 /* P1003.2 minimum (2048) + 2 */ - -#define RDTWO(ib1, lb1, ib2, lb2) \ - { \ - if (rd(ib1, lb1) < 0) { \ - if (rd(ib2, lb2) < 0) \ - exit(0); \ - copy(ib2, lb2, 2); \ - } \ - if (rd(ib2, lb2) < 0) \ - copy(ib1, lb1, 1); \ - } - -static int one; -static int two; -static int three; - -static char ldr[3][3] = {"", "\t", "\t\t"}; - -static FILE *ib1; -static FILE *ib2; -static int is_c_locale; - -int -main(int argc, char **argv) -{ - int l = 1; - int c; /* used for getopt() */ - char lb1[LB], lb2[LB], *collate; - - (void) setlocale(LC_ALL, ""); -#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ -#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ -#endif - (void) textdomain(TEXT_DOMAIN); - - if ((collate = setlocale(LC_COLLATE, NULL)) == NULL) { - (void) fprintf(stderr, - gettext("Query of LC_COLLATE category failed\n")); - exit(4); - } - - is_c_locale = (strcmp("C", collate) == 0) ? 1 : 0; - while ((c = getopt(argc, argv, "123")) != EOF) - switch (c) { - case '1': - if (!one) { - one = 1; - ldr[1][0] = ldr[2][l--] = '\0'; - } - break; - case '2': - if (!two) { - two = 1; - ldr[2][l--] = '\0'; - } - break; - case '3': - three = 1; - break; - - default: - usage(); - } - - argc -= optind; - argv = &argv[optind]; - - if (argc != 2) - usage(); - ib1 = openfil(argv[0]); - ib2 = openfil(argv[1]); - RDTWO(ib1, lb1, ib2, lb2); - for (;;) { - switch (compare(lb1, lb2)) { - case 0: - wr(lb1, 3); - RDTWO(ib1, lb1, ib2, lb2); - continue; - - case 1: - wr(lb1, 1); - if (rd(ib1, lb1) < 0) - copy(ib2, lb2, 2); - continue; - - case 2: - wr(lb2, 2); - if (rd(ib2, lb2) < 0) - copy(ib1, lb1, 1); - continue; - /* - * case "3" means lines are equal in collation, - * but not identical (not very likely) - */ - case 3: - wr(lb1, 1); - wr(lb2, 2); - RDTWO(ib1, lb1, ib2, lb2); - continue; - } - } - /* NOTREACHED */ - return (0); -} - -static int -rd(file, buf) -FILE *file; -char *buf; -{ - register int i, j; - i = j = 0; - while ((j = getc(file)) != EOF) { - *buf = (char)j; - if (*buf == '\n' || i > LB-2) { - *buf = '\0'; - return (0); - } - i++; - buf++; - } - return (-1); -} - -static void -wr(str, n) -char *str; -int n; -{ - switch (n) { - case 1: - if (one) - return; - break; - - case 2: - if (two) - return; - break; - - case 3: - if (three) - return; - } - (void) printf("%s%s\n", ldr[n-1], str); -} - -static void -copy(ibuf, lbuf, n) -FILE *ibuf; -char *lbuf; -int n; -{ - do { - wr(lbuf, n); - } while (rd(ibuf, lbuf) >= 0); - - exit(0); -} - -static int -compare(a, b) -char *a, *b; -{ - register char *ra, *rb; - int ret; - - ra = a - 1; - rb = b - 1; - while (*++ra == *++rb) - if (*ra == '\0') - return (0); - - /* For "C" locale, just compare bytes */ - if (is_c_locale) { - if (*ra < *rb) - return (1); - return (2); - } - /* For other locales, call locale-sensitive compare routine */ - else { - ret = strcoll(a, b); - return (ret == 0 ? 3 : (ret < 0 ? 1 : 2)); - } -} - -static FILE * -openfil(s) -char *s; -{ - FILE *b; - if (s[0] == '-' && s[1] == 0) - b = stdin; - else if ((b = fopen(s, "r")) == NULL) { - (void) fprintf(stderr, "comm: "); - perror(s); - exit(2); - } - return (b); -} - -static void -usage() -{ - (void) fprintf(stderr, gettext("usage: comm [-123] file1 file2\n")); - exit(2); -} diff --git a/usr/src/cmd/cut/Makefile b/usr/src/cmd/cut/Makefile deleted file mode 100644 index 55b3e17fc9..0000000000 --- a/usr/src/cmd/cut/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1989, 1996 by Sun Microsystems, Inc. -# All rights reserved. -# - -PROG= cut - -include ../Makefile.cmd - -CPPFLAGS += -D_FILE_OFFSET_BITS=64 - -XGETFLAGS += -a -x $(PROG).xcl - -.KEEP_STATE: - -all: $(PROG) - -install: all $(ROOTPROG) - -clean: - -lint: lint_PROG - -include ../Makefile.targ diff --git a/usr/src/cmd/cut/cut.c b/usr/src/cmd/cut/cut.c deleted file mode 100644 index 49d89db3c2..0000000000 --- a/usr/src/cmd/cut/cut.c +++ /dev/null @@ -1,627 +0,0 @@ -/* - * 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 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -# -/* cut : cut and paste columns of a table (projection of a relation) */ -/* Release 1.5; handles single backspaces as produced by nroff */ - -#include <stdio.h> /* make: cc cut.c */ -#include <ctype.h> -#include <limits.h> -#include <locale.h> -#include <wchar.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -#define MAX_RANGES MAX_INPUT /* maximum number of ranges */ - /* as input args */ - -static void bfunc(void); -static void bnfunc(void); -static void cfunc(void); -static void ffunc(void); -static wchar_t *read_line(FILE *); -static void process_list(char *); -static void diag(const char *); -static void usage(void); - -static wchar_t wdel = '\t'; -static int dellen; -static int supflag = 0; -static int rstart[MAX_RANGES]; -static int rend[MAX_RANGES]; -static int nranges = 0; -static FILE *inptr; -static char dummy[MB_LEN_MAX]; - -static wchar_t *linebuf = NULL; -static int bufsiz; - -int -main(int argc, char **argv) -{ - int c; - char *list; - int status = 0; - int bflag, nflag, cflag, fflag, dflag, filenr; - void (*funcp)(); - - bflag = nflag = cflag = fflag = dflag = 0; - - (void) setlocale(LC_ALL, ""); - -#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ -#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't. */ -#endif - (void) textdomain(TEXT_DOMAIN); - - while ((c = getopt(argc, argv, "b:c:d:f:ns")) != EOF) - switch (c) { - case 'b': - if (fflag || cflag) - usage(); - bflag++; - list = optarg; - break; - - case 'c': - if (fflag || bflag) - usage(); - cflag++; - list = optarg; - break; - - case 'd': - dellen = mbtowc(&wdel, optarg, MB_CUR_MAX); - if (dellen == -1) { - diag("no delimiter specified"); - } else if (dellen != strlen(optarg)) - diag("invalid delimiter"); - dflag++; - break; - - case 'f': - if (bflag || cflag) - usage(); - fflag++; - list = optarg; - break; - - case 'n': - nflag++; - break; - - case 's': - supflag++; - break; - - case '?': - usage(); - } - - argv = &argv[optind]; - argc -= optind; - - /* you must use one and only one option -b, -c, or -f */ - if (!(cflag || fflag || bflag)) - usage(); - - /* - * Make sure combination of options is correct - */ - if (nflag) { - if (cflag || fflag) { - (void) fprintf(stderr, gettext( - "cut: -n may only be used with -b\n")); - usage(); - } - } - - if (dflag || supflag) { - if (bflag || cflag) { - if (dflag) - (void) fprintf(stderr, gettext( - "cut: -d may only be used with -f\n")); - if (supflag) - (void) fprintf(stderr, gettext( - "cut: -s may only be used with -f\n")); - usage(); - } - } - - process_list(list); - - if (cflag) { - funcp = cfunc; - } else if (bflag) { - if (nflag) - funcp = bnfunc; - else - funcp = bfunc; - } else { /* fflag */ - funcp = ffunc; - } - - if (nranges == 0) - diag("no list specified"); - - filenr = 0; - do { /* for all input files */ - if (argc == 0 || strcmp(argv[filenr], "-") == 0) - inptr = stdin; - else { - if ((inptr = fopen(argv[filenr], "r")) == NULL) { - (void) fprintf(stderr, "cut: %s: %s\n", - argv[filenr], strerror(errno)); - status = 1; - continue; - } - /* - * ftell() is used to check whether the file is an - * open file descriptor and if the file is associate - * with the a pipe, a FIFO,or a socket if file cannot - * be opened ftell() can be used to check the status - * of the file - */ - if (ftell(inptr) == -1) { - (void) fprintf(stderr, "cut: %s: %s\n", - argv[filenr], strerror(errno)); - status = 1; - continue; - } - } - (*funcp)(); - (void) fclose(inptr); - } while (++filenr < argc); - return (status); -} - -/* parse range list argument and set-up rstart/rend array */ -void -process_list(char *list) -{ - int inrange = 0; - int start = 0; - int num = 0; - char *rlist = list; - char *p; - int i, j; - int tmp; - - /* first, parse list of ranges */ - do { - p = rlist; - switch (*p) { - case '-': - if (inrange) - diag("invalid range specifier"); - - inrange = 1; - if (num == 0) - start = 1; - else { - start = num; - num = 0; - } - break; - - case '\0': - case ',': - case ' ': - case '\t': - /* - * this is temporary - it will change - * when the isblank() routine becomes - * available. - */ - if (nranges == MAX_RANGES) - diag("too many ranges specified"); - - if (inrange) { - if (num == 0) - num = INT_MAX; - if (num < start) - diag("ranges must be " - "increasing"); - rstart[nranges] = start; - rend[nranges] = num; - nranges++; - } else { - rstart[nranges] = num; - rend[nranges] = num; - nranges++; - } - - num = 0; - start = 0; - inrange = 0; - - if (*p == '\0') - continue; - break; - - default: - if (!isdigit(*p)) - diag("invalid character in range"); - num = atoi(p); - while (isdigit(*rlist)) - rlist++; - continue; - } - rlist++; - } while (*p != '\0'); - - /* then, consolidate ranges where possible */ - for (i = 0; i < (nranges - 1); i++) { - for (j = i + 1; j < nranges; j++) { - if (rstart[i] != 0 && rend[i] != 0 && - (!(rend[i] < rstart[j] || rstart[i] > rend[j]))) { - if (rstart[i] < rstart[j]) - rstart[j] = rstart[i]; - if (rend[i] > rend[j]) - rend[j] = rend[i]; - rstart[i] = 0; - rend[i] = 0; - break; - } - } - } - - /* then, weed out the zero'ed/consolidated entries */ - for (i = 0; i < nranges; ) { - if (rstart[i] == 0 && rend[i] == 0) { - for (j = i; j < (nranges - 1); j++) { - rstart[j] = rstart[j+1]; - rend[j] = rend[j+1]; - } - nranges--; - } else if (rstart[i] == 0 || rend[i] == 0) { - diag("Internal error processing input"); - } else { - i++; - } - } - - /* finally, sort the remaining entries */ - for (i = 0; i < (nranges - 1); i++) { - for (j = i+1; j < nranges; j++) { - if (rstart[i] > rend[j]) { - tmp = rstart[i]; - rstart[i] = rstart[j]; - rstart[j] = tmp; - - tmp = rend[i]; - rend[i] = rend[j]; - rend[j] = tmp; - } - } - } - -#ifdef DEBUG - /* dump ranges */ - for (i = 0; i < nranges; i++) { - (void) printf("Range %d - start: %d end: %d\n", i, rstart[i], - rend[i]); - } -#endif -} - -/* called when -c is used */ -/* print out those characters selected */ - -void -cfunc(void) -{ - wint_t c; /* current character */ - int pos = 0; /* current position within line */ - int inrange = 0; /* is 'pos' within a range */ - int rndx = 0; /* current index into range table */ - - while ((c = fgetwc(inptr)) != EOF) { - if (c == '\n') { - (void) putchar('\n'); - - /* reset per-line variables */ - pos = 0; - inrange = 0; - rndx = 0; - } else { - pos++; - - /* - * check if current character is within range and, - * if so, print it. - */ - if (!inrange) - if (pos == rstart[rndx]) - inrange = 1; - - if (inrange) { - (void) putwchar(c); - if (pos == rend[rndx]) { - inrange = 0; - rndx++; - /* - * optimization - - * check for last range index - * and eat chars until newline - * if so. - */ - } - } - } - } -} - -void -bfunc(void) /* called when -b is used but -n is not */ -{ - int c; /* current character */ - int pos = 0; /* current position within line */ - int inrange = 0; /* is 'pos' within a range */ - int rndx = 0; /* current index into range table */ - - while ((c = getc(inptr)) != EOF) { - if (c == L'\n') { - (void) putchar('\n'); - - /* reset per-line variables */ - pos = 0; - inrange = 0; - rndx = 0; - } else { - pos++; - - /* - * check if current character is within range and, - * if so, print it. - */ - if (!inrange) - if (pos == rstart[rndx]) - inrange = 1; - - if (inrange) { - (void) putchar(c); - if (pos == rend[rndx]) { - inrange = 0; - rndx++; - /* - * optimization - - * check for last range index - * and eat chars until newline - * if so. - */ - } - } - } - } -} - - -void -bnfunc(void) /* called when -b -n is used */ -{ - wint_t c; /* current character */ - int pos = 0; /* current position within line */ - int inrange = 0; /* is 'pos' within a range */ - int rndx = 0; /* current index into range table */ - int wlen; /* byte length of current wide char */ - - while ((c = fgetwc(inptr)) != EOF) { - if (c == '\n') { - (void) putchar('\n'); - - /* reset per-line variables */ - pos = 0; - inrange = 0; - rndx = 0; - } else { - if (rndx >= nranges) - continue; - - if ((wlen = wctomb(dummy, c)) < 0) - diag("invalid multibyte character"); - pos += wlen; - - /* - * when trying to figure this out, remember that - * pos is actually pointing to the start byte of - * the next char. - */ - - /* - * if char starts after beginning of range, - * for the moment, consider it in range. - */ - if (!inrange && pos < rstart[rndx]) - continue; - - /* - * If tail of the multibyte is out of the range. - * do not print the character. - * (See XCU4) - */ - if (pos <= rend[rndx]) { - inrange = 1; - (void) putwchar(c); - continue; - } - inrange = 0; - while (++rndx < nranges && pos >= rstart[rndx]) { - if (pos <= rend[rndx]) { - inrange = 1; - (void) putwchar(c); - break; - } - } - } - } -} - -wchar_t * -read_line(FILE *fp) -{ - wint_t c; - wchar_t *cp; - int charcnt; - - /* alloc the line buffer if it isn't already there */ - if (linebuf == NULL) { - bufsiz = BUFSIZ - 1; - if ((linebuf = (wchar_t *)malloc((bufsiz + 1) * - sizeof (wchar_t))) == NULL) - diag("unable to allocate enough memory"); - } - - cp = linebuf; - charcnt = 0; - while ((c = fgetwc(fp)) != EOF) { - if (c == '\n') { - *cp = NULL; - return (linebuf); - } else { - charcnt++; - if (charcnt == bufsiz) { - /* - * there is no line length limitation so we - * have to be ready to expand the line buffer. - */ - bufsiz += BUFSIZ; - if ((linebuf = (wchar_t *)realloc(linebuf, - (bufsiz + 1) * sizeof (wchar_t))) == NULL) - diag("unable to allocate " - "enough memory"); - - cp = linebuf + charcnt - 1; - } - *cp++ = c; - } - } - - if (cp != linebuf) { - *cp = NULL; - return (linebuf); - } else - return (NULL); -} - -void -ffunc(void) /* called when -f is used */ -{ - int fpos; /* current field position within line */ - int inrange; /* is 'pos' within a range */ - int rndx; /* current index into range table */ - int need_del; /* need to put a delimiter char in output */ - wchar_t *linep; /* pointer to line buffer */ - wchar_t *cp, *ncp; /* working pointers into linebuf */ - - while ((linep = read_line(inptr)) != NULL) { - - /* first, prune out line with no delimiters */ - if (wcschr(linep, wdel) == NULL) { -#if !defined(__lint) /* lint doesn't grok "%ws" */ - if (!supflag) - (void) printf("%ws\n", linep); -#endif - continue; - } - - /* init per-line variable */ - fpos = 1; - inrange = 0; - rndx = 0; - need_del = 0; - - for (ncp = cp = linep; ncp != NULL; fpos++) { - /* why continue processing if no more ranges? */ - if (rndx >= nranges) - break; - - /* find the next field delimiter */ - ncp = wcschr(cp, wdel); - - if (!inrange) - if (fpos == rstart[rndx]) - inrange = 1; - - if (inrange) { - if (need_del) - (void) putwchar(wdel); - - if (ncp == NULL) { - /* - * if there are no more delimiters - * and we are in the range, print - * out the rest of the line. - */ -#if !defined(__lint) /* lint doesn't grok "%ws" */ - (void) printf("%ws", cp); -#endif - break; - } - else - while (cp != ncp) - (void) putwchar(*cp++); - need_del = 1; - - if (fpos == rend[rndx]) { - inrange = 0; - rndx++; - } - } - - if (ncp != NULL) - cp = ncp + 1; - } - (void) putchar('\n'); - } -} - - -void -diag(const char *s) -{ - (void) fprintf(stderr, "cut: "); - (void) fprintf(stderr, gettext(s)); - (void) fprintf(stderr, "\n"); - exit(2); -} - - -void -usage(void) -{ - (void) fprintf(stderr, gettext( - "usage: cut -b list [-n] [filename ...]\n" - " cut -c list [filename ...]\n" - " cut -f list [-d delim] [-s] [filename]\n")); - exit(2); -} diff --git a/usr/src/cmd/cut/cut.xcl b/usr/src/cmd/cut/cut.xcl deleted file mode 100644 index a020d688d0..0000000000 --- a/usr/src/cmd/cut/cut.xcl +++ /dev/null @@ -1,29 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -msgid "" -msgid "b:c:d:f:ns" -msgid "-" -msgid "r" -msgid "%ws\n" -msgid "%ws" -msgid "cut: " -msgid "\n" diff --git a/usr/src/cmd/join/Makefile b/usr/src/cmd/join/Makefile deleted file mode 100644 index a3dee14f6d..0000000000 --- a/usr/src/cmd/join/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -PROG= join - -include ../Makefile.cmd - -CFLAGS += $(CCVERBOSE) -XGETFLAGS += -a -x join.xcl -CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 - -.KEEP_STATE: - -all: $(PROG) - -install: all $(ROOTPROG) - -clean: - -lint: lint_PROG - -include ../Makefile.targ diff --git a/usr/src/cmd/join/join.c b/usr/src/cmd/join/join.c deleted file mode 100644 index bd631aaecb..0000000000 --- a/usr/src/cmd/join/join.c +++ /dev/null @@ -1,693 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* join F1 F2 on stuff */ - -#include <stdio.h> -#include <locale.h> -#include <stdlib.h> -#include <widec.h> -#include <string.h> -#include <limits.h> -#include <malloc.h> -#include <errno.h> -#include <unistd.h> - - -static void output(int, int); -static int cmp(wchar_t *, wchar_t *); -static int input(int); -static void Usage(); -static void init_buf(); -static void get_buf(int, int); -static void get_ppi(int); -static void get_olist(int); -wchar_t *wcsrchr(const wchar_t *, wchar_t); -size_t wcslen(const wchar_t *); - - -#define JOINFIELD 9999 -#define F1 0 -#define F2 1 -#define NFLD LINE_MAX/2 /* max field per line */ -#define NOFLD (2*NFLD) /* number arguments to -o */ -#define comp() cmp(ppi[F1][j1], ppi[F2][j2]) -#define get1() n1 = input(F1) -#define get2() n2 = input(F2) -#define putfield(string) \ - if (string == (wchar_t *)NULL) \ - (void) fputs(null, stdout); \ - else if (*string == (wchar_t)NULL) \ - (void) fputs(null, stdout); \ - else \ - (void) fputws(string, stdout) - -#define max(a, b) (a >= b ? a : b) -int CNFLD; /* current number of fields per line */ -int CNOFLD; /* current number of output fields */ -int CBUFSIZE[2]; /* current size of input buffers */ - -static FILE *f[2]; -static wchar_t *buf[2]; /* input lines */ -static wchar_t **ppi[2]; /* pointers to fields in lines */ -static int j1 = 1; /* join of this field of file 1 */ -static int j2 = 1; /* join of this field of file 2 */ -static int *olist; /* output these fields */ -static int *olistf; /* from these files */ -static int no = 0; /* number of entries in olist */ -static wchar_t sep1 = L' '; /* default field separator */ -static wchar_t sep2 = L'\t'; -static char *null = ""; -static int aflg = 0; -static int vflg = 0; -static int tflg = 0; - -int -main(int argc, char *argv[]) -{ - int i, j; - int n1, n2; - off_t top2, bot2; - int cmpresult; - int opt, filenumber; - int nextargopt; - size_t t; - char buffer1[BUFSIZ]; - char tmpfile[20]; - int fd; - - (void) setlocale(LC_ALL, ""); -#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ -#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ -#endif - - (void) textdomain(TEXT_DOMAIN); - - (void) init_buf(); /* allocate buffers */ - - /* check for non-standard "-j#" option, last 2 arguments are files */ - for (i = 1; i < (argc - 2); i++) { - if (strcmp(argv[i], "--") == 0) - break; - - if (strcmp(argv[i], "-j1") == 0) { - if (i == argc - 3) - Usage(); - - j1 = (int)strtol(argv[i+1], (char **)NULL, 10); - for (j = i; j < argc - 1; j++) { - argv[j] = argv[j+2]; - } - argc -= 2; - i--; - } else if (strcmp(argv[i], "-j2") == 0) { - if (i >= argc - 3) - Usage(); - - j2 = (int)strtol(argv[i+1], (char **)NULL, 10); - for (j = i; j < argc - 1; j++) { - argv[j] = argv[j+2]; - } - argc -= 2; - i--; - } - - } - - /* check for non-standard "-o" option, last 2 arguments are files */ - for (i = 1; i < argc - 2; i++) { - - /* stop looking for -o if "--" */ - if (strcmp(argv[i], "--") == 0) - break; - - if (strncmp(argv[i], "-o", 2) == 0) { - if (argv[i][2] == '\0') { - for (j = i; j < argc; j++) { - argv[j] = argv[j+1]; - } - argc--; - } else { - argv[i] += 2 + (int)strspn(&argv[i][2], " "); - } - - if (i == argc - 2) - Usage(); - - for (no = 0; (no < 2*CNFLD) && (i < argc - 2); no++) { - if (no > CNOFLD - 1) { - /* Get larger table for outlists */ - /* (CNOFLD is updated.) */ - get_olist(CNOFLD + NOFLD); - } - - if (strncmp(argv[i], "1.", 2) == 0) { - olistf[no] = F1; - olist[no] = (int)strtol(&argv[i][2], - (char **)NULL, 10); - nextargopt = 2 + (int) - strspn(&argv[i][2], "0123456789"); - } else if (strncmp(argv[i], "2.", 2) == 0) { - olistf[no] = F2; - olist[no] = (int)strtol(&argv[i][2], - (char **)NULL, 10); - nextargopt = 2 + (int) - strspn(&argv[i][2], "0123456789"); - } else if (argv[i][0] == '0') { - olistf[no] = JOINFIELD; - nextargopt = 1; - } else - break; - - if (olist[no] > CNFLD) - get_ppi(olist[no]); - - if (argv[i][nextargopt] == '\0') { - for (j = i; j < argc; j++) { - argv[j] = argv[j+1]; - } - argc--; - } else if ((argv[i][nextargopt] == ' ') || - (argv[i][nextargopt] == ',')) { - argv[i] += nextargopt + 1; - } else - Usage(); - } - } - } - - /* get other options */ - while ((opt = getopt(argc, argv, "1:2:a:e:j:t:v:")) != EOF) { - switch (opt) { - case '1': - j1 = (int)strtol(optarg, (char **)NULL, 10); - break; - - case '2': - j2 = (int)strtol(optarg, (char **)NULL, 10); - break; - - case 'a': - case 'v': - filenumber = (int)strtol(optarg, (char **)NULL, 10); - if ((filenumber != 1) && (filenumber != 2)) - Usage(); - - aflg |= filenumber; - if (opt == 'v') - vflg |= filenumber; - break; - - case 'e': - null = optarg; - break; - - case 'j': - j1 = j2 = (int)strtol(optarg, (char **)NULL, 10); - break; - - case 't': - tflg = 1; - (void) mbtowc(&sep1, optarg, MB_CUR_MAX); - sep2 = sep1; - break; - } - } - if (j1 > CNFLD || j2 > CNFLD) - get_ppi(max(j1, j2)); - - /* check options */ - if ((j1 > CNFLD) || (j2 > CNFLD) || (j1 <= 0) || (j2 <= 0)) { - (void) fprintf(stderr, gettext( - "join: bad join field number\n")); - Usage(); - } - - /* 0 origin */ - for (i = 0; i < no; i++) - olist[i]--; - j1--; - j2--; - - if (argc - optind != 2) - Usage(); - - if (strcmp(argv[optind], "-") == 0) - f[F1] = stdin; - else if ((f[F1] = fopen(argv[optind], "r")) == NULL) { - perror(argv[optind]); - exit(1); - } - - if (strcmp(argv[optind+1], "-") == 0) { - (void) strncpy(tmpfile, "/tmp/joinXXXXXX", 20); - if ((fd = mkstemp(tmpfile)) < 0) { - perror(gettext("join: cannot create tmpfile")); - exit(1); - } - if ((f[F2] = fdopen(fd, "w+")) == NULL) { - perror(gettext("join: cannot open tmpfile")); - exit(1); - } - /* tmpfile is automatically removed on exit */ - (void) unlink(tmpfile); - - while ((t = fread(buffer1, 1, BUFSIZ, stdin)) != 0) { - if ((fwrite(buffer1, 1, t, f[F2])) != t) { - (void) fprintf(stderr, gettext( - "join: cannot write to tmpfile\n")); - exit(1); - } - } - (void) fflush(f[F2]); - rewind(f[F2]); - } else if ((f[F2] = fopen(argv[optind+1], "r")) == NULL) { - perror(argv[optind+1]); - exit(1); - } - - /* set bottom mark on file2 */ - bot2 = ftello(f[F2]); - - /* input a line from each file */ - get1(); - get2(); - - /* while lines in both files or -a|v and lines in ether file */ - while (((n1 > 0) && (n2 > 0)) || ((aflg != 0) && ((n1 + n2) > 0))) { - - /* compare join fields */ - cmpresult = comp(); - - /* joinfiled1 > joinfield2 or file1 exasted */ - if (((n1 > 0) && (n2 > 0) && (cmpresult > 0)) || (n1 == 0)) { - - /* outputing unpaired ? */ - if (aflg & 2) - output(0, n2); - - /* mark bottom of file2 */ - bot2 = ftello(f[F2]); - - /* input line from file2 */ - get2(); - - /* joinfiled1 < joinfield2 or file2 exasted */ - } else if (((n1 > 0) && (n2 > 0) && (cmpresult < 0)) || - (n2 == 0)) { - - /* outputing unpaired ? */ - if (aflg & 1) - output(n1, 0); - - /* input line from file1 */ - get1(); - - /* line1 and line2 not empty and joinfield1 == joinfield2 */ - } else { - /* for lines in file2 that match join field */ - while (n2 > 0 && comp() == 0) { - - /* if not -v output line */ - if (!vflg) - output(n1, n2); - - /* mark top of file2 */ - top2 = ftello(f[F2]); - - /* input line from file2 */ - get2(); - } - - /* back to bottom line in file2 */ - (void) fseeko(f[F2], (off_t)bot2, SEEK_SET); - - /* input line form file1 and file2 */ - get2(); - get1(); - - for (;;) { - /* compare join fields */ - cmpresult = comp(); - - /* - * line1 and line2 not empty and - * joinfield1 == joinfield2 - */ - if (n1 > 0 && n2 > 0 && cmpresult == 0) { - - /* if not -v output line */ - if (!vflg) - output(n1, n2); - - /* input line from file2 */ - get2(); - - /* joinfiled1 < joinfield2 or file2 exasted */ - } else if (n1 > 0 && n2 > 0 && cmpresult < 0 || - n2 == 0) { - - /* seek to bottom of file2 */ - (void) fseeko(f[F2], (off_t)bot2, SEEK_SET); - - /* input line form file1 and file2 */ - get2(); - get1(); - - /* file1 exasted or joinfile1 > joinfield2 */ - } else { - /* seek to top of file2 */ - (void) fseeko(f[F2], (off_t)top2, SEEK_SET); - - /* set bottom at top */ - bot2 = top2; - - /* input line form file2 */ - get2(); - - break; - } - } - } - } - return (0); -} - - -static int -input(int n) /* get input line and split into fields */ -{ - int i, c; - wchar_t *bp; - wchar_t *tbp; - wchar_t **pp; - int nread; - - bp = buf[n]; - pp = ppi[n]; - - errno = 0; - if (fgetws(bp, CBUFSIZE[n], f[n]) == (wchar_t *)NULL) { - if (errno) { - perror("join"); - exit(1); - } - return (0); - } else { - if (errno == EILSEQ) { - (void) fprintf(stderr, gettext( - "join: invalid char following \"")); - (void) fputws(bp, stderr); - (void) fprintf(stderr, "\": "); - perror(""); - exit(1); - } else if (errno) { - perror("join"); - exit(1); - } - - /* Check for long lines */ - if (((wchar_t *)wcsrchr((wchar_t *)bp, L'\n') - == (wchar_t *)NULL) && (size_t)wcslen((wchar_t *)bp) - == (size_t)(CBUFSIZE[n] - 1)) { - tbp = bp; - nread = CBUFSIZE[n] - 1; - while ((wchar_t *)wcsrchr((wchar_t *)tbp, L'\n') - == (wchar_t *)NULL) { - /* Increase buffer by LINE_MAX */ - /* (CBUFSIZE[n] is updated.) */ - get_buf(n, CBUFSIZE[n] + LINE_MAX); - bp = buf[n]; - tbp = buf[n] + nread; - - /* Read rest of line */ - errno = 0; - if (fgetws(tbp, LINE_MAX + 1, f[n]) - == (wchar_t *)NULL) { - if (errno) { - perror("join"); - exit(1); - } - break; - } else if (errno == EILSEQ) { - (void) fprintf(stderr, gettext( - "join: invalid char following \"")); - (void) fputws(bp, stderr); - (void) fprintf(stderr, "\": "); - perror(""); - exit(1); - } else if (errno) { - perror("join"); - exit(1); - } - nread += (size_t)wcslen((wchar_t *)tbp); - } - } - } - - bp = buf[n]; - i = 0; - do { - i++; - /* Check for overflow of ppi[n] */ - if (i > CNFLD - 1) { /* account for 0 termination */ - /* Reallocate larger buffers (CNFLD is updated.) */ - get_ppi(CNFLD + NFLD); - /* Restore local pointer */ - pp = &ppi[n][i-1]; - } - if (!tflg) /* strip multiples */ - while ((c = *bp) == sep1 || c == sep2) { - bp++; /* skip blanks */ - } - *pp++ = bp; /* record beginning */ - while ((c = *bp) != sep1 && c != L'\n' && - c != sep2 && c != L'\0') { - bp++; - } - *bp++ = L'\0'; /* mark end by overwriting blank */ - } while ((c != L'\n') && (c != L'\0') && (pp != &ppi[n][CNFLD])); - - *pp = (wchar_t *)NULL; - - - return (i); -} - - -static void -output(on1, on2) /* print items from olist */ -int on1, on2; -{ - int i; - - if (no <= 0) { /* default case */ - if (on1) - putfield(ppi[F1][j1]); - else - putfield(ppi[F2][j2]); - for (i = 0; i < on1; i++) - if (i != j1) { - (void) putwchar(sep1); - putfield(ppi[F1][i]); - } - for (i = 0; i < on2; i++) - if (i != j2) { - (void) putwchar(sep1); - putfield(ppi[F2][i]); - } - (void) putwchar(L'\n'); - } else { - for (i = 0; i < no; i++) { - if (olistf[i] == F1 && on1 <= olist[i] || - olistf[i] == F2 && on2 <= olist[i]) { - (void) fputs(null, stdout); - } else if (olistf[i] == JOINFIELD) { - if (on1) - putfield(ppi[F1][j1]); - else - putfield(ppi[F2][j2]); - } else - putfield(ppi[olistf[i]][olist[i]]); - - if (i < no - 1) -#if defined(__lint) /* lint doesn't grok "%wc" */ - /* EMPTY */; -#else - (void) printf("%wc", sep1); -#endif - else - (void) putwchar(L'\n'); - } - } -} - - -static int -cmp(s1, s2) -wchar_t *s1, *s2; -{ - int rc; - - if (s1 == (wchar_t *)NULL) { - if (s2 == (wchar_t *)NULL) - rc = 0; - else - rc = -1; - } else if (s2 == (wchar_t *)NULL) - rc = 1; - else - rc = wscoll(s1, s2); - - return (rc); -} - - -static void -Usage() -{ - (void) fprintf(stderr, gettext( - "usage: join [-a file_number | -v file_number] [-o list [-e string]]\n" - " [-t char] [-1 field] [-2 field] file1 file2\n\n" - " join [-a file_number] [-j field] [-j1 field] [-j2 field]\n" - " [-o list [-e string]] [-t char] file1 file2\n")); - exit(1); -} - -/* - * Allocate memory for buffers. - */ -static void -init_buf() -{ - (void) get_buf(F1, LINE_MAX); - (void) get_buf(F2, LINE_MAX); - (void) get_ppi(NFLD); - (void) get_olist(NOFLD); -} - - -static void -get_ppi(nfld) -int nfld; -{ - int i; - - for (i = 0; i < 2; i++) { - if (ppi[i]) { - if ((ppi[i] = (wchar_t **)realloc((char *)ppi[i], - (unsigned)(nfld * sizeof (wchar_t *)))) - == NULL) { - (void) fprintf(stderr, - gettext("realloc pointer table failed\n")); - exit(1); - } - } else { - if ((ppi[i] = (wchar_t **)calloc((unsigned)nfld, - (unsigned)sizeof (wchar_t *))) == NULL) { - (void) fprintf(stderr, - gettext("calloc pointer table failed\n")); - exit(1); - } - } - } - - CNFLD = nfld; -} - - -static void -get_buf(i, size) -int i; -int size; -{ - if (buf[i]) { - if ((buf[i] = (wchar_t *) - realloc(buf[i], (unsigned)(size * sizeof (wchar_t)))) - == NULL) { - (void) fprintf(stderr, - gettext("realloc input buffer failed\n")); - exit(1); - } - } else { - if ((buf[i] = (wchar_t *) - calloc((unsigned)size, (unsigned)sizeof (wchar_t))) - == NULL) { - (void) fprintf(stderr, - gettext("calloc input buffer failed\n")); - exit(1); - } - } - - CBUFSIZE[i] = size; -} - - -static void -get_olist(onfld) -int onfld; -{ - if (olist) { - if ((olist = (int *)realloc((wchar_t *)olist, - (unsigned)(onfld * sizeof (int)))) == NULL) { - (void) fprintf(stderr, - gettext("realloc olist failed\n")); - exit(1); - } - } else { - if ((olist = (int *) - calloc((unsigned)onfld, (unsigned)sizeof (int))) - == NULL) { - (void) fprintf(stderr, - gettext("calloc olist failed\n")); - exit(1); - } - } - - if (olistf) { - if ((olistf = (int *)realloc((wchar_t *)olistf, - (unsigned)(onfld * sizeof (int)))) == NULL) { - (void) fprintf(stderr, - gettext("realloc olistf failed\n")); - exit(1); - } - } else { - if ((olistf = (int *) - calloc((unsigned)onfld, (unsigned)sizeof (int))) - == NULL) { - (void) fprintf(stderr, gettext("calloc olistf failed\n")); - exit(1); - } - } - - CNOFLD = onfld; -} diff --git a/usr/src/cmd/ksh/Makefile.testshell b/usr/src/cmd/ksh/Makefile.testshell index fdad066a57..ef520d4d04 100644 --- a/usr/src/cmd/ksh/Makefile.testshell +++ b/usr/src/cmd/ksh/Makefile.testshell @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -101,7 +101,7 @@ testshell: $(PROG) printf "# which ksh='%s', ksh93='%s'\n" \ "$$(which ksh)" "$$(which ksh93)" ; \ ) ; \ - if [[ "$$(isalist)" != ~(E)$(LIBSHELLMACH) ]] ; then \ + if [[ "$$(isalist)" != ~(F)$(LIBSHELLMACH) ]] ; then \ printf \ "# ISA='%s' not available on this system, skipping tests...\n" \ "$(LIBSHELLMACH)" ; \ @@ -135,6 +135,7 @@ testshell: $(PROG) "$$(basename "$${test_item}")" \ "$${mode%:*}"; \ ( \ + ulimit -s 65536 ; \ test_output="$$( ( \ export \ SHELL="$(SRC)/cmd/ksh/$(LIBSHELLMACH)/ksh" \ diff --git a/usr/src/cmd/ksh/builtins/Makefile b/usr/src/cmd/ksh/builtins/Makefile index fcc92f323e..52808250c7 100644 --- a/usr/src/cmd/ksh/builtins/Makefile +++ b/usr/src/cmd/ksh/builtins/Makefile @@ -30,29 +30,43 @@ PROG= alias ALIASPROG= \ bg \ cd \ + cksum \ + cmp \ + comm \ command \ + cut \ fc \ fg \ getopts \ hash \ jobs \ + join \ kill \ + logname \ + paste \ + print \ read \ rev \ sleep \ sum \ + tee \ test \ type \ ulimit \ umask \ unalias \ - wait + uniq \ + wait \ + wc include ../../Makefile.cmd +$(SPARC_BLD)include ../../Makefile.cmd.64 ROOTALIASPROG= $(ALIASPROG:%=$(ROOTBIN)/%) FILEMODE= 555 +OWNER= root +GROUP= bin .KEEP_STATE: @@ -61,8 +75,6 @@ all: $(PROG) $(ROOTBIN)/%: $(ROOTBIN)/alias $(INS.link) -include ../../Makefile.cmd - .KEEP_STATE: # Set common AST build flags (e.g., needed to support the math stuff). @@ -73,11 +85,19 @@ OBJECTS= \ SRCS= $(OBJECTS:%.o=%.c) -LDLIBS += -lshell -last +GROUP= bin +LDLIBS += -lshell -lcmd -last CPPFLAGS = \ $(DTEXTDOM) $(DTS_ERRNO) \ - -I$(ROOT)/usr/include/ast + -I$(ROOT)/usr/include/ast \ + -I$(ROOT)/usr/include + +# Enable workaround for a crash in /usr/bin/alias when invalid +# options are passed (e.g. $ /usr/bin/alias -c #). The shell +# code will call an error handler which does a |longjmp()| but +# somehow the code failed to do the |setjmp()| before this point. +CPPFLAGS += -DWORKAROUND_FOR_ALIAS_CRASH CFLAGS += \ $(ASTCFLAGS) diff --git a/usr/src/cmd/ksh/builtins/alias.c b/usr/src/cmd/ksh/builtins/alias.c index b477d7353c..dd789ef844 100644 --- a/usr/src/cmd/ksh/builtins/alias.c +++ b/usr/src/cmd/ksh/builtins/alias.c @@ -33,8 +33,122 @@ #include <shell.h> #include <nval.h> +#include <cmdext.h> #include <stdio.h> +typedef struct { + const char *name; + int (* func)(int, char **, void *); +} bfastpathrec; + +/* + * We've disabled the "fastpath" codepath for some commands below + * because it causes a paradoxon for large input files (as used by + * ON PerfPIT for testing). For /usr/bin/rev (where the issue was + * first discovered) it looks like this: + * - for small files like /etc/profile the fastpath is faster in a loop + * with 1000 iterations (8 seconds with fastpath, 14 seconds without + * fastpath) + * - for large files (/usr/pub/UTF-8 replicated until the test file + * reaches 24884706 bytes) the benchmark reverses: The fastpath now + * needs 40 seconds and without fastpath it needs 30 seconds (for 100 + * iterations). + */ +#if 0 +#define ENABLE_PERFORMANCE_PARADOXON 1 +#endif + +/* + * List of libcmd builtins which do not require a |Shell_t| context. + * This list was automatically generated from <ast/cmdext.h> + */ +static const +bfastpathrec fastpath_builtins[] = +{ + /* This list must be alphabetically sorted for |strcmp()| usage */ + { "basename", b_basename }, + { "cat", b_cat }, + { "chgrp", b_chgrp }, + { "chmod", b_chmod }, + { "chown", b_chown }, +#ifdef ENABLE_PERFORMANCE_PARADOXON + { "cksum", b_cksum }, +#endif /* ENABLE_PERFORMANCE_PARADOXON */ + { "cmp", b_cmp }, + { "comm", b_comm }, + { "cp", b_cp }, + { "cut", b_cut }, + { "date", b_date }, + { "dirname", b_dirname }, + { "egrep", b_egrep }, + { "expr", b_expr }, + { "fds", b_fds }, + { "fgrep", b_fgrep }, + { "fmt", b_fmt }, + { "fold", b_fold }, + { "getconf", b_getconf }, + { "grep", b_grep }, + { "head", b_head }, + { "id", b_id }, + { "join", b_join }, + { "ln", b_ln }, + { "logname", b_logname }, + { "md5sum", b_md5sum }, + { "mkdir", b_mkdir }, + { "mkfifo", b_mkfifo }, + { "mktemp", b_mktemp }, + { "mv", b_mv }, + { "paste", b_paste }, + { "pathchk", b_pathchk }, + { "pids", b_pids }, + { "readlink", b_readlink }, +#ifdef ENABLE_PERFORMANCE_PARADOXON + { "rev", b_rev }, +#endif /* ENABLE_PERFORMANCE_PARADOXON */ + { "rm", b_rm }, + { "rmdir", b_rmdir }, + { "stty", b_stty }, +#ifdef ENABLE_PERFORMANCE_PARADOXON + { "sum", b_sum }, +#endif /* ENABLE_PERFORMANCE_PARADOXON */ + { "sync", b_sync }, + { "tail", b_tail }, + { "tee", b_tee }, + { "tty", b_tty }, + { "uname", b_uname }, + { "uniq", b_uniq }, + { "wc", b_wc }, + { "xgrep", b_xgrep }, + { NULL, (int (*)(int, char **, void *))NULL } +}; + +static inline +const bfastpathrec * +find_bfastpathrec(const char *name) +{ + unsigned int i; + signed int cmpres; + for (i = 0; fastpath_builtins[i].name != NULL; i++) { + cmpres = strcmp(fastpath_builtins[i].name, name); + if (cmpres == 0) + return (&fastpath_builtins[i]); + else if (cmpres > 0) + return (NULL); + + } + return (NULL); +} + +static inline +int +fastpath_builtin_main(const bfastpathrec *brec, int argc, char *argv[]) +{ + setlocale(LC_ALL, ""); /* calls |_ast_setlocale()| */ + + return ((*brec->func)(argc, argv, NULL)); +} + + /* Builtin script, original derived from alias.sh */ static const char *script = "\n" /* Get name of builtin */ @@ -58,12 +172,27 @@ static const char *script = "\n" "if [[ \"${cmd}\" == \"command\" ]] ; then\n" "command \"$@\"\n" "else\n" +#ifdef WORKAROUND_FOR_ALIAS_CRASH +/* + * Work around a crash in /usr/bin/alias when invalid options are + * passed (e.g. $ /usr/bin/alias -c #). The shell code will call + * an error handler which does a |longjmp()| but somehow the code + * failed to do the |setjmp()| before this point. + * Putting the "alias" command in a subshell avoids the crash. + * Real cause of the issue is under investigation and a fix be + * delivered with the next ast-ksh update. + */ + "( \"${cmd}\" \"$@\" )\n" +#else "\"${cmd}\" \"$@\"\n" +#endif /* WORKAROUND_FOR_ALIAS_CRASH */ "fi\n" "exitval=$?"; + +static inline int -main(int argc, char *argv[]) +script_builtin_main(int argc, char *argv[]) { int i; Shell_t *shp; @@ -98,3 +227,35 @@ main(int argc, char *argv[]) return (exitval); } + +int +main(int argc, char *argv[]) +{ + const char *progname; + const bfastpathrec *brec; + char execnamebuff[PATH_MAX+1]; + + /* Get program name */ + if (pathprog(argv[0], execnamebuff, sizeof (execnamebuff)) <= 0) + error(ERROR_exit(1), "could not determinate exec name."); + + progname = (const char *)strrchr(execnamebuff, '/'); + if (progname != NULL) { + progname++; + } + else + { + progname = execnamebuff; + } + + /* Execute command... */ + if (brec = find_bfastpathrec(progname)) { + /* ... either via a fast path (calling the code directly) ... */ + return (fastpath_builtin_main(brec, argc, argv)); + } + else + { + /* ... or from within a full shell. */ + return (script_builtin_main(argc, argv)); + } +} diff --git a/usr/src/cmd/logname/Makefile b/usr/src/cmd/logname/Makefile deleted file mode 100644 index 74bdddb5f8..0000000000 --- a/usr/src/cmd/logname/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -PROG= logname - -include ../Makefile.cmd - -CFLAGS += $(CCVERBOSE) - -.KEEP_STATE: - -all: $(PROG) - -install: all $(ROOTPROG) - -clean: - -lint: lint_PROG - -include ../Makefile.targ diff --git a/usr/src/cmd/logname/logname.c b/usr/src/cmd/logname/logname.c deleted file mode 100644 index 62c895ea94..0000000000 --- a/usr/src/cmd/logname/logname.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <unistd.h> -#include <libintl.h> -#include <locale.h> -#include <stdio.h> - -int -main(void) -{ - char *name; - - (void) setlocale(LC_ALL, ""); -#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ -#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ -#endif - (void) textdomain(TEXT_DOMAIN); - - if ((name = getlogin()) == NULL) - return (1); - (void) puts(name); - return (0); -} diff --git a/usr/src/cmd/nsadmin/ksh.kshrc b/usr/src/cmd/nsadmin/ksh.kshrc index 10da11dbfe..ea3826223d 100644 --- a/usr/src/cmd/nsadmin/ksh.kshrc +++ b/usr/src/cmd/nsadmin/ksh.kshrc @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -35,6 +35,8 @@ if [[ "$(set +o)" != ~(Er)--(gmacs|emacs|vi)( .*|) ]] ; then set -o gmacs # enable multiline input mode set -o multiline + # enable globstar mode (match subdirs with **/) + set -o globstar fi # Set a default prompt (<username>@<hostname>:<path><"($|#) ">) if @@ -66,10 +68,12 @@ fi # - Make sure to use absolute paths (e.g. /usr/bin/hostname) to make # sure PS1 works in cases where PATH does not contain /usr/bin/ if [[ "$(set)" != ~(E)PS1= && "${PS1}" == '' ]] ; then - PS1='$(printf "%*s\r%s" COLUMNS "")${LOGNAME}@$(/usr/bin/hostname):$( - ellip="$( + PS1='$(set +o xtrace +o errexit + printf "%*s\r%s" COLUMNS "" + printf "%s@%s:" "${LOGNAME}" "$(/usr/bin/hostname)" + ellip="${ [[ "${LC_ALL}/${LANG}" == ~(Elr)(.*UTF-8/.*|/.*UTF-8) ]] && - printf "\u[2026]\n" || print "..." )" + printf "\u[2026]\n" || print "..." ; }" p="${PWD/~(El)${HOME}/\~}" (( ${#p} > 30 )) && print -r -n -- "${ellip}${p:${#p}-30:30}" || diff --git a/usr/src/cmd/paste/Makefile b/usr/src/cmd/paste/Makefile deleted file mode 100644 index 13e884af1d..0000000000 --- a/usr/src/cmd/paste/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1989,1996 by Sun Microsystems, Inc. -# All rights reserved. -# - -PROG= paste - -include ../Makefile.cmd - -XGETFLAGS += -a -x $(PROG).xcl -CPPFLAGS += -D_FILE_OFFSET_BITS=64 - -.KEEP_STATE: - -all: $(PROG) - -install: all $(ROOTPROG) - -clean: - -lint: lint_PROG - -include ../Makefile.targ diff --git a/usr/src/cmd/paste/paste.c b/usr/src/cmd/paste/paste.c deleted file mode 100644 index 14fc096b0e..0000000000 --- a/usr/src/cmd/paste/paste.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 1994 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T - * All Rights Reserved - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <locale.h> -#include <widec.h> -#include <stdlib.h> -#include <limits.h> - - -#define MAXOPNF 12 /* maximal no. of open files (not with -s option) */ -#define MAXOPNF_STR "12" -#define RUB '\177' - - -/* - * Function prototypes - */ -static void diag(char *, char *); -static int move(char *, wchar_t *); -static void usage(); - -int -main(int argc, char **argv) -{ - int i, j, k, eofcount, nfiles, maxline, glue; - int delcount = 1; - int onefile = 0; - register int c; - wchar_t del[LINE_MAX]; - wchar_t outbuf[LINE_MAX], l, t; - register wchar_t *p; - FILE *inptr[MAXOPNF]; - int arg_ind; - int file_ind; - int error = 0; - - - /* Get locale variables from environment */ - (void) setlocale(LC_ALL, ""); - -#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ -#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ -#endif - (void) textdomain(TEXT_DOMAIN); - - del[0] = '\t'; - maxline = LINE_MAX -2; - - /* Get command arguments */ - while ((c = getopt(argc, argv, "d:s")) != EOF) { - switch (c) { - case 'd' : - delcount = move(optarg, del); - if (delcount < 1) - diag("paste: no delimiters\n", NULL); - break; - - case 's' : - onefile++; - break; - - case '?': - usage(); - - /* NOTREACHED */ - break; - } - } - - if (!onefile) { /* not -s option: parallel line merging */ - - /* Find explicit stdin and file names */ - for (file_ind = 0, arg_ind = optind; arg_ind < argc && - file_ind < MAXOPNF; arg_ind++) { - if (argv[arg_ind][0] == '-' && - argv[arg_ind][1] == '\0') { - inptr[file_ind++] = stdin; - } else if (arg_ind >= optind) { - inptr[file_ind++] = fopen(argv[arg_ind], "r"); - if (inptr[file_ind -1] == NULL) { - diag("paste: cannot open %s\n", - argv[arg_ind]); - } - } - } - if (arg_ind < argc) { - char maxopnf_buf[LINE_MAX]; - (void) sprintf(maxopnf_buf, "%d", MAXOPNF); - diag("paste: too many files- limit %s\n", maxopnf_buf); - } - nfiles = file_ind; - - do { - p = &outbuf[0]; - eofcount = 0; - j = k = 0; - for (i = 0; i < nfiles; i++) { - while ((c = fgetwc(inptr[i])) != '\n' && - c != EOF) { - if (++j <= maxline) - *p++ = c; - else { - diag( - "paste: line too long\n", - NULL); - } - } - if ((l = del[k]) != RUB) - *p++ = l; - - k = (k + 1) % delcount; - - if (c == EOF) - eofcount++; - } - if (l != RUB) - *--p = '\n'; - else - *p = '\n'; - *++p = 0; - if (eofcount < nfiles) - (void) printf("%ws", outbuf); - } while (eofcount < nfiles); - - } else { /* -s option: serial file pasting (old 127 paste command) */ - - for (i = optind; i < argc; i++) { - p = &outbuf[0]; - glue = 0; - j = 0; - k = 0; - t = 0; - if (argv[i][0] == '-' && - argv[i][1] == '\0') { - inptr[0] = stdin; - } else if (i >= optind) { - inptr[0] = fopen(argv[i], "r"); - if (inptr[0] == NULL) { - (void) fprintf(stderr, gettext( - "paste: cannot open %s\n"), argv[i]); - error = 1; - } - } - - /* Argument not a file name */ - if (inptr[0] == NULL) { - continue; - } - - while ((c = fgetwc(inptr[0])) != EOF) { - if (j >= maxline) { - t = *--p; - *++p = 0; - (void) printf("%ws", outbuf); - p = &outbuf[0]; - j = 0; - } - if (glue) { - glue = 0; - l = del[k]; - if (l != RUB) { - *p++ = l; - t = l; - j++; - } - k = (k + 1) % delcount; - } - if (c != '\n') { - *p++ = c; - t = c; - j++; - } else glue++; - } - if (t != '\n') { - *p++ = '\n'; - j++; - } - if (j > 0) { - *p = 0; - (void) printf("%ws", outbuf); - } - } - } - return (error); -} - - -static void -diag(char *s, char *arg) -{ - (void) fprintf(stderr, gettext(s), arg); - exit(1); -} - - -static int -move(char *from, wchar_t *to) -{ - int i, n; - wchar_t wc; - - i = 0; - while (*from) { - n = mbtowc(&wc, from, MB_CUR_MAX); - if (n <= 0) - return (0); /* invalid character as a delimiter */ - from += n; - if (wc != L'\\') *to++ = wc; - else { - n = mbtowc(&wc, from, MB_CUR_MAX); - if (n <= 0) - return (0); - from += n; - switch (wc) { - case L'0' : *to++ = RUB; - break; - case L't' : *to++ = L'\t'; - break; - case L'n' : *to++ = L'\n'; - break; - default : *to++ = wc; - break; - } - } - i++; - } - return (i); -} - - -static void -usage() -{ - (void) fprintf(stderr, gettext( - "usage: paste [-s] [-d list] file \n\n")); - exit(1); -} diff --git a/usr/src/cmd/paste/paste.xcl b/usr/src/cmd/paste/paste.xcl deleted file mode 100644 index b2c15d5201..0000000000 --- a/usr/src/cmd/paste/paste.xcl +++ /dev/null @@ -1,24 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -msgid "" -msgid "%ws" -msgid "r" diff --git a/usr/src/cmd/shcomp/Makefile b/usr/src/cmd/shcomp/Makefile index a75aa1669e..1e2e774413 100644 --- a/usr/src/cmd/shcomp/Makefile +++ b/usr/src/cmd/shcomp/Makefile @@ -27,6 +27,7 @@ SHELL=/usr/bin/ksh93 include ../Makefile.cmd +$(SPARC_BLD)include ../Makefile.cmd.64 .KEEP_STATE: @@ -42,6 +43,7 @@ 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 diff --git a/usr/src/cmd/tee/Makefile b/usr/src/cmd/tee/Makefile deleted file mode 100644 index a123f8fdc6..0000000000 --- a/usr/src/cmd/tee/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -PROG= tee - -include ../Makefile.cmd - -CFLAGS += $(CCVERBOSE) -CPPFLAGS += -D_FILE_OFFSET_BITS=64 - -# -# For messaging catalogue file -XGETFLAGS += -a -x tee.xcl - -.KEEP_STATE: - -all: $(PROG) - -install: all $(ROOTPROG) - -clean: - -lint: lint_PROG - -include ../Makefile.targ diff --git a/usr/src/cmd/tee/tee.c b/usr/src/cmd/tee/tee.c deleted file mode 100644 index 954a4fd2ce..0000000000 --- a/usr/src/cmd/tee/tee.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * tee - pipe fitting - */ - -#include <stdlib.h> -#include <limits.h> -#include <signal.h> -#include <unistd.h> -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <locale.h> - -#define min(a, b) ((a) > (b) ? (b) : (a)) -#define MAXFILES 20 - -static void stash(int); - -static int ofiles = 0; -static int ispipe = 0; /* output goes to pipe or special file */ -static int openf[MAXFILES] = { 1 }; -static char in[PIPE_BUF]; -static const char *usage = "usage: tee [-ai] [file...]\n"; - -int -main(int argc, char **argv) -{ - int w; - int c; - int aflag = 0; - int errorcode = 0; - struct stat buf; - - - (void) setlocale(LC_ALL, ""); -#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ -#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't. */ -#endif - (void) textdomain(TEXT_DOMAIN); - - while ((c = getopt(argc, argv, "ai")) != EOF) { - switch (c) { - case 'a': - aflag++; - break; - case 'i': - (void) signal(SIGINT, SIG_IGN); - break; - case '?': - (void) fprintf(stderr, gettext(usage)); - exit(1); - } - } - argc -= optind; - argv = &argv[optind]; - - (void) fstat(1, &buf); - if (S_ISFIFO(buf.st_mode) || S_ISCHR(buf.st_mode)) - ispipe++; - - openf[ofiles++] = 1; - while (argc-- > 0 && ofiles < MAXFILES) { - openf[ofiles] = open(argv[0], - O_WRONLY|O_CREAT|(aflag ? O_APPEND:O_TRUNC), 0666); - if (openf[ofiles] < 0) { - (void) fprintf(stderr, "tee: "); - perror(argv[0]); - errorcode++; - } else { - if (fstat(openf[ofiles], &buf) >= 0) { - if (S_ISCHR(buf.st_mode)) - ispipe++; - ofiles++; - } else { - (void) fprintf(stderr, "tee: "); - perror(argv[0]); - errorcode++; - } - } - argv++; - } - if (argc >= 0 && ofiles >= MAXFILES) { - argv--; - (void) fprintf(stderr, gettext("tee: too many input files; " - "ignoring file(s) listed after %s\n"), argv[0]); - errorcode++; - } - - while ((w = read(0, in, PIPE_BUF)) > 0) - stash(w); - if (w < 0) { - (void) fprintf(stderr, gettext("tee: read error on input\n")); - exit(1); - } - return (errorcode); -} - -static void -stash(int nbytes) -{ - register int k, i, chunk, nb; - - chunk = ispipe ? PIPE_BUF : nbytes; - for (i = 0; i < nbytes; i += chunk) { - nb = min(chunk, nbytes - i); - for (k = 0; k < ofiles; k++) - (void) write(openf[k], in+i, nb); - } -} diff --git a/usr/src/cmd/tee/tee.xcl b/usr/src/cmd/tee/tee.xcl deleted file mode 100644 index 5d8634ce8b..0000000000 --- a/usr/src/cmd/tee/tee.xcl +++ /dev/null @@ -1,23 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -msgid "" -msgid "ai" diff --git a/usr/src/cmd/uniq/Makefile b/usr/src/cmd/uniq/Makefile deleted file mode 100644 index ad0e2aed3a..0000000000 --- a/usr/src/cmd/uniq/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -PROG= uniq - -include ../Makefile.cmd - -CFLAGS += $(CCVERBOSE) - -XGETFLAGS += -a -x uniq.xcl -.KEEP_STATE: - -all: $(PROG) - -install: all $(ROOTPROG) - -clean: - -lint: lint_PROG - -include ../Makefile.targ diff --git a/usr/src/cmd/uniq/uniq.c b/usr/src/cmd/uniq/uniq.c deleted file mode 100644 index 0f9ae1ca32..0000000000 --- a/usr/src/cmd/uniq/uniq.c +++ /dev/null @@ -1,642 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (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 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * uniq: delete repeated lines within a file. - * - * uniq [-c|-d|-u][-f fields][-s char] [input_file [output_file]] - * OR: - * uniq [-c|-d|-u][-n][+m] [input_file [output_file]] - */ - -#include <stdio.h> -#include <ctype.h> -#include <locale.h> -#include <stdlib.h> -#include <libintl.h> -#include <string.h> -#include <wchar.h> -#include <wctype.h> - -#define isWblank(c) \ - ((c == 0x09 || c == 0x20) ? 1 : (iswctype((c), _ISBLANK|_ISSPACE))) - - -#define BLOCKSIZE 1000 /* How much line buffer to allocate at a time */ - -static int mcount = 0; /* # of mutually exclusive flags used */ -static int fields = 0; /* # of fields to be ignored */ -static int letters = 0; /* # of letters to be ignored */ -static int linec; -static char mode; /* = [c, d, u] */ -static int uniq; -static int mac; /* our modified argc, after parseargs() */ -static char **mav; /* our modified argv, after parseargs() */ -static char *skip(); - -/* - * according to spec 1170 (draft April 8, 1994), there are two - * ways to use uniq; and both ways are mutually exclusive. we use modeflag - * to insure that the user doesn't mix these mutually exclusive flags. - * if the [-f -s] flags are used, modeflag should be 1. if [-n +m] are - * used, then modeflag should be 2. so the possible values for modeflag are: - * 0: [-f,-s] && [-n, +m] weren't specified. default to XBD. - * 1: either -f or -s was specified. XBD specification. - * 2: either -n or +m was specified. obsolescent usage. - */ -#define MODEFLAG_FS 1 /* modeflag bits: -f or -s was specified */ -#define MODEFLAG_NM 2 /* modeflag bits: -n or _m was specified */ - -static int modeflag = 0; /* 0,1 = XBD spec. 2 = Obsolescent usage */ - - -static char usage0[] = "uniq [-c|-d|-u][-f fields][-s char]"; -static char usage1[] = "uniq [-c|-d|-u][-n][+m]"; - -static void printe(); -static int gline(char **buf, int *size); -static void pline(char *buf); -static int equal(char *b1, char *b2); -static void parseargs(int ac, char **av); -static void usage(); - - -int -main(int argc, char *argv[]) -{ - int c; /* for getopt(3C) parsing */ - char *b1 = NULL, *b2 = NULL; - int b1size = BLOCKSIZE, b2size = BLOCKSIZE; - FILE *temp; - - (void) setlocale(LC_ALL, ""); -#if !defined(TEXT_DOMAIN) -#define TEXT_DOMAIN "SYS_TEST" -#endif - (void) textdomain(TEXT_DOMAIN); - - if ((b1 = ((char *) malloc((unsigned) BLOCKSIZE))) == NULL || (b2 = - ((char *) malloc((unsigned) BLOCKSIZE))) == NULL) - printe(gettext("out of memory\n"), ""); - - parseargs(argc, argv); /* reformat all arguments for getopt */ - - /* handle all of uniq's arguments via getopt(3C): */ - while ((c = getopt(mac, mav, "n:m:cduf:s:")) != EOF) { - switch (c) { - case 'n': /* parseargs() psuedo argument for -# */ - modeflag |= MODEFLAG_NM; - fields = atoi(optarg); - break; - - case 'm': /* parseargs() psuedo argument for +# */ - modeflag |= MODEFLAG_NM; - letters = atoi(optarg); - break; - - case 'c': /* -c: precede output lines */ - /* FALLTHROUGH! */ - case 'd': /* -d: suppress non-repeated lines */ - /* FALLTHROUGH! */ - case 'u': /* -u: suppress repeated lines */ - mcount++; - mode = c; - break; - - case 'f': /* -f: ignore 1st fields on input lines */ - modeflag |= MODEFLAG_FS; - if (isdigit((unsigned char)*optarg) != 0) { - fields = atoi(optarg); - } else { - (void) fprintf(stderr, "uniq -f: %s: %s\n", - gettext("bad fields value"), optarg); - usage(); - exit(1); - } - break; - - case 's': /* -s: ignore 1st chars on comparisons */ - modeflag |= MODEFLAG_FS; - if (isdigit((unsigned char)*optarg) != 0) { - letters = atoi(optarg); - } else { - (void) fprintf(stderr, "uniq -s: %s: %s\n", - gettext("bad fields value"), optarg); - usage(); - exit(1); - } - break; - - default: - usage(); - exit(2); - break; - } - } - - /* see if we have any mutually exclusive options: */ - if (mcount > 1) { - (void) fprintf(stderr, - gettext("Mutually exclusive options were given!\n")); - usage(); - exit(3); - } - - /* see if the user mixed the old style usage with the new: */ - if (modeflag > MODEFLAG_NM) { - (void) fprintf(stderr, gettext( - "Mutually exclusive command lines arguments!\n")); - usage(); - exit(4); - } - - /* if there are more arguments than getopt(3C) handled: */ - if (mav[optind] != (char *) NULL) { - /* if the user specified an input filename: */ - if (*mav[optind] != (char) NULL) { - /* if the user didn't specify stdin: */ - if (strcmp(mav[optind], "-") != 0) { - if ((temp = fopen(mav[optind], "r")) == NULL) { - printe(gettext("cannot open %s\n"), - mav[optind]); - } - - (void) fclose(temp); - (void) freopen(mav[optind], "r", stdin); - } - } - - /* if the user specified an output filename: */ - if ((mav[optind + 1] != (char *) NULL) && - (*mav[optind + 1] != (char) NULL)) { - if (freopen(mav[optind + 1], "w", stdout) == NULL) { - printe(gettext("cannot create %s\n"), - mav[optind + 1]); - } - } - } - - if (gline(&b1, &b1size)) - exit(0); - for (; ; ) { - linec++; - if (gline(&b2, &b2size)) { - pline(b1); - exit(0); - } - if (!equal(b1, b2)) { - pline(b1); - linec = 0; - do { - linec++; - if (gline(&b1, &b1size)) { - pline(b2); - exit(0); - } - } while (equal(b1, b2)); - pline(b2); - linec = 0; - } - } -} - -/* - * Get an input line, dynamically growing the buffer as necessary. - */ -static int -gline(buf, size) -char **buf; -int *size; -{ - register int c, left = *size; - register char *input = *buf; - - while ((c = getchar()) != '\n') - { - if (c == EOF) - return (1); - - *input++ = c; - if (--left == 0) - { - *buf = (char *) realloc(*buf, *size + BLOCKSIZE); - if (*buf == NULL) - printe(gettext("out of memory\n"), ""); - - input = (*buf) + *size; - left = BLOCKSIZE; - *size += BLOCKSIZE; - } - } - - *input = '\0'; - return (0); -} - -static void -pline(buf) -register char buf[]; -{ - - switch (mode) { - - case 'u': - if (uniq) { - uniq = 0; - return; - } - break; - - case 'd': - if (uniq) break; - return; - - case 'c': - (void) printf("%4d ", linec); - } - uniq = 0; - (void) fputs(buf, stdout); - (void) putchar('\n'); -} - -/* - * equal: see if two strings are the same, accounting for any skipping. - * similar to strcmp(), except that we call skip() first. - * output: 1 if the strings are the same. 0 otherwise. - */ -static int -equal(b1, b2) -register char b1[], b2[]; -{ - b1 = skip(b1); - b2 = skip(b2); - - if (strcmp(b1, b2) == 0) { /* if they're the same, */ - uniq++; - return (1); - } - - return (0); -} - -char * -skip(char *s) -{ - int nf, nl; - int clen; /* # bytes which comprise a mb char */ - wchar_t wc; /* the xlated version of each mb char */ - - nf = nl = 0; - - /* - * we want to skip all user-specified fields first, and then - * any specified characters. so while there're fields to be - * skipped, examine each (possible m.b.) char. for each field, - * we first skip all blanks. then we skip any non-blank chars. - */ - - while (nf++ < fields) { - /* skip blank characters (s.b. or m.b) */ - clen = mbtowc(&wc, s, MB_CUR_MAX); - while ((clen > 0) && isWblank(wc)) { - s += clen; - clen = mbtowc(&wc, s, MB_CUR_MAX); - } - - if (clen == -1) { - /* - * illegal char found - * treat it as a non-blank single byte char - */ - s++; - clen = mbtowc(&wc, s, MB_CUR_MAX); - } else if (clen == 0) { - /* EOL found */ - break; - } - - /* skip non-blank and illegal characters */ - while (((clen > 0) && !isWblank(wc)) || - (clen == -1)) { - s += clen > 0 ? clen : 1; - clen = mbtowc(&wc, s, MB_CUR_MAX); - } - - /* if we've encountered EOL */ - if (clen == 0) { - break; - } - } - - /* - * skip all user-specified letters, s.b. or m.b. - */ - - while (nl++ < letters) { - clen = mbtowc(&wc, s, MB_CUR_MAX); - - /* if we've encountered EOL */ - if (clen == 0) { - break; - } - s += clen > 0 ? clen : 1; - - } - return (s); -} - -static void -printe(p, s) -char *p, *s; -{ - (void) fprintf(stderr, p, s); - exit(1); -} - - - -/* - * parseargs(): modify the args - * this routine is used to transform all arguments into a format - * which is acceptable to getopt(3C), and which retains backwards - * Solaris 2.[0-4] compatibility. - * - * This routine allows us to make full use of getopts, without any - * funny argument processing in main(). - * - * The other alternative would be to hand-craft the processed arguments - * during and after getopt(3C) - which usually leads to uglier code - * in main(). I've opted to keep the ugliness isolated down here, - * instead of in main(). - * - * We leave the following arguments unchanged: - * [-c | -d | -u], [-f fields] [-s char]. - * - * We modify the following arguments: - * -# (a.k.a. -n) to "-n #" - * +# (a.k.a. +n) to "-m #" - * - * E.g. -3 gets changed to the psuedo argument "-n 3". - * - * N.B.: we *DON'T* map -# to -f, nor +# to -s, as -/+ usage is - * mutually exclusive with -f & -s according to the - * spec 1170 man page. - * - * Anything after the valid options is assumed to be input or - * output filenames. - * - */ -static void -parseargs(ac, av) -int ac; -char **av; -{ - int i; /* current argument */ - int fflag; /* 0 = haven't found input/output file */ - int minusflag; /* !0 = have hit a "--": end of flags */ - size_t sz; /* size of the argument */ - size_t mav_sz; /* size of our psuedo argument space */ - - i = mac = fflag = minusflag = 0; /* proper initializations */ - - mav_sz = (size_t) ((ac + 1) * sizeof (char *)); - if ((mav = malloc(mav_sz)) == (char **) NULL) { - perror("malloc failed"); - exit(1); - } - - /* for each argument, see if we need to change things: */ - while ((av[i] != (char *) NULL) && (av[i][0] != (char) NULL)) { - /* - * if we're doing argument processing, and we have - * a "+" sign, then it should be of the form: +#. - * map it to "-m #". - */ - if ((fflag == 0) && (minusflag == 0) && (av[i][0] == '+')) { - if ((av[i][1] == (char) NULL) || - (atoi(&av[i][1]) <= 0)) { - /* - * The user did not follow the + with a - * positive decimal integer. - * Exit here because we don't want getopt() to - * print an error message about the -m option, - * since it doesn't exist in the man page! - */ - usage(); - exit(1); - } - /* since we're adding an arg, need to inc mav space */ - mav_sz += sizeof (char *); - if ((mav = realloc(mav, mav_sz)) == (char **) NULL) { - perror("realloc failed"); - exit(1); - } - - if ((mav[mac] = malloc(sizeof ("-m") + 1)) == - (char *) NULL) { - perror("malloc failed"); - exit(1); - } - - (void) strcpy(mav[mac], "-m"); - ++mac; /* prepare for 2nd argument */ - - - /* add the arg to our modified space */ - if ((mav[mac] = malloc(strlen(&av[i][1]) + 1)) == - (char *) NULL) { - perror("malloc failed"); - exit(1); - } - - (void) strcpy(mav[mac++], &av[i++][1]); - continue; - } - - /* - * Here we need to see if the user typed -#, where # is - * a positive integer. - * Allow for input file named "-" (standard input). - */ - if ((fflag == 0) && (minusflag == 0) && (av[i][0] == '-') && - (av[i][1] != (char) NULL) && (atoi(&av[i][1]) > 0)) { - /* this user did, so convert it to "-n #". */ - - /* since we're adding an arg, need to inc mav space */ - mav_sz += sizeof (char *); - if ((mav = realloc(mav, mav_sz)) == (char **) NULL) { - perror("realloc failed"); - exit(1); - } - - if ((mav[mac] = malloc(sizeof ("-n") + 1)) == - (char *) NULL) { - perror("malloc failed"); - exit(1); - } - - (void) strcpy(mav[mac++], "-n"); - - if ((mav[mac] = malloc(strlen(&av[i][1] + 1))) == - (char *) NULL) { - perror("malloc failed"); - exit(1); - } - - (void) strcpy(mav[mac++], &av[i++][1]); - continue; - } - - /* the rest should be normal argument processing: */ - - /* first copy the argument: */ - sz = strlen(&av[i][0]); - if ((mav[mac] = malloc(sz + 1)) == (char *) NULL) { - perror("malloc failed"); - exit(1); - } - - (void) strcpy(mav[mac], av[i]); - - /* see if we need to do any further processing: */ - if ((av[i][0] == '-') && (av[i][1] != (char) NULL) && - (minusflag == 0)) { - - switch (av[i][1]) { - /* - * start of all the other expected arguments. - * here we keep continuing - eventually we'll - * either run out of arguments, or we'll run - * into the input & output files (after which - * we terminate this loop). - */ - - /* flags without subarguments: */ - case 'c': /* FALLTHROUGH */ - case 'd': /* FALLTHROUGH */ - case 'u': - break; /* no more processing required */ - - - /* flags with required subarguments: */ - case 'f': /* FALLTHROUGH */ - case 's': - if (av[i][2] == (char) NULL) { - /* - * The user has put white space - * between the option and its argument; - * alloc some space, & add the next - * arg. - */ - ++mac; /* inc our arg count */ - ++i; /* mv to next (sub)arg */ - - /* - * If there's no next argument, then - * simply return; getopt(3C) will - * print a message about the missing - * option argument. - */ - if ((av[i] == (char *) NULL) || - av[i][0] == (char) NULL) - return; - else { - /* add the subargument */ - mav[mac] = malloc( - strlen(&av[i][0])); - if (mav[mac] == (char *) NULL) { - perror("malloc failed"); - exit(1); - } - (void) strcpy(mav[mac], - &av[i][0]); - } - } - - break; - - case '-': /* --: end of arguments */ - minusflag = 1; - break; - - default: - /* - * no flags == input/output file. inc - * fflag, so that: - * - we do no further argument processing. - * - we know apriori that there will - * be no more than 2 files. - * we leave if we hit the second file. - */ - if (++fflag >= 2) { - /* - * we've copied the file argument - * already, so leave. - */ - mav[++mac] = (char *) NULL; - return; - } - - break; - } - } else if (i > 0) { /* if we're not the 1st arg */ - /* - * here it's not a flag, so it *must* be either - * the input or the output file, including stdin. - * - * set fflag, so we don't mishandle the -[cdu] flags. - */ - if (++fflag >= 2) { - /* - * we've copied the file argument - * already, so leave. - */ - mav[++mac] = (char *) NULL; - return; - } - } - - mac++; - i++; - } - - mav[mac] = (char *) NULL; -} - -static void -usage() -{ - (void) fprintf(stderr, "Usage:\t%s [input_file [output_file]]\n", - usage0); - (void) fprintf(stderr, "Or:\t%s [input_file [output_file]]\n", - usage1); -} diff --git a/usr/src/cmd/uniq/uniq.xcl b/usr/src/cmd/uniq/uniq.xcl deleted file mode 100644 index d6460a6212..0000000000 --- a/usr/src/cmd/uniq/uniq.xcl +++ /dev/null @@ -1,25 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -msgid "" -msgid "%4d " -msgid "r" -msgid "w" diff --git a/usr/src/cmd/wc/Makefile b/usr/src/cmd/wc/Makefile deleted file mode 100644 index 8ca1afc41c..0000000000 --- a/usr/src/cmd/wc/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1989,1996 by Sun Microsystems, Inc. -# All rights reserved. -# - -PROG= wc - -include ../Makefile.cmd - -CPPFLAGS += -D_FILE_OFFSET_BITS=64 - -.KEEP_STATE: - -all: $(PROG) - -install: all $(ROOTPROG) - -clean: - -lint: lint_PROG - -include ../Makefile.targ diff --git a/usr/src/cmd/wc/wc.c b/usr/src/cmd/wc/wc.c deleted file mode 100644 index 7eaa884619..0000000000 --- a/usr/src/cmd/wc/wc.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * 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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * wc -- word and line count - */ - -#include <stdio.h> -#include <limits.h> -#include <locale.h> -#include <wctype.h> -#include <stdlib.h> -#include <errno.h> -#include <string.h> -#include <euc.h> - -#undef BUFSIZ -#define BUFSIZ 4096 -unsigned char b[BUFSIZ]; - -FILE *fptr = stdin; -unsigned long long wordct; -unsigned long long twordct; -unsigned long long linect; -unsigned long long tlinect; -unsigned long long charct; -unsigned long long tcharct; -unsigned long long real_charct; -unsigned long long real_tcharct; - -int cflag = 0, mflag = 0, lflag = 0, wflag = 0; - -static void wcp(unsigned long long, unsigned long long, - unsigned long long, unsigned long long); -static void usage(void); - -int -main(int argc, char **argv) -{ - unsigned char *p1, *p2; - unsigned int c; - int flag; - int i, token; - int status = 0; - wchar_t wc; - int len, n, errflag; - - - (void) setlocale(LC_ALL, ""); -#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ -#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ -#endif - (void) textdomain(TEXT_DOMAIN); - - - while ((flag = getopt(argc, argv, "cCmlw")) != EOF) { - switch (flag) { - case 'c': - if (mflag) - usage(); - - cflag++; - break; - - case 'C': - case 'm': /* POSIX.2 */ - if (cflag) - usage(); - mflag++; - break; - - case 'l': - lflag++; - break; - - case 'w': - wflag++; - break; - - default: - usage(); - break; - } - } - - argc -= optind; - argv = &argv[optind]; - - /* - * If no flags set, use defaults - */ - if (cflag == 0 && mflag == 0 && lflag == 0 && wflag == 0) { - cflag = 1; - lflag = 1; - wflag = 1; - } - - i = 0; - do { - if (argc > 0 && (fptr = fopen(argv[i], "r")) == NULL) { - (void) fprintf(stderr, "wc: %s: %s\n", - argv[i], strerror(errno)); - status = 2; - continue; - } - - p1 = p2 = b; - linect = 0; - wordct = 0; - charct = 0; - real_charct = 0; - token = 0; - errflag = 0; - for (;;) { - if (p1 >= p2) { - p1 = b; - c = fread(p1, 1, BUFSIZ, fptr); - if (c == 0) { - if (feof(fptr)) - break; - /* - * skip the file and generate error - * message when failed to read the - * file. - */ - if (ferror(fptr)) { - (void) fprintf(stderr, gettext( - "wc: cannot read %s: %s\n"), - argv[i], strerror(errno)); - status = 2; - errflag = 1; - break; - } - } - charct += c; - p2 = p1+c; - } - c = *p1++; - real_charct++; - if (ISASCII(c)) { - if (isspace(c)) { - if (c == '\n') - linect++; - token = 0; - continue; - } - - if (!token) { - wordct++; - token++; - } - } else { - p1--; - if ((len = (p2 - p1)) < - (unsigned int)MB_CUR_MAX) { - for (n = 0; n < len; n++) - b[n] = *p1++; - p1 = b; - p2 = p1 + n; - c = fread(p2, 1, BUFSIZ - n, fptr); - if ((int)c > 0) { - charct += c; - p2 += c; - } - } - - if ((len = (p2 - p1)) > - (unsigned int)MB_CUR_MAX) - len = (unsigned int)MB_CUR_MAX; - if ((len = mbtowc(&wc, (char *)p1, len)) > 0) { - p1 += len; - if (iswspace(wc)) { - token = 0; - continue; - } - } else - p1++; - if (!token) { - wordct++; - token++; - } - } - } - /* print lines, words, chars */ -printwc: - (void) fclose(fptr); - if (errflag) - continue; - - wcp(charct, wordct, linect, real_charct); - if (argc > 0) { - (void) printf(" %s\n", argv[i]); - } - else - (void) printf("\n"); - tlinect += linect; - twordct += wordct; - tcharct += charct; - real_tcharct += real_charct; - } while (++i < argc); - - if (argc > 1) { - wcp(tcharct, twordct, tlinect, real_tcharct); - (void) printf(" total\n"); - } - return (status); -} - -static void -wcp( - unsigned long long charct, - unsigned long long wordct, - unsigned long long linect, - unsigned long long real_charct) -{ - if (lflag) - (void) printf((linect < 10000000) ? " %7llu" : - " %llu", linect); - - if (wflag) - (void) printf((wordct < 10000000) ? " %7llu" : - " %llu", wordct); - - if (cflag) - (void) printf((charct < 10000000) ? " %7llu" : - " %llu", charct); - else if (mflag) - (void) printf((real_charct < 10000000) ? " %7llu" : - " %llu", real_charct); -} - -static void -usage() -{ - (void) fprintf(stderr, gettext( - "usage: wc [-c | -m | -C] [-lw] [file ...]\n")); - exit(2); -} diff --git a/usr/src/lib/libast/Makefile.com b/usr/src/lib/libast/Makefile.com index 2e6d4c457b..f6d8b384f0 100644 --- a/usr/src/lib/libast/Makefile.com +++ b/usr/src/lib/libast/Makefile.com @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -235,6 +235,7 @@ OBJECTS += \ common/path/pathpath.o \ common/path/pathposix.o \ common/path/pathprobe.o \ + common/path/pathprog.o \ common/path/pathrepl.o \ common/path/pathsetlink.o \ common/path/pathshell.o \ @@ -354,6 +355,7 @@ OBJECTS += \ common/sfio/sfungetc.o \ common/sfio/sfvprintf.o \ common/sfio/sfvscanf.o \ + common/sfio/sfwalk.o \ common/sfio/sfwr.o \ common/sfio/sfwrite.o \ common/stdio/_doprnt.o \ @@ -372,6 +374,7 @@ OBJECTS += \ common/stdio/asprintf.o \ common/stdio/clearerr.o \ common/stdio/fclose.o \ + common/stdio/fcloseall.o \ common/stdio/fdopen.o \ common/stdio/feof.o \ common/stdio/ferror.o \ @@ -383,6 +386,7 @@ OBJECTS += \ common/stdio/fgetws.o \ common/stdio/fileno.o \ common/stdio/flockfile.o \ + common/stdio/fmemopen.o \ common/stdio/fopen.o \ common/stdio/fprintf.o \ common/stdio/fpurge.o \ @@ -406,6 +410,8 @@ OBJECTS += \ common/stdio/fwscanf.o \ common/stdio/getc.o \ common/stdio/getchar.o \ + common/stdio/getdelim.o \ + common/stdio/getline.o \ common/stdio/getw.o \ common/stdio/getwc.o \ common/stdio/getwchar.o \ @@ -428,7 +434,6 @@ OBJECTS += \ common/stdio/sprintf.o \ common/stdio/sscanf.o \ common/stdio/stdio_c99.o \ - common/stdio/stdio_gnu.o \ common/stdio/swprintf.o \ common/stdio/swscanf.o \ common/stdio/tmpfile.o \ @@ -502,6 +507,7 @@ OBJECTS += \ common/string/strmode.o \ common/string/strnacmp.o \ common/string/strncopy.o \ + common/string/strnpcmp.o \ common/string/strntod.o \ common/string/strntol.o \ common/string/strntold.o \ @@ -510,7 +516,9 @@ OBJECTS += \ common/string/strntoul.o \ common/string/strntonll.o \ common/string/strntoull.o \ + common/string/strnvcmp.o \ common/string/stropt.o \ + common/string/strpcmp.o \ common/string/strperm.o \ common/string/strpsearch.o \ common/string/strsearch.o \ @@ -522,6 +530,7 @@ OBJECTS += \ common/string/strtonll.o \ common/string/struid.o \ common/string/struniq.o \ + common/string/strvcmp.o \ common/string/swapget.o \ common/string/swapmem.o \ common/string/swapop.o \ @@ -549,6 +558,7 @@ OBJECTS += \ common/tm/tmweek.o \ common/tm/tmword.o \ common/tm/tmxdate.o \ + common/tm/tmxduration.o \ common/tm/tmxfmt.o \ common/tm/tmxgettime.o \ common/tm/tmxleap.o \ @@ -701,10 +711,11 @@ CPPFLAGS = \ -I$(SRCDIR)/misc \ -I$(SRCDIR)/string \ -Iinclude/ast \ + -I$(ROOT)/usr/include \ '-DCONF_LIBSUFFIX=".so"' \ '-DCONF_LIBPREFIX="lib"' \ -DERROR_CATALOG=\""libast"\" \ - -D__OBSOLETE__=20080101 \ + -D__OBSOLETE__=20090101 \ -D_BLD_ast \ -D_PACKAGE_ast \ -D_BLD_DLL @@ -727,9 +738,12 @@ pics/common/misc/recstr.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED pics/common/misc/translate.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED pics/common/path/pathkey.o := CERRWARN += -erroff=E_CONST_PROMOTED_UNSIGNED_LONG pics/common/port/astconf.o := CERRWARN += -erroff=E_CONST_OBJ_SHOULD_HAVE_INITIZR +pics/common/stdio/fflush.o := CERRWARN += -erroff=E_NO_IMPLICIT_DECL_ALLOWED +pics/common/stdio/getline.o := CERRWARN += -erroff=E_NO_IMPLICIT_DECL_ALLOWED pics/common/sfio/sfmove.o := CERRWARN += -erroff=E_NO_IMPLICIT_DECL_ALLOWED pics/common/sfio/sfrd.o := CERRWARN += -erroff=E_NO_IMPLICIT_DECL_ALLOWED pics/common/sfio/sfvscanf.o := CERRWARN += -erroff=E_END_OF_LOOP_CODE_NOT_REACHED +pics/common/tm/tmxduration.o := CERRWARN += -erroff=E_NO_IMPLICIT_DECL_ALLOWED .KEEP_STATE: diff --git a/usr/src/lib/libast/amd64/include/ast/align.h b/usr/src/lib/libast/amd64/include/ast/align.h index c44968a29e..861c524bc6 100644 --- a/usr/src/lib/libast/amd64/include/ast/align.h +++ b/usr/src/lib/libast/amd64/include/ast/align.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast.h b/usr/src/lib/libast/amd64/include/ast/ast.h index f5335ae8a2..f1dff0cf6a 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast.h +++ b/usr/src/lib/libast/amd64/include/ast/ast.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -185,7 +185,7 @@ typedef struct #define mbcoll() (ast.mb_xfrm!=0) #define mbwide() (mbmax()>1) -#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p++,ast.tmp_int)):(*(unsigned char*)(p++))) +#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p+=ast.mb_sync+1,ast.tmp_int)):(*(unsigned char*)(p++))) #define mbinit() (mbwide()?(*ast.mb_towc)((wchar_t*)0,(char*)0,mbmax()):0) #define mbsize(p) (mbwide()?(*ast.mb_len)((char*)(p),mbmax()):((p),1)) #define mbconv(s,w) (ast.mb_conv?(*ast.mb_conv)(s,w):((*(s)=(w)),1)) @@ -309,6 +309,7 @@ extern __MANGLE__ size_t pathnative __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathpath __PROTO__((char*, const char*, const char*, int)); extern __MANGLE__ size_t pathposix __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathprobe __PROTO__((char*, char*, const char*, const char*, const char*, int)); +extern __MANGLE__ size_t pathprog __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathrepl __PROTO__((char*, const char*, const char*)); extern __MANGLE__ int pathsetlink __PROTO__((const char*, const char*)); extern __MANGLE__ char* pathshell __PROTO__((void)); @@ -329,6 +330,7 @@ extern __MANGLE__ int strmatch __PROTO__((const char*, const char*)); extern __MANGLE__ int strmode __PROTO__((const char*)); extern __MANGLE__ int strnacmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ char* strncopy __PROTO__((char*, const char*, size_t)); +extern __MANGLE__ int strnpcmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ double strntod __PROTO__((const char*, size_t, char**)); extern __MANGLE__ _ast_fltmax_t strntold __PROTO__((const char*, size_t, char**)); extern __MANGLE__ long strntol __PROTO__((const char*, size_t, char**, int)); @@ -337,7 +339,9 @@ extern __MANGLE__ long strnton __PROTO__((const char*, size_t, char**, char*, i extern __MANGLE__ unsigned long strntoul __PROTO__((const char*, size_t, char**, int)); extern __MANGLE__ intmax_t strntonll __PROTO__((const char*, size_t, char**, char*, int)); extern __MANGLE__ uintmax_t strntoull __PROTO__((const char*, size_t, char**, int)); +extern __MANGLE__ int strnvcmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ int stropt __PROTO__((const char*, const __V_*, int, int(*)(__V_*, const __V_*, int, const char*), __V_*)); +extern __MANGLE__ int strpcmp __PROTO__((const char*, const char*)); extern __MANGLE__ int strperm __PROTO__((const char*, char**, int)); extern __MANGLE__ __V_* strpsearch __PROTO__((const __V_*, size_t, size_t, const char*, char**)); extern __MANGLE__ __V_* strsearch __PROTO__((const __V_*, size_t, size_t, Strcmp_f, const char*, __V_*)); @@ -350,6 +354,7 @@ extern __MANGLE__ long strton __PROTO__((const char*, char**, char*, int)); extern __MANGLE__ intmax_t strtonll __PROTO__((const char*, char**, char*, int)); extern __MANGLE__ int struid __PROTO__((const char*)); extern __MANGLE__ int struniq __PROTO__((char**, int)); +extern __MANGLE__ int strvcmp __PROTO__((const char*, const char*)); #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_botch.h b/usr/src/lib/libast/amd64/include/ast/ast_botch.h index 3376769248..74b2a69444 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_botch.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_botch.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_ccode.h b/usr/src/lib/libast/amd64/include/ast/ast_ccode.h index d9d4a0e0ef..c4efd15d09 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_ccode.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_ccode.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_common.h b/usr/src/lib/libast/amd64/include/ast/ast_common.h index aaeba13c81..7c6fae758e 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_common.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_common.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -177,9 +177,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (&(p)) /* pass va_list to varargs function */ -#define va_listval(p) (*(p)) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list* /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -187,6 +184,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (&(p)) /* pass va_list to varargs function */ +#define va_listval(p) (*(p)) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list* /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/amd64/include/ast/ast_dir.h b/usr/src/lib/libast/amd64/include/ast/ast_dir.h index a402906410..8d801aa72c 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_dir.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_dir.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/ast_dirent.h b/usr/src/lib/libast/amd64/include/ast/ast_dirent.h index b126d86393..f59c1166c8 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_dirent.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_dirent.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/include/ast/ast_fcntl.h b/usr/src/lib/libast/amd64/include/ast/ast_fcntl.h index 6cdbd58151..8dc210d0d8 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_fcntl.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_fcntl.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/amd64/include/ast/ast_float.h b/usr/src/lib/libast/amd64/include/ast/ast_float.h index 80a62a3376..c2cec55b38 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_float.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_float.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/include/ast/ast_fs.h b/usr/src/lib/libast/amd64/include/ast/ast_fs.h index a699e1dc11..a3560a8bd5 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_fs.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_fs.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -96,7 +96,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_iconv.h b/usr/src/lib/libast/amd64/include/ast/ast_iconv.h index 87d224ef6a..166e6c1a31 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_iconv.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_iconv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/include/ast/ast_lib.h b/usr/src/lib/libast/amd64/include/ast/ast_lib.h index 5c57f0076e..20a0b52e90 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_lib.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_lib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -141,7 +141,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_limits.h b/usr/src/lib/libast/amd64/include/ast/ast_limits.h index 35291561a1..9044a8ef53 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_limits.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_limits.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_map.h b/usr/src/lib/libast/amd64/include/ast/ast_map.h index 967205e8c5..e11a11d8ee 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_map.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_map.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -219,6 +219,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/amd64/include/ast/ast_mmap.h b/usr/src/lib/libast/amd64/include/ast/ast_mmap.h index 1ca3ca5df0..effaf235c7 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_mmap.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_mmap.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -28,6 +28,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/amd64/include/ast/ast_mode.h b/usr/src/lib/libast/amd64/include/ast/ast_mode.h index 1ed73f669a..83f82dfe55 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_mode.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_mode.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_namval.h b/usr/src/lib/libast/amd64/include/ast/ast_namval.h index 4c9b12f480..f54b08ff15 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_namval.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_namval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/ast_ndbm.h b/usr/src/lib/libast/amd64/include/ast/ast_ndbm.h index 506313a5eb..c654de1510 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_ndbm.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_ndbm.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_nl_types.h b/usr/src/lib/libast/amd64/include/ast/ast_nl_types.h index 768df6db8c..410351d006 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_nl_types.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_nl_types.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/include/ast/ast_param.h b/usr/src/lib/libast/amd64/include/ast/ast_param.h index 4a1a41fbc2..0cdbd19167 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_param.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_param.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_standards.h b/usr/src/lib/libast/amd64/include/ast/ast_standards.h index b094fe2cfc..81160cc84a 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_standards.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_standards.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,29 +19,11 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/amd64/include/ast/ast_std.h b/usr/src/lib/libast/amd64/include/ast/ast_std.h index 4f3f3dd9da..e734c74dbd 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_std.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_std.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -117,22 +117,27 @@ struct lconv #define __MANGLE__ __LINKAGE__ __EXPORT__ #endif +#if !_UWIN /* for ast54 compatibility */ + #undef getenv #define getenv _ast_getenv +#undef setenviron +#define setenviron _ast_setenviron + +extern __MANGLE__ char* getenv __PROTO__((const char*)); + +#endif + #undef localeconv #define localeconv _ast_localeconv #undef setlocale #define setlocale _ast_setlocale -#undef setenviron -#define setenviron _ast_setenviron - #undef strerror #define strerror _ast_strerror -extern __MANGLE__ char* getenv __PROTO__((const char*)); extern __MANGLE__ struct lconv* localeconv __PROTO__((void)); extern __MANGLE__ char* setenviron __PROTO__((const char*)); extern __MANGLE__ char* setlocale __PROTO__((int, const char*)); @@ -159,6 +164,7 @@ extern __MANGLE__ char* strerror __PROTO__((int)); #define AST_LC_MEASUREMENT 12 #define AST_LC_PAPER 13 #define AST_LC_COUNT 14 +#define AST_LC_LANG 255 #define AST_LC_find (1L<<28) #define AST_LC_debug (1L<<29) @@ -207,6 +213,9 @@ extern __MANGLE__ char* strerror __PROTO__((int)); #ifndef LC_PAPER #define LC_PAPER (-AST_LC_PAPER) #endif +#ifndef LC_LANG +#define LC_LANG (-AST_LC_LANG) +#endif #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ @@ -248,8 +257,9 @@ typedef struct int (*mb_conv) __PROTO__((char*, wchar_t)); uint32_t env_serial; + uint32_t mb_sync; - char pad[944]; + char pad[940]; } _Ast_info_t; diff --git a/usr/src/lib/libast/amd64/include/ast/ast_stdio.h b/usr/src/lib/libast/amd64/include/ast/ast_stdio.h index c59c503048..2971022d8c 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_stdio.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_stdio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/include/ast/ast_sys.h b/usr/src/lib/libast/amd64/include/ast/ast_sys.h index aa5d8560e9..8feac1da4e 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_sys.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_sys.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -125,7 +125,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_time.h b/usr/src/lib/libast/amd64/include/ast/ast_time.h index a387c8d5bb..23787cc996 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_time.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_time.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/include/ast/ast_tty.h b/usr/src/lib/libast/amd64/include/ast/ast_tty.h index 95d479539e..6379a35c08 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_tty.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_tty.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_version.h b/usr/src/lib/libast/amd64/include/ast/ast_version.h index 5882fbd2a5..af5756d02b 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_version.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_version.h @@ -7,4 +7,4 @@ #if !defined(__LINKAGE__) #define __LINKAGE__ /* 2004-08-11 transition */ #endif -#define _AST_VERSION 20080910L +#define _AST_VERSION 20090202L diff --git a/usr/src/lib/libast/amd64/include/ast/ast_vfork.h b/usr/src/lib/libast/amd64/include/ast/ast_vfork.h index 702def24ac..c36ec0285b 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_vfork.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_vfork.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/include/ast/ast_wait.h b/usr/src/lib/libast/amd64/include/ast/ast_wait.h index ec119d710c..64eb5bd71d 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_wait.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_wait.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/ast_wchar.h b/usr/src/lib/libast/amd64/include/ast/ast_wchar.h index 5f1122019e..92db98875e 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_wchar.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_wchar.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/include/ast/ast_windows.h b/usr/src/lib/libast/amd64/include/ast/ast_windows.h index b329b2d2f5..e02d2aaeb9 100644 --- a/usr/src/lib/libast/amd64/include/ast/ast_windows.h +++ b/usr/src/lib/libast/amd64/include/ast/ast_windows.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/bytesex.h b/usr/src/lib/libast/amd64/include/ast/bytesex.h index 95c43e160d..e105fc5f58 100644 --- a/usr/src/lib/libast/amd64/include/ast/bytesex.h +++ b/usr/src/lib/libast/amd64/include/ast/bytesex.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/ccode.h b/usr/src/lib/libast/amd64/include/ast/ccode.h index 70c8d76471..a7a43aecbe 100644 --- a/usr/src/lib/libast/amd64/include/ast/ccode.h +++ b/usr/src/lib/libast/amd64/include/ast/ccode.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/cdt.h b/usr/src/lib/libast/amd64/include/ast/cdt.h index 3dc5b7b7f8..f2f0389296 100644 --- a/usr/src/lib/libast/amd64/include/ast/cdt.h +++ b/usr/src/lib/libast/amd64/include/ast/cdt.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/debug.h b/usr/src/lib/libast/amd64/include/ast/debug.h index 565212e93b..8f0ec6a257 100644 --- a/usr/src/lib/libast/amd64/include/ast/debug.h +++ b/usr/src/lib/libast/amd64/include/ast/debug.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -55,14 +55,17 @@ #define DEBUG_ASSERT(p) ((p) ? 0 : (debug_fatal(__FILE__, __LINE__),0)) #define DEBUG_COUNT(n) ((n) += 1) #define DEBUG_TALLY(c,n,v) ((c) ? ((n) += (v)) : (n)) +#define DEBUG_INCREASE(n) ((n) += 1) +#define DEBUG_DECREASE(n) ((n) -= 1) #define DEBUG_DECLARE(t,v) t v #define DEBUG_SET(n,v) ((n) = (v)) #define DEBUG_PRINT(fd,s,v) do {char _b[1024];write(fd,_b,sfsprintf(_b,sizeof(_b),s,v));} while(0) #define DEBUG_WRITE(fd,d,n) write((fd),(d),(n)) #define DEBUG_TEMP(temp) (temp) /* debugging stuff that should be removed */ -#define DEBUG_RETURN(x) (debug_fatal(__FILE__, __LINE__), (x)) -#define DEBUG_BREAK (debug_fatal(__FILE__, __LINE__)) +#define DEBUG_BREAK break +#define DEBUG_CONTINUE continue #define DEBUG_GOTO(label) do { debug_fatal(__FILE__, __LINE__); goto label; } while(0) +#define DEBUG_RETURN(x) do { debug_fatal(__FILE__, __LINE__); return(x); } while(0) #else @@ -75,15 +78,31 @@ #define DEBUG_ASSERT(p) #define DEBUG_COUNT(n) #define DEBUG_TALLY(c,n,v) +#define DEBUG_INCREASE(n) +#define DEBUG_DECREASE(n) #define DEBUG_DECLARE(t,v) #define DEBUG_SET(n,v) #define DEBUG_PRINT(fd,s,v) #define DEBUG_WRITE(fd,d,n) -#define DEBUG_KPV(x) -#define DEBUG_RETURN(x) return(x) +#define DEBUG_TEMP(x) #define DEBUG_BREAK break +#define DEBUG_CONTINUE continue #define DEBUG_GOTO(label) goto label +#define DEBUG_RETURN(x) return(x) + +#endif +#ifndef BREAK +#define BREAK DEBUG_BREAK +#endif +#ifndef CONTINUE +#define CONTINUE DEBUG_CONTINUE +#endif +#ifndef GOTO +#define GOTO(label) DEBUG_GOTO(label) +#endif +#ifndef RETURN +#define RETURN(x) DEBUG_RETURN(x) #endif #if _BLD_ast && defined(__EXPORT__) diff --git a/usr/src/lib/libast/amd64/include/ast/dirent.h b/usr/src/lib/libast/amd64/include/ast/dirent.h index b94f22215f..ea81d037a5 100644 --- a/usr/src/lib/libast/amd64/include/ast/dirent.h +++ b/usr/src/lib/libast/amd64/include/ast/dirent.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/dt.h b/usr/src/lib/libast/amd64/include/ast/dt.h index 12299246bb..6fcc20c42e 100644 --- a/usr/src/lib/libast/amd64/include/ast/dt.h +++ b/usr/src/lib/libast/amd64/include/ast/dt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/endian.h b/usr/src/lib/libast/amd64/include/ast/endian.h index 12539254b6..6ad7ddcaad 100644 --- a/usr/src/lib/libast/amd64/include/ast/endian.h +++ b/usr/src/lib/libast/amd64/include/ast/endian.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/error.h b/usr/src/lib/libast/amd64/include/ast/error.h index 1cb01835f7..10d919a93a 100644 --- a/usr/src/lib/libast/amd64/include/ast/error.h +++ b/usr/src/lib/libast/amd64/include/ast/error.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/find.h b/usr/src/lib/libast/amd64/include/ast/find.h index c094791a30..9ed4227d03 100644 --- a/usr/src/lib/libast/amd64/include/ast/find.h +++ b/usr/src/lib/libast/amd64/include/ast/find.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/fnmatch.h b/usr/src/lib/libast/amd64/include/ast/fnmatch.h index 56c7dd7dce..ba357d9585 100644 --- a/usr/src/lib/libast/amd64/include/ast/fnmatch.h +++ b/usr/src/lib/libast/amd64/include/ast/fnmatch.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/fnv.h b/usr/src/lib/libast/amd64/include/ast/fnv.h index badccc3071..f4caaee97f 100644 --- a/usr/src/lib/libast/amd64/include/ast/fnv.h +++ b/usr/src/lib/libast/amd64/include/ast/fnv.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/fs3d.h b/usr/src/lib/libast/amd64/include/ast/fs3d.h index a52478f85c..50795c98b0 100644 --- a/usr/src/lib/libast/amd64/include/ast/fs3d.h +++ b/usr/src/lib/libast/amd64/include/ast/fs3d.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -104,7 +104,9 @@ #define FS3D_SIZE(n) ((n)<<4) #define FS3D_SIZEOF(n) ((n)>>4) -extern __MANGLE__ int mount __PROTO__((const char*, char*, int, __V_*)); +#if !_BLD_3d +#define mount(s,t,f,d) fs3d_mount(s,t,f,d) +#endif #if _BLD_ast && defined(__EXPORT__) #undef __MANGLE__ @@ -112,6 +114,7 @@ extern __MANGLE__ int mount __PROTO__((const char*, char*, int, __V_*)); #endif extern __MANGLE__ int fs3d __PROTO__((int)); +extern __MANGLE__ int fs3d_mount __PROTO__((const char*, char*, int, __V_*)); extern __MANGLE__ char* pathnext __PROTO__((char*, char*, long*)); #undef __MANGLE__ diff --git a/usr/src/lib/libast/amd64/include/ast/fts.h b/usr/src/lib/libast/amd64/include/ast/fts.h index a8ce187391..09420af481 100644 --- a/usr/src/lib/libast/amd64/include/ast/fts.h +++ b/usr/src/lib/libast/amd64/include/ast/fts.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -121,16 +121,21 @@ struct Ftsent long fts_number; /* local numeric value */ int fts_errno; /* errno for this entry */ unsigned short fts_info; /* info flags */ - unsigned short fts_namelen; /* strlen(fts_name) */ - unsigned short fts_pathlen; /* strlen(fts_path) */ - short fts_level; /* file tree depth, 0 at top */ + + unsigned short _fts_namelen; /* old fts_namelen */ + unsigned short _fts_pathlen; /* old fts_pathlen */ + short _fts_level; /* old fts_level */ + + short _fts_status; /* <ftwalk.h> compatibility */ + struct stat _fts_statb; /* <ftwalk.h> compatibility */ + + FTS* fts; /* fts_open() handle */ + size_t fts_namelen; /* strlen(fts_name) */ + size_t fts_pathlen; /* strlen(fts_path) */ + ssize_t fts_level; /* file tree depth, 0 at top */ #ifdef _FTSENT_PRIVATE_ _FTSENT_PRIVATE_ -#else - short _fts_pad_1; /* <ftwalk.h> compatibility */ - struct stat _fts_pad_2; /* <ftwalk.h> compatibility */ - FTS* fts; /* fts_open() handle */ #endif }; diff --git a/usr/src/lib/libast/amd64/include/ast/ftw.h b/usr/src/lib/libast/amd64/include/ast/ftw.h index 3d43cb2609..49040cf863 100644 --- a/usr/src/lib/libast/amd64/include/ast/ftw.h +++ b/usr/src/lib/libast/amd64/include/ast/ftw.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/ftwalk.h b/usr/src/lib/libast/amd64/include/ast/ftwalk.h index 7172b76565..29e1693959 100644 --- a/usr/src/lib/libast/amd64/include/ast/ftwalk.h +++ b/usr/src/lib/libast/amd64/include/ast/ftwalk.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -52,6 +52,8 @@ #define fts_parent parent #define fts_path path #define fts_pathlen pathlen +#define _fts_status status +#define _fts_statb statb #define FTSENT Ftw_t /* <fts.h> internal */ #define Ftsent FTW /* <fts.h> internal */ @@ -63,10 +65,6 @@ __V_* pointer; /* local pointer value */ \ } local; -#define _FTSENT_PRIVATE_ /* fts internal */ \ - short status; /* internal status */ \ - struct stat statb; /* fts_statp data */ - #include <fts.h> /* diff --git a/usr/src/lib/libast/amd64/include/ast/glob.h b/usr/src/lib/libast/amd64/include/ast/glob.h index 62c420bb4f..93e202a5f9 100644 --- a/usr/src/lib/libast/amd64/include/ast/glob.h +++ b/usr/src/lib/libast/amd64/include/ast/glob.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/hash.h b/usr/src/lib/libast/amd64/include/ast/hash.h index 3ad42981e3..a524737ccc 100644 --- a/usr/src/lib/libast/amd64/include/ast/hash.h +++ b/usr/src/lib/libast/amd64/include/ast/hash.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/hashkey.h b/usr/src/lib/libast/amd64/include/ast/hashkey.h index ac0557f6df..525434e369 100644 --- a/usr/src/lib/libast/amd64/include/ast/hashkey.h +++ b/usr/src/lib/libast/amd64/include/ast/hashkey.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/hashpart.h b/usr/src/lib/libast/amd64/include/ast/hashpart.h index 90f2be5c31..cfe3666777 100644 --- a/usr/src/lib/libast/amd64/include/ast/hashpart.h +++ b/usr/src/lib/libast/amd64/include/ast/hashpart.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/iconv.h b/usr/src/lib/libast/amd64/include/ast/iconv.h index 58bc8240d2..5b02759721 100644 --- a/usr/src/lib/libast/amd64/include/ast/iconv.h +++ b/usr/src/lib/libast/amd64/include/ast/iconv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/lc.h b/usr/src/lib/libast/amd64/include/ast/lc.h index b225864bbc..da06a59ba4 100644 --- a/usr/src/lib/libast/amd64/include/ast/lc.h +++ b/usr/src/lib/libast/amd64/include/ast/lc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -38,14 +38,15 @@ #define LC_abbreviated 0x00001 #define LC_checked 0x00002 -#define LC_default 0x00004 -#define LC_defined 0x00008 -#define LC_debug 0x00010 +#define LC_debug 0x00004 +#define LC_default 0x00008 +#define LC_defined 0x00010 #define LC_local 0x00020 #define LC_primary 0x00040 #define LC_qualified 0x00080 #define LC_undefined 0x00100 -#define LC_verbose 0x00200 +#define LC_utf8 0x00200 +#define LC_verbose 0x00400 #define LC_user 0x10000 #define LC_language_attribute_max 2 #define LC_territory_language_max 4 diff --git a/usr/src/lib/libast/amd64/include/ast/ls.h b/usr/src/lib/libast/amd64/include/ast/ls.h index b195c70e0c..70a8dc88ba 100644 --- a/usr/src/lib/libast/amd64/include/ast/ls.h +++ b/usr/src/lib/libast/amd64/include/ast/ls.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -76,8 +76,8 @@ #define LS_USER (1<<10) /* first user flag bit */ #define LS_W_BLOCKS 6 /* LS_BLOCKS field width */ -#define LS_W_INUMBER 7 /* LS_INUMBER field width */ -#define LS_W_LONG 55 /* LS_LONG width (w/o names) */ +#define LS_W_INUMBER 9 /* LS_INUMBER field width */ +#define LS_W_LONG 57 /* LS_LONG width (w/o names) */ #define LS_W_LINK 4 /* link text width (w/o names) */ #define LS_W_MARK 1 /* LS_MARK field width */ #define LS_W_NAME 9 /* group|user name field width */ diff --git a/usr/src/lib/libast/amd64/include/ast/magic.h b/usr/src/lib/libast/amd64/include/ast/magic.h index cf3c0fdcb8..53d632c721 100644 --- a/usr/src/lib/libast/amd64/include/ast/magic.h +++ b/usr/src/lib/libast/amd64/include/ast/magic.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/magicid.h b/usr/src/lib/libast/amd64/include/ast/magicid.h index 66507d4d0b..e31c80f288 100644 --- a/usr/src/lib/libast/amd64/include/ast/magicid.h +++ b/usr/src/lib/libast/amd64/include/ast/magicid.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/mc.h b/usr/src/lib/libast/amd64/include/ast/mc.h index be15276038..75b4308360 100644 --- a/usr/src/lib/libast/amd64/include/ast/mc.h +++ b/usr/src/lib/libast/amd64/include/ast/mc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/mime.h b/usr/src/lib/libast/amd64/include/ast/mime.h index c214a31130..6d662d29e5 100644 --- a/usr/src/lib/libast/amd64/include/ast/mime.h +++ b/usr/src/lib/libast/amd64/include/ast/mime.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/mnt.h b/usr/src/lib/libast/amd64/include/ast/mnt.h index ddce19fc9d..62815d19e7 100644 --- a/usr/src/lib/libast/amd64/include/ast/mnt.h +++ b/usr/src/lib/libast/amd64/include/ast/mnt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/modecanon.h b/usr/src/lib/libast/amd64/include/ast/modecanon.h index f207540d5b..3357d3ec75 100644 --- a/usr/src/lib/libast/amd64/include/ast/modecanon.h +++ b/usr/src/lib/libast/amd64/include/ast/modecanon.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/modex.h b/usr/src/lib/libast/amd64/include/ast/modex.h index 96971e347b..1f00578a00 100644 --- a/usr/src/lib/libast/amd64/include/ast/modex.h +++ b/usr/src/lib/libast/amd64/include/ast/modex.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/namval.h b/usr/src/lib/libast/amd64/include/ast/namval.h index 4c9b12f480..f54b08ff15 100644 --- a/usr/src/lib/libast/amd64/include/ast/namval.h +++ b/usr/src/lib/libast/amd64/include/ast/namval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/nl_types.h b/usr/src/lib/libast/amd64/include/ast/nl_types.h index 36c901d8ed..e71605ff40 100644 --- a/usr/src/lib/libast/amd64/include/ast/nl_types.h +++ b/usr/src/lib/libast/amd64/include/ast/nl_types.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/option.h b/usr/src/lib/libast/amd64/include/ast/option.h index 0cb1ca74c5..39207fcc4c 100644 --- a/usr/src/lib/libast/amd64/include/ast/option.h +++ b/usr/src/lib/libast/amd64/include/ast/option.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/preroot.h b/usr/src/lib/libast/amd64/include/ast/preroot.h index 601862a6b5..d7517e51f0 100644 --- a/usr/src/lib/libast/amd64/include/ast/preroot.h +++ b/usr/src/lib/libast/amd64/include/ast/preroot.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/include/ast/proc.h b/usr/src/lib/libast/amd64/include/ast/proc.h index 2bfa576970..219f0d5884 100644 --- a/usr/src/lib/libast/amd64/include/ast/proc.h +++ b/usr/src/lib/libast/amd64/include/ast/proc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/re_comp.h b/usr/src/lib/libast/amd64/include/ast/re_comp.h index 381bc801fc..e8d425d1c0 100644 --- a/usr/src/lib/libast/amd64/include/ast/re_comp.h +++ b/usr/src/lib/libast/amd64/include/ast/re_comp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/recfmt.h b/usr/src/lib/libast/amd64/include/ast/recfmt.h index 133e37da41..acdb18df36 100644 --- a/usr/src/lib/libast/amd64/include/ast/recfmt.h +++ b/usr/src/lib/libast/amd64/include/ast/recfmt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/regex.h b/usr/src/lib/libast/amd64/include/ast/regex.h index b1a8976991..1fcd12d298 100644 --- a/usr/src/lib/libast/amd64/include/ast/regex.h +++ b/usr/src/lib/libast/amd64/include/ast/regex.h @@ -53,6 +53,8 @@ #define REG_SHELL_ESCAPED 0x00400000 /* \ not special */ #define REG_SHELL_PATH 0x00800000 /* explicit / match */ +#define REG_REGEXP 0x40000000 /* <regexp.h> compatibility */ + /* regexec flags */ #define REG_NOTBOL 0x00000040 /* ^ is not a special char */ diff --git a/usr/src/lib/libast/amd64/include/ast/regexp.h b/usr/src/lib/libast/amd64/include/ast/regexp.h index e1c6258b3e..89e0d3a875 100644 --- a/usr/src/lib/libast/amd64/include/ast/regexp.h +++ b/usr/src/lib/libast/amd64/include/ast/regexp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/sfdisc.h b/usr/src/lib/libast/amd64/include/ast/sfdisc.h index 5303d9a62e..ce1ed6e052 100644 --- a/usr/src/lib/libast/amd64/include/ast/sfdisc.h +++ b/usr/src/lib/libast/amd64/include/ast/sfdisc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/sfio.h b/usr/src/lib/libast/amd64/include/ast/sfio.h index 11317dad65..3506f5c955 100644 --- a/usr/src/lib/libast/amd64/include/ast/sfio.h +++ b/usr/src/lib/libast/amd64/include/ast/sfio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -48,6 +48,7 @@ typedef ssize_t (*Sfread_f)_ARG_((Sfio_t*, Void_t*, size_t, Sfdisc_t*)); typedef ssize_t (*Sfwrite_f)_ARG_((Sfio_t*, const Void_t*, size_t, Sfdisc_t*)); typedef Sfoff_t (*Sfseek_f)_ARG_((Sfio_t*, Sfoff_t, int, Sfdisc_t*)); typedef int (*Sfexcept_f)_ARG_((Sfio_t*, int, Void_t*, Sfdisc_t*)); +typedef int (*Sfwalk_f)_ARG_((Sfio_t*, Void_t*)); /* discipline structure */ struct _sfdisc_s @@ -232,6 +233,7 @@ extern Sfio_t* sfpopen _ARG_((Sfio_t*, const char*, const char*)); extern Sfio_t* sfstack _ARG_((Sfio_t*, Sfio_t*)); extern Sfio_t* sfswap _ARG_((Sfio_t*, Sfio_t*)); extern Sfio_t* sftmp _ARG_((size_t)); +extern int sfwalk _ARG_((Sfwalk_f, Void_t*, int)); extern int sfpurge _ARG_((Sfio_t*)); extern int sfpoll _ARG_((Sfio_t**, int, int)); extern Void_t* sfreserve _ARG_((Sfio_t*, ssize_t, int)); diff --git a/usr/src/lib/libast/amd64/include/ast/sfio_s.h b/usr/src/lib/libast/amd64/include/ast/sfio_s.h index 19a23d4772..46b2348b9c 100644 --- a/usr/src/lib/libast/amd64/include/ast/sfio_s.h +++ b/usr/src/lib/libast/amd64/include/ast/sfio_s.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/sfio_t.h b/usr/src/lib/libast/amd64/include/ast/sfio_t.h index c5251d3f34..5c819865c8 100644 --- a/usr/src/lib/libast/amd64/include/ast/sfio_t.h +++ b/usr/src/lib/libast/amd64/include/ast/sfio_t.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/shcmd.h b/usr/src/lib/libast/amd64/include/ast/shcmd.h index 14e282a3d0..f59834ad80 100644 --- a/usr/src/lib/libast/amd64/include/ast/shcmd.h +++ b/usr/src/lib/libast/amd64/include/ast/shcmd.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -75,18 +75,19 @@ typedef struct Shbltin_s # 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) +# define sh_context(c) ((Shbltin_t*)(c)) +# define sh_run(c, ac, av) ((c)?(*sh_context(c)->shrun)(ac,av):-1) +# define sh_system(c,str) ((c)?(*sh_context(c)->shtrap)(str,0):system(str)) +# define sh_exit(c,n) ((c)?(*sh_context(c)->shexit)(n):exit(n)) +# define sh_checksig(c) ((c) && sh_context(c)->sigset) # if defined(SFIO_VERSION) || defined(_AST_H) # define LIB_INIT(c) # else -# define LIB_INIT(c) ((c) && (((Shbltin_t*)(c))->nosfio = 1)) +# define LIB_INIT(c) ((c) && (sh_context(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) + (sh_context(c)->notify = ((flg)&ERROR_NOTIFY)?1:0);} while(0) # endif #endif diff --git a/usr/src/lib/libast/amd64/include/ast/sig.h b/usr/src/lib/libast/amd64/include/ast/sig.h index 7662fe0cde..ec9e3d888b 100644 --- a/usr/src/lib/libast/amd64/include/ast/sig.h +++ b/usr/src/lib/libast/amd64/include/ast/sig.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/amd64/include/ast/stack.h b/usr/src/lib/libast/amd64/include/ast/stack.h index 5c55255f06..64bda47ad0 100644 --- a/usr/src/lib/libast/amd64/include/ast/stack.h +++ b/usr/src/lib/libast/amd64/include/ast/stack.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/stak.h b/usr/src/lib/libast/amd64/include/ast/stak.h index 321be20328..3e867b0b7d 100644 --- a/usr/src/lib/libast/amd64/include/ast/stak.h +++ b/usr/src/lib/libast/amd64/include/ast/stak.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/stdio.h b/usr/src/lib/libast/amd64/include/ast/stdio.h index 42d7ed8269..2053ba8b27 100644 --- a/usr/src/lib/libast/amd64/include/ast/stdio.h +++ b/usr/src/lib/libast/amd64/include/ast/stdio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/stk.h b/usr/src/lib/libast/amd64/include/ast/stk.h index ef9a946ce0..ae2684f36d 100644 --- a/usr/src/lib/libast/amd64/include/ast/stk.h +++ b/usr/src/lib/libast/amd64/include/ast/stk.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/swap.h b/usr/src/lib/libast/amd64/include/ast/swap.h index 81e49db105..96c2f79d74 100644 --- a/usr/src/lib/libast/amd64/include/ast/swap.h +++ b/usr/src/lib/libast/amd64/include/ast/swap.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/tar.h b/usr/src/lib/libast/amd64/include/ast/tar.h index 3a9a99b0ac..04f5586481 100644 --- a/usr/src/lib/libast/amd64/include/ast/tar.h +++ b/usr/src/lib/libast/amd64/include/ast/tar.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/times.h b/usr/src/lib/libast/amd64/include/ast/times.h index 1ed0f2135a..db0725a35c 100644 --- a/usr/src/lib/libast/amd64/include/ast/times.h +++ b/usr/src/lib/libast/amd64/include/ast/times.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/tm.h b/usr/src/lib/libast/amd64/include/ast/tm.h index 29c0d4f1fa..154615088f 100644 --- a/usr/src/lib/libast/amd64/include/ast/tm.h +++ b/usr/src/lib/libast/amd64/include/ast/tm.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -102,8 +102,9 @@ #define TM_ERA_YEAR 115 #define TM_ORDINALS 116 #define TM_FINAL 126 +#define TM_WORK 129 -#define TM_NFORM 129 +#define TM_NFORM 132 typedef struct /* leap second info */ { @@ -123,7 +124,7 @@ typedef struct /* time zone info */ typedef struct /* tm library readonly data */ { char** format; /* default TM_* format strings */ - char* lex; /* format lex type classes */ + unsigned char* lex; /* format lex type classes */ char* digit; /* output digits */ short* days; /* days in month i */ short* sum; /* days in months before i */ diff --git a/usr/src/lib/libast/amd64/include/ast/tmx.h b/usr/src/lib/libast/amd64/include/ast/tmx.h index df4e1f9972..3405302465 100644 --- a/usr/src/lib/libast/amd64/include/ast/tmx.h +++ b/usr/src/lib/libast/amd64/include/ast/tmx.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -129,12 +129,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/amd64/include/ast/tok.h b/usr/src/lib/libast/amd64/include/ast/tok.h index 1d5112837c..8850458e9a 100644 --- a/usr/src/lib/libast/amd64/include/ast/tok.h +++ b/usr/src/lib/libast/amd64/include/ast/tok.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/tv.h b/usr/src/lib/libast/amd64/include/ast/tv.h index 9cb7a59e81..a404b0e098 100644 --- a/usr/src/lib/libast/amd64/include/ast/tv.h +++ b/usr/src/lib/libast/amd64/include/ast/tv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/include/ast/usage.h b/usr/src/lib/libast/amd64/include/ast/usage.h index d969a0e4c1..e2bea60f9c 100644 --- a/usr/src/lib/libast/amd64/include/ast/usage.h +++ b/usr/src/lib/libast/amd64/include/ast/usage.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/vdb.h b/usr/src/lib/libast/amd64/include/ast/vdb.h index ba47e14901..f800446d5f 100644 --- a/usr/src/lib/libast/amd64/include/ast/vdb.h +++ b/usr/src/lib/libast/amd64/include/ast/vdb.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/vecargs.h b/usr/src/lib/libast/amd64/include/ast/vecargs.h index 121e9d5010..8b567d5d5d 100644 --- a/usr/src/lib/libast/amd64/include/ast/vecargs.h +++ b/usr/src/lib/libast/amd64/include/ast/vecargs.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/vmalloc.h b/usr/src/lib/libast/amd64/include/ast/vmalloc.h index 8cf3e9b974..0115078cf5 100644 --- a/usr/src/lib/libast/amd64/include/ast/vmalloc.h +++ b/usr/src/lib/libast/amd64/include/ast/vmalloc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/wait.h b/usr/src/lib/libast/amd64/include/ast/wait.h index 08160043fa..bb690a2ee4 100644 --- a/usr/src/lib/libast/amd64/include/ast/wait.h +++ b/usr/src/lib/libast/amd64/include/ast/wait.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/wchar.h b/usr/src/lib/libast/amd64/include/ast/wchar.h index 7796480d09..5bd6aa3ba8 100644 --- a/usr/src/lib/libast/amd64/include/ast/wchar.h +++ b/usr/src/lib/libast/amd64/include/ast/wchar.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/include/ast/wordexp.h b/usr/src/lib/libast/amd64/include/ast/wordexp.h index c3f97b37d9..0ae7e93e99 100644 --- a/usr/src/lib/libast/amd64/include/ast/wordexp.h +++ b/usr/src/lib/libast/amd64/include/ast/wordexp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/align b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/align index c1d2830f65..5ea6665c79 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/align +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/align @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/botch b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/botch index a4073c6203..992ace7c30 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/botch +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/botch @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/ccode b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/ccode index 037e0feb43..7e14f8c11a 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/ccode +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/ccode @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/common b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/common index e7cf28dd9a..3c85374ef7 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/common +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/common @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -156,9 +156,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (&(p)) /* pass va_list to varargs function */ -#define va_listval(p) (*(p)) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list* /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -166,6 +163,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (&(p)) /* pass va_list to varargs function */ +#define va_listval(p) (*(p)) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list* /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/dirent b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/dirent index 2079091a68..35bd2afa77 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/dirent +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/dirent @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/eaccess b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/eaccess index ed64f46818..50889144e2 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/eaccess +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/eaccess @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/eaccess by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/eaccess by iffe version 2009-10-06 : : */ #ifndef _def_eaccess_ast #define _def_eaccess_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/errno b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/errno index 4d8ab0363d..f0e9bc686d 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/errno +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/errno @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/errno by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/errno by iffe version 2009-10-06 : : */ #ifndef _def_errno_ast #define _def_errno_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/fcntl b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/fcntl index 81a8f188ba..f408632bee 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/fcntl +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/fcntl @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/float b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/float index bdc61b73fa..48579d1014 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/float +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/float @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/fs b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/fs index 8560af4f28..a070d05fb5 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/fs +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/fs @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -75,7 +75,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/hack b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/hack index e45d5db86d..031e5df790 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/hack +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/hack @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/hack by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/hack by iffe version 2009-10-06 : : */ #ifndef _def_hack_ast #define _def_hack_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/iconv b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/iconv index ccd176f5f4..f37272845d 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/iconv +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/iconv @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/isoc99 b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/isoc99 index a709b928f2..f79ef28b8d 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/isoc99 +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/isoc99 @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/isoc99 by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/isoc99 by iffe version 2009-10-06 : : */ #ifndef _def_isoc99_ast #define _def_isoc99_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/lib b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/lib index 67c80dc794..4b3537681b 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/lib +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/lib @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -120,7 +120,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/libpath b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/libpath index b5a7c83021..a60075ae26 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/libpath +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/libpath @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/libpath.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/libpath.sh by iffe version 2009-10-06 : : */ #ifndef _def_libpath_ast #define _def_libpath_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/limits b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/limits index f3cf6b6aed..3300a2b775 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/limits +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/limits @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/map b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/map index 39bce9c36e..8fe86746f5 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/map +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/map @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -198,6 +198,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/mmap b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/mmap index 3b628c0067..94d2cd12cb 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/mmap +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/mmap @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -7,6 +7,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/mode b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/mode index 50d7ceb870..28734c2aaf 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/mode +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/mode @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/ndbm b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/ndbm index 89a006ffb0..07b285acf6 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/ndbm +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/ndbm @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/nl_types b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/nl_types index 10de231889..33d2f55fee 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/nl_types +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/nl_types @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/omitted b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/omitted index 274dd04a02..8ead8fe2a6 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/omitted +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/omitted @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/omitted by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/omitted by iffe version 2009-10-06 : : */ #ifndef _def_omitted_ast #define _def_omitted_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/param b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/param index 67b88137e9..e91254cadb 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/param +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/param @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/preroot b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/preroot index 13040e0062..983d369adc 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/preroot +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/preroot @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/prog b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/prog new file mode 100644 index 0000000000..25aa268560 --- /dev/null +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/prog @@ -0,0 +1,7 @@ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/prog by iffe version 2009-10-06 : : */ +#ifndef _def_prog_ast +#define _def_prog_ast 1 +#define _sys_types 1 /* #include <sys/types.h> ok */ +#define _lib_getexecname 1 /* getexecname() in default lib(s) */ +#define _PROC_PROG "/proc/self/path/a.out" +#endif diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sfinit b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sfinit index 36037085b2..eca0a933d7 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sfinit +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sfinit @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/sfinit.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/sfinit.c by iffe version 2009-10-06 : : */ #ifndef _def_sfinit_ast #define _def_sfinit_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sfio b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sfio index d3319eda1b..3e693bb3f3 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sfio +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sfio @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/sfio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/sfio by iffe version 2009-10-06 : : */ #ifndef _def_sfio_ast #define _def_sfio_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sig b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sig index d48dfb6db0..2d4c6c26c3 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sig +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sig @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/siglist b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/siglist index b8d27d53e5..046c7ab2a0 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/siglist +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/siglist @@ -1,10 +1,13 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/siglist by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/siglist by iffe version 2009-10-06 : : */ #ifndef _def_siglist_ast #define _def_siglist_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ #define _hdr_string 1 /* #include <string.h> ok */ #define _hdr_signal 1 /* #include <signal.h> ok */ #define _lib_strsignal 1 /* strsignal() in default lib(s) */ +#if defined(SIGHUP) && !defined(HAD_SIGHUP) +0,"HUP",SIGHUP, +#endif #if defined(SIGINT) && !defined(HAD_SIGINT) 0,"INT",SIGINT, #endif diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/signal b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/signal index 5b8740cdad..d79150dcde 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/signal +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/signal @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/signal.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/signal.c by iffe version 2009-10-06 : : */ #ifndef _def_signal_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/standards b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/standards index 0078c458fb..f1fbfb659c 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/standards +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/standards @@ -1,26 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/stdio b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/stdio index 9514d0aacb..8ff24dd46b 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/stdio +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/stdio @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sys b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sys index 3706d9b489..1f676698fa 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sys +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/sys @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -104,7 +104,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/time b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/time index 635603a6d8..88d522baf2 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/time +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/time @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tmlib b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tmlib index 794ab423e0..4685dffe2d 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tmlib +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tmlib @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/tmlib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/tmlib by iffe version 2009-10-06 : : */ #ifndef _def_tmlib_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tmx b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tmx index 9a5298b322..2dbb660bcf 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tmx +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tmx @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -108,12 +108,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tty b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tty index 5978c7bb8c..27fcb9c802 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tty +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tty @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tv b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tv index 1daa582877..c17c0dcc6e 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tv +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tv @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tvlib b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tvlib index ffe7ba4b9c..284a91af4a 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tvlib +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/tvlib @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/tvlib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/tvlib by iffe version 2009-10-06 : : */ #ifndef _def_tvlib_ast #define _def_tvlib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/uwin b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/uwin index 53354f1751..4b86aeef0f 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/uwin +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/uwin @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/uwin by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/uwin by iffe version 2009-10-06 : : */ #ifndef _def_uwin_ast #define _def_uwin_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/vfork b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/vfork index 21f3adfa1b..23e55cefce 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/vfork +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/vfork @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/vmalloc b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/vmalloc index efe5591e34..8b9de93b49 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/vmalloc +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/vmalloc @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/vmalloc by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/vmalloc by iffe version 2009-10-06 : : */ #ifndef _def_vmalloc_ast #define _def_vmalloc_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/wait b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/wait index 42895f7a40..fbf6b53c86 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/wait +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/wait @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/wchar b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/wchar index 998e051cc7..ea2d2f24eb 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/wchar +++ b/usr/src/lib/libast/amd64/src/lib/libast/FEATURE/wchar @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/align.h b/usr/src/lib/libast/amd64/src/lib/libast/align.h index c1d2830f65..5ea6665c79 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/align.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/align.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_botch.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_botch.h index a4073c6203..992ace7c30 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_botch.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_botch.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_ccode.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_ccode.h index 037e0feb43..7e14f8c11a 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_ccode.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_ccode.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_common.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_common.h index 9049c4c0ad..ca12d1646b 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_common.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_common.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -156,9 +156,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (&(p)) /* pass va_list to varargs function */ -#define va_listval(p) (*(p)) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list* /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -166,6 +163,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (&(p)) /* pass va_list to varargs function */ +#define va_listval(p) (*(p)) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list* /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_dirent.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_dirent.h index 2079091a68..35bd2afa77 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_dirent.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_dirent.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_fcntl.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_fcntl.h index 81a8f188ba..f408632bee 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_fcntl.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_fcntl.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_float.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_float.h index bdc61b73fa..48579d1014 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_float.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_float.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_fs.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_fs.h index 8560af4f28..a070d05fb5 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_fs.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_fs.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -75,7 +75,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_iconv.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_iconv.h index ccd176f5f4..f37272845d 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_iconv.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_iconv.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_lib.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_lib.h index 67c80dc794..4b3537681b 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_lib.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_lib.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -120,7 +120,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_limits.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_limits.h index f3cf6b6aed..3300a2b775 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_limits.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_limits.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_map.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_map.h index 39bce9c36e..8fe86746f5 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_map.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_map.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -198,6 +198,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_mmap.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_mmap.h index 3b628c0067..94d2cd12cb 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_mmap.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_mmap.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -7,6 +7,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_mode.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_mode.h index 50d7ceb870..28734c2aaf 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_mode.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_mode.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libcmd/common/shcmd.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_namval.h index d355c7fd75..f8f65ab2cb 100644 --- a/usr/src/lib/libcmd/common/shcmd.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_namval.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -16,65 +16,27 @@ * * * Glenn Fowler <gsf@research.att.com> * * David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ #pragma prototyped - /* - * ksh builtin command api + * Glenn Fowler + * AT&T Research + * + * common name-value struct support */ -#ifndef _SHCMD_H -#define _SHCMD_H 1 +#ifndef _NAMVAL_H +#define _NAMVAL_H -#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)(int, char**, void*); - -#undef Shbltin_t -typedef struct Shbltin_s +typedef struct { - Shell_t *shp; - void *ptr; - int version; - int (*shrun)(int, char**); - int (*shtrap)(const char*, int); - void (*shexit)(int); - Namval_t *(*shbltin)(const char*, Shbltin_f, void*); - 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 + char* name; + int value; +#ifdef _NAMVAL_PRIVATE_ + _NAMVAL_PRIVATE_ #endif +} Namval_t; #endif diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_ndbm.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_ndbm.h index 89a006ffb0..07b285acf6 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_ndbm.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_ndbm.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_nl_types.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_nl_types.h index 10de231889..33d2f55fee 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_nl_types.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_nl_types.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_param.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_param.h index 67b88137e9..e91254cadb 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_param.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_param.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_standards.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_standards.h index 0078c458fb..f1fbfb659c 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_standards.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_standards.h @@ -1,26 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_stdio.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_stdio.h index 9514d0aacb..8ff24dd46b 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_stdio.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_stdio.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_sys.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_sys.h index 3706d9b489..1f676698fa 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_sys.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_sys.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -104,7 +104,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_time.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_time.h index 635603a6d8..88d522baf2 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_time.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_time.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_tty.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_tty.h index 5978c7bb8c..27fcb9c802 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_tty.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_tty.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_vfork.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_vfork.h index 21f3adfa1b..23e55cefce 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_vfork.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_vfork.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_wait.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_wait.h index 42895f7a40..fbf6b53c86 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_wait.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_wait.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/ast_wchar.h b/usr/src/lib/libast/amd64/src/lib/libast/ast_wchar.h index 998e051cc7..ea2d2f24eb 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/ast_wchar.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/ast_wchar.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/conftab.c b/usr/src/lib/libast/amd64/src/lib/libast/conftab.c index 08c94bd358..670808017a 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/conftab.c +++ b/usr/src/lib/libast/amd64/src/lib/libast/conftab.c @@ -10,7 +10,7 @@ #include "FEATURE/param" #include "conftab.h" -/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/comp/conf.tab : : */ +/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/comp/conf.tab : : */ /* * prefix strings -- the first few are indexed by Conf_t.standard @@ -207,6 +207,7 @@ const Conf_t conf[] = { "NL_TEXTMAX", { 0UL, 0 }, { 0UL, 0 }, CONF_LIMIT, CONF_XOPEN, 1, CONF_nop, -1 }, { "NO_TRUNC", { 0UL, 0 }, { 0UL, 0 }, CONF_FEATURE|CONF_UNDERSCORE|CONF_PREFIX_ONLY, CONF_POSIX, 1, CONF_pathconf, _PC_NO_TRUNC }, { "NPROCESSORS_CONF", { 0UL, 0 }, { 0UL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_CONF }, +{ "NPROCESSORS_MAX", { 0UL, 0 }, { 0UL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_MAX }, { "NPROCESSORS_ONLN", { 0UL, 0 }, { 0UL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_ONLN }, { "NPROC_CONF", { 0UL, 0 }, { 0UL, 0 }, CONF_FEATURE|CONF_UNDERSCORE, CONF_POSIX, 1, CONF_nop, -1 }, { "NPROC_ONLN", { 0UL, 0 }, { 0UL, 0 }, CONF_FEATURE|CONF_UNDERSCORE, CONF_POSIX, 1, CONF_nop, -1 }, diff --git a/usr/src/lib/libast/amd64/src/lib/libast/conftab.h b/usr/src/lib/libast/amd64/src/lib/libast/conftab.h index 340530c26f..dd061b6083 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/conftab.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/conftab.h @@ -6,7 +6,7 @@ #endif #include <sys/systeminfo.h> -/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/comp/conf.tab : : */ +/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/comp/conf.tab : : */ #if !defined(const) && !defined(__STDC__) && !defined(__cplusplus) && !defined(c_plusplus) #define const diff --git a/usr/src/lib/libast/amd64/src/lib/libast/lc.h b/usr/src/lib/libast/amd64/src/lib/libast/lc.h index b225864bbc..da06a59ba4 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/lc.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/lc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -38,14 +38,15 @@ #define LC_abbreviated 0x00001 #define LC_checked 0x00002 -#define LC_default 0x00004 -#define LC_defined 0x00008 -#define LC_debug 0x00010 +#define LC_debug 0x00004 +#define LC_default 0x00008 +#define LC_defined 0x00010 #define LC_local 0x00020 #define LC_primary 0x00040 #define LC_qualified 0x00080 #define LC_undefined 0x00100 -#define LC_verbose 0x00200 +#define LC_utf8 0x00200 +#define LC_verbose 0x00400 #define LC_user 0x10000 #define LC_language_attribute_max 2 #define LC_territory_language_max 4 diff --git a/usr/src/lib/libast/amd64/src/lib/libast/preroot.h b/usr/src/lib/libast/amd64/src/lib/libast/preroot.h index 13040e0062..983d369adc 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/preroot.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/preroot.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/amd64/src/lib/libast/sig.h b/usr/src/lib/libast/amd64/src/lib/libast/sig.h index d48dfb6db0..2d4c6c26c3 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/sig.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/sig.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/amd64/src/lib/libast/tmx.h b/usr/src/lib/libast/amd64/src/lib/libast/tmx.h index 9a5298b322..2dbb660bcf 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/tmx.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/tmx.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -108,12 +108,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/amd64/src/lib/libast/tv.h b/usr/src/lib/libast/amd64/src/lib/libast/tv.h index 1daa582877..c17c0dcc6e 100644 --- a/usr/src/lib/libast/amd64/src/lib/libast/tv.h +++ b/usr/src/lib/libast/amd64/src/lib/libast/tv.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/common/RELEASE b/usr/src/lib/libast/common/RELEASE index 75937141cc..67be1c3484 100644 --- a/usr/src/lib/libast/common/RELEASE +++ b/usr/src/lib/libast/common/RELEASE @@ -1,3 +1,62 @@ +09-10-05 _sfopen.c: add but ignore 'F' flags for stdio compatibility +09-09-28 fts.h,ftwalk.h,fts.c: promote { namelen pathlen level } to (s)size_t +09-09-28 locales: add AST_LC_LANG for $LANG +09-09-28 setlocale.c: fix logic for dynamic { LANG LC_ALL LC_* } changes +09-09-17 include/sfio.h,sfio/sfwalk.c: add sfwalk() +09-09-09 sfio/sfputr.c: add SIGPIPE hang fix +09-08-24 sfio/sfreserve.c: fix SF_UNBOUND logic with pushed streams +09-08-18 include/ast_std.h,ast.h: add ast.mb_sync to sync mbchar() after error +09-08-17 comp/setlocale.c: add AST_LC_utf8 and { utf8_mbtowc() utf8_mblen() } +09-08-11 comp/setlocale.c: treat "en"/"en_US" AST_LC_MESSAGES as "C"/"POSIX" +09-08-10 vmalloc/vmhdr.h: add user-defined _AST_PAGESIZE and computed VMHEAPINCR +09-08-09 comp/conf.tab: add NPROCESSORS_MAX +09-07-29 astlicense.c: fix first name=value logic error +09-07-22 string/fmtip6.c: don't drop trailing 0 in 44::1:0:0 +09-06-30 port/astconf.c: standard PATH_RESOLVE is "physical" (not "metaphysical") +09-06-19 vmalloc: sync with kpv +09-06-19 include/shcmd.h: add sh_context(p) cast +09-06-11 misc/magic.tab: differentiate pc 386 32/64 bit dll/exe/obj +09-06-06 port/astconf.c: fix look->name null pointer reference +09-06-05 port/astconf.c: fix 'UNIVERSE = value' synthesize logic +09-05-25 tm/tmxduration.c: add +09-05-08 comp/syslog.c: add _UWIN /var/log/syslog preference +09-05-01 comp/setlocale.c: fix _UWIN intercepts to return NiL on unknown locales +09-04-27 sfio/sfpool.c: fix bug that did not return pool on delete +09-04-22 include/regex.h,regex/regcomp.c: add REG_REGEXP <regexp.h> compatibility +09-04-15 tm/tmxdate.c: handle "4th thursday in november" +09-03-31 string/strvcmp.c,string/strnvcmp.c: add version strcmp(3) +09-03-31 string/strpcmp.c,string/strnpcmp.c: add path prefix strcmp(3) +09-03-29 misc/optget.c: clean up num = number casts +09-03-04 tm/tmxmake.c: add tmxtm() with zone override +09-03-03 tm/tmxfmt.c: add %(...)<c>, specifically %(...)z for output zone +09-02-22 tm/tmxdate.c: add iso P... durations +09-02-02 path/pathprog.c: add +09-02-02 misc/opthdr.h,optget.c: fix flags mixup, handle old '-' as option +09-02-02 sfio/sfprints.c: fix sfvaprints() return value to not count trailing '\0' +09-02-02 misc/cmdarg.c: handle !defined(ARG_MAX) +09-02-02 port/astconf.c: fix UNIVERSE overwrite of null[] value! +09-01-31 features/sys: drop header sys/localedef.h +09-01-28 include/fs3d.h,misc/fs3d.c: mount() => fs3d_mount() for diff std prototypes +09-01-14 misc/fts_open.c: delay top list reorder until first fts_read() +09-01-14 include/ls.h: LS_W_INUMBER => 9 to accomodate large st_ino +09-01-14 misc/optget.c: expand STYLE_usage input text +09-01-09 features/uwin,stdio/_stdfun.c: iffe for _p__iob and __p__iob +09-01-09 misc/magic.tab: add ISO filesystem image entries +09-01-07 string/strtoi.c: strtol() etc. do not consume [lLuU] suffix -- thanks jkf +09-01-07 sfio/sfstrtof.h: strtod() etc. do not consume [fFlL] suffix -- thanks jkf +09-01-05 string/strlcat.c: fix logic to match docs (not that easy) +08-12-30 tm/tmxdate.c,include/tm.h: add TM_WORK { "workday" "working" "work" } +08-12-28 sfio/sfcvt.c: fix 'a' format rounding +08-12-21 tm/tmdata.c: add 2008-12-31+23:59:60-0000 leap second event +08-12-19 tm/tmxdate.c: check for dates near the epoch rolling back to the future +08-12-19 tm/tmxfmt.c: change %s for now==0 to be the epoch +08-12-07 include/ast_std.h,misc/getenv.c: no _ast_getenv for uwin ast54 compatibility +08-12-07 tm/tmxfmt.c: add %[_][EO]K for [space pad] [full|long] iso +08-12-07 sfio/sfvscanf.c: fix ok[] short by one allocation +08-12-07 comp/setlocale.c: fix off by one composite initialition loop test +08-12-07 path/pathkey.c: fix off by one loop test +08-12-04 vmalloc/vmbest.c: catch sbrk() wraparound +08-12-04 comp/spawnveg.c: clean up attrs on failure too 08-11-04 regex/regcomp.c: fix locale [!-...] and [^-...] re-initialization 08-11-04 stdio: add flockfile.c ftrylockfile.c funlockfile.c 08-10-24 port/astconf.c: handle multiple/trailing '/' in universe initialization diff --git a/usr/src/lib/libast/common/cdt/dtclose.c b/usr/src/lib/libast/common/cdt/dtclose.c index 174f49e771..e5cc3fbfcd 100644 --- a/usr/src/lib/libast/common/cdt/dtclose.c +++ b/usr/src/lib/libast/common/cdt/dtclose.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtdisc.c b/usr/src/lib/libast/common/cdt/dtdisc.c index 1d29cfde96..453977bf10 100644 --- a/usr/src/lib/libast/common/cdt/dtdisc.c +++ b/usr/src/lib/libast/common/cdt/dtdisc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtextract.c b/usr/src/lib/libast/common/cdt/dtextract.c index 7e943d4432..2176713289 100644 --- a/usr/src/lib/libast/common/cdt/dtextract.c +++ b/usr/src/lib/libast/common/cdt/dtextract.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtflatten.c b/usr/src/lib/libast/common/cdt/dtflatten.c index 6224ee7bb4..cac5308713 100644 --- a/usr/src/lib/libast/common/cdt/dtflatten.c +++ b/usr/src/lib/libast/common/cdt/dtflatten.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dthash.c b/usr/src/lib/libast/common/cdt/dthash.c index d9dcbdcdd0..f5f2cdcaf2 100644 --- a/usr/src/lib/libast/common/cdt/dthash.c +++ b/usr/src/lib/libast/common/cdt/dthash.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dthdr.h b/usr/src/lib/libast/common/cdt/dthdr.h index 1deff63b5c..acb9d64c2f 100644 --- a/usr/src/lib/libast/common/cdt/dthdr.h +++ b/usr/src/lib/libast/common/cdt/dthdr.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtlist.c b/usr/src/lib/libast/common/cdt/dtlist.c index abdfd5ac87..3d37f7bfbb 100644 --- a/usr/src/lib/libast/common/cdt/dtlist.c +++ b/usr/src/lib/libast/common/cdt/dtlist.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtmethod.c b/usr/src/lib/libast/common/cdt/dtmethod.c index de1d575854..594831bcaf 100644 --- a/usr/src/lib/libast/common/cdt/dtmethod.c +++ b/usr/src/lib/libast/common/cdt/dtmethod.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtnew.c b/usr/src/lib/libast/common/cdt/dtnew.c index 7900e9dca9..312631050c 100644 --- a/usr/src/lib/libast/common/cdt/dtnew.c +++ b/usr/src/lib/libast/common/cdt/dtnew.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtopen.c b/usr/src/lib/libast/common/cdt/dtopen.c index 5db01152ec..62d16d40a1 100644 --- a/usr/src/lib/libast/common/cdt/dtopen.c +++ b/usr/src/lib/libast/common/cdt/dtopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtrenew.c b/usr/src/lib/libast/common/cdt/dtrenew.c index 7d5fcf3b25..521688bcf1 100644 --- a/usr/src/lib/libast/common/cdt/dtrenew.c +++ b/usr/src/lib/libast/common/cdt/dtrenew.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtrestore.c b/usr/src/lib/libast/common/cdt/dtrestore.c index a5fea8f443..610382b4a5 100644 --- a/usr/src/lib/libast/common/cdt/dtrestore.c +++ b/usr/src/lib/libast/common/cdt/dtrestore.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtsize.c b/usr/src/lib/libast/common/cdt/dtsize.c index 0e96feabf3..21b4d74bd7 100644 --- a/usr/src/lib/libast/common/cdt/dtsize.c +++ b/usr/src/lib/libast/common/cdt/dtsize.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtstat.c b/usr/src/lib/libast/common/cdt/dtstat.c index 42c2bc3692..eda7509b85 100644 --- a/usr/src/lib/libast/common/cdt/dtstat.c +++ b/usr/src/lib/libast/common/cdt/dtstat.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtstrhash.c b/usr/src/lib/libast/common/cdt/dtstrhash.c index 6a6330bb0c..60701f8d72 100644 --- a/usr/src/lib/libast/common/cdt/dtstrhash.c +++ b/usr/src/lib/libast/common/cdt/dtstrhash.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dttree.c b/usr/src/lib/libast/common/cdt/dttree.c index 413008b51c..0c7ca3f793 100644 --- a/usr/src/lib/libast/common/cdt/dttree.c +++ b/usr/src/lib/libast/common/cdt/dttree.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dttreeset.c b/usr/src/lib/libast/common/cdt/dttreeset.c index e3187b9e42..0975f92ce8 100644 --- a/usr/src/lib/libast/common/cdt/dttreeset.c +++ b/usr/src/lib/libast/common/cdt/dttreeset.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtview.c b/usr/src/lib/libast/common/cdt/dtview.c index 5977d07170..d7f77e32c1 100644 --- a/usr/src/lib/libast/common/cdt/dtview.c +++ b/usr/src/lib/libast/common/cdt/dtview.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/cdt/dtwalk.c b/usr/src/lib/libast/common/cdt/dtwalk.c index 03a25f829a..4c456ff227 100644 --- a/usr/src/lib/libast/common/cdt/dtwalk.c +++ b/usr/src/lib/libast/common/cdt/dtwalk.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/atexit.c b/usr/src/lib/libast/common/comp/atexit.c index e1ad5cba32..ba814e84f9 100644 --- a/usr/src/lib/libast/common/comp/atexit.c +++ b/usr/src/lib/libast/common/comp/atexit.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/basename.c b/usr/src/lib/libast/common/comp/basename.c index 50b6987765..7b5c87273a 100644 --- a/usr/src/lib/libast/common/comp/basename.c +++ b/usr/src/lib/libast/common/comp/basename.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/catopen.c b/usr/src/lib/libast/common/comp/catopen.c index b95b53f0c5..5039f1280b 100644 --- a/usr/src/lib/libast/common/comp/catopen.c +++ b/usr/src/lib/libast/common/comp/catopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/closelog.c b/usr/src/lib/libast/common/comp/closelog.c index f9c97e5595..8d1c0ee3f4 100644 --- a/usr/src/lib/libast/common/comp/closelog.c +++ b/usr/src/lib/libast/common/comp/closelog.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/conf.sh b/usr/src/lib/libast/common/comp/conf.sh index 115faeb7fd..0e5dcca89d 100644 --- a/usr/src/lib/libast/common/comp/conf.sh +++ b/usr/src/lib/libast/common/comp/conf.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1985-2008 AT&T Intellectual Property # +# Copyright (c) 1985-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libast/common/comp/conf.tab b/usr/src/lib/libast/common/comp/conf.tab index 36200e6a11..d141d603bd 100644 --- a/usr/src/lib/libast/common/comp/conf.tab +++ b/usr/src/lib/libast/common/comp/conf.tab @@ -305,6 +305,7 @@ NL_SPECMAX C QQ 1 L NL_TEXTMAX XOPEN XX 1 L LINE_MAX NO_TRUNC POSIX PC 1 FUW NPROCESSORS_CONF SVID SC 1 0 +NPROCESSORS_MAX SVID SC 1 0 NPROCESSORS_ONLN SVID SC 1 0 NPROC_CONF C QQ 1 L NPROC_ONLN C QQ 1 L diff --git a/usr/src/lib/libast/common/comp/creat64.c b/usr/src/lib/libast/common/comp/creat64.c index 5a34f18cde..2217f2886c 100644 --- a/usr/src/lib/libast/common/comp/creat64.c +++ b/usr/src/lib/libast/common/comp/creat64.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/dirname.c b/usr/src/lib/libast/common/comp/dirname.c index df97ae4485..95248e13a7 100644 --- a/usr/src/lib/libast/common/comp/dirname.c +++ b/usr/src/lib/libast/common/comp/dirname.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/dup2.c b/usr/src/lib/libast/common/comp/dup2.c index ad06e845c5..2a7f9ce740 100644 --- a/usr/src/lib/libast/common/comp/dup2.c +++ b/usr/src/lib/libast/common/comp/dup2.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/eaccess.c b/usr/src/lib/libast/common/comp/eaccess.c index 80abf8d033..f69376b019 100644 --- a/usr/src/lib/libast/common/comp/eaccess.c +++ b/usr/src/lib/libast/common/comp/eaccess.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/errno.c b/usr/src/lib/libast/common/comp/errno.c index 650e3ae5eb..db8a97d4df 100644 --- a/usr/src/lib/libast/common/comp/errno.c +++ b/usr/src/lib/libast/common/comp/errno.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/execlp.c b/usr/src/lib/libast/common/comp/execlp.c index dee7e9efee..85f6c7a5d5 100644 --- a/usr/src/lib/libast/common/comp/execlp.c +++ b/usr/src/lib/libast/common/comp/execlp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/execve.c b/usr/src/lib/libast/common/comp/execve.c index 5aeed0a89b..58bb970771 100644 --- a/usr/src/lib/libast/common/comp/execve.c +++ b/usr/src/lib/libast/common/comp/execve.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/execvp.c b/usr/src/lib/libast/common/comp/execvp.c index c4cd302fb7..e60c9b3b97 100644 --- a/usr/src/lib/libast/common/comp/execvp.c +++ b/usr/src/lib/libast/common/comp/execvp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/execvpe.c b/usr/src/lib/libast/common/comp/execvpe.c index 7d5104f688..9ac075dc47 100644 --- a/usr/src/lib/libast/common/comp/execvpe.c +++ b/usr/src/lib/libast/common/comp/execvpe.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/fcntl.c b/usr/src/lib/libast/common/comp/fcntl.c index ed8ca3b0e0..88a63babaa 100644 --- a/usr/src/lib/libast/common/comp/fcntl.c +++ b/usr/src/lib/libast/common/comp/fcntl.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/fmtmsglib.c b/usr/src/lib/libast/common/comp/fmtmsglib.c index ad42438a05..04ef94674c 100644 --- a/usr/src/lib/libast/common/comp/fmtmsglib.c +++ b/usr/src/lib/libast/common/comp/fmtmsglib.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/fnmatch.c b/usr/src/lib/libast/common/comp/fnmatch.c index ebee4f455f..e893616943 100644 --- a/usr/src/lib/libast/common/comp/fnmatch.c +++ b/usr/src/lib/libast/common/comp/fnmatch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/fnmatch.h b/usr/src/lib/libast/common/comp/fnmatch.h index a4d4296ab5..6b60659ce9 100644 --- a/usr/src/lib/libast/common/comp/fnmatch.h +++ b/usr/src/lib/libast/common/comp/fnmatch.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/frexp.c b/usr/src/lib/libast/common/comp/frexp.c index eabb2d5702..7408dfed1f 100644 --- a/usr/src/lib/libast/common/comp/frexp.c +++ b/usr/src/lib/libast/common/comp/frexp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/frexpl.c b/usr/src/lib/libast/common/comp/frexpl.c index 7b5c160d2a..3f9adbfd91 100644 --- a/usr/src/lib/libast/common/comp/frexpl.c +++ b/usr/src/lib/libast/common/comp/frexpl.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/fsync.c b/usr/src/lib/libast/common/comp/fsync.c index 1917d180e1..0f8abef90f 100644 --- a/usr/src/lib/libast/common/comp/fsync.c +++ b/usr/src/lib/libast/common/comp/fsync.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/ftw.c b/usr/src/lib/libast/common/comp/ftw.c index fde4482441..7ce30162ca 100644 --- a/usr/src/lib/libast/common/comp/ftw.c +++ b/usr/src/lib/libast/common/comp/ftw.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/ftw.h b/usr/src/lib/libast/common/comp/ftw.h index cb7105f67d..080fa8ddb4 100644 --- a/usr/src/lib/libast/common/comp/ftw.h +++ b/usr/src/lib/libast/common/comp/ftw.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/getdate.c b/usr/src/lib/libast/common/comp/getdate.c index 710917b9a7..1e6f0f6f09 100644 --- a/usr/src/lib/libast/common/comp/getdate.c +++ b/usr/src/lib/libast/common/comp/getdate.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/getgroups.c b/usr/src/lib/libast/common/comp/getgroups.c index 39532ff303..014221e348 100644 --- a/usr/src/lib/libast/common/comp/getgroups.c +++ b/usr/src/lib/libast/common/comp/getgroups.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/getlogin.c b/usr/src/lib/libast/common/comp/getlogin.c index 0e5e7f05bd..20322d55c8 100644 --- a/usr/src/lib/libast/common/comp/getlogin.c +++ b/usr/src/lib/libast/common/comp/getlogin.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/getopt.c b/usr/src/lib/libast/common/comp/getopt.c index 37436d2d4b..d70413f799 100644 --- a/usr/src/lib/libast/common/comp/getopt.c +++ b/usr/src/lib/libast/common/comp/getopt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/getopt.h b/usr/src/lib/libast/common/comp/getopt.h index bfb7ddcc63..9b50e5feef 100644 --- a/usr/src/lib/libast/common/comp/getopt.h +++ b/usr/src/lib/libast/common/comp/getopt.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/getoptl.c b/usr/src/lib/libast/common/comp/getoptl.c index 9135065e72..8c94e7aebb 100644 --- a/usr/src/lib/libast/common/comp/getoptl.c +++ b/usr/src/lib/libast/common/comp/getoptl.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/getpgrp.c b/usr/src/lib/libast/common/comp/getpgrp.c index 22eb3ee993..39d9cb4137 100644 --- a/usr/src/lib/libast/common/comp/getpgrp.c +++ b/usr/src/lib/libast/common/comp/getpgrp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/getsubopt.c b/usr/src/lib/libast/common/comp/getsubopt.c index 5c22480a03..4aa6697871 100644 --- a/usr/src/lib/libast/common/comp/getsubopt.c +++ b/usr/src/lib/libast/common/comp/getsubopt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/getwd.c b/usr/src/lib/libast/common/comp/getwd.c index a221c00b90..ce7a56137e 100644 --- a/usr/src/lib/libast/common/comp/getwd.c +++ b/usr/src/lib/libast/common/comp/getwd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/gross.c b/usr/src/lib/libast/common/comp/gross.c index beccc9c2c5..259e37c853 100644 --- a/usr/src/lib/libast/common/comp/gross.c +++ b/usr/src/lib/libast/common/comp/gross.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/hsearch.c b/usr/src/lib/libast/common/comp/hsearch.c index ba8b7af1f2..8f8b06d22a 100644 --- a/usr/src/lib/libast/common/comp/hsearch.c +++ b/usr/src/lib/libast/common/comp/hsearch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/iconv.c b/usr/src/lib/libast/common/comp/iconv.c index 24ecd0da8b..5772f78780 100644 --- a/usr/src/lib/libast/common/comp/iconv.c +++ b/usr/src/lib/libast/common/comp/iconv.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/killpg.c b/usr/src/lib/libast/common/comp/killpg.c index 56359a1c99..84e27d96d5 100644 --- a/usr/src/lib/libast/common/comp/killpg.c +++ b/usr/src/lib/libast/common/comp/killpg.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/libgen.h b/usr/src/lib/libast/common/comp/libgen.h index 4c1fc07b1f..fb3025171a 100644 --- a/usr/src/lib/libast/common/comp/libgen.h +++ b/usr/src/lib/libast/common/comp/libgen.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/link.c b/usr/src/lib/libast/common/comp/link.c index fead99e39e..5593a43e2e 100644 --- a/usr/src/lib/libast/common/comp/link.c +++ b/usr/src/lib/libast/common/comp/link.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/localeconv.c b/usr/src/lib/libast/common/comp/localeconv.c index 28afa2e555..bfb878a52c 100644 --- a/usr/src/lib/libast/common/comp/localeconv.c +++ b/usr/src/lib/libast/common/comp/localeconv.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/lstat.c b/usr/src/lib/libast/common/comp/lstat.c index 99fd406e8d..b67356d3b3 100644 --- a/usr/src/lib/libast/common/comp/lstat.c +++ b/usr/src/lib/libast/common/comp/lstat.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/memccpy.c b/usr/src/lib/libast/common/comp/memccpy.c index 1f70b624a9..2928e0c475 100644 --- a/usr/src/lib/libast/common/comp/memccpy.c +++ b/usr/src/lib/libast/common/comp/memccpy.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/memchr.c b/usr/src/lib/libast/common/comp/memchr.c index 51ced6c317..9a1525eca3 100644 --- a/usr/src/lib/libast/common/comp/memchr.c +++ b/usr/src/lib/libast/common/comp/memchr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/memcmp.c b/usr/src/lib/libast/common/comp/memcmp.c index 9d6a5166b7..33700fe54c 100644 --- a/usr/src/lib/libast/common/comp/memcmp.c +++ b/usr/src/lib/libast/common/comp/memcmp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/memcpy.c b/usr/src/lib/libast/common/comp/memcpy.c index 2738fcaaef..6a6c4f0e82 100644 --- a/usr/src/lib/libast/common/comp/memcpy.c +++ b/usr/src/lib/libast/common/comp/memcpy.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/memmove.c b/usr/src/lib/libast/common/comp/memmove.c index 5100dadb42..73eebc360b 100644 --- a/usr/src/lib/libast/common/comp/memmove.c +++ b/usr/src/lib/libast/common/comp/memmove.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/memset.c b/usr/src/lib/libast/common/comp/memset.c index db73f12591..88605d6c8f 100644 --- a/usr/src/lib/libast/common/comp/memset.c +++ b/usr/src/lib/libast/common/comp/memset.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/mkdir.c b/usr/src/lib/libast/common/comp/mkdir.c index c75a1702cb..6ad37d915b 100644 --- a/usr/src/lib/libast/common/comp/mkdir.c +++ b/usr/src/lib/libast/common/comp/mkdir.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/mkfifo.c b/usr/src/lib/libast/common/comp/mkfifo.c index 0d917954c5..df8e4ec06c 100644 --- a/usr/src/lib/libast/common/comp/mkfifo.c +++ b/usr/src/lib/libast/common/comp/mkfifo.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/mknod.c b/usr/src/lib/libast/common/comp/mknod.c index 9f5a67875e..8d8ec6efbf 100644 --- a/usr/src/lib/libast/common/comp/mknod.c +++ b/usr/src/lib/libast/common/comp/mknod.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/mktemp.c b/usr/src/lib/libast/common/comp/mktemp.c index 73a5b811cb..fc79301f11 100644 --- a/usr/src/lib/libast/common/comp/mktemp.c +++ b/usr/src/lib/libast/common/comp/mktemp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/mktime.c b/usr/src/lib/libast/common/comp/mktime.c index 8ebd366f39..691184645e 100644 --- a/usr/src/lib/libast/common/comp/mktime.c +++ b/usr/src/lib/libast/common/comp/mktime.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/mount.c b/usr/src/lib/libast/common/comp/mount.c index 3106302ea6..c444aebea6 100644 --- a/usr/src/lib/libast/common/comp/mount.c +++ b/usr/src/lib/libast/common/comp/mount.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/nftw.c b/usr/src/lib/libast/common/comp/nftw.c index 134acadf11..6372869a9c 100644 --- a/usr/src/lib/libast/common/comp/nftw.c +++ b/usr/src/lib/libast/common/comp/nftw.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/open.c b/usr/src/lib/libast/common/comp/open.c index aae54589fe..06b2874e92 100644 --- a/usr/src/lib/libast/common/comp/open.c +++ b/usr/src/lib/libast/common/comp/open.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/openlog.c b/usr/src/lib/libast/common/comp/openlog.c index 8d2e22f562..17b1a8fa4a 100644 --- a/usr/src/lib/libast/common/comp/openlog.c +++ b/usr/src/lib/libast/common/comp/openlog.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/putenv.c b/usr/src/lib/libast/common/comp/putenv.c index 82fc7424fe..a94dc44457 100644 --- a/usr/src/lib/libast/common/comp/putenv.c +++ b/usr/src/lib/libast/common/comp/putenv.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/re_comp.c b/usr/src/lib/libast/common/comp/re_comp.c index 086b185841..9892cfcf2c 100644 --- a/usr/src/lib/libast/common/comp/re_comp.c +++ b/usr/src/lib/libast/common/comp/re_comp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/re_comp.h b/usr/src/lib/libast/common/comp/re_comp.h index 4801721024..d4eaa98e3c 100644 --- a/usr/src/lib/libast/common/comp/re_comp.h +++ b/usr/src/lib/libast/common/comp/re_comp.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/readlink.c b/usr/src/lib/libast/common/comp/readlink.c index 72192e6fc8..e0a6ac3664 100644 --- a/usr/src/lib/libast/common/comp/readlink.c +++ b/usr/src/lib/libast/common/comp/readlink.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/realpath.c b/usr/src/lib/libast/common/comp/realpath.c index 4688ca132a..4b01835f25 100644 --- a/usr/src/lib/libast/common/comp/realpath.c +++ b/usr/src/lib/libast/common/comp/realpath.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/regcmp.c b/usr/src/lib/libast/common/comp/regcmp.c index 8006fdae68..81c7c730f1 100644 --- a/usr/src/lib/libast/common/comp/regcmp.c +++ b/usr/src/lib/libast/common/comp/regcmp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/regexp.c b/usr/src/lib/libast/common/comp/regexp.c index fa26310361..37eb3dd107 100644 --- a/usr/src/lib/libast/common/comp/regexp.c +++ b/usr/src/lib/libast/common/comp/regexp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/regexp.h b/usr/src/lib/libast/common/comp/regexp.h index 2217e987a4..1dd06ac12a 100644 --- a/usr/src/lib/libast/common/comp/regexp.h +++ b/usr/src/lib/libast/common/comp/regexp.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/remove.c b/usr/src/lib/libast/common/comp/remove.c index af8a4e0422..b920ed1b90 100644 --- a/usr/src/lib/libast/common/comp/remove.c +++ b/usr/src/lib/libast/common/comp/remove.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/rename.c b/usr/src/lib/libast/common/comp/rename.c index 5da4955b98..4089d04aab 100644 --- a/usr/src/lib/libast/common/comp/rename.c +++ b/usr/src/lib/libast/common/comp/rename.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/resolvepath.c b/usr/src/lib/libast/common/comp/resolvepath.c index a3be273646..3641e85466 100644 --- a/usr/src/lib/libast/common/comp/resolvepath.c +++ b/usr/src/lib/libast/common/comp/resolvepath.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/rmdir.c b/usr/src/lib/libast/common/comp/rmdir.c index 71b5154f48..8db360d758 100644 --- a/usr/src/lib/libast/common/comp/rmdir.c +++ b/usr/src/lib/libast/common/comp/rmdir.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/setenv.c b/usr/src/lib/libast/common/comp/setenv.c index 4d0031fd08..15a012dfb1 100644 --- a/usr/src/lib/libast/common/comp/setenv.c +++ b/usr/src/lib/libast/common/comp/setenv.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/setlocale.c b/usr/src/lib/libast/common/comp/setlocale.c index c212b9fc10..86759ee222 100644 --- a/usr/src/lib/libast/common/comp/setlocale.c +++ b/usr/src/lib/libast/common/comp/setlocale.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -69,6 +69,10 @@ extern int mblen(const char*, size_t); #define AST_LC_CANONICAL LC_abbreviated #endif +#ifndef AST_LC_test +#define AST_LC_test (1L<<27) +#endif + #if _UWIN #include <ast_windows.h> @@ -114,7 +118,11 @@ native_locale(const char* locale, char* buf, size_t siz) break; } if (!ctry) + { + if (!lang) + return 0; ctry = SUBLANG_DEFAULT; + } } lcid = MAKELCID(MAKELANGID(lang, ctry), SORT_DEFAULT); } @@ -141,14 +149,15 @@ native_setlocale(int category, const char* locale) char* sys; char buf[256]; + if (!(usr = native_locale(locale, buf, sizeof(buf)))) + return 0; + /* * win32 doesn't have LC_MESSAGES */ if (category == LC_MESSAGES) return (char*)locale; - if (!(usr = native_locale(locale, buf, sizeof(buf)))) - return 0; sys = uwin_setlocale(category, usr); if (ast.locale.set & AST_LC_debug) sfprintf(sfstderr, "locale uwin %17s %-24s %-24s\n", lc_categories[lcindex(category, 0)].name, usr, sys); @@ -528,6 +537,93 @@ sjis_mbtowc(register wchar_t* p, register const char* s, size_t n) #endif +#define utf8_wctomb wctomb + +static const uint32_t utf8mask[] = +{ + 0x00000000, + 0x00000000, + 0xffffff80, + 0xfffff800, + 0xffff0000, + 0xffe00000, + 0xfc000000, +}; + +static const signed char utf8tab[256] = +{ + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6,-1,-1, +}; + +static int +utf8_mbtowc(wchar_t* wp, const char* str, size_t n) +{ + register unsigned char* sp = (unsigned char*)str; + register int m; + register int i; + register int c; + register wchar_t w = 0; + + if (!sp || !n) + return 0; + if ((m = utf8tab[*sp]) > 0) + { + if (m > n) + return -1; + if (wp) + { + if (m == 1) + { + *wp = *sp; + return 1; + } + w = *sp & ((1<<(8-m))-1); + for (i = m - 1; i > 0; i--) + { + c = *++sp; + if ((c&0xc0) != 0x80) + goto invalid; + w = (w<<6) | (c&0x3f); + } + if (!(utf8mask[m] & w) || w >= 0xd800 && (w <= 0xdfff || w >= 0xfffe && w <= 0xffff)) + goto invalid; + *wp = w; + } + return m; + } + if (!*sp) + return 0; + invalid: +#ifdef EILSEQ + errno = EILSEQ; +#endif + ast.mb_sync = (const char*)sp - str; + return -1; +} + +static int +utf8_mblen(const char* str, size_t n) +{ + wchar_t w; + + return utf8_mbtowc(&w, str, n); +} + /* * called when LC_CTYPE initialized or changes */ @@ -535,6 +631,7 @@ sjis_mbtowc(register wchar_t* p, register const char* s, size_t n) static int set_ctype(Lc_category_t* cp) { + ast.mb_sync = 0; if (locales[cp->internal]->flags & LC_debug) { ast.mb_cur_max = DEBUG_MB_CUR_MAX; @@ -551,6 +648,15 @@ set_ctype(Lc_category_t* cp) ast.mb_width = default_wcwidth; ast.mb_conv = 0; } + else if ((locales[cp->internal]->flags & LC_utf8) && !(ast.locale.set & AST_LC_test)) + { + ast.mb_cur_max = 6; + ast.mb_len = utf8_mblen; + ast.mb_towc = utf8_mbtowc; + if (!(ast.mb_width = wcwidth)) + ast.mb_width = default_wcwidth; + ast.mb_conv = utf8_wctomb; + } else { if (!(ast.mb_width = wcwidth)) @@ -576,6 +682,19 @@ set_ctype(Lc_category_t* cp) } #endif } + if (ast.locale.set & (AST_LC_debug|AST_LC_setlocale)) + sfprintf(sfstderr, "locale info %17s MB_CUR_MAX=%d%s%s%s%s\n" + , cp->name + , ast.mb_cur_max + , ast.mb_len == debug_mblen ? " debug_mblen" : ast.mb_len == mblen ? " mblen" : "" + , ast.mb_towc == debug_mbtowc ? " debug_mbtowc" : ast.mb_towc == mbtowc ? " mbtowc" +#ifdef mb_state + : ast.mb_towc == sjis_mbtowc ? " sjis_mbtowc" +#endif + : "" + , ast.mb_width == debug_wcwidth ? " debug_wcwidth" : ast.mb_width == wcwidth ? " wcwidth" : ast.mb_width == default_wcwidth ? " default_wcwidth" : "" + , ast.mb_conv == debug_wctomb ? " debug_wctomb" : ast.mb_conv == wctomb ? " wctomb" : "" + ); return 0; } @@ -630,11 +749,21 @@ Lc_category_t lc_categories[] = { "LC_PAPER", LC_PAPER, AST_LC_PAPER, 0 }, }; -static const Namval_t options[] = +static Lc_t* lang; +static Lc_t* lc_all; + +typedef struct Unamval_s +{ + char* name; + unsigned int value; +} Unamval_t; + +static const Unamval_t options[] = { "debug", AST_LC_debug, "find", AST_LC_find, "setlocale", AST_LC_setlocale, + "test", AST_LC_test, "translate", AST_LC_translate, 0, 0 }; @@ -649,9 +778,9 @@ setopt(void* a, const void* p, int n, const char* v) if (p) { if (n) - ast.locale.set |= ((Namval_t*)p)->value; + ast.locale.set |= ((Unamval_t*)p)->value; else - ast.locale.set &= ~((Namval_t*)p)->value; + ast.locale.set &= ~((Unamval_t*)p)->value; } return 0; } @@ -690,7 +819,7 @@ single(int category, Lc_t* lc) const char* sys; int i; - if (!lc && !(lc = lc_categories[category].prev)) + if (!lc && !(lc = lc_all) && !(lc = lc_categories[category].prev) && !(lc = lang)) lc = lcmake(NiL); if (locales[category] != lc) { @@ -738,7 +867,7 @@ single(int category, Lc_t* lc) locales[category] = lc_categories[category].prev; return 0; } - if (lc->flags & LC_default) + if ((lc->flags & LC_default) || category == AST_LC_MESSAGES && lc->name[0] == 'e' && lc->name[1] == 'n' && (lc->name[2] == 0 || lc->name[2] == '_' && lc->name[3] == 'U')) ast.locale.set &= ~(1<<category); else ast.locale.set |= (1<<category); @@ -759,6 +888,7 @@ composite(register const char* s, int initialize) register int j; register int k; int n; + int m; const char* w; Lc_t* p; int cat[AST_LC_COUNT]; @@ -802,10 +932,10 @@ composite(register const char* s, int initialize) } else if (*s++ == ';') { - if ((n = s - w - 1) >= sizeof(buf)) - n = sizeof(buf) - 1; - memcpy(buf, w, n); - buf[n] = 0; + if ((m = s - w - 1) >= sizeof(buf)) + m = sizeof(buf) - 1; + memcpy(buf, w, m); + buf[m] = 0; p = lcmake(buf); break; } @@ -824,7 +954,7 @@ composite(register const char* s, int initialize) else if (!lc_categories[cat[i]].prev) lc_categories[cat[i]].prev = p; } - while (s[0] == '/' && s[1] && n < AST_LC_COUNT) + while (s[0] == '/' && s[1] && n < (AST_LC_COUNT - 1)) { n++; for (w = ++s; *s && *s != '/'; s++); @@ -855,6 +985,12 @@ composite(register const char* s, int initialize) /* * setlocale() intercept + * + * locale: + * 0 query + * "" initialize from environment + * "-" unset + * * set */ char* @@ -881,7 +1017,7 @@ _ast_setlocale(int category, const char* locale) */ compose: - if (category != AST_LC_ALL) + if (category != AST_LC_ALL && category != AST_LC_LANG) return (char*)locales[category]->name; if (!sp && !(sp = sfstropen())) return 0; @@ -916,9 +1052,12 @@ _ast_setlocale(int category, const char* locale) return sfstruse(sp); } if (!ast.locale.serial++) + { stropt(getenv("LC_OPTIONS"), options, sizeof(*options), setopt, NiL); + initialized = 0; + } if (*locale) - p = lcmake(locale); + p = streq(locale, "-") ? (Lc_t*)0 : lcmake(locale); else if (!initialized) { char* u; @@ -930,63 +1069,75 @@ _ast_setlocale(int category, const char* locale) */ u = 0; - if (!(a = getenv("LC_ALL")) || !*a) + if ((s = getenv("LANG")) && *s) { - for (i = 1; i < AST_LC_COUNT; i++) - if ((s = getenv(lc_categories[i].name)) && *s) - { - if (streq(s, local) && (u || (u = native_locale(locale, tmp, sizeof(tmp))))) - s = u; - lc_categories[i].prev = lcmake(s); - } - a = getenv("LANG"); + if (streq(s, local) && (u || (u = native_locale(locale, tmp, sizeof(tmp))))) + s = u; + lang = lcmake(s); } - if (a) + else + lang = 0; + if ((s = getenv("LC_ALL")) && *s) { - if (streq(a, local) && (u || (u = native_locale(locale, tmp, sizeof(tmp))))) - a = u; - if (composite(a, 1)) - a = 0; + if (streq(s, local) && (u || (u = native_locale(locale, tmp, sizeof(tmp))))) + s = u; + lc_all = lcmake(s); } - p = 0; + else + lc_all = 0; for (i = 1; i < AST_LC_COUNT; i++) - { - if (!lc_categories[i].prev) + if ((s = getenv(lc_categories[i].name)) && *s) { - if (!p && !(p = lcmake(a))) - break; - lc_categories[i].prev = p; + if (streq(s, local) && (u || (u = native_locale(locale, tmp, sizeof(tmp))))) + s = u; + lc_categories[i].prev = lcmake(s); } - if (!single(i, lc_categories[i].prev)) + else + lc_categories[i].prev = 0; + for (i = 1; i < AST_LC_COUNT; i++) + if (!single(i, lc_all ? lc_all : lc_categories[i].prev)) { while (i--) single(i, NiL); return 0; } - } if (ast.locale.set & AST_LC_debug) for (i = 1; i < AST_LC_COUNT; i++) - sfprintf(sfstderr, "locale env %17s %s\n", lc_categories[i].name, locales[i]->name); + sfprintf(sfstderr, "locale env %17s %16s %16s\n", lc_categories[i].name, locales[i]->name, lc_categories[i].prev ? lc_categories[i].prev->name : (char*)0); initialized = 1; goto compose; } - else if (!(p = lc_categories[category].prev)) + else if (category == AST_LC_LANG || !(p = lc_categories[category].prev)) p = lcmake("C"); - if (category != AST_LC_ALL) + if (category == AST_LC_LANG) + { + if (lang != p) + { + lang = p; + if (!lc_all) + for (i = 1; i < AST_LC_COUNT; i++) + if (!single(i, lc_categories[i].prev)) + { + while (i--) + single(i, NiL); + return 0; + } + } + } + else if (category != AST_LC_ALL) return single(category, p); - else if (!(i = composite(locale, 0))) + else if ((i = composite(locale, 0)) < 0) + return 0; + else if (lc_all != p) { - if (!p) - return 0; + lc_all = p; for (i = 1; i < AST_LC_COUNT; i++) - if (!single(i, p)) + if (!single(i, lc_all ? lc_all : lc_categories[i].prev)) { while (i--) single(i, NiL); return 0; } } - else if (i < 0) - return 0; goto compose; } diff --git a/usr/src/lib/libast/common/comp/setlogmask.c b/usr/src/lib/libast/common/comp/setlogmask.c index bd79000a77..3e14c6c131 100644 --- a/usr/src/lib/libast/common/comp/setlogmask.c +++ b/usr/src/lib/libast/common/comp/setlogmask.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/setpgid.c b/usr/src/lib/libast/common/comp/setpgid.c index d21372604e..b758a3f0aa 100644 --- a/usr/src/lib/libast/common/comp/setpgid.c +++ b/usr/src/lib/libast/common/comp/setpgid.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/setsid.c b/usr/src/lib/libast/common/comp/setsid.c index a7c0107891..77acd0cac7 100644 --- a/usr/src/lib/libast/common/comp/setsid.c +++ b/usr/src/lib/libast/common/comp/setsid.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/sigunblock.c b/usr/src/lib/libast/common/comp/sigunblock.c index f62d37f2fb..161a6c8366 100644 --- a/usr/src/lib/libast/common/comp/sigunblock.c +++ b/usr/src/lib/libast/common/comp/sigunblock.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/spawnveg.c b/usr/src/lib/libast/common/comp/spawnveg.c index e3d93a5959..092fc56a72 100644 --- a/usr/src/lib/libast/common/comp/spawnveg.c +++ b/usr/src/lib/libast/common/comp/spawnveg.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -52,7 +52,7 @@ spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid) posix_spawnattr_t attr; if (err = posix_spawnattr_init(&attr)) - goto bad; + goto nope; if (pgid) { if (pgid <= 1) @@ -76,6 +76,8 @@ spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid) #endif return pid; bad: + posix_spawnattr_destroy(&attr); + nope: errno = err; return -1; } diff --git a/usr/src/lib/libast/common/comp/statvfs.c b/usr/src/lib/libast/common/comp/statvfs.c index 3a8c8b35dd..2da0f59778 100644 --- a/usr/src/lib/libast/common/comp/statvfs.c +++ b/usr/src/lib/libast/common/comp/statvfs.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strcasecmp.c b/usr/src/lib/libast/common/comp/strcasecmp.c index 9eb0a72880..c387e1442b 100644 --- a/usr/src/lib/libast/common/comp/strcasecmp.c +++ b/usr/src/lib/libast/common/comp/strcasecmp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strchr.c b/usr/src/lib/libast/common/comp/strchr.c index c4aaecae79..c0188a13ca 100644 --- a/usr/src/lib/libast/common/comp/strchr.c +++ b/usr/src/lib/libast/common/comp/strchr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strftime.c b/usr/src/lib/libast/common/comp/strftime.c index e7ce692756..cb6c720210 100644 --- a/usr/src/lib/libast/common/comp/strftime.c +++ b/usr/src/lib/libast/common/comp/strftime.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strncasecmp.c b/usr/src/lib/libast/common/comp/strncasecmp.c index 0f4e4e8b3f..ca3c484bbc 100644 --- a/usr/src/lib/libast/common/comp/strncasecmp.c +++ b/usr/src/lib/libast/common/comp/strncasecmp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strptime.c b/usr/src/lib/libast/common/comp/strptime.c index 2c0d9d0a1c..38eb16da15 100644 --- a/usr/src/lib/libast/common/comp/strptime.c +++ b/usr/src/lib/libast/common/comp/strptime.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -27,7 +27,7 @@ #define strptime ______strptime #include <ast.h> -#include <tm.h> +#include <tmx.h> #undef strptime @@ -51,8 +51,8 @@ strptime(const char* s, const char* format, struct tm* ts) char* f; time_t t; Tm_t tm; - Tm_t* tn; + memset(&tm, 0, sizeof(tm)); tm.tm_sec = ts->tm_sec; tm.tm_min = ts->tm_min; tm.tm_hour = ts->tm_hour; @@ -66,16 +66,16 @@ strptime(const char* s, const char* format, struct tm* ts) t = tmscan(s, &e, format, &f, &t, 0); if (e == (char*)s || *f) return 0; - tn = tmmake(&t); - ts->tm_sec = tn->tm_sec; - ts->tm_min = tn->tm_min; - ts->tm_hour = tn->tm_hour; - ts->tm_mday = tn->tm_mday; - ts->tm_mon = tn->tm_mon; - ts->tm_year = tn->tm_year; - ts->tm_wday = tn->tm_wday; - ts->tm_yday = tn->tm_yday; - ts->tm_isdst = tn->tm_isdst; + tmxtm(&tm, tmxclock(&t), NiL); + ts->tm_sec = tm.tm_sec; + ts->tm_min = tm.tm_min; + ts->tm_hour = tm.tm_hour; + ts->tm_mday = tm.tm_mday; + ts->tm_mon = tm.tm_mon; + ts->tm_year = tm.tm_year; + ts->tm_wday = tm.tm_wday; + ts->tm_yday = tm.tm_yday; + ts->tm_isdst = tm.tm_isdst; return e; } diff --git a/usr/src/lib/libast/common/comp/strrchr.c b/usr/src/lib/libast/common/comp/strrchr.c index aa14262e02..03bfbcd05c 100644 --- a/usr/src/lib/libast/common/comp/strrchr.c +++ b/usr/src/lib/libast/common/comp/strrchr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strstr.c b/usr/src/lib/libast/common/comp/strstr.c index 3a5c0a0203..255c5a3710 100644 --- a/usr/src/lib/libast/common/comp/strstr.c +++ b/usr/src/lib/libast/common/comp/strstr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strtod.c b/usr/src/lib/libast/common/comp/strtod.c index 10ace03ed6..e33d8a5a55 100644 --- a/usr/src/lib/libast/common/comp/strtod.c +++ b/usr/src/lib/libast/common/comp/strtod.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strtol.c b/usr/src/lib/libast/common/comp/strtol.c index e396298532..dfcf217710 100644 --- a/usr/src/lib/libast/common/comp/strtol.c +++ b/usr/src/lib/libast/common/comp/strtol.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strtold.c b/usr/src/lib/libast/common/comp/strtold.c index 954426dfb8..c4d86bd995 100644 --- a/usr/src/lib/libast/common/comp/strtold.c +++ b/usr/src/lib/libast/common/comp/strtold.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strtoll.c b/usr/src/lib/libast/common/comp/strtoll.c index 4bcc902860..141b80bad2 100644 --- a/usr/src/lib/libast/common/comp/strtoll.c +++ b/usr/src/lib/libast/common/comp/strtoll.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strtoul.c b/usr/src/lib/libast/common/comp/strtoul.c index 3d1484bca3..4fa25c081b 100644 --- a/usr/src/lib/libast/common/comp/strtoul.c +++ b/usr/src/lib/libast/common/comp/strtoul.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/strtoull.c b/usr/src/lib/libast/common/comp/strtoull.c index eda6b831de..a1f7d5c142 100644 --- a/usr/src/lib/libast/common/comp/strtoull.c +++ b/usr/src/lib/libast/common/comp/strtoull.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/swab.c b/usr/src/lib/libast/common/comp/swab.c index 3eb4c89509..6418fef6b5 100644 --- a/usr/src/lib/libast/common/comp/swab.c +++ b/usr/src/lib/libast/common/comp/swab.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/symlink.c b/usr/src/lib/libast/common/comp/symlink.c index 46f479c56f..fc0850e548 100644 --- a/usr/src/lib/libast/common/comp/symlink.c +++ b/usr/src/lib/libast/common/comp/symlink.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/syslog.c b/usr/src/lib/libast/common/comp/syslog.c index 7d552c7708..bf62295474 100644 --- a/usr/src/lib/libast/common/comp/syslog.c +++ b/usr/src/lib/libast/common/comp/syslog.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -43,7 +43,11 @@ Syslog_state_t log = { LOG_USER, -1, 0, ~0 }; static const Namval_t attempt[] = { +#if _UWIN + "/var/log/syslog", 0, +#endif "/dev/log", 0, + "var/log/syslog", 0, "lib/syslog/log", 0, "/dev/console", LOG_CONS, }; diff --git a/usr/src/lib/libast/common/comp/system.c b/usr/src/lib/libast/common/comp/system.c index 59adb526a3..91722fb77b 100644 --- a/usr/src/lib/libast/common/comp/system.c +++ b/usr/src/lib/libast/common/comp/system.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/tempnam.c b/usr/src/lib/libast/common/comp/tempnam.c index 05273af113..7b11525ea9 100644 --- a/usr/src/lib/libast/common/comp/tempnam.c +++ b/usr/src/lib/libast/common/comp/tempnam.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/tmpnam.c b/usr/src/lib/libast/common/comp/tmpnam.c index c10df67d52..21190586e3 100644 --- a/usr/src/lib/libast/common/comp/tmpnam.c +++ b/usr/src/lib/libast/common/comp/tmpnam.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/transition.c b/usr/src/lib/libast/common/comp/transition.c index bb9dce1c89..2656846315 100644 --- a/usr/src/lib/libast/common/comp/transition.c +++ b/usr/src/lib/libast/common/comp/transition.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/tsearch.c b/usr/src/lib/libast/common/comp/tsearch.c index 0882dddc8d..a47a14d9a7 100644 --- a/usr/src/lib/libast/common/comp/tsearch.c +++ b/usr/src/lib/libast/common/comp/tsearch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/unlink.c b/usr/src/lib/libast/common/comp/unlink.c index e2d073e01a..ccf1bff60f 100644 --- a/usr/src/lib/libast/common/comp/unlink.c +++ b/usr/src/lib/libast/common/comp/unlink.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/unsetenv.c b/usr/src/lib/libast/common/comp/unsetenv.c index efd6b66a16..1280abf5b6 100644 --- a/usr/src/lib/libast/common/comp/unsetenv.c +++ b/usr/src/lib/libast/common/comp/unsetenv.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/vfork.c b/usr/src/lib/libast/common/comp/vfork.c index eae503d715..cb6ce68021 100644 --- a/usr/src/lib/libast/common/comp/vfork.c +++ b/usr/src/lib/libast/common/comp/vfork.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/waitpid.c b/usr/src/lib/libast/common/comp/waitpid.c index d7cc7d175c..25c72ebed9 100644 --- a/usr/src/lib/libast/common/comp/waitpid.c +++ b/usr/src/lib/libast/common/comp/waitpid.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/wc.c b/usr/src/lib/libast/common/comp/wc.c index 53b70f04f7..2b53f5de23 100644 --- a/usr/src/lib/libast/common/comp/wc.c +++ b/usr/src/lib/libast/common/comp/wc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/wordexp.c b/usr/src/lib/libast/common/comp/wordexp.c index 3922160469..2adf720207 100644 --- a/usr/src/lib/libast/common/comp/wordexp.c +++ b/usr/src/lib/libast/common/comp/wordexp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/comp/wordexp.h b/usr/src/lib/libast/common/comp/wordexp.h index 1b0a0cc74c..e63b85a60a 100644 --- a/usr/src/lib/libast/common/comp/wordexp.h +++ b/usr/src/lib/libast/common/comp/wordexp.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/dir/dirlib.h b/usr/src/lib/libast/common/dir/dirlib.h index d98d24d6e5..21ebe2b21e 100644 --- a/usr/src/lib/libast/common/dir/dirlib.h +++ b/usr/src/lib/libast/common/dir/dirlib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/dir/getdents.c b/usr/src/lib/libast/common/dir/getdents.c index f2c82e2657..e17ceb4a50 100644 --- a/usr/src/lib/libast/common/dir/getdents.c +++ b/usr/src/lib/libast/common/dir/getdents.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/dir/opendir.c b/usr/src/lib/libast/common/dir/opendir.c index c45e48f671..e8d37f8a98 100644 --- a/usr/src/lib/libast/common/dir/opendir.c +++ b/usr/src/lib/libast/common/dir/opendir.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/dir/readdir.c b/usr/src/lib/libast/common/dir/readdir.c index 3dc095b01f..6c8f81c471 100644 --- a/usr/src/lib/libast/common/dir/readdir.c +++ b/usr/src/lib/libast/common/dir/readdir.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/dir/rewinddir.c b/usr/src/lib/libast/common/dir/rewinddir.c index 6467b586a7..2bf0515e2a 100644 --- a/usr/src/lib/libast/common/dir/rewinddir.c +++ b/usr/src/lib/libast/common/dir/rewinddir.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/dir/seekdir.c b/usr/src/lib/libast/common/dir/seekdir.c index 9d254ab585..9aa81635b4 100644 --- a/usr/src/lib/libast/common/dir/seekdir.c +++ b/usr/src/lib/libast/common/dir/seekdir.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/dir/telldir.c b/usr/src/lib/libast/common/dir/telldir.c index d96314aba0..1fd9036996 100644 --- a/usr/src/lib/libast/common/dir/telldir.c +++ b/usr/src/lib/libast/common/dir/telldir.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/memfatal.c b/usr/src/lib/libast/common/disc/memfatal.c index adba253257..94aec989f7 100644 --- a/usr/src/lib/libast/common/disc/memfatal.c +++ b/usr/src/lib/libast/common/disc/memfatal.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -72,7 +72,8 @@ memfatal(void) { Vmdisc_t* disc; - if (disc = vmdisc(Vmheap, NiL)) + malloc(0); + if (disc = vmdisc(Vmregion, NiL)) disc->exceptf = nomalloc; } diff --git a/usr/src/lib/libast/common/disc/sfdcdio.c b/usr/src/lib/libast/common/disc/sfdcdio.c index 806b35ef74..142a66f917 100644 --- a/usr/src/lib/libast/common/disc/sfdcdio.c +++ b/usr/src/lib/libast/common/disc/sfdcdio.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfdcdos.c b/usr/src/lib/libast/common/disc/sfdcdos.c index e1e42bd624..3587bbae89 100644 --- a/usr/src/lib/libast/common/disc/sfdcdos.c +++ b/usr/src/lib/libast/common/disc/sfdcdos.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfdcfilter.c b/usr/src/lib/libast/common/disc/sfdcfilter.c index 83f0e6e023..a850d0c7cf 100644 --- a/usr/src/lib/libast/common/disc/sfdcfilter.c +++ b/usr/src/lib/libast/common/disc/sfdcfilter.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfdchdr.h b/usr/src/lib/libast/common/disc/sfdchdr.h index ed8ccbe62a..1cfa62a27e 100644 --- a/usr/src/lib/libast/common/disc/sfdchdr.h +++ b/usr/src/lib/libast/common/disc/sfdchdr.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfdcmore.c b/usr/src/lib/libast/common/disc/sfdcmore.c index 6b79a10f2a..0857011bc0 100644 --- a/usr/src/lib/libast/common/disc/sfdcmore.c +++ b/usr/src/lib/libast/common/disc/sfdcmore.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfdcprefix.c b/usr/src/lib/libast/common/disc/sfdcprefix.c index daab181964..db6ecbf9bc 100644 --- a/usr/src/lib/libast/common/disc/sfdcprefix.c +++ b/usr/src/lib/libast/common/disc/sfdcprefix.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfdcseekable.c b/usr/src/lib/libast/common/disc/sfdcseekable.c index caaa94e34d..57214ea2f7 100644 --- a/usr/src/lib/libast/common/disc/sfdcseekable.c +++ b/usr/src/lib/libast/common/disc/sfdcseekable.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfdcslow.c b/usr/src/lib/libast/common/disc/sfdcslow.c index 5e96b890de..ec50275eff 100644 --- a/usr/src/lib/libast/common/disc/sfdcslow.c +++ b/usr/src/lib/libast/common/disc/sfdcslow.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfdcsubstr.c b/usr/src/lib/libast/common/disc/sfdcsubstr.c index f166ed7201..3e393c47b8 100644 --- a/usr/src/lib/libast/common/disc/sfdcsubstr.c +++ b/usr/src/lib/libast/common/disc/sfdcsubstr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfdctee.c b/usr/src/lib/libast/common/disc/sfdctee.c index adccfbc377..53940f8346 100644 --- a/usr/src/lib/libast/common/disc/sfdctee.c +++ b/usr/src/lib/libast/common/disc/sfdctee.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfdcunion.c b/usr/src/lib/libast/common/disc/sfdcunion.c index 6565fe0e6b..95fdbea623 100644 --- a/usr/src/lib/libast/common/disc/sfdcunion.c +++ b/usr/src/lib/libast/common/disc/sfdcunion.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfkeyprintf.c b/usr/src/lib/libast/common/disc/sfkeyprintf.c index 6abe2a0f11..12aec244ea 100644 --- a/usr/src/lib/libast/common/disc/sfkeyprintf.c +++ b/usr/src/lib/libast/common/disc/sfkeyprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/disc/sfstrtmp.c b/usr/src/lib/libast/common/disc/sfstrtmp.c index e970b8be76..965a8470ec 100644 --- a/usr/src/lib/libast/common/disc/sfstrtmp.c +++ b/usr/src/lib/libast/common/disc/sfstrtmp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/features/align.c b/usr/src/lib/libast/common/features/align.c index 9220ef1280..800052a5de 100644 --- a/usr/src/lib/libast/common/features/align.c +++ b/usr/src/lib/libast/common/features/align.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/features/botch.c b/usr/src/lib/libast/common/features/botch.c index 490d70b35d..c45f5806f4 100644 --- a/usr/src/lib/libast/common/features/botch.c +++ b/usr/src/lib/libast/common/features/botch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/features/common b/usr/src/lib/libast/common/features/common index ebb697fedb..75b4b2489e 100644 --- a/usr/src/lib/libast/common/features/common +++ b/usr/src/lib/libast/common/features/common @@ -425,7 +425,15 @@ tst - -DTRY=1 - -DTRY=1 -Dvoid=char - -DTRY=2 - -DTRY=3 - -DTRY=4 output{ main() { int r; + printf("\n#ifndef va_listref\n"); + printf("#ifndef va_start\n"); + printf("#if __STD_C\n"); + printf("#include <stdarg.h>\n"); + printf("#else\n"); + printf("#include <varargs.h>\n"); + printf("#endif\n"); + printf("#endif\n"); #if TRY == 4 printf("#define va_listref(p) (&(p))\t"); printf("/* pass va_list to varargs function */\n"); @@ -478,14 +486,6 @@ tst - -DTRY=1 - -DTRY=1 -Dvoid=char - -DTRY=2 - -DTRY=3 - -DTRY=4 output{ #endif #endif - printf("#ifndef va_start\n"); - printf("#if __STD_C\n"); - printf("#include <stdarg.h>\n"); - printf("#else\n"); - printf("#include <varargs.h>\n"); - printf("#endif\n"); - printf("#endif\n"); - printf("#endif\n"); return 0; } diff --git a/usr/src/lib/libast/common/features/fcntl.c b/usr/src/lib/libast/common/features/fcntl.c index fa0f8c8ee0..e761889788 100644 --- a/usr/src/lib/libast/common/features/fcntl.c +++ b/usr/src/lib/libast/common/features/fcntl.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/features/float b/usr/src/lib/libast/common/features/float index 5125e5ddc2..de27bb235b 100644 --- a/usr/src/lib/libast/common/features/float +++ b/usr/src/lib/libast/common/features/float @@ -952,7 +952,11 @@ tst - -DN=1 - -DN=2 note{ _ast_fltmax_t maximum integral type }end output{ } }end -tst - -DSCAN=1 - -lm -DSTRTO=1 - -DDIV=1 - -DEXP=1 - -DADD=1 - -DMPY=1 note{ INF and NAN memory representations }end output{ +tst - -DSCAN=1 - -lm -DSTRTO=1 - -DMAC=1 - -DDIV=1 - -DEXP=1 - -DADD=1 - -DMPY=1 note{ INF and NAN memory representations }end output{ + #if MAC + #define _AIX_COMPATIBILITY 1 + #define _FP_MODE_VARIABLE 1 + #endif #include "FEATURE/common" #include <stdio.h> #include <sys/types.h> @@ -1104,7 +1108,13 @@ tst - -DSCAN=1 - -lm -DSTRTO=1 - -DDIV=1 - -DEXP=1 - -DADD=1 - -DMPY=1 note{ INF #if MPY f *= 2; #endif + #if MAC + f = FLT_QNAN; + #endif list("flt", "nan", &f, sizeof(f)); + #if MAC + f = FLT_INFINITY; + #endif list("flt", "inf", &f, sizeof(f)); #endif } @@ -1131,7 +1141,13 @@ tst - -DSCAN=1 - -lm -DSTRTO=1 - -DDIV=1 - -DEXP=1 - -DADD=1 - -DMPY=1 note{ INF #if MPY f *= 2; #endif + #if MAC + f = DBL_QNAN; + #endif list("dbl", "nan", &f, sizeof(f)); + #if MAC + f = DBL_INFINITY; + #endif list("dbl", "inf", &f, sizeof(f)); #endif } @@ -1158,7 +1174,13 @@ tst - -DSCAN=1 - -lm -DSTRTO=1 - -DDIV=1 - -DEXP=1 - -DADD=1 - -DMPY=1 note{ INF #if MPY f *= 2; #endif + #if MAC + f = LDBL_QNAN; + #endif list("ldbl", "nan", &f, sizeof(f)); + #if MAC + f = LDBL_INFINITY; + #endif list("ldbl", "inf", &f, sizeof(f)); #endif } diff --git a/usr/src/lib/libast/common/features/lib b/usr/src/lib/libast/common/features/lib index 8795cefa05..d2a41d7b61 100644 --- a/usr/src/lib/libast/common/features/lib +++ b/usr/src/lib/libast/common/features/lib @@ -453,6 +453,15 @@ tst lib_memccpy string.h unistd.h stdlib.h fcntl.h signal.h sys/types.h sys/stat size_t siz; int i; #endif + + #if defined(__ia64) || defined(__ia64__) || defined(__itanium__) + /* + * 0 faith that the itanium coders will ever get this right + * prove me wrong + */ + + return 1; + #endif /* * early mac osx failed here -- fixed 3Q 2001 diff --git a/usr/src/lib/libast/common/features/libpath.sh b/usr/src/lib/libast/common/features/libpath.sh index 22aaee01a6..fa9ca95daa 100644 --- a/usr/src/lib/libast/common/features/libpath.sh +++ b/usr/src/lib/libast/common/features/libpath.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1985-2008 AT&T Intellectual Property # +# Copyright (c) 1985-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libast/common/features/limits.c b/usr/src/lib/libast/common/features/limits.c index 57f41bea1b..51965f6fac 100644 --- a/usr/src/lib/libast/common/features/limits.c +++ b/usr/src/lib/libast/common/features/limits.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/features/map.c b/usr/src/lib/libast/common/features/map.c index e647b62797..373706f048 100644 --- a/usr/src/lib/libast/common/features/map.c +++ b/usr/src/lib/libast/common/features/map.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -187,6 +187,8 @@ main() printf("#define pathposix _ast_pathposix\n"); printf("#undef pathprobe\n"); printf("#define pathprobe _ast_pathprobe\n"); + printf("#undef pathprog\n"); + printf("#define pathprog _ast_pathprog\n"); printf("#undef pathrepl\n"); printf("#define pathrepl _ast_pathrepl\n"); printf("#undef pathsetlink\n"); diff --git a/usr/src/lib/libast/common/features/mode.c b/usr/src/lib/libast/common/features/mode.c index 79f42f620f..ea82970e78 100644 --- a/usr/src/lib/libast/common/features/mode.c +++ b/usr/src/lib/libast/common/features/mode.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/features/param.sh b/usr/src/lib/libast/common/features/param.sh index 6ac2dae5ee..b58ebfc9ac 100644 --- a/usr/src/lib/libast/common/features/param.sh +++ b/usr/src/lib/libast/common/features/param.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1985-2008 AT&T Intellectual Property # +# Copyright (c) 1985-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libast/common/features/preroot.sh b/usr/src/lib/libast/common/features/preroot.sh index 340ffd68d0..44e8596ad9 100644 --- a/usr/src/lib/libast/common/features/preroot.sh +++ b/usr/src/lib/libast/common/features/preroot.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1985-2008 AT&T Intellectual Property # +# Copyright (c) 1985-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libast/common/features/sfinit.c b/usr/src/lib/libast/common/features/sfinit.c index 82bb7a1f66..5a47c3e76c 100644 --- a/usr/src/lib/libast/common/features/sfinit.c +++ b/usr/src/lib/libast/common/features/sfinit.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/features/sig.sh b/usr/src/lib/libast/common/features/sig.sh index ce00815fe1..b67b2b1f3b 100644 --- a/usr/src/lib/libast/common/features/sig.sh +++ b/usr/src/lib/libast/common/features/sig.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1985-2008 AT&T Intellectual Property # +# Copyright (c) 1985-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libast/common/features/signal.c b/usr/src/lib/libast/common/features/signal.c index 1bce5eeb2f..f3c89f3574 100644 --- a/usr/src/lib/libast/common/features/signal.c +++ b/usr/src/lib/libast/common/features/signal.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/features/standards b/usr/src/lib/libast/common/features/standards index 9250fae63e..adee277e20 100644 --- a/usr/src/lib/libast/common/features/standards +++ b/usr/src/lib/libast/common/features/standards @@ -1,3 +1,4 @@ +set stdio if tst note{ _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{ #define _ALL_SOURCE 1 #define _ISOC99_SOURCE 1 @@ -33,6 +34,37 @@ if tst note{ _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _X #define __EXTENSIONS__ 1 #endif } +elif tst note{ _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{ + #define _ALL_SOURCE 1 + #define _ISOC99_SOURCE 1 + #define _POSIX_SOURCE 1 + #define _XOPEN_SOURCE 9900 + #define _GNU_SOURCE 1 + #define __EXTENSIONS__ 1 + #include <sys/types.h> + #include <sys/stat.h> + #include <stdlib.h> + #include <unistd.h> + }end { + #ifndef _ALL_SOURCE + #define _ALL_SOURCE 1 + #endif + #ifndef _ISOC99_SOURCE + #define _ISOC99_SOURCE 1 + #endif + #ifndef _POSIX_SOURCE + #define _POSIX_SOURCE 1 + #endif + #ifndef _XOPEN_SOURCE + #define _XOPEN_SOURCE 9900 + #endif + #ifndef _GNU_SOURCE + #define _GNU_SOURCE 1 + #endif + #ifndef __EXTENSIONS__ + #define __EXTENSIONS__ 1 + #endif + } elif tst note{ _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{ #define _ISOC99_SOURCE 1 #define _POSIX_SOURCE 1 diff --git a/usr/src/lib/libast/common/features/sys b/usr/src/lib/libast/common/features/sys index 3e30180cbf..87ad1e5f4a 100644 --- a/usr/src/lib/libast/common/features/sys +++ b/usr/src/lib/libast/common/features/sys @@ -45,7 +45,6 @@ header unistd.h header limits.h header fcntl.h header locale.h -header sys/localedef.h typ dev_t,nlink_t fail{ echo "#ifndef $m" diff --git a/usr/src/lib/libast/common/features/tmx b/usr/src/lib/libast/common/features/tmx index 6db5dbcc52..ebf5c0ff81 100644 --- a/usr/src/lib/libast/common/features/tmx +++ b/usr/src/lib/libast/common/features/tmx @@ -86,12 +86,14 @@ cat{ #endif extern Time_t tmxdate(const char*, char**, Time_t); + extern Time_t tmxduration(const char*, char**); extern char* tmxfmt(char*, size_t, const char*, Time_t); extern Time_t tmxleap(Time_t); extern Tm_t* tmxmake(Time_t); extern Time_t tmxscan(const char*, char**, const char*, char**, Time_t, long); extern int tmxsleep(Time_t); extern Time_t tmxtime(Tm_t*, int); + extern Tm_t* tmxtm(Tm_t*, Time_t, Tm_zone_t*); extern Time_t tmxgettime(void); extern int tmxsettime(Time_t); diff --git a/usr/src/lib/libast/common/features/uwin b/usr/src/lib/libast/common/features/uwin index 8c4640fcc9..9ff3ab078f 100644 --- a/usr/src/lib/libast/common/features/uwin +++ b/usr/src/lib/libast/common/features/uwin @@ -1,6 +1,6 @@ lib a64l,acosh,asinh,atanh,cbrt,ceil,crypt,erf,exp,expm1,floor lib gamma,getpass,lgamma,log,log1p,random,rcmd,rint,srand48 lib copysign,logb,finite,drem,sqrt,ilogb,remainder,scalb -lib _copysign,_finite,_scalb,__iob_func,_p__iob +lib _copysign,_finite,_scalb,__iob_func,_p__iob,__p__iob dat _iob diff --git a/usr/src/lib/libast/common/features/vmalloc b/usr/src/lib/libast/common/features/vmalloc index cc33c8f81f..2ef415cd2b 100644 --- a/usr/src/lib/libast/common/features/vmalloc +++ b/usr/src/lib/libast/common/features/vmalloc @@ -116,6 +116,9 @@ lib alloca note{ alloca exists }end link{ }end tst mal_alloca note{ alloca is based on malloc() }end execute{ + #if __CYGWIN__ + int main() { return 1; } + #else #if _hdr_alloca #include <alloca.h> #endif @@ -131,6 +134,7 @@ tst mal_alloca note{ alloca is based on malloc() }end execute{ { alloca(10); return 1; } + #endif }end tst stk_down note{ stack grows downward }end execute{ diff --git a/usr/src/lib/libast/common/hash/hashalloc.c b/usr/src/lib/libast/common/hash/hashalloc.c index e9be11083e..0dba5e6c19 100644 --- a/usr/src/lib/libast/common/hash/hashalloc.c +++ b/usr/src/lib/libast/common/hash/hashalloc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/hashdump.c b/usr/src/lib/libast/common/hash/hashdump.c index ee96b88d53..c453a40c0c 100644 --- a/usr/src/lib/libast/common/hash/hashdump.c +++ b/usr/src/lib/libast/common/hash/hashdump.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/hashfree.c b/usr/src/lib/libast/common/hash/hashfree.c index 14fd4e6bcd..f01337e1cf 100644 --- a/usr/src/lib/libast/common/hash/hashfree.c +++ b/usr/src/lib/libast/common/hash/hashfree.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/hashlast.c b/usr/src/lib/libast/common/hash/hashlast.c index e3459fd89a..6457a1a1ab 100644 --- a/usr/src/lib/libast/common/hash/hashlast.c +++ b/usr/src/lib/libast/common/hash/hashlast.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/hashlib.h b/usr/src/lib/libast/common/hash/hashlib.h index 8ca9d17e17..34e61d6afb 100644 --- a/usr/src/lib/libast/common/hash/hashlib.h +++ b/usr/src/lib/libast/common/hash/hashlib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/hashlook.c b/usr/src/lib/libast/common/hash/hashlook.c index b5292f94c0..99dec30ecc 100644 --- a/usr/src/lib/libast/common/hash/hashlook.c +++ b/usr/src/lib/libast/common/hash/hashlook.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/hashscan.c b/usr/src/lib/libast/common/hash/hashscan.c index 313ebd3957..9294ee6356 100644 --- a/usr/src/lib/libast/common/hash/hashscan.c +++ b/usr/src/lib/libast/common/hash/hashscan.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/hashsize.c b/usr/src/lib/libast/common/hash/hashsize.c index 62e363085c..0016cec631 100644 --- a/usr/src/lib/libast/common/hash/hashsize.c +++ b/usr/src/lib/libast/common/hash/hashsize.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/hashview.c b/usr/src/lib/libast/common/hash/hashview.c index 6da2ab3179..161a2ae38f 100644 --- a/usr/src/lib/libast/common/hash/hashview.c +++ b/usr/src/lib/libast/common/hash/hashview.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/hashwalk.c b/usr/src/lib/libast/common/hash/hashwalk.c index 90fc6201df..c98f764d4a 100644 --- a/usr/src/lib/libast/common/hash/hashwalk.c +++ b/usr/src/lib/libast/common/hash/hashwalk.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/memhash.c b/usr/src/lib/libast/common/hash/memhash.c index d045c9b4a4..e293e2bb86 100644 --- a/usr/src/lib/libast/common/hash/memhash.c +++ b/usr/src/lib/libast/common/hash/memhash.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/memsum.c b/usr/src/lib/libast/common/hash/memsum.c index ce59e6dd52..6fad3b6f10 100644 --- a/usr/src/lib/libast/common/hash/memsum.c +++ b/usr/src/lib/libast/common/hash/memsum.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/strhash.c b/usr/src/lib/libast/common/hash/strhash.c index f993b0dae7..da88165683 100644 --- a/usr/src/lib/libast/common/hash/strhash.c +++ b/usr/src/lib/libast/common/hash/strhash.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/strkey.c b/usr/src/lib/libast/common/hash/strkey.c index 57176e9581..00932cc02e 100644 --- a/usr/src/lib/libast/common/hash/strkey.c +++ b/usr/src/lib/libast/common/hash/strkey.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/hash/strsum.c b/usr/src/lib/libast/common/hash/strsum.c index 2c4d302777..f45e61f485 100644 --- a/usr/src/lib/libast/common/hash/strsum.c +++ b/usr/src/lib/libast/common/hash/strsum.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/ast.h b/usr/src/lib/libast/common/include/ast.h index ec3834159a..f9c99e866c 100644 --- a/usr/src/lib/libast/common/include/ast.h +++ b/usr/src/lib/libast/common/include/ast.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -176,7 +176,7 @@ typedef struct #define mbcoll() (ast.mb_xfrm!=0) #define mbwide() (mbmax()>1) -#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p++,ast.tmp_int)):(*(unsigned char*)(p++))) +#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p+=ast.mb_sync+1,ast.tmp_int)):(*(unsigned char*)(p++))) #define mbinit() (mbwide()?(*ast.mb_towc)((wchar_t*)0,(char*)0,mbmax()):0) #define mbsize(p) (mbwide()?(*ast.mb_len)((char*)(p),mbmax()):((p),1)) #define mbconv(s,w) (ast.mb_conv?(*ast.mb_conv)(s,w):((*(s)=(w)),1)) @@ -291,6 +291,7 @@ extern size_t pathnative(const char*, char*, size_t); extern char* pathpath(char*, const char*, const char*, int); extern size_t pathposix(const char*, char*, size_t); extern char* pathprobe(char*, char*, const char*, const char*, const char*, int); +extern size_t pathprog(const char*, char*, size_t); extern char* pathrepl(char*, const char*, const char*); extern int pathsetlink(const char*, const char*); extern char* pathshell(void); @@ -311,6 +312,7 @@ extern int strmatch(const char*, const char*); extern int strmode(const char*); extern int strnacmp(const char*, const char*, size_t); extern char* strncopy(char*, const char*, size_t); +extern int strnpcmp(const char*, const char*, size_t); extern double strntod(const char*, size_t, char**); extern _ast_fltmax_t strntold(const char*, size_t, char**); extern long strntol(const char*, size_t, char**, int); @@ -319,7 +321,9 @@ extern long strnton(const char*, size_t, char**, char*, int); extern unsigned long strntoul(const char*, size_t, char**, int); extern intmax_t strntonll(const char*, size_t, char**, char*, int); extern uintmax_t strntoull(const char*, size_t, char**, int); +extern int strnvcmp(const char*, const char*, size_t); extern int stropt(const char*, const void*, int, int(*)(void*, const void*, int, const char*), void*); +extern int strpcmp(const char*, const char*); extern int strperm(const char*, char**, int); extern void* strpsearch(const void*, size_t, size_t, const char*, char**); extern void* strsearch(const void*, size_t, size_t, Strcmp_f, const char*, void*); @@ -332,6 +336,7 @@ extern long strton(const char*, char**, char*, int); extern intmax_t strtonll(const char*, char**, char*, int); extern int struid(const char*); extern int struniq(char**, int); +extern int strvcmp(const char*, const char*); #undef extern diff --git a/usr/src/lib/libast/common/include/ast_dir.h b/usr/src/lib/libast/common/include/ast_dir.h index ead03c1eee..672ce007f7 100644 --- a/usr/src/lib/libast/common/include/ast_dir.h +++ b/usr/src/lib/libast/common/include/ast_dir.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/ast_getopt.h b/usr/src/lib/libast/common/include/ast_getopt.h index b1d262670f..85e2b2b0ee 100644 --- a/usr/src/lib/libast/common/include/ast_getopt.h +++ b/usr/src/lib/libast/common/include/ast_getopt.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/ast_std.h b/usr/src/lib/libast/common/include/ast_std.h index b9ae148c62..11c01b3776 100644 --- a/usr/src/lib/libast/common/include/ast_std.h +++ b/usr/src/lib/libast/common/include/ast_std.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -107,22 +107,27 @@ struct lconv #define extern __EXPORT__ #endif +#if !_UWIN /* for ast54 compatibility */ + #undef getenv #define getenv _ast_getenv +#undef setenviron +#define setenviron _ast_setenviron + +extern char* getenv(const char*); + +#endif + #undef localeconv #define localeconv _ast_localeconv #undef setlocale #define setlocale _ast_setlocale -#undef setenviron -#define setenviron _ast_setenviron - #undef strerror #define strerror _ast_strerror -extern char* getenv(const char*); extern struct lconv* localeconv(void); extern char* setenviron(const char*); extern char* setlocale(int, const char*); @@ -149,6 +154,7 @@ extern char* strerror(int); #define AST_LC_MEASUREMENT 12 #define AST_LC_PAPER 13 #define AST_LC_COUNT 14 +#define AST_LC_LANG 255 #define AST_LC_find (1L<<28) #define AST_LC_debug (1L<<29) @@ -197,6 +203,9 @@ extern char* strerror(int); #ifndef LC_PAPER #define LC_PAPER (-AST_LC_PAPER) #endif +#ifndef LC_LANG +#define LC_LANG (-AST_LC_LANG) +#endif #undef extern @@ -237,8 +246,9 @@ typedef struct int (*mb_conv)(char*, wchar_t); uint32_t env_serial; + uint32_t mb_sync; - char pad[944]; + char pad[940]; } _Ast_info_t; diff --git a/usr/src/lib/libast/common/include/ast_version.h b/usr/src/lib/libast/common/include/ast_version.h index 585bdce431..a15cf03d2c 100644 --- a/usr/src/lib/libast/common/include/ast_version.h +++ b/usr/src/lib/libast/common/include/ast_version.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -25,4 +25,4 @@ * AT&T Research */ -#define _AST_VERSION 20080910L +#define _AST_VERSION 20090202L diff --git a/usr/src/lib/libast/common/include/ast_windows.h b/usr/src/lib/libast/common/include/ast_windows.h index da18e66cc6..4bbd94bab5 100644 --- a/usr/src/lib/libast/common/include/ast_windows.h +++ b/usr/src/lib/libast/common/include/ast_windows.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/ccode.h b/usr/src/lib/libast/common/include/ccode.h index c4312af2e9..9c33ce2cc7 100644 --- a/usr/src/lib/libast/common/include/ccode.h +++ b/usr/src/lib/libast/common/include/ccode.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/cdt.h b/usr/src/lib/libast/common/include/cdt.h index 3dc5b7b7f8..f2f0389296 100644 --- a/usr/src/lib/libast/common/include/cdt.h +++ b/usr/src/lib/libast/common/include/cdt.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/cmdarg.h b/usr/src/lib/libast/common/include/cmdarg.h index 07307edc9f..3dbaf20e83 100644 --- a/usr/src/lib/libast/common/include/cmdarg.h +++ b/usr/src/lib/libast/common/include/cmdarg.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/debug.h b/usr/src/lib/libast/common/include/debug.h index e0637d2f46..76c21ca069 100644 --- a/usr/src/lib/libast/common/include/debug.h +++ b/usr/src/lib/libast/common/include/debug.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -46,14 +46,17 @@ #define DEBUG_ASSERT(p) ((p) ? 0 : (debug_fatal(__FILE__, __LINE__),0)) #define DEBUG_COUNT(n) ((n) += 1) #define DEBUG_TALLY(c,n,v) ((c) ? ((n) += (v)) : (n)) +#define DEBUG_INCREASE(n) ((n) += 1) +#define DEBUG_DECREASE(n) ((n) -= 1) #define DEBUG_DECLARE(t,v) t v #define DEBUG_SET(n,v) ((n) = (v)) #define DEBUG_PRINT(fd,s,v) do {char _b[1024];write(fd,_b,sfsprintf(_b,sizeof(_b),s,v));} while(0) #define DEBUG_WRITE(fd,d,n) write((fd),(d),(n)) #define DEBUG_TEMP(temp) (temp) /* debugging stuff that should be removed */ -#define DEBUG_RETURN(x) (debug_fatal(__FILE__, __LINE__), (x)) -#define DEBUG_BREAK (debug_fatal(__FILE__, __LINE__)) +#define DEBUG_BREAK break +#define DEBUG_CONTINUE continue #define DEBUG_GOTO(label) do { debug_fatal(__FILE__, __LINE__); goto label; } while(0) +#define DEBUG_RETURN(x) do { debug_fatal(__FILE__, __LINE__); return(x); } while(0) #else @@ -66,15 +69,31 @@ #define DEBUG_ASSERT(p) #define DEBUG_COUNT(n) #define DEBUG_TALLY(c,n,v) +#define DEBUG_INCREASE(n) +#define DEBUG_DECREASE(n) #define DEBUG_DECLARE(t,v) #define DEBUG_SET(n,v) #define DEBUG_PRINT(fd,s,v) #define DEBUG_WRITE(fd,d,n) -#define DEBUG_KPV(x) -#define DEBUG_RETURN(x) return(x) +#define DEBUG_TEMP(x) #define DEBUG_BREAK break +#define DEBUG_CONTINUE continue #define DEBUG_GOTO(label) goto label +#define DEBUG_RETURN(x) return(x) + +#endif +#ifndef BREAK +#define BREAK DEBUG_BREAK +#endif +#ifndef CONTINUE +#define CONTINUE DEBUG_CONTINUE +#endif +#ifndef GOTO +#define GOTO(label) DEBUG_GOTO(label) +#endif +#ifndef RETURN +#define RETURN(x) DEBUG_RETURN(x) #endif #if _BLD_ast && defined(__EXPORT__) diff --git a/usr/src/lib/libast/common/include/dt.h b/usr/src/lib/libast/common/include/dt.h index 54824790c6..b0bb7c54db 100644 --- a/usr/src/lib/libast/common/include/dt.h +++ b/usr/src/lib/libast/common/include/dt.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/error.h b/usr/src/lib/libast/common/include/error.h index e10f80d69f..848f760817 100644 --- a/usr/src/lib/libast/common/include/error.h +++ b/usr/src/lib/libast/common/include/error.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/find.h b/usr/src/lib/libast/common/include/find.h index 46946a1d08..b7d5810202 100644 --- a/usr/src/lib/libast/common/include/find.h +++ b/usr/src/lib/libast/common/include/find.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/fnv.h b/usr/src/lib/libast/common/include/fnv.h index 89c39598f4..743b6c26fe 100644 --- a/usr/src/lib/libast/common/include/fnv.h +++ b/usr/src/lib/libast/common/include/fnv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/fs3d.h b/usr/src/lib/libast/common/include/fs3d.h index acedc1b017..37338ab898 100644 --- a/usr/src/lib/libast/common/include/fs3d.h +++ b/usr/src/lib/libast/common/include/fs3d.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -95,13 +95,16 @@ #define FS3D_SIZE(n) ((n)<<4) #define FS3D_SIZEOF(n) ((n)>>4) -extern int mount(const char*, char*, int, void*); +#if !_BLD_3d +#define mount(s,t,f,d) fs3d_mount(s,t,f,d) +#endif #if _BLD_ast && defined(__EXPORT__) #define extern __EXPORT__ #endif extern int fs3d(int); +extern int fs3d_mount(const char*, char*, int, void*); extern char* pathnext(char*, char*, long*); #undef extern diff --git a/usr/src/lib/libast/common/include/fts.h b/usr/src/lib/libast/common/include/fts.h index 3464b1fc7d..8425145c35 100644 --- a/usr/src/lib/libast/common/include/fts.h +++ b/usr/src/lib/libast/common/include/fts.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -112,16 +112,21 @@ struct Ftsent long fts_number; /* local numeric value */ int fts_errno; /* errno for this entry */ unsigned short fts_info; /* info flags */ - unsigned short fts_namelen; /* strlen(fts_name) */ - unsigned short fts_pathlen; /* strlen(fts_path) */ - short fts_level; /* file tree depth, 0 at top */ + + unsigned short _fts_namelen; /* old fts_namelen */ + unsigned short _fts_pathlen; /* old fts_pathlen */ + short _fts_level; /* old fts_level */ + + short _fts_status; /* <ftwalk.h> compatibility */ + struct stat _fts_statb; /* <ftwalk.h> compatibility */ + + FTS* fts; /* fts_open() handle */ + size_t fts_namelen; /* strlen(fts_name) */ + size_t fts_pathlen; /* strlen(fts_path) */ + ssize_t fts_level; /* file tree depth, 0 at top */ #ifdef _FTSENT_PRIVATE_ _FTSENT_PRIVATE_ -#else - short _fts_pad_1; /* <ftwalk.h> compatibility */ - struct stat _fts_pad_2; /* <ftwalk.h> compatibility */ - FTS* fts; /* fts_open() handle */ #endif }; diff --git a/usr/src/lib/libast/common/include/ftwalk.h b/usr/src/lib/libast/common/include/ftwalk.h index f7b1216061..9557c1ea51 100644 --- a/usr/src/lib/libast/common/include/ftwalk.h +++ b/usr/src/lib/libast/common/include/ftwalk.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -43,6 +43,8 @@ #define fts_parent parent #define fts_path path #define fts_pathlen pathlen +#define _fts_status status +#define _fts_statb statb #define FTSENT Ftw_t /* <fts.h> internal */ #define Ftsent FTW /* <fts.h> internal */ @@ -54,10 +56,6 @@ void* pointer; /* local pointer value */ \ } local; -#define _FTSENT_PRIVATE_ /* fts internal */ \ - short status; /* internal status */ \ - struct stat statb; /* fts_statp data */ - #include <fts.h> /* diff --git a/usr/src/lib/libast/common/include/glob.h b/usr/src/lib/libast/common/include/glob.h index 5469884213..1554c435e1 100644 --- a/usr/src/lib/libast/common/include/glob.h +++ b/usr/src/lib/libast/common/include/glob.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/hash.h b/usr/src/lib/libast/common/include/hash.h index 50ea5e1831..e118141c05 100644 --- a/usr/src/lib/libast/common/include/hash.h +++ b/usr/src/lib/libast/common/include/hash.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/hashkey.h b/usr/src/lib/libast/common/include/hashkey.h index f47c53a64a..55158d62fe 100644 --- a/usr/src/lib/libast/common/include/hashkey.h +++ b/usr/src/lib/libast/common/include/hashkey.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/hashpart.h b/usr/src/lib/libast/common/include/hashpart.h index c12f9bd396..898fdbb674 100644 --- a/usr/src/lib/libast/common/include/hashpart.h +++ b/usr/src/lib/libast/common/include/hashpart.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/ip6.h b/usr/src/lib/libast/common/include/ip6.h index 4a7f2df01e..37de82c03c 100644 --- a/usr/src/lib/libast/common/include/ip6.h +++ b/usr/src/lib/libast/common/include/ip6.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/ls.h b/usr/src/lib/libast/common/include/ls.h index 7fe969071b..b3d49d3e5b 100644 --- a/usr/src/lib/libast/common/include/ls.h +++ b/usr/src/lib/libast/common/include/ls.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -67,8 +67,8 @@ #define LS_USER (1<<10) /* first user flag bit */ #define LS_W_BLOCKS 6 /* LS_BLOCKS field width */ -#define LS_W_INUMBER 7 /* LS_INUMBER field width */ -#define LS_W_LONG 55 /* LS_LONG width (w/o names) */ +#define LS_W_INUMBER 9 /* LS_INUMBER field width */ +#define LS_W_LONG 57 /* LS_LONG width (w/o names) */ #define LS_W_LINK 4 /* link text width (w/o names) */ #define LS_W_MARK 1 /* LS_MARK field width */ #define LS_W_NAME 9 /* group|user name field width */ diff --git a/usr/src/lib/libast/common/include/magic.h b/usr/src/lib/libast/common/include/magic.h index b6827316c5..c143d4ed1f 100644 --- a/usr/src/lib/libast/common/include/magic.h +++ b/usr/src/lib/libast/common/include/magic.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/magicid.h b/usr/src/lib/libast/common/include/magicid.h index 65fbdbfab7..3b5acf7812 100644 --- a/usr/src/lib/libast/common/include/magicid.h +++ b/usr/src/lib/libast/common/include/magicid.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/mc.h b/usr/src/lib/libast/common/include/mc.h index e4d8fd049d..b66e42e54b 100644 --- a/usr/src/lib/libast/common/include/mc.h +++ b/usr/src/lib/libast/common/include/mc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/mime.h b/usr/src/lib/libast/common/include/mime.h index e50929ed82..114e178475 100644 --- a/usr/src/lib/libast/common/include/mime.h +++ b/usr/src/lib/libast/common/include/mime.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/mnt.h b/usr/src/lib/libast/common/include/mnt.h index 1e03907f0b..08400acd94 100644 --- a/usr/src/lib/libast/common/include/mnt.h +++ b/usr/src/lib/libast/common/include/mnt.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/modecanon.h b/usr/src/lib/libast/common/include/modecanon.h index 4f51bdea96..058f50a89e 100644 --- a/usr/src/lib/libast/common/include/modecanon.h +++ b/usr/src/lib/libast/common/include/modecanon.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/modex.h b/usr/src/lib/libast/common/include/modex.h index f8d119ec64..675b2168e5 100644 --- a/usr/src/lib/libast/common/include/modex.h +++ b/usr/src/lib/libast/common/include/modex.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/namval.h b/usr/src/lib/libast/common/include/namval.h index d66647451e..f8f65ab2cb 100644 --- a/usr/src/lib/libast/common/include/namval.h +++ b/usr/src/lib/libast/common/include/namval.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/option.h b/usr/src/lib/libast/common/include/option.h index 874c06ff88..9e96ee7998 100644 --- a/usr/src/lib/libast/common/include/option.h +++ b/usr/src/lib/libast/common/include/option.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/proc.h b/usr/src/lib/libast/common/include/proc.h index 43bf3a1791..000f638b21 100644 --- a/usr/src/lib/libast/common/include/proc.h +++ b/usr/src/lib/libast/common/include/proc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/recfmt.h b/usr/src/lib/libast/common/include/recfmt.h index 65a58dfaf9..6d7999f263 100644 --- a/usr/src/lib/libast/common/include/recfmt.h +++ b/usr/src/lib/libast/common/include/recfmt.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/regex.h b/usr/src/lib/libast/common/include/regex.h index a1ecf9d4be..3e9400e8ed 100644 --- a/usr/src/lib/libast/common/include/regex.h +++ b/usr/src/lib/libast/common/include/regex.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -71,6 +71,8 @@ #define REG_SHELL_ESCAPED 0x00400000 /* \ not special */ #define REG_SHELL_PATH 0x00800000 /* explicit / match */ +#define REG_REGEXP 0x40000000 /* <regexp.h> compatibility */ + /* regexec flags */ #define REG_NOTBOL 0x00000040 /* ^ is not a special char */ diff --git a/usr/src/lib/libast/common/include/sfdisc.h b/usr/src/lib/libast/common/include/sfdisc.h index 0fdd0f297c..b7b0781e38 100644 --- a/usr/src/lib/libast/common/include/sfdisc.h +++ b/usr/src/lib/libast/common/include/sfdisc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/sfio.h b/usr/src/lib/libast/common/include/sfio.h index 11317dad65..3506f5c955 100644 --- a/usr/src/lib/libast/common/include/sfio.h +++ b/usr/src/lib/libast/common/include/sfio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -48,6 +48,7 @@ typedef ssize_t (*Sfread_f)_ARG_((Sfio_t*, Void_t*, size_t, Sfdisc_t*)); typedef ssize_t (*Sfwrite_f)_ARG_((Sfio_t*, const Void_t*, size_t, Sfdisc_t*)); typedef Sfoff_t (*Sfseek_f)_ARG_((Sfio_t*, Sfoff_t, int, Sfdisc_t*)); typedef int (*Sfexcept_f)_ARG_((Sfio_t*, int, Void_t*, Sfdisc_t*)); +typedef int (*Sfwalk_f)_ARG_((Sfio_t*, Void_t*)); /* discipline structure */ struct _sfdisc_s @@ -232,6 +233,7 @@ extern Sfio_t* sfpopen _ARG_((Sfio_t*, const char*, const char*)); extern Sfio_t* sfstack _ARG_((Sfio_t*, Sfio_t*)); extern Sfio_t* sfswap _ARG_((Sfio_t*, Sfio_t*)); extern Sfio_t* sftmp _ARG_((size_t)); +extern int sfwalk _ARG_((Sfwalk_f, Void_t*, int)); extern int sfpurge _ARG_((Sfio_t*)); extern int sfpoll _ARG_((Sfio_t**, int, int)); extern Void_t* sfreserve _ARG_((Sfio_t*, ssize_t, int)); diff --git a/usr/src/lib/libast/common/include/sfio_s.h b/usr/src/lib/libast/common/include/sfio_s.h index 19a23d4772..46b2348b9c 100644 --- a/usr/src/lib/libast/common/include/sfio_s.h +++ b/usr/src/lib/libast/common/include/sfio_s.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/sfio_t.h b/usr/src/lib/libast/common/include/sfio_t.h index c5251d3f34..5c819865c8 100644 --- a/usr/src/lib/libast/common/include/sfio_t.h +++ b/usr/src/lib/libast/common/include/sfio_t.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/shcmd.h b/usr/src/lib/libast/common/include/shcmd.h index b25d2467a5..4189f92c39 100644 --- a/usr/src/lib/libast/common/include/shcmd.h +++ b/usr/src/lib/libast/common/include/shcmd.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -66,18 +66,19 @@ typedef struct Shbltin_s # 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) +# define sh_context(c) ((Shbltin_t*)(c)) +# define sh_run(c, ac, av) ((c)?(*sh_context(c)->shrun)(ac,av):-1) +# define sh_system(c,str) ((c)?(*sh_context(c)->shtrap)(str,0):system(str)) +# define sh_exit(c,n) ((c)?(*sh_context(c)->shexit)(n):exit(n)) +# define sh_checksig(c) ((c) && sh_context(c)->sigset) # if defined(SFIO_VERSION) || defined(_AST_H) # define LIB_INIT(c) # else -# define LIB_INIT(c) ((c) && (((Shbltin_t*)(c))->nosfio = 1)) +# define LIB_INIT(c) ((c) && (sh_context(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) + (sh_context(c)->notify = ((flg)&ERROR_NOTIFY)?1:0);} while(0) # endif #endif diff --git a/usr/src/lib/libast/common/include/stack.h b/usr/src/lib/libast/common/include/stack.h index 2d9d03835f..a9e0451567 100644 --- a/usr/src/lib/libast/common/include/stack.h +++ b/usr/src/lib/libast/common/include/stack.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/stak.h b/usr/src/lib/libast/common/include/stak.h index 4d0c49648d..a7b9185553 100644 --- a/usr/src/lib/libast/common/include/stak.h +++ b/usr/src/lib/libast/common/include/stak.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/stk.h b/usr/src/lib/libast/common/include/stk.h index 53bcde612f..5fd7430291 100644 --- a/usr/src/lib/libast/common/include/stk.h +++ b/usr/src/lib/libast/common/include/stk.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/swap.h b/usr/src/lib/libast/common/include/swap.h index bce2045bd5..868e3fd418 100644 --- a/usr/src/lib/libast/common/include/swap.h +++ b/usr/src/lib/libast/common/include/swap.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/tar.h b/usr/src/lib/libast/common/include/tar.h index a6794fd420..a9e6af4585 100644 --- a/usr/src/lib/libast/common/include/tar.h +++ b/usr/src/lib/libast/common/include/tar.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/times.h b/usr/src/lib/libast/common/include/times.h index 4f442ca3ee..ec7f14d5ec 100644 --- a/usr/src/lib/libast/common/include/times.h +++ b/usr/src/lib/libast/common/include/times.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/tm.h b/usr/src/lib/libast/common/include/tm.h index 1a490a63a5..84b3ae182c 100644 --- a/usr/src/lib/libast/common/include/tm.h +++ b/usr/src/lib/libast/common/include/tm.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -93,8 +93,9 @@ #define TM_ERA_YEAR 115 #define TM_ORDINALS 116 #define TM_FINAL 126 +#define TM_WORK 129 -#define TM_NFORM 129 +#define TM_NFORM 132 typedef struct /* leap second info */ { @@ -114,7 +115,7 @@ typedef struct /* time zone info */ typedef struct /* tm library readonly data */ { char** format; /* default TM_* format strings */ - char* lex; /* format lex type classes */ + unsigned char* lex; /* format lex type classes */ char* digit; /* output digits */ short* days; /* days in month i */ short* sum; /* days in months before i */ diff --git a/usr/src/lib/libast/common/include/tok.h b/usr/src/lib/libast/common/include/tok.h index 5b8a5fa1df..0d23994eca 100644 --- a/usr/src/lib/libast/common/include/tok.h +++ b/usr/src/lib/libast/common/include/tok.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/usage.h b/usr/src/lib/libast/common/include/usage.h index d969a0e4c1..e2bea60f9c 100644 --- a/usr/src/lib/libast/common/include/usage.h +++ b/usr/src/lib/libast/common/include/usage.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/vdb.h b/usr/src/lib/libast/common/include/vdb.h index ed1251a2d8..c03e85e5b3 100644 --- a/usr/src/lib/libast/common/include/vdb.h +++ b/usr/src/lib/libast/common/include/vdb.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/vecargs.h b/usr/src/lib/libast/common/include/vecargs.h index 45d3e683f1..d36a403752 100644 --- a/usr/src/lib/libast/common/include/vecargs.h +++ b/usr/src/lib/libast/common/include/vecargs.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/vmalloc.h b/usr/src/lib/libast/common/include/vmalloc.h index 8cf3e9b974..0115078cf5 100644 --- a/usr/src/lib/libast/common/include/vmalloc.h +++ b/usr/src/lib/libast/common/include/vmalloc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/include/wait.h b/usr/src/lib/libast/common/include/wait.h index c64bf8f47f..ed8a1d3209 100644 --- a/usr/src/lib/libast/common/include/wait.h +++ b/usr/src/lib/libast/common/include/wait.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/man/ip6.3 b/usr/src/lib/libast/common/man/ip6.3 new file mode 100644 index 0000000000..1dadb05d9d --- /dev/null +++ b/usr/src/lib/libast/common/man/ip6.3 @@ -0,0 +1,85 @@ +.fp 5 B +.de Af +.ds ;G \\*(;G\\f\\$1\\$3\\f\\$2 +.if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9" +.. +.de aF +.ie \\$3 .ft \\$1 +.el \{\ +.ds ;G \& +.nr ;G \\n(.f +.Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9" +\\*(;G +.ft \\n(;G \} +.. +.de L +.aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" +.. +.de LR +.aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" +.. +.de RL +.aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" +.. +.de EX \" start example +.ta 1i 2i 3i 4i 5i 6i +.PP +.RS +.PD 0 +.ft 5 +.nf +.. +.de EE \" end example +.fi +.ft +.PD +.RE +.PP +.. +.TH IP6 3 +.SH NAME +ip6 \- IP V6 address support +.SH SYNOPSIS +.EX +#include <ip6.h> + +char* fmtip6(unsigned char* addr, int bits); +int strtoip6(const char* str, char** end, unsigned char* addr, unsigned char* bits); +.EE + +.SH DESCRIPTION +.L fmtip6() +formats the IPV6 address +.L addr +with optional prefix bits +.L bits +(0 if not a prefix) into a thread-specific 0-terminated temporary buffer and returns a pointer +to the formatted value. + +.PP +.L strtoip6() +converts a formatted IPV6 address from the 0-terminated string +.L str +into a host order IPV6 address in +.L addr +which must be a buffer of at least +.L IP6ADDR +bytes. +If +.L bits +is not 0 then an optional +.BI / bits +(prefix size in bits) is parsed and +.L *bits +is set to the number of prefix bits. +If +.L end +is not 0 then +.L *end +will point to the first unparsed character in +.L str +on return. +0 is returned on success, -1 on failure. + +.SH "SEE ALSO" +dss(1) diff --git a/usr/src/lib/libast/common/man/regex.3 b/usr/src/lib/libast/common/man/regex.3 new file mode 100644 index 0000000000..7c15d21c46 --- /dev/null +++ b/usr/src/lib/libast/common/man/regex.3 @@ -0,0 +1,163 @@ +.fp 5 B +.de Af +.ds ;G \\*(;G\\f\\$1\\$3\\f\\$2 +.if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9" +.. +.de aF +.ie \\$3 .ft \\$1 +.el \{\ +.ds ;G \& +.nr ;G \\n(.f +.Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9" +\\*(;G +.ft \\n(;G \} +.. +.de L +.aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" +.. +.de LR +.aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" +.. +.de RL +.aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" +.. +.de EX \" start example +.ta 1i 2i 3i 4i 5i 6i +.PP +.RS +.PD 0 +.ft 5 +.nf +.. +.de EE \" end example +.fi +.ft +.PD +.RE +.PP +.. +.TH REGEX 3 +.SH NAME +regex \- regular expression interface +.SH SYNOPSIS +.EX +#include <regex.h> + +int regcomp(regex_t* \fIre\fP, const char* \fIregex\fP, int \fIcflags\fP); +int regexec(const regex_t* \fIre\fP, const char* \fIstring\fP, size_t \fInmatch\fP, regmatch_t \fIpmatch\fP[], int \fIeflags\fP); +size_t regerror(int \fIcode\fP, const regex_t* \fIre\fP, char* \fIerrbuf\fP, size_t \fIerrbuf_size\fP); +void regfree(regex_t* \fIre\fP); + +regclass_t regclass(const char* \fIstr\fP, char** \fIend\fP); +int regaddclass(const char* \fIname\fP, regclass_t \fIclassf\fP); +int regcollate(const char* \fIstr\fP, char** \fIend\fP, char* \fIbuf\fP, int \fIsize\fP); + +int regcomb(regex_t* \fIre_1\fP, regex_t* \fIre_2\fP); +size_t regdecomp(regex_t* \fIre\fP, regflags_t \fIflags\fP, char* \fIbuf\fP, size_t \fIsize\fP); +int regdup(regex_t* \fIre_old\fP, regex_t* \fIre_new\fP); +regstat_t* regstat(const regex_t* \fIre\fP); + +regex_t* regcache(const char* \fIpattern\fP, regflags_t \fIflags\fP, int* \fIpcode\fP); + +int regncomp(regex_t* \fIre\fP, const char* \fIpattern\fP, size_t \fIsize\fP, regflags_t \fIflags\fP); +int regnexec(const regex_t* \fIre\fP, const char* \fIsubject\fP, size_t \fIsize\fP, size_t \fInmatch\fP, regmatch_t* \fImatch\fP, regflags_t \fIflags\fP); +int regrecord(const regex_t* \fIre\fP); +int regrexec(const regex_t* \fIre\fP, const char* \fIbuf\fP, size_t \fIsize\fP, size_t \fInmatch\fP, regmatch_t* \fImatch\fP, regflags_t \fIflags\fP, int \fIsep\fP, void* \fIhandle\fP, regrecord_t \fIrecordf\fP); +void regfatal(regex_t* \fIre\fP, int \fIlevel\fP, int \fIcode\fP); +void regfatalpat(regex_t* \fIre\fP, int \fIlevel\fP, int \fIcode\fP, const char* \fIpattern\fP); + +int regsubcomp(regex_t* \fIre\fP, const char* \fIstr\fP, const regflags_t* \fImap\fP, int \fIminmatch\fP, regflags_t \fIflags\fP); +int regsubexec(const regex_t* \fIre\fP, const char* \fIsubject\fP, size_t \fInmatch\fP, regmatch_t* match); +int regsubflags(regex_t* \fIre\fP, const char* \fIstr\fP, char** \fIend\fP, int \fIdelim\fP, const regflags_t* \fImap\fP, int* \fIpm\fP, regflags_t* \fIpf\fP); +void regsubfree(regex_t* \fIre\fP); +.EE + +.SH DESCRIPTION +.LR regcomp() , +.LR regexec() , +.LR regerror() , +and +.L regfree() +are the POSIX regular expression functions. +The remaining functions are +.B ast +extensions. +.B ast +also provides +.I flags +extensions to the +.LR regcomp() , +.LR regexec() +functions and +.I code +extensions to the +.L regerror() +function. + +.PP +.L regcache() +maintains a cache of compiled regular expressions for patterns of size +255 bytes or less. +The initial cache size is 8. +.L pattern +and +.L flags +are passed to +.L regcomp() +with an +.L re +pointer maintained by +.LR regcache() . +.LR pcode , +if not 0, points to the return value of the +.L regcomp() +call. +If the +.L regcomp() +call fails, +.L regcache() +returns 0 and +.L pcode +will point to the non-zero error code. +Do not call +.L regfree() +on the +.L re +returned by +.LR regcache() . +Both +.L pattern +and +.L flags +are used to match entries in the cache. +When the cache is full the least recently used +.L re +is freed (via +.LR regfree() ) +to make space for the new pattern. +Any +.L re +previously returned by +.L regcache() +may be freed (invalidated) on the next call to +.LR regcache() . +If +.L pattern +is longer that 255 bytes then it is still passed on to +.LR regcomp() , +but it will not be cached. +If +.L pattern +is 0 then the cache is flushed. +In addition, if the integer value of +.L flags +is greater than the current cache size, the cache size is increased +to that integer value. +0 is always returned when +.L pattern +is 0; +.L pcode +will point to a non-zero value on error. + +.SH "SEE ALSO" +strmatch(3) diff --git a/usr/src/lib/libast/common/man/sfio.3 b/usr/src/lib/libast/common/man/sfio.3 index df6037537a..bd805d4ec9 100644 --- a/usr/src/lib/libast/common/man/sfio.3 +++ b/usr/src/lib/libast/common/man/sfio.3 @@ -1,5 +1,5 @@ .fp 5 CW -.TH SFIO 3 "01 February 2005" +.TH SFIO 3 "01 June 2008" .SH NAME \fBsfio\fR \- safe/fast string/file input/output .SH SYNOPSIS @@ -218,7 +218,9 @@ int sferror(Sfio_t* f); int sfclrerr(Sfio_t* f); int sfclrlock(Sfio_t* f); -int sfnotify(void (*notify)(Sfio_t* f, int type, int fd)); +int sfnotify(void (*notify)(Sfio_t* f, int type, Void_t* data)); + +int sfwalk(Sfwalk_f walkf, Void_t* data, int type); .ft 1 .fi .Ss "MISCELLANEOUS FUNCTIONS" @@ -647,10 +649,11 @@ using the option \f5u\fP when opening a file. .Ss "int sfmutex(Sfio_t* f, int type)" This function acquires or releases a mutex (mutually exclusive) lock on the stream \f5f\fP. -It can be used by a thread to delineate a sequence of I/O operations +It can be used by a thread to serialize a sequence of I/O operations executed together in some critical section. \f5sfmutex()\fP is implicitly used by -all Sfio operations on a stream with the flag \f5SF_MTSAFE\fP. +all Sfio operations on a stream with the flag \f5SF_MTSAFE\fP to +protect it from concurrent accesses via multiple threads. \f5sfmutex()\fP returns \f50\fP on success and some non-zero value on failure. Each stream has a lock count which starts at \f50\fP. @@ -666,7 +669,8 @@ The \f5type\fP argument of \f5sfmutex()\fP takes on the below values: .Tp \f5SFMTX_LOCK\fP: Locking a stream if it is unlocked or increasing the lock count of the stream -if it is already locked by the same thread. +if it is already locked by the same thread. This call will block until it is +possible to lock the stream. .Tp \f5SFMTX_TRYLOCK\fP: This is the non-blocking version of \f5SFMTX_LOCK\fP. @@ -1555,7 +1559,7 @@ If \fIbase\fP is larger than \f536\fP, the set of digits is: .Ss "BUFFERING, SYNCHRONIZATION" .PP .Ss " Void_t* sfsetbuf(Sfio_t* f, Void_t* buf, size_t size)" -This function changed the buffering scheme for the stream \f5f\fP. +This function changes the buffering scheme for the stream \f5f\fP. The stream will be synchronized before any buffer modification. If a new buffer is successfully set and the old buffer has not been freed, \f5sfsetbuf()\fP returns the old buffer. Otherwise, it returns \f5NULL\fP. @@ -2003,26 +2007,55 @@ For example, it may be used before a long jump (\f5longjmp(3)\fP) out of some discipline I/O function to restore the internal stream states. \f5sfclrlock()\fP returns the current set of flags. -.Ss " int sfnotify((void(*)notify)(Sfio_t*, int, int) )" +.Ss " int sfnotify((void(*)notify)(Sfio_t*, int, void*) )" This sets a function \f5(*notify)()\fP to be called -as \f5(*notify)(f,type,file)\fP on various stream events. -Arguments \f5f\fP and \f5file\fP are stream and related file descriptor. -Argument \f5type\fP indicates the reason for the call: +as \f5(*notify)(f, type, data)\fP on various stream events. +Arguments \f5type\fP and \f5data\fP indicate the reason for the call and accompanying data: .Tp \f5SF_NEW\fP: -\f5f\fP is being opened and \f5file\fP is the underlying file descriptor. +\f5f\fP is being opened and \f5data\fP is the underlying file descriptor. .Tp \f5SF_CLOSING\fP (\f5SF_CLOSE\fP): -\f5f\fP and \f5file\fP are being closed. +\f5f\fP is the stream being closed and \f5data\fP is the underlying file descriptor. .Tp \f5SF_SETFD\fP: -The file descriptor of \f5f\fP is being changed to \f5file\fP (see \f5sfsetfd()\fP.) +The file descriptor of \f5f\fP is being changed to the one +defined by \f5data\fP (see \f5sfsetfd()\fP.) .Tp \f5SF_READ\fP: An attempt to change \f5f\fP to read mode failed. +\f5data\fP is the file descriptor of the stream. .Tp \f5SF_WRITE\fP: An attempt to change \f5f\fP to write mode failed. +\f5data\fP is the file descriptor of the stream. +.Tp +\f5SF_MTACCESS\fP: +When a notifying function was registered (see \f5sfnotify()\fP), +every Sfio call on a stream with flag \f5SF_MTSAFE\fP will +invoke the notifying function +once on entry after the stream is locked +as \f5(*notify)(f, SF_MTACCESS, Sfio_t** fp), and +once on return before unlocking as +as \f5(*notify)(f, SF_MTACCESS, (Sfio_t**)0). +In the call entry case, +the notification function could use the argument \f5fp\fP +to set a stream that would be used for performing the actual I/O operation. +In this way, certain global streams such as the standard streams \f5sfstdin\fP, +\f5sfstdout\fP and \f5sfstderr\fP could be made to act differently when used +in different streams. + +.Ss " int sfwalk(Sfwalk_f walkf, Void_t* data, int type)" +This function invokes \f5(*walkf)(f, data)\fP on every open stream \f5f\fP +whose flags as defined by \f5sfset()\fP contains all bit flags given in \f5type\fP. +On such a call, if the return value is negative, \f5sfwalk()\fP will terminate. +\f5sfwalk()\fP returns 0 if no stream was processed. +Otherwise, it returns the return value from the last invocation of \f5walkf()\fP. + +As an example, the call \f5sfwalk(walkf, data, SF_READ)\fP will iterate over all streams +opened for reading. Similarly, \f5sfwalk(walkf, data, SF_READ|SF_WRITE)\fP +iterates over all streams opened for both reading and writing. +Lastly, \f5sfwalk(walkf, data, 0)\fP iterates over all streams. .PP .Ss "MISCELLANEOUS FUNCTIONS" diff --git a/usr/src/lib/libast/common/misc/astintercept.c b/usr/src/lib/libast/common/misc/astintercept.c index 414224aa03..23f5322489 100644 --- a/usr/src/lib/libast/common/misc/astintercept.c +++ b/usr/src/lib/libast/common/misc/astintercept.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/cmdarg.c b/usr/src/lib/libast/common/misc/cmdarg.c index b27f2152c7..cdcbd02b87 100644 --- a/usr/src/lib/libast/common/misc/cmdarg.c +++ b/usr/src/lib/libast/common/misc/cmdarg.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -34,6 +34,9 @@ #include "cmdarg.h" +#ifndef ARG_MAX +#define ARG_MAX (64*1024) +#endif #ifndef EXIT_QUIT #define EXIT_QUIT 255 #endif diff --git a/usr/src/lib/libast/common/misc/debug.c b/usr/src/lib/libast/common/misc/debug.c index 2304eb7a2b..0ac2459f36 100644 --- a/usr/src/lib/libast/common/misc/debug.c +++ b/usr/src/lib/libast/common/misc/debug.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/error.c b/usr/src/lib/libast/common/misc/error.c index faab838264..1999468db9 100644 --- a/usr/src/lib/libast/common/misc/error.c +++ b/usr/src/lib/libast/common/misc/error.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/errorf.c b/usr/src/lib/libast/common/misc/errorf.c index be41031d60..f909c3d31a 100644 --- a/usr/src/lib/libast/common/misc/errorf.c +++ b/usr/src/lib/libast/common/misc/errorf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/errormsg.c b/usr/src/lib/libast/common/misc/errormsg.c index 95b974e01e..8845b22209 100644 --- a/usr/src/lib/libast/common/misc/errormsg.c +++ b/usr/src/lib/libast/common/misc/errormsg.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/errorx.c b/usr/src/lib/libast/common/misc/errorx.c index f88d49232d..214e0734d4 100644 --- a/usr/src/lib/libast/common/misc/errorx.c +++ b/usr/src/lib/libast/common/misc/errorx.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/fastfind.c b/usr/src/lib/libast/common/misc/fastfind.c index ef5d13139d..0f3e043d39 100644 --- a/usr/src/lib/libast/common/misc/fastfind.c +++ b/usr/src/lib/libast/common/misc/fastfind.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/findlib.h b/usr/src/lib/libast/common/misc/findlib.h index fa21a9e977..f48ba32665 100644 --- a/usr/src/lib/libast/common/misc/findlib.h +++ b/usr/src/lib/libast/common/misc/findlib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/fmtrec.c b/usr/src/lib/libast/common/misc/fmtrec.c index 78b8b46e23..371c373e3f 100644 --- a/usr/src/lib/libast/common/misc/fmtrec.c +++ b/usr/src/lib/libast/common/misc/fmtrec.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/fs3d.c b/usr/src/lib/libast/common/misc/fs3d.c index 91b73dd121..a486448021 100644 --- a/usr/src/lib/libast/common/misc/fs3d.c +++ b/usr/src/lib/libast/common/misc/fs3d.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -28,7 +28,12 @@ * only active for non-shared 3d library */ +#define mount ______mount + #include <ast.h> + +#undef mount + #include <fs3d.h> int @@ -92,3 +97,20 @@ fs3d(register int op) fsview = -1; return 0; } + +/* + * user code that includes <fs3d.h> will have mount() mapped to fs3d_mount() + * this restricts the various "standard" mount prototype conflicts to this spot + * this means that code that includes <fs3d.h> cannot access the real mount + * (at least without some additional macro hackery + */ + +#undef mount + +extern int mount(const char*, char*, int, void*); + +int +fs3d_mount(const char* source, char* target, int flags, void* data) +{ + return mount(source, target, flags, data); +} diff --git a/usr/src/lib/libast/common/misc/fts.c b/usr/src/lib/libast/common/misc/fts.c index 29c638cada..8506f84fe9 100644 --- a/usr/src/lib/libast/common/misc/fts.c +++ b/usr/src/lib/libast/common/misc/fts.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -39,6 +39,9 @@ struct Ftsent; typedef int (*Compar_f)(struct Ftsent* const*, struct Ftsent* const*); typedef int (*Stat_f)(const char*, struct stat*); +#define _fts_status status +#define _fts_statb statb + #define _FTS_PRIVATE_ \ FTSENT* parent; /* top parent */ \ FTSENT* todo; /* todo list */ \ @@ -55,11 +58,11 @@ typedef int (*Stat_f)(const char*, struct stat*); FTSENT* pwd; /* pwd parent */ \ DIR* dir; /* current dir stream */ \ Compar_f comparf; /* node comparison func */ \ - int baselen; /* current strlen(base) */ \ + size_t baselen; /* current strlen(base) */ \ + size_t homesize; /* sizeof(home) */ \ int cd; /* chdir status */ \ int cpname; \ int flags; /* fts_open() flags */ \ - int homesize; /* sizeof(home) */ \ int nd; \ unsigned char children; \ unsigned char fs3d; \ @@ -78,9 +81,6 @@ typedef int (*Stat_f)(const char*, struct stat*); */ #define _FTSENT_PRIVATE_ \ - short status; /* internal status */ \ - struct stat statb; /* fts_statp data */ \ - FTS* fts; /* fts_open() handle */ \ int nd; /* popdir() count */ \ FTSENT* left; /* left child */ \ FTSENT* right; /* right child */ \ @@ -174,10 +174,10 @@ static Notify_t* notify; */ static FTSENT* -node(FTS* fts, FTSENT* parent, register char* name, register int namelen) +node(FTS* fts, FTSENT* parent, register char* name, register size_t namelen) { register FTSENT* f; - register int n; + register size_t n; if (fts->free && namelen < MINNAME) { @@ -199,11 +199,17 @@ node(FTS* fts, FTSENT* parent, register char* name, register int namelen) f->status = 0; f->symlink = 0; f->fts_level = (f->fts_parent = parent)->fts_level + 1; +#if __OBSOLETE__ < 20140101 + f->_fts_level = (short)f->fts_level; +#endif f->fts_link = 0; f->fts_pointer = 0; f->fts_number = 0; f->fts_errno = 0; f->fts_namelen = namelen; +#if __OBSOLETE__ < 20140101 + f->_fts_namelen = (unsigned short)f->fts_namelen; +#endif f->fts_name = f->name; f->fts_statp = &f->statb; memcpy(f->fts_name, name, namelen + 1); @@ -389,7 +395,10 @@ getlist(register FTSENT** top, register FTSENT** bot, register FTSENT* root) break; } if (!(root = stack)) + { + (*bot)->fts_link = 0; return; + } stack = stack->stack; } } @@ -565,27 +574,27 @@ info(FTS* fts, register FTSENT* f, const char* path, struct stat* sp, int flags) /* * get top list of elements to process + * ordering delayed until first fts_read() + * to give caller a chance to set fts->handle */ static FTSENT* toplist(FTS* fts, register char* const* pathnames) { register char* path; - register struct stat* sb; register FTSENT* f; - register FTSENT* root; + register FTSENT* top; + register FTSENT* bot; int physical; int metaphysical; char* s; - FTSENT* top; - FTSENT* bot; struct stat st; if (fts->flags & FTS_NOSEEDOTDIR) fts->flags &= ~FTS_SEEDOTDIR; physical = (fts->flags & FTS_PHYSICAL); metaphysical = (fts->flags & (FTS_META|FTS_PHYSICAL)) == (FTS_META|FTS_PHYSICAL); - top = bot = root = 0; + top = bot = 0; while (path = *pathnames++) { /* @@ -625,14 +634,16 @@ toplist(FTS* fts, register char* const* pathnames) *s = 0; f->fts_namelen = s - path; } - sb = f->fts_statp; +#if __OBSOLETE__ < 20140101 + f->_fts_namelen = (unsigned short)f->fts_namelen; +#endif if (!*path) { errno = ENOENT; f->fts_info = FTS_NS; } else - info(fts, f, path, sb, fts->flags); + info(fts, f, path, f->fts_statp, fts->flags); #ifdef S_ISLNK /* @@ -642,13 +653,11 @@ toplist(FTS* fts, register char* const* pathnames) if (metaphysical && f->fts_info == FTS_SL && stat(path, &st) >= 0) { - *sb = st; - info(fts, f, NiL, sb, 0); + *f->fts_statp = st; + info(fts, f, NiL, f->fts_statp, 0); } #endif - if (fts->comparf) - root = search(f, root, fts->comparf, 1); - else if (bot) + if (bot) { bot->fts_link = f; bot = f; @@ -656,23 +665,40 @@ toplist(FTS* fts, register char* const* pathnames) else top = bot = f; } - if (fts->comparf) - getlist(&top, &bot, root); return top; } /* + * order fts->todo if fts->comparf != 0 + */ + +static void +order(FTS* fts) +{ + register FTSENT* f; + register FTSENT* root; + FTSENT* top; + FTSENT* bot; + + top = bot = root = 0; + for (f = fts->todo; f; f = f->fts_link) + root = search(f, root, fts->comparf, 1); + getlist(&top, &bot, root); + fts->todo = top; +} + +/* * resize the path buffer * note that free() is not used because we may need to chdir(fts->home) * if there isn't enough space to continue */ static int -resize(register FTS* fts, int inc) +resize(register FTS* fts, size_t inc) { register char* old; register char* newp; - register int n_old; + register size_t n_old; /* * add space for "/." used in testing FTS_DNX @@ -744,6 +770,9 @@ fts_open(char* const* pathnames, int flags, int (*comparf)(FTSENT* const*, FTSEN fts->parent->fts_info = FTS_D; memcpy(fts->parent->fts_accpath = fts->parent->fts_path = fts->parent->fts_name = fts->parent->name, ".", 2); fts->parent->fts_level = -1; +#if __OBSOLETE__ < 20140101 + fts->parent->_fts_level = (short)fts->parent->fts_level; +#endif fts->parent->fts_statp = &fts->parent->statb; fts->parent->must = 2; fts->parent->type = DT_UNKNOWN; @@ -782,597 +811,603 @@ fts_read(register FTS* fts) register int n; register FTSENT* f; struct dirent* d; - int i; + size_t i; FTSENT* t; Notify_t* p; #ifdef verify struct stat sb; #endif - for (;;) switch (fts->state) - { + for (;;) + switch (fts->state) + { - case FTS_top_return: + case FTS_top_return: - f = fts->todo; - t = 0; - while (f) - if (f->status == FTS_SKIP) - { - if (t) + f = fts->todo; + t = 0; + while (f) + if (f->status == FTS_SKIP) { - t->fts_link = f->fts_link; - drop(fts, f); - f = t->fts_link; + if (t) + { + t->fts_link = f->fts_link; + drop(fts, f); + f = t->fts_link; + } + else + { + fts->todo = f->fts_link; + drop(fts, f); + f = fts->todo; + } } else { - fts->todo = f->fts_link; - drop(fts, f); - f = fts->todo; + t = f; + f = f->fts_link; } - } - else - { - t = f; - f = f->fts_link; - } - /*FALLTHROUGH*/ + /*FALLTHROUGH*/ - case 0: + case 0: - if (!(f = fts->todo)) - return 0; - /*FALLTHROUGH*/ + if (!fts->state && fts->comparf) + order(fts); + if (!(f = fts->todo)) + return 0; + /*FALLTHROUGH*/ - case FTS_todo: + case FTS_todo: - /* - * process the top object on the stack - */ + /* + * process the top object on the stack + */ - fts->root = fts->top = fts->bot = 0; + fts->root = fts->top = fts->bot = 0; - /* - * initialize the top level - */ + /* + * initialize the top level + */ - if (f->fts_level == 0) - { - fts->parent->fts_number = f->fts_number; - fts->parent->fts_pointer = f->fts_pointer; - fts->parent->fts_statp = f->fts_statp; - fts->parent->statb = *f->fts_statp; - f->fts_parent = fts->parent; - fts->diroot = 0; - if (fts->cd == 0) - pathcd(fts->home, NiL); - else if (fts->cd < 0) - fts->cd = 0; - fts->pwd = f->fts_parent; - fts->curdir = fts->cd ? 0 : f->fts_parent; - *(fts->base = fts->path) = 0; - } + if (f->fts_level == 0) + { + fts->parent->fts_number = f->fts_number; + fts->parent->fts_pointer = f->fts_pointer; + fts->parent->fts_statp = f->fts_statp; + fts->parent->statb = *f->fts_statp; + f->fts_parent = fts->parent; + fts->diroot = 0; + if (fts->cd == 0) + pathcd(fts->home, NiL); + else if (fts->cd < 0) + fts->cd = 0; + fts->pwd = f->fts_parent; + fts->curdir = fts->cd ? 0 : f->fts_parent; + *(fts->base = fts->path) = 0; + } - /* - * chdir to parent if asked for - */ + /* + * chdir to parent if asked for + */ - if (fts->cd < 0) - { - fts->cd = setdir(fts->home, fts->path); - fts->pwd = f->fts_parent; - fts->curdir = fts->cd ? 0 : f->fts_parent; - } + if (fts->cd < 0) + { + fts->cd = setdir(fts->home, fts->path); + fts->pwd = f->fts_parent; + fts->curdir = fts->cd ? 0 : f->fts_parent; + } - /* - * add object's name to the path - */ + /* + * add object's name to the path + */ - if ((fts->baselen = f->fts_namelen) >= (fts->endbuf - fts->base) && resize(fts, fts->baselen)) - return 0; - memcpy(fts->base, f->name, fts->baselen + 1); - fts->name = fts->cd ? fts->path : fts->base; - /*FALLTHROUGH*/ + if ((fts->baselen = f->fts_namelen) >= (fts->endbuf - fts->base) && resize(fts, fts->baselen)) + return 0; + memcpy(fts->base, f->name, fts->baselen + 1); + fts->name = fts->cd ? fts->path : fts->base; + /*FALLTHROUGH*/ - case FTS_preorder: + case FTS_preorder: - /* - * check for cycle and open dir - */ + /* + * check for cycle and open dir + */ - if (f->fts_info == FTS_D) - { - if ((fts->diroot = search(f, fts->diroot, statcmp, 0)) != f || f->fts_level > 0 && (t = f) && statcmp(&t, &f->fts_parent) == 0) + if (f->fts_info == FTS_D) { - f->fts_info = FTS_DC; - f->fts_cycle = fts->diroot; + if ((fts->diroot = search(f, fts->diroot, statcmp, 0)) != f || f->fts_level > 0 && (t = f) && statcmp(&t, &f->fts_parent) == 0) + { + f->fts_info = FTS_DC; + f->fts_cycle = fts->diroot; + } + else if (!(fts->flags & FTS_TOP) && (!(fts->flags & FTS_XDEV) || f->statb.st_dev == f->fts_parent->statb.st_dev)) + { + /* + * buffer is known to be large enough here! + */ + + if (fts->base[fts->baselen - 1] != '/') + memcpy(fts->base + fts->baselen, "/.", 3); + if (!(fts->dir = opendir(fts->name))) + f->fts_info = FTS_DNX; + fts->base[fts->baselen] = 0; + if (!fts->dir && !(fts->dir = opendir(fts->name))) + f->fts_info = FTS_DNR; + } } - else if (!(fts->flags & FTS_TOP) && (!(fts->flags & FTS_XDEV) || f->statb.st_dev == f->fts_parent->statb.st_dev)) + f->nd = f->fts_info & ~FTS_DNX; + if (f->nd || !(fts->flags & FTS_NOPREORDER)) { - /* - * buffer is known to be large enough here! - */ - - if (fts->base[fts->baselen - 1] != '/') - memcpy(fts->base + fts->baselen, "/.", 3); - if (!(fts->dir = opendir(fts->name))) - f->fts_info = FTS_DNX; - fts->base[fts->baselen] = 0; - if (!fts->dir && !(fts->dir = opendir(fts->name))) - f->fts_info = FTS_DNR; + fts->current = f; + fts->link = f->fts_link; + f->fts_link = 0; + f->fts_path = PATH(fts, fts->path, f->fts_level); + f->fts_pathlen = (fts->base - f->fts_path) + fts->baselen; + f->fts_accpath = ACCESS(fts, f); + fts->state = FTS_preorder_return; + goto note; } - } - f->nd = f->fts_info & ~FTS_DNX; - if (f->nd || !(fts->flags & FTS_NOPREORDER)) - { - fts->current = f; - fts->link = f->fts_link; - f->fts_link = 0; - f->fts_path = PATH(fts, fts->path, f->fts_level); - f->fts_pathlen = (fts->base - f->fts_path) + fts->baselen; - f->fts_accpath = ACCESS(fts, f); - fts->state = FTS_preorder_return; - goto note; - } - /*FALLTHROUGH*/ + /*FALLTHROUGH*/ - case FTS_preorder_resume: + case FTS_preorder_resume: - /* - * prune - */ + /* + * prune + */ - if (!fts->dir || f->nd || f->status == FTS_SKIP) - { - if (fts->dir) + if (!fts->dir || f->nd || f->status == FTS_SKIP) { - closedir(fts->dir); - fts->dir = 0; + if (fts->dir) + { + closedir(fts->dir); + fts->dir = 0; + } + fts->state = FTS_popstack; + continue; } - fts->state = FTS_popstack; - continue; - } - /* - * FTS_D or FTS_DNX, about to read children - */ + /* + * FTS_D or FTS_DNX, about to read children + */ - if (fts->cd == 0) - { - if ((fts->cd = chdir(fts->name)) < 0) - pathcd(fts->home, NiL); - else if (fts->pwd != f) - { - f->pwd = fts->pwd; - fts->pwd = f; - } - fts->curdir = fts->cd < 0 ? 0 : f; - } - fts->nostat = fts->children > 1 || f->fts_info == FTS_DNX; - fts->cpname = fts->cd && !fts->nostat || !fts->children && !fts->comparf; - fts->dotdot = 0; - fts->endbase = fts->base + fts->baselen; - if (fts->endbase[-1] != '/') - *fts->endbase++ = '/'; - fts->current = f; - /*FALLTHROUGH*/ - - case FTS_readdir: - - while (d = readdir(fts->dir)) - { - s = d->d_name; - if (s[0] == '.') + if (fts->cd == 0) { - if (s[1] == 0) + if ((fts->cd = chdir(fts->name)) < 0) + pathcd(fts->home, NiL); + else if (fts->pwd != f) { - fts->current->nlink--; - if (!(fts->flags & FTS_SEEDOT)) - continue; - n = 1; + f->pwd = fts->pwd; + fts->pwd = f; } - else if (s[1] == '.' && s[2] == 0) + fts->curdir = fts->cd < 0 ? 0 : f; + } + fts->nostat = fts->children > 1 || f->fts_info == FTS_DNX; + fts->cpname = fts->cd && !fts->nostat || !fts->children && !fts->comparf; + fts->dotdot = 0; + fts->endbase = fts->base + fts->baselen; + if (fts->endbase[-1] != '/') + *fts->endbase++ = '/'; + fts->current = f; + /*FALLTHROUGH*/ + + case FTS_readdir: + + while (d = readdir(fts->dir)) + { + s = d->d_name; + if (s[0] == '.') { - fts->current->nlink--; - if (fts->current->must == 1) - fts->current->must = 0; - if (!(fts->flags & FTS_SEEDOT)) - continue; - n = 2; + if (s[1] == 0) + { + fts->current->nlink--; + if (!(fts->flags & FTS_SEEDOT)) + continue; + n = 1; + } + else if (s[1] == '.' && s[2] == 0) + { + fts->current->nlink--; + if (fts->current->must == 1) + fts->current->must = 0; + if (!(fts->flags & FTS_SEEDOT)) + continue; + n = 2; + } + else + n = 0; } else n = 0; - } - else - n = 0; - - /* - * make a new entry - */ - - i = D_NAMLEN(d); - if (!(f = node(fts, fts->current, s, i))) - return 0; - TYPE(f, D_TYPE(d)); - /* - * check for space - */ + /* + * make a new entry + */ - if (i >= fts->endbuf - fts->endbase) - { - if (resize(fts, i)) + i = D_NAMLEN(d); + if (!(f = node(fts, fts->current, s, i))) return 0; - fts->endbase = fts->base + fts->baselen; - if (fts->endbase[-1] != '/') - fts->endbase++; - } - if (fts->cpname) - { - memcpy(fts->endbase, s, i + 1); - if (fts->cd) - s = fts->path; - } - if (n) - { + TYPE(f, D_TYPE(d)); + /* - * don't recurse on . and .. + * check for space */ - if (n == 1) - f->fts_statp = fts->current->fts_statp; - else + if (i >= fts->endbuf - fts->endbase) { - if (f->fts_info != FTS_NS) - fts->dotdot = f; - if (fts->current->fts_parent->fts_level < 0) + if (resize(fts, i)) + return 0; + fts->endbase = fts->base + fts->baselen; + if (fts->endbase[-1] != '/') + fts->endbase++; + } + if (fts->cpname) + { + memcpy(fts->endbase, s, i + 1); + if (fts->cd) + s = fts->path; + } + if (n) + { + /* + * don't recurse on . and .. + */ + + if (n == 1) + f->fts_statp = fts->current->fts_statp; + else { - f->fts_statp = &fts->current->fts_parent->statb; - info(fts, f, s, f->fts_statp, 0); + if (f->fts_info != FTS_NS) + fts->dotdot = f; + if (fts->current->fts_parent->fts_level < 0) + { + f->fts_statp = &fts->current->fts_parent->statb; + info(fts, f, s, f->fts_statp, 0); + } + else + f->fts_statp = fts->current->fts_parent->fts_statp; } + f->fts_info = FTS_DOT; + } + else if ((fts->nostat || SKIP(fts, f)) && (f->fts_info = FTS_NSOK) || info(fts, f, s, &f->statb, fts->flags)) + f->statb.st_ino = D_FILENO(d); + if (fts->comparf) + fts->root = search(f, fts->root, fts->comparf, 1); + else if (fts->children || f->fts_info == FTS_D || f->fts_info == FTS_SL) + { + if (fts->top) + fts->bot = fts->bot->fts_link = f; else - f->fts_statp = fts->current->fts_parent->fts_statp; + fts->top = fts->bot = f; } - f->fts_info = FTS_DOT; - } - else if ((fts->nostat || SKIP(fts, f)) && (f->fts_info = FTS_NSOK) || info(fts, f, s, &f->statb, fts->flags)) - f->statb.st_ino = D_FILENO(d); - if (fts->comparf) - fts->root = search(f, fts->root, fts->comparf, 1); - else if (fts->children || f->fts_info == FTS_D || f->fts_info == FTS_SL) - { - if (fts->top) - fts->bot = fts->bot->fts_link = f; else - fts->top = fts->bot = f; + { + /* + * terminal node + */ + + f->fts_path = PATH(fts, fts->path, 1); + f->fts_pathlen = fts->endbase - f->fts_path + f->fts_namelen; + f->fts_accpath = ACCESS(fts, f); + fts->previous = fts->current; + fts->current = f; + fts->state = FTS_terminal; + goto note; + } } - else - { + + /* + * done with the directory + */ + + closedir(fts->dir); + fts->dir = 0; + if (fts->root) + getlist(&fts->top, &fts->bot, fts->root); + if (fts->children) + { /* - * terminal node + * try moving back to parent dir */ - f->fts_path = PATH(fts, fts->path, 1); - f->fts_pathlen = fts->endbase - f->fts_path + f->fts_namelen; + fts->base[fts->baselen] = 0; + if (fts->cd <= 0) + { + f = fts->current->fts_parent; + if (fts->cd < 0 + || f != fts->curdir + || !fts->dotdot + || !SAME(f->fts_statp, fts->dotdot->fts_statp) + || fts->pwd && fts->pwd->symlink + || (fts->cd = chdir("..")) < 0 +#ifdef verify + || stat(".", &sb) < 0 + || !SAME(&sb, fts->dotdot->fts_statp) +#endif + ) + fts->cd = setpdir(fts->home, fts->path, fts->base); + if (fts->pwd) + fts->pwd = fts->pwd->pwd; + fts->curdir = fts->cd ? 0 : f; + } + f = fts->current; + fts->link = f->fts_link; + f->fts_link = fts->top; + f->fts_path = PATH(fts, fts->path, f->fts_level); + f->fts_pathlen = (fts->base - f->fts_path) + f->fts_namelen; f->fts_accpath = ACCESS(fts, f); - fts->previous = fts->current; - fts->current = f; - fts->state = FTS_terminal; + fts->state = FTS_children_return; goto note; } - } - - /* - * done with the directory - */ + /*FALLTHROUGH*/ - closedir(fts->dir); - fts->dir = 0; - if (fts->root) - getlist(&fts->top, &fts->bot, fts->root); - if (fts->children) - { - /* - * try moving back to parent dir - */ + case FTS_children_resume: fts->base[fts->baselen] = 0; - if (fts->cd <= 0) + if (fts->top) { - f = fts->current->fts_parent; - if (fts->cd < 0 - || f != fts->curdir - || !fts->dotdot - || !SAME(f->fts_statp, fts->dotdot->fts_statp) - || fts->pwd && fts->pwd->symlink - || (fts->cd = chdir("..")) < 0 -#ifdef verify - || stat(".", &sb) < 0 - || !SAME(&sb, fts->dotdot->fts_statp) -#endif - ) - fts->cd = setpdir(fts->home, fts->path, fts->base); - if (fts->pwd) - fts->pwd = fts->pwd->pwd; - fts->curdir = fts->cd ? 0 : f; + fts->bot->fts_link = fts->todo; + fts->todo = fts->top; + fts->top = 0; } - f = fts->current; - fts->link = f->fts_link; - f->fts_link = fts->top; - f->fts_path = PATH(fts, fts->path, f->fts_level); - f->fts_pathlen = (fts->base - f->fts_path) + f->fts_namelen; - f->fts_accpath = ACCESS(fts, f); - fts->state = FTS_children_return; - goto note; - } - /*FALLTHROUGH*/ + /*FALLTHROUGH*/ - case FTS_children_resume: + case FTS_popstack: - fts->base[fts->baselen] = 0; - if (fts->top) - { - fts->bot->fts_link = fts->todo; - fts->todo = fts->top; - fts->top = 0; - } - /*FALLTHROUGH*/ - - case FTS_popstack: - - /* - * pop objects completely processed - */ + /* + * pop objects completely processed + */ - fts->nd = 0; - f = fts->current; - /*FALLTHROUGH*/ + fts->nd = 0; + f = fts->current; + /*FALLTHROUGH*/ - case FTS_popstack_resume: + case FTS_popstack_resume: - while (fts->todo && f == fts->todo) - { - t = f->fts_parent; - if ((f->fts_info & FTS_DP) == FTS_D) + while (fts->todo && f == fts->todo) { - /* - * delete from <dev,ino> tree - */ - - if (f != fts->diroot) - fts->diroot = search(f, fts->diroot, statcmp, 0); - fts->diroot = deleteroot(fts->diroot); - if (f == fts->curdir) - { - fts->nd++; - fts->curdir = t; - } - - /* - * perform post-order processing - */ - - if (!(fts->flags & FTS_NOPOSTORDER) && - f->status != FTS_SKIP && - f->status != FTS_NOPOSTORDER) + t = f->fts_parent; + if ((f->fts_info & FTS_DP) == FTS_D) { /* - * move to parent dir + * delete from <dev,ino> tree */ - if (fts->nd > 0) - fts->cd = popdirs(fts); - if (fts->cd < 0) - fts->cd = setpdir(fts->home, fts->path, fts->base); - fts->curdir = fts->cd ? 0 : t; - f->fts_info = FTS_DP; - f->fts_path = PATH(fts, fts->path, f->fts_level); - f->fts_pathlen = (fts->base - f->fts_path) + f->fts_namelen; - f->fts_accpath = ACCESS(fts, f); + if (f != fts->diroot) + fts->diroot = search(f, fts->diroot, statcmp, 0); + fts->diroot = deleteroot(fts->diroot); + if (f == fts->curdir) + { + fts->nd++; + fts->curdir = t; + } /* - * re-stat to update nlink/times + * perform post-order processing */ - stat(f->fts_accpath, f->fts_statp); - fts->link = f->fts_link; - f->fts_link = 0; - fts->state = FTS_popstack_return; - goto note; + if (!(fts->flags & FTS_NOPOSTORDER) && + f->status != FTS_SKIP && + f->status != FTS_NOPOSTORDER) + { + /* + * move to parent dir + */ + + if (fts->nd > 0) + fts->cd = popdirs(fts); + if (fts->cd < 0) + fts->cd = setpdir(fts->home, fts->path, fts->base); + fts->curdir = fts->cd ? 0 : t; + f->fts_info = FTS_DP; + f->fts_path = PATH(fts, fts->path, f->fts_level); + f->fts_pathlen = (fts->base - f->fts_path) + f->fts_namelen; + f->fts_accpath = ACCESS(fts, f); + + /* + * re-stat to update nlink/times + */ + + stat(f->fts_accpath, f->fts_statp); + fts->link = f->fts_link; + f->fts_link = 0; + fts->state = FTS_popstack_return; + goto note; + } } - } - /* - * reset base - */ + /* + * reset base + */ - if (fts->base > fts->path + t->fts_namelen) - fts->base--; - *fts->base = 0; - fts->base -= t->fts_namelen; + if (fts->base > fts->path + t->fts_namelen) + fts->base--; + *fts->base = 0; + fts->base -= t->fts_namelen; + + /* + * try again or delete from top of stack + */ + + if (f->status == FTS_AGAIN) + { + f->fts_info = FTS_D; + f->status = 0; + } + else + { + fts->todo = fts->todo->fts_link; + drop(fts, f); + } + f = t; + } /* - * try again or delete from top of stack + * reset current directory */ - if (f->status == FTS_AGAIN) + if (fts->nd > 0 && popdirs(fts) < 0) { - f->fts_info = FTS_D; - f->status = 0; + pathcd(fts->home, NiL); + fts->curdir = 0; + fts->cd = -1; } - else + if (fts->todo) { - fts->todo = fts->todo->fts_link; - drop(fts, f); + if (*fts->base) + fts->base += f->fts_namelen; + if (*(fts->base - 1) != '/') + *fts->base++ = '/'; + *fts->base = 0; + f = fts->todo; + fts->state = FTS_todo; + continue; } - f = t; - } - - /* - * reset current directory - */ - - if (fts->nd > 0 && popdirs(fts) < 0) - { - pathcd(fts->home, NiL); - fts->curdir = 0; - fts->cd = -1; - } - if (fts->todo) - { - if (*fts->base) - fts->base += f->fts_namelen; - if (*(fts->base - 1) != '/') - *fts->base++ = '/'; - *fts->base = 0; - f = fts->todo; - fts->state = FTS_todo; - continue; - } - return 0; + return 0; - case FTS_children_return: + case FTS_children_return: - f = fts->current; - f->fts_link = fts->link; + f = fts->current; + f->fts_link = fts->link; - /* - * chdir down again - */ + /* + * chdir down again + */ - i = f->fts_info != FTS_DNX; - n = f->status == FTS_SKIP; - if (!n && fts->cd == 0) - { - if ((fts->cd = chdir(fts->base)) < 0) - pathcd(fts->home, NiL); - else if (fts->pwd != f) + i = f->fts_info != FTS_DNX; + n = f->status == FTS_SKIP; + if (!n && fts->cd == 0) { - f->pwd = fts->pwd; - fts->pwd = f; + if ((fts->cd = chdir(fts->base)) < 0) + pathcd(fts->home, NiL); + else if (fts->pwd != f) + { + f->pwd = fts->pwd; + fts->pwd = f; + } + fts->curdir = fts->cd ? 0 : f; } - fts->curdir = fts->cd ? 0 : f; - } - /* - * prune - */ + /* + * prune + */ - if (fts->base[fts->baselen - 1] != '/') - fts->base[fts->baselen] = '/'; - for (fts->bot = 0, f = fts->top; f; ) - if (n || f->status == FTS_SKIP) - { - if (fts->bot) - fts->bot->fts_link = f->fts_link; + if (fts->base[fts->baselen - 1] != '/') + fts->base[fts->baselen] = '/'; + for (fts->bot = 0, f = fts->top; f; ) + if (n || f->status == FTS_SKIP) + { + if (fts->bot) + fts->bot->fts_link = f->fts_link; + else + fts->top = f->fts_link; + drop(fts, f); + f = fts->bot ? fts->bot->fts_link : fts->top; + } else - fts->top = f->fts_link; - drop(fts, f); - f = fts->bot ? fts->bot->fts_link : fts->top; - } - else - { - if (fts->children > 1 && i) { - if (f->status == FTS_STAT) - info(fts, f, NiL, f->fts_statp, 0); - else if (f->fts_info == FTS_NSOK && !SKIP(fts, f)) + if (fts->children > 1 && i) { - s = f->fts_name; - if (fts->cd) + if (f->status == FTS_STAT) + info(fts, f, NiL, f->fts_statp, 0); + else if (f->fts_info == FTS_NSOK && !SKIP(fts, f)) { - memcpy(fts->endbase, s, f->fts_namelen + 1); - s = fts->path; + s = f->fts_name; + if (fts->cd) + { + memcpy(fts->endbase, s, f->fts_namelen + 1); + s = fts->path; + } + info(fts, f, s, f->fts_statp, fts->flags); } - info(fts, f, s, f->fts_statp, fts->flags); } + fts->bot = f; + f = f->fts_link; } - fts->bot = f; - f = f->fts_link; - } - fts->children = 0; - fts->state = FTS_children_resume; - continue; + fts->children = 0; + fts->state = FTS_children_resume; + continue; - case FTS_popstack_return: + case FTS_popstack_return: - f = fts->todo; - f->fts_link = fts->link; - f->fts_info = f->status == FTS_AGAIN ? FTS_DP : 0; - fts->state = FTS_popstack_resume; - continue; + f = fts->todo; + f->fts_link = fts->link; + f->fts_info = f->status == FTS_AGAIN ? FTS_DP : 0; + fts->state = FTS_popstack_resume; + continue; - case FTS_preorder_return: + case FTS_preorder_return: - f = fts->current; - f->fts_link = fts->link; + f = fts->current; + f->fts_link = fts->link; - /* - * follow symlink if asked to - */ + /* + * follow symlink if asked to + */ - if (f->status == FTS_FOLLOW) - { - f->status = 0; - if (f->fts_info == FTS_SL || ISTYPE(f, DT_LNK) || f->fts_info == FTS_NSOK) + if (f->status == FTS_FOLLOW) { - info(fts, f, f->fts_accpath, f->fts_statp, 0); - if (f->fts_info != FTS_SL) + f->status = 0; + if (f->fts_info == FTS_SL || ISTYPE(f, DT_LNK) || f->fts_info == FTS_NSOK) { - fts->state = FTS_preorder; - continue; + info(fts, f, f->fts_accpath, f->fts_statp, 0); + if (f->fts_info != FTS_SL) + { + fts->state = FTS_preorder; + continue; + } } } - } - /* - * about to prune this f and already at home - */ + /* + * about to prune this f and already at home + */ - if (fts->cd == 0 && f->fts_level == 0 && f->nd) - fts->cd = -1; - fts->state = FTS_preorder_resume; - continue; + if (fts->cd == 0 && f->fts_level == 0 && f->nd) + fts->cd = -1; + fts->state = FTS_preorder_resume; + continue; - case FTS_terminal: + case FTS_terminal: - f = fts->current; - if (f->status == FTS_FOLLOW) - { - f->status = 0; - if (f->fts_info == FTS_SL || ISTYPE(f, DT_LNK) || f->fts_info == FTS_NSOK) + f = fts->current; + if (f->status == FTS_FOLLOW) { - info(fts, f, f->fts_accpath, f->fts_statp, 0); - if (f->symlink && f->fts_info != FTS_SL) + f->status = 0; + if (f->fts_info == FTS_SL || ISTYPE(f, DT_LNK) || f->fts_info == FTS_NSOK) { - if (!(f->fts_link = fts->top)) - fts->bot = f; - fts->top = f; - fts->current = fts->previous; - fts->state = FTS_readdir; - continue; + info(fts, f, f->fts_accpath, f->fts_statp, 0); + if (f->symlink && f->fts_info != FTS_SL) + { + if (!(f->fts_link = fts->top)) + fts->bot = f; + fts->top = f; + fts->current = fts->previous; + fts->state = FTS_readdir; + continue; + } } } - } - f = f->fts_parent; - drop(fts, fts->current); - fts->current = f; - fts->state = FTS_readdir; - continue; + f = f->fts_parent; + drop(fts, fts->current); + fts->current = f; + fts->state = FTS_readdir; + continue; - case FTS_error: + case FTS_error: - return 0; + return 0; - default: + default: - fts->fts_errno = EINVAL; - fts->state = FTS_error; - return 0; + fts->fts_errno = EINVAL; + fts->state = FTS_error; + return 0; - } + } note: +#if __OBSOLETE__ < 20140101 + f->_fts_pathlen = (unsigned short)f->fts_pathlen; +#endif for (p = notify; p; p = p->next) if ((n = (*p->notifyf)(fts, f, p->context)) > 0) break; @@ -1429,6 +1464,8 @@ fts_children(register FTS* fts, int flags) case 0: + if (fts->comparf) + order(fts); fts->state = FTS_top_return; return fts->todo; diff --git a/usr/src/lib/libast/common/misc/ftwalk.c b/usr/src/lib/libast/common/misc/ftwalk.c index b8b3276279..ea33821944 100644 --- a/usr/src/lib/libast/common/misc/ftwalk.c +++ b/usr/src/lib/libast/common/misc/ftwalk.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/ftwflags.c b/usr/src/lib/libast/common/misc/ftwflags.c index 22899a52d2..6a2fe25e08 100644 --- a/usr/src/lib/libast/common/misc/ftwflags.c +++ b/usr/src/lib/libast/common/misc/ftwflags.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/getcwd.c b/usr/src/lib/libast/common/misc/getcwd.c index deee50b7a4..d6879304ca 100644 --- a/usr/src/lib/libast/common/misc/getcwd.c +++ b/usr/src/lib/libast/common/misc/getcwd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/getenv.c b/usr/src/lib/libast/common/misc/getenv.c index fa4407c1ef..5391beeaa8 100644 --- a/usr/src/lib/libast/common/misc/getenv.c +++ b/usr/src/lib/libast/common/misc/getenv.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,23 +21,88 @@ ***********************************************************************/ #pragma prototyped +#if _UWIN && __STDPP__ +__STDPP__directive pragma pp:hide getenv +#endif + #include "intercepts.h" +#if _UWIN && __STDPP__ +__STDPP__directive pragma pp:nohide getenv +#endif + /* * NOTE: the "intercepts" definition is here instead of astintercept.c because some * static linkers miss lone references to "intercepts" without "astintercept()" - * ALSO: { 0 } definition required by some dynamic linkers avers to common symbols + * ALSO: { 0 } definition required by some dynamic linkers averse to common symbols + * UWIN: no _ast_getenv macro map to maintain ast54 compatibility */ Intercepts_t intercepts = { 0 }; +#if _UWIN && !defined(getenv) + +#include <windows.h> + +extern char** environ; + +static char* +default_getenv(const char* name) +{ + register char** av; + register const char* cp; + register const char* sp; + register char c0; + register char c1; + + av = environ; + if (!av || !name || !(c0 = *name)) + return 0; + if (!(c1 = *++name)) + c1 = '='; + while (cp = *av++) + { + if (cp[0] != c0 || cp[1] != c1) + continue; + sp = name; + cp++; + while (*sp && *sp++ == *cp++); + if (*(sp-1) != *(cp-1)) + continue; + if (*sp == 0 && *cp == '=') + return (char*)(cp+1); + } + return 0; +} + +#endif + /* * get name from the environment */ -char* +#if defined(__EXPORT__) && defined(getenv) +#define extern __EXPORT__ +#endif + +extern char* getenv(const char* name) { +#if _UWIN && !defined(getenv) /* for ast54 compatibility */ + HANDLE dll; + + static char* (*posix_getenv)(const char*); + + if (!posix_getenv) + { + if (dll = GetModuleHandle("posix.dll")) + posix_getenv = (char*(*)(const char*))GetProcAddress(dll, "getenv"); + if (!posix_getenv) + posix_getenv = default_getenv; + } + return intercepts.intercept_getenv ? (*intercepts.intercept_getenv)(name) : (*posix_getenv)(name); +#else #undef getenv return intercepts.intercept_getenv ? (*intercepts.intercept_getenv)(name) : getenv(name); +#endif } diff --git a/usr/src/lib/libast/common/misc/glob.c b/usr/src/lib/libast/common/misc/glob.c index 4178731409..999db2d3cd 100644 --- a/usr/src/lib/libast/common/misc/glob.c +++ b/usr/src/lib/libast/common/misc/glob.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/intercepts.h b/usr/src/lib/libast/common/misc/intercepts.h index d9c207bde4..0f1ecc917d 100644 --- a/usr/src/lib/libast/common/misc/intercepts.h +++ b/usr/src/lib/libast/common/misc/intercepts.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/liberror.c b/usr/src/lib/libast/common/misc/liberror.c index dbddb2e67d..43fb5697e3 100644 --- a/usr/src/lib/libast/common/misc/liberror.c +++ b/usr/src/lib/libast/common/misc/liberror.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/libevent.c b/usr/src/lib/libast/common/misc/libevent.c index 06b8eeaff4..8330580413 100644 --- a/usr/src/lib/libast/common/misc/libevent.c +++ b/usr/src/lib/libast/common/misc/libevent.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/magic.c b/usr/src/lib/libast/common/misc/magic.c index e26d59d37e..6b086a3b08 100644 --- a/usr/src/lib/libast/common/misc/magic.c +++ b/usr/src/lib/libast/common/misc/magic.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/mime.c b/usr/src/lib/libast/common/misc/mime.c index c08ed50dff..d5e9debb37 100644 --- a/usr/src/lib/libast/common/misc/mime.c +++ b/usr/src/lib/libast/common/misc/mime.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/mimelib.h b/usr/src/lib/libast/common/misc/mimelib.h index 48ffa22c83..3c55acebf5 100644 --- a/usr/src/lib/libast/common/misc/mimelib.h +++ b/usr/src/lib/libast/common/misc/mimelib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/mimetype.c b/usr/src/lib/libast/common/misc/mimetype.c index 50955c96ee..7df8b6c0da 100644 --- a/usr/src/lib/libast/common/misc/mimetype.c +++ b/usr/src/lib/libast/common/misc/mimetype.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/optctx.c b/usr/src/lib/libast/common/misc/optctx.c index c255643ada..067236b5fd 100644 --- a/usr/src/lib/libast/common/misc/optctx.c +++ b/usr/src/lib/libast/common/misc/optctx.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/optesc.c b/usr/src/lib/libast/common/misc/optesc.c index e8e2f4f6c2..3e29f5051a 100644 --- a/usr/src/lib/libast/common/misc/optesc.c +++ b/usr/src/lib/libast/common/misc/optesc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/optget.c b/usr/src/lib/libast/common/misc/optget.c index 79041fb694..551051dca3 100644 --- a/usr/src/lib/libast/common/misc/optget.c +++ b/usr/src/lib/libast/common/misc/optget.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -50,13 +50,13 @@ #define OPT_ignorecase 0x004 /* arg match ignores case */ #define OPT_invert 0x008 /* flag inverts long sense */ #define OPT_listof 0x010 /* arg is ' ' or ',' list */ -#define OPT_minus 0x021 /* '-' is an option flag */ -#define OPT_number 0x040 /* arg is strtonll() number */ -#define OPT_oneof 0x080 /* arg may be set once */ -#define OPT_optional 0x100 /* arg is optional */ -#define OPT_string 0x200 /* arg is string */ +#define OPT_number 0x020 /* arg is strtonll() number */ +#define OPT_oneof 0x040 /* arg may be set once */ +#define OPT_optional 0x080 /* arg is optional */ +#define OPT_string 0x100 /* arg is string */ #define OPT_preformat 0001 /* output preformat string */ +#define OPT_proprietary 0002 /* proprietary docs */ #define OPT_TYPE (OPT_flag|OPT_number|OPT_string) @@ -902,6 +902,7 @@ init(register char* s, Optpass_t* p) s += n; } p->opts = s; + message((-1, "version=%d prefix=%d section=%d flags=%04x catalog=%s", p->version, p->prefix, p->section, p->flags, p->catalog)); return 0; } @@ -2150,7 +2151,7 @@ opthelp(const char* oopts, const char* what) } else return T(NiL, ID, "[* call optget() before opthelp() *]"); - if (style < STYLE_usage) + if (style <= STYLE_usage) { if (!(sp_text = sfstropen()) || !(sp_info = sfstropen())) goto nospace; @@ -2212,10 +2213,18 @@ opthelp(const char* oopts, const char* what) sfputc(mp, '\n'); else xl = 1; - while (c = *p++) + psp = 0; + for (;;) { - switch (c) + switch (c = *p++) { + case 0: + if (!(tsp = psp)) + goto style_usage; + p = psp->ob; + psp = psp->next; + free(tsp); + continue; case '\a': c = 'a'; break; @@ -2223,8 +2232,15 @@ opthelp(const char* oopts, const char* what) c = 'b'; break; case '\f': - c = 'f'; - break; + psp = info(psp, p, NiL, sp_info); + if (psp->nb) + p = psp->nb; + else + { + p = psp->ob; + psp = psp->next; + } + continue; case '\n': c = 'n'; break; @@ -2253,6 +2269,7 @@ opthelp(const char* oopts, const char* what) sfputc(mp, '\\'); sfputc(mp, c); } + style_usage: continue; case STYLE_keys: a = 0; @@ -3668,7 +3685,7 @@ opterror(register char* p, int version, char* catalog, int err) register int c; if (opt_info.num != LONG_MIN) - opt_info.num = opt_info.number = 0; + opt_info.num = (long)(opt_info.number = 0); if (!p || !(mp = opt_info.state->mp) && !(mp = opt_info.state->mp = sfstropen())) goto nospace; s = *p == '-' ? p : opt_info.name; @@ -3762,7 +3779,7 @@ opterror(register char* p, int version, char* catalog, int err) * `Usage: command ' * ':' error: opt_info.arg points to message sans `command: ' * - * '-' '+' '?' ':' '#' '[' ']' ' ' + * ':' '#' ' ' '[' ']' * invalid option chars * * -- terminates option list and returns 0 @@ -4015,6 +4032,7 @@ optget(register char** argv, const char* oopts) return 0; if (c == '+') opt_info.arg = 0; + message((-2, "c='%c' n=%d", c, n)); if (n == 2) { x = 0; @@ -4117,7 +4135,7 @@ optget(register char** argv, const char* oopts) */ if (opt_info.num != LONG_MIN) - opt_info.num = opt_info.number = !(k & OPT_cache_invert); + opt_info.num = (long)(opt_info.number = !(k & OPT_cache_invert)); if (!(k & (OPT_cache_string|OPT_cache_numeric))) return c; if (*(opt_info.arg = &argv[opt_info.index++][opt_info.offset])) @@ -4259,7 +4277,7 @@ optget(register char** argv, const char* oopts) } continue; } - message((-20, "optget: opt %s w %s num %ld", show(s), w, num)); + message((-20, "optget: opt %s c %c w %s num %ld", show(s), c, w, num)); if (*s == c && !w) break; else if (*s == '[') @@ -4663,6 +4681,7 @@ optget(register char** argv, const char* oopts) if (*s == GO) s = skip(s + 1, 0, 0, 0, 0, 1, 1, version); } + message((-21, "optget: opt %s", show(s))); } if (w && x) { @@ -4725,7 +4744,7 @@ optget(register char** argv, const char* oopts) */ if (opt_info.num != LONG_MIN) - opt_info.num = opt_info.number = num; + opt_info.num = (long)(opt_info.number = num); if ((n = *++s == '#') || *s == ':' || w && !nov && v && (optnumber(v, &e, NiL), n = !*e)) { if (w) @@ -4737,7 +4756,7 @@ optget(register char** argv, const char* oopts) pop(psp); return opterror("!", version, catalog, 0); } - opt_info.num = opt_info.number = 0; + opt_info.num = (long)(opt_info.number = 0); } else { @@ -4768,7 +4787,7 @@ optget(register char** argv, const char* oopts) else { opt_info.arg = 0; - opt_info.num = opt_info.number = 0; + opt_info.num = (long)(opt_info.number = 0); } break; } @@ -4988,7 +5007,7 @@ optget(register char** argv, const char* oopts) } } } while (*(s = skip(s, 0, 0, 0, 1, 0, 1, version)) == '['); - if (!(opt_info.num = opt_info.number = x)) + if (!(opt_info.num = (long)(opt_info.number = x))) { pop(psp); return opterror("*", version, catalog, 0); @@ -5003,7 +5022,7 @@ optget(register char** argv, const char* oopts) } else { - opt_info.num = opt_info.number = num; + opt_info.num = (long)(opt_info.number = num); if (!w && !argv[opt_info.index][opt_info.offset]) { opt_info.offset = 0; @@ -5148,7 +5167,7 @@ optstr(const char* str, const char* opts) e = opt_info.name; while (e < &opt_info.name[sizeof(opt_info.name)-1] && (*e++ = *s++)); opt_info.arg = 0; - opt_info.num = opt_info.number = 0; + opt_info.num = (long)(opt_info.number = 0); opt_info.option[0] = ':'; opt_info.option[1] = 0; return '#'; diff --git a/usr/src/lib/libast/common/misc/optjoin.c b/usr/src/lib/libast/common/misc/optjoin.c index bab68823fa..1f792e76e5 100644 --- a/usr/src/lib/libast/common/misc/optjoin.c +++ b/usr/src/lib/libast/common/misc/optjoin.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/optlib.h b/usr/src/lib/libast/common/misc/optlib.h index 08871b4012..ff697034f2 100644 --- a/usr/src/lib/libast/common/misc/optlib.h +++ b/usr/src/lib/libast/common/misc/optlib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -39,8 +39,8 @@ #define OPT_long 0x08 #define OPT_numeric 0x10 #define OPT_old 0x20 -#define OPT_plus 0x40 -#define OPT_proprietary 0x80 +#define OPT_minus 0x40 +#define OPT_plus 0x80 #define OPT_cache_flag 0x01 #define OPT_cache_invert 0x02 diff --git a/usr/src/lib/libast/common/misc/procclose.c b/usr/src/lib/libast/common/misc/procclose.c index 317ea584a1..07915f8b22 100644 --- a/usr/src/lib/libast/common/misc/procclose.c +++ b/usr/src/lib/libast/common/misc/procclose.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/procfree.c b/usr/src/lib/libast/common/misc/procfree.c index 6a7d429af6..c3effe4456 100644 --- a/usr/src/lib/libast/common/misc/procfree.c +++ b/usr/src/lib/libast/common/misc/procfree.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/proclib.h b/usr/src/lib/libast/common/misc/proclib.h index 55801fec6b..85dc1f7d2d 100644 --- a/usr/src/lib/libast/common/misc/proclib.h +++ b/usr/src/lib/libast/common/misc/proclib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/procopen.c b/usr/src/lib/libast/common/misc/procopen.c index ba026296c0..541fba6c14 100644 --- a/usr/src/lib/libast/common/misc/procopen.c +++ b/usr/src/lib/libast/common/misc/procopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/procrun.c b/usr/src/lib/libast/common/misc/procrun.c index 757613eb00..e6dd204d74 100644 --- a/usr/src/lib/libast/common/misc/procrun.c +++ b/usr/src/lib/libast/common/misc/procrun.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/recfmt.c b/usr/src/lib/libast/common/misc/recfmt.c index 404c809634..f056984e39 100644 --- a/usr/src/lib/libast/common/misc/recfmt.c +++ b/usr/src/lib/libast/common/misc/recfmt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/reclen.c b/usr/src/lib/libast/common/misc/reclen.c index 507619b35e..6ca007ee70 100644 --- a/usr/src/lib/libast/common/misc/reclen.c +++ b/usr/src/lib/libast/common/misc/reclen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/recstr.c b/usr/src/lib/libast/common/misc/recstr.c index f5e069c747..8ffed6ecfd 100644 --- a/usr/src/lib/libast/common/misc/recstr.c +++ b/usr/src/lib/libast/common/misc/recstr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -180,8 +180,6 @@ recstr(register const char* s, char** e) case '5': case '6': case '7': case '8': case '9': v = 0; a[n++] = strtol(s, &t, 0); - if (t > s && (*(t - 1) == 'l' || *(t - 1) == 'L')) - t--; s = (const char*)t - 1; continue; } diff --git a/usr/src/lib/libast/common/misc/setenviron.c b/usr/src/lib/libast/common/misc/setenviron.c index bc42f192ca..c2e75da3d5 100644 --- a/usr/src/lib/libast/common/misc/setenviron.c +++ b/usr/src/lib/libast/common/misc/setenviron.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/sigcrit.c b/usr/src/lib/libast/common/misc/sigcrit.c index 5941e8cd4b..1627e4ee4c 100644 --- a/usr/src/lib/libast/common/misc/sigcrit.c +++ b/usr/src/lib/libast/common/misc/sigcrit.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/sigdata.c b/usr/src/lib/libast/common/misc/sigdata.c index b295004b98..6b5c8a337d 100644 --- a/usr/src/lib/libast/common/misc/sigdata.c +++ b/usr/src/lib/libast/common/misc/sigdata.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/signal.c b/usr/src/lib/libast/common/misc/signal.c index 1eb9ed26cb..c64d04b941 100644 --- a/usr/src/lib/libast/common/misc/signal.c +++ b/usr/src/lib/libast/common/misc/signal.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/stack.c b/usr/src/lib/libast/common/misc/stack.c index 3878653442..941c7fa0fb 100644 --- a/usr/src/lib/libast/common/misc/stack.c +++ b/usr/src/lib/libast/common/misc/stack.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/state.c b/usr/src/lib/libast/common/misc/state.c index ec0681e234..2e6ac5eb6b 100644 --- a/usr/src/lib/libast/common/misc/state.c +++ b/usr/src/lib/libast/common/misc/state.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/stk.c b/usr/src/lib/libast/common/misc/stk.c index 52f90137ff..90de21eac3 100644 --- a/usr/src/lib/libast/common/misc/stk.c +++ b/usr/src/lib/libast/common/misc/stk.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/systrace.c b/usr/src/lib/libast/common/misc/systrace.c index 38d8fa172d..506125ba92 100644 --- a/usr/src/lib/libast/common/misc/systrace.c +++ b/usr/src/lib/libast/common/misc/systrace.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/translate.c b/usr/src/lib/libast/common/misc/translate.c index 995cdcd51b..b8d79b9fe5 100644 --- a/usr/src/lib/libast/common/misc/translate.c +++ b/usr/src/lib/libast/common/misc/translate.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -23,7 +23,7 @@ /* * AT&T Research and SCO - * ast i18n message translation + * ast l10n message translation */ #include "lclib.h" diff --git a/usr/src/lib/libast/common/misc/univdata.c b/usr/src/lib/libast/common/misc/univdata.c index afeeb943b9..865f3e8b9f 100644 --- a/usr/src/lib/libast/common/misc/univdata.c +++ b/usr/src/lib/libast/common/misc/univdata.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/misc/univlib.h b/usr/src/lib/libast/common/misc/univlib.h index 24a728a312..8ce891748e 100644 --- a/usr/src/lib/libast/common/misc/univlib.h +++ b/usr/src/lib/libast/common/misc/univlib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/obsolete/spawn.c b/usr/src/lib/libast/common/obsolete/spawn.c index 22f215ff85..3bc86e9854 100644 --- a/usr/src/lib/libast/common/obsolete/spawn.c +++ b/usr/src/lib/libast/common/obsolete/spawn.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathaccess.c b/usr/src/lib/libast/common/path/pathaccess.c index b23d7d30ad..c38b19a88e 100644 --- a/usr/src/lib/libast/common/path/pathaccess.c +++ b/usr/src/lib/libast/common/path/pathaccess.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathbin.c b/usr/src/lib/libast/common/path/pathbin.c index 58f4301142..97fff55e57 100644 --- a/usr/src/lib/libast/common/path/pathbin.c +++ b/usr/src/lib/libast/common/path/pathbin.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathcanon.c b/usr/src/lib/libast/common/path/pathcanon.c index c119bca002..72f4e6b444 100644 --- a/usr/src/lib/libast/common/path/pathcanon.c +++ b/usr/src/lib/libast/common/path/pathcanon.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathcat.c b/usr/src/lib/libast/common/path/pathcat.c index 92091826f8..75eebd420f 100644 --- a/usr/src/lib/libast/common/path/pathcat.c +++ b/usr/src/lib/libast/common/path/pathcat.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathcd.c b/usr/src/lib/libast/common/path/pathcd.c index 363cb1f709..e2c921a3a4 100644 --- a/usr/src/lib/libast/common/path/pathcd.c +++ b/usr/src/lib/libast/common/path/pathcd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathcheck.c b/usr/src/lib/libast/common/path/pathcheck.c index 0bedbb185b..624cd35da4 100644 --- a/usr/src/lib/libast/common/path/pathcheck.c +++ b/usr/src/lib/libast/common/path/pathcheck.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathexists.c b/usr/src/lib/libast/common/path/pathexists.c index ceb5f2ec56..23c47e4820 100644 --- a/usr/src/lib/libast/common/path/pathexists.c +++ b/usr/src/lib/libast/common/path/pathexists.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathfind.c b/usr/src/lib/libast/common/path/pathfind.c index 6f1907589b..ce736e52bb 100644 --- a/usr/src/lib/libast/common/path/pathfind.c +++ b/usr/src/lib/libast/common/path/pathfind.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathgetlink.c b/usr/src/lib/libast/common/path/pathgetlink.c index 515b0dbcd9..408b6757ae 100644 --- a/usr/src/lib/libast/common/path/pathgetlink.c +++ b/usr/src/lib/libast/common/path/pathgetlink.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathkey.c b/usr/src/lib/libast/common/path/pathkey.c index dbe350ded3..7fe06995a6 100644 --- a/usr/src/lib/libast/common/path/pathkey.c +++ b/usr/src/lib/libast/common/path/pathkey.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -151,7 +151,7 @@ pathkey(char* key, char* attr, const char* lang, const char* tool, const char* a if (!(k = getenv("PROBE_ATTRIBUTES"))) k = getenv("VERSION_ENVIRONMENT"); if (k) - while (c < elementsof(usr)) + while (c < (elementsof(usr) - 1)) { while (*k && (*k == ':' || *k == ' ')) k++; diff --git a/usr/src/lib/libast/common/path/pathnative.c b/usr/src/lib/libast/common/path/pathnative.c index 125ec26712..9075b49343 100644 --- a/usr/src/lib/libast/common/path/pathnative.c +++ b/usr/src/lib/libast/common/path/pathnative.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathpath.c b/usr/src/lib/libast/common/path/pathpath.c index f080bb63e3..cead8785f7 100644 --- a/usr/src/lib/libast/common/path/pathpath.c +++ b/usr/src/lib/libast/common/path/pathpath.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathposix.c b/usr/src/lib/libast/common/path/pathposix.c index d8d097c0fe..e6772e1881 100644 --- a/usr/src/lib/libast/common/path/pathposix.c +++ b/usr/src/lib/libast/common/path/pathposix.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathprobe.c b/usr/src/lib/libast/common/path/pathprobe.c index 09e629a665..be9e3bdcf5 100644 --- a/usr/src/lib/libast/common/path/pathprobe.c +++ b/usr/src/lib/libast/common/path/pathprobe.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathprog.c b/usr/src/lib/libast/common/path/pathprog.c new file mode 100644 index 0000000000..e184db0448 --- /dev/null +++ b/usr/src/lib/libast/common/path/pathprog.c @@ -0,0 +1,119 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped +/* + * Glenn Fowler + * AT&T Research + * + * return the full path of the current program in path + * command!=0 is used as a default + */ + +#include <ast.h> + +#if _WINIX +#include <ast_windows.h> +#include <ctype.h> +#endif + +#include "FEATURE/prog" + +static size_t +prog(const char* command, char* path, size_t size) +{ + ssize_t n; +#if _WINIX || _lib_getexecname + char* s; +#endif +#if _WINIX + char* t; + char* e; + int c; + int q; +#endif + +#ifdef _PROC_PROG + if ((n = readlink(_PROC_PROG, path, size)) > 0) + { + if (n < size) + path[n] = 0; + return n; + } +#endif +#if _lib_getexecname + if (s = (char*)getexecname()) + { + n = strlen(s); + if (n < size) + strcpy(path, s); + return n; + } +#endif +#if _WINIX + if (s = GetCommandLine()) + { + n = 0; + q = 0; + t = path; + e = path + size - 1; + while (c = *s++) + { + if (c == q) + q = 0; + else if (!q && c == '"') + q = c; + else if (!q && isspace(c)) + break; + else if (t < e) + *t++ = c == '\\' ? '/' : c; + else + n++; + } + if (t < e) + *t = 0; + return (t - path) + n; + } +#endif + if (command) + { + if ((n = strlen(command) + 1) <= size) + memcpy(path, command, n); + return n; + } + return 0; +} + +size_t +pathprog(const char* command, char* path, size_t size) +{ + ssize_t n; + char buf[PATH_MAX]; + + if ((n = prog(command, path, size)) > 0 && n <= size && *path != '/') + { + if (!pathpath(buf, path, NiL, PATH_REGULAR|PATH_EXECUTE)) + n = 0; + else if ((n = strlen(buf) + 1) <= size) + memcpy(path, buf, n); + } + return n; +} diff --git a/usr/src/lib/libast/common/path/pathrepl.c b/usr/src/lib/libast/common/path/pathrepl.c index dd424e473a..4a6d5372f5 100644 --- a/usr/src/lib/libast/common/path/pathrepl.c +++ b/usr/src/lib/libast/common/path/pathrepl.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathsetlink.c b/usr/src/lib/libast/common/path/pathsetlink.c index 9c8a507a92..97e1069af5 100644 --- a/usr/src/lib/libast/common/path/pathsetlink.c +++ b/usr/src/lib/libast/common/path/pathsetlink.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathshell.c b/usr/src/lib/libast/common/path/pathshell.c index 2ed2987829..aae0c60237 100644 --- a/usr/src/lib/libast/common/path/pathshell.c +++ b/usr/src/lib/libast/common/path/pathshell.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathstat.c b/usr/src/lib/libast/common/path/pathstat.c index 2d13bbd334..d8c224fad3 100644 --- a/usr/src/lib/libast/common/path/pathstat.c +++ b/usr/src/lib/libast/common/path/pathstat.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathtemp.c b/usr/src/lib/libast/common/path/pathtemp.c index 1656e1193e..3c4b72f59f 100644 --- a/usr/src/lib/libast/common/path/pathtemp.c +++ b/usr/src/lib/libast/common/path/pathtemp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/path/pathtmp.c b/usr/src/lib/libast/common/path/pathtmp.c index 98791c6aa2..0be0306a69 100644 --- a/usr/src/lib/libast/common/path/pathtmp.c +++ b/usr/src/lib/libast/common/path/pathtmp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/astconf.c b/usr/src/lib/libast/common/port/astconf.c index c0b08e8386..3b3c7000a7 100644 --- a/usr/src/lib/libast/common/port/astconf.c +++ b/usr/src/lib/libast/common/port/astconf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -26,7 +26,7 @@ * extended to allow some features to be set per-process */ -static const char id[] = "\n@(#)$Id: getconf (AT&T Research) 2008-04-24 $\0\n"; +static const char id[] = "\n@(#)$Id: getconf (AT&T Research) 2009-07-02 $\0\n"; #include "univlib.h" @@ -40,6 +40,10 @@ static const char id[] = "\n@(#)$Id: getconf (AT&T Research) 2008-04-24 $\0\n"; #include "conftab.h" #include "FEATURE/libpath" +#ifndef DEBUG_astconf +#define DEBUG_astconf 0 +#endif + #ifndef _pth_getconf #undef ASTCONF_system #define ASTCONF_system 0 @@ -64,23 +68,14 @@ static const char id[] = "\n@(#)$Id: getconf (AT&T Research) 2008-04-24 $\0\n"; # undef _lib_sysinfo #endif -#define OP_conformance 1 -#define OP_fs_3d 2 -#define OP_getconf 3 -#define OP_hosttype 4 -#define OP_libpath 5 -#define OP_libprefix 6 -#define OP_libsuffix 7 -#define OP_path_attributes 8 -#define OP_path_resolve 9 -#define OP_universe 10 - #define CONF_ERROR (CONF_USER<<0) #define CONF_READONLY (CONF_USER<<1) #define CONF_ALLOC (CONF_USER<<2) #define CONF_GLOBAL (CONF_USER<<3) +#define DEFAULT(o) ((state.std||!dynamic[o].ast)?dynamic[o].std:dynamic[o].ast) #define INITIALIZE() do{if(!state.data)synthesize(NiL,NiL,NiL);}while(0) +#define STANDARD(v) (streq(v,"standard")||streq(v,"strict")||streq(v,"posix")||streq(v,"xopen")) #define MAXVAL 256 @@ -101,7 +96,8 @@ typedef struct Feature_s struct Feature_s*next; const char* name; char* value; - char* strict; + char* std; + char* ast; short length; short standard; unsigned int flags; @@ -120,28 +116,33 @@ typedef struct static Feature_t dynamic[] = { +#define OP_conformance 0 { - &dynamic[1], + &dynamic[OP_conformance+1], "CONFORMANCE", "ast", "standard", + "ast", 11, CONF_AST, 0, OP_conformance }, +#define OP_fs_3d 1 { - &dynamic[2], + &dynamic[OP_fs_3d+1], "FS_3D", &null[0], "0", + 0, 5, CONF_AST, 0, OP_fs_3d }, +#define OP_getconf 2 { - &dynamic[3], + &dynamic[OP_getconf+1], "GETCONF", #ifdef _pth_getconf _pth_getconf, @@ -149,23 +150,27 @@ static Feature_t dynamic[] = &null[0], #endif 0, + 0, 7, CONF_AST, CONF_READONLY, OP_getconf }, +#define OP_hosttype 3 { - &dynamic[4], + &dynamic[OP_hosttype+1], "HOSTTYPE", HOSTTYPE, 0, + 0, 8, CONF_AST, CONF_READONLY, OP_hosttype }, +#define OP_libpath 4 { - &dynamic[5], + &dynamic[OP_libpath+1], "LIBPATH", #ifdef CONF_LIBPATH CONF_LIBPATH, @@ -173,13 +178,15 @@ static Feature_t dynamic[] = &null[0], #endif 0, + 0, 7, CONF_AST, 0, OP_libpath }, +#define OP_libprefix 5 { - &dynamic[6], + &dynamic[OP_libprefix+1], "LIBPREFIX", #ifdef CONF_LIBPREFIX CONF_LIBPREFIX, @@ -187,13 +194,15 @@ static Feature_t dynamic[] = "lib", #endif 0, + 0, 9, CONF_AST, 0, OP_libprefix }, +#define OP_libsuffix 6 { - &dynamic[7], + &dynamic[OP_libsuffix+1], "LIBSUFFIX", #ifdef CONF_LIBSUFFIX CONF_LIBSUFFIX, @@ -201,13 +210,15 @@ static Feature_t dynamic[] = ".so", #endif 0, + 0, 9, CONF_AST, 0, OP_libsuffix }, +#define OP_path_attributes 7 { - &dynamic[8], + &dynamic[OP_path_attributes+1], "PATH_ATTRIBUTES", #if _WINIX "c", @@ -215,26 +226,31 @@ static Feature_t dynamic[] = &null[0], #endif &null[0], + 0, 15, CONF_AST, CONF_READONLY, OP_path_attributes }, +#define OP_path_resolve 8 { - &dynamic[9], + &dynamic[OP_path_resolve+1], "PATH_RESOLVE", &null[0], + "physical", "metaphysical", 12, CONF_AST, 0, OP_path_resolve }, +#define OP_universe 9 { 0, "UNIVERSE", &null[0], "att", + 0, 8, CONF_AST, 0, @@ -252,6 +268,8 @@ typedef struct const char* name; Feature_t* features; + int std; + /* default initialization from here down */ int prefix; @@ -266,7 +284,7 @@ typedef struct } State_t; -static State_t state = { "getconf", "_AST_FEATURES", dynamic }; +static State_t state = { "getconf", "_AST_FEATURES", dynamic, -1 }; static char* feature(const char*, const char*, const char*, unsigned int, Error_f); @@ -293,9 +311,10 @@ synthesize(register Feature_t* fp, const char* path, const char* value) register char* s; register char* d; register char* v; + register char* p; register int n; -#if DEBUG || DEBUG_astconf +#if DEBUG_astconf if (fp) error(-2, "astconf synthesize name=%s path=%s value=%s fp=%p%s", fp->name, path, value, fp, state.synthesizing ? " SYNTHESIZING" : ""); #endif @@ -376,11 +395,11 @@ synthesize(register Feature_t* fp, const char* path, const char* value) value = (const char*)d; goto ok; } - for (s = d + n + 1; *s && !isspace(*s); s++); + for (s = p = d + n + 1; *s && !isspace(*s); s++); for (; isspace(*s); s++); for (v = s; *s && !isspace(*s); s++); n = s - v; - if (strneq(v, value, n)) + if ((!path || *path == *p && strlen(path) == (v - p - 1) && !memcmp(path, p, v - p - 1)) && strneq(v, value, n)) goto ok; for (; isspace(*s); s++); if (*s) @@ -433,6 +452,9 @@ synthesize(register Feature_t* fp, const char* path, const char* value) for (s = (char*)path; *d = *s++; d++); *d++ = ' '; for (s = (char*)value; *d = *s++; d++); +#if DEBUG_astconf + error(-3, "astconf synthesize %s", state.data - state.prefix); +#endif setenviron(state.data - state.prefix); if (state.notify) (*state.notify)(NiL, NiL, state.data - state.prefix); @@ -466,7 +488,7 @@ initialize(register Feature_t* fp, const char* path, const char* command, const register char* p; register int ok = 1; -#if DEBUG || DEBUG_astconf +#if DEBUG_astconf error(-2, "astconf initialize name=%s path=%s command=%s succeed=%s fail=%s fp=%p%s", fp->name, path, command, succeed, fail, fp, state.synthesizing ? " SYNTHESIZING" : ""); #endif switch (fp->op) @@ -484,7 +506,7 @@ initialize(register Feature_t* fp, const char* path, const char* command, const ok = fs3d(FS3D_TEST); break; case OP_universe: - ok = streq(_UNIV_DEFAULT, "att"); + ok = streq(_UNIV_DEFAULT, DEFAULT(OP_universe)); /*FALLTHROUGH...*/ default: if (p = getenv("PATH")) @@ -493,7 +515,7 @@ initialize(register Feature_t* fp, const char* path, const char* command, const register char* d = p; Sfio_t* tmp; -#if DEBUG || DEBUG_astconf +#if DEBUG_astconf error(-2, "astconf initialize name=%s ok=%d PATH=%s", fp->name, ok, p); #endif if (tmp = sfstropen()) @@ -566,6 +588,9 @@ initialize(register Feature_t* fp, const char* path, const char* command, const } break; } +#if DEBUG_astconf + error(-1, "AHA#%d state.std=%d %s [%s] std=%s ast=%s value=%s ok=%d", __LINE__, state.std, fp->name, ok ? succeed : fail, fp->std, fp->ast, fp->value, ok); +#endif synthesize(fp, path, ok ? succeed : fail); } @@ -579,7 +604,7 @@ format(register Feature_t* fp, const char* path, const char* value, unsigned int register Feature_t* sp; register int n; -#if DEBUG || DEBUG_astconf +#if DEBUG_astconf error(-2, "astconf format name=%s path=%s value=%s flags=%04x fp=%p%s", fp->name, path, value, flags, fp, state.synthesizing ? " SYNTHESIZING" : ""); #endif if (value) @@ -590,15 +615,27 @@ format(register Feature_t* fp, const char* path, const char* value, unsigned int { case OP_conformance: - if (value && (streq(value, "strict") || streq(value, "posix") || streq(value, "xopen"))) - value = fp->strict; - n = streq(fp->value, fp->strict); + if (value && STANDARD(value)) + value = fp->std; + n = state.std = streq(fp->value, fp->std); +#if DEBUG_astconf + error(-1, "AHA#%d state.std=%d %s [%s] std=%s ast=%s value=%s", __LINE__, state.std, fp->name, value, fp->std, fp->ast, fp->value); +#endif if (!synthesize(fp, path, value)) - initialize(fp, path, NiL, fp->strict, fp->value); - if (!n && streq(fp->value, fp->strict)) + initialize(fp, path, NiL, fp->std, fp->value); +#if DEBUG_astconf + error(-1, "AHA#%d state.std=%d %s [%s] std=%s ast=%s value=%s", __LINE__, state.std, fp->name, value, fp->std, fp->ast, fp->value); +#endif + if (!n && STANDARD(fp->value)) + { + state.std = 1; for (sp = state.features; sp; sp = sp->next) - if (sp->strict && sp->op && sp->op != OP_conformance) - astconf(sp->name, path, sp->strict); + if (sp->std && sp->op && sp->op != OP_conformance) + astconf(sp->name, path, sp->std); + } +#if DEBUG_astconf + error(-1, "AHA#%d state.std=%d %s [%s] std=%s ast=%s value=%s", __LINE__, state.std, fp->name, value, fp->std, fp->ast, fp->value); +#endif break; case OP_fs_3d: @@ -637,13 +674,13 @@ format(register Feature_t* fp, const char* path, const char* value, unsigned int case OP_path_resolve: if (!synthesize(fp, path, value)) - initialize(fp, path, NiL, "logical", "metaphysical"); + initialize(fp, path, NiL, "logical", DEFAULT(OP_path_resolve)); break; case OP_universe: #if _lib_universe if (getuniverse(fp->value) < 0) - strcpy(fp->value, "att"); + strcpy(fp->value, DEFAULT(OP_universe)); if (value) setuniverse(value); #else @@ -672,9 +709,26 @@ format(register Feature_t* fp, const char* path, const char* value, unsigned int strcpy(fp->value, univ_name[n - 1]); #else if (value && streq(path, "=")) - strcpy(fp->value, value); + { + if (state.synthesizing) + { + if (!(fp->flags & CONF_ALLOC)) + fp->value = 0; + n = strlen(value); + if (!(fp->value = newof(fp->value, char, n, 1))) + fp->value = null; + else + { + fp->flags |= CONF_ALLOC; + memcpy(fp->value, value, n); + fp->value[n] = 0; + } + } + else + synthesize(fp, path, value); + } else - initialize(fp, path, "echo", "att", "ucb"); + initialize(fp, path, "echo", DEFAULT(OP_universe), "ucb"); #endif #endif break; @@ -704,7 +758,7 @@ feature(const char* name, const char* path, const char* value, unsigned int flag if (value && (streq(value, "-") || streq(value, "0"))) value = null; for (fp = state.features; fp && !streq(fp->name, name); fp = fp->next); -#if DEBUG || DEBUG_astconf +#if DEBUG_astconf error(-2, "astconf feature name=%s path=%s value=%s flags=%04x fp=%p%s", name, path, value, flags, fp, state.synthesizing ? " SYNTHESIZING" : ""); #endif if (!fp) @@ -720,9 +774,11 @@ feature(const char* name, const char* path, const char* value, unsigned int flag (*conferror)(&state, &state, 2, "%s: out of space", name); return 0; } + fp->op = -1; fp->name = (const char*)fp + sizeof(Feature_t); strcpy((char*)fp->name, name); fp->length = n; + fp->std = &null[0]; fp->next = state.features; state.features = fp; } @@ -807,14 +863,14 @@ lookup(register Lookup_t* look, const char* name, unsigned int flags) look->section = 1; #endif look->name = name; -#if DEBUG || DEBUG_astconf +#if DEBUG_astconf error(-2, "astconf normal name=%s standard=%d section=%d call=%d flags=%04x elements=%d", look->name, look->standard, look->section, look->call, flags, conf_elements); #endif c = *((unsigned char*)name); while (lo <= hi) { mid = lo + (hi - lo) / 2; -#if DEBUG || DEBUG_astconf +#if DEBUG_astconf error(-3, "astconf lookup name=%s mid=%s", name, mid->name); #endif if (!(v = c - *((unsigned char*)mid->name)) && !(v = strcmp(name, mid->name))) @@ -849,7 +905,7 @@ lookup(register Lookup_t* look, const char* name, unsigned int flags) if (look->call < 0 && look->standard >= 0 && (look->section <= 1 || (mid->flags & CONF_MINMAX))) look->flags |= CONF_MINMAX; look->conf = mid; -#if DEBUG || DEBUG_astconf +#if DEBUG_astconf error(-2, "astconf lookup name=%s standard=%d:%d section=%d:%d call=%d:%d", look->name, look->standard, mid->standard, look->section, mid->section, look->call, mid->call); #endif return 1; @@ -904,9 +960,9 @@ print(Sfio_t* sp, register Lookup_t* look, const char* name, const char* path, i flags |= CONF_PREFIXED; olderrno = errno; errno = 0; -#if DEBUG || DEBUG_astconf - error(-1, "astconf name=%s:%s standard=%d section=%d call=%s op=%d flags=|%s%s%s%s%s:|%s%s%s%s%s%s%s%s%s%s" - , name , p->name, p->standard, p->section, prefix[p->call + CONF_call].name, p->op +#if DEBUG_astconf + error(-1, "astconf name=%s:%s:%s standard=%d section=%d call=%s op=%d flags=|%s%s%s%s%s:|%s%s%s%s%s%s%s%s%s%s" + , name, look->name, p->name, p->standard, p->section, prefix[p->call + CONF_call].name, p->op , (flags & CONF_FEATURE) ? "FEATURE|" : "" , (flags & CONF_LIMIT) ? "LIMIT|" : "" , (flags & CONF_MINMAX) ? "MINMAX|" : "" @@ -1035,7 +1091,7 @@ print(Sfio_t* sp, register Lookup_t* look, const char* name, const char* path, i call = 0; if (p->standard == CONF_AST) { - if (streq(look->name, "RELEASE") && (i = open("/proc/version", O_RDONLY)) >= 0) + if (streq(p->name, "RELEASE") && (i = open("/proc/version", O_RDONLY)) >= 0) { n = read(i, buf, sizeof(buf) - 1); close(i); @@ -1061,7 +1117,7 @@ print(Sfio_t* sp, register Lookup_t* look, const char* name, const char* path, i predef: if (look->standard == CONF_AST) { - if (streq(look->name, "VERSION")) + if (streq(p->name, "VERSION")) { v = _AST_VERSION; break; @@ -1253,7 +1309,7 @@ nativeconf(Proc_t** pp, const char* operand) char* cmd[3]; long ops[2]; -#if DEBUG || DEBUG_astconf +#if DEBUG_astconf error(-2, "astconf defer %s %s", _pth_getconf, operand); #endif cmd[0] = (char*)state.id; diff --git a/usr/src/lib/libast/common/port/astcopy.c b/usr/src/lib/libast/common/port/astcopy.c index 74c47eca32..3634328d62 100644 --- a/usr/src/lib/libast/common/port/astcopy.c +++ b/usr/src/lib/libast/common/port/astcopy.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/astdynamic.c b/usr/src/lib/libast/common/port/astdynamic.c index faff88ad69..a772b67878 100644 --- a/usr/src/lib/libast/common/port/astdynamic.c +++ b/usr/src/lib/libast/common/port/astdynamic.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/astlicense.c b/usr/src/lib/libast/common/port/astlicense.c index 5e15cee13a..6627b20b6b 100644 --- a/usr/src/lib/libast/common/port/astlicense.c +++ b/usr/src/lib/libast/common/port/astlicense.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -428,7 +428,8 @@ astlicense(char* p, int size, char* file, char* options, int cc1, int cc2, int c line = 0; for (;;) { - for (first = 1; c = *s; first = 0) + first = 1; + while (c = *s) { while (c == ' ' || c == '\t' || c == '\n' && ++line || c == '\r' || c == ',' || c == ';' || c == ')') c = *++s; @@ -640,6 +641,7 @@ astlicense(char* p, int size, char* file, char* options, int cc1, int cc2, int c } if (*s) s++; + first = 0; } if (!options || !*(s = options)) break; diff --git a/usr/src/lib/libast/common/port/astmath.c b/usr/src/lib/libast/common/port/astmath.c index 8637dc9300..eba93b384b 100644 --- a/usr/src/lib/libast/common/port/astmath.c +++ b/usr/src/lib/libast/common/port/astmath.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/astquery.c b/usr/src/lib/libast/common/port/astquery.c index 3c45c861fc..2cfa7bd3d3 100644 --- a/usr/src/lib/libast/common/port/astquery.c +++ b/usr/src/lib/libast/common/port/astquery.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/aststatic.c b/usr/src/lib/libast/common/port/aststatic.c index 4ac6bc08a3..a4764670c2 100644 --- a/usr/src/lib/libast/common/port/aststatic.c +++ b/usr/src/lib/libast/common/port/aststatic.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/astwinsize.c b/usr/src/lib/libast/common/port/astwinsize.c index 21416eb9ec..350859a2b1 100644 --- a/usr/src/lib/libast/common/port/astwinsize.c +++ b/usr/src/lib/libast/common/port/astwinsize.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/iblocks.c b/usr/src/lib/libast/common/port/iblocks.c index 33e88f01dc..3fd30dcbde 100644 --- a/usr/src/lib/libast/common/port/iblocks.c +++ b/usr/src/lib/libast/common/port/iblocks.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/lc.c b/usr/src/lib/libast/common/port/lc.c index 0e6aa22cfc..d4f2158c2e 100644 --- a/usr/src/lib/libast/common/port/lc.c +++ b/usr/src/lib/libast/common/port/lc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -125,6 +125,7 @@ lcindex(int category, int min) case LC_COLLATE: return AST_LC_COLLATE; case LC_CTYPE: return AST_LC_CTYPE; case LC_IDENTIFICATION: return AST_LC_IDENTIFICATION; + case LC_LANG: return AST_LC_LANG; case LC_MEASUREMENT: return AST_LC_MEASUREMENT; case LC_MESSAGES: return AST_LC_MESSAGES; case LC_MONETARY: return AST_LC_MONETARY; @@ -703,6 +704,8 @@ lcmake(const char* name) lc->language = lp ? lp : &lc_languages[0]; lc->territory = tp ? tp : &lc_territories[0]; lc->charset = cp ? cp : &lc_charsets[0]; + if (!strcmp(lc->charset->code, "utf8")) + lc->flags |= LC_utf8; lc->attributes = al; for (i = 0; i < elementsof(lc->info); i++) lc->info[i].lc = lc; diff --git a/usr/src/lib/libast/common/port/lcgen.c b/usr/src/lib/libast/common/port/lcgen.c index 1272faa5cd..4fd1271ce5 100644 --- a/usr/src/lib/libast/common/port/lcgen.c +++ b/usr/src/lib/libast/common/port/lcgen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -323,14 +323,15 @@ char** argv; fprintf(hf, "\n"); fprintf(hf, "#define LC_abbreviated\t\t0x00001\n"); fprintf(hf, "#define LC_checked\t\t0x00002\n"); - fprintf(hf, "#define LC_default\t\t0x00004\n"); - fprintf(hf, "#define LC_defined\t\t0x00008\n"); - fprintf(hf, "#define LC_debug\t\t0x00010\n"); + fprintf(hf, "#define LC_debug\t\t0x00004\n"); + fprintf(hf, "#define LC_default\t\t0x00008\n"); + fprintf(hf, "#define LC_defined\t\t0x00010\n"); fprintf(hf, "#define LC_local\t\t0x00020\n"); fprintf(hf, "#define LC_primary\t\t0x00040\n"); fprintf(hf, "#define LC_qualified\t\t0x00080\n"); fprintf(hf, "#define LC_undefined\t\t0x00100\n"); - fprintf(hf, "#define LC_verbose\t\t0x00200\n"); + fprintf(hf, "#define LC_utf8\t\t\t0x00200\n"); + fprintf(hf, "#define LC_verbose\t\t0x00400\n"); fprintf(hf, "#define LC_user\t\t\t0x10000\n"); fprintf(lf, "/* : : generated by %s : : */\n", command); fprintf(lf, "\n"); diff --git a/usr/src/lib/libast/common/port/lclang.h b/usr/src/lib/libast/common/port/lclang.h index 0e0d1242f8..2433d9fcfa 100644 --- a/usr/src/lib/libast/common/port/lclang.h +++ b/usr/src/lib/libast/common/port/lclang.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/lclib.h b/usr/src/lib/libast/common/port/lclib.h index ae648a5168..50dc36ea53 100644 --- a/usr/src/lib/libast/common/port/lclib.h +++ b/usr/src/lib/libast/common/port/lclib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/mc.c b/usr/src/lib/libast/common/port/mc.c index 6b016578e8..e5637b5669 100644 --- a/usr/src/lib/libast/common/port/mc.c +++ b/usr/src/lib/libast/common/port/mc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/mnt.c b/usr/src/lib/libast/common/port/mnt.c index d7531b028c..37a6ed4812 100644 --- a/usr/src/lib/libast/common/port/mnt.c +++ b/usr/src/lib/libast/common/port/mnt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/port/touch.c b/usr/src/lib/libast/common/port/touch.c index 85e85009f6..f3974502bb 100644 --- a/usr/src/lib/libast/common/port/touch.c +++ b/usr/src/lib/libast/common/port/touch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/preroot/getpreroot.c b/usr/src/lib/libast/common/preroot/getpreroot.c index c8d82de894..e63b6678eb 100644 --- a/usr/src/lib/libast/common/preroot/getpreroot.c +++ b/usr/src/lib/libast/common/preroot/getpreroot.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/preroot/ispreroot.c b/usr/src/lib/libast/common/preroot/ispreroot.c index 7a99a1ab2f..d03bdbb4af 100644 --- a/usr/src/lib/libast/common/preroot/ispreroot.c +++ b/usr/src/lib/libast/common/preroot/ispreroot.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/preroot/realopen.c b/usr/src/lib/libast/common/preroot/realopen.c index 67be26f329..cbe6f0031d 100644 --- a/usr/src/lib/libast/common/preroot/realopen.c +++ b/usr/src/lib/libast/common/preroot/realopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/preroot/setpreroot.c b/usr/src/lib/libast/common/preroot/setpreroot.c index 7ea63abe93..fa482ec03a 100644 --- a/usr/src/lib/libast/common/preroot/setpreroot.c +++ b/usr/src/lib/libast/common/preroot/setpreroot.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regalloc.c b/usr/src/lib/libast/common/regex/regalloc.c index 6df78772a2..710800ef60 100644 --- a/usr/src/lib/libast/common/regex/regalloc.c +++ b/usr/src/lib/libast/common/regex/regalloc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regcache.c b/usr/src/lib/libast/common/regex/regcache.c index e306bb0855..f40f31fc09 100644 --- a/usr/src/lib/libast/common/regex/regcache.c +++ b/usr/src/lib/libast/common/regex/regcache.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regclass.c b/usr/src/lib/libast/common/regex/regclass.c index 2a4ada89ae..b68ef4b00b 100644 --- a/usr/src/lib/libast/common/regex/regclass.c +++ b/usr/src/lib/libast/common/regex/regclass.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regcoll.c b/usr/src/lib/libast/common/regex/regcoll.c index 6294becacd..178b635790 100644 --- a/usr/src/lib/libast/common/regex/regcoll.c +++ b/usr/src/lib/libast/common/regex/regcoll.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regcomp.c b/usr/src/lib/libast/common/regex/regcomp.c index 9b6dbf8f98..90098dfbc2 100644 --- a/usr/src/lib/libast/common/regex/regcomp.c +++ b/usr/src/lib/libast/common/regex/regcomp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -121,6 +121,7 @@ typedef struct Cenv_s int parno; /* number of last open paren */ int parnest; /* paren nest count */ int posixkludge; /* to make * nonspecial */ + int regexp; /* <regexp.h> compatibility */ Token_t token; /* token lookahead */ Stats_t stats; /* RE statistics */ int terminator; /* pattern terminator */ @@ -1289,6 +1290,8 @@ bra(Cenv_t* env) case 0: goto error; case ':': + if (env->regexp) + goto normal; if (inrange == 1) { setadd(e->re.charclass, last); @@ -1336,6 +1339,8 @@ bra(Cenv_t* env) elements++; continue; case '=': + if (env->regexp) + goto normal; if (inrange == 2) goto erange; if (inrange == 1) @@ -1355,6 +1360,8 @@ bra(Cenv_t* env) elements++; continue; case '.': + if (env->regexp) + goto normal; if ((c = regcollate((char*)env->cursor, (char**)&env->cursor, (char*)buf, sizeof(buf))) < 0) goto ecollate; if (c > 1) @@ -1363,6 +1370,7 @@ bra(Cenv_t* env) complicated++; break; default: + normal: if (*env->cursor == env->terminator || *env->cursor == env->delimiter && (env->flags & REG_ESCAPE)) goto error; break; @@ -1535,6 +1543,8 @@ bra(Cenv_t* env) case 0: goto error; case ':': + if (env->regexp) + goto complicated_normal; if (inrange == 1) ce = col(ce, ic, rp, rw, rc, NiL, 0, 0); if (!(f = regclass((char*)env->cursor, (char**)&env->cursor))) @@ -1569,6 +1579,8 @@ bra(Cenv_t* env) inrange = 0; continue; case '=': + if (env->regexp) + goto complicated_normal; if (inrange == 2) goto erange; if (inrange == 1) @@ -1629,12 +1641,15 @@ bra(Cenv_t* env) c = *pp; continue; case '.': + if (env->regexp) + goto complicated_normal; pp = (unsigned char*)cb[inrange]; if ((w = regcollate((char*)env->cursor, (char**)&env->cursor, (char*)pp, COLL_KEY_MAX)) < 0) goto ecollate; c = buf[0]; break; default: + complicated_normal: if (*env->cursor == env->terminator || *env->cursor == env->delimiter && (env->flags & REG_ESCAPE)) goto error; break; @@ -3226,6 +3241,7 @@ regcomp(regex_t* p, const char* pattern, regflags_t flags) env.explicit = env.mappednewline; p->env->leading = (env.flags & REG_SHELL_DOT) ? env.mappeddot : -1; env.posixkludge = !(env.flags & (REG_EXTENDED|REG_SHELL)); + env.regexp = !!(env.flags & REG_REGEXP); env.token.lex = 0; env.token.push = 0; if (env.flags & REG_DELIMITED) diff --git a/usr/src/lib/libast/common/regex/regdecomp.c b/usr/src/lib/libast/common/regex/regdecomp.c index 7f400a81ce..a89722480a 100644 --- a/usr/src/lib/libast/common/regex/regdecomp.c +++ b/usr/src/lib/libast/common/regex/regdecomp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regerror.c b/usr/src/lib/libast/common/regex/regerror.c index 477f007da1..596e62ce45 100644 --- a/usr/src/lib/libast/common/regex/regerror.c +++ b/usr/src/lib/libast/common/regex/regerror.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regexec.c b/usr/src/lib/libast/common/regex/regexec.c index a5dca77586..3293c2207e 100644 --- a/usr/src/lib/libast/common/regex/regexec.c +++ b/usr/src/lib/libast/common/regex/regexec.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regfatal.c b/usr/src/lib/libast/common/regex/regfatal.c index 3da0162482..ccf3a1ec44 100644 --- a/usr/src/lib/libast/common/regex/regfatal.c +++ b/usr/src/lib/libast/common/regex/regfatal.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/reginit.c b/usr/src/lib/libast/common/regex/reginit.c index fa027fac53..133702b721 100644 --- a/usr/src/lib/libast/common/regex/reginit.c +++ b/usr/src/lib/libast/common/regex/reginit.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/reglib.h b/usr/src/lib/libast/common/regex/reglib.h index 4260ba901e..25f461debe 100644 --- a/usr/src/lib/libast/common/regex/reglib.h +++ b/usr/src/lib/libast/common/regex/reglib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -65,6 +65,10 @@ typedef struct regsubop_s #include <ctype.h> #include <errno.h> +#if _BLD_DEBUG && !defined(_AST_REGEX_DEBUG) +#define _AST_REGEX_DEBUG 1 +#endif + #define MBSIZE(p) ((ast.tmp_int=mbsize(p))>0?ast.tmp_int:1) #undef RE_DUP_MAX /* posix puts this in limits.h! */ diff --git a/usr/src/lib/libast/common/regex/regnexec.c b/usr/src/lib/libast/common/regex/regnexec.c index a265d0ffd1..28763b471a 100644 --- a/usr/src/lib/libast/common/regex/regnexec.c +++ b/usr/src/lib/libast/common/regex/regnexec.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -406,7 +406,7 @@ parserep(Env_t* env, Rex_t* rex, Rex_t* cont, unsigned char* s, int n) int r = NONE; Rex_t catcher; - DEBUG_TEST(0x0010,(sfprintf(sfstdout, "AHA#%04d 0x%04x parserep %s %d %d %d `%-.*s'\n", __LINE__, debug_flag, rexname(rex->re.group.expr.rex), rex->lo, n, rex->hi, env->end - s, s)),(0)); + DEBUG_TEST(0x0010,(sfprintf(sfstdout, "AHA#%04d 0x%04x parserep %s %d %d %d %d `%-.*s'\n", __LINE__, debug_flag, rexname(rex->re.group.expr.rex), rex->re.group.number, rex->lo, n, rex->hi, env->end - s, s)),(0)); if ((rex->flags & REG_MINIMAL) && n >= rex->lo && n < rex->hi) { if (env->stack && pospush(env, rex, s, END_ANY)) @@ -438,21 +438,19 @@ parserep(Env_t* env, Rex_t* rex, Rex_t* cont, unsigned char* s, int n) rex->re.rep_catch.beg = s; if (env->stack) { -DEBUG_TEST(0x0004,(sfprintf(sfstdout,"AHA#%04d 0x%04x PUSH (%d,%d)(%d,%d) (%d,%d)(%d,%d)\n", __LINE__, debug_flag, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0)); if (matchpush(env, rex)) return BAD; if (pospush(env, rex, s, BEG_ONE)) return BAD; -DEBUG_TEST(0x0004,(sfprintf(sfstdout,"AHA#%04d 0x%04x PUSH (%d,%d)(%d,%d) (%d,%d)(%d,%d)\n", __LINE__, debug_flag, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0)); +DEBUG_TEST(0x0004,(sfprintf(sfstdout,"AHA#%04d 0x%04x PUSH %d (%d,%d)(%d,%d)(%d,%d) (%d,%d)(%d,%d)(%d,%d)\n", __LINE__, debug_flag, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->best[2].rm_so, env->best[2].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo, env->match[2].rm_so, env->match[2].rm_eo)),(0)); } r = parse(env, rex->re.group.expr.rex, &catcher, s); - DEBUG_TEST(0x0010,(sfprintf(sfstdout, "AHA#%04d 0x%04x parserep parse %d `%-.*s'\n", __LINE__, debug_flag, r, env->end - s, s)),(0)); + DEBUG_TEST(0x0010,(sfprintf(sfstdout, "AHA#%04d 0x%04x parserep parse %d %d `%-.*s'\n", __LINE__, debug_flag, rex->re.group.number, r, env->end - s, s)),(0)); if (env->stack) { -DEBUG_TEST(0x0004,(sfprintf(sfstdout,"AHA#%04d 0x%04x POP (%d,%d)(%d,%d) (%d,%d)(%d,%d)\n", __LINE__, debug_flag, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0)); pospop(env); matchpop(env, rex); -DEBUG_TEST(0x0004,(sfprintf(sfstdout,"AHA#%04d 0x%04x POP (%d,%d)(%d,%d) (%d,%d)(%d,%d)\n", __LINE__, debug_flag, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo)),(0)); +DEBUG_TEST(0x0004,(sfprintf(sfstdout,"AHA#%04d 0x%04x POP %d %d (%d,%d)(%d,%d)(%d,%d) (%d,%d)(%d,%d)(%d,%d)\n", __LINE__, debug_flag, rex->re.group.number, r, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->best[2].rm_so, env->best[2].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo, env->match[2].rm_so, env->match[2].rm_eo)),(0)); } switch (r) { diff --git a/usr/src/lib/libast/common/regex/regrecord.c b/usr/src/lib/libast/common/regex/regrecord.c index 4247cec1b2..1f531aa63a 100644 --- a/usr/src/lib/libast/common/regex/regrecord.c +++ b/usr/src/lib/libast/common/regex/regrecord.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regrexec.c b/usr/src/lib/libast/common/regex/regrexec.c index bfda0a3b14..4b49a57d63 100644 --- a/usr/src/lib/libast/common/regex/regrexec.c +++ b/usr/src/lib/libast/common/regex/regrexec.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regstat.c b/usr/src/lib/libast/common/regex/regstat.c index 35f15e696d..c896068672 100644 --- a/usr/src/lib/libast/common/regex/regstat.c +++ b/usr/src/lib/libast/common/regex/regstat.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regsub.c b/usr/src/lib/libast/common/regex/regsub.c index f456251b51..749c9d1a13 100644 --- a/usr/src/lib/libast/common/regex/regsub.c +++ b/usr/src/lib/libast/common/regex/regsub.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regsubcomp.c b/usr/src/lib/libast/common/regex/regsubcomp.c index 83a0664989..d7b3625049 100644 --- a/usr/src/lib/libast/common/regex/regsubcomp.c +++ b/usr/src/lib/libast/common/regex/regsubcomp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/regsubexec.c b/usr/src/lib/libast/common/regex/regsubexec.c index 5040167934..b4599ee5a1 100644 --- a/usr/src/lib/libast/common/regex/regsubexec.c +++ b/usr/src/lib/libast/common/regex/regsubexec.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/regex/ucs_names.h b/usr/src/lib/libast/common/regex/ucs_names.h index daf835f73e..13acdd5edd 100644 --- a/usr/src/lib/libast/common/regex/ucs_names.h +++ b/usr/src/lib/libast/common/regex/ucs_names.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfclrerr.c b/usr/src/lib/libast/common/sfio/_sfclrerr.c index fbae931f5d..a5c02aca9c 100644 --- a/usr/src/lib/libast/common/sfio/_sfclrerr.c +++ b/usr/src/lib/libast/common/sfio/_sfclrerr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfdlen.c b/usr/src/lib/libast/common/sfio/_sfdlen.c index 326ff1f6c4..179231a4c3 100644 --- a/usr/src/lib/libast/common/sfio/_sfdlen.c +++ b/usr/src/lib/libast/common/sfio/_sfdlen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfeof.c b/usr/src/lib/libast/common/sfio/_sfeof.c index e2946b30c8..d11e24b272 100644 --- a/usr/src/lib/libast/common/sfio/_sfeof.c +++ b/usr/src/lib/libast/common/sfio/_sfeof.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sferror.c b/usr/src/lib/libast/common/sfio/_sferror.c index fdcfc95369..39124c804d 100644 --- a/usr/src/lib/libast/common/sfio/_sferror.c +++ b/usr/src/lib/libast/common/sfio/_sferror.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sffileno.c b/usr/src/lib/libast/common/sfio/_sffileno.c index 1d38365c29..642bfe9f14 100644 --- a/usr/src/lib/libast/common/sfio/_sffileno.c +++ b/usr/src/lib/libast/common/sfio/_sffileno.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfgetc.c b/usr/src/lib/libast/common/sfio/_sfgetc.c index 22ed7b8547..dc83691c9c 100644 --- a/usr/src/lib/libast/common/sfio/_sfgetc.c +++ b/usr/src/lib/libast/common/sfio/_sfgetc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfgetl.c b/usr/src/lib/libast/common/sfio/_sfgetl.c index a9d57e32bd..fd084ebc8e 100644 --- a/usr/src/lib/libast/common/sfio/_sfgetl.c +++ b/usr/src/lib/libast/common/sfio/_sfgetl.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfgetl2.c b/usr/src/lib/libast/common/sfio/_sfgetl2.c index a983a38492..4e0a66729b 100644 --- a/usr/src/lib/libast/common/sfio/_sfgetl2.c +++ b/usr/src/lib/libast/common/sfio/_sfgetl2.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfgetu.c b/usr/src/lib/libast/common/sfio/_sfgetu.c index 8d8a7434c2..adfc9370bd 100644 --- a/usr/src/lib/libast/common/sfio/_sfgetu.c +++ b/usr/src/lib/libast/common/sfio/_sfgetu.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfgetu2.c b/usr/src/lib/libast/common/sfio/_sfgetu2.c index ff12230a1e..c19ed29b86 100644 --- a/usr/src/lib/libast/common/sfio/_sfgetu2.c +++ b/usr/src/lib/libast/common/sfio/_sfgetu2.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfllen.c b/usr/src/lib/libast/common/sfio/_sfllen.c index 1a2e6922f7..478d7ed897 100644 --- a/usr/src/lib/libast/common/sfio/_sfllen.c +++ b/usr/src/lib/libast/common/sfio/_sfllen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfopen.c b/usr/src/lib/libast/common/sfio/_sfopen.c index e8a041759d..be64dc6a26 100644 --- a/usr/src/lib/libast/common/sfio/_sfopen.c +++ b/usr/src/lib/libast/common/sfio/_sfopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -154,16 +154,17 @@ int* uflagp; sflags = oflags = uflag = 0; while(1) switch(*mode++) { - case 'w' : - sflags |= SF_WRITE; - oflags |= O_WRONLY | O_CREAT; - if(!(sflags&SF_READ)) - oflags |= O_TRUNC; - continue; case 'a' : sflags |= SF_WRITE | SF_APPENDWR; oflags |= O_WRONLY | O_APPEND | O_CREAT; continue; + case 'b' : + oflags |= O_BINARY; + continue; + case 'm' : + sflags |= SF_MTSAFE; + uflag = 0; + continue; case 'r' : sflags |= SF_READ; oflags |= O_RDONLY; @@ -171,31 +172,33 @@ int* uflagp; case 's' : sflags |= SF_STRING; continue; - case 'b' : - oflags |= O_BINARY; - continue; case 't' : oflags |= O_TEXT; continue; - case 'x' : - oflags |= O_EXCL; - continue; - case '+' : - if(sflags) - sflags |= SF_READ|SF_WRITE; - continue; - case 'm' : - sflags |= SF_MTSAFE; - uflag = 0; - continue; case 'u' : sflags &= ~SF_MTSAFE; uflag = 1; continue; + case 'w' : + sflags |= SF_WRITE; + oflags |= O_WRONLY | O_CREAT; + if(!(sflags&SF_READ)) + oflags |= O_TRUNC; + continue; + case 'x' : + oflags |= O_EXCL; + continue; + case 'F': + /* stdio compatibility -- fd >= FOPEN_MAX (or other magic number) ok */ + continue; case 'W' : sflags |= SF_WCWIDTH; uflag = 0; continue; + case '+' : + if(sflags) + sflags |= SF_READ|SF_WRITE; + continue; default : if(!(oflags&O_CREAT) ) oflags &= ~O_EXCL; diff --git a/usr/src/lib/libast/common/sfio/_sfputc.c b/usr/src/lib/libast/common/sfio/_sfputc.c index 27f3705ebc..d8255f8da1 100644 --- a/usr/src/lib/libast/common/sfio/_sfputc.c +++ b/usr/src/lib/libast/common/sfio/_sfputc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfputd.c b/usr/src/lib/libast/common/sfio/_sfputd.c index 0e02a6c30b..43e395980f 100644 --- a/usr/src/lib/libast/common/sfio/_sfputd.c +++ b/usr/src/lib/libast/common/sfio/_sfputd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfputl.c b/usr/src/lib/libast/common/sfio/_sfputl.c index 410d346562..16d3d00b42 100644 --- a/usr/src/lib/libast/common/sfio/_sfputl.c +++ b/usr/src/lib/libast/common/sfio/_sfputl.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfputm.c b/usr/src/lib/libast/common/sfio/_sfputm.c index 30e41edf8c..79f1bad4ac 100644 --- a/usr/src/lib/libast/common/sfio/_sfputm.c +++ b/usr/src/lib/libast/common/sfio/_sfputm.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfputu.c b/usr/src/lib/libast/common/sfio/_sfputu.c index a83e9b9d14..69d4903e83 100644 --- a/usr/src/lib/libast/common/sfio/_sfputu.c +++ b/usr/src/lib/libast/common/sfio/_sfputu.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfslen.c b/usr/src/lib/libast/common/sfio/_sfslen.c index c86daec1f0..dcf6f60e62 100644 --- a/usr/src/lib/libast/common/sfio/_sfslen.c +++ b/usr/src/lib/libast/common/sfio/_sfslen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfstacked.c b/usr/src/lib/libast/common/sfio/_sfstacked.c index e16ec78b58..12b62bc025 100644 --- a/usr/src/lib/libast/common/sfio/_sfstacked.c +++ b/usr/src/lib/libast/common/sfio/_sfstacked.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfulen.c b/usr/src/lib/libast/common/sfio/_sfulen.c index 058e110e1a..e872fc2750 100644 --- a/usr/src/lib/libast/common/sfio/_sfulen.c +++ b/usr/src/lib/libast/common/sfio/_sfulen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/_sfvalue.c b/usr/src/lib/libast/common/sfio/_sfvalue.c index bafbe85f2c..89f55f5605 100644 --- a/usr/src/lib/libast/common/sfio/_sfvalue.c +++ b/usr/src/lib/libast/common/sfio/_sfvalue.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfclose.c b/usr/src/lib/libast/common/sfio/sfclose.c index 46377baabc..08f5d1c2a9 100644 --- a/usr/src/lib/libast/common/sfio/sfclose.c +++ b/usr/src/lib/libast/common/sfio/sfclose.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfclrlock.c b/usr/src/lib/libast/common/sfio/sfclrlock.c index ed6f253d68..211d16d20d 100644 --- a/usr/src/lib/libast/common/sfio/sfclrlock.c +++ b/usr/src/lib/libast/common/sfio/sfclrlock.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfcvt.c b/usr/src/lib/libast/common/sfio/sfcvt.c index 61312db04a..0022470438 100644 --- a/usr/src/lib/libast/common/sfio/sfcvt.c +++ b/usr/src/lib/libast/common/sfio/sfcvt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -114,7 +114,8 @@ int format; /* conversion format */ { reg char *sp; reg long n, v; - reg char *ep, *b, *endsp; + reg char *ep, *b, *endsp, *t; + int x; _ast_flt_unsigned_max_t m; static char lx[] = "0123456789abcdef"; @@ -193,7 +194,6 @@ int format; /* conversion format */ if(format & SFFMT_AFORMAT) { Sfdouble_t g; - int x; b = sp = buf; ep = (format & SFFMT_UPPER) ? ux : lx; if(n_digit <= 0 || n_digit >= (size - 9)) @@ -210,9 +210,7 @@ int format; /* conversion format */ while ((x -= 4) >= 0) { *sp++ = ep[(m >> x) & 0xf]; if (sp >= endsp) - { ep = sp + 1; - goto done; - } + goto around; } f -= m; f = ldexpl(f, 8 * sizeof(m)); @@ -369,13 +367,12 @@ int format; /* conversion format */ return SF_INF; if(format & SFFMT_AFORMAT) - { double g; - int x; + { double g; b = sp = buf; ep = (format & SFFMT_UPPER) ? ux : lx; if(n_digit <= 0 || n_digit >= (size - 9)) n_digit = size - 9; - endsp = sp + n_digit; + endsp = sp + n_digit + 1; g = frexp(f, &x); *decpt = x; @@ -387,9 +384,7 @@ int format; /* conversion format */ while ((x -= 4) >= 0) { *sp++ = ep[(m >> x) & 0xf]; if (sp >= endsp) - { ep = sp + 1; - goto done; - } + goto around; } f -= m; f = ldexp(f, 8 * sizeof(m)); @@ -503,9 +498,35 @@ int format; /* conversion format */ } } -done: + done: *--ep = '\0'; if(len) *len = ep-b; return b; + around: + if (((m >> x) & 0xf) >= 8) + { t = sp - 1; + for (;;) + { if (--t <= b) + { (*decpt)++; + break; + } + switch (*t) + { + case 'f': + case 'F': + *t = '0'; + continue; + case '9': + *t = ep[10]; + break; + default: + (*t)++; + break; + } + break; + } + } + ep = sp + 1; + goto done; } diff --git a/usr/src/lib/libast/common/sfio/sfdisc.c b/usr/src/lib/libast/common/sfio/sfdisc.c index 9bc9125445..cf390d1160 100644 --- a/usr/src/lib/libast/common/sfio/sfdisc.c +++ b/usr/src/lib/libast/common/sfio/sfdisc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfdlen.c b/usr/src/lib/libast/common/sfio/sfdlen.c index 404b89e859..8d4cd03c47 100644 --- a/usr/src/lib/libast/common/sfio/sfdlen.c +++ b/usr/src/lib/libast/common/sfio/sfdlen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfecvt.c b/usr/src/lib/libast/common/sfio/sfecvt.c index 85fa74b3f2..1e35ec231b 100644 --- a/usr/src/lib/libast/common/sfio/sfecvt.c +++ b/usr/src/lib/libast/common/sfio/sfecvt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfexcept.c b/usr/src/lib/libast/common/sfio/sfexcept.c index 52b20760d0..c427d5333c 100644 --- a/usr/src/lib/libast/common/sfio/sfexcept.c +++ b/usr/src/lib/libast/common/sfio/sfexcept.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfextern.c b/usr/src/lib/libast/common/sfio/sfextern.c index ddc96837d2..a7f4941153 100644 --- a/usr/src/lib/libast/common/sfio/sfextern.c +++ b/usr/src/lib/libast/common/sfio/sfextern.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sffcvt.c b/usr/src/lib/libast/common/sfio/sffcvt.c index bc108ea962..1d6a5ff397 100644 --- a/usr/src/lib/libast/common/sfio/sffcvt.c +++ b/usr/src/lib/libast/common/sfio/sffcvt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sffilbuf.c b/usr/src/lib/libast/common/sfio/sffilbuf.c index a6c2a4fa9c..5fa88a4918 100644 --- a/usr/src/lib/libast/common/sfio/sffilbuf.c +++ b/usr/src/lib/libast/common/sfio/sffilbuf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfflsbuf.c b/usr/src/lib/libast/common/sfio/sfflsbuf.c index 5e71fedb5d..a7018da0cc 100644 --- a/usr/src/lib/libast/common/sfio/sfflsbuf.c +++ b/usr/src/lib/libast/common/sfio/sfflsbuf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -35,18 +35,18 @@ Sfio_t* f; /* write out the buffered content of this stream */ int c; /* if c>=0, c is also written out */ #endif { - ssize_t n, w; + ssize_t n, w, written; uchar* data; uchar outc; int local, isall; int inpc = c; - SFMTXDECL(f); + SFMTXDECL(f); /* declare a local stream variable for multithreading */ SFMTXENTER(f,-1); GETLOCAL(f,local); - for(;; f->mode &= ~SF_LOCK) + for(written = 0;; f->mode &= ~SF_LOCK) { /* check stream mode */ if(SFMODE(f,local) != SF_WRITE && _sfmode(f,SF_WRITE,local) < 0) SFMTXRETURN(f, -1); @@ -96,16 +96,24 @@ int c; /* if c>=0, c is also written out */ if((w = SFWR(f,data,n,f->disc)) > 0) { if((n -= w) > 0) /* save unwritten data, then resume */ memcpy((char*)f->data,(char*)data+w,n); + written += w; f->next = f->data+n; if(c < 0 && (!isall || n == 0)) break; } else if(w == 0) - { SFOPEN(f,local); - SFMTXRETURN(f, -1); + { if(written > 0) /* some buffer was cleared */ + break; /* do normal exit below */ + else /* nothing was done, returning failure */ + { SFOPEN(f,local); + SFMTXRETURN(f, -1); + } + } + else /* w < 0 means SF_EDISC or SF_ESTACK in sfwr() */ + { if(c < 0) /* back to the calling write operation */ + break; + else continue; /* try again to write out c */ } - else if(c < 0) - break; } SFOPEN(f,local); diff --git a/usr/src/lib/libast/common/sfio/sfgetd.c b/usr/src/lib/libast/common/sfio/sfgetd.c index b6e31af5f6..803761843b 100644 --- a/usr/src/lib/libast/common/sfio/sfgetd.c +++ b/usr/src/lib/libast/common/sfio/sfgetd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfgetl.c b/usr/src/lib/libast/common/sfio/sfgetl.c index cfd14632b1..fd7e3390b6 100644 --- a/usr/src/lib/libast/common/sfio/sfgetl.c +++ b/usr/src/lib/libast/common/sfio/sfgetl.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfgetm.c b/usr/src/lib/libast/common/sfio/sfgetm.c index e2232c955c..7199c9c34d 100644 --- a/usr/src/lib/libast/common/sfio/sfgetm.c +++ b/usr/src/lib/libast/common/sfio/sfgetm.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfgetr.c b/usr/src/lib/libast/common/sfio/sfgetr.c index 64b10103be..7a1aa3184a 100644 --- a/usr/src/lib/libast/common/sfio/sfgetr.c +++ b/usr/src/lib/libast/common/sfio/sfgetr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfgetu.c b/usr/src/lib/libast/common/sfio/sfgetu.c index a6fb82d9d5..6f64003854 100644 --- a/usr/src/lib/libast/common/sfio/sfgetu.c +++ b/usr/src/lib/libast/common/sfio/sfgetu.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfhdr.h b/usr/src/lib/libast/common/sfio/sfhdr.h index 5fd9dd52fb..8fe2e3a52d 100644 --- a/usr/src/lib/libast/common/sfio/sfhdr.h +++ b/usr/src/lib/libast/common/sfio/sfhdr.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -884,8 +884,7 @@ typedef struct _sfextern_s #define GETLOCAL(f,v) ((v) = ((f)->mode&SF_LOCAL), (f)->mode &= ~SF_LOCAL, (v)) #define SFWRALL(f) ((f)->mode |= SF_RV) #define SFISALL(f,v) ((((v) = (f)->mode&SF_RV) ? ((f)->mode &= ~SF_RV) : 0), \ - ((v) || (f)->extent < 0 || \ - ((f)->flags&(SF_SHARE|SF_APPENDWR|SF_WHOLE)) ) ) + ((v) || ((f)->flags&(SF_SHARE|SF_APPENDWR|SF_WHOLE)) ) ) #define SFSK(f,a,o,d) (SETLOCAL(f),sfsk(f,(Sfoff_t)a,o,d)) #define SFRD(f,b,n,d) (SETLOCAL(f),sfrd(f,(Void_t*)b,n,d)) #define SFWR(f,b,n,d) (SETLOCAL(f),sfwr(f,(Void_t*)b,n,d)) diff --git a/usr/src/lib/libast/common/sfio/sfllen.c b/usr/src/lib/libast/common/sfio/sfllen.c index 02b0657077..17381b15fa 100644 --- a/usr/src/lib/libast/common/sfio/sfllen.c +++ b/usr/src/lib/libast/common/sfio/sfllen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfmode.c b/usr/src/lib/libast/common/sfio/sfmode.c index d30e404881..1e9a2badd8 100644 --- a/usr/src/lib/libast/common/sfio/sfmode.c +++ b/usr/src/lib/libast/common/sfio/sfmode.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -20,7 +20,7 @@ * * ***********************************************************************/ #include "sfhdr.h" -static char* Version = "\n@(#)$Id: sfio (AT&T Research) 2008-07-17 $\0\n"; +static char* Version = "\n@(#)$Id: sfio (AT&T Labs - Research) 2009-09-15 $\0\n"; /* Functions to set a given stream to some desired mode ** @@ -46,6 +46,7 @@ static char* Version = "\n@(#)$Id: sfio (AT&T Research) 2008-07-17 $\0\n"; ** (%I1d is fixed to handle "signed char" correctly) ** 01/01/2004 Porting issues to various platforms resolved. ** 06/01/2008 Allowing notify() at entering/exiting thread-safe routines. +** 09/15/2008 Add sfwalk(). */ /* the below is for protecting the application from SIGPIPE */ diff --git a/usr/src/lib/libast/common/sfio/sfmove.c b/usr/src/lib/libast/common/sfio/sfmove.c index ae1af300ad..8ac858c204 100644 --- a/usr/src/lib/libast/common/sfio/sfmove.c +++ b/usr/src/lib/libast/common/sfio/sfmove.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfmutex.c b/usr/src/lib/libast/common/sfio/sfmutex.c index c887a12f6e..2a1cc12eac 100644 --- a/usr/src/lib/libast/common/sfio/sfmutex.c +++ b/usr/src/lib/libast/common/sfio/sfmutex.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfnew.c b/usr/src/lib/libast/common/sfio/sfnew.c index 8c462eba8b..e163b750f3 100644 --- a/usr/src/lib/libast/common/sfio/sfnew.c +++ b/usr/src/lib/libast/common/sfio/sfnew.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfnotify.c b/usr/src/lib/libast/common/sfio/sfnotify.c index cee5b9909f..c5424f0018 100644 --- a/usr/src/lib/libast/common/sfio/sfnotify.c +++ b/usr/src/lib/libast/common/sfio/sfnotify.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfnputc.c b/usr/src/lib/libast/common/sfio/sfnputc.c index b58eb6989b..3b9bf164c8 100644 --- a/usr/src/lib/libast/common/sfio/sfnputc.c +++ b/usr/src/lib/libast/common/sfio/sfnputc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfopen.c b/usr/src/lib/libast/common/sfio/sfopen.c index ed7a664722..944bfa9f3b 100644 --- a/usr/src/lib/libast/common/sfio/sfopen.c +++ b/usr/src/lib/libast/common/sfio/sfopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfpeek.c b/usr/src/lib/libast/common/sfio/sfpeek.c index be92216d8a..40c827d48b 100644 --- a/usr/src/lib/libast/common/sfio/sfpeek.c +++ b/usr/src/lib/libast/common/sfio/sfpeek.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfpkrd.c b/usr/src/lib/libast/common/sfio/sfpkrd.c index 7769682432..398a880054 100644 --- a/usr/src/lib/libast/common/sfio/sfpkrd.c +++ b/usr/src/lib/libast/common/sfio/sfpkrd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfpoll.c b/usr/src/lib/libast/common/sfio/sfpoll.c index 708d81fe44..d26917e1c2 100644 --- a/usr/src/lib/libast/common/sfio/sfpoll.c +++ b/usr/src/lib/libast/common/sfio/sfpoll.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfpool.c b/usr/src/lib/libast/common/sfio/sfpool.c index bf94a76d82..c1a16fe32a 100644 --- a/usr/src/lib/libast/common/sfio/sfpool.c +++ b/usr/src/lib/libast/common/sfio/sfpool.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -251,8 +251,9 @@ reg Sfio_t* pf; reg int mode; #endif { - reg Sfpool_t* p; - reg Sfio_t* rv; + int k; + Sfpool_t* p; + Sfio_t* rv; _Sfpmove = _sfpmove; @@ -301,13 +302,21 @@ reg int mode; SFLOCK(pf,0); if(!pf) /* deleting f from its current pool */ - { if(!(p = f->pool) || p == &_Sfpool || - _sfpmove(f,-1) < 0 || _sfsetpool(f) < 0) + { if((p = f->pool) != NIL(Sfpool_t*) && p != &_Sfpool) + for(k = 0; k < p->n_sf && pf == NIL(Sfio_t*); ++k) + if(p->sf[k] != f) /* a stream != f represents the pool */ + pf = p->sf[k]; + if(!pf) /* already isolated */ + { rv = f; /* just return self */ goto done; + } + + if(_sfpmove(f,-1) < 0 || _sfsetpool(f) < 0) + goto done; /* can't delete */ - if((p = f->pool) == &_Sfpool || p->n_sf <= 0) - rv = f; - else rv = p->sf[0]; /* return head of pool */ + if(!pf->pool || pf->pool == &_Sfpool || pf->pool->n_sf <= 0 ) + rv = pf; + else rv = pf->pool->sf[0]; /* return head of old pool */ goto done; } diff --git a/usr/src/lib/libast/common/sfio/sfpopen.c b/usr/src/lib/libast/common/sfio/sfpopen.c index d44b86e66f..d496c13e7b 100644 --- a/usr/src/lib/libast/common/sfio/sfpopen.c +++ b/usr/src/lib/libast/common/sfio/sfpopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfprintf.c b/usr/src/lib/libast/common/sfio/sfprintf.c index 46b07066b0..db8969bd27 100644 --- a/usr/src/lib/libast/common/sfio/sfprintf.c +++ b/usr/src/lib/libast/common/sfio/sfprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfprints.c b/usr/src/lib/libast/common/sfio/sfprints.c index 3e2c7261c7..402cefe5dc 100644 --- a/usr/src/lib/libast/common/sfio/sfprints.c +++ b/usr/src/lib/libast/common/sfio/sfprints.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -96,7 +96,7 @@ va_list args; { if(!(*sp = (char*)malloc(n = strlen(s)+1)) ) return -1; memcpy(*sp, s, n); - return n; + return n - 1; } } diff --git a/usr/src/lib/libast/common/sfio/sfpurge.c b/usr/src/lib/libast/common/sfio/sfpurge.c index d24567c0cf..d0a0d48a3a 100644 --- a/usr/src/lib/libast/common/sfio/sfpurge.c +++ b/usr/src/lib/libast/common/sfio/sfpurge.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -59,7 +59,7 @@ Sfio_t* f; { f->here -= f->endb - f->next; if(f->data) { SFMUNMAP(f,f->data,f->endb-f->data); - SFSK(f,f->here,SEEK_SET,f->disc); + (void)SFSK(f,f->here,SEEK_SET,f->disc); } SFOPEN(f,0); SFMTXRETURN(f, 0); @@ -82,7 +82,7 @@ Sfio_t* f; case SF_READ: if(f->extent >= 0 && f->endb > f->next) { f->here -= f->endb-f->next; - SFSK(f,f->here,SEEK_SET,f->disc); + (void)SFSK(f,f->here,SEEK_SET,f->disc); } f->endb = f->next = f->data; break; diff --git a/usr/src/lib/libast/common/sfio/sfputd.c b/usr/src/lib/libast/common/sfio/sfputd.c index a3a64f7c34..1409aa5c8b 100644 --- a/usr/src/lib/libast/common/sfio/sfputd.c +++ b/usr/src/lib/libast/common/sfio/sfputd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfputl.c b/usr/src/lib/libast/common/sfio/sfputl.c index 281452d1b0..2c64c9bb94 100644 --- a/usr/src/lib/libast/common/sfio/sfputl.c +++ b/usr/src/lib/libast/common/sfio/sfputl.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfputm.c b/usr/src/lib/libast/common/sfio/sfputm.c index 6652839cf3..5ee927401d 100644 --- a/usr/src/lib/libast/common/sfio/sfputm.c +++ b/usr/src/lib/libast/common/sfio/sfputm.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfputr.c b/usr/src/lib/libast/common/sfio/sfputr.c index 87dd1dd71a..2969cd8baa 100644 --- a/usr/src/lib/libast/common/sfio/sfputr.c +++ b/usr/src/lib/libast/common/sfio/sfputr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -46,7 +46,8 @@ int rc; /* record separator. */ SFLOCK(f,0); for(w = 0; (*s || rc >= 0); ) - { SFWPEEK(f,ps,p); + { if(SFWPEEK(f,ps,p) < 0) + break; if(p == 0 || (f->flags&SF_WHOLE) ) { n = strlen(s); diff --git a/usr/src/lib/libast/common/sfio/sfputu.c b/usr/src/lib/libast/common/sfio/sfputu.c index a72ba27592..fee187a1cd 100644 --- a/usr/src/lib/libast/common/sfio/sfputu.c +++ b/usr/src/lib/libast/common/sfio/sfputu.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfraise.c b/usr/src/lib/libast/common/sfio/sfraise.c index be98f6e15d..aab5d00024 100644 --- a/usr/src/lib/libast/common/sfio/sfraise.c +++ b/usr/src/lib/libast/common/sfio/sfraise.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfrd.c b/usr/src/lib/libast/common/sfio/sfrd.c index 515976d379..0eb881b19b 100644 --- a/usr/src/lib/libast/common/sfio/sfrd.c +++ b/usr/src/lib/libast/common/sfio/sfrd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfread.c b/usr/src/lib/libast/common/sfio/sfread.c index f0d893b2ba..c9377d4f68 100644 --- a/usr/src/lib/libast/common/sfio/sfread.c +++ b/usr/src/lib/libast/common/sfio/sfread.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfreserve.c b/usr/src/lib/libast/common/sfio/sfreserve.c index 0e9cdd6fdf..6c8726d4a3 100644 --- a/usr/src/lib/libast/common/sfio/sfreserve.c +++ b/usr/src/lib/libast/common/sfio/sfreserve.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -110,7 +110,11 @@ int type; /* LOCKR: lock stream, LASTR: last record */ if(size == 0 || (f->mode&SF_WRITE)) iosz = -1; else if(size < 0 && n == 0 && f->push) /* maybe stack-pop */ - iosz = sz; /* so only get what is asked for */ + { if((iosz = f->push->endb - f->push->next) == 0) + iosz = f->push->size; + if(iosz < sz) + iosz = sz; /* so only get what is asked for */ + } else { iosz = sz - n; /* get enough to fulfill requirement */ if(size < 0 && iosz < (f->size - n) ) diff --git a/usr/src/lib/libast/common/sfio/sfresize.c b/usr/src/lib/libast/common/sfio/sfresize.c index d9a6f77d6a..cd8e803346 100644 --- a/usr/src/lib/libast/common/sfio/sfresize.c +++ b/usr/src/lib/libast/common/sfio/sfresize.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfscanf.c b/usr/src/lib/libast/common/sfio/sfscanf.c index 68977ed7f0..c48e1a1419 100644 --- a/usr/src/lib/libast/common/sfio/sfscanf.c +++ b/usr/src/lib/libast/common/sfio/sfscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfseek.c b/usr/src/lib/libast/common/sfio/sfseek.c index 045911d7a9..d3ad987945 100644 --- a/usr/src/lib/libast/common/sfio/sfseek.c +++ b/usr/src/lib/libast/common/sfio/sfseek.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfset.c b/usr/src/lib/libast/common/sfio/sfset.c index 051aa5baed..8b1d57ec35 100644 --- a/usr/src/lib/libast/common/sfio/sfset.c +++ b/usr/src/lib/libast/common/sfio/sfset.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfsetbuf.c b/usr/src/lib/libast/common/sfio/sfsetbuf.c index 566e7191b7..d354f48497 100644 --- a/usr/src/lib/libast/common/sfio/sfsetbuf.c +++ b/usr/src/lib/libast/common/sfio/sfsetbuf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfsetfd.c b/usr/src/lib/libast/common/sfio/sfsetfd.c index f21193b540..911dcb3a5c 100644 --- a/usr/src/lib/libast/common/sfio/sfsetfd.c +++ b/usr/src/lib/libast/common/sfio/sfsetfd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfsize.c b/usr/src/lib/libast/common/sfio/sfsize.c index bea3b42b23..75d7e0789e 100644 --- a/usr/src/lib/libast/common/sfio/sfsize.c +++ b/usr/src/lib/libast/common/sfio/sfsize.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfsk.c b/usr/src/lib/libast/common/sfio/sfsk.c index 6e7c542da7..5b717a5e07 100644 --- a/usr/src/lib/libast/common/sfio/sfsk.c +++ b/usr/src/lib/libast/common/sfio/sfsk.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfstack.c b/usr/src/lib/libast/common/sfio/sfstack.c index c2c86a7d58..2162f9f292 100644 --- a/usr/src/lib/libast/common/sfio/sfstack.c +++ b/usr/src/lib/libast/common/sfio/sfstack.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfstrtod.c b/usr/src/lib/libast/common/sfio/sfstrtod.c index a42e6b3551..0927e3c3e4 100644 --- a/usr/src/lib/libast/common/sfio/sfstrtod.c +++ b/usr/src/lib/libast/common/sfio/sfstrtod.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfstrtof.h b/usr/src/lib/libast/common/sfio/sfstrtof.h index bc7c0113a6..bdedd2db5e 100644 --- a/usr/src/lib/libast/common/sfio/sfstrtof.h +++ b/usr/src/lib/libast/common/sfio/sfstrtof.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -33,6 +33,7 @@ * S2F_function the function name * S2F_static <0:export =0:extern >0:static * S2F_type 0:float 1:double 2:long.double + * S2F_qualifier 1 for optional [fFlL] qualifier suffix * S2F_size 1 for interface with size_t second arg * S2F_scan 1 for alternate interface with these arguments: * void* handle @@ -284,6 +285,8 @@ S2F_function(str, end) char* str; char** end; m = -m; } +#if S2F_qualifier + /* * consume the optional suffix */ @@ -297,6 +300,7 @@ S2F_function(str, end) char* str; char** end; c = GET(s); break; } +#endif PUT(s); if (v == 0) return negative ? -v : v; @@ -449,6 +453,8 @@ S2F_function(str, end) char* str; char** end; digits += n; } +#if S2F_qualifier + /* * consume the optional suffix */ @@ -462,6 +468,7 @@ S2F_function(str, end) char* str; char** end; c = GET(s); break; } +#endif PUT(s); /* diff --git a/usr/src/lib/libast/common/sfio/sfswap.c b/usr/src/lib/libast/common/sfio/sfswap.c index 0526591212..ca32892692 100644 --- a/usr/src/lib/libast/common/sfio/sfswap.c +++ b/usr/src/lib/libast/common/sfio/sfswap.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfsync.c b/usr/src/lib/libast/common/sfio/sfsync.c index 4bcd095226..9d2f1e06be 100644 --- a/usr/src/lib/libast/common/sfio/sfsync.c +++ b/usr/src/lib/libast/common/sfio/sfsync.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sftable.c b/usr/src/lib/libast/common/sfio/sftable.c index 23a82fbe77..c1e4651a53 100644 --- a/usr/src/lib/libast/common/sfio/sftable.c +++ b/usr/src/lib/libast/common/sfio/sftable.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sftell.c b/usr/src/lib/libast/common/sfio/sftell.c index bdd4dcef46..e46ed41b86 100644 --- a/usr/src/lib/libast/common/sfio/sftell.c +++ b/usr/src/lib/libast/common/sfio/sftell.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sftmp.c b/usr/src/lib/libast/common/sfio/sftmp.c index 47b6b34b69..1adf1066ae 100644 --- a/usr/src/lib/libast/common/sfio/sftmp.c +++ b/usr/src/lib/libast/common/sfio/sftmp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfungetc.c b/usr/src/lib/libast/common/sfio/sfungetc.c index b51b558676..de2512892c 100644 --- a/usr/src/lib/libast/common/sfio/sfungetc.c +++ b/usr/src/lib/libast/common/sfio/sfungetc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfvprintf.c b/usr/src/lib/libast/common/sfio/sfvprintf.c index a78fe2f3b5..94c23703cc 100644 --- a/usr/src/lib/libast/common/sfio/sfvprintf.c +++ b/usr/src/lib/libast/common/sfio/sfvprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -324,6 +324,12 @@ loop_fmt : if(thousand > 0) flags |= SFFMT_THOUSAND; goto loop_flags; + case ',': + SFSETLOCALE(&decimal,&thousand); + if(thousand < 0) + thousand = fmt; + flags |= SFFMT_THOUSAND; + goto loop_flags; case '.' : dot += 1; diff --git a/usr/src/lib/libast/common/sfio/sfvscanf.c b/usr/src/lib/libast/common/sfio/sfvscanf.c index a6f008b651..9047b1a670 100644 --- a/usr/src/lib/libast/common/sfio/sfvscanf.c +++ b/usr/src/lib/libast/common/sfio/sfvscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -122,7 +122,7 @@ int flag; /* structure to match characters in a character class */ typedef struct _accept_s -{ char ok[SF_MAXCHAR]; +{ char ok[SF_MAXCHAR+1]; int yes; char *form, *endf; #if _has_multibyte diff --git a/usr/src/lib/libast/common/sfio/sfwalk.c b/usr/src/lib/libast/common/sfio/sfwalk.c new file mode 100644 index 0000000000..a97b079924 --- /dev/null +++ b/usr/src/lib/libast/common/sfio/sfwalk.c @@ -0,0 +1,67 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#include "sfhdr.h" + +/* Walk streams and run operations on them +** +** Written by Kiem-Phong Vo. +*/ + +#if __STD_C +int sfwalk(Sfwalk_f walkf, Void_t* data, int type) +#else +int sfwalk(walkf, data, type) +Sfwalk_f walkf; /* return <0: stop, >=0: continue */ +Void_t* data; +int type; /* walk streams with all given flags */ +#endif +{ + Sfpool_t *p; + Sfio_t *f; + int n, rv; + + /* truly initializing std-streams before walking */ + if(sfstdin->mode & SF_INIT) + _sfmode(sfstdin, (sfstdin->mode & SF_RDWR), 0); + if(sfstdout->mode & SF_INIT) + _sfmode(sfstdout, (sfstdout->mode & SF_RDWR), 0); + if(sfstderr->mode & SF_INIT) + _sfmode(sfstderr, (sfstderr->mode & SF_RDWR), 0); + + for(rv = 0, p = &_Sfpool; p; p = p->next) + { for(n = 0; n < p->n_sf; ) + { f = p->sf[n]; + + if(type != 0 && (f->_flags&type) != type ) + continue; /* not in the interested set */ + + if((rv = (*walkf)(f, data)) < 0) + return rv; + + if(p->sf[n] == f) /* move forward to next stream */ + n += 1; + /* else - a sfclose() was done on current stream */ + } + } + + return rv; +} diff --git a/usr/src/lib/libast/common/sfio/sfwr.c b/usr/src/lib/libast/common/sfio/sfwr.c index 80c3aecfe4..87f27ca3bd 100644 --- a/usr/src/lib/libast/common/sfio/sfwr.c +++ b/usr/src/lib/libast/common/sfio/sfwr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/sfwrite.c b/usr/src/lib/libast/common/sfio/sfwrite.c index 82f7a04e61..da36623347 100644 --- a/usr/src/lib/libast/common/sfio/sfwrite.c +++ b/usr/src/lib/libast/common/sfio/sfwrite.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/sfio/vthread.h b/usr/src/lib/libast/common/sfio/vthread.h index eb49278449..fa5f503e6c 100644 --- a/usr/src/lib/libast/common/sfio/vthread.h +++ b/usr/src/lib/libast/common/sfio/vthread.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/std/bytesex.h b/usr/src/lib/libast/common/std/bytesex.h index 95c43e160d..e105fc5f58 100644 --- a/usr/src/lib/libast/common/std/bytesex.h +++ b/usr/src/lib/libast/common/std/bytesex.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/std/dirent.h b/usr/src/lib/libast/common/std/dirent.h index b94f22215f..ea81d037a5 100644 --- a/usr/src/lib/libast/common/std/dirent.h +++ b/usr/src/lib/libast/common/std/dirent.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/std/endian.h b/usr/src/lib/libast/common/std/endian.h index 12539254b6..6ad7ddcaad 100644 --- a/usr/src/lib/libast/common/std/endian.h +++ b/usr/src/lib/libast/common/std/endian.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/std/iconv.h b/usr/src/lib/libast/common/std/iconv.h index 58bc8240d2..5b02759721 100644 --- a/usr/src/lib/libast/common/std/iconv.h +++ b/usr/src/lib/libast/common/std/iconv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/std/nl_types.h b/usr/src/lib/libast/common/std/nl_types.h index 36c901d8ed..e71605ff40 100644 --- a/usr/src/lib/libast/common/std/nl_types.h +++ b/usr/src/lib/libast/common/std/nl_types.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/std/stdio.h b/usr/src/lib/libast/common/std/stdio.h index 42d7ed8269..2053ba8b27 100644 --- a/usr/src/lib/libast/common/std/stdio.h +++ b/usr/src/lib/libast/common/std/stdio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/std/wchar.h b/usr/src/lib/libast/common/std/wchar.h index 7796480d09..5bd6aa3ba8 100644 --- a/usr/src/lib/libast/common/std/wchar.h +++ b/usr/src/lib/libast/common/std/wchar.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_doprnt.c b/usr/src/lib/libast/common/stdio/_doprnt.c index abe981daeb..5f02ffdd7b 100644 --- a/usr/src/lib/libast/common/stdio/_doprnt.c +++ b/usr/src/lib/libast/common/stdio/_doprnt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_doscan.c b/usr/src/lib/libast/common/stdio/_doscan.c index 1e1f40006b..8334f44bee 100644 --- a/usr/src/lib/libast/common/stdio/_doscan.c +++ b/usr/src/lib/libast/common/stdio/_doscan.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_filbuf.c b/usr/src/lib/libast/common/stdio/_filbuf.c index 48fc226ca7..420c429c91 100644 --- a/usr/src/lib/libast/common/stdio/_filbuf.c +++ b/usr/src/lib/libast/common/stdio/_filbuf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_flsbuf.c b/usr/src/lib/libast/common/stdio/_flsbuf.c index 4c335cec46..ecf9a2cbb6 100644 --- a/usr/src/lib/libast/common/stdio/_flsbuf.c +++ b/usr/src/lib/libast/common/stdio/_flsbuf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_stdfun.c b/usr/src/lib/libast/common/stdio/_stdfun.c index 94c8b77241..a6a82ae902 100644 --- a/usr/src/lib/libast/common/stdio/_stdfun.c +++ b/usr/src/lib/libast/common/stdio/_stdfun.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -36,10 +36,12 @@ void _STUB_stdfun(){} #if _lib___iob_func #define IOB ((char*)__iob_func()) +#elif _lib___p__iob +#define IOB ((char*)__p__iob()) #elif _dat__iob #define IOB ((char*)_iob) #else -#define IOB ((char*)__p__iob()) +#define IOB ((char*)_p__iob()) #endif #define IOBMAX (512*32) diff --git a/usr/src/lib/libast/common/stdio/_stdopen.c b/usr/src/lib/libast/common/stdio/_stdopen.c index cd2b40babf..0290aa9e5f 100644 --- a/usr/src/lib/libast/common/stdio/_stdopen.c +++ b/usr/src/lib/libast/common/stdio/_stdopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_stdprintf.c b/usr/src/lib/libast/common/stdio/_stdprintf.c index 0ccd914243..9f46637c9a 100644 --- a/usr/src/lib/libast/common/stdio/_stdprintf.c +++ b/usr/src/lib/libast/common/stdio/_stdprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_stdscanf.c b/usr/src/lib/libast/common/stdio/_stdscanf.c index 863847ccf2..998636a41f 100644 --- a/usr/src/lib/libast/common/stdio/_stdscanf.c +++ b/usr/src/lib/libast/common/stdio/_stdscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_stdsprnt.c b/usr/src/lib/libast/common/stdio/_stdsprnt.c index ebff0918a3..bd91deafd7 100644 --- a/usr/src/lib/libast/common/stdio/_stdsprnt.c +++ b/usr/src/lib/libast/common/stdio/_stdsprnt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_stdvbuf.c b/usr/src/lib/libast/common/stdio/_stdvbuf.c index 7ad8add7e6..6307c47115 100644 --- a/usr/src/lib/libast/common/stdio/_stdvbuf.c +++ b/usr/src/lib/libast/common/stdio/_stdvbuf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_stdvsnprnt.c b/usr/src/lib/libast/common/stdio/_stdvsnprnt.c index 4d07332060..fb992302cf 100644 --- a/usr/src/lib/libast/common/stdio/_stdvsnprnt.c +++ b/usr/src/lib/libast/common/stdio/_stdvsnprnt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_stdvsprnt.c b/usr/src/lib/libast/common/stdio/_stdvsprnt.c index 7a145eeef7..af3840f345 100644 --- a/usr/src/lib/libast/common/stdio/_stdvsprnt.c +++ b/usr/src/lib/libast/common/stdio/_stdvsprnt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/_stdvsscn.c b/usr/src/lib/libast/common/stdio/_stdvsscn.c index 451d036675..be57402e0c 100644 --- a/usr/src/lib/libast/common/stdio/_stdvsscn.c +++ b/usr/src/lib/libast/common/stdio/_stdvsscn.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/asprintf.c b/usr/src/lib/libast/common/stdio/asprintf.c index f7ed170751..bbf155196d 100644 --- a/usr/src/lib/libast/common/stdio/asprintf.c +++ b/usr/src/lib/libast/common/stdio/asprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/clearerr.c b/usr/src/lib/libast/common/stdio/clearerr.c index c7198a7c7a..39c202d1de 100644 --- a/usr/src/lib/libast/common/stdio/clearerr.c +++ b/usr/src/lib/libast/common/stdio/clearerr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fclose.c b/usr/src/lib/libast/common/stdio/fclose.c index e7cbcfd483..7ba4a27dda 100644 --- a/usr/src/lib/libast/common/stdio/fclose.c +++ b/usr/src/lib/libast/common/stdio/fclose.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fcloseall.c b/usr/src/lib/libast/common/stdio/fcloseall.c new file mode 100644 index 0000000000..37728c9dc5 --- /dev/null +++ b/usr/src/lib/libast/common/stdio/fcloseall.c @@ -0,0 +1,57 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +#include "stdhdr.h" + +#define MAXLOOP 3 + +int +fcloseall(void) +{ + Sfpool_t* p; + Sfpool_t* next; + int n; + int nclose; + int count; + int loop; + + STDIO_INT(0, "fcloseall", int, (void), ()) + + for(loop = 0; loop < MAXLOOP; ++loop) + { nclose = count = 0; + for(p = &_Sfpool; p; p = next) + { /* find the next legitimate pool */ + for(next = p->next; next; next = next->next) + if(next->n_sf > 0) + break; + for(n = 0; n < ((p == &_Sfpool) ? p->n_sf : 1); ++n) + { count += 1; + if(sfclose(p->sf[n]) >= 0) + nclose += 1; + } + } + if(nclose == count) + break; + } + return 0; /* always return 0 per GNU */ +} diff --git a/usr/src/lib/libast/common/stdio/fdopen.c b/usr/src/lib/libast/common/stdio/fdopen.c index 92e1d7d9e5..c356270653 100644 --- a/usr/src/lib/libast/common/stdio/fdopen.c +++ b/usr/src/lib/libast/common/stdio/fdopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/feof.c b/usr/src/lib/libast/common/stdio/feof.c index 8357345e69..e289f7c2b8 100644 --- a/usr/src/lib/libast/common/stdio/feof.c +++ b/usr/src/lib/libast/common/stdio/feof.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/ferror.c b/usr/src/lib/libast/common/stdio/ferror.c index 698ade88b8..53879696f5 100644 --- a/usr/src/lib/libast/common/stdio/ferror.c +++ b/usr/src/lib/libast/common/stdio/ferror.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fflush.c b/usr/src/lib/libast/common/stdio/fflush.c index e30eb34bd7..3abb8b4257 100644 --- a/usr/src/lib/libast/common/stdio/fflush.c +++ b/usr/src/lib/libast/common/stdio/fflush.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,13 +21,17 @@ ***********************************************************************/ #pragma prototyped +#ifndef _USE_GNU +#define _USE_GNU +#endif + #include "stdhdr.h" int fflush(Sfio_t* f) { if (!f) - return sfsync(NiL); + return fcloseall(); STDIO_INT(f, "fflush", int, (Sfio_t*), (f)) diff --git a/usr/src/lib/libast/common/stdio/fgetc.c b/usr/src/lib/libast/common/stdio/fgetc.c index 880c4a5abd..a99d12bb0c 100644 --- a/usr/src/lib/libast/common/stdio/fgetc.c +++ b/usr/src/lib/libast/common/stdio/fgetc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fgetpos.c b/usr/src/lib/libast/common/stdio/fgetpos.c index 988a3ebf2f..df9573e8d8 100644 --- a/usr/src/lib/libast/common/stdio/fgetpos.c +++ b/usr/src/lib/libast/common/stdio/fgetpos.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fgets.c b/usr/src/lib/libast/common/stdio/fgets.c index 99880271a0..15368b5add 100644 --- a/usr/src/lib/libast/common/stdio/fgets.c +++ b/usr/src/lib/libast/common/stdio/fgets.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fgetwc.c b/usr/src/lib/libast/common/stdio/fgetwc.c index 03728d867e..65acb7925e 100644 --- a/usr/src/lib/libast/common/stdio/fgetwc.c +++ b/usr/src/lib/libast/common/stdio/fgetwc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fgetws.c b/usr/src/lib/libast/common/stdio/fgetws.c index d7e941c10a..d1d9acde30 100644 --- a/usr/src/lib/libast/common/stdio/fgetws.c +++ b/usr/src/lib/libast/common/stdio/fgetws.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fileno.c b/usr/src/lib/libast/common/stdio/fileno.c index f0cb8db31e..b5507afdc6 100644 --- a/usr/src/lib/libast/common/stdio/fileno.c +++ b/usr/src/lib/libast/common/stdio/fileno.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/flockfile.c b/usr/src/lib/libast/common/stdio/flockfile.c index 1da30178ef..5df7aa11a5 100644 --- a/usr/src/lib/libast/common/stdio/flockfile.c +++ b/usr/src/lib/libast/common/stdio/flockfile.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/stdio_gnu.c b/usr/src/lib/libast/common/stdio/fmemopen.c index ea420bb666..fa1cdb5adb 100644 --- a/usr/src/lib/libast/common/stdio/stdio_gnu.c +++ b/usr/src/lib/libast/common/stdio/fmemopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,54 +21,12 @@ ***********************************************************************/ #pragma prototyped -/* - * gnu stdio extensions - */ - #include "stdhdr.h" -int -fcloseall(void) -{ - return sfsync(NiL) < 0 ? -1 : 0; -} - Sfio_t* fmemopen(void* buf, size_t size, const char* mode) { - return sfnew(NiL, buf, size, -1, SF_STRING|_sftype(mode, NiL, NiL)); -} - -ssize_t -__getdelim(char** pbuf, size_t* psize, int del, Sfio_t* sp) -{ - char* s; - size_t n; - size_t m; + STDIO_PTR(0, "fmemopen", Sfio_t*, (void*, size_t, const char*), (buf, size, mode)) - if (!(s = sfgetr(sp, del, 1))) - return -1; - n = sfsize(sp); - m = n + 1; - if (!*pbuf || m > *psize) - { - m = roundof(m, 1024); - if (!(*pbuf = newof(*pbuf, char, m, 0))) - return -1; - *psize = m; - } - memcpy(*pbuf, s, n); - return n; -} - -ssize_t -getdelim(char** pbuf, size_t* psize, int del, Sfio_t* sp) -{ - return __getdelim(pbuf, psize, del, sp); -} - -ssize_t -getline(char** pbuf, size_t* psize, Sfio_t* sp) -{ - return __getdelim(pbuf, psize, '\n', sp); + return sfnew(NiL, buf, size, -1, SF_STRING|_sftype(mode, NiL, NiL)); } diff --git a/usr/src/lib/libast/common/stdio/fopen.c b/usr/src/lib/libast/common/stdio/fopen.c index 27d942a04b..8c723e849a 100644 --- a/usr/src/lib/libast/common/stdio/fopen.c +++ b/usr/src/lib/libast/common/stdio/fopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fprintf.c b/usr/src/lib/libast/common/stdio/fprintf.c index c9974ff04c..345fce71cb 100644 --- a/usr/src/lib/libast/common/stdio/fprintf.c +++ b/usr/src/lib/libast/common/stdio/fprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fpurge.c b/usr/src/lib/libast/common/stdio/fpurge.c index e71564657e..2b57e51ac0 100644 --- a/usr/src/lib/libast/common/stdio/fpurge.c +++ b/usr/src/lib/libast/common/stdio/fpurge.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fputc.c b/usr/src/lib/libast/common/stdio/fputc.c index 1c4ece7e61..4ea662824c 100644 --- a/usr/src/lib/libast/common/stdio/fputc.c +++ b/usr/src/lib/libast/common/stdio/fputc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fputs.c b/usr/src/lib/libast/common/stdio/fputs.c index 1fd2c228b9..a5d5a94cd6 100644 --- a/usr/src/lib/libast/common/stdio/fputs.c +++ b/usr/src/lib/libast/common/stdio/fputs.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fputwc.c b/usr/src/lib/libast/common/stdio/fputwc.c index 0fe7f8c9e8..7f7637f7bd 100644 --- a/usr/src/lib/libast/common/stdio/fputwc.c +++ b/usr/src/lib/libast/common/stdio/fputwc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fputws.c b/usr/src/lib/libast/common/stdio/fputws.c index a37f961f5a..844088b694 100644 --- a/usr/src/lib/libast/common/stdio/fputws.c +++ b/usr/src/lib/libast/common/stdio/fputws.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fread.c b/usr/src/lib/libast/common/stdio/fread.c index 0caeebc590..d94c1f341d 100644 --- a/usr/src/lib/libast/common/stdio/fread.c +++ b/usr/src/lib/libast/common/stdio/fread.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/freopen.c b/usr/src/lib/libast/common/stdio/freopen.c index f774b91b47..1746a450b7 100644 --- a/usr/src/lib/libast/common/stdio/freopen.c +++ b/usr/src/lib/libast/common/stdio/freopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fscanf.c b/usr/src/lib/libast/common/stdio/fscanf.c index 73da47c4a2..6ab28131ea 100644 --- a/usr/src/lib/libast/common/stdio/fscanf.c +++ b/usr/src/lib/libast/common/stdio/fscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fseek.c b/usr/src/lib/libast/common/stdio/fseek.c index 84233b1b87..b6175f1b15 100644 --- a/usr/src/lib/libast/common/stdio/fseek.c +++ b/usr/src/lib/libast/common/stdio/fseek.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fseeko.c b/usr/src/lib/libast/common/stdio/fseeko.c index 1bafc4c97e..cb69bbeaa6 100644 --- a/usr/src/lib/libast/common/stdio/fseeko.c +++ b/usr/src/lib/libast/common/stdio/fseeko.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fsetpos.c b/usr/src/lib/libast/common/stdio/fsetpos.c index 9e5c193cad..3212b9499d 100644 --- a/usr/src/lib/libast/common/stdio/fsetpos.c +++ b/usr/src/lib/libast/common/stdio/fsetpos.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/ftell.c b/usr/src/lib/libast/common/stdio/ftell.c index 225b34f408..cf5b1336cf 100644 --- a/usr/src/lib/libast/common/stdio/ftell.c +++ b/usr/src/lib/libast/common/stdio/ftell.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/ftello.c b/usr/src/lib/libast/common/stdio/ftello.c index 0fbcbe153f..65ba754468 100644 --- a/usr/src/lib/libast/common/stdio/ftello.c +++ b/usr/src/lib/libast/common/stdio/ftello.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/ftrylockfile.c b/usr/src/lib/libast/common/stdio/ftrylockfile.c index d4c40a5ce1..b00fe135b7 100644 --- a/usr/src/lib/libast/common/stdio/ftrylockfile.c +++ b/usr/src/lib/libast/common/stdio/ftrylockfile.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/funlockfile.c b/usr/src/lib/libast/common/stdio/funlockfile.c index 6aee88a525..fb186a32cb 100644 --- a/usr/src/lib/libast/common/stdio/funlockfile.c +++ b/usr/src/lib/libast/common/stdio/funlockfile.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fwide.c b/usr/src/lib/libast/common/stdio/fwide.c index 4d472cafaa..4db3e3d4eb 100644 --- a/usr/src/lib/libast/common/stdio/fwide.c +++ b/usr/src/lib/libast/common/stdio/fwide.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fwprintf.c b/usr/src/lib/libast/common/stdio/fwprintf.c index 3e7579369b..7ced942740 100644 --- a/usr/src/lib/libast/common/stdio/fwprintf.c +++ b/usr/src/lib/libast/common/stdio/fwprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fwrite.c b/usr/src/lib/libast/common/stdio/fwrite.c index 94a192ae4f..2121d32c19 100644 --- a/usr/src/lib/libast/common/stdio/fwrite.c +++ b/usr/src/lib/libast/common/stdio/fwrite.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/fwscanf.c b/usr/src/lib/libast/common/stdio/fwscanf.c index 29838447a3..dc6e31667d 100644 --- a/usr/src/lib/libast/common/stdio/fwscanf.c +++ b/usr/src/lib/libast/common/stdio/fwscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/getc.c b/usr/src/lib/libast/common/stdio/getc.c index bfc0c9a0f6..b52909ef49 100644 --- a/usr/src/lib/libast/common/stdio/getc.c +++ b/usr/src/lib/libast/common/stdio/getc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/getchar.c b/usr/src/lib/libast/common/stdio/getchar.c index f1c4a168b3..5c85793bb6 100644 --- a/usr/src/lib/libast/common/stdio/getchar.c +++ b/usr/src/lib/libast/common/stdio/getchar.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/getdelim.c b/usr/src/lib/libast/common/stdio/getdelim.c new file mode 100644 index 0000000000..a24ad68fd8 --- /dev/null +++ b/usr/src/lib/libast/common/stdio/getdelim.c @@ -0,0 +1,96 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +#include "stdhdr.h" + +ssize_t +getdelim(char** sp, size_t* np, int delim, Sfio_t* f) +{ + ssize_t m; + ssize_t n; + ssize_t k; + ssize_t p; + uchar* s; + uchar* ps; + SFMTXDECL(f); + + STDIO_INT(f, "getdelim", ssize_t, (char**, size_t*, int, Sfio_t*), (sp, np, delim, f)) + + SFMTXENTER(f, -1); + + if(delim < 0 || delim > 255 || !sp || !np) /* bad parameters */ + SFMTXRETURN(f, -1); + + if(f->mode != SF_READ && _sfmode(f,SF_READ,0) < 0) + SFMTXRETURN(f, -1); + + SFLOCK(f,0); + + if(!(s = (uchar*)(*sp)) || (n = *np) < 0) + { s = NIL(uchar*); n = 0; } + for(m = 0;; ) + { /* read new data */ + if((p = f->endb - (ps = f->next)) <= 0 ) + { f->getr = delim; + f->mode |= SF_RC; + if(SFRPEEK(f,ps,p) <= 0) + { m = -1; + break; + } + } + + for(k = 0; k < p; ++k) /* find the delimiter */ + { if(ps[k] == delim) + { k += 1; /* include delim in copying */ + break; + } + } + + if((m+k+1) >= n ) /* make sure there is space */ + { n = ((m+k+15)/8)*8; + if(!(s = (uchar*)realloc(s, n)) ) + { *sp = 0; *np = 0; + m = -1; + break; + } + *sp = (char*)s; *np = n; + } + + memcpy(s+m, ps, k); m += k; + f->next = ps+k; /* skip copied data in buffer */ + + if(s[m-1] == delim) + { s[m] = 0; /* 0-terminated */ + break; + } + } + + SFOPEN(f,0); + SFMTXRETURN(f,m); +} + +ssize_t +__getdelim(char** sp, size_t* np, int delim, Sfio_t* f) +{ + return getdelim(sp, np, delim, f); +} diff --git a/usr/src/lib/libast/common/stdio/getline.c b/usr/src/lib/libast/common/stdio/getline.c new file mode 100644 index 0000000000..b4936c2b30 --- /dev/null +++ b/usr/src/lib/libast/common/stdio/getline.c @@ -0,0 +1,36 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +#ifndef _USE_GNU +#define _USE_GNU +#endif + +#include "stdhdr.h" + +ssize_t +getline(char** sp, size_t* np, Sfio_t* f) +{ + STDIO_INT(f, "getline", ssize_t, (char**, size_t*, Sfio_t*), (sp, np, f)) + + return getdelim(sp, np, '\n', f); +} diff --git a/usr/src/lib/libast/common/stdio/getw.c b/usr/src/lib/libast/common/stdio/getw.c index 031f4588c5..264fd7b375 100644 --- a/usr/src/lib/libast/common/stdio/getw.c +++ b/usr/src/lib/libast/common/stdio/getw.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/getwc.c b/usr/src/lib/libast/common/stdio/getwc.c index 27d1273a86..970d1fb588 100644 --- a/usr/src/lib/libast/common/stdio/getwc.c +++ b/usr/src/lib/libast/common/stdio/getwc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/getwchar.c b/usr/src/lib/libast/common/stdio/getwchar.c index 2b08127e46..59b85f41c7 100644 --- a/usr/src/lib/libast/common/stdio/getwchar.c +++ b/usr/src/lib/libast/common/stdio/getwchar.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/pclose.c b/usr/src/lib/libast/common/stdio/pclose.c index 51bdf3071b..5c49dc9bea 100644 --- a/usr/src/lib/libast/common/stdio/pclose.c +++ b/usr/src/lib/libast/common/stdio/pclose.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/popen.c b/usr/src/lib/libast/common/stdio/popen.c index 0f15e8b961..38329fd259 100644 --- a/usr/src/lib/libast/common/stdio/popen.c +++ b/usr/src/lib/libast/common/stdio/popen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/printf.c b/usr/src/lib/libast/common/stdio/printf.c index 45dd3c8b5c..a191f32bc1 100644 --- a/usr/src/lib/libast/common/stdio/printf.c +++ b/usr/src/lib/libast/common/stdio/printf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/putc.c b/usr/src/lib/libast/common/stdio/putc.c index c42448dd6b..ad8742f63c 100644 --- a/usr/src/lib/libast/common/stdio/putc.c +++ b/usr/src/lib/libast/common/stdio/putc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/putchar.c b/usr/src/lib/libast/common/stdio/putchar.c index a43c666486..e339082c75 100644 --- a/usr/src/lib/libast/common/stdio/putchar.c +++ b/usr/src/lib/libast/common/stdio/putchar.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/puts.c b/usr/src/lib/libast/common/stdio/puts.c index 96c114a3d9..523383f93e 100644 --- a/usr/src/lib/libast/common/stdio/puts.c +++ b/usr/src/lib/libast/common/stdio/puts.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/putw.c b/usr/src/lib/libast/common/stdio/putw.c index 662a746d2a..bb120a8434 100644 --- a/usr/src/lib/libast/common/stdio/putw.c +++ b/usr/src/lib/libast/common/stdio/putw.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/putwc.c b/usr/src/lib/libast/common/stdio/putwc.c index 5929ca938b..21d0006257 100644 --- a/usr/src/lib/libast/common/stdio/putwc.c +++ b/usr/src/lib/libast/common/stdio/putwc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/putwchar.c b/usr/src/lib/libast/common/stdio/putwchar.c index 9d6215ecde..bbca267759 100644 --- a/usr/src/lib/libast/common/stdio/putwchar.c +++ b/usr/src/lib/libast/common/stdio/putwchar.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/rewind.c b/usr/src/lib/libast/common/stdio/rewind.c index ae475316ab..285857848e 100644 --- a/usr/src/lib/libast/common/stdio/rewind.c +++ b/usr/src/lib/libast/common/stdio/rewind.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/scanf.c b/usr/src/lib/libast/common/stdio/scanf.c index 459b3340e6..e06681ee09 100644 --- a/usr/src/lib/libast/common/stdio/scanf.c +++ b/usr/src/lib/libast/common/stdio/scanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/setbuf.c b/usr/src/lib/libast/common/stdio/setbuf.c index 54998bda2a..7ec63c4604 100644 --- a/usr/src/lib/libast/common/stdio/setbuf.c +++ b/usr/src/lib/libast/common/stdio/setbuf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/setbuffer.c b/usr/src/lib/libast/common/stdio/setbuffer.c index 9f2559e52a..18e6f5dac9 100644 --- a/usr/src/lib/libast/common/stdio/setbuffer.c +++ b/usr/src/lib/libast/common/stdio/setbuffer.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/setlinebuf.c b/usr/src/lib/libast/common/stdio/setlinebuf.c index d354a94d0d..ffb71365ce 100644 --- a/usr/src/lib/libast/common/stdio/setlinebuf.c +++ b/usr/src/lib/libast/common/stdio/setlinebuf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/setvbuf.c b/usr/src/lib/libast/common/stdio/setvbuf.c index f2d5cc46c7..b8673fafe8 100644 --- a/usr/src/lib/libast/common/stdio/setvbuf.c +++ b/usr/src/lib/libast/common/stdio/setvbuf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/snprintf.c b/usr/src/lib/libast/common/stdio/snprintf.c index 20495a7354..fd22ea1088 100644 --- a/usr/src/lib/libast/common/stdio/snprintf.c +++ b/usr/src/lib/libast/common/stdio/snprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/sprintf.c b/usr/src/lib/libast/common/stdio/sprintf.c index c887627f9a..76f434e73d 100644 --- a/usr/src/lib/libast/common/stdio/sprintf.c +++ b/usr/src/lib/libast/common/stdio/sprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/sscanf.c b/usr/src/lib/libast/common/stdio/sscanf.c index 4d064d3758..014a328f7e 100644 --- a/usr/src/lib/libast/common/stdio/sscanf.c +++ b/usr/src/lib/libast/common/stdio/sscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/stdhdr.h b/usr/src/lib/libast/common/stdio/stdhdr.h index 1b0c160453..3436bb9fc5 100644 --- a/usr/src/lib/libast/common/stdio/stdhdr.h +++ b/usr/src/lib/libast/common/stdio/stdhdr.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/stdio_c99.c b/usr/src/lib/libast/common/stdio/stdio_c99.c index c75aad10e1..9bfe96ebba 100644 --- a/usr/src/lib/libast/common/stdio/stdio_c99.c +++ b/usr/src/lib/libast/common/stdio/stdio_c99.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/swprintf.c b/usr/src/lib/libast/common/stdio/swprintf.c index b7b412f726..4b43fccc33 100644 --- a/usr/src/lib/libast/common/stdio/swprintf.c +++ b/usr/src/lib/libast/common/stdio/swprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/swscanf.c b/usr/src/lib/libast/common/stdio/swscanf.c index acf72fdc48..6653930fba 100644 --- a/usr/src/lib/libast/common/stdio/swscanf.c +++ b/usr/src/lib/libast/common/stdio/swscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/tmpfile.c b/usr/src/lib/libast/common/stdio/tmpfile.c index cfcd311da5..7d19057681 100644 --- a/usr/src/lib/libast/common/stdio/tmpfile.c +++ b/usr/src/lib/libast/common/stdio/tmpfile.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/ungetc.c b/usr/src/lib/libast/common/stdio/ungetc.c index bf3f5fa8fc..dc86703317 100644 --- a/usr/src/lib/libast/common/stdio/ungetc.c +++ b/usr/src/lib/libast/common/stdio/ungetc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/ungetwc.c b/usr/src/lib/libast/common/stdio/ungetwc.c index 08c5aa362a..12aa1cc92a 100644 --- a/usr/src/lib/libast/common/stdio/ungetwc.c +++ b/usr/src/lib/libast/common/stdio/ungetwc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vasprintf.c b/usr/src/lib/libast/common/stdio/vasprintf.c index 6bdaf77fa0..1bb9609243 100644 --- a/usr/src/lib/libast/common/stdio/vasprintf.c +++ b/usr/src/lib/libast/common/stdio/vasprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vfprintf.c b/usr/src/lib/libast/common/stdio/vfprintf.c index cff1bd5d1d..42fca64d7e 100644 --- a/usr/src/lib/libast/common/stdio/vfprintf.c +++ b/usr/src/lib/libast/common/stdio/vfprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vfscanf.c b/usr/src/lib/libast/common/stdio/vfscanf.c index c9d4df1051..dd0d2a1a0d 100644 --- a/usr/src/lib/libast/common/stdio/vfscanf.c +++ b/usr/src/lib/libast/common/stdio/vfscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vfwprintf.c b/usr/src/lib/libast/common/stdio/vfwprintf.c index a4a274c340..06e4bfcdeb 100644 --- a/usr/src/lib/libast/common/stdio/vfwprintf.c +++ b/usr/src/lib/libast/common/stdio/vfwprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vfwscanf.c b/usr/src/lib/libast/common/stdio/vfwscanf.c index 4ae8697fca..7e3d9baa51 100644 --- a/usr/src/lib/libast/common/stdio/vfwscanf.c +++ b/usr/src/lib/libast/common/stdio/vfwscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vprintf.c b/usr/src/lib/libast/common/stdio/vprintf.c index 0824e692e9..983bf17118 100644 --- a/usr/src/lib/libast/common/stdio/vprintf.c +++ b/usr/src/lib/libast/common/stdio/vprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vscanf.c b/usr/src/lib/libast/common/stdio/vscanf.c index 4e36c27bb3..4e5d8a6f7d 100644 --- a/usr/src/lib/libast/common/stdio/vscanf.c +++ b/usr/src/lib/libast/common/stdio/vscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vsnprintf.c b/usr/src/lib/libast/common/stdio/vsnprintf.c index 8ce4424d40..d794845cbf 100644 --- a/usr/src/lib/libast/common/stdio/vsnprintf.c +++ b/usr/src/lib/libast/common/stdio/vsnprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vsprintf.c b/usr/src/lib/libast/common/stdio/vsprintf.c index 7f3c173aaf..365f54b8a8 100644 --- a/usr/src/lib/libast/common/stdio/vsprintf.c +++ b/usr/src/lib/libast/common/stdio/vsprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vsscanf.c b/usr/src/lib/libast/common/stdio/vsscanf.c index ea5a1adccd..f3a76d6d5e 100644 --- a/usr/src/lib/libast/common/stdio/vsscanf.c +++ b/usr/src/lib/libast/common/stdio/vsscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vswprintf.c b/usr/src/lib/libast/common/stdio/vswprintf.c index a3e90472b6..a6c1d84e48 100644 --- a/usr/src/lib/libast/common/stdio/vswprintf.c +++ b/usr/src/lib/libast/common/stdio/vswprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vswscanf.c b/usr/src/lib/libast/common/stdio/vswscanf.c index da785c3723..94dabdda18 100644 --- a/usr/src/lib/libast/common/stdio/vswscanf.c +++ b/usr/src/lib/libast/common/stdio/vswscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vwprintf.c b/usr/src/lib/libast/common/stdio/vwprintf.c index 77cdfcf99a..5b44f2caa8 100644 --- a/usr/src/lib/libast/common/stdio/vwprintf.c +++ b/usr/src/lib/libast/common/stdio/vwprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/vwscanf.c b/usr/src/lib/libast/common/stdio/vwscanf.c index fd388d0894..f9fa06eac8 100644 --- a/usr/src/lib/libast/common/stdio/vwscanf.c +++ b/usr/src/lib/libast/common/stdio/vwscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/wprintf.c b/usr/src/lib/libast/common/stdio/wprintf.c index 180c83ef72..5a3e5d5510 100644 --- a/usr/src/lib/libast/common/stdio/wprintf.c +++ b/usr/src/lib/libast/common/stdio/wprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/stdio/wscanf.c b/usr/src/lib/libast/common/stdio/wscanf.c index 607a109219..1aa647a5cf 100644 --- a/usr/src/lib/libast/common/stdio/wscanf.c +++ b/usr/src/lib/libast/common/stdio/wscanf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/base64.c b/usr/src/lib/libast/common/string/base64.c index 8132fdc3b7..e919cba7a6 100644 --- a/usr/src/lib/libast/common/string/base64.c +++ b/usr/src/lib/libast/common/string/base64.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/ccmap.c b/usr/src/lib/libast/common/string/ccmap.c index 139662c0f1..106d887da5 100644 --- a/usr/src/lib/libast/common/string/ccmap.c +++ b/usr/src/lib/libast/common/string/ccmap.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/ccmapid.c b/usr/src/lib/libast/common/string/ccmapid.c index 52369e32c3..fc1e7a071c 100644 --- a/usr/src/lib/libast/common/string/ccmapid.c +++ b/usr/src/lib/libast/common/string/ccmapid.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/ccnative.c b/usr/src/lib/libast/common/string/ccnative.c index def38beee1..a3aa48e995 100644 --- a/usr/src/lib/libast/common/string/ccnative.c +++ b/usr/src/lib/libast/common/string/ccnative.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/chresc.c b/usr/src/lib/libast/common/string/chresc.c index ac9bb1c3df..e1b6fbe087 100644 --- a/usr/src/lib/libast/common/string/chresc.c +++ b/usr/src/lib/libast/common/string/chresc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/chrtoi.c b/usr/src/lib/libast/common/string/chrtoi.c index 929809ee7b..e41c37e15a 100644 --- a/usr/src/lib/libast/common/string/chrtoi.c +++ b/usr/src/lib/libast/common/string/chrtoi.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtbase.c b/usr/src/lib/libast/common/string/fmtbase.c index be5db317e1..5589d50ff8 100644 --- a/usr/src/lib/libast/common/string/fmtbase.c +++ b/usr/src/lib/libast/common/string/fmtbase.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtbuf.c b/usr/src/lib/libast/common/string/fmtbuf.c index 0423e21225..4202e780bf 100644 --- a/usr/src/lib/libast/common/string/fmtbuf.c +++ b/usr/src/lib/libast/common/string/fmtbuf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtclock.c b/usr/src/lib/libast/common/string/fmtclock.c index 4a7f48eb48..1036fdee95 100644 --- a/usr/src/lib/libast/common/string/fmtclock.c +++ b/usr/src/lib/libast/common/string/fmtclock.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtdev.c b/usr/src/lib/libast/common/string/fmtdev.c index 3b591ea8bc..0a5886b234 100644 --- a/usr/src/lib/libast/common/string/fmtdev.c +++ b/usr/src/lib/libast/common/string/fmtdev.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtelapsed.c b/usr/src/lib/libast/common/string/fmtelapsed.c index 7df376be13..ec140a5a03 100644 --- a/usr/src/lib/libast/common/string/fmtelapsed.c +++ b/usr/src/lib/libast/common/string/fmtelapsed.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmterror.c b/usr/src/lib/libast/common/string/fmterror.c index 379510f352..da9c44efd4 100644 --- a/usr/src/lib/libast/common/string/fmterror.c +++ b/usr/src/lib/libast/common/string/fmterror.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtesc.c b/usr/src/lib/libast/common/string/fmtesc.c index 48b4efe8bd..a88844216b 100644 --- a/usr/src/lib/libast/common/string/fmtesc.c +++ b/usr/src/lib/libast/common/string/fmtesc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtfmt.c b/usr/src/lib/libast/common/string/fmtfmt.c index dddfb805d8..351460626b 100644 --- a/usr/src/lib/libast/common/string/fmtfmt.c +++ b/usr/src/lib/libast/common/string/fmtfmt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtfs.c b/usr/src/lib/libast/common/string/fmtfs.c index 1b7e0b1866..7b613bcb9a 100644 --- a/usr/src/lib/libast/common/string/fmtfs.c +++ b/usr/src/lib/libast/common/string/fmtfs.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtgid.c b/usr/src/lib/libast/common/string/fmtgid.c index 9e5c9fe957..55ad21700c 100644 --- a/usr/src/lib/libast/common/string/fmtgid.c +++ b/usr/src/lib/libast/common/string/fmtgid.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtident.c b/usr/src/lib/libast/common/string/fmtident.c index 5210503c49..5a7f8418f6 100644 --- a/usr/src/lib/libast/common/string/fmtident.c +++ b/usr/src/lib/libast/common/string/fmtident.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtip4.c b/usr/src/lib/libast/common/string/fmtip4.c index 623ae26dc9..3faedbbbc0 100644 --- a/usr/src/lib/libast/common/string/fmtip4.c +++ b/usr/src/lib/libast/common/string/fmtip4.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtip6.c b/usr/src/lib/libast/common/string/fmtip6.c index d5c0a6b894..6e62d988a6 100644 --- a/usr/src/lib/libast/common/string/fmtip6.c +++ b/usr/src/lib/libast/common/string/fmtip6.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -141,7 +141,10 @@ fmtip6(unsigned char* addr, int bits) *s++ = ':'; *s++ = ':'; if ((i += r[m]) >= n) + { + z = 1; break; + } z = 0; } else if (i && !(i & 1)) @@ -163,6 +166,8 @@ fmtip6(unsigned char* addr, int bits) *s++ = dig[k]; } } + if (!z && *(s - 1) == ':') + *s++ = '0'; if (bits > 0 && bits <= 128) s = dec(s, "/", bits); *s = 0; diff --git a/usr/src/lib/libast/common/string/fmtls.c b/usr/src/lib/libast/common/string/fmtls.c index b8a835d2c1..6b92a5b3e1 100644 --- a/usr/src/lib/libast/common/string/fmtls.c +++ b/usr/src/lib/libast/common/string/fmtls.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtmatch.c b/usr/src/lib/libast/common/string/fmtmatch.c index 44428a1d4e..ac8ab6707d 100644 --- a/usr/src/lib/libast/common/string/fmtmatch.c +++ b/usr/src/lib/libast/common/string/fmtmatch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtmode.c b/usr/src/lib/libast/common/string/fmtmode.c index 542833582c..3445467972 100644 --- a/usr/src/lib/libast/common/string/fmtmode.c +++ b/usr/src/lib/libast/common/string/fmtmode.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtnum.c b/usr/src/lib/libast/common/string/fmtnum.c index b35ee66f1b..bfebea9f17 100644 --- a/usr/src/lib/libast/common/string/fmtnum.c +++ b/usr/src/lib/libast/common/string/fmtnum.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtperm.c b/usr/src/lib/libast/common/string/fmtperm.c index b88e9a71d3..0fd30dd9bf 100644 --- a/usr/src/lib/libast/common/string/fmtperm.c +++ b/usr/src/lib/libast/common/string/fmtperm.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtre.c b/usr/src/lib/libast/common/string/fmtre.c index 14f2df085c..05fc4ab69c 100644 --- a/usr/src/lib/libast/common/string/fmtre.c +++ b/usr/src/lib/libast/common/string/fmtre.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtscale.c b/usr/src/lib/libast/common/string/fmtscale.c index 2646c1b744..511acf5cde 100644 --- a/usr/src/lib/libast/common/string/fmtscale.c +++ b/usr/src/lib/libast/common/string/fmtscale.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtsignal.c b/usr/src/lib/libast/common/string/fmtsignal.c index de435505d3..88162606c1 100644 --- a/usr/src/lib/libast/common/string/fmtsignal.c +++ b/usr/src/lib/libast/common/string/fmtsignal.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmttime.c b/usr/src/lib/libast/common/string/fmttime.c index b67a0c788c..45ba4bff32 100644 --- a/usr/src/lib/libast/common/string/fmttime.c +++ b/usr/src/lib/libast/common/string/fmttime.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmttmx.c b/usr/src/lib/libast/common/string/fmttmx.c index f79693aa11..b178cf46ae 100644 --- a/usr/src/lib/libast/common/string/fmttmx.c +++ b/usr/src/lib/libast/common/string/fmttmx.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmttv.c b/usr/src/lib/libast/common/string/fmttv.c index bdf8fabcdf..2478ca8991 100644 --- a/usr/src/lib/libast/common/string/fmttv.c +++ b/usr/src/lib/libast/common/string/fmttv.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtuid.c b/usr/src/lib/libast/common/string/fmtuid.c index ae33c07848..2c9fb16227 100644 --- a/usr/src/lib/libast/common/string/fmtuid.c +++ b/usr/src/lib/libast/common/string/fmtuid.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/fmtversion.c b/usr/src/lib/libast/common/string/fmtversion.c index 0868eafa04..e7829717dd 100644 --- a/usr/src/lib/libast/common/string/fmtversion.c +++ b/usr/src/lib/libast/common/string/fmtversion.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/memdup.c b/usr/src/lib/libast/common/string/memdup.c index f15de32dd9..d69cb9416c 100644 --- a/usr/src/lib/libast/common/string/memdup.c +++ b/usr/src/lib/libast/common/string/memdup.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/modedata.c b/usr/src/lib/libast/common/string/modedata.c index 9a73e9980f..c9d3a18e77 100644 --- a/usr/src/lib/libast/common/string/modedata.c +++ b/usr/src/lib/libast/common/string/modedata.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/modei.c b/usr/src/lib/libast/common/string/modei.c index 78cff935f5..cce5492601 100644 --- a/usr/src/lib/libast/common/string/modei.c +++ b/usr/src/lib/libast/common/string/modei.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/modelib.h b/usr/src/lib/libast/common/string/modelib.h index 6668ad2e24..8e6c6536f3 100644 --- a/usr/src/lib/libast/common/string/modelib.h +++ b/usr/src/lib/libast/common/string/modelib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/modex.c b/usr/src/lib/libast/common/string/modex.c index 8a21f0c2da..d61856730a 100644 --- a/usr/src/lib/libast/common/string/modex.c +++ b/usr/src/lib/libast/common/string/modex.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/stracmp.c b/usr/src/lib/libast/common/string/stracmp.c index c0a0a2a5eb..3f34f01a24 100644 --- a/usr/src/lib/libast/common/string/stracmp.c +++ b/usr/src/lib/libast/common/string/stracmp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strcopy.c b/usr/src/lib/libast/common/string/strcopy.c index 1815a5c685..7c73b363ad 100644 --- a/usr/src/lib/libast/common/string/strcopy.c +++ b/usr/src/lib/libast/common/string/strcopy.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strdup.c b/usr/src/lib/libast/common/string/strdup.c index 6831319620..a60ea63612 100644 --- a/usr/src/lib/libast/common/string/strdup.c +++ b/usr/src/lib/libast/common/string/strdup.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strelapsed.c b/usr/src/lib/libast/common/string/strelapsed.c index fe49de2034..04e9a68546 100644 --- a/usr/src/lib/libast/common/string/strelapsed.c +++ b/usr/src/lib/libast/common/string/strelapsed.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strerror.c b/usr/src/lib/libast/common/string/strerror.c index 54f6c8119c..74fbafc553 100644 --- a/usr/src/lib/libast/common/string/strerror.c +++ b/usr/src/lib/libast/common/string/strerror.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/stresc.c b/usr/src/lib/libast/common/string/stresc.c index eb53caa96c..d911accaec 100644 --- a/usr/src/lib/libast/common/string/stresc.c +++ b/usr/src/lib/libast/common/string/stresc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/streval.c b/usr/src/lib/libast/common/string/streval.c index 9b815c12a7..bfd26afcf4 100644 --- a/usr/src/lib/libast/common/string/streval.c +++ b/usr/src/lib/libast/common/string/streval.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strexpr.c b/usr/src/lib/libast/common/string/strexpr.c index d2055edfc6..8518916018 100644 --- a/usr/src/lib/libast/common/string/strexpr.c +++ b/usr/src/lib/libast/common/string/strexpr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strgid.c b/usr/src/lib/libast/common/string/strgid.c index dce5b04bc1..18ec53d6f3 100644 --- a/usr/src/lib/libast/common/string/strgid.c +++ b/usr/src/lib/libast/common/string/strgid.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strlcat.c b/usr/src/lib/libast/common/string/strlcat.c index 3bbd39c689..6c7d4d909b 100644 --- a/usr/src/lib/libast/common/string/strlcat.c +++ b/usr/src/lib/libast/common/string/strlcat.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -40,7 +40,7 @@ NoN(strlcat) #else /* - * append at t onto s limiting total size of s to n + * append t onto s limiting total size of s to n * s 0 terminated if n>0 * min(n,strlen(s))+strlen(t) returned */ @@ -52,12 +52,17 @@ NoN(strlcat) extern size_t strlcat(register char* s, register const char* t, register size_t n) { + register size_t m; const char* o = t; - if (n) + if (m = n) { - while (--n && *s) + while (n && *s) + { + n--; s++; + } + m -= n; if (n) do { @@ -72,7 +77,7 @@ strlcat(register char* s, register const char* t, register size_t n) } if (!n) while (*t++); - return t - o - 1; + return (t - o) + m - 1; } #endif diff --git a/usr/src/lib/libast/common/string/strlcpy.c b/usr/src/lib/libast/common/string/strlcpy.c index 40b4c41cd9..b389a95fdb 100644 --- a/usr/src/lib/libast/common/string/strlcpy.c +++ b/usr/src/lib/libast/common/string/strlcpy.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strlook.c b/usr/src/lib/libast/common/string/strlook.c index dbb05cd39d..a97ebe3205 100644 --- a/usr/src/lib/libast/common/string/strlook.c +++ b/usr/src/lib/libast/common/string/strlook.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strmatch.c b/usr/src/lib/libast/common/string/strmatch.c index 9d38777298..d5811b98d9 100644 --- a/usr/src/lib/libast/common/string/strmatch.c +++ b/usr/src/lib/libast/common/string/strmatch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strmode.c b/usr/src/lib/libast/common/string/strmode.c index e7e0d03ff2..5c6d2d6c4c 100644 --- a/usr/src/lib/libast/common/string/strmode.c +++ b/usr/src/lib/libast/common/string/strmode.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strnacmp.c b/usr/src/lib/libast/common/string/strnacmp.c index f32e943f3e..6813976786 100644 --- a/usr/src/lib/libast/common/string/strnacmp.c +++ b/usr/src/lib/libast/common/string/strnacmp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strncopy.c b/usr/src/lib/libast/common/string/strncopy.c index 8441d905fd..3db15a33d4 100644 --- a/usr/src/lib/libast/common/string/strncopy.c +++ b/usr/src/lib/libast/common/string/strncopy.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strnpcmp.c b/usr/src/lib/libast/common/string/strnpcmp.c new file mode 100644 index 0000000000..a7344f063a --- /dev/null +++ b/usr/src/lib/libast/common/string/strnpcmp.c @@ -0,0 +1,51 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +#include <ast.h> + +/* + * path prefix strncmp(3) -- longest first! + */ + +int +strnpcmp(register const char* a, register const char* b, size_t n) +{ + register const char* e; + + e = a + n; + for (;;) + { + if (a >= e) + return 0; + if (*a != *b) + break; + if (!*a++) + return 0; + b++; + } + if (*a == 0 && *b == '/') + return 1; + if (*a == '/' && *b == 0) + return -1; + return (a < b) ? -1 : 1; +} diff --git a/usr/src/lib/libast/common/string/strntod.c b/usr/src/lib/libast/common/string/strntod.c index fb42b59fca..a9d2dc8d18 100644 --- a/usr/src/lib/libast/common/string/strntod.c +++ b/usr/src/lib/libast/common/string/strntod.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strntol.c b/usr/src/lib/libast/common/string/strntol.c index 0cc0af02ec..65d3e58cd1 100644 --- a/usr/src/lib/libast/common/string/strntol.c +++ b/usr/src/lib/libast/common/string/strntol.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strntold.c b/usr/src/lib/libast/common/string/strntold.c index 83fcb9bf4a..53f320653b 100644 --- a/usr/src/lib/libast/common/string/strntold.c +++ b/usr/src/lib/libast/common/string/strntold.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strntoll.c b/usr/src/lib/libast/common/string/strntoll.c index 7aa5cd48b9..08862f8798 100644 --- a/usr/src/lib/libast/common/string/strntoll.c +++ b/usr/src/lib/libast/common/string/strntoll.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strnton.c b/usr/src/lib/libast/common/string/strnton.c index 43129dec1b..0466c79c6d 100644 --- a/usr/src/lib/libast/common/string/strnton.c +++ b/usr/src/lib/libast/common/string/strnton.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strntonll.c b/usr/src/lib/libast/common/string/strntonll.c index 5ab4077f18..ed6010a9c6 100644 --- a/usr/src/lib/libast/common/string/strntonll.c +++ b/usr/src/lib/libast/common/string/strntonll.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strntoul.c b/usr/src/lib/libast/common/string/strntoul.c index db65fa6c60..387c52c2e3 100644 --- a/usr/src/lib/libast/common/string/strntoul.c +++ b/usr/src/lib/libast/common/string/strntoul.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strntoull.c b/usr/src/lib/libast/common/string/strntoull.c index 985356e2d1..89b10593ee 100644 --- a/usr/src/lib/libast/common/string/strntoull.c +++ b/usr/src/lib/libast/common/string/strntoull.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strnvcmp.c b/usr/src/lib/libast/common/string/strnvcmp.c new file mode 100644 index 0000000000..7a6419d375 --- /dev/null +++ b/usr/src/lib/libast/common/string/strnvcmp.c @@ -0,0 +1,86 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +#include <ast.h> +#include <ctype.h> + +/* + * version strncmp(3) + */ + +int +strnvcmp(register const char* a, register const char* b, size_t n) +{ + register const char* ae; + register const char* be; + register unsigned long na; + register unsigned long nb; + + ae = a + n; + be = b + n; + for (;;) + { + if (a >= ae) + { + if (b >= be) + return 0; + return 1; + } + else if (b >= be) + return -1; + if (isdigit(*a) && isdigit(*b)) + { + na = nb = 0; + while (a < ae && isdigit(*a)) + na = na * 10 + *a++ - '0'; + while (b < be && isdigit(*b)) + nb = nb * 10 + *b++ - '0'; + if (na < nb) + return -1; + if (na > nb) + return 1; + } + else if (*a != *b) + break; + else if (!*a) + return 0; + else + { + a++; + b++; + } + } + if (*a == 0) + return -1; + if (*b == 0) + return 1; + if (*a == '.') + return -1; + if (*b == '.') + return 1; + if (*a == '-') + return -1; + if (*b == '-') + return 1; + return *a < *b ? -1 : 1; +} diff --git a/usr/src/lib/libast/common/string/stropt.c b/usr/src/lib/libast/common/string/stropt.c index 9890d9f8c1..7981345519 100644 --- a/usr/src/lib/libast/common/string/stropt.c +++ b/usr/src/lib/libast/common/string/stropt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strpcmp.c b/usr/src/lib/libast/common/string/strpcmp.c new file mode 100644 index 0000000000..a6bcedb80d --- /dev/null +++ b/usr/src/lib/libast/common/string/strpcmp.c @@ -0,0 +1,44 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +#include <ast.h> + +/* + * path prefix strcmp(3) -- longest first! + */ + +int +strpcmp(register const char* a, register const char* b) +{ + while (*a == *b) + { + if (!*a++) + return 0; + b++; + } + if (*a == 0 && *b == '/') + return 1; + if (*a == '/' && *b == 0) + return -1; + return (a < b) ? -1 : 1; +} diff --git a/usr/src/lib/libast/common/string/strperm.c b/usr/src/lib/libast/common/string/strperm.c index 2eab0fadd1..84ba6498d0 100644 --- a/usr/src/lib/libast/common/string/strperm.c +++ b/usr/src/lib/libast/common/string/strperm.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strpsearch.c b/usr/src/lib/libast/common/string/strpsearch.c index 69affd692e..fd7deaa5fc 100644 --- a/usr/src/lib/libast/common/string/strpsearch.c +++ b/usr/src/lib/libast/common/string/strpsearch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strsearch.c b/usr/src/lib/libast/common/string/strsearch.c index eebe7ac192..ffee3cbfd5 100644 --- a/usr/src/lib/libast/common/string/strsearch.c +++ b/usr/src/lib/libast/common/string/strsearch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strsort.c b/usr/src/lib/libast/common/string/strsort.c index 54e4067d5d..a34b36af2c 100644 --- a/usr/src/lib/libast/common/string/strsort.c +++ b/usr/src/lib/libast/common/string/strsort.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strtape.c b/usr/src/lib/libast/common/string/strtape.c index 75fc9ae5db..d2f54c720b 100644 --- a/usr/src/lib/libast/common/string/strtape.c +++ b/usr/src/lib/libast/common/string/strtape.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strtoi.h b/usr/src/lib/libast/common/string/strtoi.h index 3939aa2db7..ed53ec520e 100644 --- a/usr/src/lib/libast/common/string/strtoi.h +++ b/usr/src/lib/libast/common/string/strtoi.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -37,6 +37,7 @@ * S2I_number the signed number type * S2I_unumber the unsigned number type * S2I_unsigned 1 for unsigned, 0 for signed + * S2I_qualifier 1 for optional qualifier suffix, 0 otherwise * S2I_multiplier 1 for optional multiplier suffix, 0 otherwise * S2I_size the second argument is the input string size * @@ -425,6 +426,8 @@ S2I_function(a, e, base) const char* a; char** e; int base; c = *(s - 1); } +#if S2I_qualifier + /* * optional qualifier suffix */ @@ -461,6 +464,7 @@ S2I_function(a, e, base) const char* a; char** e; int base; break; } } +#endif if (S2I_valid(s)) { #if S2I_multiplier diff --git a/usr/src/lib/libast/common/string/strtoip4.c b/usr/src/lib/libast/common/string/strtoip4.c index 66b4eb32fe..5c36fb8443 100644 --- a/usr/src/lib/libast/common/string/strtoip4.c +++ b/usr/src/lib/libast/common/string/strtoip4.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strtoip6.c b/usr/src/lib/libast/common/string/strtoip6.c index bfc8a00053..4372213a91 100644 --- a/usr/src/lib/libast/common/string/strtoip6.c +++ b/usr/src/lib/libast/common/string/strtoip6.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strton.c b/usr/src/lib/libast/common/string/strton.c index 35410be6d8..17728d8216 100644 --- a/usr/src/lib/libast/common/string/strton.c +++ b/usr/src/lib/libast/common/string/strton.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strtonll.c b/usr/src/lib/libast/common/string/strtonll.c index 520ee67698..abc3bcd7a0 100644 --- a/usr/src/lib/libast/common/string/strtonll.c +++ b/usr/src/lib/libast/common/string/strtonll.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/struid.c b/usr/src/lib/libast/common/string/struid.c index 51c3a7b6be..864a0fa759 100644 --- a/usr/src/lib/libast/common/string/struid.c +++ b/usr/src/lib/libast/common/string/struid.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/struniq.c b/usr/src/lib/libast/common/string/struniq.c index 061b9169b7..7a25d93a20 100644 --- a/usr/src/lib/libast/common/string/struniq.c +++ b/usr/src/lib/libast/common/string/struniq.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/strvcmp.c b/usr/src/lib/libast/common/string/strvcmp.c new file mode 100644 index 0000000000..510daa2758 --- /dev/null +++ b/usr/src/lib/libast/common/string/strvcmp.c @@ -0,0 +1,74 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +#include <ast.h> +#include <ctype.h> + +/* + * version strcmp(3) + */ + +int +strvcmp(register const char* a, register const char* b) +{ + register unsigned long na; + register unsigned long nb; + + for (;;) + { + if (isdigit(*a) && isdigit(*b)) + { + na = nb = 0; + while (isdigit(*a)) + na = na * 10 + *a++ - '0'; + while (isdigit(*b)) + nb = nb * 10 + *b++ - '0'; + if (na < nb) + return -1; + if (na > nb) + return 1; + } + else if (*a != *b) + break; + else if (!*a) + return 0; + else + { + a++; + b++; + } + } + if (*a == 0) + return -1; + if (*b == 0) + return 1; + if (*a == '.') + return -1; + if (*b == '.') + return 1; + if (*a == '-') + return -1; + if (*b == '-') + return 1; + return *a < *b ? -1 : 1; +} diff --git a/usr/src/lib/libast/common/string/swapget.c b/usr/src/lib/libast/common/string/swapget.c index cdcdc32cb0..423d7e3e88 100644 --- a/usr/src/lib/libast/common/string/swapget.c +++ b/usr/src/lib/libast/common/string/swapget.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/swapmem.c b/usr/src/lib/libast/common/string/swapmem.c index 8aa02d554b..efd50f8502 100644 --- a/usr/src/lib/libast/common/string/swapmem.c +++ b/usr/src/lib/libast/common/string/swapmem.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/swapop.c b/usr/src/lib/libast/common/string/swapop.c index 6071dcfeee..5d25e13ca0 100644 --- a/usr/src/lib/libast/common/string/swapop.c +++ b/usr/src/lib/libast/common/string/swapop.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/swapput.c b/usr/src/lib/libast/common/string/swapput.c index f2669b9337..f91719dd8e 100644 --- a/usr/src/lib/libast/common/string/swapput.c +++ b/usr/src/lib/libast/common/string/swapput.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/tok.c b/usr/src/lib/libast/common/string/tok.c index 32dda53e90..bddee19a32 100644 --- a/usr/src/lib/libast/common/string/tok.c +++ b/usr/src/lib/libast/common/string/tok.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/tokline.c b/usr/src/lib/libast/common/string/tokline.c index 42c122d2f3..47391d4af1 100644 --- a/usr/src/lib/libast/common/string/tokline.c +++ b/usr/src/lib/libast/common/string/tokline.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/string/tokscan.c b/usr/src/lib/libast/common/string/tokscan.c index 88b8a9693f..ba4a455769 100644 --- a/usr/src/lib/libast/common/string/tokscan.c +++ b/usr/src/lib/libast/common/string/tokscan.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmdata.c b/usr/src/lib/libast/common/tm/tmdata.c index a71ff9041e..a6ee4f6a1c 100644 --- a/usr/src/lib/libast/common/tm/tmdata.c +++ b/usr/src/lib/libast/common/tm/tmdata.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -93,13 +93,15 @@ static char* format[] = "sixth", "seventh", "eighth", "ninth", "tenth", "final", "ending", "nth", + + "work", "working", "workday", }; /* * format[] lex type classes */ -static char lex[] = +static unsigned char lex[] = { TM_MONTH_ABBREV,TM_MONTH_ABBREV,TM_MONTH_ABBREV,TM_MONTH_ABBREV, TM_MONTH_ABBREV,TM_MONTH_ABBREV,TM_MONTH_ABBREV,TM_MONTH_ABBREV, @@ -153,6 +155,8 @@ static char lex[] = TM_ORDINALS, TM_ORDINALS, TM_ORDINALS, TM_ORDINALS, TM_ORDINALS, TM_FINAL, TM_FINAL, TM_FINAL, + + TM_WORK, TM_WORK, TM_WORK, }; /* @@ -185,29 +189,30 @@ static short sum[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 36 static Tm_leap_t leap[] = { - 1136073622, 23, /* 2005-12-31+23:59:60 UTC*/ - 915148821, 22, /* 1998-12-31+23:59:60 UTC */ - 867715220, 21, /* 1997-06-30+23:59:60 UTC */ - 820454419, 20, /* 1995-12-31+23:59:60 UTC */ - 773020818, 19, /* 1994-06-30+23:59:60 UTC */ - 741484817, 18, /* 1993-06-30+23:59:60 UTC */ - 709948816, 17, /* 1992-06-30+23:59:60 UTC */ - 662688015, 16, /* 1990-12-31+23:59:60 UTC */ - 631152014, 15, /* 1989-12-31+23:59:60 UTC */ - 567993613, 14, /* 1987-12-31+23:59:60 UTC */ - 489024012, 13, /* 1985-06-30+23:59:60 UTC */ - 425865611, 12, /* 1983-06-30+23:59:60 UTC */ - 394329610, 11, /* 1982-06-30+23:59:60 UTC */ - 362793609, 10, /* 1981-06-30+23:59:60 UTC */ - 315532808, 9, /* 1979-12-31+23:59:60 UTC */ - 283996807, 8, /* 1978-12-31+23:59:60 UTC */ - 252460806, 7, /* 1977-12-31+23:59:60 UTC */ - 220924805, 6, /* 1976-12-31+23:59:60 UTC */ - 189302404, 5, /* 1975-12-31+23:59:60 UTC */ - 157766403, 4, /* 1974-12-31+23:59:60 UTC */ - 126230402, 3, /* 1973-12-31+23:59:60 UTC */ - 94694401, 2, /* 1972-12-31+23:59:60 UTC */ - 78796800, 1, /* 1972-06-30+23:59:60 UTC */ + 1230768023, 24, /* 2008-12-31+23:59:60-0000 */ + 1136073622, 23, /* 2005-12-31+23:59:60-0000 */ + 915148821, 22, /* 1998-12-31+23:59:60-0000 */ + 867715220, 21, /* 1997-06-30+23:59:60-0000 */ + 820454419, 20, /* 1995-12-31+23:59:60-0000 */ + 773020818, 19, /* 1994-06-30+23:59:60-0000 */ + 741484817, 18, /* 1993-06-30+23:59:60-0000 */ + 709948816, 17, /* 1992-06-30+23:59:60-0000 */ + 662688015, 16, /* 1990-12-31+23:59:60-0000 */ + 631152014, 15, /* 1989-12-31+23:59:60-0000 */ + 567993613, 14, /* 1987-12-31+23:59:60-0000 */ + 489024012, 13, /* 1985-06-30+23:59:60-0000 */ + 425865611, 12, /* 1983-06-30+23:59:60-0000 */ + 394329610, 11, /* 1982-06-30+23:59:60-0000 */ + 362793609, 10, /* 1981-06-30+23:59:60-0000 */ + 315532808, 9, /* 1979-12-31+23:59:60-0000 */ + 283996807, 8, /* 1978-12-31+23:59:60-0000 */ + 252460806, 7, /* 1977-12-31+23:59:60-0000 */ + 220924805, 6, /* 1976-12-31+23:59:60-0000 */ + 189302404, 5, /* 1975-12-31+23:59:60-0000 */ + 157766403, 4, /* 1974-12-31+23:59:60-0000 */ + 126230402, 3, /* 1973-12-31+23:59:60-0000 */ + 94694401, 2, /* 1972-12-31+23:59:60-0000 */ + 78796800, 1, /* 1972-06-30+23:59:60-0000 */ 0, 0, /* can reference (tl+1) */ 0, 0 }; @@ -240,10 +245,10 @@ static Tm_zone_t zone[] = "CAN", "AST", "ADT", ( 4 * 60), TM_DST, /* Atlantic */ 0, "NST", 0, ( 3 * 60 + 30), 0, /* Newfoundland */ "GBR", "", "BST", ( 0 * 60), TM_DST, /* British Summer */ - "EUR", "WET", 0, ( 0 * 60), TM_DST, /* Western Eurpoean */ - 0, "CET", 0, -( 1 * 60), TM_DST, /* Central European */ - 0, "MET", 0, -( 1 * 60), TM_DST, /* Middle European */ - 0, "EET", 0, -( 2 * 60), TM_DST, /* Eastern Eurpoean */ + "EUR", "WET", "WEST", ( 0 * 60), TM_DST, /* Western Eurpoean */ + 0, "CET", "CEST", -( 1 * 60), TM_DST, /* Central European */ + 0, "MET", "MEST", -( 1 * 60), TM_DST, /* Middle European */ + 0, "EET", "EEST", -( 2 * 60), TM_DST, /* Eastern Eurpoean */ "ISR", "IST", "IDT", -( 3 * 60), TM_DST, /* Israel */ "IND", "IST", 0, -( 5 * 60 + 30 ), 0, /* India */ "CHN", "HKT", 0, -( 8 * 60), 0, /* Hong Kong */ diff --git a/usr/src/lib/libast/common/tm/tmdate.c b/usr/src/lib/libast/common/tm/tmdate.c index ff89abe081..6cc7cfe492 100644 --- a/usr/src/lib/libast/common/tm/tmdate.c +++ b/usr/src/lib/libast/common/tm/tmdate.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmequiv.c b/usr/src/lib/libast/common/tm/tmequiv.c index 0a630e21bb..d1e02d1215 100644 --- a/usr/src/lib/libast/common/tm/tmequiv.c +++ b/usr/src/lib/libast/common/tm/tmequiv.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -32,7 +32,7 @@ /* * use one of the 14 equivalent calendar years to determine * daylight savings time for future years beyond the range - * of the local system (via tmxmake()) + * of the local system (via tmxtm()) */ static const short equiv[] = diff --git a/usr/src/lib/libast/common/tm/tmfix.c b/usr/src/lib/libast/common/tm/tmfix.c index 048161ea70..11ede9c817 100644 --- a/usr/src/lib/libast/common/tm/tmfix.c +++ b/usr/src/lib/libast/common/tm/tmfix.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -28,7 +28,7 @@ */ #include <ast.h> -#include <tm.h> +#include <tmx.h> #define DAYS(p) (tm_data.days[(p)->tm_mon]+((p)->tm_mon==1&&LEAP(p))) #define LEAP(p) (tmisleapyear((p)->tm_year)) @@ -36,7 +36,7 @@ /* * correct out of bounds fields in tm * - * tm_isdst is not changed -- call tmxmake() to get that + * tm_isdst is not changed -- call tmxtm() to get that * * tm is the return value */ @@ -65,6 +65,16 @@ tmfix(register Tm_t* tm) * adjust from shortest to longest units */ + if ((n = tm->tm_nsec) < 0) + { + tm->tm_sec -= (TMX_RESOLUTION - n) / TMX_RESOLUTION; + tm->tm_nsec = TMX_RESOLUTION - (-n) % TMX_RESOLUTION; + } + else if (n >= TMX_RESOLUTION) + { + tm->tm_sec += n / TMX_RESOLUTION; + tm->tm_nsec %= TMX_RESOLUTION; + } if ((n = tm->tm_sec) < 0) { tm->tm_min -= (60 - n) / 60; diff --git a/usr/src/lib/libast/common/tm/tmfmt.c b/usr/src/lib/libast/common/tm/tmfmt.c index 8349a814b3..bfbc87c3e1 100644 --- a/usr/src/lib/libast/common/tm/tmfmt.c +++ b/usr/src/lib/libast/common/tm/tmfmt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmform.c b/usr/src/lib/libast/common/tm/tmform.c index 88040a0991..b486a91a57 100644 --- a/usr/src/lib/libast/common/tm/tmform.c +++ b/usr/src/lib/libast/common/tm/tmform.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmgoff.c b/usr/src/lib/libast/common/tm/tmgoff.c index 51d369757e..87ccbf001d 100644 --- a/usr/src/lib/libast/common/tm/tmgoff.c +++ b/usr/src/lib/libast/common/tm/tmgoff.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tminit.c b/usr/src/lib/libast/common/tm/tminit.c index fc2cb58a1d..95c6da2775 100644 --- a/usr/src/lib/libast/common/tm/tminit.c +++ b/usr/src/lib/libast/common/tm/tminit.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmleap.c b/usr/src/lib/libast/common/tm/tmleap.c index 1bbd94289d..5738462a96 100644 --- a/usr/src/lib/libast/common/tm/tmleap.c +++ b/usr/src/lib/libast/common/tm/tmleap.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmlex.c b/usr/src/lib/libast/common/tm/tmlex.c index 79d4b6f75d..f63630eb58 100644 --- a/usr/src/lib/libast/common/tm/tmlex.c +++ b/usr/src/lib/libast/common/tm/tmlex.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmlocale.c b/usr/src/lib/libast/common/tm/tmlocale.c index 7d542d16ce..7f52fc3f2c 100644 --- a/usr/src/lib/libast/common/tm/tmlocale.c +++ b/usr/src/lib/libast/common/tm/tmlocale.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmmake.c b/usr/src/lib/libast/common/tm/tmmake.c index df405877dd..fd8a9ca646 100644 --- a/usr/src/lib/libast/common/tm/tmmake.c +++ b/usr/src/lib/libast/common/tm/tmmake.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmpoff.c b/usr/src/lib/libast/common/tm/tmpoff.c index 9f52d92bf7..6863b3924b 100644 --- a/usr/src/lib/libast/common/tm/tmpoff.c +++ b/usr/src/lib/libast/common/tm/tmpoff.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmscan.c b/usr/src/lib/libast/common/tm/tmscan.c index 1ef02b07f1..2118076dd3 100644 --- a/usr/src/lib/libast/common/tm/tmscan.c +++ b/usr/src/lib/libast/common/tm/tmscan.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmsleep.c b/usr/src/lib/libast/common/tm/tmsleep.c index 69bc893020..1fb83075ea 100644 --- a/usr/src/lib/libast/common/tm/tmsleep.c +++ b/usr/src/lib/libast/common/tm/tmsleep.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmtime.c b/usr/src/lib/libast/common/tm/tmtime.c index 9853a3cc15..947fefb37a 100644 --- a/usr/src/lib/libast/common/tm/tmtime.c +++ b/usr/src/lib/libast/common/tm/tmtime.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmtype.c b/usr/src/lib/libast/common/tm/tmtype.c index fb79fbc8ab..7a6ba38939 100644 --- a/usr/src/lib/libast/common/tm/tmtype.c +++ b/usr/src/lib/libast/common/tm/tmtype.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmweek.c b/usr/src/lib/libast/common/tm/tmweek.c index ce3f8a46a1..fdec924c51 100644 --- a/usr/src/lib/libast/common/tm/tmweek.c +++ b/usr/src/lib/libast/common/tm/tmweek.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmword.c b/usr/src/lib/libast/common/tm/tmword.c index 6e8b571138..3453ac0f77 100644 --- a/usr/src/lib/libast/common/tm/tmword.c +++ b/usr/src/lib/libast/common/tm/tmword.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmxdate.c b/usr/src/lib/libast/common/tm/tmxdate.c index 4307be04fd..76e9cd71df 100644 --- a/usr/src/lib/libast/common/tm/tmxdate.c +++ b/usr/src/lib/libast/common/tm/tmxdate.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -38,6 +38,8 @@ #define dig3(s,n) ((n)=((*(s)++)-'0')*100,(n)+=((*(s)++)-'0')*10,(n)+=(*(s)++)-'0') #define dig4(s,n) ((n)=((*(s)++)-'0')*1000,(n)+=((*(s)++)-'0')*100,(n)+=((*(s)++)-'0')*10,(n)+=(*(s)++)-'0') +#undef BREAK + #define BREAK (1<<0) #define CCYYMMDDHHMMSS (1<<1) #define CRON (1<<2) @@ -56,9 +58,12 @@ #define SECOND (1<<15) #define THIS (1L<<16) #define WDAY (1L<<17) -#define YEAR (1L<<18) -#define ZONE (1L<<19) +#define WORK (1L<<18) +#define YEAR (1L<<19) +#define ZONE (1L<<20) +#define FFMT "%s%s%s%s%s%s%s|" +#define FLAGS(f) (f&EXACT)?"|EXACT":"",(f&LAST)?"|LAST":"",(f&THIS)?"|THIS":"",(f&NEXT)?"|NEXT":"",(f&ORDINAL)?"|ORDINAL":"",(f&FINAL)?"|FINAL":"",(f&WORK)?"|WORK":"" /* * parse cron range into set * return: -1:error 0:* 1:some @@ -112,6 +117,36 @@ range(register char* s, char** e, char* set, int lo, int hi) } /* + * normalize <p,q> to power of 10 u in tm + */ + +static void +powerize(Tm_t* tm, unsigned long p, unsigned long q, unsigned long u) +{ + Time_t t = p; + + while (q > u) + { + q /= 10; + t /= 10; + } + while (q < u) + { + q *= 10; + t *= 10; + } + tm->tm_nsec += (int)(t % TMX_RESOLUTION); + tm->tm_sec += (int)(t / TMX_RESOLUTION); +} + +#define K1(c1) (c1) +#define K2(c1,c2) (((c1)<<8)|(c2)) +#define K3(c1,c2,c3) (((c1)<<16)|((c2)<<8)|(c3)) +#define K4(c1,c2,c3,c4) (((c1)<<24)|((c2)<<16)|((c3)<<8)|(c4)) + +#define P_INIT(n) w = n; p = q = 0; u = (char*)s + 1 + +/* * parse date expression in s and return Time_t value * * if non-null, e points to the first invalid sequence in s @@ -130,6 +165,7 @@ tmxdate(register const char* s, char** e, Time_t now) Time_t fix; char* t; char* u; + const char* o; const char* x; char* last; char* type; @@ -144,16 +180,17 @@ tmxdate(register const char* s, char** e, Time_t now) int k; int l; long m; - long p; - long q; + unsigned long p; + unsigned long q; Tm_zone_t* zp; + Tm_t ts; char skip[UCHAR_MAX + 1]; /* * check DATEMSK first */ - debug((error(-1, "AHA tmxdate 2008-05-22"))); + debug((error(-1, "AHA tmxdate 2009-03-06"))); fix = tmxscan(s, &last, NiL, &t, now, 0); if (t && !*last) { @@ -161,6 +198,7 @@ tmxdate(register const char* s, char** e, Time_t now) *e = last; return fix; } + o = s; reset: @@ -168,9 +206,10 @@ tmxdate(register const char* s, char** e, Time_t now) * use now for defaults */ - tm = tmxmake(now); - tm_info.date = tm_info.zone; + tm = tmxtm(&ts, now, NiL); + tm_info.date = tm->tm_zone; day = -1; + dir = 0; dst = TM_DST; set = state = 0; type = 0; @@ -183,12 +222,13 @@ tmxdate(register const char* s, char** e, Time_t now) * get <weekday year month day hour minutes seconds ?[ds]t [ap]m> */ + again: for (;;) { state &= (state & HOLD) ? ~(HOLD) : ~(EXACT|LAST|NEXT|THIS); if ((set|state) & (YEAR|MONTH|DAY)) skip['/'] = 1; - message((-1, "AHA#%d state=%s%s%s%s| set=%s%s%s%s|", __LINE__, (state & EXACT) ? "|EXACT" : "", (state & LAST) ? "|LAST" : "", (state & THIS) ? "|THIS" : "", (state & NEXT) ? "|NEXT" : "", (set & EXACT) ? "|EXACT" : "", (set & LAST) ? "|LAST" : "", (set & THIS) ? "|THIS" : "", (set & NEXT) ? "|NEXT" : "")); + message((-1, "AHA#%d state=" FFMT " set=" FFMT, __LINE__, FLAGS(state), FLAGS(set))); for (;;) { if (*s == '.' || *s == '-' || *s == '+') @@ -234,6 +274,232 @@ tmxdate(register const char* s, char** e, Time_t now) } break; } + if ((*s == 'P' || *s == 'p') && (!isalpha(*(s + 1)) || (*(s + 1) == 'T' || *(s + 1) == 't') && !isalpha(*(s + 2)))) + { + Tm_t otm; + + /* + * iso duration + */ + + otm = *tm; + t = (char*)s; + m = 0; + P_INIT('Y'); + do + { + c = *++s; + duration_next: + switch (c) + { + case 0: + m++; + if ((char*)s > u) + { + s--; + c = '_'; + goto duration_next; + } + break; + case 'T': + case 't': + m++; + if ((char*)s > u) + { + s++; + c = 'D'; + goto duration_next; + } + continue; + case 'Y': + case 'y': + m = 0; + if (q > 1) + tm->tm_sec += (365L*24L*60L*60L) * p / q; + else + tm->tm_year += p; + P_INIT('M'); + continue; + case 'm': + if (!m) + m = 1; + /*FALLTHROUGH*/ + case 'M': + switch (*(s + 1)) + { + case 'I': + case 'i': + s++; + m = 1; + w = 'S'; + break; + case 'O': + case 'o': + s++; + m = 0; + w = 'H'; + break; + case 'S': + case 's': + s++; + m = 2; + w = 's'; + break; + } + switch (m) + { + case 0: + m = 1; + if (q > 1) + tm->tm_sec += (3042L*24L*60L*60L) * p / q / 100L; + else + tm->tm_mon += p; + break; + case 1: + m = 2; + if (q > 1) + tm->tm_sec += (60L) * p / q; + else + tm->tm_min += p; + break; + default: + if (q > 1) + powerize(tm, p, q, 1000UL); + else + tm->tm_nsec += p * 1000000L; + break; + } + P_INIT(w); + continue; + case 'W': + case 'w': + m = 0; + if (q > 1) + tm->tm_sec += (7L*24L*60L*60L) * p / q; + else + tm->tm_mday += 7 * p; + P_INIT('D'); + continue; + case 'D': + case 'd': + m = 0; + if (q > 1) + tm->tm_sec += (24L*60L*60L) * p / q; + else + tm->tm_mday += p; + P_INIT('H'); + continue; + case 'H': + case 'h': + m = 1; + if (q > 1) + tm->tm_sec += (60L*60L) * p / q; + else + tm->tm_hour += p; + P_INIT('m'); + continue; + case 'S': + case 's': + m = 2; + /*FALLTHROUGH*/ + case ' ': + case '_': + case '\n': + case '\r': + case '\t': + case '\v': + if (q > 1) + powerize(tm, p, q, 1000000000UL); + else + tm->tm_sec += p; + P_INIT('U'); + continue; + case 'U': + case 'u': + switch (*(s + 1)) + { + case 'S': + case 's': + s++; + break; + } + m = 0; + if (q > 1) + powerize(tm, p, q, 1000000UL); + else + tm->tm_nsec += p * 1000L; + P_INIT('N'); + continue; + case 'N': + case 'n': + switch (*(s + 1)) + { + case 'S': + case 's': + s++; + break; + } + m = 0; + if (q > 1) + powerize(tm, p, q, 1000000000UL); + else + tm->tm_nsec += p; + P_INIT('Y'); + continue; + case '.': + if (q) + goto exact; + q = 1; + continue; + case '-': + c = 'M'; + u = (char*)s++; + while (*++u && *u != ':') + if (*u == '-') + { + c = 'Y'; + break; + } + goto duration_next; + case ':': + c = 'm'; + u = (char*)s++; + while (*++u) + if (*u == ':') + { + c = 'H'; + break; + } + goto duration_next; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + q *= 10; + p = p * 10 + (c - '0'); + continue; + default: + exact: + *tm = otm; + s = (const char*)t + 1; + if (*t == 'p') + { + state |= HOLD|EXACT; + set &= ~(EXACT|LAST|NEXT|THIS); + set |= state & (EXACT|LAST|NEXT|THIS); + } + goto again; + } + break; + } while (c); + continue; + } f = -1; if (*s == '+') { @@ -369,7 +635,7 @@ tmxdate(register const char* s, char** e, Time_t now) if (flags & (MONTH|MDAY|WDAY)) { fix = tmxtime(tm, zone); - tm = tmxmake(fix); + tm = tmxtm(tm, fix, tm->tm_zone); i = tm->tm_mon + 1; j = tm->tm_mday; k = tm->tm_wday; @@ -387,7 +653,7 @@ tmxdate(register const char* s, char** e, Time_t now) tt = tmxtime(tm, zone); if (tt < fix) goto done; - tm = tmxmake(tt); + tm = tmxtm(tm, tt, tm->tm_zone); i = tm->tm_mon + 1; j = tm->tm_mday; k = tm->tm_wday; @@ -408,7 +674,7 @@ tmxdate(register const char* s, char** e, Time_t now) { tm->tm_mon = i - 1; tm->tm_mday = j; - tm = tmxmake(tmxtime(tm, zone)); + tm = tmxtm(tm, tmxtime(tm, zone), tm->tm_zone); i = tm->tm_mon + 1; j = tm->tm_mday; k = tm->tm_wday; @@ -559,7 +825,8 @@ tmxdate(register const char* s, char** e, Time_t now) } else n = -1; - message((-1, "AHA#%d f=%d n=%d", __LINE__, f, n)); + dir = f; + message((-1, "AHA#%d f=%d n=%d state=" FFMT, __LINE__, f, n, FLAGS(state))); } else { @@ -613,6 +880,8 @@ tmxdate(register const char* s, char** e, Time_t now) } else dig4(s, m); + if (m < 1969 || m >= 3000) + break; m -= 1900; } else if (i == 10) @@ -805,353 +1074,481 @@ tmxdate(register const char* s, char** e, Time_t now) else break; } - if (isalpha(*s) && n < 1000) + if (isalpha(*s)) { - if ((j = tmlex(s, &t, tm_info.format, TM_NFORM, tm_info.format + TM_SUFFIXES, TM_PARTS - TM_SUFFIXES)) >= 0) + if (n > 0) { - s = t; - switch (tm_data.lex[j]) + x = s; + q = *s++; + if (isalpha(*s)) + { + q <<= 8; + q |= *s++; + if (isalpha(*s)) + { + if (tmlex(s, &t, tm_info.format + TM_SUFFIXES, TM_PARTS - TM_SUFFIXES, NiL, 0) >= 0) + s = t; + if (isalpha(*s)) + { + q <<= 8; + q |= *s++; + if (isalpha(*s)) + { + q <<= 8; + q |= *s++; + if (isalpha(*s)) + q = 0; + } + } + } + } + switch (q) { - case TM_EXACT: - state |= HOLD|EXACT; - set &= ~(EXACT|LAST|NEXT|THIS); - set |= state & (EXACT|LAST|NEXT|THIS); + case K1('y'): + case K1('Y'): + case K2('y','r'): + case K2('Y','R'): + tm->tm_year += n; + set |= YEAR; continue; - case TM_LAST: - state |= HOLD|LAST; - set &= ~(EXACT|LAST|NEXT|THIS); - set |= state & (EXACT|LAST|NEXT|THIS); + case K1('M'): + case K2('m','o'): + case K2('M','O'): + tm->tm_mon += n; + set |= MONTH; continue; - case TM_THIS: - state |= HOLD|THIS; - set &= ~(EXACT|LAST|NEXT|THIS); - set |= state & (EXACT|LAST|NEXT|THIS); - n = 0; + case K1('w'): + case K1('W'): + case K2('w','k'): + case K2('W','K'): + tm->tm_mday += n * 7; + set |= DAY; continue; - case TM_NEXT: - /* - * disambiguate english "last ... in" - */ - - if (!((state|set) & LAST)) + case K1('d'): + case K1('D'): + case K2('d','a'): + case K2('d','y'): + case K2('D','A'): + case K2('D','Y'): + tm->tm_mday += n; + set |= DAY; + continue; + case K1('h'): + case K1('H'): + case K2('h','r'): + case K2('H','R'): + tm->tm_hour += n; + set |= HOUR; + continue; + case K1('m'): + case K2('m','n'): + case K2('M','N'): + tm->tm_min += n; + set |= MINUTE; + continue; + case K1('s'): + case K2('s','c'): + case K1('S'): + case K2('S','C'): + tm->tm_sec += n; + set |= SECOND; + continue; + case K2('m','s'): + case K3('m','s','c'): + case K4('m','s','e','c'): + case K2('M','S'): + case K3('M','S','C'): + case K4('M','S','E','C'): + tm->tm_nsec += n * 1000000L; + continue; + case K1('u'): + case K2('u','s'): + case K3('u','s','c'): + case K4('u','s','e','c'): + case K1('U'): + case K2('U','S'): + case K3('U','S','C'): + case K4('U','S','E','C'): + tm->tm_nsec += n * 1000L; + continue; + case K2('n','s'): + case K3('n','s','c'): + case K4('n','s','e','c'): + case K2('N','S'): + case K3('N','S','C'): + case K4('N','S','E','C'): + tm->tm_nsec += n; + continue; + } + s = x; + } + if (n < 1000) + { + if ((j = tmlex(s, &t, tm_info.format, TM_NFORM, tm_info.format + TM_SUFFIXES, TM_PARTS - TM_SUFFIXES)) >= 0) + { + s = t; + switch (tm_data.lex[j]) { - state |= HOLD|NEXT; + case TM_EXACT: + state |= HOLD|EXACT; set &= ~(EXACT|LAST|NEXT|THIS); set |= state & (EXACT|LAST|NEXT|THIS); continue; - } - /*FALLTHROUGH*/ - case TM_FINAL: - state |= HOLD|THIS|FINAL; - set &= ~(EXACT|LAST|NEXT|THIS); - set |= state & (EXACT|LAST|NEXT|THIS|FINAL); - continue; - case TM_ORDINAL: - j += TM_ORDINALS - TM_ORDINAL; - message((-1, "AHA#%d j=%d", __LINE__, j)); - /*FALLTHROUGH*/ - case TM_ORDINALS: - n = j - TM_ORDINALS + 1; - message((-1, "AHA#%d n=%d", __LINE__, n)); - goto ordinal; - case TM_MERIDIAN: - if (f >= 0) - f++; - else if (state & LAST) - f = -1; - else if (state & THIS) - f = 1; - else if (state & NEXT) - f = 2; - else - f = 0; - if (n > 0) - { - if (n > 24) - goto done; - tm->tm_hour = n; - } - for (k = tm->tm_hour; k < 0; k += 24); - k %= 24; - if (j == TM_MERIDIAN) - { - if (k == 12) - tm->tm_hour -= 12; - } - else if (k < 12) - tm->tm_hour += 12; - if (n > 0) - goto clear_min; - continue; - case TM_DAY_ABBREV: - j += TM_DAY - TM_DAY_ABBREV; - /*FALLTHROUGH*/ - case TM_DAY: - case TM_PARTS: - case TM_HOURS: - state |= set & (EXACT|LAST|NEXT|THIS); - if (!(state & (LAST|NEXT|THIS))) - for (;;) + case TM_LAST: + state |= HOLD|LAST; + set &= ~(EXACT|LAST|NEXT|THIS); + set |= state & (EXACT|LAST|NEXT|THIS); + continue; + case TM_THIS: + state |= HOLD|THIS; + set &= ~(EXACT|LAST|NEXT|THIS); + set |= state & (EXACT|LAST|NEXT|THIS); + n = 0; + continue; + case TM_NEXT: + /* + * disambiguate english "last ... in" + */ + + if (!((state|set) & LAST)) { - while (skip[*s]) - s++; - if ((k = tmlex(s, &t, tm_info.format + TM_LAST, TM_NOISE - TM_LAST, NiL, 0)) >= 0) + state |= HOLD|NEXT; + set &= ~(EXACT|LAST|NEXT|THIS); + set |= state & (EXACT|LAST|NEXT|THIS); + continue; + } + /*FALLTHROUGH*/ + case TM_FINAL: + state |= HOLD|THIS|FINAL; + set &= ~(EXACT|LAST|NEXT|THIS); + set |= state & (EXACT|LAST|NEXT|THIS|FINAL); + continue; + case TM_WORK: + message((-1, "AHA#%d WORK", __LINE__)); + state |= WORK; + set |= DAY; + if (state & LAST) + { + state &= ~LAST; + set &= ~LAST; + state |= FINAL; + set |= FINAL; + } + goto clear_hour; + case TM_ORDINAL: + j += TM_ORDINALS - TM_ORDINAL; + message((-1, "AHA#%d j=%d", __LINE__, j)); + /*FALLTHROUGH*/ + case TM_ORDINALS: + n = j - TM_ORDINALS + 1; + message((-1, "AHA#%d n=%d", __LINE__, n)); + goto ordinal; + case TM_MERIDIAN: + if (f >= 0) + f++; + else if (state & LAST) + f = -1; + else if (state & THIS) + f = 1; + else if (state & NEXT) + f = 2; + else + f = 0; + if (n > 0) + { + if (n > 24) + goto done; + tm->tm_hour = n; + } + for (k = tm->tm_hour; k < 0; k += 24); + k %= 24; + if (j == TM_MERIDIAN) + { + if (k == 12) + tm->tm_hour -= 12; + } + else if (k < 12) + tm->tm_hour += 12; + if (n > 0) + goto clear_min; + continue; + case TM_DAY_ABBREV: + j += TM_DAY - TM_DAY_ABBREV; + /*FALLTHROUGH*/ + case TM_DAY: + case TM_PARTS: + case TM_HOURS: + state |= set & (EXACT|LAST|NEXT|THIS); + if (!(state & (LAST|NEXT|THIS))) + for (;;) { - s = t; - if (k <= 2) - state |= LAST; - else if (k <= 5) - state |= THIS; - else if (k <= 8) - state |= NEXT; + while (skip[*s]) + s++; + if ((k = tmlex(s, &t, tm_info.format + TM_LAST, TM_NOISE - TM_LAST, NiL, 0)) >= 0) + { + s = t; + if (k <= 2) + state |= LAST; + else if (k <= 5) + state |= THIS; + else if (k <= 8) + state |= NEXT; + else + state |= EXACT; + } else - state |= EXACT; + { + state |= (n > 0) ? NEXT : THIS; + break; + } + set &= ~(EXACT|LAST|NEXT|THIS); + set |= state & (EXACT|LAST|NEXT|THIS); } - else + /*FALLTHROUGH*/ + case TM_DAYS: + message((-1, "AHA#%d n=%d j=%d f=%d state=" FFMT, __LINE__, n, j, f, FLAGS(state))); + if (n == -1) + { + /* + * disambiguate english "second" + */ + + if (j == TM_PARTS && f == -1) { - state |= (n > 0) ? NEXT : THIS; - break; + state &= ~(LAST|NEXT|THIS|ORDINAL); /*AHA*/ + n = 2; + goto ordinal; } - set &= ~(EXACT|LAST|NEXT|THIS); - set |= state & (EXACT|LAST|NEXT|THIS); + n = 1; } - /*FALLTHROUGH*/ - case TM_DAYS: - message((-1, "AHA#%d n=%d j=%d f=%d state=%s%s%s%s|", __LINE__, n, j, f, (state & EXACT) ? "|EXACT" : "", (state & LAST) ? "|LAST" : "", (state & THIS) ? "|THIS" : "", (state & NEXT) ? "|NEXT" : "")); - if (n == -1) - { + /* - * disambiguate english "second" + * disambiguate "last" vs. { "previous" "final" } */ - if (j == TM_PARTS && f == -1) + while (isspace(*s)) + s++; + message((-1, "AHA#%d disambiguate LAST s='%s'", __LINE__, s)); + if ((k = tmlex(s, &t, tm_info.format + TM_NEXT, TM_EXACT - TM_NEXT, NiL, 0)) >= 0 || (k = tmlex(s, &t, tm_info.format + TM_PARTS + 3, 1, NiL, 0)) >= 0) { - state &= ~(LAST|NEXT|THIS|ORDINAL); /*AHA*/ - n = 2; - goto ordinal; + s = t; + if (state & LAST) + { + state &= ~LAST; + set &= ~LAST; + state |= FINAL; + set |= FINAL; + message((-1, "AHA#%d LAST => FINAL", __LINE__)); + } + else + state &= ~(THIS|NEXT); } - n = 1; - } - - /* - * disambiguate "last" vs. { "previous" "final" } - */ - - while (isspace(*s)) - s++; - message((-1, "AHA#%d disambiguate LAST s='%s'", __LINE__, s)); - if ((k = tmlex(s, &t, tm_info.format + TM_NEXT, TM_EXACT - TM_NEXT, NiL, 0)) >= 0) - { - s = t; + message((-1, "AHA#%d disambiguate LAST k=%d", __LINE__, k)); if (state & LAST) + n = -n; + else if (!(state & NEXT)) + n--; + m = (f > 0) ? f * n : n; + message((-1, "AHA#%d f=%d n=%d i=%d j=%d k=%d l=%d m=%d state=" FFMT, __LINE__, f, n, i, j, k, l, m, FLAGS(state))); + switch (j) { - state &= ~LAST; - set &= ~LAST; - state |= FINAL; - set |= FINAL; - message((-1, "AHA#%d LAST => FINAL", __LINE__)); + case TM_DAYS+0: + tm->tm_mday--; + set |= DAY; + goto clear_hour; + case TM_DAYS+1: + set |= DAY; + goto clear_hour; + case TM_DAYS+2: + tm->tm_mday++; + set |= DAY; + goto clear_hour; + case TM_PARTS+0: + set |= SECOND; + if ((m < 0 ? -m : m) > (365L*24L*60L*60L)) + { + now = tmxtime(tm, zone) + tmxsns(m, 0); + goto reset; + } + tm->tm_sec += m; + goto clear_nsec; + case TM_PARTS+1: + tm->tm_min += m; + set |= MINUTE; + goto clear_sec; + case TM_PARTS+2: + tm->tm_hour += m; + set |= MINUTE; + goto clear_min; + case TM_PARTS+3: + message((-1, "AHA#%d DAY m=%d n=%d%s", __LINE__, m, n, (state & LAST) ? " LAST" : "")); + if ((state & (LAST|NEXT|THIS)) == LAST) + tm->tm_mday = tm_data.days[tm->tm_mon] + (tm->tm_mon == 1 && tmisleapyear(tm->tm_year)); + else if (state & ORDINAL) + tm->tm_mday = m + 1; + else + tm->tm_mday += m; + if (!(set & (FINAL|WORK))) + set |= HOUR; + goto clear_hour; + case TM_PARTS+4: + tm = tmxtm(tm, tmxtime(tm, zone), tm->tm_zone); + tm->tm_mday += 7 * m - tm->tm_wday + 1; + set |= DAY; + goto clear_hour; + case TM_PARTS+5: + tm->tm_mon += m; + set |= MONTH; + goto clear_mday; + case TM_PARTS+6: + tm->tm_year += m; + goto clear_mon; + case TM_HOURS+0: + tm->tm_mday += m; + set |= DAY; + goto clear_hour; + case TM_HOURS+1: + tm->tm_mday += m; + tm->tm_hour = 6; + set |= HOUR; + goto clear_min; + case TM_HOURS+2: + tm->tm_mday += m; + tm->tm_hour = 12; + set |= HOUR; + goto clear_min; + case TM_HOURS+3: + tm->tm_mday += m; + tm->tm_hour = 18; + set |= HOUR; + goto clear_min; } - else - state &= ~(THIS|NEXT); - } - message((-1, "AHA#%d disambiguate LAST k=%d", __LINE__, k)); - if (state & LAST) - n = -n; - else if (!(state & NEXT)) - n--; - m = (f > 0) ? f * n : n; - message((-1, "AHA#%d f=%d n=%d i=%d j=%d k=%d l=%d m=%d state=%s%s%s%s|", __LINE__, f, n, i, j, k, l, m, (state & EXACT) ? "|EXACT" : "", (state & LAST) ? "|LAST" : "", (state & THIS) ? "|THIS" : "", (state & NEXT) ? "|NEXT" : "")); - switch (j) - { - case TM_DAYS+0: - tm->tm_mday--; - set |= DAY; - goto clear_hour; - case TM_DAYS+1: - set |= DAY; - goto clear_hour; - case TM_DAYS+2: - tm->tm_mday++; - set |= DAY; - goto clear_hour; - case TM_PARTS+0: - set |= SECOND; - if ((m < 0 ? -m : m) > (365L*24L*60L*60L)) + if (m >= 0 && (state & ORDINAL)) + tm->tm_mday = 1; + tm = tmxtm(tm, tmxtime(tm, zone), tm->tm_zone); + day = j -= TM_DAY; + if (!dir) + dir = m; + message((-1, "AHA#%d j=%d m=%d", __LINE__, j, m)); + j -= tm->tm_wday; + message((-1, "AHA#%d mday=%d wday=%d day=%d dir=%d f=%d i=%d j=%d l=%d m=%d", __LINE__, tm->tm_mday, tm->tm_wday, day, dir, f, i, j, l, m)); + if (state & (LAST|NEXT|THIS)) { - now = tmxtime(tm, zone) + tmxsns(m, 0); - goto reset; + if (state & ORDINAL) + { + while (isspace(*s)) + s++; + if (isdigit(*s) || tmlex(s, &t, tm_info.format, TM_DAY_ABBREV, NiL, 0) >= 0) + { + state &= ~(LAST|NEXT|THIS); + goto clear_hour; + } + } + if (j < 0) + j += 7; } - tm->tm_sec += m; - goto clear_nsec; - case TM_PARTS+1: - tm->tm_min += m; - set |= MINUTE; - goto clear_sec; - case TM_PARTS+2: - tm->tm_hour += m; - set |= MINUTE; - goto clear_min; - case TM_PARTS+3: - tm->tm_mday += m; - if (!(set & FINAL)) - set |= HOUR; - goto clear_hour; - case TM_PARTS+4: - tm = tmxmake(tmxtime(tm, zone)); - tm->tm_mday += 7 * m - tm->tm_wday + 1; + else if (j > 0) + j -= 7; + message((-1, "AHA#%d day=%d mday=%d f=%d m=%d j=%d state=" FFMT, __LINE__, day, tm->tm_mday, f, m, j, FLAGS(state))); set |= DAY; - goto clear_hour; - case TM_PARTS+5: - tm->tm_mon += m; - set |= MONTH; - goto clear_mday; - case TM_PARTS+6: - tm->tm_year += m; - goto clear_mon; - case TM_HOURS+0: - tm->tm_mday += m; - set |= DAY; - goto clear_hour; - case TM_HOURS+1: - tm->tm_mday += m; - tm->tm_hour = 6; - set |= HOUR; - goto clear_min; - case TM_HOURS+2: - tm->tm_mday += m; - tm->tm_hour = 12; - set |= HOUR; - goto clear_min; - case TM_HOURS+3: - tm->tm_mday += m; - tm->tm_hour = 18; - set |= HOUR; - goto clear_min; - } - if (m >= 0 && (state & ORDINAL)) - tm->tm_mday = 1; - tm = tmxmake(tmxtime(tm, zone)); - day = j -= TM_DAY; - dir = m; - message((-1, "AHA#%d j=%d m=%d", __LINE__, j, m)); - j -= tm->tm_wday; - message((-1, "AHA#%d mday=%d wday=%d day=%d dir=%d f=%d i=%d j=%d l=%d m=%d", __LINE__, tm->tm_mday, tm->tm_wday, day, dir, f, i, j, l, m)); - if (state & (LAST|NEXT|THIS)) - { - if (state & ORDINAL) + if (set & (FINAL|WORK)) + goto clear_hour; + else if (state & (LAST|NEXT|THIS)) { - while (isspace(*s)) + if (f >= 0) + day = -1; + else if (m > 0 && (state & (NEXT|YEAR|MONTH)) == NEXT && j >= 0) + m--; + tm->tm_mday += j + m * 7; + set &= ~(LAST|NEXT|THIS|ORDINAL); /*AHA*/ + state &= ~(LAST|NEXT|THIS|ORDINAL); /*AHA*/ + if (!(state & EXACT)) + goto clear_hour; + } + continue; + case TM_MONTH_ABBREV: + j += TM_MONTH - TM_MONTH_ABBREV; + /*FALLTHROUGH*/ + case TM_MONTH: + if (state & MONTH) + goto done; + state |= MONTH; + i = tm->tm_mon; + tm->tm_mon = j - TM_MONTH; + if (n < 0) + { + while (skip[*s]) s++; - if (isdigit(*s) || tmlex(s, &t, tm_info.format, TM_DAY_ABBREV, NiL, 0) >= 0) + if (isdigit(*s)) { - state &= ~(LAST|NEXT|THIS); - goto clear_hour; + n = strtol(s, &t, 10); + if (n <= 31 && *t != ':') + s = t; + else + n = -1; } } - if (j < 0) - j += 7; - } - else if (j > 0) - j -= 7; - message((-1, "AHA#%d day=%d mday=%d f=%d m=%d j=%d state=%s%s%s%s|", __LINE__, day, tm->tm_mday, f, m, j, (state & EXACT) ? "|EXACT" : "", (state & LAST) ? "|LAST" : "", (state & THIS) ? "|THIS" : "", (state & NEXT) ? "|NEXT" : "")); - set |= DAY; - if (set & FINAL) - goto clear_hour; - else if (state & (LAST|NEXT|THIS)) - { - if (f >= 0) - day = -1; - else if (m > 0 && (state & (NEXT|YEAR|MONTH)) == NEXT && j >= 0) - m--; - tm->tm_mday += j + m * 7; - set &= ~(LAST|NEXT|THIS|ORDINAL); /*AHA*/ - state &= ~(LAST|NEXT|THIS|ORDINAL); /*AHA*/ - if (!(state & EXACT)) - goto clear_hour; - } - continue; - case TM_MONTH_ABBREV: - j += TM_MONTH - TM_MONTH_ABBREV; - /*FALLTHROUGH*/ - case TM_MONTH: - if (state & MONTH) - goto done; - state |= MONTH; - i = tm->tm_mon; - tm->tm_mon = j - TM_MONTH; - if (n < 0) - { - while (skip[*s]) - s++; - if (isdigit(*s)) + if (n >= 0) { - n = strtol(s, &t, 10); - if (n <= 31 && *t != ':') - s = t; - else - n = -1; + if (n > 31) + goto done; + state |= DAY|MDAY; + tm->tm_mday = n; + if (f > 0) + tm->tm_year += f; } - } - if (n >= 0) - { - if (n > 31) + if (state & (LAST|NEXT|THIS)) + { + n = i; + goto rel_month; + } + continue; + case TM_UT: + if (state & ZONE) goto done; - state |= DAY|MDAY; - tm->tm_mday = n; - if (f > 0) - tm->tm_year += f; - } - if (state & (LAST|NEXT|THIS)) - { - n = i; - goto rel_month; - } - continue; - case TM_UT: - if (state & ZONE) - goto done; - state |= ZONE; - zone = tmgoff(s, &t, 0); - s = t; - continue; - case TM_DT: - if (!dst) - goto done; - if (!(state & ZONE)) - { - dst = tm_info.zone->dst; - zone = tm_info.zone->west; + state |= ZONE; + zone = tmgoff(s, &t, 0); + s = t; + continue; + case TM_DT: + if (!dst) + goto done; + if (!(state & ZONE)) + { + dst = tm->tm_zone->dst; + zone = tm->tm_zone->west; + } + zone += tmgoff(s, &t, dst); + s = t; + dst = 0; + state |= ZONE; + continue; + case TM_NOISE: + continue; } - zone += tmgoff(s, &t, dst); + } + if (!(state & ZONE) && (zp = tmzone(s, &t, type, &dst))) + { s = t; - dst = 0; + zone = zp->west + dst; + tm_info.date = zp; state |= ZONE; - continue; - case TM_NOISE: - continue; + if (n < 0) + continue; } + else if (!type && (zp = tmtype(s, &t))) + { + s = t; + type = zp->type; + if (n < 0) + continue; + } + state |= BREAK; } - if (!(state & ZONE) && (zp = tmzone(s, &t, type, &dst))) - { - s = t; - zone = zp->west + dst; - tm_info.date = zp; - state |= ZONE; - if (n < 0) - continue; - } - else if (!type && (zp = tmtype(s, &t))) - { - s = t; - type = zp->type; - if (n < 0) - continue; - } - state |= BREAK; } else if (*s == '/') { - if (!(state & (YEAR|MONTH)) && n >= 1900 && n < 3000 && (i = strtol(s + 1, &t, 10)) > 0 && i <= 12) + if (!(state & (YEAR|MONTH)) && n >= 1969 && n < 3000 && (i = strtol(s + 1, &t, 10)) > 0 && i <= 12) { state |= YEAR; tm->tm_year = n - 1900; @@ -1216,7 +1613,7 @@ tmxdate(register const char* s, char** e, Time_t now) break; if (w == 4) { - if ((state & YEAR) || n < 1900 || n >= 3000) + if ((state & YEAR) || n < 1969 || n >= 3000) break; state |= YEAR; tm->tm_year = n - 1900; @@ -1288,13 +1685,13 @@ tmxdate(register const char* s, char** e, Time_t now) done: if (day >= 0 && !(state & (MDAY|WDAY))) { - message((-1, "AHA#%d day=%d dir=%d%s", __LINE__, day, dir, (state & FINAL) ? " FINAL" : "")); + message((-1, "AHA#%d day=%d dir=%d state=" FFMT, __LINE__, day, dir, FLAGS(state))); m = dir; if (state & MONTH) tm->tm_mday = 1; else if (m < 0) m++; - tm = tmxmake(tmxtime(tm, zone)); + tm = tmxtm(tm, tmxtime(tm, zone), tm->tm_zone); j = day - tm->tm_wday; if (j < 0) j += 7; @@ -1304,7 +1701,25 @@ tmxdate(register const char* s, char** e, Time_t now) } else if (day < 0 && (state & FINAL) && (set & DAY)) tm->tm_mday = tm_data.days[tm->tm_mon] + (tm->tm_mon == 1 && tmisleapyear(tm->tm_year)); + if (state & WORK) + { + tm->tm_mday = (set & FINAL) ? (tm_data.days[tm->tm_mon] + (tm->tm_mon == 1 && tmisleapyear(tm->tm_year))) : 1; + tmfix(tm); + message((-1, "AHA#%d WORK mday=%d wday=%d", __LINE__, tm->tm_mday, tm->tm_wday)); + if (tm->tm_wday == 0 && (j = 1) || tm->tm_wday == 6 && (j = 2)) + { + if ((tm->tm_mday + j) > (tm_data.days[tm->tm_mon] + (tm->tm_mon == 1 && tmisleapyear(tm->tm_year)))) + j -= 3; + tm->tm_mday += j; + } + } + now = tmxtime(tm, zone); + if (tm->tm_year <= 70 && tmxsec(now) > 31536000) + { + now = 0; + last = (char*)o; + } if (e) *e = last; - return tmxtime(tm, zone); + return now; } diff --git a/usr/src/lib/libast/common/tm/tmxduration.c b/usr/src/lib/libast/common/tm/tmxduration.c new file mode 100644 index 0000000000..d69eaa7fb8 --- /dev/null +++ b/usr/src/lib/libast/common/tm/tmxduration.c @@ -0,0 +1,81 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +#include <tmx.h> +#include <ctype.h> + +/* + * parse duration expression in s and return Time_t value + * if non-null, e points to the first unused char in s + * returns 0 with *e==s on error + */ + +Time_t +tmxduration(const char* s, char** e) +{ + double d; + Time_t ns; + Time_t ts; + Time_t now; + char* last; + char* t; + char* x; + Sfio_t* f; + int i; + + now = TMX_NOW; + while (isspace(*s)) + s++; + if (*s == 'P' || *s == 'p') + ns = tmxdate(s, &last, now) - now; + else + { + ns = strtod(s, &last) * TMX_RESOLUTION; + if (*last && (f = sfstropen())) + { + sfprintf(f, "exact %s", s); + t = sfstruse(f); + ts = tmxdate(t, &x, now); + if ((i = x - t - 6) > (last - s)) + { + last = (char*)s + i; + ns = ts - now; + } + else + { + sfprintf(f, "p%s", s); + t = sfstruse(f); + ts = tmxdate(t, &x, now); + if ((i = x - t - 1) > (last - s)) + { + last = (char*)s + i; + ns = ts - now; + } + } + sfstrclose(f); + } + } + if (e) + *e = last; + return ns; +} diff --git a/usr/src/lib/libast/common/tm/tmxfmt.c b/usr/src/lib/libast/common/tm/tmxfmt.c index 5228d29036..03c16bebe2 100644 --- a/usr/src/lib/libast/common/tm/tmxfmt.c +++ b/usr/src/lib/libast/common/tm/tmxfmt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -104,22 +104,26 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) int c; int i; int flags; + int alt; int pad; int delimiter; int width; int prec; int parts; + char* arg; char* f; const char* oformat; - Tm_t* tp; + Tm_t* tm; Tm_zone_t* zp; Time_t now; Stack_t* sp; Stack_t stack[8]; + Tm_t ts; + char argbuf[256]; char fmt[32]; tmlocale(); - tp = tmxmake(t); + tm = tmxtm(&ts, t, NiL); if (!format || !*format) format = tm_info.deformat; oformat = format; @@ -146,6 +150,8 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) *cp++ = c; continue; } + alt = 0; + arg = 0; pad = 0; width = 0; prec = 0; @@ -162,6 +168,7 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) case 'O': if (!isalpha(*format)) break; + alt = c; continue; case '0': if (!parts) @@ -196,6 +203,26 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) if (!parts++) parts++; continue; + case '(': + i = 1; + arg = argbuf; + for (;;) + { + if (!(c = *format++)) + { + format--; + break; + } + else if (c == '(') + i++; + else if (c == ')' && !--i) + break; + else if (arg < &argbuf[sizeof(argbuf) - 1]) + *arg++ = c; + } + *arg = 0; + arg = argbuf; + continue; default: break; } @@ -217,38 +244,37 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) format = tm_info.format[TM_DEFAULT]; continue; case 'a': /* abbreviated day of week name */ - n = TM_DAY_ABBREV + tp->tm_wday; + n = TM_DAY_ABBREV + tm->tm_wday; goto index; case 'A': /* day of week name */ - n = TM_DAY + tp->tm_wday; + n = TM_DAY + tm->tm_wday; goto index; case 'b': /* abbreviated month name */ case 'h': - n = TM_MONTH_ABBREV + tp->tm_mon; + n = TM_MONTH_ABBREV + tm->tm_mon; goto index; case 'B': /* month name */ - n = TM_MONTH + tp->tm_mon; + n = TM_MONTH + tm->tm_mon; goto index; case 'c': /* `ctime(3)' date sans newline */ p = tm_info.format[TM_CTIME]; goto push; case 'C': /* 2 digit century */ - cp = number(cp, ep, (long)(1900 + tp->tm_year) / 100, 2, width, pad); + cp = number(cp, ep, (long)(1900 + tm->tm_year) / 100, 2, width, pad); continue; case 'd': /* day of month */ - cp = number(cp, ep, (long)tp->tm_mday, 2, width, pad); + cp = number(cp, ep, (long)tm->tm_mday, 2, width, pad); continue; case 'D': /* date */ p = tm_info.format[TM_DATE]; goto push; case 'E': /* OBSOLETE no pad day of month */ - cp = number(cp, ep, (long)tp->tm_mday, 0, width, pad); + cp = number(cp, ep, (long)tm->tm_mday, 0, width, pad); continue; case 'e': /* blank padded day of month */ - cp = number(cp, ep, (long)tp->tm_mday, -2, width, pad); + cp = number(cp, ep, (long)tm->tm_mday, -2, width, pad); continue; case 'f': /* TM_DEFAULT override */ - case 'o': /* OBSOLETE */ p = tm_info.deformat; goto push; case 'F': /* ISO 8601:2000 standard date format */ @@ -256,15 +282,15 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) goto push; case 'g': /* %V 2 digit year */ case 'G': /* %V 4 digit year */ - n = tp->tm_year + 1900; - if (tp->tm_yday < 7) + n = tm->tm_year + 1900; + if (tm->tm_yday < 7) { - if (tmweek(tp, 2, -1, -1) >= 52) + if (tmweek(tm, 2, -1, -1) >= 52) n--; } - else if (tp->tm_yday > 358) + else if (tm->tm_yday > 358) { - if (tmweek(tp, 2, -1, -1) <= 1) + if (tmweek(tm, 2, -1, -1) <= 1) n++; } if (c == 'g') @@ -277,27 +303,38 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) cp = number(cp, ep, (long)n, c, width, pad); continue; case 'H': /* hour (0 - 23) */ - cp = number(cp, ep, (long)tp->tm_hour, 2, width, pad); + cp = number(cp, ep, (long)tm->tm_hour, 2, width, pad); continue; case 'i': /* international `date(1)' date */ p = tm_info.format[TM_INTERNATIONAL]; goto push; case 'I': /* hour (0 - 12) */ - if ((n = tp->tm_hour) > 12) n -= 12; + if ((n = tm->tm_hour) > 12) n -= 12; else if (n == 0) n = 12; cp = number(cp, ep, (long)n, 2, width, pad); continue; case 'J': /* Julian date (0 offset) */ - cp = number(cp, ep, (long)tp->tm_yday, 3, width, pad); + cp = number(cp, ep, (long)tm->tm_yday, 3, width, pad); continue; case 'j': /* Julian date (1 offset) */ - cp = number(cp, ep, (long)(tp->tm_yday + 1), 3, width, pad); + cp = number(cp, ep, (long)(tm->tm_yday + 1), 3, width, pad); continue; case 'k': /* `date(1)' date */ p = tm_info.format[TM_DATE_1]; goto push; case 'K': - p = "%Y-%m-%d+%H:%M:%S"; + switch (alt) + { + case 'E': + p = (pad == '_') ? "%Y-%m-%d %H:%M:%S.%N %z" : "%Y-%m-%d+%H:%M:%S.%N%z"; + break; + case 'O': + p = (pad == '_') ? "%Y-%m-%d %H:%M:%S.%N" : "%Y-%m-%d+%H:%M:%S.%N"; + break; + default: + p = (pad == '_') ? "%Y-%m-%d %H:%M:%S" : "%Y-%m-%d+%H:%M:%S"; + break; + } goto push; case 'l': /* `ls -l' date */ if (t) @@ -316,25 +353,31 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) p = tm_info.format[TM_DEFAULT]; goto push; case 'm': /* month number */ - cp = number(cp, ep, (long)(tp->tm_mon + 1), 2, width, pad); + cp = number(cp, ep, (long)(tm->tm_mon + 1), 2, width, pad); continue; case 'M': /* minutes */ - cp = number(cp, ep, (long)tp->tm_min, 2, width, pad); + cp = number(cp, ep, (long)tm->tm_min, 2, width, pad); continue; case 'n': if (cp < ep) *cp++ = '\n'; continue; case 'N': /* nanosecond part */ - cp = number(cp, ep, (long)tp->tm_nsec, 9, width, pad); + cp = number(cp, ep, (long)tm->tm_nsec, 9, width, pad); continue; + case 'o': /* set options */ + if (arg) + goto options; + /*OBSOLETE*/ + p = tm_info.deformat; + goto push; case 'p': /* meridian */ - n = TM_MERIDIAN + (tp->tm_hour >= 12); + n = TM_MERIDIAN + (tm->tm_hour >= 12); goto index; case 'q': /* time zone type (nation code) */ if (!(flags & TM_UTC)) { - if ((zp = tm_info.zone) != tm_info.local) + if ((zp = tm->tm_zone) != tm_info.local) for (; zp >= tm_data.zone; zp--) if (p = zp->type) goto string; @@ -393,10 +436,7 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) goto push; case 's': /* seconds[.nanoseconds] since the epoch */ case '#': - if (t) - now = t; - else - now = tmxgettime(); + now = t; f = fmt; *f++ = '%'; if (pad == '0') @@ -414,7 +454,7 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) } continue; case 'S': /* seconds */ - cp = number(cp, ep, (long)tp->tm_sec, 2, width, pad); + cp = number(cp, ep, (long)tm->tm_sec, 2, width, pad); if ((flags & TM_SUBSECOND) && (format - 2) != oformat) { p = ".%N"; @@ -429,21 +469,21 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) p = tm_info.format[TM_TIME]; goto push; case 'u': /* weekday number [1(Monday)-7] */ - if (!(i = tp->tm_wday)) + if (!(i = tm->tm_wday)) i = 7; cp = number(cp, ep, (long)i, 0, width, pad); continue; case 'U': /* week number, Sunday as first day */ - cp = number(cp, ep, (long)tmweek(tp, 0, -1, -1), 2, width, pad); + cp = number(cp, ep, (long)tmweek(tm, 0, -1, -1), 2, width, pad); continue; case 'V': /* ISO week number */ - cp = number(cp, ep, (long)tmweek(tp, 2, -1, -1), 2, width, pad); + cp = number(cp, ep, (long)tmweek(tm, 2, -1, -1), 2, width, pad); continue; case 'W': /* week number, Monday as first day */ - cp = number(cp, ep, (long)tmweek(tp, 1, -1, -1), 2, width, pad); + cp = number(cp, ep, (long)tmweek(tm, 1, -1, -1), 2, width, pad); continue; case 'w': /* weekday number [0(Sunday)-6] */ - cp = number(cp, ep, (long)tp->tm_wday, 0, width, pad); + cp = number(cp, ep, (long)tm->tm_wday, 0, width, pad); continue; case 'x': p = tm_info.format[TM_DATE]; @@ -452,33 +492,73 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) p = tm_info.format[TM_TIME]; goto push; case 'y': /* year in the form yy */ - cp = number(cp, ep, (long)(tp->tm_year % 100), 2, width, pad); + cp = number(cp, ep, (long)(tm->tm_year % 100), 2, width, pad); continue; case 'Y': /* year in the form ccyy */ - cp = number(cp, ep, (long)(1900 + tp->tm_year), 4, width, pad); + cp = number(cp, ep, (long)(1900 + tm->tm_year), 4, width, pad); continue; case 'z': /* time zone west offset */ + if (arg) + { + if ((zp = tmzone(arg, &f, 0, 0)) && !*f && tm->tm_zone != zp) + tm = tmxtm(tm, tmxtime(tm, tm->tm_zone->west + (tm->tm_isdst ? tm->tm_zone->dst : 0)), zp); + continue; + } if ((ep - cp) >= 16) - cp = tmpoff(cp, ep - cp, "", (flags & TM_UTC) ? 0 : tm_info.zone->west - (tp->tm_isdst ? 60 : 0), 24 * 60); + cp = tmpoff(cp, ep - cp, "", (flags & TM_UTC) ? 0 : tm->tm_zone->west + (tm->tm_isdst ? tm->tm_zone->dst : 0), 24 * 60); continue; case 'Z': /* time zone */ - p = (flags & TM_UTC) ? tm_info.format[TM_UT] : tp->tm_isdst && tm_info.zone->daylight ? tm_info.zone->daylight : tm_info.zone->standard; + if (arg) + { + if ((zp = tmzone(arg, &f, 0, 0)) && !*f && tm->tm_zone != zp) + tm = tmxtm(tm, tmxtime(tm, tm->tm_zone->west + (tm->tm_isdst ? tm->tm_zone->dst : 0)), zp); + continue; + } + p = (flags & TM_UTC) ? tm_info.format[TM_UT] : tm->tm_isdst && tm->tm_zone->daylight ? tm->tm_zone->daylight : tm->tm_zone->standard; goto string; case '+': /* old %+flag */ case '!': /* old %!flag */ format--; /*FALLTHROUGH*/ - case '=': /* %=[=][+-]flag */ - if (i = *format == '=') + case '=': /* old %=[=][+-]flag */ + for (arg = argbuf; *format == '=' || *format == '-' || *format == '+' || *format == '!'; format++) + if (arg < &argbuf[sizeof(argbuf) - 2]) + *arg++ = *format; + if (*arg++ = *format) format++; - if (*format == '+' || *format == '-' || *format == '!') - c = *format++; - else - c = '+'; - switch (*format++) + *arg = 0; + arg = argbuf; + goto options; + default: + if (cp < ep) + *cp++ = '%'; + if (cp < ep) + *cp++ = c; + continue; + } + index: + p = tm_info.format[n]; + string: + while (cp < ep && (*cp = *p++)) + cp++; + continue; + options: + c = '+'; + i = 0; + for (;;) + { + switch (*arg++) { case 0: - format--; + n = 0; + break; + case '=': + i = !i; + continue; + case '+': + case '-': + case '!': + c = *(arg - 1); continue; case 'l': n = TM_LEAP; @@ -490,47 +570,37 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) case 'u': n = TM_UTC; break; + default: + continue; } - if (n) - { - /* - * right, the global state stinks - * but we respect its locale-like status - */ + if (!n) + break; - if (c == '+') - { - if (!(flags & n)) - { - flags |= n; - tm_info.flags |= n; - tp = tmxmake(t); - if (!i) - tm_info.flags &= ~n; - } - } - else if (flags & n) + /* + * right, the global state stinks + * but we respect its locale-like status + */ + + if (c == '+') + { + if (!(flags & n)) { - flags &= ~n; - tm_info.flags &= ~n; - tp = tmxmake(t); + flags |= n; + tm_info.flags |= n; + tm = tmxtm(tm, t, (flags & TM_UTC) ? &tm_data.zone[2] : tm->tm_zone); if (!i) - tm_info.flags |= n; + tm_info.flags &= ~n; } } - continue; - default: - if (cp < ep) - *cp++ = '%'; - if (cp < ep) - *cp++ = c; - continue; + else if (flags & n) + { + flags &= ~n; + tm_info.flags &= ~n; + tm = tmxtm(tm, t, (flags & TM_UTC) ? &tm_data.zone[2] : tm->tm_zone); + if (!i) + tm_info.flags |= n; + } } - index: - p = tm_info.format[n]; - string: - while (cp < ep && (*cp = *p++)) - cp++; continue; push: c = 0; diff --git a/usr/src/lib/libast/common/tm/tmxgettime.c b/usr/src/lib/libast/common/tm/tmxgettime.c index a07dab0728..dbe33c4380 100644 --- a/usr/src/lib/libast/common/tm/tmxgettime.c +++ b/usr/src/lib/libast/common/tm/tmxgettime.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmxleap.c b/usr/src/lib/libast/common/tm/tmxleap.c index 12373eff36..80fd1c1cb4 100644 --- a/usr/src/lib/libast/common/tm/tmxleap.c +++ b/usr/src/lib/libast/common/tm/tmxleap.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmxmake.c b/usr/src/lib/libast/common/tm/tmxmake.c index 0fa21fc1af..f37db8a265 100644 --- a/usr/src/lib/libast/common/tm/tmxmake.c +++ b/usr/src/lib/libast/common/tm/tmxmake.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -37,7 +37,7 @@ */ Tm_t* -tmxmake(Time_t t) +tmxtm(register Tm_t* tm, Time_t t, Tm_zone_t* zone) { register struct tm* tp; register Tm_leap_t* lp; @@ -51,9 +51,6 @@ tmxmake(Time_t t) Time_t z; uint32_t i; #endif - Tm_t tm; - - static Tm_t ts; tmset(tm_info.zone); leapsec = 0; @@ -68,67 +65,76 @@ tmxmake(Time_t t) } } x = tmxsec(t); - if (tm_info.flags & TM_UTC) + if (!(tm->tm_zone = zone)) { - tm.tm_zone = &tm_data.zone[2]; - o = 0; + if (tm_info.flags & TM_UTC) + tm->tm_zone = &tm_data.zone[2]; + else + tm->tm_zone = tm_info.zone; } - else + if ((o = 60 * tm->tm_zone->west) && x > o) { - tm.tm_zone = tm_info.zone; - o = 60 * tm.tm_zone->west; - if (x > o) - { - x -= o; - o = 0; - } + x -= o; + o = 0; } #if TMX_FLOAT i = x / (24 * 60 * 60); z = i; n = x - z * (24 * 60 * 60); - tm.tm_sec = n % 60 + leapsec; + tm->tm_sec = n % 60 + leapsec; n /= 60; - tm.tm_min = n % 60; + tm->tm_min = n % 60; n /= 60; - tm.tm_hour = n % 24; + tm->tm_hour = n % 24; #define x i #else - tm.tm_sec = x % 60 + leapsec; + tm->tm_sec = x % 60 + leapsec; x /= 60; - tm.tm_min = x % 60; + tm->tm_min = x % 60; x /= 60; - tm.tm_hour = x % 24; + tm->tm_hour = x % 24; x /= 24; #endif - tm.tm_wday = (x + 4) % 7; - tm.tm_year = (400 * (x + 25202)) / 146097 + 1; - n = tm.tm_year - 1; + tm->tm_wday = (x + 4) % 7; + tm->tm_year = (400 * (x + 25202)) / 146097 + 1; + n = tm->tm_year - 1; x -= n * 365 + n / 4 - n / 100 + (n + (1900 - 1600)) / 400 - (1970 - 1901) * 365 - (1970 - 1901) / 4; - tm.tm_mon = 0; - tm.tm_mday = x + 1; - tmfix(&tm); + tm->tm_mon = 0; + tm->tm_mday = x + 1; + tm->tm_nsec = tmxnsec(t); + tmfix(tm); n += 1900; - tm.tm_isdst = 0; - if (tm.tm_zone->daylight) + tm->tm_isdst = 0; + if (tm->tm_zone->daylight) { - if ((y = tmequiv(&tm) - 1900) == tm.tm_year) + if ((y = tmequiv(tm) - 1900) == tm->tm_year) now = tmxsec(t); else { Tm_t te; - te = tm; + te = *tm; te.tm_year = y; - now = tmxsec(tmxtime(&te, tm.tm_zone->west)); + now = tmxsec(tmxtime(&te, tm->tm_zone->west)); } - if ((tp = tmlocaltime(&now)) && ((tm.tm_isdst = tp->tm_isdst) || o)) + if ((tp = tmlocaltime(&now)) && ((tm->tm_isdst = tp->tm_isdst) || o)) { - tm.tm_min -= o / 60 + (tm.tm_isdst ? tm.tm_zone->dst : 0); - tmfix(&tm); + tm->tm_min -= o / 60 + (tm->tm_isdst ? tm->tm_zone->dst : 0); + tmfix(tm); } } - tm.tm_nsec = tmxnsec(t); - ts = tm; - return &ts; + return tm; +} + +/* + * return Tm_t for t + * time zone and leap seconds accounted for in return value + */ + +Tm_t* +tmxmake(Time_t t) +{ + static Tm_t ts; + + return tmxtm(&ts, t, NiL); } diff --git a/usr/src/lib/libast/common/tm/tmxscan.c b/usr/src/lib/libast/common/tm/tmxscan.c index e27f6f7541..c35fd89061 100644 --- a/usr/src/lib/libast/common/tm/tmxscan.c +++ b/usr/src/lib/libast/common/tm/tmxscan.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -74,6 +74,7 @@ static Time_t gen(register Tm_t* tm, register Set_t* set) { register int n; + int z; Time_t t; if (set->year >= 0) @@ -132,26 +133,32 @@ gen(register Tm_t* tm, register Set_t* set) tm->tm_hour -= 12; } t = tmxtime(tm, set->zone); - tm = 0; if (set->yday >= 0) { - tm = tmxmake(t); + z = 1; + tm = tmxtm(tm, t, tm->tm_zone); tm->tm_mday += set->yday - tm->tm_yday; } else if (set->wday >= 0) { - tm = tmxmake(t); + z = 1; + tm = tmxtm(tm, t, tm->tm_zone); if ((n = set->wday - tm->tm_wday) < 0) n += 7; tm->tm_mday += n; } + else + z = 0; if (set->nsec < 1000000000L) { - if (!tm) - tm = tmxmake(t); + if (!z) + { + z = 1; + tm = tmxtm(tm, t, tm->tm_zone); + } tm->tm_nsec = set->nsec; } - return tm ? tmxtime(tm, set->zone) : t; + return z ? tmxtime(tm, set->zone) : t; } /* @@ -175,6 +182,7 @@ scan(register const char* s, char** e, const char* format, char** f, Time_t t, l Time_t x; Set_t set; Tm_zone_t* zp; + Tm_t ts; char** sp = &stack[0]; @@ -183,8 +191,7 @@ scan(register const char* s, char** e, const char* format, char** f, Time_t t, l b = s; again: CLEAR(set); - tm = tmxmake(t); - tm_info.date = tm_info.zone; + tm = tmxtm(&ts, t, NiL); pedantic = (flags & TM_PEDANTIC) != 0; for (;;) { @@ -315,7 +322,7 @@ scan(register const char* s, char** e, const char* format, char** f, Time_t t, l x = strtoul(s, &u, 0); if (s == u) goto next; - tm = tmxmake(tmxsns(x, 0)); + tm = tmxtm(tm, tmxsns(x, 0), tm->tm_zone); s = u; CLEAR(set); continue; diff --git a/usr/src/lib/libast/common/tm/tmxsettime.c b/usr/src/lib/libast/common/tm/tmxsettime.c index 7b90cf4cd2..46e93c5cd9 100644 --- a/usr/src/lib/libast/common/tm/tmxsettime.c +++ b/usr/src/lib/libast/common/tm/tmxsettime.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmxsleep.c b/usr/src/lib/libast/common/tm/tmxsleep.c index 4330a7801b..5ad4282f75 100644 --- a/usr/src/lib/libast/common/tm/tmxsleep.c +++ b/usr/src/lib/libast/common/tm/tmxsleep.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmxtime.c b/usr/src/lib/libast/common/tm/tmxtime.c index a773dbff9a..93d0df36cc 100644 --- a/usr/src/lib/libast/common/tm/tmxtime.c +++ b/usr/src/lib/libast/common/tm/tmxtime.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmxtouch.c b/usr/src/lib/libast/common/tm/tmxtouch.c index d3545c32c6..aaedc8f53f 100644 --- a/usr/src/lib/libast/common/tm/tmxtouch.c +++ b/usr/src/lib/libast/common/tm/tmxtouch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tmzone.c b/usr/src/lib/libast/common/tm/tmzone.c index da0f35fe0e..14af6ae194 100644 --- a/usr/src/lib/libast/common/tm/tmzone.c +++ b/usr/src/lib/libast/common/tm/tmzone.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tvcmp.c b/usr/src/lib/libast/common/tm/tvcmp.c index 0ab31a4783..2a00e21e39 100644 --- a/usr/src/lib/libast/common/tm/tvcmp.c +++ b/usr/src/lib/libast/common/tm/tvcmp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tvgettime.c b/usr/src/lib/libast/common/tm/tvgettime.c index 47797c72a0..244f761d4c 100644 --- a/usr/src/lib/libast/common/tm/tvgettime.c +++ b/usr/src/lib/libast/common/tm/tvgettime.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tvsettime.c b/usr/src/lib/libast/common/tm/tvsettime.c index 6de2f12c12..14b3f3eef6 100644 --- a/usr/src/lib/libast/common/tm/tvsettime.c +++ b/usr/src/lib/libast/common/tm/tvsettime.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tvsleep.c b/usr/src/lib/libast/common/tm/tvsleep.c index cf8b735cdc..ba5dbef422 100644 --- a/usr/src/lib/libast/common/tm/tvsleep.c +++ b/usr/src/lib/libast/common/tm/tvsleep.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/tm/tvtouch.c b/usr/src/lib/libast/common/tm/tvtouch.c index 1591ec66f9..27533b26bf 100644 --- a/usr/src/lib/libast/common/tm/tvtouch.c +++ b/usr/src/lib/libast/common/tm/tvtouch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/uwin/a64l.c b/usr/src/lib/libast/common/uwin/a64l.c index 36be08484e..c2a8adbc85 100644 --- a/usr/src/lib/libast/common/uwin/a64l.c +++ b/usr/src/lib/libast/common/uwin/a64l.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/uwin/cbrt.c b/usr/src/lib/libast/common/uwin/cbrt.c index 511c99e258..873e18694a 100644 --- a/usr/src/lib/libast/common/uwin/cbrt.c +++ b/usr/src/lib/libast/common/uwin/cbrt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/uwin/err.c b/usr/src/lib/libast/common/uwin/err.c index 920f3af5be..e80007333e 100644 --- a/usr/src/lib/libast/common/uwin/err.c +++ b/usr/src/lib/libast/common/uwin/err.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/uwin/getpass.c b/usr/src/lib/libast/common/uwin/getpass.c index 11d5c49f58..7a961f7dc1 100644 --- a/usr/src/lib/libast/common/uwin/getpass.c +++ b/usr/src/lib/libast/common/uwin/getpass.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/uwin/rand48.c b/usr/src/lib/libast/common/uwin/rand48.c index d8e3aa238c..82ee3d1d3d 100644 --- a/usr/src/lib/libast/common/uwin/rand48.c +++ b/usr/src/lib/libast/common/uwin/rand48.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/uwin/rint.c b/usr/src/lib/libast/common/uwin/rint.c index 6761a429ab..87d28d4f0f 100644 --- a/usr/src/lib/libast/common/uwin/rint.c +++ b/usr/src/lib/libast/common/uwin/rint.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vec/vecargs.c b/usr/src/lib/libast/common/vec/vecargs.c index 1ce1c2dc3a..974da9f577 100644 --- a/usr/src/lib/libast/common/vec/vecargs.c +++ b/usr/src/lib/libast/common/vec/vecargs.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vec/vecfile.c b/usr/src/lib/libast/common/vec/vecfile.c index 7bb91b6c14..77f17f52ef 100644 --- a/usr/src/lib/libast/common/vec/vecfile.c +++ b/usr/src/lib/libast/common/vec/vecfile.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vec/vecfree.c b/usr/src/lib/libast/common/vec/vecfree.c index fed8e5a76b..f1dfb659ff 100644 --- a/usr/src/lib/libast/common/vec/vecfree.c +++ b/usr/src/lib/libast/common/vec/vecfree.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vec/vecload.c b/usr/src/lib/libast/common/vec/vecload.c index 1f7f18a38d..a12702cb99 100644 --- a/usr/src/lib/libast/common/vec/vecload.c +++ b/usr/src/lib/libast/common/vec/vecload.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vec/vecstring.c b/usr/src/lib/libast/common/vec/vecstring.c index 71d1042c0c..f9cc749c1c 100644 --- a/usr/src/lib/libast/common/vec/vecstring.c +++ b/usr/src/lib/libast/common/vec/vecstring.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/malloc.c b/usr/src/lib/libast/common/vmalloc/malloc.c index abe71cbf8b..da4a839ecd 100644 --- a/usr/src/lib/libast/common/vmalloc/malloc.c +++ b/usr/src/lib/libast/common/vmalloc/malloc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -43,6 +43,7 @@ extern char* getenv(const char*); #endif #include "vmhdr.h" +#include <errno.h> #if _UWIN @@ -556,6 +557,27 @@ reg size_t size; } #if __STD_C +extern int posix_memalign(reg Void_t **memptr, reg size_t align, reg size_t size) +#else +extern int posix_memalign(memptr, align, size) +reg Void_t** memptr; +reg size_t align; +reg size_t size; +#endif +{ + Void_t *mem; + + if(align == 0 || (align%sizeof(Void_t*)) != 0 || ((align-1)&align) != 0 ) + return EINVAL; + + if(!(mem = memalign(align, size)) ) + return ENOMEM; + + *memptr = mem; + return 0; +} + +#if __STD_C extern Void_t* valloc(reg size_t size) #else extern Void_t* valloc(size) diff --git a/usr/src/lib/libast/common/vmalloc/vmbest.c b/usr/src/lib/libast/common/vmalloc/vmbest.c index 8e9ef32436..35b24fa678 100644 --- a/usr/src/lib/libast/common/vmalloc/vmbest.c +++ b/usr/src/lib/libast/common/vmalloc/vmbest.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -887,7 +887,7 @@ Void_t* data; reg int local, inuse; #ifdef DEBUG - if((local = (int)data) >= 0 && local <= 0xf) + if((local = (int)integralof(data)) >= 0 && local <= 0xf) { int vmassert = _Vmassert; _Vmassert = local ? local : vmassert ? vmassert : (VM_check|VM_abort); _vmbestcheck(vd, NIL(Block_t*)); @@ -1279,6 +1279,56 @@ typedef struct _mmapdisc_s #endif #define BRK_FAILED ((Void_t*)(-1)) +/* make sure that allocated memory are addressable */ + +#if _PACKAGE_ast +#include <sig.h> +#else +#include <signal.h> +typedef void (*Sig_handler_t)(int); +#endif + +static int Gotsegv = 0; + +#if __STD_C +static void sigsegv(int sig) +#else +static void sigsegv(sig) +int sig; +#endif +{ + if(sig == SIGSEGV) + Gotsegv = 1; +} + +#if __STD_C +static int okaddr(Void_t* addr, size_t nsize) +#else +static int okaddr(addr, nsize) +Void_t* addr; +size_t nsize; +#endif +{ + Sig_handler_t segv; + int rv; + + Gotsegv = 0; /* catch segment fault */ + segv = signal(SIGSEGV, sigsegv); + + if(Gotsegv == 0) + rv = *((char*)addr); + if(Gotsegv == 0) + rv += *(((char*)addr)+nsize-1); + if(Gotsegv == 0) + rv = rv == 0 ? 0 : 1; + else rv = -1; + + signal(SIGSEGV, segv); /* restore signal catcher */ + Gotsegv = 0; + + return rv; +} + /* A discipline to get raw memory using sbrk/VirtualAlloc/mmap */ #if __STD_C static Void_t* sbrkmem(Vmalloc_t* vm, Void_t* caddr, @@ -1323,8 +1373,15 @@ Vmdisc_t* disc; /* discipline structure */ { addr = (Vmuchar_t*)sbrk(0); /* old break value */ if(addr && addr != (Vmuchar_t*)BRK_FAILED ) + { + if((addr+nsize) < addr) + return NIL(Void_t*); if(brk(addr+nsize) == 0 ) - return addr; + { if(okaddr(addr,nsize) >= 0) + return addr; + (void)brk(addr); /* release reserved address */ + } + } } #endif /* _mem_sbrk */ @@ -1333,7 +1390,10 @@ Vmdisc_t* disc; /* discipline structure */ addr = (Vmuchar_t*)mmap(0, nsize, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); if(addr && addr != (Vmuchar_t*)MAP_FAILED) - return addr; + { if(okaddr(addr,nsize) >= 0) + return addr; + (void)munmap(addr, nsize); /* release reserved address */ + } } #endif /* _mem_mmap_anon */ @@ -1357,8 +1417,11 @@ Vmdisc_t* disc; /* discipline structure */ addr = (Vmuchar_t*)mmap(0, nsize, PROT_READ|PROT_WRITE, MAP_PRIVATE, mmdc->fd, mmdc->offset); if(addr && addr != (Vmuchar_t*)MAP_FAILED) - { mmdc->offset += nsize; - return addr; + { if(okaddr(addr, nsize) >= 0) + { mmdc->offset += nsize; + return addr; + } + (void)munmap(addr, nsize); /* release reserved address */ } } #endif /* _mem_mmap_zero */ @@ -1374,10 +1437,11 @@ Vmdisc_t* disc; /* discipline structure */ if(!addr || addr == (Vmuchar_t*)BRK_FAILED) addr = caddr; else if(((Vmuchar_t*)caddr+csize) == addr) /* in sbrk-space */ - { if(nsize > csize) - addr += nsize-csize; - else addr -= csize-nsize; - return brk(addr) == 0 ? caddr : NIL(Void_t*); + { if(nsize <= csize) + addr -= csize-nsize; + else if((addr += nsize-csize) < (Vmuchar_t*)caddr) + return NIL(Void_t*); /* wrapped around address */ + else return brk(addr) == 0 ? caddr : NIL(Void_t*); } } #endif /* _mem_sbrk */ diff --git a/usr/src/lib/libast/common/vmalloc/vmclear.c b/usr/src/lib/libast/common/vmalloc/vmclear.c index d80a396628..bca98e669a 100644 --- a/usr/src/lib/libast/common/vmalloc/vmclear.c +++ b/usr/src/lib/libast/common/vmalloc/vmclear.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmclose.c b/usr/src/lib/libast/common/vmalloc/vmclose.c index 3ada670748..67b63c7723 100644 --- a/usr/src/lib/libast/common/vmalloc/vmclose.c +++ b/usr/src/lib/libast/common/vmalloc/vmclose.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmdcheap.c b/usr/src/lib/libast/common/vmalloc/vmdcheap.c index 7c985ee68c..892de4ae18 100644 --- a/usr/src/lib/libast/common/vmalloc/vmdcheap.c +++ b/usr/src/lib/libast/common/vmalloc/vmdcheap.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmdebug.c b/usr/src/lib/libast/common/vmalloc/vmdebug.c index f04c527e19..dede7d0469 100644 --- a/usr/src/lib/libast/common/vmalloc/vmdebug.c +++ b/usr/src/lib/libast/common/vmalloc/vmdebug.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmdisc.c b/usr/src/lib/libast/common/vmalloc/vmdisc.c index 89fd04b318..719d2c4194 100644 --- a/usr/src/lib/libast/common/vmalloc/vmdisc.c +++ b/usr/src/lib/libast/common/vmalloc/vmdisc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmexit.c b/usr/src/lib/libast/common/vmalloc/vmexit.c index b381567070..946a2f9519 100644 --- a/usr/src/lib/libast/common/vmalloc/vmexit.c +++ b/usr/src/lib/libast/common/vmalloc/vmexit.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmgetmem.c b/usr/src/lib/libast/common/vmalloc/vmgetmem.c index b919155140..e7a66f740b 100644 --- a/usr/src/lib/libast/common/vmalloc/vmgetmem.c +++ b/usr/src/lib/libast/common/vmalloc/vmgetmem.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmhdr.h b/usr/src/lib/libast/common/vmalloc/vmhdr.h index 8a33270f69..7fe3d64917 100644 --- a/usr/src/lib/libast/common/vmalloc/vmhdr.h +++ b/usr/src/lib/libast/common/vmalloc/vmhdr.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -157,17 +157,25 @@ extern void _vmmessage _ARG_((const char*, long, const char*, long)); #endif /*DEBUG*/ #define VMPAGESIZE 8192 + #if _AST_PAGESIZE > VMPAGESIZE #undef VMPAGESIZE #define VMPAGESIZE _AST_PAGESIZE #endif -#if _lib_getpagesize + +#if _lib_getpagesize && !defined(_AST_PAGESIZE) #define GETPAGESIZE(x) ((x) ? (x) : \ (((x)=getpagesize()) < VMPAGESIZE ? ((x)=VMPAGESIZE) : (x)) ) #else #define GETPAGESIZE(x) ((x) = VMPAGESIZE) #endif +#ifdef _AST_PAGESIZE +#define VMHEAPINCR (_Vmpagesize*1) +#else +#define VMHEAPINCR (_Vmpagesize*4) +#endif + /* Blocks are allocated such that their sizes are 0%(BITS+1) ** This frees up enough low order bits to store state information */ diff --git a/usr/src/lib/libast/common/vmalloc/vmlast.c b/usr/src/lib/libast/common/vmalloc/vmlast.c index 9a723b0ee4..2463f24e09 100644 --- a/usr/src/lib/libast/common/vmalloc/vmlast.c +++ b/usr/src/lib/libast/common/vmalloc/vmlast.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -153,6 +153,7 @@ reg Void_t* data; CLRLOCK(vd, local); ANNOUNCE(local, vm, VM_FREE, data, vm->disc); + CLRINUSE(vd, inuse); return 0; } diff --git a/usr/src/lib/libast/common/vmalloc/vmmopen.c b/usr/src/lib/libast/common/vmalloc/vmmopen.c index 4586895fbb..b5ccff821c 100644 --- a/usr/src/lib/libast/common/vmalloc/vmmopen.c +++ b/usr/src/lib/libast/common/vmalloc/vmmopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmopen.c b/usr/src/lib/libast/common/vmalloc/vmopen.c index 0f85550396..0e92089ddf 100644 --- a/usr/src/lib/libast/common/vmalloc/vmopen.c +++ b/usr/src/lib/libast/common/vmalloc/vmopen.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmpool.c b/usr/src/lib/libast/common/vmalloc/vmpool.c index a318cb9150..3195a03e65 100644 --- a/usr/src/lib/libast/common/vmalloc/vmpool.c +++ b/usr/src/lib/libast/common/vmalloc/vmpool.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmprivate.c b/usr/src/lib/libast/common/vmalloc/vmprivate.c index a16e2dc92c..d1dd774442 100644 --- a/usr/src/lib/libast/common/vmalloc/vmprivate.c +++ b/usr/src/lib/libast/common/vmalloc/vmprivate.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -27,7 +27,7 @@ void _STUB_vmprivate(){} #include "vmhdr.h" -static char* Version = "\n@(#)$Id: Vmalloc (AT&T Research) 2007-09-11 $\0\n"; +static char* Version = "\n@(#)$Id: Vmalloc (AT&T Research) 2009-06-19 $\0\n"; #if _sys_stat #include <sys/stat.h> @@ -77,7 +77,7 @@ Vmsearch_f searchf; /* tree search function */ #endif if(vd->incr <= 0) /* this is just _Vmheap on the first call */ - vd->incr = _Vmpagesize; + vd->incr = VMHEAPINCR; /* Get slightly more for administrative data */ s = size + sizeof(Seg_t) + sizeof(Block_t) + sizeof(Head_t) + 2*ALIGN; diff --git a/usr/src/lib/libast/common/vmalloc/vmprofile.c b/usr/src/lib/libast/common/vmalloc/vmprofile.c index a9e620468e..c8381e1913 100644 --- a/usr/src/lib/libast/common/vmalloc/vmprofile.c +++ b/usr/src/lib/libast/common/vmalloc/vmprofile.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmregion.c b/usr/src/lib/libast/common/vmalloc/vmregion.c index 61a59562d5..ad468388b0 100644 --- a/usr/src/lib/libast/common/vmalloc/vmregion.c +++ b/usr/src/lib/libast/common/vmalloc/vmregion.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmsegment.c b/usr/src/lib/libast/common/vmalloc/vmsegment.c index 2eb4ae35e3..b5fca2d604 100644 --- a/usr/src/lib/libast/common/vmalloc/vmsegment.c +++ b/usr/src/lib/libast/common/vmalloc/vmsegment.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmset.c b/usr/src/lib/libast/common/vmalloc/vmset.c index 3fbc354464..de80405e8e 100644 --- a/usr/src/lib/libast/common/vmalloc/vmset.c +++ b/usr/src/lib/libast/common/vmalloc/vmset.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmstat.c b/usr/src/lib/libast/common/vmalloc/vmstat.c index dc2c1097c2..6ee4de7e3c 100644 --- a/usr/src/lib/libast/common/vmalloc/vmstat.c +++ b/usr/src/lib/libast/common/vmalloc/vmstat.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmstrdup.c b/usr/src/lib/libast/common/vmalloc/vmstrdup.c index 8bbe524fb3..e5c0d4a5ef 100644 --- a/usr/src/lib/libast/common/vmalloc/vmstrdup.c +++ b/usr/src/lib/libast/common/vmalloc/vmstrdup.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmtrace.c b/usr/src/lib/libast/common/vmalloc/vmtrace.c index 7111d229ea..2e18ede92f 100644 --- a/usr/src/lib/libast/common/vmalloc/vmtrace.c +++ b/usr/src/lib/libast/common/vmalloc/vmtrace.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/common/vmalloc/vmwalk.c b/usr/src/lib/libast/common/vmalloc/vmwalk.c index 6597870d79..f2628a4594 100644 --- a/usr/src/lib/libast/common/vmalloc/vmwalk.c +++ b/usr/src/lib/libast/common/vmalloc/vmwalk.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/align.h b/usr/src/lib/libast/i386/include/ast/align.h index 7287667b33..24f8bf15f4 100644 --- a/usr/src/lib/libast/i386/include/ast/align.h +++ b/usr/src/lib/libast/i386/include/ast/align.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/ast.h b/usr/src/lib/libast/i386/include/ast/ast.h index f5335ae8a2..f1dff0cf6a 100644 --- a/usr/src/lib/libast/i386/include/ast/ast.h +++ b/usr/src/lib/libast/i386/include/ast/ast.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -185,7 +185,7 @@ typedef struct #define mbcoll() (ast.mb_xfrm!=0) #define mbwide() (mbmax()>1) -#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p++,ast.tmp_int)):(*(unsigned char*)(p++))) +#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p+=ast.mb_sync+1,ast.tmp_int)):(*(unsigned char*)(p++))) #define mbinit() (mbwide()?(*ast.mb_towc)((wchar_t*)0,(char*)0,mbmax()):0) #define mbsize(p) (mbwide()?(*ast.mb_len)((char*)(p),mbmax()):((p),1)) #define mbconv(s,w) (ast.mb_conv?(*ast.mb_conv)(s,w):((*(s)=(w)),1)) @@ -309,6 +309,7 @@ extern __MANGLE__ size_t pathnative __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathpath __PROTO__((char*, const char*, const char*, int)); extern __MANGLE__ size_t pathposix __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathprobe __PROTO__((char*, char*, const char*, const char*, const char*, int)); +extern __MANGLE__ size_t pathprog __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathrepl __PROTO__((char*, const char*, const char*)); extern __MANGLE__ int pathsetlink __PROTO__((const char*, const char*)); extern __MANGLE__ char* pathshell __PROTO__((void)); @@ -329,6 +330,7 @@ extern __MANGLE__ int strmatch __PROTO__((const char*, const char*)); extern __MANGLE__ int strmode __PROTO__((const char*)); extern __MANGLE__ int strnacmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ char* strncopy __PROTO__((char*, const char*, size_t)); +extern __MANGLE__ int strnpcmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ double strntod __PROTO__((const char*, size_t, char**)); extern __MANGLE__ _ast_fltmax_t strntold __PROTO__((const char*, size_t, char**)); extern __MANGLE__ long strntol __PROTO__((const char*, size_t, char**, int)); @@ -337,7 +339,9 @@ extern __MANGLE__ long strnton __PROTO__((const char*, size_t, char**, char*, i extern __MANGLE__ unsigned long strntoul __PROTO__((const char*, size_t, char**, int)); extern __MANGLE__ intmax_t strntonll __PROTO__((const char*, size_t, char**, char*, int)); extern __MANGLE__ uintmax_t strntoull __PROTO__((const char*, size_t, char**, int)); +extern __MANGLE__ int strnvcmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ int stropt __PROTO__((const char*, const __V_*, int, int(*)(__V_*, const __V_*, int, const char*), __V_*)); +extern __MANGLE__ int strpcmp __PROTO__((const char*, const char*)); extern __MANGLE__ int strperm __PROTO__((const char*, char**, int)); extern __MANGLE__ __V_* strpsearch __PROTO__((const __V_*, size_t, size_t, const char*, char**)); extern __MANGLE__ __V_* strsearch __PROTO__((const __V_*, size_t, size_t, Strcmp_f, const char*, __V_*)); @@ -350,6 +354,7 @@ extern __MANGLE__ long strton __PROTO__((const char*, char**, char*, int)); extern __MANGLE__ intmax_t strtonll __PROTO__((const char*, char**, char*, int)); extern __MANGLE__ int struid __PROTO__((const char*)); extern __MANGLE__ int struniq __PROTO__((char**, int)); +extern __MANGLE__ int strvcmp __PROTO__((const char*, const char*)); #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ diff --git a/usr/src/lib/libast/i386/include/ast/ast_botch.h b/usr/src/lib/libast/i386/include/ast/ast_botch.h index e8bdabcda3..4b5ef40291 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_botch.h +++ b/usr/src/lib/libast/i386/include/ast/ast_botch.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/ast_ccode.h b/usr/src/lib/libast/i386/include/ast/ast_ccode.h index 8717cfb8db..c62b58b6bf 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_ccode.h +++ b/usr/src/lib/libast/i386/include/ast/ast_ccode.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/ast_common.h b/usr/src/lib/libast/i386/include/ast/ast_common.h index f4ac70b9fd..dcad835b59 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_common.h +++ b/usr/src/lib/libast/i386/include/ast/ast_common.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -176,9 +176,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (p) /* pass va_list to varargs function */ -#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -186,6 +183,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (p) /* pass va_list to varargs function */ +#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/i386/include/ast/ast_dir.h b/usr/src/lib/libast/i386/include/ast/ast_dir.h index a402906410..8d801aa72c 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_dir.h +++ b/usr/src/lib/libast/i386/include/ast/ast_dir.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/ast_dirent.h b/usr/src/lib/libast/i386/include/ast/ast_dirent.h index 488c3ee03f..b5af5057a1 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_dirent.h +++ b/usr/src/lib/libast/i386/include/ast/ast_dirent.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/include/ast/ast_fcntl.h b/usr/src/lib/libast/i386/include/ast/ast_fcntl.h index 3b0da8bd54..00bcfa8fb6 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_fcntl.h +++ b/usr/src/lib/libast/i386/include/ast/ast_fcntl.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/i386/include/ast/ast_float.h b/usr/src/lib/libast/i386/include/ast/ast_float.h index be3594d6ad..f1e82608fc 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_float.h +++ b/usr/src/lib/libast/i386/include/ast/ast_float.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/include/ast/ast_fs.h b/usr/src/lib/libast/i386/include/ast/ast_fs.h index c4d8e36045..bd1b4b8c3e 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_fs.h +++ b/usr/src/lib/libast/i386/include/ast/ast_fs.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -100,7 +100,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/i386/include/ast/ast_iconv.h b/usr/src/lib/libast/i386/include/ast/ast_iconv.h index 314d29bd3f..01e60bd046 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_iconv.h +++ b/usr/src/lib/libast/i386/include/ast/ast_iconv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/include/ast/ast_lib.h b/usr/src/lib/libast/i386/include/ast/ast_lib.h index 0c33652fa7..0ae2eec0fe 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_lib.h +++ b/usr/src/lib/libast/i386/include/ast/ast_lib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -152,7 +152,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/ast_limits.h b/usr/src/lib/libast/i386/include/ast/ast_limits.h index 57cea0a209..83c102d1f8 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_limits.h +++ b/usr/src/lib/libast/i386/include/ast/ast_limits.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/ast_map.h b/usr/src/lib/libast/i386/include/ast/ast_map.h index 73150b3996..18772a201a 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_map.h +++ b/usr/src/lib/libast/i386/include/ast/ast_map.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -219,6 +219,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/i386/include/ast/ast_mmap.h b/usr/src/lib/libast/i386/include/ast/ast_mmap.h index d1371a1f80..db4b9daa7c 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_mmap.h +++ b/usr/src/lib/libast/i386/include/ast/ast_mmap.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -28,6 +28,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/i386/include/ast/ast_mode.h b/usr/src/lib/libast/i386/include/ast/ast_mode.h index 3c64e13ec6..86480ac738 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_mode.h +++ b/usr/src/lib/libast/i386/include/ast/ast_mode.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/ast_namval.h b/usr/src/lib/libast/i386/include/ast/ast_namval.h index 4c9b12f480..f54b08ff15 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_namval.h +++ b/usr/src/lib/libast/i386/include/ast/ast_namval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/ast_ndbm.h b/usr/src/lib/libast/i386/include/ast/ast_ndbm.h index ee6158c893..84d720a257 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_ndbm.h +++ b/usr/src/lib/libast/i386/include/ast/ast_ndbm.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/ast_nl_types.h b/usr/src/lib/libast/i386/include/ast/ast_nl_types.h index b12b443045..a3f0e08cf3 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_nl_types.h +++ b/usr/src/lib/libast/i386/include/ast/ast_nl_types.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/include/ast/ast_param.h b/usr/src/lib/libast/i386/include/ast/ast_param.h index 6893791ab9..0a9ed88045 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_param.h +++ b/usr/src/lib/libast/i386/include/ast/ast_param.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/ast_standards.h b/usr/src/lib/libast/i386/include/ast/ast_standards.h index fce59534a7..8f7b5d4093 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_standards.h +++ b/usr/src/lib/libast/i386/include/ast/ast_standards.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,29 +19,11 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/i386/include/ast/ast_std.h b/usr/src/lib/libast/i386/include/ast/ast_std.h index 4f3f3dd9da..e734c74dbd 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_std.h +++ b/usr/src/lib/libast/i386/include/ast/ast_std.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -117,22 +117,27 @@ struct lconv #define __MANGLE__ __LINKAGE__ __EXPORT__ #endif +#if !_UWIN /* for ast54 compatibility */ + #undef getenv #define getenv _ast_getenv +#undef setenviron +#define setenviron _ast_setenviron + +extern __MANGLE__ char* getenv __PROTO__((const char*)); + +#endif + #undef localeconv #define localeconv _ast_localeconv #undef setlocale #define setlocale _ast_setlocale -#undef setenviron -#define setenviron _ast_setenviron - #undef strerror #define strerror _ast_strerror -extern __MANGLE__ char* getenv __PROTO__((const char*)); extern __MANGLE__ struct lconv* localeconv __PROTO__((void)); extern __MANGLE__ char* setenviron __PROTO__((const char*)); extern __MANGLE__ char* setlocale __PROTO__((int, const char*)); @@ -159,6 +164,7 @@ extern __MANGLE__ char* strerror __PROTO__((int)); #define AST_LC_MEASUREMENT 12 #define AST_LC_PAPER 13 #define AST_LC_COUNT 14 +#define AST_LC_LANG 255 #define AST_LC_find (1L<<28) #define AST_LC_debug (1L<<29) @@ -207,6 +213,9 @@ extern __MANGLE__ char* strerror __PROTO__((int)); #ifndef LC_PAPER #define LC_PAPER (-AST_LC_PAPER) #endif +#ifndef LC_LANG +#define LC_LANG (-AST_LC_LANG) +#endif #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ @@ -248,8 +257,9 @@ typedef struct int (*mb_conv) __PROTO__((char*, wchar_t)); uint32_t env_serial; + uint32_t mb_sync; - char pad[944]; + char pad[940]; } _Ast_info_t; diff --git a/usr/src/lib/libast/i386/include/ast/ast_stdio.h b/usr/src/lib/libast/i386/include/ast/ast_stdio.h index 69f189a28e..bf2c08fb73 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_stdio.h +++ b/usr/src/lib/libast/i386/include/ast/ast_stdio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/include/ast/ast_sys.h b/usr/src/lib/libast/i386/include/ast/ast_sys.h index 28a1dfea31..3b63c47b46 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_sys.h +++ b/usr/src/lib/libast/i386/include/ast/ast_sys.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -125,7 +125,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/ast_time.h b/usr/src/lib/libast/i386/include/ast/ast_time.h index 09c701be72..377f747a0e 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_time.h +++ b/usr/src/lib/libast/i386/include/ast/ast_time.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/include/ast/ast_tty.h b/usr/src/lib/libast/i386/include/ast/ast_tty.h index 0c0e4dccb7..25660744e1 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_tty.h +++ b/usr/src/lib/libast/i386/include/ast/ast_tty.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/ast_version.h b/usr/src/lib/libast/i386/include/ast/ast_version.h index 5882fbd2a5..af5756d02b 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_version.h +++ b/usr/src/lib/libast/i386/include/ast/ast_version.h @@ -7,4 +7,4 @@ #if !defined(__LINKAGE__) #define __LINKAGE__ /* 2004-08-11 transition */ #endif -#define _AST_VERSION 20080910L +#define _AST_VERSION 20090202L diff --git a/usr/src/lib/libast/i386/include/ast/ast_vfork.h b/usr/src/lib/libast/i386/include/ast/ast_vfork.h index 05f8d6a6a3..e65f4c0438 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_vfork.h +++ b/usr/src/lib/libast/i386/include/ast/ast_vfork.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/include/ast/ast_wait.h b/usr/src/lib/libast/i386/include/ast/ast_wait.h index 0c6ac1a3bf..f11358a087 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_wait.h +++ b/usr/src/lib/libast/i386/include/ast/ast_wait.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/ast_wchar.h b/usr/src/lib/libast/i386/include/ast/ast_wchar.h index fb5148ea56..c84a745fab 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_wchar.h +++ b/usr/src/lib/libast/i386/include/ast/ast_wchar.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/include/ast/ast_windows.h b/usr/src/lib/libast/i386/include/ast/ast_windows.h index b329b2d2f5..e02d2aaeb9 100644 --- a/usr/src/lib/libast/i386/include/ast/ast_windows.h +++ b/usr/src/lib/libast/i386/include/ast/ast_windows.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/bytesex.h b/usr/src/lib/libast/i386/include/ast/bytesex.h index 95c43e160d..e105fc5f58 100644 --- a/usr/src/lib/libast/i386/include/ast/bytesex.h +++ b/usr/src/lib/libast/i386/include/ast/bytesex.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/ccode.h b/usr/src/lib/libast/i386/include/ast/ccode.h index 70c8d76471..a7a43aecbe 100644 --- a/usr/src/lib/libast/i386/include/ast/ccode.h +++ b/usr/src/lib/libast/i386/include/ast/ccode.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/cdt.h b/usr/src/lib/libast/i386/include/ast/cdt.h index 3dc5b7b7f8..f2f0389296 100644 --- a/usr/src/lib/libast/i386/include/ast/cdt.h +++ b/usr/src/lib/libast/i386/include/ast/cdt.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/debug.h b/usr/src/lib/libast/i386/include/ast/debug.h index 565212e93b..8f0ec6a257 100644 --- a/usr/src/lib/libast/i386/include/ast/debug.h +++ b/usr/src/lib/libast/i386/include/ast/debug.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -55,14 +55,17 @@ #define DEBUG_ASSERT(p) ((p) ? 0 : (debug_fatal(__FILE__, __LINE__),0)) #define DEBUG_COUNT(n) ((n) += 1) #define DEBUG_TALLY(c,n,v) ((c) ? ((n) += (v)) : (n)) +#define DEBUG_INCREASE(n) ((n) += 1) +#define DEBUG_DECREASE(n) ((n) -= 1) #define DEBUG_DECLARE(t,v) t v #define DEBUG_SET(n,v) ((n) = (v)) #define DEBUG_PRINT(fd,s,v) do {char _b[1024];write(fd,_b,sfsprintf(_b,sizeof(_b),s,v));} while(0) #define DEBUG_WRITE(fd,d,n) write((fd),(d),(n)) #define DEBUG_TEMP(temp) (temp) /* debugging stuff that should be removed */ -#define DEBUG_RETURN(x) (debug_fatal(__FILE__, __LINE__), (x)) -#define DEBUG_BREAK (debug_fatal(__FILE__, __LINE__)) +#define DEBUG_BREAK break +#define DEBUG_CONTINUE continue #define DEBUG_GOTO(label) do { debug_fatal(__FILE__, __LINE__); goto label; } while(0) +#define DEBUG_RETURN(x) do { debug_fatal(__FILE__, __LINE__); return(x); } while(0) #else @@ -75,15 +78,31 @@ #define DEBUG_ASSERT(p) #define DEBUG_COUNT(n) #define DEBUG_TALLY(c,n,v) +#define DEBUG_INCREASE(n) +#define DEBUG_DECREASE(n) #define DEBUG_DECLARE(t,v) #define DEBUG_SET(n,v) #define DEBUG_PRINT(fd,s,v) #define DEBUG_WRITE(fd,d,n) -#define DEBUG_KPV(x) -#define DEBUG_RETURN(x) return(x) +#define DEBUG_TEMP(x) #define DEBUG_BREAK break +#define DEBUG_CONTINUE continue #define DEBUG_GOTO(label) goto label +#define DEBUG_RETURN(x) return(x) + +#endif +#ifndef BREAK +#define BREAK DEBUG_BREAK +#endif +#ifndef CONTINUE +#define CONTINUE DEBUG_CONTINUE +#endif +#ifndef GOTO +#define GOTO(label) DEBUG_GOTO(label) +#endif +#ifndef RETURN +#define RETURN(x) DEBUG_RETURN(x) #endif #if _BLD_ast && defined(__EXPORT__) diff --git a/usr/src/lib/libast/i386/include/ast/dirent.h b/usr/src/lib/libast/i386/include/ast/dirent.h index b94f22215f..ea81d037a5 100644 --- a/usr/src/lib/libast/i386/include/ast/dirent.h +++ b/usr/src/lib/libast/i386/include/ast/dirent.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/dt.h b/usr/src/lib/libast/i386/include/ast/dt.h index 12299246bb..6fcc20c42e 100644 --- a/usr/src/lib/libast/i386/include/ast/dt.h +++ b/usr/src/lib/libast/i386/include/ast/dt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/endian.h b/usr/src/lib/libast/i386/include/ast/endian.h index 12539254b6..6ad7ddcaad 100644 --- a/usr/src/lib/libast/i386/include/ast/endian.h +++ b/usr/src/lib/libast/i386/include/ast/endian.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/error.h b/usr/src/lib/libast/i386/include/ast/error.h index 1cb01835f7..10d919a93a 100644 --- a/usr/src/lib/libast/i386/include/ast/error.h +++ b/usr/src/lib/libast/i386/include/ast/error.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/find.h b/usr/src/lib/libast/i386/include/ast/find.h index c094791a30..9ed4227d03 100644 --- a/usr/src/lib/libast/i386/include/ast/find.h +++ b/usr/src/lib/libast/i386/include/ast/find.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/fnmatch.h b/usr/src/lib/libast/i386/include/ast/fnmatch.h index 56c7dd7dce..ba357d9585 100644 --- a/usr/src/lib/libast/i386/include/ast/fnmatch.h +++ b/usr/src/lib/libast/i386/include/ast/fnmatch.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/fnv.h b/usr/src/lib/libast/i386/include/ast/fnv.h index badccc3071..f4caaee97f 100644 --- a/usr/src/lib/libast/i386/include/ast/fnv.h +++ b/usr/src/lib/libast/i386/include/ast/fnv.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/fs3d.h b/usr/src/lib/libast/i386/include/ast/fs3d.h index a52478f85c..50795c98b0 100644 --- a/usr/src/lib/libast/i386/include/ast/fs3d.h +++ b/usr/src/lib/libast/i386/include/ast/fs3d.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -104,7 +104,9 @@ #define FS3D_SIZE(n) ((n)<<4) #define FS3D_SIZEOF(n) ((n)>>4) -extern __MANGLE__ int mount __PROTO__((const char*, char*, int, __V_*)); +#if !_BLD_3d +#define mount(s,t,f,d) fs3d_mount(s,t,f,d) +#endif #if _BLD_ast && defined(__EXPORT__) #undef __MANGLE__ @@ -112,6 +114,7 @@ extern __MANGLE__ int mount __PROTO__((const char*, char*, int, __V_*)); #endif extern __MANGLE__ int fs3d __PROTO__((int)); +extern __MANGLE__ int fs3d_mount __PROTO__((const char*, char*, int, __V_*)); extern __MANGLE__ char* pathnext __PROTO__((char*, char*, long*)); #undef __MANGLE__ diff --git a/usr/src/lib/libast/i386/include/ast/fts.h b/usr/src/lib/libast/i386/include/ast/fts.h index a8ce187391..09420af481 100644 --- a/usr/src/lib/libast/i386/include/ast/fts.h +++ b/usr/src/lib/libast/i386/include/ast/fts.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -121,16 +121,21 @@ struct Ftsent long fts_number; /* local numeric value */ int fts_errno; /* errno for this entry */ unsigned short fts_info; /* info flags */ - unsigned short fts_namelen; /* strlen(fts_name) */ - unsigned short fts_pathlen; /* strlen(fts_path) */ - short fts_level; /* file tree depth, 0 at top */ + + unsigned short _fts_namelen; /* old fts_namelen */ + unsigned short _fts_pathlen; /* old fts_pathlen */ + short _fts_level; /* old fts_level */ + + short _fts_status; /* <ftwalk.h> compatibility */ + struct stat _fts_statb; /* <ftwalk.h> compatibility */ + + FTS* fts; /* fts_open() handle */ + size_t fts_namelen; /* strlen(fts_name) */ + size_t fts_pathlen; /* strlen(fts_path) */ + ssize_t fts_level; /* file tree depth, 0 at top */ #ifdef _FTSENT_PRIVATE_ _FTSENT_PRIVATE_ -#else - short _fts_pad_1; /* <ftwalk.h> compatibility */ - struct stat _fts_pad_2; /* <ftwalk.h> compatibility */ - FTS* fts; /* fts_open() handle */ #endif }; diff --git a/usr/src/lib/libast/i386/include/ast/ftw.h b/usr/src/lib/libast/i386/include/ast/ftw.h index 3d43cb2609..49040cf863 100644 --- a/usr/src/lib/libast/i386/include/ast/ftw.h +++ b/usr/src/lib/libast/i386/include/ast/ftw.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/ftwalk.h b/usr/src/lib/libast/i386/include/ast/ftwalk.h index 7172b76565..29e1693959 100644 --- a/usr/src/lib/libast/i386/include/ast/ftwalk.h +++ b/usr/src/lib/libast/i386/include/ast/ftwalk.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -52,6 +52,8 @@ #define fts_parent parent #define fts_path path #define fts_pathlen pathlen +#define _fts_status status +#define _fts_statb statb #define FTSENT Ftw_t /* <fts.h> internal */ #define Ftsent FTW /* <fts.h> internal */ @@ -63,10 +65,6 @@ __V_* pointer; /* local pointer value */ \ } local; -#define _FTSENT_PRIVATE_ /* fts internal */ \ - short status; /* internal status */ \ - struct stat statb; /* fts_statp data */ - #include <fts.h> /* diff --git a/usr/src/lib/libast/i386/include/ast/glob.h b/usr/src/lib/libast/i386/include/ast/glob.h index 62c420bb4f..93e202a5f9 100644 --- a/usr/src/lib/libast/i386/include/ast/glob.h +++ b/usr/src/lib/libast/i386/include/ast/glob.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/hash.h b/usr/src/lib/libast/i386/include/ast/hash.h index 3ad42981e3..a524737ccc 100644 --- a/usr/src/lib/libast/i386/include/ast/hash.h +++ b/usr/src/lib/libast/i386/include/ast/hash.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/hashkey.h b/usr/src/lib/libast/i386/include/ast/hashkey.h index ac0557f6df..525434e369 100644 --- a/usr/src/lib/libast/i386/include/ast/hashkey.h +++ b/usr/src/lib/libast/i386/include/ast/hashkey.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/hashpart.h b/usr/src/lib/libast/i386/include/ast/hashpart.h index 90f2be5c31..cfe3666777 100644 --- a/usr/src/lib/libast/i386/include/ast/hashpart.h +++ b/usr/src/lib/libast/i386/include/ast/hashpart.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/iconv.h b/usr/src/lib/libast/i386/include/ast/iconv.h index 58bc8240d2..5b02759721 100644 --- a/usr/src/lib/libast/i386/include/ast/iconv.h +++ b/usr/src/lib/libast/i386/include/ast/iconv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/lc.h b/usr/src/lib/libast/i386/include/ast/lc.h index b225864bbc..da06a59ba4 100644 --- a/usr/src/lib/libast/i386/include/ast/lc.h +++ b/usr/src/lib/libast/i386/include/ast/lc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -38,14 +38,15 @@ #define LC_abbreviated 0x00001 #define LC_checked 0x00002 -#define LC_default 0x00004 -#define LC_defined 0x00008 -#define LC_debug 0x00010 +#define LC_debug 0x00004 +#define LC_default 0x00008 +#define LC_defined 0x00010 #define LC_local 0x00020 #define LC_primary 0x00040 #define LC_qualified 0x00080 #define LC_undefined 0x00100 -#define LC_verbose 0x00200 +#define LC_utf8 0x00200 +#define LC_verbose 0x00400 #define LC_user 0x10000 #define LC_language_attribute_max 2 #define LC_territory_language_max 4 diff --git a/usr/src/lib/libast/i386/include/ast/ls.h b/usr/src/lib/libast/i386/include/ast/ls.h index b195c70e0c..70a8dc88ba 100644 --- a/usr/src/lib/libast/i386/include/ast/ls.h +++ b/usr/src/lib/libast/i386/include/ast/ls.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -76,8 +76,8 @@ #define LS_USER (1<<10) /* first user flag bit */ #define LS_W_BLOCKS 6 /* LS_BLOCKS field width */ -#define LS_W_INUMBER 7 /* LS_INUMBER field width */ -#define LS_W_LONG 55 /* LS_LONG width (w/o names) */ +#define LS_W_INUMBER 9 /* LS_INUMBER field width */ +#define LS_W_LONG 57 /* LS_LONG width (w/o names) */ #define LS_W_LINK 4 /* link text width (w/o names) */ #define LS_W_MARK 1 /* LS_MARK field width */ #define LS_W_NAME 9 /* group|user name field width */ diff --git a/usr/src/lib/libast/i386/include/ast/magic.h b/usr/src/lib/libast/i386/include/ast/magic.h index cf3c0fdcb8..53d632c721 100644 --- a/usr/src/lib/libast/i386/include/ast/magic.h +++ b/usr/src/lib/libast/i386/include/ast/magic.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/magicid.h b/usr/src/lib/libast/i386/include/ast/magicid.h index 66507d4d0b..e31c80f288 100644 --- a/usr/src/lib/libast/i386/include/ast/magicid.h +++ b/usr/src/lib/libast/i386/include/ast/magicid.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/mc.h b/usr/src/lib/libast/i386/include/ast/mc.h index be15276038..75b4308360 100644 --- a/usr/src/lib/libast/i386/include/ast/mc.h +++ b/usr/src/lib/libast/i386/include/ast/mc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/mime.h b/usr/src/lib/libast/i386/include/ast/mime.h index c214a31130..6d662d29e5 100644 --- a/usr/src/lib/libast/i386/include/ast/mime.h +++ b/usr/src/lib/libast/i386/include/ast/mime.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/mnt.h b/usr/src/lib/libast/i386/include/ast/mnt.h index ddce19fc9d..62815d19e7 100644 --- a/usr/src/lib/libast/i386/include/ast/mnt.h +++ b/usr/src/lib/libast/i386/include/ast/mnt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/modecanon.h b/usr/src/lib/libast/i386/include/ast/modecanon.h index f207540d5b..3357d3ec75 100644 --- a/usr/src/lib/libast/i386/include/ast/modecanon.h +++ b/usr/src/lib/libast/i386/include/ast/modecanon.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/modex.h b/usr/src/lib/libast/i386/include/ast/modex.h index 96971e347b..1f00578a00 100644 --- a/usr/src/lib/libast/i386/include/ast/modex.h +++ b/usr/src/lib/libast/i386/include/ast/modex.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/namval.h b/usr/src/lib/libast/i386/include/ast/namval.h index 4c9b12f480..f54b08ff15 100644 --- a/usr/src/lib/libast/i386/include/ast/namval.h +++ b/usr/src/lib/libast/i386/include/ast/namval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/nl_types.h b/usr/src/lib/libast/i386/include/ast/nl_types.h index 36c901d8ed..e71605ff40 100644 --- a/usr/src/lib/libast/i386/include/ast/nl_types.h +++ b/usr/src/lib/libast/i386/include/ast/nl_types.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/option.h b/usr/src/lib/libast/i386/include/ast/option.h index 0cb1ca74c5..39207fcc4c 100644 --- a/usr/src/lib/libast/i386/include/ast/option.h +++ b/usr/src/lib/libast/i386/include/ast/option.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/preroot.h b/usr/src/lib/libast/i386/include/ast/preroot.h index f1ab677142..4e31cf12bf 100644 --- a/usr/src/lib/libast/i386/include/ast/preroot.h +++ b/usr/src/lib/libast/i386/include/ast/preroot.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/include/ast/proc.h b/usr/src/lib/libast/i386/include/ast/proc.h index 2bfa576970..219f0d5884 100644 --- a/usr/src/lib/libast/i386/include/ast/proc.h +++ b/usr/src/lib/libast/i386/include/ast/proc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/re_comp.h b/usr/src/lib/libast/i386/include/ast/re_comp.h index 381bc801fc..e8d425d1c0 100644 --- a/usr/src/lib/libast/i386/include/ast/re_comp.h +++ b/usr/src/lib/libast/i386/include/ast/re_comp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/recfmt.h b/usr/src/lib/libast/i386/include/ast/recfmt.h index 133e37da41..acdb18df36 100644 --- a/usr/src/lib/libast/i386/include/ast/recfmt.h +++ b/usr/src/lib/libast/i386/include/ast/recfmt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/regex.h b/usr/src/lib/libast/i386/include/ast/regex.h index b1a8976991..1fcd12d298 100644 --- a/usr/src/lib/libast/i386/include/ast/regex.h +++ b/usr/src/lib/libast/i386/include/ast/regex.h @@ -53,6 +53,8 @@ #define REG_SHELL_ESCAPED 0x00400000 /* \ not special */ #define REG_SHELL_PATH 0x00800000 /* explicit / match */ +#define REG_REGEXP 0x40000000 /* <regexp.h> compatibility */ + /* regexec flags */ #define REG_NOTBOL 0x00000040 /* ^ is not a special char */ diff --git a/usr/src/lib/libast/i386/include/ast/regexp.h b/usr/src/lib/libast/i386/include/ast/regexp.h index e1c6258b3e..89e0d3a875 100644 --- a/usr/src/lib/libast/i386/include/ast/regexp.h +++ b/usr/src/lib/libast/i386/include/ast/regexp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/sfdisc.h b/usr/src/lib/libast/i386/include/ast/sfdisc.h index 5303d9a62e..ce1ed6e052 100644 --- a/usr/src/lib/libast/i386/include/ast/sfdisc.h +++ b/usr/src/lib/libast/i386/include/ast/sfdisc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/sfio.h b/usr/src/lib/libast/i386/include/ast/sfio.h index 11317dad65..3506f5c955 100644 --- a/usr/src/lib/libast/i386/include/ast/sfio.h +++ b/usr/src/lib/libast/i386/include/ast/sfio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -48,6 +48,7 @@ typedef ssize_t (*Sfread_f)_ARG_((Sfio_t*, Void_t*, size_t, Sfdisc_t*)); typedef ssize_t (*Sfwrite_f)_ARG_((Sfio_t*, const Void_t*, size_t, Sfdisc_t*)); typedef Sfoff_t (*Sfseek_f)_ARG_((Sfio_t*, Sfoff_t, int, Sfdisc_t*)); typedef int (*Sfexcept_f)_ARG_((Sfio_t*, int, Void_t*, Sfdisc_t*)); +typedef int (*Sfwalk_f)_ARG_((Sfio_t*, Void_t*)); /* discipline structure */ struct _sfdisc_s @@ -232,6 +233,7 @@ extern Sfio_t* sfpopen _ARG_((Sfio_t*, const char*, const char*)); extern Sfio_t* sfstack _ARG_((Sfio_t*, Sfio_t*)); extern Sfio_t* sfswap _ARG_((Sfio_t*, Sfio_t*)); extern Sfio_t* sftmp _ARG_((size_t)); +extern int sfwalk _ARG_((Sfwalk_f, Void_t*, int)); extern int sfpurge _ARG_((Sfio_t*)); extern int sfpoll _ARG_((Sfio_t**, int, int)); extern Void_t* sfreserve _ARG_((Sfio_t*, ssize_t, int)); diff --git a/usr/src/lib/libast/i386/include/ast/sfio_s.h b/usr/src/lib/libast/i386/include/ast/sfio_s.h index 19a23d4772..46b2348b9c 100644 --- a/usr/src/lib/libast/i386/include/ast/sfio_s.h +++ b/usr/src/lib/libast/i386/include/ast/sfio_s.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/sfio_t.h b/usr/src/lib/libast/i386/include/ast/sfio_t.h index c5251d3f34..5c819865c8 100644 --- a/usr/src/lib/libast/i386/include/ast/sfio_t.h +++ b/usr/src/lib/libast/i386/include/ast/sfio_t.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/shcmd.h b/usr/src/lib/libast/i386/include/ast/shcmd.h index 14e282a3d0..f59834ad80 100644 --- a/usr/src/lib/libast/i386/include/ast/shcmd.h +++ b/usr/src/lib/libast/i386/include/ast/shcmd.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -75,18 +75,19 @@ typedef struct Shbltin_s # 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) +# define sh_context(c) ((Shbltin_t*)(c)) +# define sh_run(c, ac, av) ((c)?(*sh_context(c)->shrun)(ac,av):-1) +# define sh_system(c,str) ((c)?(*sh_context(c)->shtrap)(str,0):system(str)) +# define sh_exit(c,n) ((c)?(*sh_context(c)->shexit)(n):exit(n)) +# define sh_checksig(c) ((c) && sh_context(c)->sigset) # if defined(SFIO_VERSION) || defined(_AST_H) # define LIB_INIT(c) # else -# define LIB_INIT(c) ((c) && (((Shbltin_t*)(c))->nosfio = 1)) +# define LIB_INIT(c) ((c) && (sh_context(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) + (sh_context(c)->notify = ((flg)&ERROR_NOTIFY)?1:0);} while(0) # endif #endif diff --git a/usr/src/lib/libast/i386/include/ast/sig.h b/usr/src/lib/libast/i386/include/ast/sig.h index d755292cdd..e5da3b46c4 100644 --- a/usr/src/lib/libast/i386/include/ast/sig.h +++ b/usr/src/lib/libast/i386/include/ast/sig.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/i386/include/ast/stack.h b/usr/src/lib/libast/i386/include/ast/stack.h index 5c55255f06..64bda47ad0 100644 --- a/usr/src/lib/libast/i386/include/ast/stack.h +++ b/usr/src/lib/libast/i386/include/ast/stack.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/stak.h b/usr/src/lib/libast/i386/include/ast/stak.h index 321be20328..3e867b0b7d 100644 --- a/usr/src/lib/libast/i386/include/ast/stak.h +++ b/usr/src/lib/libast/i386/include/ast/stak.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/stdio.h b/usr/src/lib/libast/i386/include/ast/stdio.h index 42d7ed8269..2053ba8b27 100644 --- a/usr/src/lib/libast/i386/include/ast/stdio.h +++ b/usr/src/lib/libast/i386/include/ast/stdio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/stk.h b/usr/src/lib/libast/i386/include/ast/stk.h index ef9a946ce0..ae2684f36d 100644 --- a/usr/src/lib/libast/i386/include/ast/stk.h +++ b/usr/src/lib/libast/i386/include/ast/stk.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/swap.h b/usr/src/lib/libast/i386/include/ast/swap.h index 81e49db105..96c2f79d74 100644 --- a/usr/src/lib/libast/i386/include/ast/swap.h +++ b/usr/src/lib/libast/i386/include/ast/swap.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/tar.h b/usr/src/lib/libast/i386/include/ast/tar.h index 3a9a99b0ac..04f5586481 100644 --- a/usr/src/lib/libast/i386/include/ast/tar.h +++ b/usr/src/lib/libast/i386/include/ast/tar.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/times.h b/usr/src/lib/libast/i386/include/ast/times.h index 1ed0f2135a..db0725a35c 100644 --- a/usr/src/lib/libast/i386/include/ast/times.h +++ b/usr/src/lib/libast/i386/include/ast/times.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/tm.h b/usr/src/lib/libast/i386/include/ast/tm.h index 29c0d4f1fa..154615088f 100644 --- a/usr/src/lib/libast/i386/include/ast/tm.h +++ b/usr/src/lib/libast/i386/include/ast/tm.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -102,8 +102,9 @@ #define TM_ERA_YEAR 115 #define TM_ORDINALS 116 #define TM_FINAL 126 +#define TM_WORK 129 -#define TM_NFORM 129 +#define TM_NFORM 132 typedef struct /* leap second info */ { @@ -123,7 +124,7 @@ typedef struct /* time zone info */ typedef struct /* tm library readonly data */ { char** format; /* default TM_* format strings */ - char* lex; /* format lex type classes */ + unsigned char* lex; /* format lex type classes */ char* digit; /* output digits */ short* days; /* days in month i */ short* sum; /* days in months before i */ diff --git a/usr/src/lib/libast/i386/include/ast/tmx.h b/usr/src/lib/libast/i386/include/ast/tmx.h index 6b3ca63285..9628931c54 100644 --- a/usr/src/lib/libast/i386/include/ast/tmx.h +++ b/usr/src/lib/libast/i386/include/ast/tmx.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -129,12 +129,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/i386/include/ast/tok.h b/usr/src/lib/libast/i386/include/ast/tok.h index 1d5112837c..8850458e9a 100644 --- a/usr/src/lib/libast/i386/include/ast/tok.h +++ b/usr/src/lib/libast/i386/include/ast/tok.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/tv.h b/usr/src/lib/libast/i386/include/ast/tv.h index eb57020181..13839caf62 100644 --- a/usr/src/lib/libast/i386/include/ast/tv.h +++ b/usr/src/lib/libast/i386/include/ast/tv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/include/ast/usage.h b/usr/src/lib/libast/i386/include/ast/usage.h index d969a0e4c1..e2bea60f9c 100644 --- a/usr/src/lib/libast/i386/include/ast/usage.h +++ b/usr/src/lib/libast/i386/include/ast/usage.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/vdb.h b/usr/src/lib/libast/i386/include/ast/vdb.h index ba47e14901..f800446d5f 100644 --- a/usr/src/lib/libast/i386/include/ast/vdb.h +++ b/usr/src/lib/libast/i386/include/ast/vdb.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/vecargs.h b/usr/src/lib/libast/i386/include/ast/vecargs.h index 121e9d5010..8b567d5d5d 100644 --- a/usr/src/lib/libast/i386/include/ast/vecargs.h +++ b/usr/src/lib/libast/i386/include/ast/vecargs.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/vmalloc.h b/usr/src/lib/libast/i386/include/ast/vmalloc.h index 8cf3e9b974..0115078cf5 100644 --- a/usr/src/lib/libast/i386/include/ast/vmalloc.h +++ b/usr/src/lib/libast/i386/include/ast/vmalloc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/wait.h b/usr/src/lib/libast/i386/include/ast/wait.h index 08160043fa..bb690a2ee4 100644 --- a/usr/src/lib/libast/i386/include/ast/wait.h +++ b/usr/src/lib/libast/i386/include/ast/wait.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/wchar.h b/usr/src/lib/libast/i386/include/ast/wchar.h index 7796480d09..5bd6aa3ba8 100644 --- a/usr/src/lib/libast/i386/include/ast/wchar.h +++ b/usr/src/lib/libast/i386/include/ast/wchar.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/include/ast/wordexp.h b/usr/src/lib/libast/i386/include/ast/wordexp.h index c3f97b37d9..0ae7e93e99 100644 --- a/usr/src/lib/libast/i386/include/ast/wordexp.h +++ b/usr/src/lib/libast/i386/include/ast/wordexp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/align b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/align index 08a43ae9da..3750e7e44b 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/align +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/align @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/botch b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/botch index 9aa7e03bc9..ed69c2e4b0 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/botch +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/botch @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/ccode b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/ccode index d7684a82db..3d39dd3273 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/ccode +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/ccode @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/common b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/common index ea3d39f8c1..874c5bcc98 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/common +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/common @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -155,9 +155,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (p) /* pass va_list to varargs function */ -#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -165,6 +162,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (p) /* pass va_list to varargs function */ +#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/dirent b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/dirent index 81ba45ad54..2edcceeed2 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/dirent +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/dirent @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/eaccess b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/eaccess index e1e91b7484..3559cc8008 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/eaccess +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/eaccess @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/eaccess by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/eaccess by iffe version 2009-10-06 : : */ #ifndef _def_eaccess_ast #define _def_eaccess_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/errno b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/errno index a9c0fc3cbe..69d3fbeace 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/errno +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/errno @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/errno by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/errno by iffe version 2009-10-06 : : */ #ifndef _def_errno_ast #define _def_errno_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/fcntl b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/fcntl index 22b6e0a868..8baac5a21e 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/fcntl +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/fcntl @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/float b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/float index a4914d2f39..4bf68ca64c 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/float +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/float @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/fs b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/fs index b18bef1b29..924bf7dae5 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/fs +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/fs @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -79,7 +79,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/hack b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/hack index de39f993ac..07686b31dc 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/hack +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/hack @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/hack by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/hack by iffe version 2009-10-06 : : */ #ifndef _def_hack_ast #define _def_hack_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/iconv b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/iconv index 449c82bd36..a1540a7138 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/iconv +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/iconv @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/isoc99 b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/isoc99 index 0f1650ba0e..8524187db3 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/isoc99 +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/isoc99 @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/isoc99 by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/isoc99 by iffe version 2009-10-06 : : */ #ifndef _def_isoc99_ast #define _def_isoc99_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/lib b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/lib index 8304bd96b9..517b907aca 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/lib +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/lib @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -131,7 +131,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/libpath b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/libpath index 33e0f3c97c..790df03b16 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/libpath +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/libpath @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/libpath.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/libpath.sh by iffe version 2009-10-06 : : */ #ifndef _def_libpath_ast #define _def_libpath_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/limits b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/limits index e2608b975e..2453905aca 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/limits +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/limits @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/map b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/map index fe3d5fddbc..b9088a2c91 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/map +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/map @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -198,6 +198,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/mmap b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/mmap index 448ab22df8..f4d39abcf5 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/mmap +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/mmap @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -7,6 +7,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/mode b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/mode index b663948b0f..31ba6eef6d 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/mode +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/mode @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/ndbm b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/ndbm index d21a376500..a145e764da 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/ndbm +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/ndbm @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/nl_types b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/nl_types index 2f713d9855..d439a1c608 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/nl_types +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/nl_types @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/omitted b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/omitted index e321578c70..26d4e7ab65 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/omitted +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/omitted @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/omitted by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/omitted by iffe version 2009-10-06 : : */ #ifndef _def_omitted_ast #define _def_omitted_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/param b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/param index f10c928b22..2427aa29bf 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/param +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/param @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/preroot b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/preroot index 7215b1a074..61ff583a6f 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/preroot +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/preroot @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/prog b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/prog new file mode 100644 index 0000000000..a8d762af33 --- /dev/null +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/prog @@ -0,0 +1,7 @@ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/prog by iffe version 2009-10-06 : : */ +#ifndef _def_prog_ast +#define _def_prog_ast 1 +#define _sys_types 1 /* #include <sys/types.h> ok */ +#define _lib_getexecname 1 /* getexecname() in default lib(s) */ +#define _PROC_PROG "/proc/self/path/a.out" +#endif diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sfinit b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sfinit index 92e3bff69e..2b3903fc0d 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sfinit +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sfinit @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/sfinit.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/sfinit.c by iffe version 2009-10-06 : : */ #ifndef _def_sfinit_ast #define _def_sfinit_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sfio b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sfio index a16a3d1a64..b75267e31b 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sfio +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sfio @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/sfio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/sfio by iffe version 2009-10-06 : : */ #ifndef _def_sfio_ast #define _def_sfio_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sig b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sig index f187f7276d..b926f3799c 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sig +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sig @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/siglist b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/siglist index 82e6361823..6fcb000cb2 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/siglist +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/siglist @@ -1,10 +1,13 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/siglist by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/siglist by iffe version 2009-10-06 : : */ #ifndef _def_siglist_ast #define _def_siglist_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ #define _hdr_string 1 /* #include <string.h> ok */ #define _hdr_signal 1 /* #include <signal.h> ok */ #define _lib_strsignal 1 /* strsignal() in default lib(s) */ +#if defined(SIGHUP) && !defined(HAD_SIGHUP) +0,"HUP",SIGHUP, +#endif #if defined(SIGINT) && !defined(HAD_SIGINT) 0,"INT",SIGINT, #endif diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/signal b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/signal index f37e3f068d..f3ba78b6ca 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/signal +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/signal @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/signal.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/signal.c by iffe version 2009-10-06 : : */ #ifndef _def_signal_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/standards b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/standards index 03c21fffe3..5f95685de4 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/standards +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/standards @@ -1,26 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/stdio b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/stdio index 4657a0929d..3e7776ae7a 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/stdio +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/stdio @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sys b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sys index 55d8137d6f..0307c7da37 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sys +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/sys @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -104,7 +104,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/time b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/time index 83fd6b7121..bac9e4aeb4 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/time +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/time @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tmlib b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tmlib index fac870b534..fa1f078f2f 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tmlib +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tmlib @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/tmlib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/tmlib by iffe version 2009-10-06 : : */ #ifndef _def_tmlib_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tmx b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tmx index a576776476..076e1c3594 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tmx +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tmx @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -108,12 +108,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tty b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tty index 04cec09685..8ade1d6d9e 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tty +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tty @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tv b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tv index 5e7b8ce3f4..b7e1c55981 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tv +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tv @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tvlib b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tvlib index 88616f5462..e379433f61 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tvlib +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/tvlib @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/tvlib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/tvlib by iffe version 2009-10-06 : : */ #ifndef _def_tvlib_ast #define _def_tvlib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/uwin b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/uwin index acc87f68cd..a399a15c93 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/uwin +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/uwin @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/uwin by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/uwin by iffe version 2009-10-06 : : */ #ifndef _def_uwin_ast #define _def_uwin_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/vfork b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/vfork index 5ebb662a08..f1848017d7 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/vfork +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/vfork @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/vmalloc b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/vmalloc index cbfeafdd9c..a142225766 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/vmalloc +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/vmalloc @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/vmalloc by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/vmalloc by iffe version 2009-10-06 : : */ #ifndef _def_vmalloc_ast #define _def_vmalloc_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/wait b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/wait index a113121028..c3c160bf45 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/wait +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/wait @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/wchar b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/wchar index 11d8827727..ab4944ad8a 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/FEATURE/wchar +++ b/usr/src/lib/libast/i386/src/lib/libast/FEATURE/wchar @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/align.h b/usr/src/lib/libast/i386/src/lib/libast/align.h index 08a43ae9da..3750e7e44b 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/align.h +++ b/usr/src/lib/libast/i386/src/lib/libast/align.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_botch.h b/usr/src/lib/libast/i386/src/lib/libast/ast_botch.h index 9aa7e03bc9..ed69c2e4b0 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_botch.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_botch.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_ccode.h b/usr/src/lib/libast/i386/src/lib/libast/ast_ccode.h index d7684a82db..3d39dd3273 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_ccode.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_ccode.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_common.h b/usr/src/lib/libast/i386/src/lib/libast/ast_common.h index 91c4301b16..4e2dd10b82 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_common.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_common.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -155,9 +155,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (p) /* pass va_list to varargs function */ -#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -165,6 +162,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (p) /* pass va_list to varargs function */ +#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_dirent.h b/usr/src/lib/libast/i386/src/lib/libast/ast_dirent.h index 81ba45ad54..2edcceeed2 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_dirent.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_dirent.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_fcntl.h b/usr/src/lib/libast/i386/src/lib/libast/ast_fcntl.h index 22b6e0a868..8baac5a21e 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_fcntl.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_fcntl.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_float.h b/usr/src/lib/libast/i386/src/lib/libast/ast_float.h index a4914d2f39..4bf68ca64c 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_float.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_float.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_fs.h b/usr/src/lib/libast/i386/src/lib/libast/ast_fs.h index b18bef1b29..924bf7dae5 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_fs.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_fs.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -79,7 +79,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_iconv.h b/usr/src/lib/libast/i386/src/lib/libast/ast_iconv.h index 449c82bd36..a1540a7138 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_iconv.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_iconv.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_lib.h b/usr/src/lib/libast/i386/src/lib/libast/ast_lib.h index 8304bd96b9..517b907aca 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_lib.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_lib.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -131,7 +131,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_limits.h b/usr/src/lib/libast/i386/src/lib/libast/ast_limits.h index e2608b975e..2453905aca 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_limits.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_limits.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_map.h b/usr/src/lib/libast/i386/src/lib/libast/ast_map.h index fe3d5fddbc..b9088a2c91 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_map.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_map.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -198,6 +198,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_mmap.h b/usr/src/lib/libast/i386/src/lib/libast/ast_mmap.h index 448ab22df8..f4d39abcf5 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_mmap.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_mmap.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -7,6 +7,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_mode.h b/usr/src/lib/libast/i386/src/lib/libast/ast_mode.h index b663948b0f..31ba6eef6d 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_mode.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_mode.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_namval.h b/usr/src/lib/libast/i386/src/lib/libast/ast_namval.h new file mode 100644 index 0000000000..f8f65ab2cb --- /dev/null +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_namval.h @@ -0,0 +1,42 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped +/* + * Glenn Fowler + * AT&T Research + * + * common name-value struct support + */ + +#ifndef _NAMVAL_H +#define _NAMVAL_H + +typedef struct +{ + char* name; + int value; +#ifdef _NAMVAL_PRIVATE_ + _NAMVAL_PRIVATE_ +#endif +} Namval_t; + +#endif diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_ndbm.h b/usr/src/lib/libast/i386/src/lib/libast/ast_ndbm.h index d21a376500..a145e764da 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_ndbm.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_ndbm.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_nl_types.h b/usr/src/lib/libast/i386/src/lib/libast/ast_nl_types.h index 2f713d9855..d439a1c608 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_nl_types.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_nl_types.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_param.h b/usr/src/lib/libast/i386/src/lib/libast/ast_param.h index f10c928b22..2427aa29bf 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_param.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_param.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_standards.h b/usr/src/lib/libast/i386/src/lib/libast/ast_standards.h index 03c21fffe3..5f95685de4 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_standards.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_standards.h @@ -1,26 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_stdio.h b/usr/src/lib/libast/i386/src/lib/libast/ast_stdio.h index 4657a0929d..3e7776ae7a 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_stdio.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_stdio.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_sys.h b/usr/src/lib/libast/i386/src/lib/libast/ast_sys.h index 55d8137d6f..0307c7da37 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_sys.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_sys.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -104,7 +104,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_time.h b/usr/src/lib/libast/i386/src/lib/libast/ast_time.h index 83fd6b7121..bac9e4aeb4 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_time.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_time.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_tty.h b/usr/src/lib/libast/i386/src/lib/libast/ast_tty.h index 04cec09685..8ade1d6d9e 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_tty.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_tty.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_vfork.h b/usr/src/lib/libast/i386/src/lib/libast/ast_vfork.h index 5ebb662a08..f1848017d7 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_vfork.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_vfork.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_wait.h b/usr/src/lib/libast/i386/src/lib/libast/ast_wait.h index a113121028..c3c160bf45 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_wait.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_wait.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/ast_wchar.h b/usr/src/lib/libast/i386/src/lib/libast/ast_wchar.h index 11d8827727..ab4944ad8a 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/ast_wchar.h +++ b/usr/src/lib/libast/i386/src/lib/libast/ast_wchar.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/i386/src/lib/libast/conftab.c b/usr/src/lib/libast/i386/src/lib/libast/conftab.c index 10dab929ea..38e9c18c64 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/conftab.c +++ b/usr/src/lib/libast/i386/src/lib/libast/conftab.c @@ -10,7 +10,7 @@ #include "FEATURE/param" #include "conftab.h" -/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/comp/conf.tab : : */ +/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/comp/conf.tab : : */ /* * prefix strings -- the first few are indexed by Conf_t.standard @@ -207,6 +207,7 @@ const Conf_t conf[] = { "NL_TEXTMAX", { 0ULL, 0 }, { 0ULL, 0 }, CONF_LIMIT, CONF_XOPEN, 1, CONF_nop, -1 }, { "NO_TRUNC", { 0ULL, 0 }, { 0ULL, 0 }, CONF_FEATURE|CONF_UNDERSCORE|CONF_PREFIX_ONLY, CONF_POSIX, 1, CONF_pathconf, _PC_NO_TRUNC }, { "NPROCESSORS_CONF", { 0ULL, 0 }, { 0ULL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_CONF }, +{ "NPROCESSORS_MAX", { 0ULL, 0 }, { 0ULL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_MAX }, { "NPROCESSORS_ONLN", { 0ULL, 0 }, { 0ULL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_ONLN }, { "NPROC_CONF", { 0ULL, 0 }, { 0ULL, 0 }, CONF_FEATURE|CONF_UNDERSCORE, CONF_POSIX, 1, CONF_nop, -1 }, { "NPROC_ONLN", { 0ULL, 0 }, { 0ULL, 0 }, CONF_FEATURE|CONF_UNDERSCORE, CONF_POSIX, 1, CONF_nop, -1 }, diff --git a/usr/src/lib/libast/i386/src/lib/libast/conftab.h b/usr/src/lib/libast/i386/src/lib/libast/conftab.h index 165462f87f..b5e17192c3 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/conftab.h +++ b/usr/src/lib/libast/i386/src/lib/libast/conftab.h @@ -6,7 +6,7 @@ #endif #include <sys/systeminfo.h> -/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/comp/conf.tab : : */ +/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/comp/conf.tab : : */ #if !defined(const) && !defined(__STDC__) && !defined(__cplusplus) && !defined(c_plusplus) #define const diff --git a/usr/src/lib/libast/i386/src/lib/libast/lc.h b/usr/src/lib/libast/i386/src/lib/libast/lc.h index b225864bbc..da06a59ba4 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/lc.h +++ b/usr/src/lib/libast/i386/src/lib/libast/lc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -38,14 +38,15 @@ #define LC_abbreviated 0x00001 #define LC_checked 0x00002 -#define LC_default 0x00004 -#define LC_defined 0x00008 -#define LC_debug 0x00010 +#define LC_debug 0x00004 +#define LC_default 0x00008 +#define LC_defined 0x00010 #define LC_local 0x00020 #define LC_primary 0x00040 #define LC_qualified 0x00080 #define LC_undefined 0x00100 -#define LC_verbose 0x00200 +#define LC_utf8 0x00200 +#define LC_verbose 0x00400 #define LC_user 0x10000 #define LC_language_attribute_max 2 #define LC_territory_language_max 4 diff --git a/usr/src/lib/libast/i386/src/lib/libast/preroot.h b/usr/src/lib/libast/i386/src/lib/libast/preroot.h index 7215b1a074..61ff583a6f 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/preroot.h +++ b/usr/src/lib/libast/i386/src/lib/libast/preroot.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/i386/src/lib/libast/sig.h b/usr/src/lib/libast/i386/src/lib/libast/sig.h index f187f7276d..b926f3799c 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/sig.h +++ b/usr/src/lib/libast/i386/src/lib/libast/sig.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/i386/src/lib/libast/tmx.h b/usr/src/lib/libast/i386/src/lib/libast/tmx.h index a576776476..076e1c3594 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/tmx.h +++ b/usr/src/lib/libast/i386/src/lib/libast/tmx.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -108,12 +108,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/i386/src/lib/libast/tv.h b/usr/src/lib/libast/i386/src/lib/libast/tv.h index 5e7b8ce3f4..b7e1c55981 100644 --- a/usr/src/lib/libast/i386/src/lib/libast/tv.h +++ b/usr/src/lib/libast/i386/src/lib/libast/tv.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/mapfile-vers b/usr/src/lib/libast/mapfile-vers index 9430c6e527..e1c3b35bb2 100644 --- a/usr/src/lib/libast/mapfile-vers +++ b/usr/src/lib/libast/mapfile-vers @@ -194,6 +194,7 @@ SUNWprivate_1.1 { _ast_pathpath; _ast_pathposix; _ast_pathprobe; + _ast_pathprog; _ast_pathrepl; _ast_pathsetlink; _ast_pathshell; @@ -462,6 +463,7 @@ SUNWprivate_1.1 { fmtuid; fmtversion; fs3d; + fs3d_mount; hashalloc; hashdone; hashdump; diff --git a/usr/src/lib/libast/sparc/include/ast/align.h b/usr/src/lib/libast/sparc/include/ast/align.h index 55df32793a..6907841d79 100644 --- a/usr/src/lib/libast/sparc/include/ast/align.h +++ b/usr/src/lib/libast/sparc/include/ast/align.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast.h b/usr/src/lib/libast/sparc/include/ast/ast.h index f5335ae8a2..f1dff0cf6a 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast.h +++ b/usr/src/lib/libast/sparc/include/ast/ast.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -185,7 +185,7 @@ typedef struct #define mbcoll() (ast.mb_xfrm!=0) #define mbwide() (mbmax()>1) -#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p++,ast.tmp_int)):(*(unsigned char*)(p++))) +#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p+=ast.mb_sync+1,ast.tmp_int)):(*(unsigned char*)(p++))) #define mbinit() (mbwide()?(*ast.mb_towc)((wchar_t*)0,(char*)0,mbmax()):0) #define mbsize(p) (mbwide()?(*ast.mb_len)((char*)(p),mbmax()):((p),1)) #define mbconv(s,w) (ast.mb_conv?(*ast.mb_conv)(s,w):((*(s)=(w)),1)) @@ -309,6 +309,7 @@ extern __MANGLE__ size_t pathnative __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathpath __PROTO__((char*, const char*, const char*, int)); extern __MANGLE__ size_t pathposix __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathprobe __PROTO__((char*, char*, const char*, const char*, const char*, int)); +extern __MANGLE__ size_t pathprog __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathrepl __PROTO__((char*, const char*, const char*)); extern __MANGLE__ int pathsetlink __PROTO__((const char*, const char*)); extern __MANGLE__ char* pathshell __PROTO__((void)); @@ -329,6 +330,7 @@ extern __MANGLE__ int strmatch __PROTO__((const char*, const char*)); extern __MANGLE__ int strmode __PROTO__((const char*)); extern __MANGLE__ int strnacmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ char* strncopy __PROTO__((char*, const char*, size_t)); +extern __MANGLE__ int strnpcmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ double strntod __PROTO__((const char*, size_t, char**)); extern __MANGLE__ _ast_fltmax_t strntold __PROTO__((const char*, size_t, char**)); extern __MANGLE__ long strntol __PROTO__((const char*, size_t, char**, int)); @@ -337,7 +339,9 @@ extern __MANGLE__ long strnton __PROTO__((const char*, size_t, char**, char*, i extern __MANGLE__ unsigned long strntoul __PROTO__((const char*, size_t, char**, int)); extern __MANGLE__ intmax_t strntonll __PROTO__((const char*, size_t, char**, char*, int)); extern __MANGLE__ uintmax_t strntoull __PROTO__((const char*, size_t, char**, int)); +extern __MANGLE__ int strnvcmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ int stropt __PROTO__((const char*, const __V_*, int, int(*)(__V_*, const __V_*, int, const char*), __V_*)); +extern __MANGLE__ int strpcmp __PROTO__((const char*, const char*)); extern __MANGLE__ int strperm __PROTO__((const char*, char**, int)); extern __MANGLE__ __V_* strpsearch __PROTO__((const __V_*, size_t, size_t, const char*, char**)); extern __MANGLE__ __V_* strsearch __PROTO__((const __V_*, size_t, size_t, Strcmp_f, const char*, __V_*)); @@ -350,6 +354,7 @@ extern __MANGLE__ long strton __PROTO__((const char*, char**, char*, int)); extern __MANGLE__ intmax_t strtonll __PROTO__((const char*, char**, char*, int)); extern __MANGLE__ int struid __PROTO__((const char*)); extern __MANGLE__ int struniq __PROTO__((char**, int)); +extern __MANGLE__ int strvcmp __PROTO__((const char*, const char*)); #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_botch.h b/usr/src/lib/libast/sparc/include/ast/ast_botch.h index b7532f9e98..b9332f4905 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_botch.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_botch.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_ccode.h b/usr/src/lib/libast/sparc/include/ast/ast_ccode.h index fefe5cc7b0..a62f64644b 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_ccode.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_ccode.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_common.h b/usr/src/lib/libast/sparc/include/ast/ast_common.h index 2da0ae6e58..b73507418a 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_common.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_common.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -176,9 +176,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (p) /* pass va_list to varargs function */ -#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -186,6 +183,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (p) /* pass va_list to varargs function */ +#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/sparc/include/ast/ast_dir.h b/usr/src/lib/libast/sparc/include/ast/ast_dir.h index a402906410..8d801aa72c 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_dir.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_dir.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/ast_dirent.h b/usr/src/lib/libast/sparc/include/ast/ast_dirent.h index 805c02da9a..8953febca5 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_dirent.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_dirent.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/include/ast/ast_fcntl.h b/usr/src/lib/libast/sparc/include/ast/ast_fcntl.h index 05e75c6ba8..79cc353af2 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_fcntl.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_fcntl.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparc/include/ast/ast_float.h b/usr/src/lib/libast/sparc/include/ast/ast_float.h index 9e377ab4c1..91ba8915aa 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_float.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_float.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/include/ast/ast_fs.h b/usr/src/lib/libast/sparc/include/ast/ast_fs.h index 6038294501..35237f0bb9 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_fs.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_fs.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -96,7 +96,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_iconv.h b/usr/src/lib/libast/sparc/include/ast/ast_iconv.h index a9ff7e8408..df659ec3c9 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_iconv.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_iconv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/include/ast/ast_lib.h b/usr/src/lib/libast/sparc/include/ast/ast_lib.h index 9a9e784ad9..1af9045750 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_lib.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_lib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -152,7 +152,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_limits.h b/usr/src/lib/libast/sparc/include/ast/ast_limits.h index 937534cc0d..b311d668de 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_limits.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_limits.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_map.h b/usr/src/lib/libast/sparc/include/ast/ast_map.h index 225d5afb03..ca6f1c1622 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_map.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_map.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -219,6 +219,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/sparc/include/ast/ast_mmap.h b/usr/src/lib/libast/sparc/include/ast/ast_mmap.h index 34b939995a..835a61f69c 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_mmap.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_mmap.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -28,7 +28,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ -#define _mmap_worthy 1 /* mmap is good */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/sparc/include/ast/ast_mode.h b/usr/src/lib/libast/sparc/include/ast/ast_mode.h index fe2d6c8bea..1e5fbbc62f 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_mode.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_mode.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_namval.h b/usr/src/lib/libast/sparc/include/ast/ast_namval.h index 4c9b12f480..f54b08ff15 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_namval.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_namval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/ast_ndbm.h b/usr/src/lib/libast/sparc/include/ast/ast_ndbm.h index 48ca492dd4..82a68ae1a5 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_ndbm.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_ndbm.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_nl_types.h b/usr/src/lib/libast/sparc/include/ast/ast_nl_types.h index a7d7d12172..406e82b8b0 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_nl_types.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_nl_types.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/include/ast/ast_param.h b/usr/src/lib/libast/sparc/include/ast/ast_param.h index da001d829f..4caf9ce185 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_param.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_param.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_standards.h b/usr/src/lib/libast/sparc/include/ast/ast_standards.h index 5a697fc0da..ce15af2cf6 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_standards.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_standards.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,29 +19,11 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/sparc/include/ast/ast_std.h b/usr/src/lib/libast/sparc/include/ast/ast_std.h index 4f3f3dd9da..e734c74dbd 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_std.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_std.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -117,22 +117,27 @@ struct lconv #define __MANGLE__ __LINKAGE__ __EXPORT__ #endif +#if !_UWIN /* for ast54 compatibility */ + #undef getenv #define getenv _ast_getenv +#undef setenviron +#define setenviron _ast_setenviron + +extern __MANGLE__ char* getenv __PROTO__((const char*)); + +#endif + #undef localeconv #define localeconv _ast_localeconv #undef setlocale #define setlocale _ast_setlocale -#undef setenviron -#define setenviron _ast_setenviron - #undef strerror #define strerror _ast_strerror -extern __MANGLE__ char* getenv __PROTO__((const char*)); extern __MANGLE__ struct lconv* localeconv __PROTO__((void)); extern __MANGLE__ char* setenviron __PROTO__((const char*)); extern __MANGLE__ char* setlocale __PROTO__((int, const char*)); @@ -159,6 +164,7 @@ extern __MANGLE__ char* strerror __PROTO__((int)); #define AST_LC_MEASUREMENT 12 #define AST_LC_PAPER 13 #define AST_LC_COUNT 14 +#define AST_LC_LANG 255 #define AST_LC_find (1L<<28) #define AST_LC_debug (1L<<29) @@ -207,6 +213,9 @@ extern __MANGLE__ char* strerror __PROTO__((int)); #ifndef LC_PAPER #define LC_PAPER (-AST_LC_PAPER) #endif +#ifndef LC_LANG +#define LC_LANG (-AST_LC_LANG) +#endif #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ @@ -248,8 +257,9 @@ typedef struct int (*mb_conv) __PROTO__((char*, wchar_t)); uint32_t env_serial; + uint32_t mb_sync; - char pad[944]; + char pad[940]; } _Ast_info_t; diff --git a/usr/src/lib/libast/sparc/include/ast/ast_stdio.h b/usr/src/lib/libast/sparc/include/ast/ast_stdio.h index 7ee7ac581b..cffbe94ad4 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_stdio.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_stdio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/include/ast/ast_sys.h b/usr/src/lib/libast/sparc/include/ast/ast_sys.h index 10898b74de..f3dccadae2 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_sys.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_sys.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -125,7 +125,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_time.h b/usr/src/lib/libast/sparc/include/ast/ast_time.h index 7d491b9d03..e768dd3b4f 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_time.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_time.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/include/ast/ast_tty.h b/usr/src/lib/libast/sparc/include/ast/ast_tty.h index ca02a68486..846dae59a5 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_tty.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_tty.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_version.h b/usr/src/lib/libast/sparc/include/ast/ast_version.h index 5882fbd2a5..af5756d02b 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_version.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_version.h @@ -7,4 +7,4 @@ #if !defined(__LINKAGE__) #define __LINKAGE__ /* 2004-08-11 transition */ #endif -#define _AST_VERSION 20080910L +#define _AST_VERSION 20090202L diff --git a/usr/src/lib/libast/sparc/include/ast/ast_vfork.h b/usr/src/lib/libast/sparc/include/ast/ast_vfork.h index 545cc84ef9..452495056d 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_vfork.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_vfork.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/include/ast/ast_wait.h b/usr/src/lib/libast/sparc/include/ast/ast_wait.h index c0d9128eb7..dddd375b1f 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_wait.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_wait.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/ast_wchar.h b/usr/src/lib/libast/sparc/include/ast/ast_wchar.h index ff10eeffa4..b1f01c441a 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_wchar.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_wchar.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/include/ast/ast_windows.h b/usr/src/lib/libast/sparc/include/ast/ast_windows.h index b329b2d2f5..e02d2aaeb9 100644 --- a/usr/src/lib/libast/sparc/include/ast/ast_windows.h +++ b/usr/src/lib/libast/sparc/include/ast/ast_windows.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/bytesex.h b/usr/src/lib/libast/sparc/include/ast/bytesex.h index 95c43e160d..e105fc5f58 100644 --- a/usr/src/lib/libast/sparc/include/ast/bytesex.h +++ b/usr/src/lib/libast/sparc/include/ast/bytesex.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/ccode.h b/usr/src/lib/libast/sparc/include/ast/ccode.h index 70c8d76471..a7a43aecbe 100644 --- a/usr/src/lib/libast/sparc/include/ast/ccode.h +++ b/usr/src/lib/libast/sparc/include/ast/ccode.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/cdt.h b/usr/src/lib/libast/sparc/include/ast/cdt.h index 3dc5b7b7f8..f2f0389296 100644 --- a/usr/src/lib/libast/sparc/include/ast/cdt.h +++ b/usr/src/lib/libast/sparc/include/ast/cdt.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/debug.h b/usr/src/lib/libast/sparc/include/ast/debug.h index 565212e93b..8f0ec6a257 100644 --- a/usr/src/lib/libast/sparc/include/ast/debug.h +++ b/usr/src/lib/libast/sparc/include/ast/debug.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -55,14 +55,17 @@ #define DEBUG_ASSERT(p) ((p) ? 0 : (debug_fatal(__FILE__, __LINE__),0)) #define DEBUG_COUNT(n) ((n) += 1) #define DEBUG_TALLY(c,n,v) ((c) ? ((n) += (v)) : (n)) +#define DEBUG_INCREASE(n) ((n) += 1) +#define DEBUG_DECREASE(n) ((n) -= 1) #define DEBUG_DECLARE(t,v) t v #define DEBUG_SET(n,v) ((n) = (v)) #define DEBUG_PRINT(fd,s,v) do {char _b[1024];write(fd,_b,sfsprintf(_b,sizeof(_b),s,v));} while(0) #define DEBUG_WRITE(fd,d,n) write((fd),(d),(n)) #define DEBUG_TEMP(temp) (temp) /* debugging stuff that should be removed */ -#define DEBUG_RETURN(x) (debug_fatal(__FILE__, __LINE__), (x)) -#define DEBUG_BREAK (debug_fatal(__FILE__, __LINE__)) +#define DEBUG_BREAK break +#define DEBUG_CONTINUE continue #define DEBUG_GOTO(label) do { debug_fatal(__FILE__, __LINE__); goto label; } while(0) +#define DEBUG_RETURN(x) do { debug_fatal(__FILE__, __LINE__); return(x); } while(0) #else @@ -75,15 +78,31 @@ #define DEBUG_ASSERT(p) #define DEBUG_COUNT(n) #define DEBUG_TALLY(c,n,v) +#define DEBUG_INCREASE(n) +#define DEBUG_DECREASE(n) #define DEBUG_DECLARE(t,v) #define DEBUG_SET(n,v) #define DEBUG_PRINT(fd,s,v) #define DEBUG_WRITE(fd,d,n) -#define DEBUG_KPV(x) -#define DEBUG_RETURN(x) return(x) +#define DEBUG_TEMP(x) #define DEBUG_BREAK break +#define DEBUG_CONTINUE continue #define DEBUG_GOTO(label) goto label +#define DEBUG_RETURN(x) return(x) + +#endif +#ifndef BREAK +#define BREAK DEBUG_BREAK +#endif +#ifndef CONTINUE +#define CONTINUE DEBUG_CONTINUE +#endif +#ifndef GOTO +#define GOTO(label) DEBUG_GOTO(label) +#endif +#ifndef RETURN +#define RETURN(x) DEBUG_RETURN(x) #endif #if _BLD_ast && defined(__EXPORT__) diff --git a/usr/src/lib/libast/sparc/include/ast/dirent.h b/usr/src/lib/libast/sparc/include/ast/dirent.h index b94f22215f..ea81d037a5 100644 --- a/usr/src/lib/libast/sparc/include/ast/dirent.h +++ b/usr/src/lib/libast/sparc/include/ast/dirent.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/dt.h b/usr/src/lib/libast/sparc/include/ast/dt.h index 12299246bb..6fcc20c42e 100644 --- a/usr/src/lib/libast/sparc/include/ast/dt.h +++ b/usr/src/lib/libast/sparc/include/ast/dt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/endian.h b/usr/src/lib/libast/sparc/include/ast/endian.h index 12539254b6..6ad7ddcaad 100644 --- a/usr/src/lib/libast/sparc/include/ast/endian.h +++ b/usr/src/lib/libast/sparc/include/ast/endian.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/error.h b/usr/src/lib/libast/sparc/include/ast/error.h index 1cb01835f7..10d919a93a 100644 --- a/usr/src/lib/libast/sparc/include/ast/error.h +++ b/usr/src/lib/libast/sparc/include/ast/error.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/find.h b/usr/src/lib/libast/sparc/include/ast/find.h index c094791a30..9ed4227d03 100644 --- a/usr/src/lib/libast/sparc/include/ast/find.h +++ b/usr/src/lib/libast/sparc/include/ast/find.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/fnmatch.h b/usr/src/lib/libast/sparc/include/ast/fnmatch.h index 56c7dd7dce..ba357d9585 100644 --- a/usr/src/lib/libast/sparc/include/ast/fnmatch.h +++ b/usr/src/lib/libast/sparc/include/ast/fnmatch.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/fnv.h b/usr/src/lib/libast/sparc/include/ast/fnv.h index badccc3071..f4caaee97f 100644 --- a/usr/src/lib/libast/sparc/include/ast/fnv.h +++ b/usr/src/lib/libast/sparc/include/ast/fnv.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/fs3d.h b/usr/src/lib/libast/sparc/include/ast/fs3d.h index a52478f85c..50795c98b0 100644 --- a/usr/src/lib/libast/sparc/include/ast/fs3d.h +++ b/usr/src/lib/libast/sparc/include/ast/fs3d.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -104,7 +104,9 @@ #define FS3D_SIZE(n) ((n)<<4) #define FS3D_SIZEOF(n) ((n)>>4) -extern __MANGLE__ int mount __PROTO__((const char*, char*, int, __V_*)); +#if !_BLD_3d +#define mount(s,t,f,d) fs3d_mount(s,t,f,d) +#endif #if _BLD_ast && defined(__EXPORT__) #undef __MANGLE__ @@ -112,6 +114,7 @@ extern __MANGLE__ int mount __PROTO__((const char*, char*, int, __V_*)); #endif extern __MANGLE__ int fs3d __PROTO__((int)); +extern __MANGLE__ int fs3d_mount __PROTO__((const char*, char*, int, __V_*)); extern __MANGLE__ char* pathnext __PROTO__((char*, char*, long*)); #undef __MANGLE__ diff --git a/usr/src/lib/libast/sparc/include/ast/fts.h b/usr/src/lib/libast/sparc/include/ast/fts.h index a8ce187391..09420af481 100644 --- a/usr/src/lib/libast/sparc/include/ast/fts.h +++ b/usr/src/lib/libast/sparc/include/ast/fts.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -121,16 +121,21 @@ struct Ftsent long fts_number; /* local numeric value */ int fts_errno; /* errno for this entry */ unsigned short fts_info; /* info flags */ - unsigned short fts_namelen; /* strlen(fts_name) */ - unsigned short fts_pathlen; /* strlen(fts_path) */ - short fts_level; /* file tree depth, 0 at top */ + + unsigned short _fts_namelen; /* old fts_namelen */ + unsigned short _fts_pathlen; /* old fts_pathlen */ + short _fts_level; /* old fts_level */ + + short _fts_status; /* <ftwalk.h> compatibility */ + struct stat _fts_statb; /* <ftwalk.h> compatibility */ + + FTS* fts; /* fts_open() handle */ + size_t fts_namelen; /* strlen(fts_name) */ + size_t fts_pathlen; /* strlen(fts_path) */ + ssize_t fts_level; /* file tree depth, 0 at top */ #ifdef _FTSENT_PRIVATE_ _FTSENT_PRIVATE_ -#else - short _fts_pad_1; /* <ftwalk.h> compatibility */ - struct stat _fts_pad_2; /* <ftwalk.h> compatibility */ - FTS* fts; /* fts_open() handle */ #endif }; diff --git a/usr/src/lib/libast/sparc/include/ast/ftw.h b/usr/src/lib/libast/sparc/include/ast/ftw.h index 3d43cb2609..49040cf863 100644 --- a/usr/src/lib/libast/sparc/include/ast/ftw.h +++ b/usr/src/lib/libast/sparc/include/ast/ftw.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/ftwalk.h b/usr/src/lib/libast/sparc/include/ast/ftwalk.h index 7172b76565..29e1693959 100644 --- a/usr/src/lib/libast/sparc/include/ast/ftwalk.h +++ b/usr/src/lib/libast/sparc/include/ast/ftwalk.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -52,6 +52,8 @@ #define fts_parent parent #define fts_path path #define fts_pathlen pathlen +#define _fts_status status +#define _fts_statb statb #define FTSENT Ftw_t /* <fts.h> internal */ #define Ftsent FTW /* <fts.h> internal */ @@ -63,10 +65,6 @@ __V_* pointer; /* local pointer value */ \ } local; -#define _FTSENT_PRIVATE_ /* fts internal */ \ - short status; /* internal status */ \ - struct stat statb; /* fts_statp data */ - #include <fts.h> /* diff --git a/usr/src/lib/libast/sparc/include/ast/glob.h b/usr/src/lib/libast/sparc/include/ast/glob.h index 62c420bb4f..93e202a5f9 100644 --- a/usr/src/lib/libast/sparc/include/ast/glob.h +++ b/usr/src/lib/libast/sparc/include/ast/glob.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/hash.h b/usr/src/lib/libast/sparc/include/ast/hash.h index 3ad42981e3..a524737ccc 100644 --- a/usr/src/lib/libast/sparc/include/ast/hash.h +++ b/usr/src/lib/libast/sparc/include/ast/hash.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/hashkey.h b/usr/src/lib/libast/sparc/include/ast/hashkey.h index ac0557f6df..525434e369 100644 --- a/usr/src/lib/libast/sparc/include/ast/hashkey.h +++ b/usr/src/lib/libast/sparc/include/ast/hashkey.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/hashpart.h b/usr/src/lib/libast/sparc/include/ast/hashpart.h index 90f2be5c31..cfe3666777 100644 --- a/usr/src/lib/libast/sparc/include/ast/hashpart.h +++ b/usr/src/lib/libast/sparc/include/ast/hashpart.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/iconv.h b/usr/src/lib/libast/sparc/include/ast/iconv.h index 58bc8240d2..5b02759721 100644 --- a/usr/src/lib/libast/sparc/include/ast/iconv.h +++ b/usr/src/lib/libast/sparc/include/ast/iconv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/lc.h b/usr/src/lib/libast/sparc/include/ast/lc.h index b225864bbc..da06a59ba4 100644 --- a/usr/src/lib/libast/sparc/include/ast/lc.h +++ b/usr/src/lib/libast/sparc/include/ast/lc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -38,14 +38,15 @@ #define LC_abbreviated 0x00001 #define LC_checked 0x00002 -#define LC_default 0x00004 -#define LC_defined 0x00008 -#define LC_debug 0x00010 +#define LC_debug 0x00004 +#define LC_default 0x00008 +#define LC_defined 0x00010 #define LC_local 0x00020 #define LC_primary 0x00040 #define LC_qualified 0x00080 #define LC_undefined 0x00100 -#define LC_verbose 0x00200 +#define LC_utf8 0x00200 +#define LC_verbose 0x00400 #define LC_user 0x10000 #define LC_language_attribute_max 2 #define LC_territory_language_max 4 diff --git a/usr/src/lib/libast/sparc/include/ast/ls.h b/usr/src/lib/libast/sparc/include/ast/ls.h index b195c70e0c..70a8dc88ba 100644 --- a/usr/src/lib/libast/sparc/include/ast/ls.h +++ b/usr/src/lib/libast/sparc/include/ast/ls.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -76,8 +76,8 @@ #define LS_USER (1<<10) /* first user flag bit */ #define LS_W_BLOCKS 6 /* LS_BLOCKS field width */ -#define LS_W_INUMBER 7 /* LS_INUMBER field width */ -#define LS_W_LONG 55 /* LS_LONG width (w/o names) */ +#define LS_W_INUMBER 9 /* LS_INUMBER field width */ +#define LS_W_LONG 57 /* LS_LONG width (w/o names) */ #define LS_W_LINK 4 /* link text width (w/o names) */ #define LS_W_MARK 1 /* LS_MARK field width */ #define LS_W_NAME 9 /* group|user name field width */ diff --git a/usr/src/lib/libast/sparc/include/ast/magic.h b/usr/src/lib/libast/sparc/include/ast/magic.h index cf3c0fdcb8..53d632c721 100644 --- a/usr/src/lib/libast/sparc/include/ast/magic.h +++ b/usr/src/lib/libast/sparc/include/ast/magic.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/magicid.h b/usr/src/lib/libast/sparc/include/ast/magicid.h index 66507d4d0b..e31c80f288 100644 --- a/usr/src/lib/libast/sparc/include/ast/magicid.h +++ b/usr/src/lib/libast/sparc/include/ast/magicid.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/mc.h b/usr/src/lib/libast/sparc/include/ast/mc.h index be15276038..75b4308360 100644 --- a/usr/src/lib/libast/sparc/include/ast/mc.h +++ b/usr/src/lib/libast/sparc/include/ast/mc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/mime.h b/usr/src/lib/libast/sparc/include/ast/mime.h index c214a31130..6d662d29e5 100644 --- a/usr/src/lib/libast/sparc/include/ast/mime.h +++ b/usr/src/lib/libast/sparc/include/ast/mime.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/mnt.h b/usr/src/lib/libast/sparc/include/ast/mnt.h index ddce19fc9d..62815d19e7 100644 --- a/usr/src/lib/libast/sparc/include/ast/mnt.h +++ b/usr/src/lib/libast/sparc/include/ast/mnt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/modecanon.h b/usr/src/lib/libast/sparc/include/ast/modecanon.h index f207540d5b..3357d3ec75 100644 --- a/usr/src/lib/libast/sparc/include/ast/modecanon.h +++ b/usr/src/lib/libast/sparc/include/ast/modecanon.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/modex.h b/usr/src/lib/libast/sparc/include/ast/modex.h index 96971e347b..1f00578a00 100644 --- a/usr/src/lib/libast/sparc/include/ast/modex.h +++ b/usr/src/lib/libast/sparc/include/ast/modex.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/namval.h b/usr/src/lib/libast/sparc/include/ast/namval.h index 4c9b12f480..f54b08ff15 100644 --- a/usr/src/lib/libast/sparc/include/ast/namval.h +++ b/usr/src/lib/libast/sparc/include/ast/namval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/nl_types.h b/usr/src/lib/libast/sparc/include/ast/nl_types.h index 36c901d8ed..e71605ff40 100644 --- a/usr/src/lib/libast/sparc/include/ast/nl_types.h +++ b/usr/src/lib/libast/sparc/include/ast/nl_types.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/option.h b/usr/src/lib/libast/sparc/include/ast/option.h index 0cb1ca74c5..39207fcc4c 100644 --- a/usr/src/lib/libast/sparc/include/ast/option.h +++ b/usr/src/lib/libast/sparc/include/ast/option.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/preroot.h b/usr/src/lib/libast/sparc/include/ast/preroot.h index b183ce7a8d..40df78ea73 100644 --- a/usr/src/lib/libast/sparc/include/ast/preroot.h +++ b/usr/src/lib/libast/sparc/include/ast/preroot.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/include/ast/proc.h b/usr/src/lib/libast/sparc/include/ast/proc.h index 2bfa576970..219f0d5884 100644 --- a/usr/src/lib/libast/sparc/include/ast/proc.h +++ b/usr/src/lib/libast/sparc/include/ast/proc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/re_comp.h b/usr/src/lib/libast/sparc/include/ast/re_comp.h index 381bc801fc..e8d425d1c0 100644 --- a/usr/src/lib/libast/sparc/include/ast/re_comp.h +++ b/usr/src/lib/libast/sparc/include/ast/re_comp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/recfmt.h b/usr/src/lib/libast/sparc/include/ast/recfmt.h index 133e37da41..acdb18df36 100644 --- a/usr/src/lib/libast/sparc/include/ast/recfmt.h +++ b/usr/src/lib/libast/sparc/include/ast/recfmt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/regex.h b/usr/src/lib/libast/sparc/include/ast/regex.h index b1a8976991..1fcd12d298 100644 --- a/usr/src/lib/libast/sparc/include/ast/regex.h +++ b/usr/src/lib/libast/sparc/include/ast/regex.h @@ -53,6 +53,8 @@ #define REG_SHELL_ESCAPED 0x00400000 /* \ not special */ #define REG_SHELL_PATH 0x00800000 /* explicit / match */ +#define REG_REGEXP 0x40000000 /* <regexp.h> compatibility */ + /* regexec flags */ #define REG_NOTBOL 0x00000040 /* ^ is not a special char */ diff --git a/usr/src/lib/libast/sparc/include/ast/regexp.h b/usr/src/lib/libast/sparc/include/ast/regexp.h index e1c6258b3e..89e0d3a875 100644 --- a/usr/src/lib/libast/sparc/include/ast/regexp.h +++ b/usr/src/lib/libast/sparc/include/ast/regexp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/sfdisc.h b/usr/src/lib/libast/sparc/include/ast/sfdisc.h index 5303d9a62e..ce1ed6e052 100644 --- a/usr/src/lib/libast/sparc/include/ast/sfdisc.h +++ b/usr/src/lib/libast/sparc/include/ast/sfdisc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/sfio.h b/usr/src/lib/libast/sparc/include/ast/sfio.h index 11317dad65..3506f5c955 100644 --- a/usr/src/lib/libast/sparc/include/ast/sfio.h +++ b/usr/src/lib/libast/sparc/include/ast/sfio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -48,6 +48,7 @@ typedef ssize_t (*Sfread_f)_ARG_((Sfio_t*, Void_t*, size_t, Sfdisc_t*)); typedef ssize_t (*Sfwrite_f)_ARG_((Sfio_t*, const Void_t*, size_t, Sfdisc_t*)); typedef Sfoff_t (*Sfseek_f)_ARG_((Sfio_t*, Sfoff_t, int, Sfdisc_t*)); typedef int (*Sfexcept_f)_ARG_((Sfio_t*, int, Void_t*, Sfdisc_t*)); +typedef int (*Sfwalk_f)_ARG_((Sfio_t*, Void_t*)); /* discipline structure */ struct _sfdisc_s @@ -232,6 +233,7 @@ extern Sfio_t* sfpopen _ARG_((Sfio_t*, const char*, const char*)); extern Sfio_t* sfstack _ARG_((Sfio_t*, Sfio_t*)); extern Sfio_t* sfswap _ARG_((Sfio_t*, Sfio_t*)); extern Sfio_t* sftmp _ARG_((size_t)); +extern int sfwalk _ARG_((Sfwalk_f, Void_t*, int)); extern int sfpurge _ARG_((Sfio_t*)); extern int sfpoll _ARG_((Sfio_t**, int, int)); extern Void_t* sfreserve _ARG_((Sfio_t*, ssize_t, int)); diff --git a/usr/src/lib/libast/sparc/include/ast/sfio_s.h b/usr/src/lib/libast/sparc/include/ast/sfio_s.h index 19a23d4772..46b2348b9c 100644 --- a/usr/src/lib/libast/sparc/include/ast/sfio_s.h +++ b/usr/src/lib/libast/sparc/include/ast/sfio_s.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/sfio_t.h b/usr/src/lib/libast/sparc/include/ast/sfio_t.h index c5251d3f34..5c819865c8 100644 --- a/usr/src/lib/libast/sparc/include/ast/sfio_t.h +++ b/usr/src/lib/libast/sparc/include/ast/sfio_t.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/shcmd.h b/usr/src/lib/libast/sparc/include/ast/shcmd.h index 14e282a3d0..f59834ad80 100644 --- a/usr/src/lib/libast/sparc/include/ast/shcmd.h +++ b/usr/src/lib/libast/sparc/include/ast/shcmd.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -75,18 +75,19 @@ typedef struct Shbltin_s # 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) +# define sh_context(c) ((Shbltin_t*)(c)) +# define sh_run(c, ac, av) ((c)?(*sh_context(c)->shrun)(ac,av):-1) +# define sh_system(c,str) ((c)?(*sh_context(c)->shtrap)(str,0):system(str)) +# define sh_exit(c,n) ((c)?(*sh_context(c)->shexit)(n):exit(n)) +# define sh_checksig(c) ((c) && sh_context(c)->sigset) # if defined(SFIO_VERSION) || defined(_AST_H) # define LIB_INIT(c) # else -# define LIB_INIT(c) ((c) && (((Shbltin_t*)(c))->nosfio = 1)) +# define LIB_INIT(c) ((c) && (sh_context(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) + (sh_context(c)->notify = ((flg)&ERROR_NOTIFY)?1:0);} while(0) # endif #endif diff --git a/usr/src/lib/libast/sparc/include/ast/sig.h b/usr/src/lib/libast/sparc/include/ast/sig.h index a154747b8c..aebf3eb6df 100644 --- a/usr/src/lib/libast/sparc/include/ast/sig.h +++ b/usr/src/lib/libast/sparc/include/ast/sig.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparc/include/ast/stack.h b/usr/src/lib/libast/sparc/include/ast/stack.h index 5c55255f06..64bda47ad0 100644 --- a/usr/src/lib/libast/sparc/include/ast/stack.h +++ b/usr/src/lib/libast/sparc/include/ast/stack.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/stak.h b/usr/src/lib/libast/sparc/include/ast/stak.h index 321be20328..3e867b0b7d 100644 --- a/usr/src/lib/libast/sparc/include/ast/stak.h +++ b/usr/src/lib/libast/sparc/include/ast/stak.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/stdio.h b/usr/src/lib/libast/sparc/include/ast/stdio.h index 42d7ed8269..2053ba8b27 100644 --- a/usr/src/lib/libast/sparc/include/ast/stdio.h +++ b/usr/src/lib/libast/sparc/include/ast/stdio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/stk.h b/usr/src/lib/libast/sparc/include/ast/stk.h index ef9a946ce0..ae2684f36d 100644 --- a/usr/src/lib/libast/sparc/include/ast/stk.h +++ b/usr/src/lib/libast/sparc/include/ast/stk.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/swap.h b/usr/src/lib/libast/sparc/include/ast/swap.h index 81e49db105..96c2f79d74 100644 --- a/usr/src/lib/libast/sparc/include/ast/swap.h +++ b/usr/src/lib/libast/sparc/include/ast/swap.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/tar.h b/usr/src/lib/libast/sparc/include/ast/tar.h index 3a9a99b0ac..04f5586481 100644 --- a/usr/src/lib/libast/sparc/include/ast/tar.h +++ b/usr/src/lib/libast/sparc/include/ast/tar.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/times.h b/usr/src/lib/libast/sparc/include/ast/times.h index 1ed0f2135a..db0725a35c 100644 --- a/usr/src/lib/libast/sparc/include/ast/times.h +++ b/usr/src/lib/libast/sparc/include/ast/times.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/tm.h b/usr/src/lib/libast/sparc/include/ast/tm.h index 29c0d4f1fa..154615088f 100644 --- a/usr/src/lib/libast/sparc/include/ast/tm.h +++ b/usr/src/lib/libast/sparc/include/ast/tm.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -102,8 +102,9 @@ #define TM_ERA_YEAR 115 #define TM_ORDINALS 116 #define TM_FINAL 126 +#define TM_WORK 129 -#define TM_NFORM 129 +#define TM_NFORM 132 typedef struct /* leap second info */ { @@ -123,7 +124,7 @@ typedef struct /* time zone info */ typedef struct /* tm library readonly data */ { char** format; /* default TM_* format strings */ - char* lex; /* format lex type classes */ + unsigned char* lex; /* format lex type classes */ char* digit; /* output digits */ short* days; /* days in month i */ short* sum; /* days in months before i */ diff --git a/usr/src/lib/libast/sparc/include/ast/tmx.h b/usr/src/lib/libast/sparc/include/ast/tmx.h index 68d897dc15..a911d9b697 100644 --- a/usr/src/lib/libast/sparc/include/ast/tmx.h +++ b/usr/src/lib/libast/sparc/include/ast/tmx.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -129,12 +129,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/sparc/include/ast/tok.h b/usr/src/lib/libast/sparc/include/ast/tok.h index 1d5112837c..8850458e9a 100644 --- a/usr/src/lib/libast/sparc/include/ast/tok.h +++ b/usr/src/lib/libast/sparc/include/ast/tok.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/tv.h b/usr/src/lib/libast/sparc/include/ast/tv.h index 85358a7d6c..e18f74dc3c 100644 --- a/usr/src/lib/libast/sparc/include/ast/tv.h +++ b/usr/src/lib/libast/sparc/include/ast/tv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/include/ast/usage.h b/usr/src/lib/libast/sparc/include/ast/usage.h index d969a0e4c1..e2bea60f9c 100644 --- a/usr/src/lib/libast/sparc/include/ast/usage.h +++ b/usr/src/lib/libast/sparc/include/ast/usage.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/vdb.h b/usr/src/lib/libast/sparc/include/ast/vdb.h index ba47e14901..f800446d5f 100644 --- a/usr/src/lib/libast/sparc/include/ast/vdb.h +++ b/usr/src/lib/libast/sparc/include/ast/vdb.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/vecargs.h b/usr/src/lib/libast/sparc/include/ast/vecargs.h index 121e9d5010..8b567d5d5d 100644 --- a/usr/src/lib/libast/sparc/include/ast/vecargs.h +++ b/usr/src/lib/libast/sparc/include/ast/vecargs.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/vmalloc.h b/usr/src/lib/libast/sparc/include/ast/vmalloc.h index 8cf3e9b974..0115078cf5 100644 --- a/usr/src/lib/libast/sparc/include/ast/vmalloc.h +++ b/usr/src/lib/libast/sparc/include/ast/vmalloc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/wait.h b/usr/src/lib/libast/sparc/include/ast/wait.h index 08160043fa..bb690a2ee4 100644 --- a/usr/src/lib/libast/sparc/include/ast/wait.h +++ b/usr/src/lib/libast/sparc/include/ast/wait.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/wchar.h b/usr/src/lib/libast/sparc/include/ast/wchar.h index 7796480d09..5bd6aa3ba8 100644 --- a/usr/src/lib/libast/sparc/include/ast/wchar.h +++ b/usr/src/lib/libast/sparc/include/ast/wchar.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/include/ast/wordexp.h b/usr/src/lib/libast/sparc/include/ast/wordexp.h index c3f97b37d9..0ae7e93e99 100644 --- a/usr/src/lib/libast/sparc/include/ast/wordexp.h +++ b/usr/src/lib/libast/sparc/include/ast/wordexp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/align b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/align index a3113b6b2c..98bedb9f54 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/align +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/align @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/botch b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/botch index c3ed99bc2a..a0760dfb3a 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/botch +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/botch @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/ccode b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/ccode index 8d0727ee21..d85e09ed74 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/ccode +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/ccode @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/common b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/common index e2f3a275a5..656f34ec3b 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/common +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/common @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -155,9 +155,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (p) /* pass va_list to varargs function */ -#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -165,6 +162,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (p) /* pass va_list to varargs function */ +#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/dirent b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/dirent index 62a98fe825..738c2ec46e 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/dirent +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/dirent @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/eaccess b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/eaccess index 26e8c921d7..4368037fb9 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/eaccess +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/eaccess @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/eaccess by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/eaccess by iffe version 2009-10-06 : : */ #ifndef _def_eaccess_ast #define _def_eaccess_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/errno b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/errno index 2568119338..bb9c1ea4b0 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/errno +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/errno @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/errno by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/errno by iffe version 2009-10-06 : : */ #ifndef _def_errno_ast #define _def_errno_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/fcntl b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/fcntl index 3d39832d33..7d86da86b5 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/fcntl +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/fcntl @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/float b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/float index 4f7ff9e57d..6788a72a32 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/float +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/float @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/fs b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/fs index e5672249ea..8544e82ffa 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/fs +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/fs @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -75,7 +75,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/hack b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/hack index 42af8246ea..0fffc88bd9 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/hack +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/hack @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/hack by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/hack by iffe version 2009-10-06 : : */ #ifndef _def_hack_ast #define _def_hack_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/iconv b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/iconv index b9cb3d1b41..73e67a6cc5 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/iconv +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/iconv @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/isoc99 b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/isoc99 index 3f5cd55351..9fe968c42c 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/isoc99 +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/isoc99 @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/isoc99 by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/isoc99 by iffe version 2009-10-06 : : */ #ifndef _def_isoc99_ast #define _def_isoc99_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/lib b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/lib index 09fec9d2e6..c0a95868d0 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/lib +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/lib @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -131,7 +131,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/libpath b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/libpath index 4d68591268..31faafef26 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/libpath +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/libpath @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/libpath.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/libpath.sh by iffe version 2009-10-06 : : */ #ifndef _def_libpath_ast #define _def_libpath_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/limits b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/limits index aa30dfe16a..ef995653b9 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/limits +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/limits @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/map b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/map index af8a8f68d7..d039c336a9 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/map +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/map @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -198,6 +198,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/mmap b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/mmap index 20c894c9fe..f381a9f394 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/mmap +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/mmap @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -7,7 +7,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ -#define _mmap_worthy 1 /* mmap is good */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/mode b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/mode index ca8bae2c91..43dca228f4 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/mode +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/mode @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/ndbm b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/ndbm index fec155cde2..d9eb9cc239 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/ndbm +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/ndbm @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/nl_types b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/nl_types index 7290f4df17..ac8e8d8ef8 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/nl_types +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/nl_types @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/omitted b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/omitted index 10b65d37fe..05c8c85c57 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/omitted +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/omitted @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/omitted by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/omitted by iffe version 2009-10-06 : : */ #ifndef _def_omitted_ast #define _def_omitted_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/param b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/param index 6b14c7d72d..69ae2644c7 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/param +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/param @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/preroot b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/preroot index 57a661e1d5..756b78a37f 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/preroot +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/preroot @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/prog b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/prog new file mode 100644 index 0000000000..ba1115cdb1 --- /dev/null +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/prog @@ -0,0 +1,7 @@ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/prog by iffe version 2009-10-06 : : */ +#ifndef _def_prog_ast +#define _def_prog_ast 1 +#define _sys_types 1 /* #include <sys/types.h> ok */ +#define _lib_getexecname 1 /* getexecname() in default lib(s) */ +#define _PROC_PROG "/proc/self/path/a.out" +#endif diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sfinit b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sfinit index 1badda4725..6d31652693 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sfinit +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sfinit @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/sfinit.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/sfinit.c by iffe version 2009-10-06 : : */ #ifndef _def_sfinit_ast #define _def_sfinit_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sfio b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sfio index f1069c1f0d..7f15af3b14 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sfio +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sfio @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/sfio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/sfio by iffe version 2009-10-06 : : */ #ifndef _def_sfio_ast #define _def_sfio_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sig b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sig index 10e7ce106c..4a05425f62 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sig +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sig @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/siglist b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/siglist index e21458c476..c99c89509b 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/siglist +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/siglist @@ -1,10 +1,13 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/siglist by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/siglist by iffe version 2009-10-06 : : */ #ifndef _def_siglist_ast #define _def_siglist_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ #define _hdr_string 1 /* #include <string.h> ok */ #define _hdr_signal 1 /* #include <signal.h> ok */ #define _lib_strsignal 1 /* strsignal() in default lib(s) */ +#if defined(SIGHUP) && !defined(HAD_SIGHUP) +0,"HUP",SIGHUP, +#endif #if defined(SIGINT) && !defined(HAD_SIGINT) 0,"INT",SIGINT, #endif diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/signal b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/signal index dc8c8b8d00..2bb0880240 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/signal +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/signal @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/signal.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/signal.c by iffe version 2009-10-06 : : */ #ifndef _def_signal_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/standards b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/standards index 1e7c62f706..562e8b6650 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/standards +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/standards @@ -1,26 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/stdio b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/stdio index de7c89e350..b89ea30d69 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/stdio +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/stdio @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sys b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sys index c73ea23b86..c4231a6042 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sys +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/sys @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -104,7 +104,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/time b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/time index c772198ef6..2a4bd3dbb7 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/time +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/time @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tmlib b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tmlib index 3597d6a274..a92e195a08 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tmlib +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tmlib @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/tmlib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/tmlib by iffe version 2009-10-06 : : */ #ifndef _def_tmlib_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tmx b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tmx index 189ba75695..5c84ca22cb 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tmx +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tmx @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -108,12 +108,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tty b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tty index d677e658e3..2c48057ed3 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tty +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tty @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tv b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tv index 0ead9fa85c..289ea145de 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tv +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tv @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tvlib b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tvlib index eccd218a2c..0b217f8c3f 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tvlib +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/tvlib @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/tvlib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/tvlib by iffe version 2009-10-06 : : */ #ifndef _def_tvlib_ast #define _def_tvlib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/uwin b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/uwin index 2f8d56aeab..a5e25c14f3 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/uwin +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/uwin @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/uwin by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/uwin by iffe version 2009-10-06 : : */ #ifndef _def_uwin_ast #define _def_uwin_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/vfork b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/vfork index 2da80228cf..7f64bc5c1c 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/vfork +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/vfork @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/vmalloc b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/vmalloc index b3dccf8aff..b0c7f6d891 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/vmalloc +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/vmalloc @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/vmalloc by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/vmalloc by iffe version 2009-10-06 : : */ #ifndef _def_vmalloc_ast #define _def_vmalloc_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/wait b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/wait index 46bb607432..4f48b8ccd4 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/wait +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/wait @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/wchar b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/wchar index a3ced6a848..aa52f40fd2 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/wchar +++ b/usr/src/lib/libast/sparc/src/lib/libast/FEATURE/wchar @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/align.h b/usr/src/lib/libast/sparc/src/lib/libast/align.h index a3113b6b2c..98bedb9f54 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/align.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/align.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_botch.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_botch.h index c3ed99bc2a..a0760dfb3a 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_botch.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_botch.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_ccode.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_ccode.h index 8d0727ee21..d85e09ed74 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_ccode.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_ccode.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_common.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_common.h index 1425e28c09..9cccc65817 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_common.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_common.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -155,9 +155,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (p) /* pass va_list to varargs function */ -#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -165,6 +162,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (p) /* pass va_list to varargs function */ +#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_dirent.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_dirent.h index 62a98fe825..738c2ec46e 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_dirent.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_dirent.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_fcntl.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_fcntl.h index 3d39832d33..7d86da86b5 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_fcntl.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_fcntl.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_float.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_float.h index 4f7ff9e57d..6788a72a32 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_float.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_float.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_fs.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_fs.h index e5672249ea..8544e82ffa 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_fs.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_fs.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -75,7 +75,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_iconv.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_iconv.h index b9cb3d1b41..73e67a6cc5 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_iconv.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_iconv.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_lib.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_lib.h index 09fec9d2e6..c0a95868d0 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_lib.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_lib.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -131,7 +131,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_limits.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_limits.h index aa30dfe16a..ef995653b9 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_limits.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_limits.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_map.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_map.h index af8a8f68d7..d039c336a9 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_map.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_map.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -198,6 +198,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_mmap.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_mmap.h index 20c894c9fe..f381a9f394 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_mmap.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_mmap.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -7,7 +7,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ -#define _mmap_worthy 1 /* mmap is good */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_mode.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_mode.h index ca8bae2c91..43dca228f4 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_mode.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_mode.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_namval.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_namval.h new file mode 100644 index 0000000000..f8f65ab2cb --- /dev/null +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_namval.h @@ -0,0 +1,42 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped +/* + * Glenn Fowler + * AT&T Research + * + * common name-value struct support + */ + +#ifndef _NAMVAL_H +#define _NAMVAL_H + +typedef struct +{ + char* name; + int value; +#ifdef _NAMVAL_PRIVATE_ + _NAMVAL_PRIVATE_ +#endif +} Namval_t; + +#endif diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_ndbm.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_ndbm.h index fec155cde2..d9eb9cc239 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_ndbm.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_ndbm.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_nl_types.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_nl_types.h index 7290f4df17..ac8e8d8ef8 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_nl_types.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_nl_types.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_param.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_param.h index 6b14c7d72d..69ae2644c7 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_param.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_param.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_standards.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_standards.h index 1e7c62f706..562e8b6650 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_standards.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_standards.h @@ -1,26 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_stdio.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_stdio.h index de7c89e350..b89ea30d69 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_stdio.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_stdio.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_sys.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_sys.h index c73ea23b86..c4231a6042 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_sys.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_sys.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -104,7 +104,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_time.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_time.h index c772198ef6..2a4bd3dbb7 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_time.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_time.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_tty.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_tty.h index d677e658e3..2c48057ed3 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_tty.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_tty.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_vfork.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_vfork.h index 2da80228cf..7f64bc5c1c 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_vfork.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_vfork.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_wait.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_wait.h index 46bb607432..4f48b8ccd4 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_wait.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_wait.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/ast_wchar.h b/usr/src/lib/libast/sparc/src/lib/libast/ast_wchar.h index a3ced6a848..aa52f40fd2 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/ast_wchar.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/ast_wchar.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/conftab.c b/usr/src/lib/libast/sparc/src/lib/libast/conftab.c index c073c29d26..ac3ae6bca7 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/conftab.c +++ b/usr/src/lib/libast/sparc/src/lib/libast/conftab.c @@ -10,7 +10,7 @@ #include "FEATURE/param" #include "conftab.h" -/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/comp/conf.tab : : */ +/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/comp/conf.tab : : */ /* * prefix strings -- the first few are indexed by Conf_t.standard @@ -207,6 +207,7 @@ const Conf_t conf[] = { "NL_TEXTMAX", { 0ULL, 0 }, { 0ULL, 0 }, CONF_LIMIT, CONF_XOPEN, 1, CONF_nop, -1 }, { "NO_TRUNC", { 0ULL, 0 }, { 0ULL, 0 }, CONF_FEATURE|CONF_UNDERSCORE|CONF_PREFIX_ONLY, CONF_POSIX, 1, CONF_pathconf, _PC_NO_TRUNC }, { "NPROCESSORS_CONF", { 0ULL, 0 }, { 0ULL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_CONF }, +{ "NPROCESSORS_MAX", { 0ULL, 0 }, { 0ULL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_MAX }, { "NPROCESSORS_ONLN", { 0ULL, 0 }, { 0ULL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_ONLN }, { "NPROC_CONF", { 0ULL, 0 }, { 0ULL, 0 }, CONF_FEATURE|CONF_UNDERSCORE, CONF_POSIX, 1, CONF_nop, -1 }, { "NPROC_ONLN", { 0ULL, 0 }, { 0ULL, 0 }, CONF_FEATURE|CONF_UNDERSCORE, CONF_POSIX, 1, CONF_nop, -1 }, diff --git a/usr/src/lib/libast/sparc/src/lib/libast/conftab.h b/usr/src/lib/libast/sparc/src/lib/libast/conftab.h index d5e15e0a5b..e8d3f27f82 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/conftab.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/conftab.h @@ -6,7 +6,7 @@ #endif #include <sys/systeminfo.h> -/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/comp/conf.tab : : */ +/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/comp/conf.tab : : */ #if !defined(const) && !defined(__STDC__) && !defined(__cplusplus) && !defined(c_plusplus) #define const diff --git a/usr/src/lib/libast/sparc/src/lib/libast/lc.h b/usr/src/lib/libast/sparc/src/lib/libast/lc.h index b225864bbc..da06a59ba4 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/lc.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/lc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -38,14 +38,15 @@ #define LC_abbreviated 0x00001 #define LC_checked 0x00002 -#define LC_default 0x00004 -#define LC_defined 0x00008 -#define LC_debug 0x00010 +#define LC_debug 0x00004 +#define LC_default 0x00008 +#define LC_defined 0x00010 #define LC_local 0x00020 #define LC_primary 0x00040 #define LC_qualified 0x00080 #define LC_undefined 0x00100 -#define LC_verbose 0x00200 +#define LC_utf8 0x00200 +#define LC_verbose 0x00400 #define LC_user 0x10000 #define LC_language_attribute_max 2 #define LC_territory_language_max 4 diff --git a/usr/src/lib/libast/sparc/src/lib/libast/preroot.h b/usr/src/lib/libast/sparc/src/lib/libast/preroot.h index 57a661e1d5..756b78a37f 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/preroot.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/preroot.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparc/src/lib/libast/sig.h b/usr/src/lib/libast/sparc/src/lib/libast/sig.h index 10e7ce106c..4a05425f62 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/sig.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/sig.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparc/src/lib/libast/tmx.h b/usr/src/lib/libast/sparc/src/lib/libast/tmx.h index 189ba75695..5c84ca22cb 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/tmx.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/tmx.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -108,12 +108,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/sparc/src/lib/libast/tv.h b/usr/src/lib/libast/sparc/src/lib/libast/tv.h index 0ead9fa85c..289ea145de 100644 --- a/usr/src/lib/libast/sparc/src/lib/libast/tv.h +++ b/usr/src/lib/libast/sparc/src/lib/libast/tv.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/include/ast/align.h b/usr/src/lib/libast/sparcv9/include/ast/align.h index 5f6cef50cc..825809c3af 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/align.h +++ b/usr/src/lib/libast/sparcv9/include/ast/align.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast.h b/usr/src/lib/libast/sparcv9/include/ast/ast.h index f5335ae8a2..f1dff0cf6a 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -185,7 +185,7 @@ typedef struct #define mbcoll() (ast.mb_xfrm!=0) #define mbwide() (mbmax()>1) -#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p++,ast.tmp_int)):(*(unsigned char*)(p++))) +#define mbchar(p) (mbwide()?((ast.tmp_int=(*ast.mb_towc)(&ast.tmp_wchar,(char*)(p),mbmax()))>0?((p+=ast.tmp_int),ast.tmp_wchar):(p+=ast.mb_sync+1,ast.tmp_int)):(*(unsigned char*)(p++))) #define mbinit() (mbwide()?(*ast.mb_towc)((wchar_t*)0,(char*)0,mbmax()):0) #define mbsize(p) (mbwide()?(*ast.mb_len)((char*)(p),mbmax()):((p),1)) #define mbconv(s,w) (ast.mb_conv?(*ast.mb_conv)(s,w):((*(s)=(w)),1)) @@ -309,6 +309,7 @@ extern __MANGLE__ size_t pathnative __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathpath __PROTO__((char*, const char*, const char*, int)); extern __MANGLE__ size_t pathposix __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathprobe __PROTO__((char*, char*, const char*, const char*, const char*, int)); +extern __MANGLE__ size_t pathprog __PROTO__((const char*, char*, size_t)); extern __MANGLE__ char* pathrepl __PROTO__((char*, const char*, const char*)); extern __MANGLE__ int pathsetlink __PROTO__((const char*, const char*)); extern __MANGLE__ char* pathshell __PROTO__((void)); @@ -329,6 +330,7 @@ extern __MANGLE__ int strmatch __PROTO__((const char*, const char*)); extern __MANGLE__ int strmode __PROTO__((const char*)); extern __MANGLE__ int strnacmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ char* strncopy __PROTO__((char*, const char*, size_t)); +extern __MANGLE__ int strnpcmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ double strntod __PROTO__((const char*, size_t, char**)); extern __MANGLE__ _ast_fltmax_t strntold __PROTO__((const char*, size_t, char**)); extern __MANGLE__ long strntol __PROTO__((const char*, size_t, char**, int)); @@ -337,7 +339,9 @@ extern __MANGLE__ long strnton __PROTO__((const char*, size_t, char**, char*, i extern __MANGLE__ unsigned long strntoul __PROTO__((const char*, size_t, char**, int)); extern __MANGLE__ intmax_t strntonll __PROTO__((const char*, size_t, char**, char*, int)); extern __MANGLE__ uintmax_t strntoull __PROTO__((const char*, size_t, char**, int)); +extern __MANGLE__ int strnvcmp __PROTO__((const char*, const char*, size_t)); extern __MANGLE__ int stropt __PROTO__((const char*, const __V_*, int, int(*)(__V_*, const __V_*, int, const char*), __V_*)); +extern __MANGLE__ int strpcmp __PROTO__((const char*, const char*)); extern __MANGLE__ int strperm __PROTO__((const char*, char**, int)); extern __MANGLE__ __V_* strpsearch __PROTO__((const __V_*, size_t, size_t, const char*, char**)); extern __MANGLE__ __V_* strsearch __PROTO__((const __V_*, size_t, size_t, Strcmp_f, const char*, __V_*)); @@ -350,6 +354,7 @@ extern __MANGLE__ long strton __PROTO__((const char*, char**, char*, int)); extern __MANGLE__ intmax_t strtonll __PROTO__((const char*, char**, char*, int)); extern __MANGLE__ int struid __PROTO__((const char*)); extern __MANGLE__ int struniq __PROTO__((char**, int)); +extern __MANGLE__ int strvcmp __PROTO__((const char*, const char*)); #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_botch.h b/usr/src/lib/libast/sparcv9/include/ast/ast_botch.h index d21da2aaac..c734b79be1 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_botch.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_botch.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_ccode.h b/usr/src/lib/libast/sparcv9/include/ast/ast_ccode.h index b1a5219a63..8c8ecd553e 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_ccode.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_ccode.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_common.h b/usr/src/lib/libast/sparcv9/include/ast/ast_common.h index ab2221a08d..8cda3ef0fe 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_common.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_common.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -177,9 +177,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (p) /* pass va_list to varargs function */ -#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -187,6 +184,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (p) /* pass va_list to varargs function */ +#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_dir.h b/usr/src/lib/libast/sparcv9/include/ast/ast_dir.h index a402906410..8d801aa72c 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_dir.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_dir.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_dirent.h b/usr/src/lib/libast/sparcv9/include/ast/ast_dirent.h index 46020fa183..7ed2922b70 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_dirent.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_dirent.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_fcntl.h b/usr/src/lib/libast/sparcv9/include/ast/ast_fcntl.h index e9164e7881..15816246b8 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_fcntl.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_fcntl.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_float.h b/usr/src/lib/libast/sparcv9/include/ast/ast_float.h index 2904cd9cf1..bd76a64a1c 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_float.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_float.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_fs.h b/usr/src/lib/libast/sparcv9/include/ast/ast_fs.h index 354d8245ed..0420a9311d 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_fs.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_fs.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -96,7 +96,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_iconv.h b/usr/src/lib/libast/sparcv9/include/ast/ast_iconv.h index 0629e61bee..c0e6a25dd3 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_iconv.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_iconv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_lib.h b/usr/src/lib/libast/sparcv9/include/ast/ast_lib.h index d44704c408..3bfcec14ec 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_lib.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_lib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -141,7 +141,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_limits.h b/usr/src/lib/libast/sparcv9/include/ast/ast_limits.h index 805c03a45d..ab89acd722 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_limits.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_limits.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_map.h b/usr/src/lib/libast/sparcv9/include/ast/ast_map.h index e18bcb27af..3a512b6ece 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_map.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_map.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -219,6 +219,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_mmap.h b/usr/src/lib/libast/sparcv9/include/ast/ast_mmap.h index e076458cf8..9261494c4b 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_mmap.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_mmap.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -28,6 +28,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_mode.h b/usr/src/lib/libast/sparcv9/include/ast/ast_mode.h index 733b4a3ba9..f9caab398c 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_mode.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_mode.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_namval.h b/usr/src/lib/libast/sparcv9/include/ast/ast_namval.h index 4c9b12f480..f54b08ff15 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_namval.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_namval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_ndbm.h b/usr/src/lib/libast/sparcv9/include/ast/ast_ndbm.h index 3818920d7a..f63856aeb6 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_ndbm.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_ndbm.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_nl_types.h b/usr/src/lib/libast/sparcv9/include/ast/ast_nl_types.h index 930c8428d6..988f320b52 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_nl_types.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_nl_types.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_param.h b/usr/src/lib/libast/sparcv9/include/ast/ast_param.h index 259bad3eb6..326200af6a 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_param.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_param.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_standards.h b/usr/src/lib/libast/sparcv9/include/ast/ast_standards.h index 63f05ff515..cd18f087a6 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_standards.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_standards.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,29 +19,11 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_std.h b/usr/src/lib/libast/sparcv9/include/ast/ast_std.h index 4f3f3dd9da..e734c74dbd 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_std.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_std.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -117,22 +117,27 @@ struct lconv #define __MANGLE__ __LINKAGE__ __EXPORT__ #endif +#if !_UWIN /* for ast54 compatibility */ + #undef getenv #define getenv _ast_getenv +#undef setenviron +#define setenviron _ast_setenviron + +extern __MANGLE__ char* getenv __PROTO__((const char*)); + +#endif + #undef localeconv #define localeconv _ast_localeconv #undef setlocale #define setlocale _ast_setlocale -#undef setenviron -#define setenviron _ast_setenviron - #undef strerror #define strerror _ast_strerror -extern __MANGLE__ char* getenv __PROTO__((const char*)); extern __MANGLE__ struct lconv* localeconv __PROTO__((void)); extern __MANGLE__ char* setenviron __PROTO__((const char*)); extern __MANGLE__ char* setlocale __PROTO__((int, const char*)); @@ -159,6 +164,7 @@ extern __MANGLE__ char* strerror __PROTO__((int)); #define AST_LC_MEASUREMENT 12 #define AST_LC_PAPER 13 #define AST_LC_COUNT 14 +#define AST_LC_LANG 255 #define AST_LC_find (1L<<28) #define AST_LC_debug (1L<<29) @@ -207,6 +213,9 @@ extern __MANGLE__ char* strerror __PROTO__((int)); #ifndef LC_PAPER #define LC_PAPER (-AST_LC_PAPER) #endif +#ifndef LC_LANG +#define LC_LANG (-AST_LC_LANG) +#endif #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ @@ -248,8 +257,9 @@ typedef struct int (*mb_conv) __PROTO__((char*, wchar_t)); uint32_t env_serial; + uint32_t mb_sync; - char pad[944]; + char pad[940]; } _Ast_info_t; diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_stdio.h b/usr/src/lib/libast/sparcv9/include/ast/ast_stdio.h index 2017750455..7c7f05a381 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_stdio.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_stdio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_sys.h b/usr/src/lib/libast/sparcv9/include/ast/ast_sys.h index ad32fd43a6..3659647fa2 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_sys.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_sys.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -125,7 +125,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_time.h b/usr/src/lib/libast/sparcv9/include/ast/ast_time.h index e1564ee374..0507482344 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_time.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_time.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_tty.h b/usr/src/lib/libast/sparcv9/include/ast/ast_tty.h index e0a03bbe45..9e0af86eb6 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_tty.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_tty.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_version.h b/usr/src/lib/libast/sparcv9/include/ast/ast_version.h index 5882fbd2a5..af5756d02b 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_version.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_version.h @@ -7,4 +7,4 @@ #if !defined(__LINKAGE__) #define __LINKAGE__ /* 2004-08-11 transition */ #endif -#define _AST_VERSION 20080910L +#define _AST_VERSION 20090202L diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_vfork.h b/usr/src/lib/libast/sparcv9/include/ast/ast_vfork.h index 3a9c783f17..ebf40888ed 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_vfork.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_vfork.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_wait.h b/usr/src/lib/libast/sparcv9/include/ast/ast_wait.h index 9871a31b0c..becfa490b0 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_wait.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_wait.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_wchar.h b/usr/src/lib/libast/sparcv9/include/ast/ast_wchar.h index d16e55a896..2ad80cca1b 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_wchar.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_wchar.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/include/ast/ast_windows.h b/usr/src/lib/libast/sparcv9/include/ast/ast_windows.h index b329b2d2f5..e02d2aaeb9 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ast_windows.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ast_windows.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/bytesex.h b/usr/src/lib/libast/sparcv9/include/ast/bytesex.h index 95c43e160d..e105fc5f58 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/bytesex.h +++ b/usr/src/lib/libast/sparcv9/include/ast/bytesex.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/ccode.h b/usr/src/lib/libast/sparcv9/include/ast/ccode.h index 70c8d76471..a7a43aecbe 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ccode.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ccode.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/cdt.h b/usr/src/lib/libast/sparcv9/include/ast/cdt.h index 3dc5b7b7f8..f2f0389296 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/cdt.h +++ b/usr/src/lib/libast/sparcv9/include/ast/cdt.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/debug.h b/usr/src/lib/libast/sparcv9/include/ast/debug.h index 565212e93b..8f0ec6a257 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/debug.h +++ b/usr/src/lib/libast/sparcv9/include/ast/debug.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -55,14 +55,17 @@ #define DEBUG_ASSERT(p) ((p) ? 0 : (debug_fatal(__FILE__, __LINE__),0)) #define DEBUG_COUNT(n) ((n) += 1) #define DEBUG_TALLY(c,n,v) ((c) ? ((n) += (v)) : (n)) +#define DEBUG_INCREASE(n) ((n) += 1) +#define DEBUG_DECREASE(n) ((n) -= 1) #define DEBUG_DECLARE(t,v) t v #define DEBUG_SET(n,v) ((n) = (v)) #define DEBUG_PRINT(fd,s,v) do {char _b[1024];write(fd,_b,sfsprintf(_b,sizeof(_b),s,v));} while(0) #define DEBUG_WRITE(fd,d,n) write((fd),(d),(n)) #define DEBUG_TEMP(temp) (temp) /* debugging stuff that should be removed */ -#define DEBUG_RETURN(x) (debug_fatal(__FILE__, __LINE__), (x)) -#define DEBUG_BREAK (debug_fatal(__FILE__, __LINE__)) +#define DEBUG_BREAK break +#define DEBUG_CONTINUE continue #define DEBUG_GOTO(label) do { debug_fatal(__FILE__, __LINE__); goto label; } while(0) +#define DEBUG_RETURN(x) do { debug_fatal(__FILE__, __LINE__); return(x); } while(0) #else @@ -75,15 +78,31 @@ #define DEBUG_ASSERT(p) #define DEBUG_COUNT(n) #define DEBUG_TALLY(c,n,v) +#define DEBUG_INCREASE(n) +#define DEBUG_DECREASE(n) #define DEBUG_DECLARE(t,v) #define DEBUG_SET(n,v) #define DEBUG_PRINT(fd,s,v) #define DEBUG_WRITE(fd,d,n) -#define DEBUG_KPV(x) -#define DEBUG_RETURN(x) return(x) +#define DEBUG_TEMP(x) #define DEBUG_BREAK break +#define DEBUG_CONTINUE continue #define DEBUG_GOTO(label) goto label +#define DEBUG_RETURN(x) return(x) + +#endif +#ifndef BREAK +#define BREAK DEBUG_BREAK +#endif +#ifndef CONTINUE +#define CONTINUE DEBUG_CONTINUE +#endif +#ifndef GOTO +#define GOTO(label) DEBUG_GOTO(label) +#endif +#ifndef RETURN +#define RETURN(x) DEBUG_RETURN(x) #endif #if _BLD_ast && defined(__EXPORT__) diff --git a/usr/src/lib/libast/sparcv9/include/ast/dirent.h b/usr/src/lib/libast/sparcv9/include/ast/dirent.h index b94f22215f..ea81d037a5 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/dirent.h +++ b/usr/src/lib/libast/sparcv9/include/ast/dirent.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/dt.h b/usr/src/lib/libast/sparcv9/include/ast/dt.h index 12299246bb..6fcc20c42e 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/dt.h +++ b/usr/src/lib/libast/sparcv9/include/ast/dt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/endian.h b/usr/src/lib/libast/sparcv9/include/ast/endian.h index 12539254b6..6ad7ddcaad 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/endian.h +++ b/usr/src/lib/libast/sparcv9/include/ast/endian.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/error.h b/usr/src/lib/libast/sparcv9/include/ast/error.h index 1cb01835f7..10d919a93a 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/error.h +++ b/usr/src/lib/libast/sparcv9/include/ast/error.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/find.h b/usr/src/lib/libast/sparcv9/include/ast/find.h index c094791a30..9ed4227d03 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/find.h +++ b/usr/src/lib/libast/sparcv9/include/ast/find.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/fnmatch.h b/usr/src/lib/libast/sparcv9/include/ast/fnmatch.h index 56c7dd7dce..ba357d9585 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/fnmatch.h +++ b/usr/src/lib/libast/sparcv9/include/ast/fnmatch.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/fnv.h b/usr/src/lib/libast/sparcv9/include/ast/fnv.h index badccc3071..f4caaee97f 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/fnv.h +++ b/usr/src/lib/libast/sparcv9/include/ast/fnv.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/fs3d.h b/usr/src/lib/libast/sparcv9/include/ast/fs3d.h index a52478f85c..50795c98b0 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/fs3d.h +++ b/usr/src/lib/libast/sparcv9/include/ast/fs3d.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -104,7 +104,9 @@ #define FS3D_SIZE(n) ((n)<<4) #define FS3D_SIZEOF(n) ((n)>>4) -extern __MANGLE__ int mount __PROTO__((const char*, char*, int, __V_*)); +#if !_BLD_3d +#define mount(s,t,f,d) fs3d_mount(s,t,f,d) +#endif #if _BLD_ast && defined(__EXPORT__) #undef __MANGLE__ @@ -112,6 +114,7 @@ extern __MANGLE__ int mount __PROTO__((const char*, char*, int, __V_*)); #endif extern __MANGLE__ int fs3d __PROTO__((int)); +extern __MANGLE__ int fs3d_mount __PROTO__((const char*, char*, int, __V_*)); extern __MANGLE__ char* pathnext __PROTO__((char*, char*, long*)); #undef __MANGLE__ diff --git a/usr/src/lib/libast/sparcv9/include/ast/fts.h b/usr/src/lib/libast/sparcv9/include/ast/fts.h index a8ce187391..09420af481 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/fts.h +++ b/usr/src/lib/libast/sparcv9/include/ast/fts.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -121,16 +121,21 @@ struct Ftsent long fts_number; /* local numeric value */ int fts_errno; /* errno for this entry */ unsigned short fts_info; /* info flags */ - unsigned short fts_namelen; /* strlen(fts_name) */ - unsigned short fts_pathlen; /* strlen(fts_path) */ - short fts_level; /* file tree depth, 0 at top */ + + unsigned short _fts_namelen; /* old fts_namelen */ + unsigned short _fts_pathlen; /* old fts_pathlen */ + short _fts_level; /* old fts_level */ + + short _fts_status; /* <ftwalk.h> compatibility */ + struct stat _fts_statb; /* <ftwalk.h> compatibility */ + + FTS* fts; /* fts_open() handle */ + size_t fts_namelen; /* strlen(fts_name) */ + size_t fts_pathlen; /* strlen(fts_path) */ + ssize_t fts_level; /* file tree depth, 0 at top */ #ifdef _FTSENT_PRIVATE_ _FTSENT_PRIVATE_ -#else - short _fts_pad_1; /* <ftwalk.h> compatibility */ - struct stat _fts_pad_2; /* <ftwalk.h> compatibility */ - FTS* fts; /* fts_open() handle */ #endif }; diff --git a/usr/src/lib/libast/sparcv9/include/ast/ftw.h b/usr/src/lib/libast/sparcv9/include/ast/ftw.h index 3d43cb2609..49040cf863 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ftw.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ftw.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/ftwalk.h b/usr/src/lib/libast/sparcv9/include/ast/ftwalk.h index 7172b76565..29e1693959 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ftwalk.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ftwalk.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -52,6 +52,8 @@ #define fts_parent parent #define fts_path path #define fts_pathlen pathlen +#define _fts_status status +#define _fts_statb statb #define FTSENT Ftw_t /* <fts.h> internal */ #define Ftsent FTW /* <fts.h> internal */ @@ -63,10 +65,6 @@ __V_* pointer; /* local pointer value */ \ } local; -#define _FTSENT_PRIVATE_ /* fts internal */ \ - short status; /* internal status */ \ - struct stat statb; /* fts_statp data */ - #include <fts.h> /* diff --git a/usr/src/lib/libast/sparcv9/include/ast/glob.h b/usr/src/lib/libast/sparcv9/include/ast/glob.h index 62c420bb4f..93e202a5f9 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/glob.h +++ b/usr/src/lib/libast/sparcv9/include/ast/glob.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/hash.h b/usr/src/lib/libast/sparcv9/include/ast/hash.h index 3ad42981e3..a524737ccc 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/hash.h +++ b/usr/src/lib/libast/sparcv9/include/ast/hash.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/hashkey.h b/usr/src/lib/libast/sparcv9/include/ast/hashkey.h index ac0557f6df..525434e369 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/hashkey.h +++ b/usr/src/lib/libast/sparcv9/include/ast/hashkey.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/hashpart.h b/usr/src/lib/libast/sparcv9/include/ast/hashpart.h index 90f2be5c31..cfe3666777 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/hashpart.h +++ b/usr/src/lib/libast/sparcv9/include/ast/hashpart.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/iconv.h b/usr/src/lib/libast/sparcv9/include/ast/iconv.h index 58bc8240d2..5b02759721 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/iconv.h +++ b/usr/src/lib/libast/sparcv9/include/ast/iconv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/lc.h b/usr/src/lib/libast/sparcv9/include/ast/lc.h index b225864bbc..da06a59ba4 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/lc.h +++ b/usr/src/lib/libast/sparcv9/include/ast/lc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -38,14 +38,15 @@ #define LC_abbreviated 0x00001 #define LC_checked 0x00002 -#define LC_default 0x00004 -#define LC_defined 0x00008 -#define LC_debug 0x00010 +#define LC_debug 0x00004 +#define LC_default 0x00008 +#define LC_defined 0x00010 #define LC_local 0x00020 #define LC_primary 0x00040 #define LC_qualified 0x00080 #define LC_undefined 0x00100 -#define LC_verbose 0x00200 +#define LC_utf8 0x00200 +#define LC_verbose 0x00400 #define LC_user 0x10000 #define LC_language_attribute_max 2 #define LC_territory_language_max 4 diff --git a/usr/src/lib/libast/sparcv9/include/ast/ls.h b/usr/src/lib/libast/sparcv9/include/ast/ls.h index b195c70e0c..70a8dc88ba 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/ls.h +++ b/usr/src/lib/libast/sparcv9/include/ast/ls.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -76,8 +76,8 @@ #define LS_USER (1<<10) /* first user flag bit */ #define LS_W_BLOCKS 6 /* LS_BLOCKS field width */ -#define LS_W_INUMBER 7 /* LS_INUMBER field width */ -#define LS_W_LONG 55 /* LS_LONG width (w/o names) */ +#define LS_W_INUMBER 9 /* LS_INUMBER field width */ +#define LS_W_LONG 57 /* LS_LONG width (w/o names) */ #define LS_W_LINK 4 /* link text width (w/o names) */ #define LS_W_MARK 1 /* LS_MARK field width */ #define LS_W_NAME 9 /* group|user name field width */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/magic.h b/usr/src/lib/libast/sparcv9/include/ast/magic.h index cf3c0fdcb8..53d632c721 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/magic.h +++ b/usr/src/lib/libast/sparcv9/include/ast/magic.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/magicid.h b/usr/src/lib/libast/sparcv9/include/ast/magicid.h index 66507d4d0b..e31c80f288 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/magicid.h +++ b/usr/src/lib/libast/sparcv9/include/ast/magicid.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/mc.h b/usr/src/lib/libast/sparcv9/include/ast/mc.h index be15276038..75b4308360 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/mc.h +++ b/usr/src/lib/libast/sparcv9/include/ast/mc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/mime.h b/usr/src/lib/libast/sparcv9/include/ast/mime.h index c214a31130..6d662d29e5 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/mime.h +++ b/usr/src/lib/libast/sparcv9/include/ast/mime.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/mnt.h b/usr/src/lib/libast/sparcv9/include/ast/mnt.h index ddce19fc9d..62815d19e7 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/mnt.h +++ b/usr/src/lib/libast/sparcv9/include/ast/mnt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/modecanon.h b/usr/src/lib/libast/sparcv9/include/ast/modecanon.h index f207540d5b..3357d3ec75 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/modecanon.h +++ b/usr/src/lib/libast/sparcv9/include/ast/modecanon.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/modex.h b/usr/src/lib/libast/sparcv9/include/ast/modex.h index 96971e347b..1f00578a00 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/modex.h +++ b/usr/src/lib/libast/sparcv9/include/ast/modex.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/namval.h b/usr/src/lib/libast/sparcv9/include/ast/namval.h index 4c9b12f480..f54b08ff15 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/namval.h +++ b/usr/src/lib/libast/sparcv9/include/ast/namval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/nl_types.h b/usr/src/lib/libast/sparcv9/include/ast/nl_types.h index 36c901d8ed..e71605ff40 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/nl_types.h +++ b/usr/src/lib/libast/sparcv9/include/ast/nl_types.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/option.h b/usr/src/lib/libast/sparcv9/include/ast/option.h index 0cb1ca74c5..39207fcc4c 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/option.h +++ b/usr/src/lib/libast/sparcv9/include/ast/option.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/preroot.h b/usr/src/lib/libast/sparcv9/include/ast/preroot.h index 43cc7b8567..9a1db7b8dd 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/preroot.h +++ b/usr/src/lib/libast/sparcv9/include/ast/preroot.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -19,7 +19,7 @@ * Phong Vo <kpv@research.att.com> * * * ***********************************************************************/ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/proc.h b/usr/src/lib/libast/sparcv9/include/ast/proc.h index 2bfa576970..219f0d5884 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/proc.h +++ b/usr/src/lib/libast/sparcv9/include/ast/proc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/re_comp.h b/usr/src/lib/libast/sparcv9/include/ast/re_comp.h index 381bc801fc..e8d425d1c0 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/re_comp.h +++ b/usr/src/lib/libast/sparcv9/include/ast/re_comp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/recfmt.h b/usr/src/lib/libast/sparcv9/include/ast/recfmt.h index 133e37da41..acdb18df36 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/recfmt.h +++ b/usr/src/lib/libast/sparcv9/include/ast/recfmt.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/regex.h b/usr/src/lib/libast/sparcv9/include/ast/regex.h index b1a8976991..1fcd12d298 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/regex.h +++ b/usr/src/lib/libast/sparcv9/include/ast/regex.h @@ -53,6 +53,8 @@ #define REG_SHELL_ESCAPED 0x00400000 /* \ not special */ #define REG_SHELL_PATH 0x00800000 /* explicit / match */ +#define REG_REGEXP 0x40000000 /* <regexp.h> compatibility */ + /* regexec flags */ #define REG_NOTBOL 0x00000040 /* ^ is not a special char */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/regexp.h b/usr/src/lib/libast/sparcv9/include/ast/regexp.h index e1c6258b3e..89e0d3a875 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/regexp.h +++ b/usr/src/lib/libast/sparcv9/include/ast/regexp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/sfdisc.h b/usr/src/lib/libast/sparcv9/include/ast/sfdisc.h index 5303d9a62e..ce1ed6e052 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/sfdisc.h +++ b/usr/src/lib/libast/sparcv9/include/ast/sfdisc.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/sfio.h b/usr/src/lib/libast/sparcv9/include/ast/sfio.h index 11317dad65..3506f5c955 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/sfio.h +++ b/usr/src/lib/libast/sparcv9/include/ast/sfio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -48,6 +48,7 @@ typedef ssize_t (*Sfread_f)_ARG_((Sfio_t*, Void_t*, size_t, Sfdisc_t*)); typedef ssize_t (*Sfwrite_f)_ARG_((Sfio_t*, const Void_t*, size_t, Sfdisc_t*)); typedef Sfoff_t (*Sfseek_f)_ARG_((Sfio_t*, Sfoff_t, int, Sfdisc_t*)); typedef int (*Sfexcept_f)_ARG_((Sfio_t*, int, Void_t*, Sfdisc_t*)); +typedef int (*Sfwalk_f)_ARG_((Sfio_t*, Void_t*)); /* discipline structure */ struct _sfdisc_s @@ -232,6 +233,7 @@ extern Sfio_t* sfpopen _ARG_((Sfio_t*, const char*, const char*)); extern Sfio_t* sfstack _ARG_((Sfio_t*, Sfio_t*)); extern Sfio_t* sfswap _ARG_((Sfio_t*, Sfio_t*)); extern Sfio_t* sftmp _ARG_((size_t)); +extern int sfwalk _ARG_((Sfwalk_f, Void_t*, int)); extern int sfpurge _ARG_((Sfio_t*)); extern int sfpoll _ARG_((Sfio_t**, int, int)); extern Void_t* sfreserve _ARG_((Sfio_t*, ssize_t, int)); diff --git a/usr/src/lib/libast/sparcv9/include/ast/sfio_s.h b/usr/src/lib/libast/sparcv9/include/ast/sfio_s.h index 19a23d4772..46b2348b9c 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/sfio_s.h +++ b/usr/src/lib/libast/sparcv9/include/ast/sfio_s.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/sfio_t.h b/usr/src/lib/libast/sparcv9/include/ast/sfio_t.h index c5251d3f34..5c819865c8 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/sfio_t.h +++ b/usr/src/lib/libast/sparcv9/include/ast/sfio_t.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/shcmd.h b/usr/src/lib/libast/sparcv9/include/ast/shcmd.h index 14e282a3d0..f59834ad80 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/shcmd.h +++ b/usr/src/lib/libast/sparcv9/include/ast/shcmd.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -75,18 +75,19 @@ typedef struct Shbltin_s # 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) +# define sh_context(c) ((Shbltin_t*)(c)) +# define sh_run(c, ac, av) ((c)?(*sh_context(c)->shrun)(ac,av):-1) +# define sh_system(c,str) ((c)?(*sh_context(c)->shtrap)(str,0):system(str)) +# define sh_exit(c,n) ((c)?(*sh_context(c)->shexit)(n):exit(n)) +# define sh_checksig(c) ((c) && sh_context(c)->sigset) # if defined(SFIO_VERSION) || defined(_AST_H) # define LIB_INIT(c) # else -# define LIB_INIT(c) ((c) && (((Shbltin_t*)(c))->nosfio = 1)) +# define LIB_INIT(c) ((c) && (sh_context(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) + (sh_context(c)->notify = ((flg)&ERROR_NOTIFY)?1:0);} while(0) # endif #endif diff --git a/usr/src/lib/libast/sparcv9/include/ast/sig.h b/usr/src/lib/libast/sparcv9/include/ast/sig.h index a095a0cf26..8025730eed 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/sig.h +++ b/usr/src/lib/libast/sparcv9/include/ast/sig.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparcv9/include/ast/stack.h b/usr/src/lib/libast/sparcv9/include/ast/stack.h index 5c55255f06..64bda47ad0 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/stack.h +++ b/usr/src/lib/libast/sparcv9/include/ast/stack.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/stak.h b/usr/src/lib/libast/sparcv9/include/ast/stak.h index 321be20328..3e867b0b7d 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/stak.h +++ b/usr/src/lib/libast/sparcv9/include/ast/stak.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/stdio.h b/usr/src/lib/libast/sparcv9/include/ast/stdio.h index 42d7ed8269..2053ba8b27 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/stdio.h +++ b/usr/src/lib/libast/sparcv9/include/ast/stdio.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/stk.h b/usr/src/lib/libast/sparcv9/include/ast/stk.h index ef9a946ce0..ae2684f36d 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/stk.h +++ b/usr/src/lib/libast/sparcv9/include/ast/stk.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/swap.h b/usr/src/lib/libast/sparcv9/include/ast/swap.h index 81e49db105..96c2f79d74 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/swap.h +++ b/usr/src/lib/libast/sparcv9/include/ast/swap.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/tar.h b/usr/src/lib/libast/sparcv9/include/ast/tar.h index 3a9a99b0ac..04f5586481 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/tar.h +++ b/usr/src/lib/libast/sparcv9/include/ast/tar.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/times.h b/usr/src/lib/libast/sparcv9/include/ast/times.h index 1ed0f2135a..db0725a35c 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/times.h +++ b/usr/src/lib/libast/sparcv9/include/ast/times.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/tm.h b/usr/src/lib/libast/sparcv9/include/ast/tm.h index 29c0d4f1fa..154615088f 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/tm.h +++ b/usr/src/lib/libast/sparcv9/include/ast/tm.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -102,8 +102,9 @@ #define TM_ERA_YEAR 115 #define TM_ORDINALS 116 #define TM_FINAL 126 +#define TM_WORK 129 -#define TM_NFORM 129 +#define TM_NFORM 132 typedef struct /* leap second info */ { @@ -123,7 +124,7 @@ typedef struct /* time zone info */ typedef struct /* tm library readonly data */ { char** format; /* default TM_* format strings */ - char* lex; /* format lex type classes */ + unsigned char* lex; /* format lex type classes */ char* digit; /* output digits */ short* days; /* days in month i */ short* sum; /* days in months before i */ diff --git a/usr/src/lib/libast/sparcv9/include/ast/tmx.h b/usr/src/lib/libast/sparcv9/include/ast/tmx.h index c8a9b7477f..7471b3ac15 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/tmx.h +++ b/usr/src/lib/libast/sparcv9/include/ast/tmx.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -129,12 +129,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/sparcv9/include/ast/tok.h b/usr/src/lib/libast/sparcv9/include/ast/tok.h index 1d5112837c..8850458e9a 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/tok.h +++ b/usr/src/lib/libast/sparcv9/include/ast/tok.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/tv.h b/usr/src/lib/libast/sparcv9/include/ast/tv.h index 94d87c22b3..870ef5e538 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/tv.h +++ b/usr/src/lib/libast/sparcv9/include/ast/tv.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ ***********************************************************************/ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/include/ast/usage.h b/usr/src/lib/libast/sparcv9/include/ast/usage.h index d969a0e4c1..e2bea60f9c 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/usage.h +++ b/usr/src/lib/libast/sparcv9/include/ast/usage.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/vdb.h b/usr/src/lib/libast/sparcv9/include/ast/vdb.h index ba47e14901..f800446d5f 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/vdb.h +++ b/usr/src/lib/libast/sparcv9/include/ast/vdb.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/vecargs.h b/usr/src/lib/libast/sparcv9/include/ast/vecargs.h index 121e9d5010..8b567d5d5d 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/vecargs.h +++ b/usr/src/lib/libast/sparcv9/include/ast/vecargs.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/vmalloc.h b/usr/src/lib/libast/sparcv9/include/ast/vmalloc.h index 8cf3e9b974..0115078cf5 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/vmalloc.h +++ b/usr/src/lib/libast/sparcv9/include/ast/vmalloc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/wait.h b/usr/src/lib/libast/sparcv9/include/ast/wait.h index 08160043fa..bb690a2ee4 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/wait.h +++ b/usr/src/lib/libast/sparcv9/include/ast/wait.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/wchar.h b/usr/src/lib/libast/sparcv9/include/ast/wchar.h index 7796480d09..5bd6aa3ba8 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/wchar.h +++ b/usr/src/lib/libast/sparcv9/include/ast/wchar.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/include/ast/wordexp.h b/usr/src/lib/libast/sparcv9/include/ast/wordexp.h index c3f97b37d9..0ae7e93e99 100644 --- a/usr/src/lib/libast/sparcv9/include/ast/wordexp.h +++ b/usr/src/lib/libast/sparcv9/include/ast/wordexp.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/align b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/align index 47a9dd4cd7..f62317708d 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/align +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/align @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/botch b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/botch index 826811b6de..1b1f3a41c0 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/botch +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/botch @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/ccode b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/ccode index af262d71e8..78aed4b6ac 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/ccode +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/ccode @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/common b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/common index b8458bb017..827eab96c2 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/common +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/common @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -156,9 +156,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (p) /* pass va_list to varargs function */ -#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -166,6 +163,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (p) /* pass va_list to varargs function */ +#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/dirent b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/dirent index 0fced82d9e..e089bbefa2 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/dirent +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/dirent @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/eaccess b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/eaccess index 8cd966b6e6..0669111107 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/eaccess +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/eaccess @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/eaccess by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/eaccess by iffe version 2009-10-06 : : */ #ifndef _def_eaccess_ast #define _def_eaccess_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/errno b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/errno index c0c3262ab1..ee9b847216 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/errno +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/errno @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/errno by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/errno by iffe version 2009-10-06 : : */ #ifndef _def_errno_ast #define _def_errno_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/fcntl b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/fcntl index cbc1b8ade8..1af42562ca 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/fcntl +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/fcntl @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/float b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/float index 282df4d035..cb94fe0b9f 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/float +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/float @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/fs b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/fs index 7548ff404e..169eb70204 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/fs +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/fs @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -75,7 +75,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/hack b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/hack index a430fbeeea..0d716635cb 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/hack +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/hack @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/hack by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/hack by iffe version 2009-10-06 : : */ #ifndef _def_hack_ast #define _def_hack_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/iconv b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/iconv index c6c5d452bf..2062ba6ae1 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/iconv +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/iconv @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/isoc99 b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/isoc99 index 96b9949b89..79c93b2fc4 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/isoc99 +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/isoc99 @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/isoc99 by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/isoc99 by iffe version 2009-10-06 : : */ #ifndef _def_isoc99_ast #define _def_isoc99_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/lib b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/lib index ff4a6baa81..1ecf711728 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/lib +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/lib @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -120,7 +120,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/libpath b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/libpath index 9bbb2a1b69..e061abd223 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/libpath +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/libpath @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/libpath.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/libpath.sh by iffe version 2009-10-06 : : */ #ifndef _def_libpath_ast #define _def_libpath_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/limits b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/limits index 0e62d36fb7..29541b28d5 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/limits +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/limits @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/map b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/map index 98bb09fcef..e8c3169102 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/map +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/map @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -198,6 +198,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/mmap b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/mmap index 310a5aed05..55b3ff469e 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/mmap +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/mmap @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -7,6 +7,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/mode b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/mode index 6d4729935b..c075013b77 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/mode +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/mode @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/ndbm b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/ndbm index 42bec1ff86..2ebf428b23 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/ndbm +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/ndbm @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/nl_types b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/nl_types index 7babd03ed3..540a2070e5 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/nl_types +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/nl_types @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/omitted b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/omitted index 409dbefe47..9037895d0a 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/omitted +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/omitted @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/omitted by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/omitted by iffe version 2009-10-06 : : */ #ifndef _def_omitted_ast #define _def_omitted_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/param b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/param index 12a9a5c76c..ef85fba2b0 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/param +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/param @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/preroot b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/preroot index 1f65b6c24d..20da834210 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/preroot +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/preroot @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/prog b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/prog new file mode 100644 index 0000000000..374aed0f47 --- /dev/null +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/prog @@ -0,0 +1,7 @@ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/prog by iffe version 2009-10-06 : : */ +#ifndef _def_prog_ast +#define _def_prog_ast 1 +#define _sys_types 1 /* #include <sys/types.h> ok */ +#define _lib_getexecname 1 /* getexecname() in default lib(s) */ +#define _PROC_PROG "/proc/self/path/a.out" +#endif diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sfinit b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sfinit index 7e6f16e370..973c3bb9ae 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sfinit +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sfinit @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/sfinit.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/sfinit.c by iffe version 2009-10-06 : : */ #ifndef _def_sfinit_ast #define _def_sfinit_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sfio b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sfio index f9da74edd7..fbca3f07c0 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sfio +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sfio @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/sfio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/sfio by iffe version 2009-10-06 : : */ #ifndef _def_sfio_ast #define _def_sfio_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sig b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sig index 0af59f7f3a..93e9f11dab 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sig +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sig @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/siglist b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/siglist index 58c2f0c016..ea32c8e5f0 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/siglist +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/siglist @@ -1,10 +1,13 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/siglist by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/siglist by iffe version 2009-10-06 : : */ #ifndef _def_siglist_ast #define _def_siglist_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ #define _hdr_string 1 /* #include <string.h> ok */ #define _hdr_signal 1 /* #include <signal.h> ok */ #define _lib_strsignal 1 /* strsignal() in default lib(s) */ +#if defined(SIGHUP) && !defined(HAD_SIGHUP) +0,"HUP",SIGHUP, +#endif #if defined(SIGINT) && !defined(HAD_SIGINT) 0,"INT",SIGINT, #endif diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/signal b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/signal index 907ccd9782..850142e01d 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/signal +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/signal @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/signal.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/signal.c by iffe version 2009-10-06 : : */ #ifndef _def_signal_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/standards b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/standards index 79a23337bf..2af2a12db9 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/standards +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/standards @@ -1,26 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/stdio b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/stdio index bb1b0953c4..6df00bdc50 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/stdio +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/stdio @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sys b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sys index 40bdd3f74d..37f473d50a 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sys +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/sys @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -104,7 +104,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/time b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/time index 701c9d785f..cb6df6caf0 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/time +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/time @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tmlib b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tmlib index 6361871dc1..3b069d0dcc 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tmlib +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tmlib @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/tmlib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/tmlib by iffe version 2009-10-06 : : */ #ifndef _def_tmlib_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tmx b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tmx index d08369abf8..e033082b3b 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tmx +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tmx @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -108,12 +108,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tty b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tty index 4e0a72ed3f..14ad85f134 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tty +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tty @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tv b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tv index 765511125b..82ff72affb 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tv +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tv @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tvlib b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tvlib index 4a32d75885..f1bec737d9 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tvlib +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/tvlib @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/tvlib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/tvlib by iffe version 2009-10-06 : : */ #ifndef _def_tvlib_ast #define _def_tvlib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/uwin b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/uwin index e69ca63ac6..77ae8f2992 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/uwin +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/uwin @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/uwin by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/uwin by iffe version 2009-10-06 : : */ #ifndef _def_uwin_ast #define _def_uwin_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/vfork b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/vfork index e5adaaa12b..476213e1c1 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/vfork +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/vfork @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/vmalloc b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/vmalloc index 809dd009a8..5828823987 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/vmalloc +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/vmalloc @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/vmalloc by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/vmalloc by iffe version 2009-10-06 : : */ #ifndef _def_vmalloc_ast #define _def_vmalloc_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/wait b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/wait index 9371585de4..d8d97504ec 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/wait +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/wait @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/wchar b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/wchar index a5f734dd1a..20b0daad3f 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/wchar +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/wchar @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/align.h b/usr/src/lib/libast/sparcv9/src/lib/libast/align.h index 47a9dd4cd7..f62317708d 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/align.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/align.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/align.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/align.c by iffe version 2009-10-06 : : */ #ifndef _def_align_ast #define _def_align_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_botch.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_botch.h index 826811b6de..1b1f3a41c0 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_botch.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_botch.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/botch.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/botch.c by iffe version 2009-10-06 : : */ #ifndef _def_botch_ast #define _def_botch_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_ccode.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_ccode.h index af262d71e8..78aed4b6ac 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_ccode.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_ccode.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/ccode by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/ccode by iffe version 2009-10-06 : : */ #ifndef _def_ccode_ast #define _def_ccode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_common.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_common.h index 6485009f1e..2ae83984e8 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_common.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_common.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/common by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/common by iffe version 2009-10-06 : : */ #ifndef _AST_COMMON_H #define _AST_COMMON_H 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -156,9 +156,6 @@ #define _typ_uintmax_t 1 /* uintmax_t is a type */ #ifndef va_listref -#define va_listref(p) (p) /* pass va_list to varargs function */ -#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ -#define va_listarg va_list /* va_arg() va_list type */ #ifndef va_start #if __STD_C #include <stdarg.h> @@ -166,6 +163,9 @@ #include <varargs.h> #endif #endif +#define va_listref(p) (p) /* pass va_list to varargs function */ +#define va_listval(p) (p) /* retrieve va_list from va_arg(ap,va_listarg) */ +#define va_listarg va_list /* va_arg() va_list type */ #endif #ifndef _AST_STD_H # if __STD_C && _hdr_stddef diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_dirent.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_dirent.h index 0fced82d9e..e089bbefa2 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_dirent.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_dirent.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/dirent by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/dirent by iffe version 2009-10-06 : : */ #ifndef _def_dirent_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_fcntl.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_fcntl.h index cbc1b8ade8..1af42562ca 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_fcntl.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_fcntl.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/fcntl.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/fcntl.c by iffe version 2009-10-06 : : */ #ifndef _def_fcntl_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_float.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_float.h index 282df4d035..cb94fe0b9f 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_float.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_float.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/float by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/float by iffe version 2009-10-06 : : */ #ifndef _def_float_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_fs.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_fs.h index 7548ff404e..169eb70204 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_fs.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_fs.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/fs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/fs by iffe version 2009-10-06 : : */ #ifndef _def_fs_ast #if !defined(__PROTO__) @@ -75,7 +75,6 @@ __STDPP__directive pragma pp:noinitial #endif #define _hdr_stdio 1 /* #include <stdio.h> ok */ #define _sys_mntent 1 /* #include <sys/mntent.h> ok */ -#define _sys_mnttab 1 /* #include <sys/mnttab.h> ok */ #define _mem_st_blocks_stat 1 /* st_blocks is a member of struct stat */ #define _mem_st_blksize_stat 1 /* st_blksize is a member of struct stat */ #define _mem_st_rdev_stat 1 /* st_rdev is a member of struct stat */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_iconv.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_iconv.h index c6c5d452bf..2062ba6ae1 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_iconv.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_iconv.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/iconv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/iconv by iffe version 2009-10-06 : : */ #ifndef _def_iconv_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_lib.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_lib.h index ff4a6baa81..1ecf711728 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_lib.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_lib.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/lib by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/lib by iffe version 2009-10-06 : : */ #ifndef _def_lib_ast #define _def_lib_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -120,7 +120,6 @@ #define _sys_filio 1 /* #include <sys/filio.h> ok */ #define _sys_jioctl 1 /* #include <sys/jioctl.h> ok */ #define _sys_localedef 1 /* #include <sys/localedef.h> ok */ -#define _sys_ptem 1 /* #include <sys/ptem.h> ok */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _sys_stream 1 /* #include <sys/stream.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_limits.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_limits.h index 0e62d36fb7..29541b28d5 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_limits.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_limits.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/limits.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/limits.c by iffe version 2009-10-06 : : */ #ifndef _def_limits_ast #define _def_limits_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_map.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_map.h index 98bb09fcef..e8c3169102 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_map.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_map.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/map.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/map.c by iffe version 2009-10-06 : : */ #ifndef _def_map_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -198,6 +198,8 @@ extern __MANGLE__ char* mktemp __PROTO__((char*)); #define pathposix _ast_pathposix #undef pathprobe #define pathprobe _ast_pathprobe +#undef pathprog +#define pathprog _ast_pathprog #undef pathrepl #define pathrepl _ast_pathrepl #undef pathsetlink diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_mmap.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_mmap.h index 310a5aed05..55b3ff469e 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_mmap.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_mmap.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/mmap by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/mmap by iffe version 2009-10-06 : : */ #ifndef _def_mmap_ast #define _def_mmap_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ @@ -7,6 +7,7 @@ #define _lib_mmap64 1 /* mmap64 interface and implementation work */ #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +#define _mmap_worthy 2 /* mmap is good */ /* some systems get it wrong but escape concise detection */ #ifndef _NO_MMAP diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_mode.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_mode.h index 6d4729935b..c075013b77 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_mode.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_mode.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/mode.c by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/mode.c by iffe version 2009-10-06 : : */ #ifndef _def_mode_ast #define _def_mode_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_namval.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_namval.h new file mode 100644 index 0000000000..f8f65ab2cb --- /dev/null +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_namval.h @@ -0,0 +1,42 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1985-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* Phong Vo <kpv@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped +/* + * Glenn Fowler + * AT&T Research + * + * common name-value struct support + */ + +#ifndef _NAMVAL_H +#define _NAMVAL_H + +typedef struct +{ + char* name; + int value; +#ifdef _NAMVAL_PRIVATE_ + _NAMVAL_PRIVATE_ +#endif +} Namval_t; + +#endif diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_ndbm.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_ndbm.h index 42bec1ff86..2ebf428b23 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_ndbm.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_ndbm.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/ndbm by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/ndbm by iffe version 2009-10-06 : : */ #ifndef _def_ndbm_ast #define _def_ndbm_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_nl_types.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_nl_types.h index 7babd03ed3..540a2070e5 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_nl_types.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_nl_types.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/nl_types by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/nl_types by iffe version 2009-10-06 : : */ #ifndef _def_nl_types_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_param.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_param.h index 12a9a5c76c..ef85fba2b0 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_param.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_param.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/param.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/param.sh by iffe version 2009-10-06 : : */ #ifndef _def_param_ast #define _def_param_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_standards.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_standards.h index 79a23337bf..2af2a12db9 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_standards.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_standards.h @@ -1,26 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/standards by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/standards by iffe version 2009-10-06 : : */ #ifndef _def_standards_ast #define _def_standards_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -/* _ALL_SOURCE & _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE 1 -#endif -#ifndef _ISOC99_SOURCE -#define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_SOURCE -#define _POSIX_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 21000101L -#endif -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 9900 -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +/* __EXTENSIONS__ works */ #ifndef __EXTENSIONS__ #define __EXTENSIONS__ 1 #endif diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_stdio.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_stdio.h index bb1b0953c4..6df00bdc50 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_stdio.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_stdio.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/stdio by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/stdio by iffe version 2009-10-06 : : */ #ifndef _SFSTDIO_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_sys.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_sys.h index 40bdd3f74d..37f473d50a 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_sys.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_sys.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/sys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/sys by iffe version 2009-10-06 : : */ #ifndef _AST_SYS_H #if !defined(__PROTO__) @@ -104,7 +104,6 @@ #include <limits.h> #include <fcntl.h> #include <locale.h> -#include <sys/localedef.h> #define _hdr_time 1 /* #include <time.h> ok */ #define _sys_time 1 /* #include <sys/time.h> ok */ #define _sys_times 1 /* #include <sys/times.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_time.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_time.h index 701c9d785f..cb6df6caf0 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_time.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_time.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_tty.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_tty.h index 4e0a72ed3f..14ad85f134 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_tty.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_tty.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/tty by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/tty by iffe version 2009-10-06 : : */ #ifndef _def_tty_ast #define _def_tty_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_vfork.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_vfork.h index e5adaaa12b..476213e1c1 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_vfork.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_vfork.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/vfork by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/vfork by iffe version 2009-10-06 : : */ #ifndef _def_vfork_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_wait.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_wait.h index 9371585de4..d8d97504ec 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_wait.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_wait.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/wait by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/wait by iffe version 2009-10-06 : : */ #ifndef _def_wait_ast #define _def_wait_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_wchar.h b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_wchar.h index a5f734dd1a..20b0daad3f 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/ast_wchar.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/ast_wchar.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/wchar by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/wchar by iffe version 2009-10-06 : : */ #ifndef _def_wchar_ast #if !defined(__PROTO__) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/conftab.c b/usr/src/lib/libast/sparcv9/src/lib/libast/conftab.c index a9a530c64b..cca6463dd1 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/conftab.c +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/conftab.c @@ -10,7 +10,7 @@ #include "FEATURE/param" #include "conftab.h" -/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/comp/conf.tab : : */ +/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/comp/conf.tab : : */ /* * prefix strings -- the first few are indexed by Conf_t.standard @@ -207,6 +207,7 @@ const Conf_t conf[] = { "NL_TEXTMAX", { 0UL, 0 }, { 0UL, 0 }, CONF_LIMIT, CONF_XOPEN, 1, CONF_nop, -1 }, { "NO_TRUNC", { 0UL, 0 }, { 0UL, 0 }, CONF_FEATURE|CONF_UNDERSCORE|CONF_PREFIX_ONLY, CONF_POSIX, 1, CONF_pathconf, _PC_NO_TRUNC }, { "NPROCESSORS_CONF", { 0UL, 0 }, { 0UL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_CONF }, +{ "NPROCESSORS_MAX", { 0UL, 0 }, { 0UL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_MAX }, { "NPROCESSORS_ONLN", { 0UL, 0 }, { 0UL, 0 }, 0, CONF_SVID, 1, CONF_sysconf, _SC_NPROCESSORS_ONLN }, { "NPROC_CONF", { 0UL, 0 }, { 0UL, 0 }, CONF_FEATURE|CONF_UNDERSCORE, CONF_POSIX, 1, CONF_nop, -1 }, { "NPROC_ONLN", { 0UL, 0 }, { 0UL, 0 }, CONF_FEATURE|CONF_UNDERSCORE, CONF_POSIX, 1, CONF_nop, -1 }, diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/conftab.h b/usr/src/lib/libast/sparcv9/src/lib/libast/conftab.h index 6306df6d31..59c7b1b69d 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/conftab.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/conftab.h @@ -6,7 +6,7 @@ #endif #include <sys/systeminfo.h> -/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/comp/conf.tab : : */ +/* : : generated by conf from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/comp/conf.tab : : */ #if !defined(const) && !defined(__STDC__) && !defined(__cplusplus) && !defined(c_plusplus) #define const diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/lc.h b/usr/src/lib/libast/sparcv9/src/lib/libast/lc.h index b225864bbc..da06a59ba4 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/lc.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/lc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1985-2008 AT&T Intellectual Property * +* Copyright (c) 1985-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -38,14 +38,15 @@ #define LC_abbreviated 0x00001 #define LC_checked 0x00002 -#define LC_default 0x00004 -#define LC_defined 0x00008 -#define LC_debug 0x00010 +#define LC_debug 0x00004 +#define LC_default 0x00008 +#define LC_defined 0x00010 #define LC_local 0x00020 #define LC_primary 0x00040 #define LC_qualified 0x00080 #define LC_undefined 0x00100 -#define LC_verbose 0x00200 +#define LC_utf8 0x00200 +#define LC_verbose 0x00400 #define LC_user 0x10000 #define LC_language_attribute_max 2 #define LC_territory_language_max 4 diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/preroot.h b/usr/src/lib/libast/sparcv9/src/lib/libast/preroot.h index 1f65b6c24d..20da834210 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/preroot.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/preroot.h @@ -1,4 +1,4 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/preroot.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/preroot.sh by iffe version 2009-10-06 : : */ #ifndef _def_preroot_ast #define _def_preroot_ast 1 #define _sys_types 1 /* #include <sys/types.h> ok */ diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/sig.h b/usr/src/lib/libast/sparcv9/src/lib/libast/sig.h index 0af59f7f3a..93e9f11dab 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/sig.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/sig.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/sig.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/sig.sh by iffe version 2009-10-06 : : */ #ifndef _def_sig_ast #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/tmx.h b/usr/src/lib/libast/sparcv9/src/lib/libast/tmx.h index d08369abf8..e033082b3b 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/tmx.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/tmx.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/tmx by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/tmx by iffe version 2009-10-06 : : */ #ifndef _TMX_H #if !defined(__PROTO__) @@ -108,12 +108,14 @@ typedef uint32_t Tmxnsec_t; #endif extern __MANGLE__ Time_t tmxdate __PROTO__((const char*, char**, Time_t)); +extern __MANGLE__ Time_t tmxduration __PROTO__((const char*, char**)); extern __MANGLE__ char* tmxfmt __PROTO__((char*, size_t, const char*, Time_t)); extern __MANGLE__ Time_t tmxleap __PROTO__((Time_t)); extern __MANGLE__ Tm_t* tmxmake __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long)); extern __MANGLE__ int tmxsleep __PROTO__((Time_t)); extern __MANGLE__ Time_t tmxtime __PROTO__((Tm_t*, int)); +extern __MANGLE__ Tm_t* tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*)); extern __MANGLE__ Time_t tmxgettime __PROTO__((void)); extern __MANGLE__ int tmxsettime __PROTO__((Time_t)); diff --git a/usr/src/lib/libast/sparcv9/src/lib/libast/tv.h b/usr/src/lib/libast/sparcv9/src/lib/libast/tv.h index 765511125b..82ff72affb 100644 --- a/usr/src/lib/libast/sparcv9/src/lib/libast/tv.h +++ b/usr/src/lib/libast/sparcv9/src/lib/libast/tv.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libast/features/tv by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libast/features/tv by iffe version 2009-10-06 : : */ #ifndef _TV_H #if !defined(__PROTO__) diff --git a/usr/src/lib/libcmd/Makefile.com b/usr/src/lib/libcmd/Makefile.com index 2b9873103c..c11a682638 100644 --- a/usr/src/lib/libcmd/Makefile.com +++ b/usr/src/lib/libcmd/Makefile.com @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -44,6 +44,7 @@ OBJECTS = \ date.o \ dirname.o \ expr.o \ + grep.o \ fds.o \ fmt.o \ fold.o \ @@ -56,6 +57,7 @@ OBJECTS = \ md5sum.o \ mkdir.o \ mkfifo.o \ + mktemp.o \ mv.o \ paste.o \ pathchk.o \ @@ -112,6 +114,7 @@ CPPFLAGS = \ -I../common \ -Isrc/lib/libcmd \ -I$(ROOT)/usr/include/ast \ + -I$(ROOT)/usr/include \ -D_BLD_cmd \ -D_PACKAGE_ast \ -D_BLD_DLL \ @@ -119,7 +122,7 @@ CPPFLAGS = \ '-DUSAGE_LICENSE=\ "[-author?Glenn Fowler <gsf@research.att.com>]"\ "[-author?David Korn <dgk@research.att.com>]"\ - "[-copyright?Copyright (c) 1992-2008 AT&T Intellectual Property]"\ + "[-copyright?Copyright (c) 1992-2009 AT&T Intellectual Property]"\ "[-license?http://www.opensource.org/licenses/cpl1.0.txt]"\ "[--catalog?libcmd]"' diff --git a/usr/src/lib/libcmd/amd64/include/ast/cmd.h b/usr/src/lib/libcmd/amd64/include/ast/cmd.h index 9ac1c90993..f149f8d275 100644 --- a/usr/src/lib/libcmd/amd64/include/ast/cmd.h +++ b/usr/src/lib/libcmd/amd64/include/ast/cmd.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -44,6 +44,8 @@ #define cmdinit _cmd_init +#define ERROR_CALLBACK ERROR_SET + #if _BLD_cmd && defined(__EXPORT__) #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ __EXPORT__ @@ -96,7 +98,7 @@ cmdinit __PARAM__((int argc, register char** argv, __V_* context, const char* ca error_info.catalog = (char*)catalog; opt_info.index = 0; if (context) - error_info.flags |= flags; + error_info.flags |= flags & ~(ERROR_CALLBACK|ERROR_NOTIFY); return 0; } diff --git a/usr/src/lib/libcmd/amd64/include/ast/cmdext.h b/usr/src/lib/libcmd/amd64/include/ast/cmdext.h index 602f8d7a7d..416a3dc5a5 100644 --- a/usr/src/lib/libcmd/amd64/include/ast/cmdext.h +++ b/usr/src/lib/libcmd/amd64/include/ast/cmdext.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -39,11 +39,14 @@ extern __MANGLE__ int b_cp __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_cut __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_date __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_dirname __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_egrep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_expr __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fds __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_fgrep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fmt __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fold __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_getconf __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_grep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_head __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_id __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_join __PROTO__((int, char**, __V_*)); @@ -52,11 +55,13 @@ extern __MANGLE__ int b_logname __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_md5sum __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mkdir __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mkfifo __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_mktemp __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mv __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_paste __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_pathchk __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_pids __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rev __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_readlink __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rm __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rmdir __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_stty __PROTO__((int, char**, __V_*)); @@ -68,3 +73,4 @@ extern __MANGLE__ int b_tty __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_uname __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_uniq __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_wc __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_xgrep __PROTO__((int, char**, __V_*)); diff --git a/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/ids b/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/ids index 4edd14f3cf..4b285da2a7 100644 --- a/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/ids +++ b/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/ids @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libcmd/features/ids by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libcmd/features/ids by iffe version 2009-10-06 : : */ #ifndef _def_ids_cmd #define _def_ids_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_endgrent 1 /* endgrent() in default lib(s) */ #define _lib_getgrent 1 /* getgrent() in default lib(s) */ diff --git a/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/sockets b/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/sockets index 90b55e7c99..febcb42135 100644 --- a/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/sockets +++ b/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/sockets @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libcmd/features/sockets by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libcmd/features/sockets by iffe version 2009-10-06 : : */ #ifndef _def_sockets_cmd #define _def_sockets_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _hdr_arpa_inet 1 /* #include <arpa/inet.h> ok */ diff --git a/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/symlink b/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/symlink index 43ae73a5c4..3426d54558 100644 --- a/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/symlink +++ b/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/symlink @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libcmd/features/symlink by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libcmd/features/symlink by iffe version 2009-10-06 : : */ #ifndef _def_symlink_cmd #define _def_symlink_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_lchown 1 /* lchown implemented */ #endif diff --git a/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/utsname b/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/utsname index b6cb394d64..482658f139 100644 --- a/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/utsname +++ b/usr/src/lib/libcmd/amd64/src/lib/libcmd/FEATURE/utsname @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libcmd/features/utsname by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libcmd/features/utsname by iffe version 2009-10-06 : : */ #ifndef _def_utsname_cmd #define _def_utsname_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_getdomainname 1 /* getdomainname() in default lib(s) */ #define _lib_gethostid 1 /* gethostid() in default lib(s) */ diff --git a/usr/src/lib/libcmd/common/RELEASE b/usr/src/lib/libcmd/common/RELEASE index 6300890d12..ebda670177 100644 --- a/usr/src/lib/libcmd/common/RELEASE +++ b/usr/src/lib/libcmd/common/RELEASE @@ -1,3 +1,34 @@ +09-09-09 fds.c: add --unit=fd +09-08-25 tail.c: initialize Tail_t.fifo=0 !! +09-08-15 tail.c: fix fifo logic +09-08-11 wc.c: add setlocale(LC_CTYPE,"C") cleanup, add utf8 optimzations +09-08-10 uniq.c: replace -c 1..9999 sfsprintf() with inline conversion +09-08-01 join.c: fix empty field null pointer deref +09-07-23 pathchk.c: add -P,--path and -a,--all +09-07-02 chgrp.c,chmod.c,cksum.c: fts_flags() default only if not --recursive +09-06-19 cmd.h,cmdinit.c: add ERROR_CALLBACK for ERROR_NOTIFY main() callback +09-06-19 mktemp.c: --unsafe now checks and prints path but does create +09-06-19 tee.c: add ERROR_CALLBACK for tee_cleanup() sfio discipline pop +09-06-18 rm.c: handle interrupts during interactive query +09-06-18 cp.c: handle interrupts during interactive query +09-05-25 tail.c: fix old style option logic to handle --invalid-long-option +09-05-24 tail.c: -r == +1r +09-05-01 mktemp.c: handle foo/prefix, add -p dir and -u +09-03-31 cat.c: handle --no* options +09-03-15 tail.c: fix --timeout termination logic +09-03-03 tee.c: clean up sfio disciplines on error +09-03-03 cat.c: fix -v|-e|-n|-B interaction bugs +09-02-14 tail.c: fix VSC failures +09-02-14 join.c: fix VSC failure +09-02-02 uniq.c: document -number == -fnumber, +number == -snumber +09-02-02 tail.c: fix usage[] for negative offsets, add sun -b +09-02-02 mktemp.c: add +09-02-02 features/utsname: UWIN _UNAME_os_DEFAULT => UWIN +09-01-31 dirname.c: add experimental { -f -r -x } for pathpath(3) +09-01-05 cmp.c: fix EOF diagnostic to conform to posix +09-01-03 mkfifo.c: fix --mode=mode logic +08-12-07 date.c: add %[_][EO]K for [space pad] [full|long] iso docs +08-11-10 stty.c: check for -t grouping so -tostop != -t -ostop 08-10-15 rm.c: handle 'rm -f x x' => exit 0 08-09-08 stty.c: #ifdef guard TAB[012] -- freebsd: damn the posix, full speed ahead 08-06-17 shcmd.h: move to libast @@ -169,7 +200,7 @@ 00-10-31 mkdir: handle races by checking EEXIST 00-09-20 cp: copy argv to stack before modifying in place 00-05-18 add setlocale(LC_ALL,"") -00-04-30 join: drop wierd opt_info.argv reference +00-04-30 join: drop weird opt_info.argv reference 00-03-17 expr: add == operator -- duh cp,ln,mv: delay pathcanon() on destination to verify `cp a b/.' getconf: use astgetconf for proper message control diff --git a/usr/src/lib/libcmd/common/basename.c b/usr/src/lib/libcmd/common/basename.c index c5c86aa154..2b59030483 100644 --- a/usr/src/lib/libcmd/common/basename.c +++ b/usr/src/lib/libcmd/common/basename.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/cat.c b/usr/src/lib/libcmd/common/cat.c index 76af2f2765..e451998cc2 100644 --- a/usr/src/lib/libcmd/common/cat.c +++ b/usr/src/lib/libcmd/common/cat.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -31,7 +31,7 @@ #include <fcntl.h> static const char usage[] = -"[-?\n@(#)$Id: cat (AT&T Research) 2007-07-17 $\n]" +"[-?\n@(#)$Id: cat (AT&T Research) 2009-03-31 $\n]" USAGE_LICENSE "[+NAME?cat - concatenate files]" "[+DESCRIPTION?\bcat\b copies each \afile\a in sequence to the standard" @@ -62,6 +62,7 @@ USAGE_LICENSE "[D:dos-output?Output files are opened in \atext\amode which inserts carriage" " returns in front of new-lines on some systems.]" "[E:show-ends?Causes a \b$\b to be inserted before each new-line.]" +"[R:regress?Regression test defaults: \b-v\b buffer size 4.]" "[S:silent?\bcat\b is silent about non-existent files.]" "[T:show-blank?Causes tabs to be copied as \b^I\b and formfeeds as \b^L\b.]" @@ -87,146 +88,306 @@ USAGE_LICENSE #define d_FLAG (1<<9) /* character types */ -#define T_ENDBUF 1 -#define T_CONTROL 2 -#define T_NEWLINE 3 -#define T_EIGHTBIT 4 -#define T_CNTL8BIT 5 +#define T_ERROR 1 +#define T_EOF 2 +#define T_ENDBUF 3 +#define T_NEWLINE 4 +#define T_CONTROL 5 +#define T_EIGHTBIT 6 +#define T_CNTL8BIT 7 #define printof(c) ((c)^0100) +typedef void* (*Reserve_f)(Sfio_t*, ssize_t, int); + +#ifndef sfvalue +#define sfvalue(f) ((f)->_val) +#endif + +static void* +regress(Sfio_t* sp, ssize_t n, int f) +{ + void* r; + + if (!(r = sfreserve(sp, 4, f))) + r = sfreserve(sp, n, f); + else if (sfvalue(sp) > 4) + sfvalue(sp) = 4; + return r; +} + /* * called for any special output processing */ static int -vcat(register char* states, Sfio_t *fdin, Sfio_t *fdout, int flags) +vcat(register char* states, Sfio_t* ip, Sfio_t* op, Reserve_f reserve, int flags) { register unsigned char* cp; - register unsigned char* cpold; + register unsigned char* pp; + unsigned char* cur; + unsigned char* end; + unsigned char* buf; + unsigned char* nxt; register int n; - register int m; - register int line = 1; - register unsigned char* endbuff; - unsigned char* inbuff; - int printdefer = (flags&(B_FLAG|N_FLAG)); - int lastchar; - int lastline; + register int line; + register int raw; + int last; + int c; + int m; + int any; + int header; unsigned char meta[4]; + unsigned char tmp[32]; meta[0] = 'M'; meta[1] = '-'; + last = -1; + *(cp = buf = end = tmp) = 0; + any = 0; + header = flags & (B_FLAG|N_FLAG); + line = 1; + states[0] = T_ENDBUF; + raw = !mbwide(); for (;;) { - /* read in a buffer full */ - if (!(inbuff = (unsigned char*)sfreserve(fdin, SF_UNBOUND, 0))) - return sfvalue(fdin) ? -1 : 0; - if ((n = sfvalue(fdin)) <= 0) - return n; - cp = inbuff; - lastchar = *(endbuff = cp + --n); - *endbuff = 0; - if (printdefer) + cur = cp; + if (raw) + while (!(n = states[*cp++])); + else + for (;;) + { + while (!(n = states[*cp++])); + if (n < T_CONTROL) + break; + if ((m = mbsize(pp = cp - 1)) > 1) + cp += m - 1; + else + { + if (m <= 0) + { + if (cur == pp) + { + if (last > 0) + { + *end = last; + last = -1; + c = end - pp + 1; + if ((m = mbsize(pp)) == c) + { + any = 1; + if (header) + { + header = 0; + sfprintf(op, "%6d\t", line); + } + sfwrite(op, cur, m); + *(cp = cur = end) = 0; + } + else + { + memcpy(tmp, pp, c); + if (!(nxt = (unsigned char*)(*reserve)(ip, SF_UNBOUND, 0))) + { + states[0] = sfvalue(ip) ? T_ERROR : T_EOF; + *(cp = end = tmp + sizeof(tmp) - 1) = 0; + last = -1; + } + else if ((n = sfvalue(ip)) <= 0) + { + states[0] = n ? T_ERROR : T_EOF; + *(cp = end = tmp + sizeof(tmp) - 1) = 0; + last = -1; + } + else + { + cp = buf = nxt; + end = buf + n - 1; + last = *end; + *end = 0; + } + mb: + if ((n = end - cp + 1) >= (sizeof(tmp) - c)) + n = sizeof(tmp) - c - 1; + memcpy(tmp + c, cp, n); + if ((m = mbsize(tmp)) >= c) + { + any = 1; + if (header) + { + header = 0; + sfprintf(op, "%6d\t", line); + } + sfwrite(op, tmp, m); + cur = cp += m - c; + } + } + continue; + } + } + else + { + cp = pp + 1; + n = 0; + } + } + break; + } + } + c = *--cp; + if ((m = cp - cur) || n >= T_CONTROL) { - if (states[*cp]!=T_NEWLINE || !(flags&B_FLAG)) - sfprintf(fdout,"%6d\t",line); - printdefer = 0; + flush: + any = 1; + if (header) + { + header = 0; + sfprintf(op, "%6d\t", line); + } + if (m) + sfwrite(op, cur, m); } - while (endbuff) + special: + switch (n) { - cpold = cp; - /* skip over printable characters */ - if (mbwide()) - while ((n = (m = mbsize(cp)) < 2 ? states[*cp++] : (cp += m, states['a'])) == 0); + case T_ERROR: + if (cp != end) + { + n = T_CONTROL; + goto flush; + } + return -1; + case T_EOF: + if (cp != end) + { + n = T_CONTROL; + goto flush; + } + return 0; + case T_ENDBUF: + if (cp != end) + { + n = T_CONTROL; + goto flush; + } + c = last; + if (!(nxt = (unsigned char*)(*reserve)(ip, SF_UNBOUND, 0))) + { + *(cp = end = tmp) = 0; + states[0] = sfvalue(ip) ? T_ERROR : T_EOF; + last = -1; + } + else if ((m = sfvalue(ip)) <= 0) + { + *(cp = end = tmp) = 0; + states[0] = m ? T_ERROR : T_EOF; + last = -1; + } else - while ((n = states[*cp++]) == 0); - if (n==T_ENDBUF) { - if (cp>endbuff) + buf = nxt; + end = buf + m - 1; + last = *end; + *end = 0; + cp = buf; + } + if (c >= 0) + { + if (!(n = states[c])) { - if (!(n = states[lastchar])) - { - *endbuff = lastchar; - cp++; - } - else - { - if (--cp > cpold) - sfwrite(fdout,(char*)cpold,cp-cpold); - if (endbuff==inbuff) - *++endbuff = 0; - cp = cpold = endbuff; - cp[-1] = lastchar; - if (n==T_ENDBUF) - n = T_CONTROL; - - } - endbuff = 0; + *(cur = tmp) = c; + m = 1; + goto flush; } - else n = T_CONTROL; + if (raw || n < T_CONTROL) + { + cp--; + goto special; + } + tmp[0] = c; + c = 1; + goto mb; } - if (--cp>cpold) - sfwrite(fdout,(char*)cpold,cp-cpold); - switch(n) + break; + case T_CONTROL: + do { - case T_CNTL8BIT: - meta[2] = '^'; - do - { - n = (*cp++)&~0200; - meta[3] = printof(n); - sfwrite(fdout,(char*)meta,4); - } - while ((n=states[*cp])==T_CNTL8BIT); - break; - case T_EIGHTBIT: - do - { - meta[2] = (*cp++)&~0200; - sfwrite(fdout,(char*)meta,3); - } - while ((n=states[*cp])==T_EIGHTBIT); - break; - case T_CONTROL: - do + sfputc(op, '^'); + sfputc(op, printof(c)); + } while (states[c = *++cp] == T_CONTROL); + break; + case T_CNTL8BIT: + meta[2] = '^'; + do + { + n = c & ~0200; + meta[3] = printof(n); + sfwrite(op, (char*)meta, 4); + } while (states[c = *++cp] == T_CNTL8BIT && raw); + break; + case T_EIGHTBIT: + do + { + meta[2] = c & ~0200; + sfwrite(op, (char*)meta, 3); + } while (states[c = *++cp] == T_EIGHTBIT && raw); + break; + case T_NEWLINE: + if (header && !(flags & B_FLAG)) + sfprintf(op, "%6d\t", line); + if (flags & E_FLAG) + sfputc(op, '$'); + sfputc(op, '\n'); + if (!header || !(flags & B_FLAG)) + line++; + header = !(flags & S_FLAG); + for (;;) + { + if ((n = states[*++cp]) == T_ENDBUF) + { + if (cp != end || last != '\n') + break; + if (!(nxt = (unsigned char*)(*reserve)(ip, SF_UNBOUND, 0))) { - n = *cp++; - sfputc(fdout,'^'); - sfputc(fdout,printof(n)); + states[0] = sfvalue(ip) ? T_ERROR : T_EOF; + cp = end = tmp; + *cp-- = 0; + last = -1; } - while ((n=states[*cp])==T_CONTROL); - break; - case T_NEWLINE: - lastline = line; - if (flags&S_FLAG) + else if ((n = sfvalue(ip)) <= 0) { - while (states[*++cp]==T_NEWLINE) - line++; - cp--; + states[0] = n ? T_ERROR : T_EOF; + cp = end = tmp; + *cp-- = 0; + last = -1; } - do + else { - cp++; - if (flags&E_FLAG) - sfputc(fdout,'$'); - sfputc(fdout,'\n'); - if(line > lastline) - { - if (flags&E_FLAG) - sfputc(fdout,'$'); - sfputc(fdout,'\n'); - } - if (!(flags&(N_FLAG|B_FLAG))) - continue; - line++; - if (cp < endbuff) - sfprintf(fdout,"%6d\t",line); - else printdefer = 1; + buf = nxt; + end = buf + n - 1; + last = *end; + *end = 0; + cp = buf - 1; } - while (states[*cp]==T_NEWLINE); + } + else if (n != T_NEWLINE) break; + if (!(flags & S_FLAG) || any || header) + { + any = 0; + header = 0; + if ((flags & (B_FLAG|N_FLAG)) == N_FLAG) + sfprintf(op, "%6d\t", line); + if (flags & E_FLAG) + sfputc(op, '$'); + sfputc(op, '\n'); + } + if (!(flags & B_FLAG)) + line++; } + header = flags & (B_FLAG|N_FLAG); + break; } } } @@ -239,60 +400,65 @@ b_cat(int argc, char** argv, void* context) register char* cp; register Sfio_t* fp; char* mode; + Reserve_f reserve = sfreserve; int att; - int dovcat=0; + int dovcat = 0; char states[UCHAR_MAX+1]; - NoP(argc); cmdinit(argc, argv, context, ERROR_CATALOG, 0); + setlocale(LC_ALL, ""); att = !strcmp(astconf("UNIVERSE", NiL, NiL), "att"); mode = "r"; for (;;) { + n = 0; switch (optget(argv, usage)) { case 'A': - flags |= T_FLAG|E_FLAG|V_FLAG; - continue; + n = T_FLAG|E_FLAG|V_FLAG; + break; case 'B': - flags |= S_FLAG; - continue; + n = S_FLAG; + break; case 'b': - flags |= B_FLAG; + n = B_FLAG; + break; + case 'd': + mode = opt_info.num ? "rt" : "r"; continue; + case 'D': + n = d_FLAG; + break; case 'E': - flags |= E_FLAG; - continue; + n = E_FLAG; + break; case 'e': - flags |= E_FLAG|V_FLAG; - continue; + n = E_FLAG|V_FLAG; + break; case 'n': - flags |= N_FLAG; + n = N_FLAG; + break; + case 'R': + reserve = opt_info.num ? regress : sfreserve; continue; case 's': - flags |= att ? F_FLAG : S_FLAG; - continue; + n = att ? F_FLAG : S_FLAG; + break; case 'S': - flags |= F_FLAG; - continue; + n = F_FLAG; + break; case 'T': - flags |= T_FLAG; - continue; + n = T_FLAG; + break; case 't': - flags |= T_FLAG|V_FLAG; - continue; + n = T_FLAG|V_FLAG; + break; case 'u': - flags |= U_FLAG; - continue; + n = U_FLAG; + break; case 'v': - flags |= V_FLAG; - continue; - case 'd': - mode = "rt"; - continue; - case 'D': - flags |= d_FLAG; - continue; + n = V_FLAG; + break; case ':': error(2, "%s", opt_info.arg); break; @@ -300,7 +466,12 @@ b_cat(int argc, char** argv, void* context) error(ERROR_usage(2), "%s", opt_info.arg); break; } - break; + if (!n) + break; + if (opt_info.num) + flags |= n; + else + flags &= ~n; } argv += opt_info.index; if (error_info.errors) @@ -340,15 +511,13 @@ b_cat(int argc, char** argv, void* context) states['\n'] = T_NEWLINE; dovcat = 1; } - if (flags&B_FLAG) - flags |= S_FLAG; if (flags&d_FLAG) sfopen(sfstdout, NiL, "wt"); if (cp = *argv) argv++; do { - if (!cp || streq(cp,"-")) + if (!cp || streq(cp, "-")) { fp = sfstdin; if (flags&D_FLAG) @@ -364,7 +533,7 @@ b_cat(int argc, char** argv, void* context) if (flags&U_FLAG) sfsetbuf(fp, (void*)fp, -1); if (dovcat) - n = vcat(states, fp, sfstdout, flags); + n = vcat(states, fp, sfstdout, reserve, flags); else if (sfmove(fp, sfstdout, SF_UNBOUND, -1) >= 0 && sfeof(fp)) n = 0; else diff --git a/usr/src/lib/libcmd/common/chgrp.c b/usr/src/lib/libcmd/common/chgrp.c index 5525157070..3295f3ab24 100644 --- a/usr/src/lib/libcmd/common/chgrp.c +++ b/usr/src/lib/libcmd/common/chgrp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -28,7 +28,7 @@ */ static const char usage_1[] = -"[-?@(#)$Id: chgrp (AT&T Research) 2008-03-28 $\n]" +"[-?@(#)$Id: chgrp (AT&T Research) 2009-07-02 $\n]" USAGE_LICENSE ; @@ -221,6 +221,7 @@ b_chgrp(int argc, char** argv, void* context) register FTSENT*ent; register int i; Dt_t* map = 0; + int logical = 1; int flags; int uid; int gid; @@ -297,16 +298,20 @@ b_chgrp(int argc, char** argv, void* context) continue; case 'H': flags |= FTS_META|FTS_PHYSICAL; + logical = 0; continue; case 'L': flags &= ~(FTS_META|FTS_PHYSICAL); + logical = 0; continue; case 'P': flags &= ~FTS_META; flags |= FTS_PHYSICAL; + logical = 0; continue; case 'R': flags &= ~FTS_TOP; + logical = 0; continue; case 'X': options |= OPT_TEST; @@ -325,6 +330,8 @@ b_chgrp(int argc, char** argv, void* context) if (error_info.errors || argc < 2) error(ERROR_usage(2), "%s", optusage(NiL)); s = *argv; + if (logical) + flags &= ~(FTS_META|FTS_PHYSICAL); if (map) { if (streq(s, "-")) diff --git a/usr/src/lib/libcmd/common/chmod.c b/usr/src/lib/libcmd/common/chmod.c index f8fc03226a..4247446859 100644 --- a/usr/src/lib/libcmd/common/chmod.c +++ b/usr/src/lib/libcmd/common/chmod.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -28,7 +28,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: chmod (AT&T Research) 2007-09-10 $\n]" +"[-?\n@(#)$Id: chmod (AT&T Research) 2009-07-02 $\n]" USAGE_LICENSE "[+NAME?chmod - change the access permissions of files]" "[+DESCRIPTION?\bchmod\b changes the permission of each file " @@ -158,6 +158,7 @@ b_chmod(int argc, char** argv, void* context) register FTSENT*ent; char* last; int (*chmodf)(const char*, mode_t); + int logical = 1; int notify = 0; int ignore = 0; int show = 0; @@ -206,16 +207,20 @@ b_chmod(int argc, char** argv, void* context) continue; case 'H': flags |= FTS_META|FTS_PHYSICAL; + logical = 0; continue; case 'L': flags &= ~(FTS_META|FTS_PHYSICAL); + logical = 0; continue; case 'P': flags &= ~FTS_META; flags |= FTS_PHYSICAL; + logical = 0; continue; case 'R': flags &= ~FTS_TOP; + logical = 0; continue; case '?': error(ERROR_usage(2), "%s", opt_info.arg); @@ -226,6 +231,8 @@ b_chmod(int argc, char** argv, void* context) argv += opt_info.index; if (error_info.errors || !*argv || !amode && !*(argv + 1)) error(ERROR_usage(2), "%s", optusage(NiL)); + if (logical) + flags &= ~(FTS_META|FTS_PHYSICAL); if (ignore) ignore = umask(0); if (amode) diff --git a/usr/src/lib/libcmd/common/chown.c b/usr/src/lib/libcmd/common/chown.c index 83340c346a..cc80ba516f 100644 --- a/usr/src/lib/libcmd/common/chown.c +++ b/usr/src/lib/libcmd/common/chown.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/cksum.c b/usr/src/lib/libcmd/common/cksum.c index 56a80131a6..2be23e4a93 100644 --- a/usr/src/lib/libcmd/common/cksum.c +++ b/usr/src/lib/libcmd/common/cksum.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: sum (AT&T Research) 2007-11-27 $\n]" +"[-?\n@(#)$Id: sum (AT&T Research) 2009-07-02 $\n]" USAGE_LICENSE "[+NAME?cksum,md5sum,sum - print file checksum and block count]" "[+DESCRIPTION?\bsum\b lists the checksum, and for most methods the block" @@ -447,6 +447,7 @@ b_cksum(int argc, register char** argv, void* context) Sfio_t* sp; FTS* fts; FTSENT* ent; + int logical; Optdisc_t optdisc; State_t state; @@ -456,6 +457,7 @@ b_cksum(int argc, register char** argv, void* context) flags = fts_flags() | FTS_TOP | FTS_NOPOSTORDER | FTS_NOSEEDOTDIR; state.flags = SUM_SIZE; state.warn = 1; + logical = 1; method = 0; optinit(&optdisc, optinfo); for (;;) @@ -493,6 +495,7 @@ b_cksum(int argc, register char** argv, void* context) flags &= ~FTS_TOP; state.recursive = 1; state.sort = order; + logical = 0; continue; case 's': method = "sys5"; @@ -511,13 +514,16 @@ b_cksum(int argc, register char** argv, void* context) continue; case 'H': flags |= FTS_META|FTS_PHYSICAL; + logical = 0; continue; case 'L': flags &= ~(FTS_META|FTS_PHYSICAL); + logical = 0; continue; case 'P': flags &= ~FTS_META; flags |= FTS_PHYSICAL; + logical = 0; continue; case 'T': state.text = 1; @@ -548,6 +554,8 @@ b_cksum(int argc, register char** argv, void* context) * do it */ + if (logical) + flags &= ~(FTS_META|FTS_PHYSICAL); if (state.permissions) { state.uid = geteuid(); diff --git a/usr/src/lib/libcmd/common/cmd.h b/usr/src/lib/libcmd/common/cmd.h index 8fe4094d78..3b054da7dd 100644 --- a/usr/src/lib/libcmd/common/cmd.h +++ b/usr/src/lib/libcmd/common/cmd.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -35,6 +35,8 @@ #define cmdinit _cmd_init +#define ERROR_CALLBACK ERROR_SET + #if _BLD_cmd && defined(__EXPORT__) #define extern __EXPORT__ #endif @@ -86,7 +88,7 @@ cmdinit(int argc, register char** argv, void* context, const char* catalog, int error_info.catalog = (char*)catalog; opt_info.index = 0; if (context) - error_info.flags |= flags; + error_info.flags |= flags & ~(ERROR_CALLBACK|ERROR_NOTIFY); return 0; } diff --git a/usr/src/lib/libcmd/common/cmdinit.c b/usr/src/lib/libcmd/common/cmdinit.c index bd450ebf47..e0bdfe511e 100644 --- a/usr/src/lib/libcmd/common/cmdinit.c +++ b/usr/src/lib/libcmd/common/cmdinit.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -24,14 +24,29 @@ */ #include <cmd.h> +#include <shcmd.h> int _cmd_init(int argc, char** argv, void* context, const char* catalog, int flags) { register char* cp; - if (argc < 0) + if (argc <= 0) return -1; + if (context) + { + if (flags & ERROR_CALLBACK) + { + flags &= ~ERROR_CALLBACK; + flags |= ERROR_NOTIFY; + } + else if (flags & ERROR_NOTIFY) + { + ((Shbltin_t*)(context))->notify = 1; + flags &= ~ERROR_NOTIFY; + } + error_info.flags |= flags; + } if (cp = strrchr(argv[0], '/')) cp++; else @@ -40,8 +55,6 @@ _cmd_init(int argc, char** argv, void* context, const char* catalog, int flags) if (!error_info.catalog) error_info.catalog = catalog; opt_info.index = 0; - if (context) - error_info.flags |= flags; return 0; } diff --git a/usr/src/lib/libcmd/common/cmp.c b/usr/src/lib/libcmd/common/cmp.c index 06223f5695..12b69ee23b 100644 --- a/usr/src/lib/libcmd/common/cmp.c +++ b/usr/src/lib/libcmd/common/cmp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -28,7 +28,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: cmp (AT&T Research) 2004-12-01 $\n]" +"[-?\n@(#)$Id: cmp (AT&T Research) 2009-01-05 $\n]" USAGE_LICENSE "[+NAME?cmp - compare two files]" "[+DESCRIPTION?\bcmp\b compares two files \afile1\a and \afile2\a. " @@ -119,7 +119,7 @@ cmp(const char* file1, Sfio_t* f1, const char* file2, Sfio_t* f2, int flags) { ret = 1; if (!(flags & CMP_SILENT)) - error(ERROR_exit(1), "%s: EOF", file1); + error(ERROR_exit(1), "EOF on %s", file1); } return(ret); } @@ -130,7 +130,7 @@ cmp(const char* file1, Sfio_t* f1, const char* file2, Sfio_t* f2, int flags) if (!(p2 = (unsigned char*)sfreserve(f2, SF_UNBOUND, 0)) || (c2 = sfvalue(f2)) <= 0) { if (!(flags & CMP_SILENT)) - error(ERROR_exit(1), "%s: EOF", file2); + error(ERROR_exit(1), "EOF on %s", file2); return(1); } e2 = p2 + c2; @@ -263,14 +263,14 @@ b_cmp(int argc, register char** argv, void* context) if (o1 && sfseek(f1, o1, SEEK_SET) != o1) { if (!(flags & CMP_SILENT)) - error(ERROR_exit(0), "%s: EOF", file1); + error(ERROR_exit(0), "EOF on %s", file1); n = 1; goto done; } if (o2 && sfseek(f2, o2, SEEK_SET) != o2) { if (!(flags & CMP_SILENT)) - error(ERROR_exit(0), "%s: EOF", file2); + error(ERROR_exit(0), "EOF on %s", file2); n = 1; goto done; } @@ -280,7 +280,8 @@ b_cmp(int argc, register char** argv, void* context) error(ERROR_system(0), "%s: cannot stat", file1); else if (s1.st_ino == s2.st_ino && s1.st_dev == s2.st_dev && o1 == o2) n = 0; - else n = ((flags & CMP_SILENT) && S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode) && (s1.st_size - o1) != (s2.st_size - o2)) ? 1 : cmp(file1, f1, file2, f2, flags); + else + n = ((flags & CMP_SILENT) && S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode) && (s1.st_size - o1) != (s2.st_size - o2)) ? 1 : cmp(file1, f1, file2, f2, flags); done: if (f1 && f1 != sfstdin) sfclose(f1); if (f2 && f2 != sfstdin) sfclose(f2); diff --git a/usr/src/lib/libcmd/common/comm.c b/usr/src/lib/libcmd/common/comm.c index 347867d656..f3fee9ef09 100644 --- a/usr/src/lib/libcmd/common/comm.c +++ b/usr/src/lib/libcmd/common/comm.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/cp.c b/usr/src/lib/libcmd/common/cp.c index c3484b0cb0..bff4430830 100644 --- a/usr/src/lib/libcmd/common/cp.c +++ b/usr/src/lib/libcmd/common/cp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -27,7 +27,7 @@ */ static const char usage_head[] = -"[-?@(#)$Id: cp (AT&T Research) 2007-12-13 $\n]" +"[-?@(#)$Id: cp (AT&T Research) 2009-06-18 $\n]" USAGE_LICENSE ; @@ -142,6 +142,7 @@ static const char usage_tail[] = typedef struct State_s /* program state */ { + void* context; /* builtin context */ int backup; /* BAK_* type */ int directory; /* destination is directory */ int flags; /* FTS_* flags */ @@ -438,7 +439,7 @@ visit(State_t* state, register FTSENT* ent) /* ok */; else if (state->interactive) { - if (astquery(-1, "%s %s? ", state->opname, state->path)) + if (astquery(-1, "%s %s? ", state->opname, state->path) < 0 || sh_checksig(state->context)) return 0; } else if (state->op == LN) @@ -459,7 +460,7 @@ visit(State_t* state, register FTSENT* ent) fmtmode(st.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO), 0) + 1; if (state->interactive) { - if (astquery(-1, "override protection %s for %s? ", protection, state->path)) + if (astquery(-1, "override protection %s for %s? ", protection, state->path) < 0 || sh_checksig(state->context)) return 0; rm = 1; } @@ -659,7 +660,7 @@ b_cp(int argc, register char** argv, void* context) char** v; char* backup_type; FTS* fts; - FTSENT* ent; + FTSENT* ent; const char* usage; int path_resolve; int standard; @@ -677,6 +678,7 @@ b_cp(int argc, register char** argv, void* context) } else memset(state, 0, offsetof(State_t, INITSTATE)); + state->context = context; state->presiz = -1; backup_type = 0; state->flags = FTS_NOCHDIR|FTS_NOSEEDOTDIR; diff --git a/usr/src/lib/libcmd/common/cut.c b/usr/src/lib/libcmd/common/cut.c index 305ebdaf9d..2be03c3183 100644 --- a/usr/src/lib/libcmd/common/cut.c +++ b/usr/src/lib/libcmd/common/cut.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/date.c b/usr/src/lib/libcmd/common/date.c index 1984570b2d..d7895b02d4 100644 --- a/usr/src/lib/libcmd/common/date.c +++ b/usr/src/lib/libcmd/common/date.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: date (AT&T Research) 2007-05-21 $\n]" +"[-?\n@(#)$Id: date (AT&T Research) 2009-03-03 $\n]" USAGE_LICENSE "[+NAME?date - set/list/convert dates]" "[+DESCRIPTION?\bdate\b sets the current date and time (with appropriate" @@ -106,7 +106,7 @@ USAGE_LICENSE " [+j?1-offset Julian date]" " [+J?0-offset Julian date]" " [+k?\bdate\b(1) style date]" -" [+K?all numeric date; equivalent to \b%Y-%m-%d+%H:%M:%S\b]" +" [+K?all numeric date; equivalent to \b%Y-%m-%d+%H:%M:%S\b; \b%_[EO]]K\b for space separator, %OK adds \b.%N\b, \b%EK\b adds \b%.N%z\b, \b%_EK\b adds \b.%N %z\b]" " [+l?\bls\b(1) \b-l\b date; equivalent to \b%Q/%g/%G/\b]" " [+L?locale default date format]" " [+m?month number]" @@ -212,7 +212,7 @@ settime(void* context, const char* cmd, Time_t now, int adjust, int network) char* s; char** argv; char* args[5]; - char buf[128]; + char buf[1024]; if (!adjust && !network) return tmxsettime(now); @@ -276,7 +276,7 @@ b_date(int argc, register char** argv, void* context) Time_t ts; Time_t te; Time_t e; - char buf[128]; + char buf[1024]; Fmt_t* fmts; Fmt_t fmt; struct stat st; diff --git a/usr/src/lib/libcmd/common/dirname.c b/usr/src/lib/libcmd/common/dirname.c index 71e69d8594..cd6076240b 100644 --- a/usr/src/lib/libcmd/common/dirname.c +++ b/usr/src/lib/libcmd/common/dirname.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -29,7 +29,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: dirname (AT&T Research) 2000-03-07 $\n]" +"[-?\n@(#)$Id: dirname (AT&T Research) 2009-01-31 $\n]" USAGE_LICENSE "[+NAME?dirname - return directory portion of file name]" "[+DESCRIPTION?\bdirname\b treats \astring\a as a file name and returns " @@ -48,14 +48,17 @@ USAGE_LICENSE "as \b/\b characters as described above. Otherwise, all " "trailing slashes are removed and the output will be this string " "unless this string is empty. If empty the output will be \b.\b.]" +"[f:file?Print the \b$PATH\b relative regular file path for \astring\a.]" +"[r:relative?Print the \b$PATH\b relative readable file path for \astring\a.]" +"[x:executable?Print the \b$PATH\b relative executable file path for \astring\a.]" "\n" -"\n string\n" +"\nstring\n" "\n" "[+EXIT STATUS?]{" "[+0?Successful Completion.]" "[+>0?An error occurred.]" "}" -"[+SEE ALSO?\bbasename\b(1), \bgetconf\b(1), \bdirname\b(3)]" +"[+SEE ALSO?\bbasename\b(1), \bgetconf\b(1), \bdirname\b(3), \bpathname\b(3)]" ; #include <cmd.h> @@ -96,10 +99,22 @@ int b_dirname(int argc,register char *argv[], void* context) { register int n; + int mode = 0; + char buf[PATH_MAX]; cmdinit(argc, argv, context, ERROR_CATALOG, 0); while (n = optget(argv, usage)) switch (n) { + case 'f': + mode |= PATH_REGULAR; + break; + case 'r': + mode &= ~PATH_REGULAR; + mode |= PATH_READ; + break; + case 'x': + mode |= PATH_EXECUTE; + break; case ':': error(2, "%s", opt_info.arg); break; @@ -111,6 +126,11 @@ b_dirname(int argc,register char *argv[], void* context) argc -= opt_info.index; if(error_info.errors || argc != 1) error(ERROR_usage(2),"%s", optusage(NiL)); - l_dirname(sfstdout,argv[0]); + if(!mode) + l_dirname(sfstdout,argv[0]); + else if(pathpath(buf, argv[0], "", mode)) + sfputr(sfstdout, buf, '\n'); + else + error(1|ERROR_WARNING, "%s: relative path not found", argv[0]); return(0); } diff --git a/usr/src/lib/libcmd/common/expr.c b/usr/src/lib/libcmd/common/expr.c index ff5d45e039..78749d25ce 100644 --- a/usr/src/lib/libcmd/common/expr.c +++ b/usr/src/lib/libcmd/common/expr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/fds.c b/usr/src/lib/libcmd/common/fds.c index bafa2c09f7..cca4fd22c3 100644 --- a/usr/src/lib/libcmd/common/fds.c +++ b/usr/src/lib/libcmd/common/fds.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ #pragma prototyped static const char usage[] = -"[-?\n@(#)$Id: fds (AT&T Research) 2008-08-26 $\n]" +"[-?\n@(#)$Id: fds (AT&T Research) 2009-09-09 $\n]" USAGE_LICENSE "[+NAME?fds - list open file descriptor status]" "[+DESCRIPTION?\bfds\b lists the status for each open file descriptor. " @@ -29,6 +29,7 @@ USAGE_LICENSE "calling shell, otherwise it lists the file descriptors passed across " "\bexec\b(2).]" "[l:long?List file descriptor details.]" +"[u:unit?Write output to \afd\a.]#[fd]" "[+SEE ALSO?\blogname\b(1), \bwho\b(1), \bgetgroups\b(2), \bgetsockname\b(2), \bgetsockopts\b(2)]" ; @@ -164,6 +165,8 @@ b_fds(int argc, char** argv, void* context) int flags; int details; int open_max; + int unit; + Sfio_t* sp; struct stat st; #ifdef S_IFSOCK struct sockaddr_in addr; @@ -175,13 +178,16 @@ b_fds(int argc, char** argv, void* context) int type; int port; int prot; - char nam[256]; char num[64]; char fam[64]; +#ifdef INET6_ADDRSTRLEN + char nam[256]; +#endif #endif cmdinit(argc, argv, context, ERROR_CATALOG, 0); details = 0; + unit = 1; for (;;) { switch (optget(argv, usage)) @@ -189,6 +195,9 @@ b_fds(int argc, char** argv, void* context) case 'l': details = opt_info.num; continue; + case 'u': + unit = opt_info.num; + continue; case '?': error(ERROR_USAGE|4, "%s", opt_info.arg); continue; @@ -203,6 +212,10 @@ b_fds(int argc, char** argv, void* context) error(ERROR_USAGE|4, "%s", optusage(NiL)); if ((open_max = getconf("OPEN_MAX")) <= 0) open_max = OPEN_MAX; + if (unit == 1) + sp = sfstdout; + else if (fstat(unit, &st) || !(sp = sfnew(NiL, NiL, SF_UNBOUND, unit, SF_WRITE))) + error(ERROR_SYSTEM|3, "%d: cannot write to file descriptor"); for (i = 0; i <= open_max; i++) { if (fstat(i, &st)) @@ -212,7 +225,7 @@ b_fds(int argc, char** argv, void* context) } if (!details) { - sfprintf(sfstdout, "%d\n", i); + sfprintf(sp, "%d\n", i); continue; } if ((flags = fcntl(i, F_GETFL, (char*)0)) == -1) @@ -236,7 +249,7 @@ b_fds(int argc, char** argv, void* context) x = (fcntl(i, F_GETFD, (char*)0) > 0) ? "x" : "-"; if (isatty(i) && (s = ttyname(i))) { - sfprintf(sfstdout, "%02d %s%s %s %s\n", i, m, x, fmtmode(st.st_mode, 0), s); + sfprintf(sp, "%02d %s%s %s %s\n", i, m, x, fmtmode(st.st_mode, 0), s); continue; } #ifdef S_IFSOCK @@ -330,13 +343,18 @@ b_fds(int argc, char** argv, void* context) a = a == fam ? "0" : fam + 1; } if (port) - sfprintf(sfstdout, "%02d %s%s %s /dev/%s/%s/%d\n", i, m, x, fmtmode(st.st_mode, 0), s, a, port); + sfprintf(sp, "%02d %s%s %s /dev/%s/%s/%d\n", i, m, x, fmtmode(st.st_mode, 0), s, a, port); else - sfprintf(sfstdout, "%02d %s%s %s /dev/%s/%s\n", i, m, x, fmtmode(st.st_mode, 0), s, a); + sfprintf(sp, "%02d %s%s %s /dev/%s/%s\n", i, m, x, fmtmode(st.st_mode, 0), s, a); continue; } #endif - sfprintf(sfstdout, "%02d %s%s %s /dev/inode/%u/%u\n", i, m, x, fmtmode(st.st_mode, 0), st.st_dev, st.st_ino); + sfprintf(sp, "%02d %s%s %s /dev/inode/%u/%u\n", i, m, x, fmtmode(st.st_mode, 0), st.st_dev, st.st_ino); + } + if (sp != sfstdout) + { + sfsetfd(sp, -1); + sfclose(sp); } return 0; } diff --git a/usr/src/lib/libcmd/common/features/utsname b/usr/src/lib/libcmd/common/features/utsname index 5b746ce7ad..7254867181 100644 --- a/usr/src/lib/libcmd/common/features/utsname +++ b/usr/src/lib/libcmd/common/features/utsname @@ -6,6 +6,9 @@ sys syscall,systeminfo,syssgi tst cross{ u=`/bin/uname -o 2>/dev/null` case $u in + UWIN-*) u=UWIN ;; + esac + case $u in '') ;; *) echo "#define _UNAME_os_DEFAULT \"$u\" /* default os name */" ;; esac diff --git a/usr/src/lib/libcmd/common/fmt.c b/usr/src/lib/libcmd/common/fmt.c index 95f5fd4528..ab0db310ea 100644 --- a/usr/src/lib/libcmd/common/fmt.c +++ b/usr/src/lib/libcmd/common/fmt.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/fold.c b/usr/src/lib/libcmd/common/fold.c index 6541da8035..01a2cadfb1 100644 --- a/usr/src/lib/libcmd/common/fold.c +++ b/usr/src/lib/libcmd/common/fold.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/getconf.c b/usr/src/lib/libcmd/common/getconf.c index bceae0e167..a4509437ab 100644 --- a/usr/src/lib/libcmd/common/getconf.c +++ b/usr/src/lib/libcmd/common/getconf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/grep.c b/usr/src/lib/libcmd/common/grep.c new file mode 100644 index 0000000000..1e857f087c --- /dev/null +++ b/usr/src/lib/libcmd/common/grep.c @@ -0,0 +1,876 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1995-2009 AT&T Knowledge Ventures * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Knowledge Ventures * +* * +* 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 <gsf@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +static const char usage[] = +"[-?\n@(#)$Id: grep (AT&T Research) 2006-06-14 $\n]" +USAGE_LICENSE +"[+NAME?grep - search lines in files for matching patterns]" +"[+DESCRIPTION?The \bgrep\b commands search the named input files" +" for lines containing a match for the given \apatterns\a." +" Matching lines are printed by default. The standard input is searched" +" if no files are given or when the file \b-\b is specified.]" +"[+?There are six variants of \bgrep\b, each one using a different form of" +" \apattern\a, controlled either by option or the command path" +" base name. Details of each variant may be found in \bregex\b(3).]" +" {" +" [+grep?The default basic regular expressions (no alternations.)]" +" [+egrep?Extended regular expressions (alternations, one or more.)]" +" [+pgrep?\bperl\b(1) regular expressions (lenient extended.)]" +" [+xgrep?Augmented regular expressions (conjunction, negation.)]" +" [+fgrep?Fixed string expressions.]" +" [+agrep?Approximate regular expressions (not implemented.)]" +" }" +"[G:basic-regexp?\bgrep\b mode (default): basic regular expression \apatterns\a.]" +"[E:extended-regexp?\begrep\b mode: extended regular expression \apatterns\a.]" +"[X:augmented-regexp?\bxgrep\b mode: augmented regular expression \apatterns\a.]" +"[P:perl-regexp?\bpgrep\b mode: \bperl\b(1) regular expression \apatterns\a.]" +"[F:fixed-string?\bfgrep\b mode: fixed string \apatterns\a.]" +"[A:approximate-regexp?\bagrep\b mode: approximate regular expression \apatterns\a (not implemented.)]" + +"[C:context?Set the matched line context \abefore\a and \aafter\a count." +" By default only matched lines are printed.]:?" +" [before[,after]]:=2,2]" +"[c:count?Only print a matching line count for each file.]" +"[e:expression|pattern|regexp?Specify a matching \apattern\a. More than one" +" \apattern\a implies alternation. If this option is specified" +" then the command line \apattern\a must be omitted.]:" +" [pattern]" +"[f:file?Each line in \apattern-file\a is a \apattern\a, placed into a single" +" alternating expression.]:" +" [pattern-file]" +"[H:filename|with-filename?Prefix each matched line with the containing file name.]" +"[h:no-filename?Suppress containing file name prefix for each matched line.]" +"[i:ignore-case?Ignore case when matching.]" +"[l:files-with-matches?Only print file names with at least one match.]" +"[L:files-without-matches?Only print file names with no matches.]" +"[b:highlight?Highlight matches using the ansi terminal bold sequence.]" +"[v:invert-match|revert-match?Invert the \apattern\a match sense.]" +"[m:label?All patterns must be of the form \alabel\a:\apattern\a. Match and" +" count output will be prefixed by the corresponding \alabel\a:.]" +"[O:lenient?Enable lenient \apattern\a interpretation. This is the default.]" +"[x:line-match|line-regexp?Force \apatterns\a to match complete lines.]" +"[n:number|line-number?Prefix each matched line with its line number.]" +"[N:name?Set the standard input file name prefix to" +" \aname\a.]:[name:=empty]" +"[q:quiet|silent?Do not print matching lines.]" +"[S:strict?Enable strict \apattern\a interpretation with diagnostics.]" +"[s:suppress|no-messages?Suppress error and warning messages.]" +"[t:total?Only print a single matching line count for all files.]" +"[T:test?Enable implementation specific tests.]:" +" [test]" +"[w:word-match|word-regexp?Force \apatterns\a to match complete words.]" +"[a?Ignored for GNU compatibility.]" +"\n" +"\n[ pattern ] [ file ... ]\n" +"\n" +"[+DIAGNOSTICS?Exit status 0 if matches were found, 1 if no matches were found," +" where \b-v\b invertes the exit status. Exit status 2 for other" +" errors that are accompanied by a message on the standard error.]" +"[+SEE ALSO?\bed\b(1), \bsed\b(1), \bperl\b(1), \bregex\b(3)]" +"[+CAVEATS?Some expressions of necessity require exponential space" +" and/or time.]" +"[+BUGS?Some expressions may use sub-optimal algorithms. For example," +" don't use this implementation to compute primes.]" +; + +#include <ast.h> +#include <ctype.h> +#include <ccode.h> +#include <error.h> +#include <regex.h> + +#ifndef EISDIR +#define EISDIR (-1) +#endif + +/* + * snarfed from Doug McElroy's C++ version + * + * this grep is based on the Posix re package. + * unfortunately it has to have a nonstandard interface. + * 1. fgrep does not have usual operators. REG_LITERAL + * caters for this. + * 2. grep allows null expressions, hence REG_NULL. + * 3. it may be possible to combine the multiple + * patterns of grep into single patterns. important + * special cases are handled by regcomb(). + * 4. anchoring by -x has to be done separately from + * compilation (remember that fgrep has no ^ or $ operator), + * hence REG_LEFT|REG_RIGHT. (An honest, but slow alternative: + * run regexec with REG_NOSUB off and nmatch=1 and check + * whether the match is full length) + */ + +typedef struct Item_s /* list item - sue me for waste */ +{ + struct Item_s* next; /* next in list */ + regex_t re; /* compiled re */ + Sfulong_t hits; /* labeled pattern matches */ + Sfulong_t total; /* total hits */ + char string[1]; /* string value */ +} Item_t; + +typedef struct List_s /* generic list */ +{ + Item_t* head; /* list head */ + Item_t* tail; /* list tail */ +} List_t; + +typedef struct State_s /* program state */ +{ + struct + { + char* base; /* sfsetbuf buffer */ + size_t size; /* sfsetbuf size */ + int noshare; /* turn off SF_SHARE */ + } buffer; + + List_t file; /* pattern file list */ + List_t pattern; /* pattern list */ + List_t re; /* re list */ + + regmatch_t posvec[1]; /* match position vector */ + regmatch_t* pos; /* match position pointer */ + int posnum; /* number of match positions */ + + int any; /* if any pattern hit */ + int list; /* list files with hits */ + int notfound; /* some input file not found */ + int options; /* regex options */ + + Sfulong_t hits; /* total matched pattern count */ + + unsigned char byline; /* multiple pattern line by line*/ + unsigned char count; /* count number of hits */ + unsigned char label; /* all patterns labeled */ + unsigned char match; /* match sense */ + unsigned char query; /* return status but no output */ + unsigned char number; /* line numbers */ + unsigned char prefix; /* print file prefix */ + unsigned char suppress; /* no unopenable file messages */ + unsigned char words; /* word matches only */ +} State_s; + +static void +addre(State_s *state, List_t* p, char* s) +{ + int c; + char* b; + Item_t* x; + Sfio_t* t; + + b = s; + if (state->label) + { + if (!(s = strchr(s, ':'))) + error(3, "%s: label:pattern expected", b); + c = s - b; + s++; + } + else + c = 0; + if (!(x = newof(0, Item_t, 1, c))) + error(ERROR_SYSTEM|3, "out of space (pattern `%s')", b); + if (c) + memcpy(x->string, b, c); + if (state->words) + { + if (!(t = sfstropen())) + error(ERROR_SYSTEM|3, "out of space (word pattern `%s')", s); + if (!(state->options & REG_AUGMENTED)) + sfputc(t, '\\'); + sfputc(t, '<'); + sfputr(t, s, -1); + if (!(state->options & REG_AUGMENTED)) + sfputc(t, '\\'); + sfputc(t, '>'); + if (!(s = sfstruse(t))) + error(ERROR_SYSTEM|3, "out of space"); + } + else + t = 0; + if (c = regcomp(&x->re, s, state->options|REG_MULTIPLE)) + regfatal(&x->re, 3, c); + if (t) + sfstrclose(t); + if (!p->head) + { + p->head = p->tail = x; + if (state->number || !regrecord(&x->re)) + state->byline = 1; + } + else if (state->label || regcomb(&p->tail->re, &x->re)) + { + p->tail = p->tail->next = x; + if (!state->byline && (state->number || !state->label || !regrecord(&x->re))) + state->byline = 1; + } + else + free(x); +} + +static void +addstring(State_s *state, List_t* p, char* s) +{ + Item_t* x; + + if (!(x = newof(0, Item_t, 1, strlen(s)))) + error(ERROR_SYSTEM|3, "out of space (string `%s')", s); + strcpy(x->string, s); + if (p->head) + p->tail->next = x; + else + p->head = x; + p->tail = x; +} + +static void +compile(State_s *state) +{ + int line; + size_t n; + char* s; + char* t; + char* file; + Item_t* x; + Sfio_t* f; + + for (x = state->pattern.head; x; x = x->next) + addre(state, &state->re, x->string); + for (x = state->file.head; x; x = x->next) + { + s = x->string; + if (!(f = sfopen(NiL, s, "r"))) + error(ERROR_SYSTEM|4, "%s: cannot open", s); + else + { + file = error_info.file; + error_info.file = s; + line = error_info.line; + error_info.line = 0; + while (s = (char*)sfreserve(f, SF_UNBOUND, SF_LOCKR)) + { + if (!(n = sfvalue(f))) + break; + if (s[n - 1] != '\n') + { + for (t = s + n; t > s && *--t != '\n'; t--); + if (t == s) + { + sfread(f, s, 0); + break; + } + n = t - s + 1; + } + s[n - 1] = 0; + addre(state, &state->re, s); + s[n - 1] = '\n'; + sfread(f, s, n); + } + while ((s = sfgetr(f, '\n', 1)) || (s = sfgetr(f, '\n', -1))) + { + error_info.line++; + addre(state, &state->re, s); + } + error_info.file = file; + error_info.line = line; + sfclose(f); + } + } + if (!state->re.head) + error(3, "no pattern"); +} + +static void +highlight(Sfio_t* sp, const char* s, int n, int so, int eo) +{ + static const char bold[] = {CC_esc,'[','1','m'}; + static const char normal[] = {CC_esc,'[','0','m'}; + + sfwrite(sp, s, so); + sfwrite(sp, bold, sizeof(bold)); + sfwrite(sp, s + so, eo - so); + sfwrite(sp, normal, sizeof(normal)); + sfwrite(sp, s + eo, n - eo); +} + +typedef struct +{ + State_s *state; + Item_t *item; +} record_handle; + +static int +record(void* handle, const char* s, size_t len) +{ + record_handle *r_x = (record_handle *)handle; + State_s *state = r_x->state; + Item_t *item = r_x->item; + + item->hits++; + if (state->query || state->list) + return -1; + if (!state->count) + { + if (state->prefix) + sfprintf(sfstdout, "%s:", error_info.file); + if (state->label) + sfprintf(sfstdout, "%s:", item->string); + if (state->pos) + highlight(sfstdout, s, len + 1, state->pos[0].rm_so, state->pos[0].rm_eo); + else + sfwrite(sfstdout, s, len + 1); + } + return 0; +} + +static void +execute(State_s *state, Sfio_t* input, char* name) +{ + register char* s; + char* file; + Item_t* x; + size_t len; + int result; + int line; + + Sfulong_t hits = 0; + + if (state->buffer.noshare) + sfset(input, SF_SHARE, 0); + if (state->buffer.size) + sfsetbuf(input, state->buffer.base, state->buffer.size); + if (!name) + name = "/dev/stdin"; + file = error_info.file; + error_info.file = name; + line = error_info.line; + error_info.line = 0; + if (state->byline) + { + for (;;) + { + error_info.line++; + if (s = sfgetr(input, '\n', 0)) + len = sfvalue(input) - 1; + else if (s = sfgetr(input, '\n', -1)) + { + len = sfvalue(input); + s[len] = '\n'; +#if _you_like_the_noise + error(1, "newline appended"); +#endif + } + else + { + if (sferror(input) && errno != EISDIR) + error(ERROR_SYSTEM|2, "read error"); + break; + } + x = state->re.head; + do + { + if (!(result = regnexec(&x->re, s, len, state->posnum, state->pos, 0))) + { + if (!state->label) + break; + x->hits++; + if (state->query || state->list) + goto done; + if (!state->count) + { + if (state->prefix) + sfprintf(sfstdout, "%s:", name); + if (state->number) + sfprintf(sfstdout, "%d:", error_info.line); + sfprintf(sfstdout, "%s:", x->string); + if (state->pos) + highlight(sfstdout, s, len + 1, state->pos[0].rm_so, state->pos[0].rm_eo); + else + sfwrite(sfstdout, s, len + 1); + } + } + else if (result != REG_NOMATCH) + regfatal(&x->re, 3, result); + } while (x = x->next); + if (!state->label && (x != 0) == state->match) + { + hits++; + if (state->query || state->list) + break; + if (!state->count) + { + if (state->prefix) + sfprintf(sfstdout, "%s:", name); + if (state->number) + sfprintf(sfstdout, "%d:", error_info.line); + if (state->pos) + highlight(sfstdout, s, len + 1, state->pos[0].rm_so, state->pos[0].rm_eo); + else + sfwrite(sfstdout, s, len + 1); + } + } + } + } + else + { + register char* e; + register char* t; + char* r; + + static char* span = 0; + static size_t spansize = 0; + + s = e = 0; + for (;;) + { + if (s < e) + { + t = span; + for (;;) + { + len = 2 * (e - s) + t - span + 1; + len = roundof(len, SF_BUFSIZE); + if (spansize < len) + { + spansize = len; + len = t - span; + if (!(span = newof(span, char, spansize, 0))) + error(ERROR_SYSTEM|3, "%s: line longer than %lu characters", name, len + e - s); + t = span + len; + } + len = e - s; + memcpy(t, s, len); + t += len; + if (!(s = sfreserve(input, SF_UNBOUND, 0)) || (len = sfvalue(input)) <= 0) + { + if ((sfvalue(input) || sferror(input)) && errno != EISDIR) + error(ERROR_SYSTEM|2, "%s: read error", name); + break; + } + else if (!(e = memchr(s, '\n', len))) + e = s + len; + else + { + r = s + len; + len = (e - s) + t - span; + len = roundof(len, SF_BUFSIZE); + if (spansize < len) + { + spansize = len; + len = t - span; + if (!(span = newof(span, char, spansize, 0))) + error(ERROR_SYSTEM|3, "%s: line longer than %lu characters", name, len + e - s); + t = span + len; + } + len = e - s; + memcpy(t, s, len); + t += len; + s += len + 1; + e = r; + break; + } + } + *t = '\n'; + x = state->re.head; + do + { + record_handle r_x = { state, x }; + if ((result = regrexec(&x->re, span, t - span, state->posnum, state->pos, state->options, '\n', (void*)&r_x, record)) < 0) + goto done; + if (result && result != REG_NOMATCH) + regfatal(&x->re, 3, result); + } while (x = x->next); + if (!s) + break; + } + else + { + if (!(s = sfreserve(input, SF_UNBOUND, 0))) + { + if ((sfvalue(input) || sferror(input)) && errno != EISDIR) + error(ERROR_SYSTEM|2, "%s: read error", name); + break; + } + if ((len = sfvalue(input)) <= 0) + break; + e = s + len; + } + t = e; + while (t > s) + if (*--t == '\n') + { + x = state->re.head; + do + { + record_handle r_x = { state, x }; + if ((result = regrexec(&x->re, s, t - s, state->posnum, state->pos, state->options, '\n', (void*)&r_x, record)) < 0) + goto done; + if (result && result != REG_NOMATCH) + regfatal(&x->re, 3, result); + } while (x = x->next); + s = t + 1; + break; + } + } + } + done: + error_info.file = file; + error_info.line = line; + if (state->byline && !state->label) + { + if (hits && state->list >= 0) + state->any = 1; + if (!state->query) + { + if (!state->list) + { + if (state->count) + { + if (state->count & 2) + state->hits += hits; + else + { + if (state->prefix) + sfprintf(sfstdout, "%s:", name); + sfprintf(sfstdout, "%I*u\n", sizeof(hits), hits); + } + } + } + else if ((hits != 0) == (state->list > 0)) + { + if (state->list < 0) + state->any = 1; + sfprintf(sfstdout, "%s\n", name); + } + } + } + else + { + x = state->re.head; + do + { + if (x->hits && state->list >= 0) + { + state->any = 1; + if (state->query) + break; + } + if (!state->query) + { + if (!state->list) + { + if (state->count) + { + if (state->count & 2) + { + x->total += x->hits; + state->hits += x->hits; + } + else + { + if (state->prefix) + sfprintf(sfstdout, "%s:", name); + if (state->label) + sfprintf(sfstdout, "%s:", x->string); + sfprintf(sfstdout, "%I*u\n", sizeof(x->hits), x->hits); + } + } + } + else if ((x->hits != 0) == (state->list > 0)) + { + if (state->list < 0) + state->any = 1; + if (state->label) + sfprintf(sfstdout, "%s:%s\n", name, x->string); + else + sfprintf(sfstdout, "%s\n", name); + } + } + x->hits = 0; + } while (x = x->next); + } +} + + +static +int grep_main(int argc, char** argv, void *context) +{ + int c; + char* s; + char* h; + Sfio_t* f; + State_s state; + memset(&state, 0, sizeof(state)); + + NoP(argc); + state.match = 1; + state.options = REG_FIRST|REG_NOSUB|REG_NULL; + h = 0; + if (strcmp(astconf("CONFORMANCE", NiL, NiL), "standard")) + state.options |= REG_LENIENT; + if (s = strrchr(argv[0], '/')) + s++; + else + s = argv[0]; + switch (*s) + { + case 'e': + case 'E': + s = "egrep"; + state.options |= REG_EXTENDED; + break; + case 'f': + case 'F': + s = "fgrep"; + state.options |= REG_LITERAL; + break; + case 'p': + case 'P': + s = "pgrep"; + state.options |= REG_EXTENDED|REG_LENIENT; + break; + case 'x': + case 'X': + s = "xgrep"; + state.options |= REG_AUGMENTED; + break; + default: + s = "grep"; + break; + } + error_info.id = s; + while (c = optget(argv, usage)) + switch (c) + { + case 'E': + state.options |= REG_EXTENDED; + break; + case 'F': + state.options |= REG_LITERAL; + break; + case 'G': + state.options &= ~(REG_AUGMENTED|REG_EXTENDED); + break; + case 'H': + state.prefix = opt_info.num; + break; + case 'L': + state.list = -opt_info.num; + break; + case 'N': + h = opt_info.arg; + break; + case 'O': + state.options |= REG_LENIENT; + break; + case 'P': + state.options |= REG_EXTENDED|REG_LENIENT; + break; + case 'S': + state.options &= ~REG_LENIENT; + break; + case 'T': + s = opt_info.arg; + switch (*s) + { + case 'b': + case 'm': + c = *s++; + state.buffer.size = strton(s, &s, NiL, 1); + if (c == 'b' && !(state.buffer.base = newof(0, char, state.buffer.size, 0))) + error(ERROR_SYSTEM|3, "out of space [test buffer]"); + if (*s) + error(3, "%s: invalid characters after test", s); + break; + case 'f': + state.options |= REG_FIRST; + break; + case 'l': + state.options |= REG_LEFT; + break; + case 'n': + state.buffer.noshare = 1; + break; + case 'r': + state.options |= REG_RIGHT; + break; + default: + error(3, "%s: unknown test", s); + break; + } + break; + case 'X': + state.options |= REG_AUGMENTED; + break; + case 'a': + break; + case 'b': + state.options &= ~(REG_FIRST|REG_NOSUB); + break; + case 'c': + state.count |= 1; + break; + case 'e': + addstring(&state, &state.pattern, opt_info.arg); + break; + case 'f': + addstring(&state, &state.file, opt_info.arg); + break; + case 'h': + state.prefix = 2; + break; + case 'i': + state.options |= REG_ICASE; + break; + case 'l': + state.list = opt_info.num; + break; + case 'm': + state.label = 1; + break; + case 'n': + state.number = 1; + break; + case 'q': + state.query = 1; + break; + case 's': + state.suppress = opt_info.num; + break; + case 't': + state.count |= 2; + break; + case 'v': + if (state.match = !opt_info.num) + state.options &= ~REG_INVERT; + else + state.options |= REG_INVERT; + break; + case 'w': + state.words = 1; + break; + case 'x': + state.options |= REG_LEFT|REG_RIGHT; + break; + case '?': + error(ERROR_USAGE|4, "%s", opt_info.arg); + break; + case ':': + error(2, "%s", opt_info.arg); + break; + default: + error(3, "%s: not implemented", opt_info.name); + break; + } + argv += opt_info.index; + if ((state.options & REG_LITERAL) && (state.options & (REG_AUGMENTED|REG_EXTENDED))) + error(3, "-F and -A or -P or -X are incompatible"); + if ((state.options & REG_LITERAL) && state.words) + error(ERROR_SYSTEM|3, "-F and -w are incompatible"); + if (!state.file.head && !state.pattern.head) + { + if (!argv[0]) + error(3, "no pattern"); + addstring(&state, &state.pattern, *argv++); + } + if (!(state.options & (REG_FIRST|REG_NOSUB))) + { + if (state.count || state.list || state.query || (state.options & REG_INVERT)) + state.options |= REG_FIRST|REG_NOSUB; + else + { + state.pos = state.posvec; + state.posnum = elementsof(state.posvec); + } + } + compile(&state); + if (!argv[0]) + { + state.prefix = h ? 1 : 0; + execute(&state, sfstdin, h); + } + else + { + if (state.prefix > 1) + state.prefix = 0; + else if (argv[1]) + state.prefix = 1; + while (s = *argv++) + { + if (f = sfopen(NiL, s, "r")) + { + execute(&state, f, s); + sfclose(f); + if (state.query && state.any) + break; + } + else + { + state.notfound = 1; + if (!state.suppress) + error(ERROR_SYSTEM|2, "%s: cannot open", s); + } + } + } + if ((state.count & 2) && !state.query && !state.list) + { + if (state.label) + { + Item_t* x; + + x = state.re.head; + do + { + sfprintf(sfstdout, "%s:%I*u\n", x->string, sizeof(x->total), x->total); + } while (x = x->next); + } + else + sfprintf(sfstdout, "%I*u\n", sizeof(state.hits), state.hits); + } + return (state.notfound && !state.query) ? 2 : !state.any; +} + + +int b_egrep(int argc, char** argv, void *context) +{ + return grep_main(argc, argv, context); +} + +int b_grep(int argc, char** argv, void *context) +{ + return grep_main(argc, argv, context); +} + +int b_fgrep(int argc, char** argv, void *context) +{ + return grep_main(argc, argv, context); +} + +int b_pgrep(int argc, char** argv, void *context) +{ + return grep_main(argc, argv, context); +} + +int b_xgrep(int argc, char** argv, void *context) +{ + return grep_main(argc, argv, context); +} diff --git a/usr/src/lib/libcmd/common/head.c b/usr/src/lib/libcmd/common/head.c index cee683e81a..98f7df8e8f 100644 --- a/usr/src/lib/libcmd/common/head.c +++ b/usr/src/lib/libcmd/common/head.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/id.c b/usr/src/lib/libcmd/common/id.c index a1820e3bf7..53d8cad830 100644 --- a/usr/src/lib/libcmd/common/id.c +++ b/usr/src/lib/libcmd/common/id.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/join.c b/usr/src/lib/libcmd/common/join.c index 12b40bc31b..909a8e8a29 100644 --- a/usr/src/lib/libcmd/common/join.c +++ b/usr/src/lib/libcmd/common/join.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -28,7 +28,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: join (AT&T Research) 2006-10-31 $\n]" +"[-?\n@(#)$Id: join (AT&T Research) 2009-08-01 $\n]" USAGE_LICENSE "[+NAME?join - relational database operator]" "[+DESCRIPTION?\bjoin\b performs an \aequality join\a on the files \afile1\a " @@ -351,7 +351,7 @@ outfield(Join_t* jp, int index, register int n, int last) cp = 0; if ((n=jp->delim)<=0) { - if (fp->spaces) + if (cp && fp->spaces) { /*eliminate leading spaces */ while (jp->state[*(unsigned char*)cp++]==S_SPACE); @@ -365,7 +365,7 @@ outfield(Join_t* jp, int index, register int n, int last) size = cpmax-cp; else size = 0; - if (size==0) + if (size<=1) { if (!jp->nullfield) sfputc(iop,n); @@ -800,7 +800,7 @@ b_join(int argc, char** argv, void* context) if (jp->buffered) { sfsetbuf(jp->file[0].iop, jp->file[0].iop, SF_UNBOUND); - sfsetbuf(jp->file[1].iop, jp->file[0].iop, SF_UNBOUND); + sfsetbuf(jp->file[1].iop, jp->file[1].iop, SF_UNBOUND); } jp->state['\n'] = S_NL; jp->outfile = sfstdout; diff --git a/usr/src/lib/libcmd/common/ln.c b/usr/src/lib/libcmd/common/ln.c index 90a6190504..94da7be389 100644 --- a/usr/src/lib/libcmd/common/ln.c +++ b/usr/src/lib/libcmd/common/ln.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/logname.c b/usr/src/lib/libcmd/common/logname.c index a142653345..6ca5b02e0b 100644 --- a/usr/src/lib/libcmd/common/logname.c +++ b/usr/src/lib/libcmd/common/logname.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/md5sum.c b/usr/src/lib/libcmd/common/md5sum.c index f4f7e6ad9b..c4cafa98c7 100644 --- a/usr/src/lib/libcmd/common/md5sum.c +++ b/usr/src/lib/libcmd/common/md5sum.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/mkdir.c b/usr/src/lib/libcmd/common/mkdir.c index 596ef2b6b8..5ccce98221 100644 --- a/usr/src/lib/libcmd/common/mkdir.c +++ b/usr/src/lib/libcmd/common/mkdir.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -73,22 +73,28 @@ b_mkdir(int argc, char** argv, void* context) struct stat st; cmdinit(argc, argv, context, ERROR_CATALOG, 0); - while (n = optget(argv, usage)) switch (n) + for (;;) { - case 'p': - pflag = 1; - break; - case 'm': - mflag = 1; - mode = strperm(arg = opt_info.arg, &opt_info.arg, mode); - if (*opt_info.arg) - error(ERROR_exit(0), "%s: invalid mode", arg); - break; - case ':': - error(2, "%s", opt_info.arg); - break; - case '?': - error(ERROR_usage(2), "%s", opt_info.arg); + switch (optget(argv, usage)) + { + case 0: + break; + case 'p': + pflag = 1; + continue; + case 'm': + mflag = 1; + mode = strperm(arg = opt_info.arg, &opt_info.arg, mode); + if (*opt_info.arg) + error(ERROR_exit(0), "%s: invalid mode", arg); + continue; + case ':': + error(2, "%s", opt_info.arg); + continue; + case '?': + error(ERROR_usage(2), "%s", opt_info.arg); + continue; + } break; } argv += opt_info.index; diff --git a/usr/src/lib/libcmd/common/mkfifo.c b/usr/src/lib/libcmd/common/mkfifo.c index 7bc56747f7..8692c0702d 100644 --- a/usr/src/lib/libcmd/common/mkfifo.c +++ b/usr/src/lib/libcmd/common/mkfifo.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -26,9 +26,8 @@ * mkfifo */ - static const char usage[] = -"[-?\n@(#)$Id: mkfifo (AT&T Research) 1999-04-20 $\n]" +"[-?\n@(#)$Id: mkfifo (AT&T Research) 2009-01-02 $\n]" USAGE_LICENSE "[+NAME?mkfifo - make FIFOs (named pipes)]" "[+DESCRIPTION?\bmkfifo\b creates one or more FIFO's. By " @@ -50,40 +49,50 @@ USAGE_LICENSE #include <cmd.h> #include <ls.h> -#define RWALL (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) - int b_mkfifo(int argc, char *argv[], void* context) { - register char *arg; - register mode_t mode=RWALL, mask=0; - register int n; + register char* arg; + register mode_t mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH; + register mode_t mask = 0; + register int mflag = 0; cmdinit(argc, argv, context, ERROR_CATALOG, 0); - while (n = optget(argv, usage)) switch (n) + for (;;) { - case 'm': - mode = strperm(arg=opt_info.arg,&opt_info.arg,mode); - if(*opt_info.arg) - error(ERROR_exit(0),"%s: invalid mode",arg); - break; - case ':': - error(2, "%s",opt_info.arg); - break; - case '?': - error(ERROR_usage(2), "%s",opt_info.arg); + switch (optget(argv, usage)) + { + case 0: + break; + case 'm': + mflag = 1; + mode = strperm(arg = opt_info.arg, &opt_info.arg, mode); + if (*opt_info.arg) + error(ERROR_exit(0), "%s: invalid mode", arg); + continue; + case ':': + error(2, "%s", opt_info.arg); + continue; + case '?': + error(ERROR_usage(2), "%s", opt_info.arg); + continue; + } break; } argv += opt_info.index; - if(error_info.errors || !*argv) - error(ERROR_usage(2),"%s",optusage(NiL)); - while(arg = *argv++) + if (error_info.errors || !*argv) + error(ERROR_usage(2), "%s", optusage(NiL)); + mask = umask(0); + if (!mflag) { - if(mkfifo(arg,mode) < 0) - error(ERROR_system(0),"%s:",arg); + mode &= ~mask; + umask(mask); + mask = 0; } - if(mask) + while (arg = *argv++) + if (mkfifo(arg, mode) < 0) + error(ERROR_system(0), "%s:", arg); + if (mask) umask(mask); - return(error_info.errors!=0); + return error_info.errors != 0; } - diff --git a/usr/src/lib/libcmd/common/mktemp.c b/usr/src/lib/libcmd/common/mktemp.c new file mode 100644 index 0000000000..2936a56e22 --- /dev/null +++ b/usr/src/lib/libcmd/common/mktemp.c @@ -0,0 +1,164 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1992-2009 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 <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +static const char usage[] = +"[-?\n@(#)$Id: mktemp (AT&T Research) 2009-06-19 $\n]" +USAGE_LICENSE +"[+NAME?mktemp - make temporary file or directory]" +"[+DESCRIPTION?\bmktemp\b creates a temporary file with optional base " + "name prefix \aprefix\a. If \aprefix\a is omitted then \btmp_\b is used " + "and \b--tmp\b is implied. If \aprefix\a contains a directory prefix " + "then that directory overrides any of the directories described below. A " + "temporary file will have mode \brw-------\b and a temporary directory " + "will have mode \brwx------\b, subject to \bumask\b(1). Generated paths " + "have these attributes:]" + "{" + "[+*?Lower case to avoid clashes on case ignorant filesystems.]" + "[+*?Pseudo-random part to deter denial of service attacks.]" + "[+*?Pseudo-random part is \a3-chars\a.\a3-chars\a to accomodate " + "8.3 filesystems.]" + "}" +"[+?A consecutive sequence of \bX\b's in \aprefix\a is replaced by the " + "pseudo-random part. If there are no \bX\b's then the pseudo-random part " + "is appended to the prefix.]" +"[d:directory?Create a directory instead of a regular file.]" +"[m:mode]:[mode?Set the mode of the created temporary to \amode\a. " + "\amode\a is symbolic or octal mode as in \bchmod\b(1). Relative modes " + "assume an initial mode of \bu=rwx\b.]" +"[p:default?Use \adirectory\a if the \bTMPDIR\b environment variable is " + "not defined. Implies \b--tmp\b.]:[directory]" +"[q:quiet?Suppress file and directory error diagnostics.]" +"[t:tmp|temporary-directory?Create a path rooted in a temporary " + "directory.]" +"[u:unsafe|dry-run?Check for file/directory existence but do not create. " + "Who would want to do that.]" +"\n" +"\n[ prefix ]\n" +"\n" +"[+SEE ALSO?\bmkdir\b(1), \bpathtemp\b(3), \bmktemp\b(3)]" +; + +#include <cmd.h> +#include <ls.h> + +int +b_mktemp(int argc, char** argv, void* context) +{ + mode_t mode = 0; + mode_t mask; + int fd; + int i; + int quiet = 0; + int unsafe = 0; + int* fdp = &fd; + char* dir = ""; + char* pfx; + char* t; + char path[PATH_MAX]; + + cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_NOTIFY); + for (;;) + { + switch (optget(argv, usage)) + { + case 0: + break; + case 'd': + fdp = 0; + continue; + case 'm': + mode = strperm(pfx = opt_info.arg, &opt_info.arg, S_IRWXU); + if (*opt_info.arg) + error(ERROR_exit(0), "%s: invalid mode", pfx); + continue; + case 'p': + if ((t = getenv("TMPDIR")) && *t) + dir = 0; + else + dir = opt_info.arg; + continue; + case 'q': + quiet = 1; + continue; + case 't': + dir = 0; + continue; + case 'u': + unsafe = 1; + fdp = 0; + continue; + case ':': + error(2, "%s", opt_info.arg); + continue; + case '?': + error(ERROR_usage(2), "%s", opt_info.arg); + continue; + } + break; + } + argv += opt_info.index; + if (error_info.errors || (pfx = *argv++) && *argv) + error(ERROR_usage(2), "%s", optusage(NiL)); + mask = umask(0); + if (!mode) + mode = (fdp ? (S_IRUSR|S_IWUSR) : S_IRWXU) & ~mask; + umask(~mode & (S_IRWXU|S_IRWXG|S_IRWXO)); + if (!pfx) + { + pfx = "tmp_"; + if (dir && !*dir) + dir = 0; + } + if (t = strrchr(pfx, '/')) + { + i = ++t - pfx; + dir = fmtbuf(i); + memcpy(dir, pfx, i); + dir[i] = 0; + pfx = t; + } + for (;;) + { + if (!pathtemp(path, sizeof(path), dir, pfx, fdp)) + { + if (quiet) + error_info.errors++; + else + error(ERROR_SYSTEM|2, "cannot create temporary path"); + break; + } + if (fdp || unsafe || !mkdir(path, mode)) + { + if (fdp) + close(*fdp); + sfputr(sfstdout, path, '\n'); + break; + } + if (sh_checksig(context)) + { + error_info.errors++; + break; + } + } + umask(mask); + return error_info.errors != 0; +} diff --git a/usr/src/lib/libcmd/common/mv.c b/usr/src/lib/libcmd/common/mv.c index ec08bea2e4..c84c1092bd 100644 --- a/usr/src/lib/libcmd/common/mv.c +++ b/usr/src/lib/libcmd/common/mv.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/paste.c b/usr/src/lib/libcmd/common/paste.c index ce1dcef087..71da3f472a 100644 --- a/usr/src/lib/libcmd/common/paste.c +++ b/usr/src/lib/libcmd/common/paste.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/pathchk.c b/usr/src/lib/libcmd/common/pathchk.c index 7b0151d69c..ef27bd2788 100644 --- a/usr/src/lib/libcmd/common/pathchk.c +++ b/usr/src/lib/libcmd/common/pathchk.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -26,44 +26,50 @@ */ static const char usage[] = -"[-?\n@(#)$Id: pathchk (AT&T Research) 2006-09-19 $\n]" +"[-?\n@(#)$Id: pathchk (AT&T Research) 2009-07-24 $\n]" USAGE_LICENSE "[+NAME?pathchk - check pathnames for portability]" -"[+DESCRIPTION?\bpathchk\b checks each \apathname\a to see if it " - "is valid and/or portable. A \apathname\a is valid if it " - "can be used to access or create a file without causing syntax " - "errors. A file is portable, if no truncation will result on " - "any conforming POSIX.1 implementation.]" +"[+DESCRIPTION?\bpathchk\b checks each \apathname\a to see if it is " + "valid and/or portable. A \apathname\a is valid if it can be used to " + "access or create a file without causing syntax errors. A file is " + "portable if no truncation will result on any conforming POSIX.1 " + "implementation.]" "[+?By default \bpathchk\b checks each component of each \apathname\a " - "based on the underlying file system. A diagnostic is written " - "to standard error for each pathname that:]{" - "[+-?Is longer than \b$(getconf PATH_MAX)\b bytes.]" - "[+-?Contains any component longer than \b$(getconf NAME_MAX)\b bytes.]" - "[+-?Contains any directory component in a directory that is " - "not searchable.]" - "[+-?Contains any character in any component that is not valid in " - "its containing directory.]" - "[+-?Is empty.]" - "}" -"[p:portability?Instead of performing length checks on the underlying " - "file system, write a diagnostic for each pathname operand that:]{" - "[+-?Is longer than \b$(getconf _POSIX_PATH_MAX)\b bytes.]" - "[+-?Contains any component longer than " - "\b$(getconf _POSIX_NAME_MAX)\b bytes.]" + "based on the underlying file system. A diagnostic is written to " + "standard error for each pathname that:]" + "{" + "[+-?Is longer than \b$(getconf PATH_MAX)\b bytes.]" + "[+-?Contains any component longer than \b$(getconf NAME_MAX)\b " + "bytes.]" + "[+-?Contains any directory component in a directory that is not " + "searchable.]" + "[+-?Contains any character in any component that is not valid " + "in its containing directory.]" + "[+-?Is empty.]" + "}" +"[p:components?Instead of performing length checks on the underlying " + "file system, write a diagnostic for each pathname operand that:]" + "{" + "[+-?Is longer than \b$(getconf _POSIX_PATH_MAX)\b bytes.]" + "[+-?Contains any component longer than \b$(getconf " + "_POSIX_NAME_MAX)\b bytes.]" "[+-?Contains any character in any component that is not in the " - "portable filename character set.]" -#if 0 - "[+-?Contains any component with \b-\b as the first character.]" -#endif - "[+-?Is empty.]" - "}" + "portable filename character set.]" + "}" +"[P:path?Write a diagnostic for each pathname operand that:]" + "{" + "[+-?Contains any component with \b-\b as the first character.]" + "[+-?Is empty.]" + "}" +"[a:all|portability?Equivalent to \b--components\b \b--path\b.]" "\n" "\npathname ...\n" "\n" -"[+EXIT STATUS?]{" +"[+EXIT STATUS?]" + "{" "[+0?All \apathname\a operands passed all of the checks.]" "[+>0?An error occurred.]" -"}" + "}" "[+SEE ALSO?\bgetconf\b(1), \bcreat\b(2), \bpathchk\b(2)]" ; @@ -71,6 +77,9 @@ USAGE_LICENSE #include <cmd.h> #include <ls.h> +#define COMPONENTS 0x1 +#define PATH 0x2 + #define isport(c) (((c)>='a' && (c)<='z') || ((c)>='A' && (c)<='Z') || ((c)>='0' && (c)<='9') || (strchr("._-",(c))!=0) ) /* @@ -82,10 +91,10 @@ static long mypathconf(const char *path, int op) static const char* const ops[] = { "NAME_MAX", "PATH_MAX" }; - errno=0; - if((r=strtol(astconf(ops[op], path, NiL), NiL, 0))<0 && errno==0) - return(LONG_MAX); - return(r); + errno = 0; + if ((r = strtol(astconf(ops[op], path, NiL), NiL, 0)) < 0 && !errno) + return LONG_MAX; + return r; } /* @@ -100,10 +109,11 @@ static int pathchk(char* path, int mode) if(!*path) { - error(2,"path is empty"); - return(0); + if (mode & PATH) + error(2,"path is empty"); + return -1; } - if(mode) + if(mode & COMPONENTS) { name_max = _POSIX_NAME_MAX; path_max = _POSIX_PATH_MAX; @@ -177,7 +187,7 @@ static int pathchk(char* path, int mode) else if(errno==ENAMETOOLONG) { error(2,"%s: pathname too long",path); - return(0); + return -1; } #endif /*ENAMETOOLONG*/ else @@ -186,18 +196,18 @@ static int pathchk(char* path, int mode) } while(*(cpold=cp)) { - if(mode && *cp == '-') + if((mode & PATH) && *cp == '-') { error(2,"%s: path component begins with '-'",path,fmtquote(buf, NiL, "'", 1, 0)); - return(0); + return -1; } while((c= *cp++) && c!='/') - if(mode && !isport(c)) + if((mode & COMPONENTS) && !isport(c)) { buf[0] = c; buf[1] = 0; error(2,"%s: '%s' not in portable character set",path,fmtquote(buf, NiL, "'", 1, 0)); - return(0); + return -1; } if((cp-cpold) > name_max) goto err; @@ -208,41 +218,51 @@ static int pathchk(char* path, int mode) } if((cp-path) >= path_max) { - error(2,"%s: pathname too long",path); - return(0); + error(2, "%s: pathname too long", path); + return -1; } - return(1); -err: - error(2,"%s: component name %.*s too long",path,cp-cpold-1,cpold); - return(0); + return 0; + err: + error(2, "%s: component name %.*s too long", path, cp-cpold-1, cpold); + return -1; } int b_pathchk(int argc, char** argv, void* context) { - register int n, mode=0; - register char *cp; + register int n; + register int mode = 0; + register char* s; cmdinit(argc, argv, context, ERROR_CATALOG, 0); - while (n = optget(argv, usage)) switch (n) + for (;;) { - case 'p': - mode = 1; - break; - case ':': - error(2, "%s", opt_info.arg); - break; - case '?': - error(ERROR_usage(2), "%s", opt_info.arg); + switch (optget(argv, usage)) + { + case 0: + break; + case 'a': + mode |= COMPONENTS|PATH; + continue; + case 'p': + mode |= COMPONENTS; + continue; + case 'P': + mode |= PATH; + continue; + case ':': + error(2, "%s", opt_info.arg); + continue; + case '?': + error(ERROR_usage(2), "%s", opt_info.arg); + continue; + } break; } argv += opt_info.index; - if(*argv==0 || error_info.errors) - error(ERROR_usage(2),"%s", optusage((char*)0)); - while(cp = *argv++) - { - if(!pathchk(cp,mode)) - error_info.errors=1; - } - return(error_info.errors); + if (!*argv || error_info.errors) + error(ERROR_usage(2),"%s", optusage(NiL)); + while (s = *argv++) + pathchk(s, mode); + return error_info.errors != 0; } diff --git a/usr/src/lib/libcmd/common/pids.c b/usr/src/lib/libcmd/common/pids.c index ca419850c1..432b46f345 100644 --- a/usr/src/lib/libcmd/common/pids.c +++ b/usr/src/lib/libcmd/common/pids.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/rev.c b/usr/src/lib/libcmd/common/rev.c index 3c63840bdb..c67a6a4c9f 100644 --- a/usr/src/lib/libcmd/common/rev.c +++ b/usr/src/lib/libcmd/common/rev.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/rev.h b/usr/src/lib/libcmd/common/rev.h index c23ffb381e..c35fbc4ead 100644 --- a/usr/src/lib/libcmd/common/rev.h +++ b/usr/src/lib/libcmd/common/rev.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/revlib.c b/usr/src/lib/libcmd/common/revlib.c index d95bbf0c80..a2407f122b 100644 --- a/usr/src/lib/libcmd/common/revlib.c +++ b/usr/src/lib/libcmd/common/revlib.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/rm.c b/usr/src/lib/libcmd/common/rm.c index d64d209b9d..fbd21583fb 100644 --- a/usr/src/lib/libcmd/common/rm.c +++ b/usr/src/lib/libcmd/common/rm.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: rm (AT&T Research) 2008-10-15 $\n]" +"[-?\n@(#)$Id: rm (AT&T Research) 2009-06-18 $\n]" USAGE_LICENSE "[+NAME?rm - remove files]" "[+DESCRIPTION?\brm\b removes the named \afile\a arguments. By default it" @@ -81,6 +81,7 @@ USAGE_LICENSE typedef struct State_s /* program state */ { + void* context; /* builtin context */ int clobber; /* clear out file data first */ int directory; /* remove(dir) not rmdir(dir) */ int force; /* force actions */ @@ -179,7 +180,7 @@ rm(State_t* state, register FTSENT* ent) { if (state->interactive) { - if ((v = astquery(-1, "remove directory %s? ", ent->fts_path)) < 0) + if ((v = astquery(-1, "remove directory %s? ", ent->fts_path)) < 0 || sh_checksig(state->context)) return -1; if (v > 0) { @@ -253,7 +254,7 @@ rm(State_t* state, register FTSENT* ent) sfputr(sfstdout, ent->fts_path, '\n'); if (state->interactive) { - if ((v = astquery(-1, "remove %s? ", ent->fts_path)) < 0) + if ((v = astquery(-1, "remove %s? ", ent->fts_path)) < 0 || sh_checksig(state->context)) return -1; if (v > 0) { @@ -277,7 +278,8 @@ rm(State_t* state, register FTSENT* ent) errno == ETXTBSY ? "``running program''" : #endif ent->fts_statp->st_uid != state->uid ? "``not owner''" : - fmtmode(ent->fts_statp->st_mode & S_IPERM, 0) + 1, ent->fts_path)) < 0) + fmtmode(ent->fts_statp->st_mode & S_IPERM, 0) + 1, ent->fts_path)) < 0 || + sh_checksig(state->context)) return -1; if (v > 0) { @@ -343,6 +345,7 @@ b_rm(int argc, register char** argv, void* context) cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_NOTIFY); memset(&state, 0, sizeof(state)); + state.context = context; state.fs3d = fs3d(FS3D_TEST); state.terminal = isatty(0); for (;;) diff --git a/usr/src/lib/libcmd/common/rmdir.c b/usr/src/lib/libcmd/common/rmdir.c index e6c370c436..c7acb197f9 100644 --- a/usr/src/lib/libcmd/common/rmdir.c +++ b/usr/src/lib/libcmd/common/rmdir.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/stty.c b/usr/src/lib/libcmd/common/stty.c index 6868d3f326..a7754f447c 100644 --- a/usr/src/lib/libcmd/common/stty.c +++ b/usr/src/lib/libcmd/common/stty.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -26,7 +26,7 @@ */ static const char usage[] = -"[-?@(#)$Id: stty (AT&T Research) 2008-04-01 $\n]" +"[-?@(#)$Id: stty (AT&T Research) 2008-11-10 $\n]" USAGE_LICENSE "[+NAME?stty - set or get terminal modes]" "[+DESCRIPTION?\bstty\b sets certain terminal I/O modes for the device " @@ -913,11 +913,9 @@ b_stty(int argc, char** argv, void* context) { switch (n = optget(argv, usage)) { - case 't': - flags |= T_FLAG; - continue; case 'a': case 'g': + case 't': if (!opt_info.offset || !argv[opt_info.index][opt_info.offset]) { switch (n) @@ -928,6 +926,9 @@ b_stty(int argc, char** argv, void* context) case 'g': flags |= G_FLAG; break; + case 't': + flags |= T_FLAG; + break; } continue; } diff --git a/usr/src/lib/libcmd/common/sum.c b/usr/src/lib/libcmd/common/sum.c index da6dc6fa2a..8b16197863 100644 --- a/usr/src/lib/libcmd/common/sum.c +++ b/usr/src/lib/libcmd/common/sum.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/sync.c b/usr/src/lib/libcmd/common/sync.c index 8ddc855783..863211c225 100644 --- a/usr/src/lib/libcmd/common/sync.c +++ b/usr/src/lib/libcmd/common/sync.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/tail.c b/usr/src/lib/libcmd/common/tail.c index 7eb012af7f..ca128f2938 100644 --- a/usr/src/lib/libcmd/common/tail.c +++ b/usr/src/lib/libcmd/common/tail.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -28,7 +28,7 @@ */ static const char usage[] = -"+[-?\n@(#)$Id: tail (AT&T Research) 2006-10-18 $\n]" +"+[-?\n@(#)$Id: tail (AT&T Research) 2009-08-25 $\n]" USAGE_LICENSE "[+NAME?tail - output trailing portion of one or more files ]" "[+DESCRIPTION?\btail\b copies one or more input files to standard output " @@ -44,21 +44,25 @@ USAGE_LICENSE "followed by one of the following characters to specify a different " "unit other than a single byte:]{" "[+b?512 bytes.]" - "[+k?1-kilobyte.]" - "[+m?1-megabyte.]" + "[+k?1 KiB.]" + "[+m?1 MiB.]" + "[+g?1 GiB.]" "}" "[+?For backwards compatibility, \b-\b\anumber\a is equivalent to " "\b-n\b \anumber\a and \b+\b\anumber\a is equivalent to " - "\b-n -\b\anumber\a.]" + "\b-n -\b\anumber\a. \anumber\a may also have these option " + "suffixes: \bb c f g k l m r\b.]" "[n:lines]:[lines:=10?Copy \alines\a lines from each file. A negative value " - "for \alines\a indicates an offset from the start of the file.]" + "for \alines\a indicates an offset from the end of the file.]" +"[b:blocks?Copy units of 512 bytes.]" "[c:bytes]:?[chars?Copy \achars\a bytes from each file. A negative value " - "for \achars\a indicates an offset from the start of the file.]" + "for \achars\a indicates an offset from the end of the file.]" "[f:forever|follow?Loop forever trying to read more characters as the " "end of each file to copy new data. Ignored if reading from a pipe " "or fifo.]" "[h!:headers?Output filename headers.]" +"[l:lines?Copy units of lines. This is the default.]" "[L:log?When a \b--forever\b file times out via \b--timeout\b, verify that " "the curent file has not been renamed and replaced by another file " "of the same name (a common log file practice) before giving up on " @@ -83,9 +87,11 @@ USAGE_LICENSE "[+S?scores]" "}" "[v:verbose?Always ouput filename headers.]" + "\n" "\n[file ...]\n" "\n" + "[+EXIT STATUS?]{" "[+0?All files copied successfully.]" "[+>0?One or more files did not copy.]" @@ -103,17 +109,18 @@ USAGE_LICENSE #define ERROR (1<<1) #define FOLLOW (1<<2) #define HEADERS (1<<3) -#define LOG (1<<4) -#define NEGATIVE (1<<5) -#define POSITIVE (1<<6) -#define REVERSE (1<<7) -#define SILENT (1<<8) -#define TIMEOUT (1<<9) -#define VERBOSE (1<<10) +#define LINES (1<<4) +#define LOG (1<<5) +#define NEGATIVE (1<<6) +#define POSITIVE (1<<7) +#define REVERSE (1<<8) +#define SILENT (1<<9) +#define TIMEOUT (1<<10) +#define VERBOSE (1<<11) #define NOW (unsigned long)time(NiL) -#define LINES 10 +#define DEFAULT 10 #ifdef S_ISSOCK #define FIFO(m) (S_ISFIFO(m)||S_ISSOCK(m)) @@ -132,8 +139,11 @@ struct Tail_s unsigned long expire; long dev; long ino; + int fifo; }; +static const char header_fmt[] = "\n==> %s <==\n"; + /* * if file is seekable, position file to tail location and return offset * otherwise, return -1 @@ -159,10 +169,10 @@ tailpos(register Sfio_t* fp, register Sfoff_t number, int delim) return first; return offset; } - if ((offset = last - SF_BUFSIZE) < first) - offset = first; for (;;) { + if ((offset = last - SF_BUFSIZE) < first) + offset = first; sfseek(fp, offset, SEEK_SET); n = last - offset; if (!(s = sfreserve(fp, n, SF_LOCKR))) @@ -178,8 +188,6 @@ tailpos(register Sfio_t* fp, register Sfoff_t number, int delim) if (offset == first) break; last = offset; - if ((offset = last - SF_BUFSIZE) < first) - offset = first; } return first; } @@ -245,11 +253,13 @@ pipetail(Sfio_t* infile, Sfio_t* outfile, Sfoff_t number, int delim) */ static int -init(Tail_t* tp, Sfoff_t number, int delim, int flags) +init(Tail_t* tp, Sfoff_t number, int delim, int flags, const char** format) { Sfoff_t offset; + Sfio_t* op; struct stat st; + tp->fifo = 0; if (tp->sp) { offset = 0; @@ -273,12 +283,46 @@ init(Tail_t* tp, Sfoff_t number, int delim, int flags) sfset(tp->sp, SF_SHARE, 0); if (offset) { - if ((offset = tailpos(tp->sp, number, delim)) < 0) + if (number < 0 || !number && (flags & POSITIVE)) + { + sfset(tp->sp, SF_SHARE, !(flags & FOLLOW)); + if (number < -1) + { + sfmove(tp->sp, NiL, -number - 1, delim); + offset = sfseek(tp->sp, (Sfoff_t)0, SEEK_CUR); + } + else + offset = 0; + } + else if ((offset = tailpos(tp->sp, number, delim)) >= 0) + sfseek(tp->sp, offset, SEEK_SET); + else if (fstat(sffileno(tp->sp), &st)) + { + error(ERROR_system(0), "%s: cannot stat", tp->name); + goto bad; + } + else if (!FIFO(st.st_mode)) { error(ERROR_SYSTEM|2, "%s: cannot position file to tail", tp->name); goto bad; } - sfseek(tp->sp, offset, SEEK_SET); + else + { + tp->fifo = 1; + if (flags & (HEADERS|VERBOSE)) + { + sfprintf(sfstdout, *format, tp->name); + *format = header_fmt; + } + op = (flags & REVERSE) ? sftmp(4*SF_BUFSIZE) : sfstdout; + pipetail(tp->sp ? tp->sp : sfstdin, op, number, delim); + if (flags & REVERSE) + { + sfseek(op, (Sfoff_t)0, SEEK_SET); + rev_line(op, sfstdout, (Sfoff_t)0); + sfclose(op); + } + } } tp->last = offset; if (flags & LOG) @@ -325,10 +369,8 @@ num(register const char* s, char** e, int* f, int o) s++; errno = 0; number = strtonll(s, &t, NiL, 0); - if (!o && t > s && *(t - 1) == 'l') - t--; if (t == s) - number = LINES; + number = DEFAULT; if (o && *t) { number = 0; @@ -346,6 +388,8 @@ num(register const char* s, char** e, int* f, int o) else { *f |= COUNT; + if (t > s && isalpha(*(t - 1))) + *f &= ~LINES; if (c == '-') number = -number; } @@ -357,24 +401,23 @@ num(register const char* s, char** e, int* f, int o) int b_tail(int argc, char** argv, void* context) { - static const char header_fmt[] = "\n==> %s <==\n"; - register Sfio_t* ip; register int n; register int i; - register int delim = '\n'; - int flags = HEADERS; + int delim; + int flags = HEADERS|LINES; + int blocks = 0; char* s; char* t; char* r; char* e; char* file; Sfoff_t offset; - Sfoff_t number = LINES; + Sfoff_t number = DEFAULT; unsigned long timeout = 0; struct stat st; const char* format = header_fmt+1; - size_t z; + ssize_t z; Sfio_t* op; register Tail_t* fp; register Tail_t* pp; @@ -386,13 +429,38 @@ b_tail(int argc, char** argv, void* context) { switch (n = optget(argv, usage)) { - case 'c': - delim = -1; - if (opt_info.arg && *opt_info.arg=='f' && !*(opt_info.arg+1)) + case 0: + if (!(flags & FOLLOW) && argv[opt_info.index] && (argv[opt_info.index][0] == '-' || argv[opt_info.index][0] == '+') && !argv[opt_info.index][1]) { - flags |= FOLLOW; + number = argv[opt_info.index][0] == '-' ? 10 : -10; + flags |= LINES; + opt_info.index++; continue; } + break; + case 'b': + blocks = 512; + flags &= ~LINES; + if (opt_info.option[0] == '+') + number = -number; + continue; + case 'c': + flags &= ~LINES; + if (opt_info.arg == argv[opt_info.index - 1]) + { + strtol(opt_info.arg, &s, 10); + if (*s) + { + opt_info.index--; + t = ""; + goto suffix; + } + } + else if (opt_info.arg && isalpha(*opt_info.arg)) + { + t = opt_info.arg; + goto suffix; + } /*FALLTHROUGH*/ case 'n': flags |= COUNT; @@ -400,14 +468,14 @@ b_tail(int argc, char** argv, void* context) number = num(s, &s, &flags, n); else { - number = LINES; + number = DEFAULT; flags &= ~(ERROR|NEGATIVE|POSITIVE); s = ""; } - if (n=='c' && *s=='f') + if (n != 'n' && s && isalpha(*s)) { - s++; - flags |= FOLLOW; + t = s; + goto suffix; } if (flags & ERROR) continue; @@ -425,6 +493,11 @@ b_tail(int argc, char** argv, void* context) else flags &= ~HEADERS; continue; + case 'l': + flags |= LINES; + if (opt_info.option[0] == '+') + number = -number; + continue; case 'L': flags |= LOG; continue; @@ -448,32 +521,46 @@ b_tail(int argc, char** argv, void* context) continue; case ':': /* handle old style arguments */ - r = s = argv[opt_info.index]; - number = num(s, &t, &flags, 0); + if (!(r = argv[opt_info.index]) || !opt_info.offset) + { + error(2, "%s", opt_info.arg); + break; + } + s = r + opt_info.offset - 1; + if (i = *(s - 1) == '-' || *(s - 1) == '+') + s--; + if ((number = num(s, &t, &flags, 0)) && i) + number = -number; + goto compatibility; + suffix: + r = 0; + if (opt_info.option[0] == '+') + number = -number; + compatibility: for (;;) { switch (*t++) { case 0: - opt_info.offset = t - r - 1; - if (number) - number = -number; + if (r) + opt_info.offset = t - r - 1; break; case 'c': - delim = -1; + flags &= ~LINES; continue; case 'f': flags |= FOLLOW; continue; case 'l': - delim = '\n'; + flags |= LINES; continue; case 'r': flags |= REVERSE; continue; default: error(2, "%s: invalid suffix", t - 1); - opt_info.offset = strlen(r); + if (r) + opt_info.offset = strlen(r); break; } break; @@ -496,12 +583,15 @@ b_tail(int argc, char** argv, void* context) } else if (!*(argv + 1)) flags &= ~HEADERS; + delim = (flags & LINES) ? '\n' : -1; + if (blocks) + number *= blocks; if (flags & REVERSE) { if (delim < 0) error(2, "--reverse requires line mode"); - else if (!(flags & COUNT)) - number = 0; + if (!(flags & COUNT)) + number = -1; flags &= ~FOLLOW; } if ((flags & (FOLLOW|TIMEOUT)) == TIMEOUT) @@ -527,7 +617,7 @@ b_tail(int argc, char** argv, void* context) { fp->name = s; fp->sp = 0; - if (!init(fp, number, delim, flags)) + if (!init(fp, number, delim, flags, &format)) { fp->expire = timeout ? (NOW + timeout + 1) : 0; if (files) @@ -542,27 +632,35 @@ b_tail(int argc, char** argv, void* context) return error_info.errors != 0; pp->next = 0; hp = 0; - for (;;) + while (fp = files) { if (sfsync(sfstdout)) error(ERROR_system(1), "write error"); +#if 0 sleep(1); +#else + { + struct timespec rqt = { 0L, 1000000000L/4L }; + (void)nanosleep(&rqt, NULL); + } +#endif n = 0; pp = 0; - fp = files; while (fp) { if (fstat(sffileno(fp->sp), &st)) error(ERROR_system(0), "%s: cannot stat", fp->name); - else if (st.st_size > fp->last) + else if (st.st_size > fp->last || fp->fifo) { n = 1; if (timeout) fp->expire = NOW + timeout; - z = st.st_size - fp->last; + z = fp->fifo ? SF_UNBOUND : st.st_size - fp->last; i = 0; if ((s = sfreserve(fp->sp, z, SF_LOCKR)) || (z = sfvalue(fp->sp)) && (s = sfreserve(fp->sp, z, SF_LOCKR)) && (i = 1)) { + if (fp->fifo) + z = sfvalue(fp->sp); r = 0; for (e = (t = s) + z; t < e; t++) if (*t == '\n') @@ -594,7 +692,7 @@ b_tail(int argc, char** argv, void* context) i = 3; while (--i && stat(fp->name, &st)) sleep(1); - if (i && (fp->dev != st.st_dev || fp->ino != st.st_ino) && !init(fp, 0, 0, flags)) + if (i && (fp->dev != st.st_dev || fp->ino != st.st_ino) && !init(fp, 0, 0, flags, &format)) { if (!(flags & SILENT)) error(ERROR_warn(0), "%s: log file change", fp->name); @@ -636,11 +734,13 @@ b_tail(int argc, char** argv, void* context) continue; } if (flags & (HEADERS|VERBOSE)) + { sfprintf(sfstdout, format, file); - format = header_fmt; + format = header_fmt; + } if (number < 0 || !number && (flags & POSITIVE)) { - sfset(ip, SF_SHARE, !(flags & FOLLOW)); + sfset(ip, SF_SHARE, 1); if (number < -1) sfmove(ip, NiL, -number - 1, delim); if (flags & REVERSE) diff --git a/usr/src/lib/libcmd/common/tee.c b/usr/src/lib/libcmd/common/tee.c index c1189bade7..246b5af9c3 100644 --- a/usr/src/lib/libcmd/common/tee.c +++ b/usr/src/lib/libcmd/common/tee.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: tee (AT&T Research) 2007-11-11 $\n]" +"[-?\n@(#)$Id: tee (AT&T Research) 2009-06-19 $\n]" USAGE_LICENSE "[+NAME?tee - duplicate standard input]" "[+DESCRIPTION?\btee\b copies standard input to standard output " @@ -52,7 +52,6 @@ USAGE_LICENSE "[+SEE ALSO?\bcat\b(1), \bsignal\b(3)]" ; - #include <cmd.h> #include <ls.h> #include <sig.h> @@ -60,6 +59,7 @@ USAGE_LICENSE typedef struct Tee_s { Sfdisc_t disc; + int line; int fd[1]; } Tee_t; @@ -67,7 +67,8 @@ typedef struct Tee_s * This discipline writes to each file in the list given in handle */ -static ssize_t tee_write(Sfio_t* fp, const void* buf, size_t n, Sfdisc_t* handle) +static ssize_t +tee_write(Sfio_t* fp, const void* buf, size_t n, Sfdisc_t* handle) { register const char* bp; register const char* ep; @@ -82,11 +83,27 @@ static ssize_t tee_write(Sfio_t* fp, const void* buf, size_t n, Sfdisc_t* handle while (bp < ep) { if ((r = write(fd, bp, ep - bp)) <= 0) - return(-1); + return -1; bp += r; } } while ((fd = *hp++) >= 0); - return(n); + return n; +} + +static void +tee_cleanup(register Tee_t* tp) +{ + register int* hp; + register int n; + + if (tp) + { + sfdisc(sfstdout, NiL); + if (tp->line >= 0) + sfset(sfstdout, SF_LINE, tp->line); + for (hp = tp->fd; (n = *hp) >= 0; hp++) + close(n); + } } int @@ -100,32 +117,45 @@ b_tee(int argc, register char** argv, void* context) int line; Sfdisc_t tee_disc; - cmdinit(argc, argv, context, ERROR_CATALOG, 0); + if (argc <= 0) + { + if (context && (tp = (Tee_t*)sh_context(context)->data)) + { + sh_context(context)->data = 0; + tee_cleanup(tp); + } + return 0; + } + cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_CALLBACK); line = -1; - while (n = optget(argv, usage)) switch (n) + for (;;) { - case 'a': - oflag &= ~O_TRUNC; - oflag |= O_APPEND; - break; - case 'i': - signal(SIGINT, SIG_IGN); - break; - case 'l': - line = sfset(sfstdout, 0, 0) & SF_LINE; - if ((line == 0) == (opt_info.num == 0)) - line = -1; - else - sfset(sfstdout, SF_LINE, !!opt_info.num); - break; - case ':': - error(2, "%s", opt_info.arg); - break; - case '?': - error(ERROR_usage(2), "%s", opt_info.arg); + switch (optget(argv, usage)) + { + case 'a': + oflag &= ~O_TRUNC; + oflag |= O_APPEND; + continue; + case 'i': + signal(SIGINT, SIG_IGN); + continue; + case 'l': + line = sfset(sfstdout, 0, 0) & SF_LINE; + if ((line == 0) == (opt_info.num == 0)) + line = -1; + else + sfset(sfstdout, SF_LINE, !!opt_info.num); + continue; + case ':': + error(2, "%s", opt_info.arg); + break; + case '?': + error(ERROR_usage(2), "%s", opt_info.arg); + break; + } break; } - if(error_info.errors) + if (error_info.errors) error(ERROR_usage(2), "%s", optusage(NiL)); argv += opt_info.index; argc -= opt_info.index; @@ -139,40 +169,36 @@ b_tee(int argc, register char** argv, void* context) #endif if (argc > 0) { - if (!(tp = (Tee_t*)stakalloc(sizeof(Tee_t) + argc * sizeof(int)))) - error(ERROR_exit(1), "no space"); - memset(&tee_disc, 0, sizeof(tee_disc)); - tee_disc.writef = tee_write; - tp->disc = tee_disc; - hp = tp->fd; - while (cp = *argv++) + if (tp = (Tee_t*)stakalloc(sizeof(Tee_t) + argc * sizeof(int))) { - if ((*hp = open(cp, oflag, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) < 0) - error(ERROR_system(0), "%s: cannot create", cp); - else hp++; + memset(&tp->disc, 0, sizeof(tp->disc)); + tp->disc.writef = tee_write; + if (context) + sh_context(context)->data = (void*)tp; + tp->line = line; + hp = tp->fd; + while (cp = *argv++) + { + if ((*hp = open(cp, oflag, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) < 0) + error(ERROR_system(0), "%s: cannot create", cp); + else + hp++; + } + if (hp == tp->fd) + tp = 0; + else + { + *hp = -1; + sfdisc(sfstdout, &tp->disc); + } } - if (hp == tp->fd) - tp = 0; else - { - *hp = -1; - sfdisc(sfstdout, &tp->disc); - } - } - if (sfmove(sfstdin, sfstdout, SF_UNBOUND, -1) < 0 || !sfeof(sfstdin) || sfsync(sfstdout)) - error(ERROR_system(1), "cannot copy"); - - /* - * close files and free resources - */ - - if (tp) - { - sfdisc(sfstdout, NiL); - if (line >= 0) - sfset(sfstdout, SF_LINE, line); - for(hp = tp->fd; (n = *hp) >= 0; hp++) - close(n); + error(ERROR_exit(0), "out of space"); } - return(error_info.errors); + if ((sfmove(sfstdin, sfstdout, SF_UNBOUND, -1) < 0 || !sfeof(sfstdin)) && errno != EPIPE) + error(ERROR_system(0), "read error"); + if (sfsync(sfstdout)) + error(ERROR_system(0), "write error"); + tee_cleanup(tp); + return error_info.errors; } diff --git a/usr/src/lib/libcmd/common/tty.c b/usr/src/lib/libcmd/common/tty.c index 4db11b9185..b257290e50 100644 --- a/usr/src/lib/libcmd/common/tty.c +++ b/usr/src/lib/libcmd/common/tty.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libcmd/common/uname.c b/usr/src/lib/libcmd/common/uname.c index 72605200be..74cbd39ebe 100644 --- a/usr/src/lib/libcmd/common/uname.c +++ b/usr/src/lib/libcmd/common/uname.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -104,7 +104,7 @@ __STDPP__directive pragma pp:nohide getdomainname gethostid gethostname sethostn extern int getdomainname(char*, size_t); #endif #if _lib_gethostid -extern int gethostid(void); +extern long gethostid(void); #endif #if _lib_gethostname extern int gethostname(char*, size_t); diff --git a/usr/src/lib/libcmd/common/uniq.c b/usr/src/lib/libcmd/common/uniq.c index d49954a710..bf87a2a15a 100644 --- a/usr/src/lib/libcmd/common/uniq.c +++ b/usr/src/lib/libcmd/common/uniq.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -26,17 +26,17 @@ */ static const char usage[] = -"[-n?\n@(#)$Id: uniq (AT&T Research) 2008-04-24 $\n]" +"[-n?\n@(#)$Id: uniq (AT&T Research) 2009-08-10 $\n]" USAGE_LICENSE "[+NAME?uniq - Report or filter out repeated lines in a file]" -"[+DESCRIPTION?\buniq\b reads an input, comparing adjacent lines, and " - "writing one copy of each input line on the output. The second " +"[+DESCRIPTION?\buniq\b reads the input, compares adjacent lines, and " + "writes one copy of each input line on the output. The second " "and succeeding copies of the repeated adjacent lines are not " "written.]" "[+?If the output file, \aoutfile\a, is not specified, \buniq\b writes " "to standard output. If no \ainfile\a is given, or if the \ainfile\a " - "is \b-\b, \buniq\b reads from standard input with the start of " - "the file is defined as the current offset.]" + "is \b-\b, \buniq\b reads from standard input with the start of " + "the file defined as the current offset.]" "[c:count?Output the number of times each line occurred along with " "the line.]" "[d:repeated|duplicates?Output the first of each duplicate line.]" @@ -49,13 +49,15 @@ USAGE_LICENSE "}" "[f:skip-fields]#[fields?\afields\a is the number of fields to skip over " "before checking for uniqueness. A field is the minimal string matching " - "the BRE \b[[:blank:]]]]*[^[:blank:]]]]*\b.]" + "the BRE \b[[:blank:]]]]*[^[:blank:]]]]*\b. -\anumber\a is equivalent to " + "\b--skip-fields\b=\anumber\a.]" "[i:ignore-case?Ignore case in comparisons.]" "[s:skip-chars]#[chars?\achars\a is the number of characters to skip over " "before checking for uniqueness. If specified along with \b-f\b, " "the first \achars\a after the first \afields\a are ignored. If " "the \achars\a specifies more characters than are on the line, " - "an empty string will be used for comparison.]" + "an empty string will be used for comparison. +\anumber\a is " + "equivalent to \b--skip-chars\b=\anumber\a.]" "[u:unique?Output unique lines.]" "[w:check-chars]#[chars?\achars\a is the number of characters to compare " "after skipping any specified fields and characters.]" @@ -145,11 +147,25 @@ static int uniq(Sfio_t *fdin, Sfio_t *fdout, int fields, int chars, int width, i { if(cwidth) { - outp[CWIDTH] = ' '; - if(count<MAXCNT) + if(count<9) { - sfsprintf(outp,cwidth,"%*d",CWIDTH,count+1); - outp[CWIDTH] = ' '; + f = 0; + while(f < CWIDTH-1) + outp[f++] = ' '; + outp[f++] = '0' + count + 1; + outp[f] = ' '; + } + else if(count<MAXCNT) + { + count++; + f = CWIDTH; + outp[f--] = ' '; + do + { + outp[f--] = '0' + (count % 10); + } while (count /= 10); + while (f >= 0) + outp[f--] = ' '; } else { diff --git a/usr/src/lib/libcmd/common/wc.c b/usr/src/lib/libcmd/common/wc.c index 763090fc02..4203fffd3a 100644 --- a/usr/src/lib/libcmd/common/wc.c +++ b/usr/src/lib/libcmd/common/wc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: wc (AT&T Research) 2006-08-25 $\n]" +"[-?\n@(#)$Id: wc (AT&T Research) 2000-08-11 $\n]" USAGE_LICENSE "[+NAME?wc - print the number of bytes, words, and lines in files]" "[+DESCRIPTION?\bwc\b reads one or more input files and, by default, " @@ -50,7 +50,10 @@ USAGE_LICENSE "[c:bytes|chars:chars?List the byte counts.]" "[m|C:multibyte-chars?List the character counts.]" "[q:quiet?Suppress invalid multibyte character warnings.]" -"[L:longest-line|max-line-length?List the longest line length.]" +"[L:longest-line|max-line-length?List the longest line length; the newline," + "if any, is not counted in the length.]" +"[N!:utf8?For \bUTF-8\b locales \b--noutf8\b disables \bUTF-8\b " + "optimzations and relies on the native \bmbtowc\b(3).]" "\n" "\n[file ...]\n" "\n" @@ -70,15 +73,15 @@ USAGE_LICENSE static void printout(register Wc_t *wp, register char *name,register int mode) { - if(mode&WC_LINES) + if (mode&WC_LINES) sfprintf(sfstdout," %7I*d",sizeof(wp->lines),wp->lines); - if(mode&WC_WORDS) + if (mode&WC_WORDS) sfprintf(sfstdout," %7I*d",sizeof(wp->words),wp->words); - if(mode&WC_CHARS) + if (mode&WC_CHARS) sfprintf(sfstdout," %7I*d",sizeof(wp->chars),wp->chars); - if(mode&WC_LONGEST) + if (mode&WC_LONGEST) sfprintf(sfstdout," %7I*d",sizeof(wp->chars),wp->longest); - if(name) + if (name) sfprintf(sfstdout," %s",name); sfputc(sfstdout,'\n'); } @@ -94,71 +97,72 @@ b_wc(int argc,register char **argv, void* context) struct stat statb; cmdinit(argc, argv, context, ERROR_CATALOG, 0); - while (n = optget(argv,usage)) switch (n) + for (;;) { - case 'c': - mode |= WC_CHARS; - break; - case 'l': - mode |= WC_LINES; - break; - case 'L': - mode |= WC_LONGEST; - break; - case 'm': - case 'C': - mode |= WC_MBYTE; - break; - case 'q': - mode |= WC_QUIET; - break; - case 'w': - mode |= WC_WORDS; - break; - case ':': - error(2, "%s", opt_info.arg); - break; - case '?': - error(ERROR_usage(2), "%s", opt_info.arg); + switch (optget(argv, usage)) + { + case 'c': + mode |= WC_CHARS; + continue; + case 'l': + mode |= WC_LINES; + continue; + case 'L': + mode |= WC_LONGEST; + continue; + case 'N': + if (!opt_info.num) + mode |= WC_NOUTF8; + continue; + case 'm': + case 'C': + mode |= WC_MBYTE; + continue; + case 'q': + mode |= WC_QUIET; + continue; + case 'w': + mode |= WC_WORDS; + continue; + case ':': + error(2, "%s", opt_info.arg); + break; + case '?': + error(ERROR_usage(2), "%s", opt_info.arg); + break; + } break; } argv += opt_info.index; if (error_info.errors) error(ERROR_usage(2), "%s", optusage(NiL)); - if(mode&WC_MBYTE) + if (mode&WC_MBYTE) { - if(mode&WC_CHARS) + if (mode&WC_CHARS) error(2, "-c and -C are mutually exclusive"); - mode |= WC_CHARS; - if(!mbwide()) - { + if (!mbwide()) mode &= ~WC_MBYTE; - setlocale(LC_CTYPE, "C"); - } + mode |= WC_CHARS; } - if(!(mode&(WC_WORDS|WC_CHARS|WC_LINES|WC_MBYTE|WC_LONGEST))) + if (!(mode&(WC_WORDS|WC_CHARS|WC_LINES|WC_MBYTE|WC_LONGEST))) mode |= (WC_WORDS|WC_CHARS|WC_LINES); - if(!(wp = wc_init(mode))) + if (!(wp = wc_init(mode))) error(3,"internal error"); - if(!(mode&WC_WORDS)) - { - memzero(wp->space, (1<<CHAR_BIT)); - wp->space['\n'] = -1; - } - if(cp = *argv) + if (cp = *argv) argv++; + n = 0; do { - if(!cp || streq(cp,"-")) + if (!cp || streq(cp,"-")) fp = sfstdin; - else if(!(fp = sfopen(NiL,cp,"r"))) + else if (!(fp = sfopen(NiL,cp,"r"))) { error(ERROR_system(0),"%s: cannot open",cp); continue; } - if(cp) + if (cp) n++; - if(!(mode&(WC_WORDS|WC_LINES|WC_MBYTE|WC_LONGEST)) && fstat(sffileno(fp),&statb)>=0 + if (!(mode&(WC_WORDS|WC_LINES|WC_MBYTE|WC_LONGEST)) && fstat(sffileno(fp),&statb)>=0 && S_ISREG(statb.st_mode)) { wp->chars = statb.st_size - lseek(sffileno(fp),0L,1); @@ -166,21 +170,19 @@ b_wc(int argc,register char **argv, void* context) } else wc_count(wp, fp, cp); - if(fp!=sfstdin) + if (fp!=sfstdin) sfclose(fp); tchars += wp->chars; twords += wp->words; tlines += wp->lines; printout(wp,cp,mode); - } - while(cp= *argv++); - if(n>1) + } while (cp= *argv++); + if (n > 1) { wp->lines = tlines; wp->chars = tchars; wp->words = twords; printout(wp,"total",mode); } - return(error_info.errors<ERRORMAX?error_info.errors:ERRORMAX); + return error_info.errors<ERRORMAX?error_info.errors:ERRORMAX; } - diff --git a/usr/src/lib/libcmd/common/wc.h b/usr/src/lib/libcmd/common/wc.h index 2752af36a3..e23a1ec2c4 100644 --- a/usr/src/lib/libcmd/common/wc.h +++ b/usr/src/lib/libcmd/common/wc.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -37,15 +37,17 @@ #define WC_MBYTE 0x08 #define WC_LONGEST 0x10 #define WC_QUIET 0x20 +#define WC_NOUTF8 0x40 typedef struct { - signed char space[1<<CHAR_BIT]; + char type[1<<CHAR_BIT]; Sfoff_t words; Sfoff_t lines; Sfoff_t chars; Sfoff_t longest; int mode; + int mb; } Wc_t; #define wc_count _cmd_wccount diff --git a/usr/src/lib/libcmd/common/wclib.c b/usr/src/lib/libcmd/common/wclib.c index 67adb5fe15..c7ce5a338a 100644 --- a/usr/src/lib/libcmd/common/wclib.c +++ b/usr/src/lib/libcmd/common/wclib.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -34,6 +34,7 @@ #include <wchar.h> #include <wctype.h> +#include <lc.h> #else @@ -43,80 +44,197 @@ #endif -#define endline(c) (((signed char)-1)<0?(c)<0:(c)==((char)-1)) -#define mbok(p,n) (((n)<1)?0:mbwide()?((*ast.mb_towc)(NiL,(char*)(p),n)>=0):1) +#define WC_SP 0x08 +#define WC_NL 0x10 +#define WC_MB 0x20 +#define WC_ERR 0x40 -Wc_t *wc_init(int mode) +#define eol(c) ((c)&WC_NL) +#define mbc(c) ((c)&WC_MB) +#define spc(c) ((c)&WC_SP) +#define mbwc(w,p,n) (*ast.mb_towc)(&w,(char*)p,n) + +Wc_t* wc_init(int mode) { register int n; register int w; Wc_t* wp; - if(!(wp = (Wc_t*)stakalloc(sizeof(Wc_t)))) - return(0); - wp->mode = mode; + if (!(wp = (Wc_t*)stakalloc(sizeof(Wc_t)))) + return 0; + if (!mbwide()) + wp->mb = 0; +#if _hdr_wchar && _hdr_wctype && _lib_iswctype + else if (!(mode & WC_NOUTF8) && (lcinfo(LC_CTYPE)->lc->flags & LC_utf8)) + wp->mb = 1; +#endif + else + wp->mb = -1; w = mode & WC_WORDS; - for(n=(1<<CHAR_BIT);--n >=0;) - wp->space[n] = w ? !!isspace(n) : 0; - wp->space['\n'] = -1; - return(wp); + for (n = (1<<CHAR_BIT); --n >= 0;) + wp->type[n] = (w && isspace(n)) ? WC_SP : 0; + wp->type['\n'] = WC_SP|WC_NL; + if ((mode & (WC_MBYTE|WC_WORDS)) && wp->mb > 0) + { + for (n = 0; n < 64; n++) + { + wp->type[0x80+n] |= WC_MB; + if (n<32) + wp->type[0xc0+n] |= WC_MB+1; + else if (n<48) + wp->type[0xc0+n] |= WC_MB+2; + else if (n<56) + wp->type[0xc0+n] |= WC_MB+3; + else if (n<60) + wp->type[0xc0+n] |= WC_MB+4; + else if (n<62) + wp->type[0xc0+n] |= WC_MB+5; + } + wp->type[0xc0] = WC_MB|WC_ERR; + wp->type[0xc1] = WC_MB|WC_ERR; + wp->type[0xfe] = WC_MB|WC_ERR; + wp->type[0xff] = WC_MB|WC_ERR; + } + wp->mode = mode; + return wp; +} + +static int invalid(const char *file, int nlines) +{ + error_info.file = (char*)file; + error_info.line = nlines; + error(ERROR_SYSTEM|1, "invalid multibyte character"); + error_info.file = 0; + error_info.line = 0; + return nlines; +} + +/* + * handle utf space characters + */ + +static int chkstate(int state, register unsigned int c) +{ + switch(state) + { + case 1: + state = (c==0x9a?4:0); + break; + case 2: + state = ((c==0x80||c==0x81)?6+(c&1):0); + break; + case 3: + state = (c==0x80?5:0); + break; + case 4: + state = (c==0x80?10:0); + break; + case 5: + state = (c==0x80?10:0); + break; + case 6: + state = 0; + if(c==0xa0 || c==0xa1) + return(10); + else if((c&0xf0)== 0x80) + { + if((c&=0xf)==7) + return(iswspace(0x2007)?10:0); + if(c<=0xb) + return(10); + } + else if(c==0xaf && iswspace(0x202f)) + return(10); + break; + case 7: + state = (c==0x9f?10:0); + break; + case 8: + return (iswspace(c)?10:0); + } + return state; } /* * compute the line, word, and character count for file <fd> */ + int wc_count(Wc_t *wp, Sfio_t *fd, const char* file) { - register signed char *space = wp->space; - register unsigned char *cp; + register char* type = wp->type; + register unsigned char* cp; register Sfoff_t nchars; register Sfoff_t nwords; register Sfoff_t nlines; - register Sfoff_t eline; - register Sfoff_t longest; + register Sfoff_t eline = -1; + register Sfoff_t longest = 0; register ssize_t c; - register unsigned char *endbuff; - register int lasttype = 1; + register unsigned char* endbuff; + register int lasttype = WC_SP; unsigned int lastchar; - unsigned char *buff; + ssize_t n; + ssize_t o; + unsigned char* buff; wchar_t x; + unsigned char side[32]; sfset(fd,SF_WRITE,1); nlines = nwords = nchars = 0; wp->longest = 0; - if (wp->mode & (WC_LONGEST|WC_MBYTE)) + if (wp->mb < 0 && (wp->mode & (WC_MBYTE|WC_WORDS))) { - longest = 0; - eline = -1; cp = buff = endbuff = 0; for (;;) { - if (!mbok(cp, endbuff-cp)) - { - if (buff) - sfread(fd, buff, cp-buff); - if (!(buff = (unsigned char*)sfreserve(fd, SF_UNBOUND, SF_LOCKR))) - break; - endbuff = (cp = buff) + sfvalue(fd); - } - nchars++; - x = mbchar(cp); - if (x == -1) + if (cp >= endbuff || (n = mbwc(x, cp, endbuff-cp)) < 0) { - if (eline != nlines && !(wp->mode & WC_QUIET)) + if ((o = endbuff-cp) < sizeof(side)) + { + if (buff) + { + if (o) + memcpy(side, cp, o); + mbinit(); + } + else + o = 0; + cp = side + o; + if (!(buff = (unsigned char*)sfreserve(fd, SF_UNBOUND, 0)) || (n = sfvalue(fd)) <= 0) + { + if ((nchars - longest) > wp->longest) + wp->longest = nchars - longest; + break; + } + if ((c = sizeof(side) - o) > n) + c = n; + if (c) + memcpy(cp, buff, c); + endbuff = buff + n; + cp = side; + x = mbchar(cp); + if ((cp-side) < o) + { + cp = buff; + nchars += (cp-side) - 1; + } + else + cp = buff + (cp-side) - o; + } + else { - error_info.file = (char*)file; - error_info.line = eline = nlines; - error(ERROR_SYSTEM|1, "invalid multibyte character"); - error_info.file = 0; - error_info.line = 0; + cp++; + x = -1; } + if (x == -1 && eline != nlines && !(wp->mode & WC_QUIET)) + eline = invalid(file, nlines); } - else if (x == '\n') + else + cp += n ? n : 1; + if (x == '\n') { if ((nchars - longest) > wp->longest) wp->longest = nchars - longest; - longest = nchars; + longest = nchars + 1; nlines++; lasttype = 1; } @@ -127,71 +245,253 @@ int wc_count(Wc_t *wp, Sfio_t *fd, const char* file) lasttype = 0; nwords++; } + nchars++; + } + } + else if (!wp->mb && !(wp->mode & WC_LONGEST) || wp->mb > 0 && !(wp->mode & (WC_MBYTE|WC_WORDS|WC_LONGEST))) + { + if (!(wp->mode & (WC_MBYTE|WC_WORDS|WC_LONGEST))) + { + while ((cp = (unsigned char*)sfreserve(fd, SF_UNBOUND, 0)) && (c = sfvalue(fd)) > 0) + { + nchars += c; + endbuff = cp + c; + if (*--endbuff == '\n') + nlines++; + else + *endbuff = '\n'; + for (;;) + if (*cp++ == '\n') + { + if (cp > endbuff) + break; + nlines++; + } + } + } + else + { + while ((cp = buff = (unsigned char*)sfreserve(fd, SF_UNBOUND, 0)) && (c = sfvalue(fd)) > 0) + { + nchars += c; + /* check to see whether first character terminates word */ + if (c==1) + { + if (eol(lasttype)) + nlines++; + if ((c = type[*cp]) && !lasttype) + nwords++; + lasttype = c; + continue; + } + if (!lasttype && type[*cp]) + nwords++; + lastchar = cp[--c]; + *(endbuff = cp+c) = '\n'; + c = lasttype; + /* process each buffer */ + for (;;) + { + /* process spaces and new-lines */ + do + { + if (eol(c)) + for (;;) + { + /* check for end of buffer */ + if (cp > endbuff) + goto beob; + nlines++; + if (*cp != '\n') + break; + cp++; + } + } while (c = type[*cp++]); + /* skip over word characters */ + while (!(c = type[*cp++])); + nwords++; + } + beob: + if ((cp -= 2) >= buff) + c = type[*cp]; + else + c = lasttype; + lasttype = type[lastchar]; + /* see if was in word */ + if (!c && !lasttype) + nwords--; + } + if (eol(lasttype)) + nlines++; + else if (!lasttype) + nwords++; } } else { - for (;;) + int lineoff=0; + int skip=0; + int adjust=0; + int state=0; + int oldc; + int xspace; + int wasspace = 1; + unsigned char* start; + + lastchar = 0; + start = (endbuff = side) + 1; + xspace = iswspace(0xa0) || iswspace(0x85); + while ((cp = buff = (unsigned char*)sfreserve(fd, SF_UNBOUND, 0)) && (c = sfvalue(fd)) > 0) { - /* fill next buffer and check for end-of-file */ - if (!(buff = (unsigned char*)sfreserve(fd, 0, 0)) || (c = sfvalue(fd)) <= 0) - break; - sfread(fd,(char*)(cp=buff),c); nchars += c; + start = cp-lineoff; /* check to see whether first character terminates word */ if(c==1) { - if(endline(lasttype)) + if(eol(lasttype)) nlines++; - if((c = space[*cp]) && !lasttype) + if((c = type[*cp]) && !lasttype) nwords++; lasttype = c; + endbuff = start; continue; } - if(!lasttype && space[*cp]) - nwords++; lastchar = cp[--c]; - cp[c] = '\n'; endbuff = cp+c; + cp[c] = '\n'; + if(mbc(lasttype)) + { + c = lasttype; + goto mbyte; + } + if(!lasttype && spc(type[*cp])) + nwords++; c = lasttype; /* process each buffer */ for (;;) { /* process spaces and new-lines */ - do if (endline(c)) + spaces: + do { - for (;;) + if (eol(c)) { /* check for end of buffer */ if (cp > endbuff) goto eob; + if(wp->mode&WC_LONGEST) + { + if((cp-start)-adjust > longest) + longest = (cp-start)-adjust-1; + start = cp; + } nlines++; - if (*cp != '\n') + nchars -= adjust; + adjust = 0; + } + } while (spc(c = type[*cp++])); + wasspace=1; + if(mbc(c)) + { + mbyte: + do + { + if(c&WC_ERR) + goto err; + if(skip && (c&7)) break; - cp++; + if(!skip) + { + if(!(c&7)) + { + skip=1; + break; + } + skip = (c&7); + adjust += skip; + state = 0; + if(skip==2 && (cp[-1]&0xc)==0 && (state=(cp[-1]&0x3))) + oldc = *cp; + else if(xspace && cp[-1]==0xc2) + { + state = 8; + oldc = *cp; + } + } + else + { + skip--; + if(state && (state=chkstate(state,oldc))) + { + if(state==10) + { + if(!wasspace) + nwords++; + wasspace = 1; + state=0; + goto spaces; + } + oldc = *cp; + } + } + } while (mbc(c = type[*cp++])); + wasspace = 0; + if(skip) + { + if(eol(c) && (cp > endbuff)) + goto eob; + err: + skip = 0; + state = 0; + if(eline!=nlines && !(wp->mode & WC_QUIET)) + eline = invalid(file, nlines); + while(mbc(c) && ((c|WC_ERR) || (c&7)==0)) + c=type[*cp++]; + if(eol(c) && (cp > endbuff)) + { + c = WC_MB|WC_ERR; + goto eob; + } + if(mbc(c)) + goto mbyte; + else if(c&WC_SP) + goto spaces; + } + if(spc(c)) + { + nwords++; + continue; } - } while (c = space[*cp++]); + } /* skip over word characters */ - while(!(c = space[*cp++])); + while(!(c = type[*cp++])); + if(mbc(c)) + goto mbyte; nwords++; } eob: + lineoff = cp-start; if((cp -= 2) >= buff) - c = space[*cp]; + c = type[*cp]; else - c = lasttype; - lasttype = space[lastchar]; + c = lasttype; + lasttype = type[lastchar]; /* see if was in word */ if(!c && !lasttype) nwords--; } - if(endline(lasttype)) + if ((wp->mode&WC_LONGEST) && ((endbuff + 1 - start) - adjust - (lastchar == '\n')) > longest) + longest = (endbuff + 1 - start) - adjust - (lastchar == '\n'); + wp->longest = longest; + if (eol(lasttype)) nlines++; - else if(!lasttype) + else if (!lasttype) nwords++; + nchars -= adjust; } wp->chars = nchars; wp->words = nwords; wp->lines = nlines; - return(0); + return 0; } + diff --git a/usr/src/lib/libcmd/i386/include/ast/cmd.h b/usr/src/lib/libcmd/i386/include/ast/cmd.h index 9ac1c90993..f149f8d275 100644 --- a/usr/src/lib/libcmd/i386/include/ast/cmd.h +++ b/usr/src/lib/libcmd/i386/include/ast/cmd.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -44,6 +44,8 @@ #define cmdinit _cmd_init +#define ERROR_CALLBACK ERROR_SET + #if _BLD_cmd && defined(__EXPORT__) #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ __EXPORT__ @@ -96,7 +98,7 @@ cmdinit __PARAM__((int argc, register char** argv, __V_* context, const char* ca error_info.catalog = (char*)catalog; opt_info.index = 0; if (context) - error_info.flags |= flags; + error_info.flags |= flags & ~(ERROR_CALLBACK|ERROR_NOTIFY); return 0; } diff --git a/usr/src/lib/libcmd/i386/include/ast/cmdext.h b/usr/src/lib/libcmd/i386/include/ast/cmdext.h index 602f8d7a7d..416a3dc5a5 100644 --- a/usr/src/lib/libcmd/i386/include/ast/cmdext.h +++ b/usr/src/lib/libcmd/i386/include/ast/cmdext.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -39,11 +39,14 @@ extern __MANGLE__ int b_cp __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_cut __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_date __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_dirname __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_egrep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_expr __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fds __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_fgrep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fmt __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fold __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_getconf __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_grep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_head __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_id __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_join __PROTO__((int, char**, __V_*)); @@ -52,11 +55,13 @@ extern __MANGLE__ int b_logname __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_md5sum __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mkdir __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mkfifo __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_mktemp __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mv __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_paste __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_pathchk __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_pids __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rev __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_readlink __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rm __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rmdir __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_stty __PROTO__((int, char**, __V_*)); @@ -68,3 +73,4 @@ extern __MANGLE__ int b_tty __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_uname __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_uniq __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_wc __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_xgrep __PROTO__((int, char**, __V_*)); diff --git a/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/ids b/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/ids index 91fb2f255e..052b939476 100644 --- a/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/ids +++ b/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/ids @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libcmd/features/ids by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libcmd/features/ids by iffe version 2009-10-06 : : */ #ifndef _def_ids_cmd #define _def_ids_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_endgrent 1 /* endgrent() in default lib(s) */ #define _lib_getgrent 1 /* getgrent() in default lib(s) */ diff --git a/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/sockets b/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/sockets index 1b4d8b6101..e9c9c9e59e 100644 --- a/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/sockets +++ b/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/sockets @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libcmd/features/sockets by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libcmd/features/sockets by iffe version 2009-10-06 : : */ #ifndef _def_sockets_cmd #define _def_sockets_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _hdr_arpa_inet 1 /* #include <arpa/inet.h> ok */ diff --git a/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/symlink b/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/symlink index 15284effed..b237c3896c 100644 --- a/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/symlink +++ b/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/symlink @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libcmd/features/symlink by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libcmd/features/symlink by iffe version 2009-10-06 : : */ #ifndef _def_symlink_cmd #define _def_symlink_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_lchown 1 /* lchown implemented */ #endif diff --git a/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/utsname b/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/utsname index 240a52a974..88adc91c75 100644 --- a/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/utsname +++ b/usr/src/lib/libcmd/i386/src/lib/libcmd/FEATURE/utsname @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libcmd/features/utsname by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libcmd/features/utsname by iffe version 2009-10-06 : : */ #ifndef _def_utsname_cmd #define _def_utsname_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_getdomainname 1 /* getdomainname() in default lib(s) */ #define _lib_gethostid 1 /* gethostid() in default lib(s) */ diff --git a/usr/src/lib/libcmd/mapfile-vers b/usr/src/lib/libcmd/mapfile-vers index 13a767a496..9e59e44cad 100644 --- a/usr/src/lib/libcmd/mapfile-vers +++ b/usr/src/lib/libcmd/mapfile-vers @@ -55,11 +55,14 @@ SUNWprivate_1.1 { b_cut; b_date; b_dirname; + b_egrep; b_expr; b_fds; + b_fgrep; b_fmt; b_fold; b_getconf; + b_grep; b_head; b_id; b_join; @@ -68,10 +71,12 @@ SUNWprivate_1.1 { b_md5sum; b_mkdir; b_mkfifo; + b_mktemp; b_mv; b_paste; b_pathchk; b_pids; + b_pgrep; b_readlink; b_rev; b_rm; @@ -85,6 +90,7 @@ SUNWprivate_1.1 { b_uname; b_uniq; b_wc; + b_xgrep; local: *; }; diff --git a/usr/src/lib/libcmd/sparc/include/ast/cmd.h b/usr/src/lib/libcmd/sparc/include/ast/cmd.h index 9ac1c90993..f149f8d275 100644 --- a/usr/src/lib/libcmd/sparc/include/ast/cmd.h +++ b/usr/src/lib/libcmd/sparc/include/ast/cmd.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -44,6 +44,8 @@ #define cmdinit _cmd_init +#define ERROR_CALLBACK ERROR_SET + #if _BLD_cmd && defined(__EXPORT__) #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ __EXPORT__ @@ -96,7 +98,7 @@ cmdinit __PARAM__((int argc, register char** argv, __V_* context, const char* ca error_info.catalog = (char*)catalog; opt_info.index = 0; if (context) - error_info.flags |= flags; + error_info.flags |= flags & ~(ERROR_CALLBACK|ERROR_NOTIFY); return 0; } diff --git a/usr/src/lib/libcmd/sparc/include/ast/cmdext.h b/usr/src/lib/libcmd/sparc/include/ast/cmdext.h index 602f8d7a7d..416a3dc5a5 100644 --- a/usr/src/lib/libcmd/sparc/include/ast/cmdext.h +++ b/usr/src/lib/libcmd/sparc/include/ast/cmdext.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -39,11 +39,14 @@ extern __MANGLE__ int b_cp __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_cut __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_date __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_dirname __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_egrep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_expr __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fds __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_fgrep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fmt __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fold __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_getconf __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_grep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_head __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_id __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_join __PROTO__((int, char**, __V_*)); @@ -52,11 +55,13 @@ extern __MANGLE__ int b_logname __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_md5sum __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mkdir __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mkfifo __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_mktemp __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mv __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_paste __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_pathchk __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_pids __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rev __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_readlink __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rm __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rmdir __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_stty __PROTO__((int, char**, __V_*)); @@ -68,3 +73,4 @@ extern __MANGLE__ int b_tty __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_uname __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_uniq __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_wc __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_xgrep __PROTO__((int, char**, __V_*)); diff --git a/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/ids b/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/ids index 3ce04f892b..19cfcffdf3 100644 --- a/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/ids +++ b/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/ids @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libcmd/features/ids by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libcmd/features/ids by iffe version 2009-10-06 : : */ #ifndef _def_ids_cmd #define _def_ids_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_endgrent 1 /* endgrent() in default lib(s) */ #define _lib_getgrent 1 /* getgrent() in default lib(s) */ diff --git a/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/sockets b/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/sockets index bcb69bfd42..a479cee37b 100644 --- a/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/sockets +++ b/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/sockets @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libcmd/features/sockets by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libcmd/features/sockets by iffe version 2009-10-06 : : */ #ifndef _def_sockets_cmd #define _def_sockets_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _hdr_arpa_inet 1 /* #include <arpa/inet.h> ok */ diff --git a/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/symlink b/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/symlink index a5426021fe..1dee0e7af3 100644 --- a/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/symlink +++ b/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/symlink @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libcmd/features/symlink by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libcmd/features/symlink by iffe version 2009-10-06 : : */ #ifndef _def_symlink_cmd #define _def_symlink_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_lchown 1 /* lchown implemented */ #endif diff --git a/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/utsname b/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/utsname index d2bf7024f7..a582177617 100644 --- a/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/utsname +++ b/usr/src/lib/libcmd/sparc/src/lib/libcmd/FEATURE/utsname @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libcmd/features/utsname by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libcmd/features/utsname by iffe version 2009-10-06 : : */ #ifndef _def_utsname_cmd #define _def_utsname_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_getdomainname 1 /* getdomainname() in default lib(s) */ #define _lib_gethostid 1 /* gethostid() in default lib(s) */ diff --git a/usr/src/lib/libcmd/sparcv9/include/ast/cmd.h b/usr/src/lib/libcmd/sparcv9/include/ast/cmd.h index 9ac1c90993..f149f8d275 100644 --- a/usr/src/lib/libcmd/sparcv9/include/ast/cmd.h +++ b/usr/src/lib/libcmd/sparcv9/include/ast/cmd.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -44,6 +44,8 @@ #define cmdinit _cmd_init +#define ERROR_CALLBACK ERROR_SET + #if _BLD_cmd && defined(__EXPORT__) #undef __MANGLE__ #define __MANGLE__ __LINKAGE__ __EXPORT__ @@ -96,7 +98,7 @@ cmdinit __PARAM__((int argc, register char** argv, __V_* context, const char* ca error_info.catalog = (char*)catalog; opt_info.index = 0; if (context) - error_info.flags |= flags; + error_info.flags |= flags & ~(ERROR_CALLBACK|ERROR_NOTIFY); return 0; } diff --git a/usr/src/lib/libcmd/sparcv9/include/ast/cmdext.h b/usr/src/lib/libcmd/sparcv9/include/ast/cmdext.h index 602f8d7a7d..416a3dc5a5 100644 --- a/usr/src/lib/libcmd/sparcv9/include/ast/cmdext.h +++ b/usr/src/lib/libcmd/sparcv9/include/ast/cmdext.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2008 AT&T Intellectual Property * +* Copyright (c) 1992-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -39,11 +39,14 @@ extern __MANGLE__ int b_cp __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_cut __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_date __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_dirname __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_egrep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_expr __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fds __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_fgrep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fmt __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_fold __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_getconf __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_grep __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_head __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_id __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_join __PROTO__((int, char**, __V_*)); @@ -52,11 +55,13 @@ extern __MANGLE__ int b_logname __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_md5sum __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mkdir __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mkfifo __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_mktemp __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_mv __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_paste __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_pathchk __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_pids __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rev __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_readlink __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rm __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rmdir __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_stty __PROTO__((int, char**, __V_*)); @@ -68,3 +73,4 @@ extern __MANGLE__ int b_tty __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_uname __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_uniq __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_wc __PROTO__((int, char**, __V_*)); +extern __MANGLE__ int b_xgrep __PROTO__((int, char**, __V_*)); diff --git a/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/ids b/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/ids index 8654d20bb5..ce23090155 100644 --- a/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/ids +++ b/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/ids @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libcmd/features/ids by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libcmd/features/ids by iffe version 2009-10-06 : : */ #ifndef _def_ids_cmd #define _def_ids_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_endgrent 1 /* endgrent() in default lib(s) */ #define _lib_getgrent 1 /* getgrent() in default lib(s) */ diff --git a/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/sockets b/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/sockets index 75613c1ffb..f6681b51f8 100644 --- a/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/sockets +++ b/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/sockets @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libcmd/features/sockets by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libcmd/features/sockets by iffe version 2009-10-06 : : */ #ifndef _def_sockets_cmd #define _def_sockets_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _sys_socket 1 /* #include <sys/socket.h> ok */ #define _hdr_arpa_inet 1 /* #include <arpa/inet.h> ok */ diff --git a/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/symlink b/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/symlink index 0fddf44f02..c52367e2ef 100644 --- a/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/symlink +++ b/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/symlink @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libcmd/features/symlink by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libcmd/features/symlink by iffe version 2009-10-06 : : */ #ifndef _def_symlink_cmd #define _def_symlink_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_lchown 1 /* lchown implemented */ #endif diff --git a/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/utsname b/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/utsname index cdf393a6f0..ed90329740 100644 --- a/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/utsname +++ b/usr/src/lib/libcmd/sparcv9/src/lib/libcmd/FEATURE/utsname @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libcmd/features/utsname by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libcmd/features/utsname by iffe version 2009-10-06 : : */ #ifndef _def_utsname_cmd #define _def_utsname_cmd 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _lib_getdomainname 1 /* getdomainname() in default lib(s) */ #define _lib_gethostid 1 /* gethostid() in default lib(s) */ diff --git a/usr/src/lib/libdll/Makefile.com b/usr/src/lib/libdll/Makefile.com index 8dddf764b0..20ec620bc7 100644 --- a/usr/src/lib/libdll/Makefile.com +++ b/usr/src/lib/libdll/Makefile.com @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -34,6 +34,7 @@ OBJECTS= \ dllfind.o \ dlllook.o \ dllnext.o \ + dllopen.o \ dllplug.o \ dllscan.o @@ -70,6 +71,7 @@ CPPFLAGS = \ $(DLLPLATFORMCPPFLAGS) \ -I. \ -I$(ROOT)/usr/include/ast \ + -I$(ROOT)/usr/include \ '-DCONF_LIBSUFFIX=".so"' \ '-DCONF_LIBPREFIX="lib"' \ -D_BLD_dll \ diff --git a/usr/src/lib/libdll/amd64/src/lib/libdll/FEATURE/dll b/usr/src/lib/libdll/amd64/src/lib/libdll/FEATURE/dll index b62e81b7dc..87c04d9ca8 100644 --- a/usr/src/lib/libdll/amd64/src/lib/libdll/FEATURE/dll +++ b/usr/src/lib/libdll/amd64/src/lib/libdll/FEATURE/dll @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libdll/features/dll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libdll/features/dll by iffe version 2009-10-06 : : */ #ifndef _def_dll_dll #if !defined(__PROTO__) @@ -63,13 +63,16 @@ #define _def_dll_dll 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_dlfcn 1 /* #include <dlfcn.h> ok */ #define _LIB_dl 1 /* -ldl is a library */ #define _lib_dlopen 1 /* dlopen() in default lib(s) */ #define _DLL_NEXT_PATH "/usr/lib/libc.so.1" +#if defined(__MVS__) && !defined(__SUSV3) +#define __SUSV3 1 +#endif #include <dlfcn.h> #define DLL_INFO_PREVER 0x0001 /* pre-suffix style version */ @@ -112,6 +115,7 @@ typedef struct Dllscan_s extern __MANGLE__ Dllinfo_t* dllinfo __PROTO__((void)); extern __MANGLE__ __V_* dllplug __PROTO__((const char*, const char*, const char*, int, char*, size_t)); extern __MANGLE__ __V_* dllfind __PROTO__((const char*, const char*, int, char*, size_t)); +extern __MANGLE__ __V_* dllopen __PROTO__((const char*, int)); extern __MANGLE__ __V_* dllnext __PROTO__((int)); extern __MANGLE__ __V_* dlllook __PROTO__((__V_*, const char*)); diff --git a/usr/src/lib/libdll/amd64/src/lib/libdll/dlldefs.h b/usr/src/lib/libdll/amd64/src/lib/libdll/dlldefs.h index b62e81b7dc..87c04d9ca8 100644 --- a/usr/src/lib/libdll/amd64/src/lib/libdll/dlldefs.h +++ b/usr/src/lib/libdll/amd64/src/lib/libdll/dlldefs.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libdll/features/dll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libdll/features/dll by iffe version 2009-10-06 : : */ #ifndef _def_dll_dll #if !defined(__PROTO__) @@ -63,13 +63,16 @@ #define _def_dll_dll 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_dlfcn 1 /* #include <dlfcn.h> ok */ #define _LIB_dl 1 /* -ldl is a library */ #define _lib_dlopen 1 /* dlopen() in default lib(s) */ #define _DLL_NEXT_PATH "/usr/lib/libc.so.1" +#if defined(__MVS__) && !defined(__SUSV3) +#define __SUSV3 1 +#endif #include <dlfcn.h> #define DLL_INFO_PREVER 0x0001 /* pre-suffix style version */ @@ -112,6 +115,7 @@ typedef struct Dllscan_s extern __MANGLE__ Dllinfo_t* dllinfo __PROTO__((void)); extern __MANGLE__ __V_* dllplug __PROTO__((const char*, const char*, const char*, int, char*, size_t)); extern __MANGLE__ __V_* dllfind __PROTO__((const char*, const char*, int, char*, size_t)); +extern __MANGLE__ __V_* dllopen __PROTO__((const char*, int)); extern __MANGLE__ __V_* dllnext __PROTO__((int)); extern __MANGLE__ __V_* dlllook __PROTO__((__V_*, const char*)); diff --git a/usr/src/lib/libdll/common/RELEASE b/usr/src/lib/libdll/common/RELEASE index d4a437cf3d..7aeac9e025 100644 --- a/usr/src/lib/libdll/common/RELEASE +++ b/usr/src/lib/libdll/common/RELEASE @@ -1,3 +1,4 @@ +09-04-15 dllopen.c: add, use dllopen() internally to wrap dlopen() 08-05-12 dllscan.c: LIBSUFFIX==.dylib => default plugin version match 0.0 06-10-11 dllscan.c: check sfstruse() return values -- doh 06-01-25 dllplug.c: add errorf() library message for dlopen() error diff --git a/usr/src/lib/libdll/common/dlfcn.c b/usr/src/lib/libdll/common/dlfcn.c index 5b61ff2c58..08fd774181 100644 --- a/usr/src/lib/libdll/common/dlfcn.c +++ b/usr/src/lib/libdll/common/dlfcn.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1997-2008 AT&T Intellectual Property * +* Copyright (c) 1997-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -26,7 +26,7 @@ * AT&T Research */ -static const char id[] = "\n@(#)$Id: dll library (AT&T Research) 2005-02-14 $\0\n"; +static const char id[] = "\n@(#)$Id: dll library (AT&T Research) 2009-04-15 $\0\n"; #include <ast.h> #include <dlldefs.h> diff --git a/usr/src/lib/libdll/common/dllfind.c b/usr/src/lib/libdll/common/dllfind.c index 48317c3fa8..88b2fd1015 100644 --- a/usr/src/lib/libdll/common/dllfind.c +++ b/usr/src/lib/libdll/common/dllfind.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1997-2008 AT&T Intellectual Property * +* Copyright (c) 1997-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libdll/common/dlllook.c b/usr/src/lib/libdll/common/dlllook.c index 6ea224e61d..a9d7c97dce 100644 --- a/usr/src/lib/libdll/common/dlllook.c +++ b/usr/src/lib/libdll/common/dlllook.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1997-2008 AT&T Intellectual Property * +* Copyright (c) 1997-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libdll/common/dllnext.c b/usr/src/lib/libdll/common/dllnext.c index 33f80f1255..012a01b0e1 100644 --- a/usr/src/lib/libdll/common/dllnext.c +++ b/usr/src/lib/libdll/common/dllnext.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1997-2008 AT&T Intellectual Property * +* Copyright (c) 1997-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -80,7 +80,7 @@ _dll_next(int flags, _DLL_RLD_SYM_TYPE* here) { do { - if (strcmp(vp, "MAIN") && (lp = dlopen(vp, flags))) + if (strcmp(vp, "MAIN") && (lp = dllopen(vp, flags))) { if (xr = (Write_f)dlsym(lp, "write")) wr = xr; @@ -92,7 +92,7 @@ _dll_next(int flags, _DLL_RLD_SYM_TYPE* here) { do { - if (lp = dlopen(strcmp(vp, "MAIN") ? vp : (char*)0, flags)) + if (lp = dllopen(strcmp(vp, "MAIN") ? vp : (char*)0, flags)) { if (found) { @@ -207,7 +207,7 @@ dllnext(int flags) } #endif ver = path + strlen(path); - while (!(dll = dlopen(path, flags))) + while (!(dll = dllopen(path, flags))) { do { diff --git a/usr/src/lib/libdll/common/dllopen.c b/usr/src/lib/libdll/common/dllopen.c new file mode 100644 index 0000000000..19c057d792 --- /dev/null +++ b/usr/src/lib/libdll/common/dllopen.c @@ -0,0 +1,93 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1997-2009 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 <gsf@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped +/* + * Glenn Fowler + * at&t research + */ + +#include <ast.h> +#include <dlldefs.h> +#include <error.h> + +#if 0 + +/* + * dlopen() wrapper that properly initializes LIBPATH + * with the path of the dll to be opened + * + * 2009-04-15 -- if ld.so re-checked the env this would work ... + */ + +void* +dllopen(const char* name, int mode) +{ + void* dll; + Dllinfo_t* info; + char* olibpath; + char* path; + char* oenv; + char* nenv[2]; + char* dir; + char* base; + int len; + + if (!environ) + { + nenv[0] = nenv[1] = 0; + environ = nenv; + } + info = dllinfo(); + oenv = environ[0]; + olibpath = getenv(info->env); + if (base = strrchr(name, '/')) + { + dir = (char*)name; + len = ++base - dir; + } + else + { + dir = "./"; + len = 2; + base = (char*)name; + } + path = sfprints("%-.*s%s%c%s=%-.*s%s%s", len, dir, base, 0, info->env, len, dir, olibpath ? ":" : "", olibpath ? olibpath : ""); + environ[0] = path + strlen(path) + 1; + dll = dlopen(path, mode); + if (environ == nenv) + environ = 0; + else + environ[0] = oenv; + return dll; +} + +#else + +/* + * dlopen() wrapper -- waiting for prestidigitaions + */ + +void* +dllopen(const char* name, int mode) +{ + return dlopen(name, mode); +} + +#endif diff --git a/usr/src/lib/libdll/common/dllplug.c b/usr/src/lib/libdll/common/dllplug.c index 72ae471352..e0c9dc61cf 100644 --- a/usr/src/lib/libdll/common/dllplug.c +++ b/usr/src/lib/libdll/common/dllplug.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1997-2008 AT&T Intellectual Property * +* Copyright (c) 1997-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -50,7 +50,7 @@ dllplug(const char* lib, const char* name, const char* ver, int flags, char* pat while (dle = dllsread(dls)) { hit = 1; - if (dll = dlopen(dle->path, flags|RTLD_GLOBAL|RTLD_PARENT)) + if (dll = dllopen(dle->path, flags|RTLD_GLOBAL|RTLD_PARENT)) { if (path && size) strncopy(path, dle->path, size); @@ -67,9 +67,7 @@ dllplug(const char* lib, const char* name, const char* ver, int flags, char* pat break; lib = 0; } - if (!(dll = dlopen(name, flags)) && !strchr(name, '/') && strchr(name, '.')) - dll = dlopen(sfprints("./%s", name), flags); - if (dll && path && size) + if ((dll = dllopen(name, flags)) && dll && path && size) strncopy(path, name, size); return dll; } diff --git a/usr/src/lib/libdll/common/dllscan.c b/usr/src/lib/libdll/common/dllscan.c index 3863390b2a..85389152cb 100644 --- a/usr/src/lib/libdll/common/dllscan.c +++ b/usr/src/lib/libdll/common/dllscan.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1997-2008 AT&T Intellectual Property * +* Copyright (c) 1997-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libdll/common/features/dll b/usr/src/lib/libdll/common/features/dll index c1a4900e3a..70e790be7d 100644 --- a/usr/src/lib/libdll/common/features/dll +++ b/usr/src/lib/libdll/common/features/dll @@ -75,6 +75,9 @@ tst run{ echo "#define _DLL_NEXT_PATH \"$lib\"" }end tst - output{ + #if defined(__MVS__) && !defined(__SUSV3) + #define __SUSV3 1 + #endif #if _hdr_dlfcn && _lib_dlopen #include <dlfcn.h> #endif @@ -90,6 +93,9 @@ tst - output{ static char* local[] = { "__elf_header", "_call_add_gp_range", "_etext" }; #endif printf("\n"); + printf("#if defined(__MVS__) && !defined(__SUSV3)\n"); + printf("#define __SUSV3 1\n"); + printf("#endif\n"); #if _hdr_dlfcn && _lib_dlopen printf("#include <dlfcn.h>\n"); #endif @@ -206,6 +212,7 @@ tst - output{ printf("extern Dllinfo_t* dllinfo(void);\n"); printf("extern void* dllplug(const char*, const char*, const char*, int, char*, size_t);\n"); printf("extern void* dllfind(const char*, const char*, int, char*, size_t);\n"); + printf("extern void* dllopen(const char*, int);\n"); printf("extern void* dllnext(int);\n"); printf("extern void* dlllook(void*, const char*);\n"); #if _hdr_rld_interface diff --git a/usr/src/lib/libdll/i386/src/lib/libdll/FEATURE/dll b/usr/src/lib/libdll/i386/src/lib/libdll/FEATURE/dll index 9c30e76853..e881151555 100644 --- a/usr/src/lib/libdll/i386/src/lib/libdll/FEATURE/dll +++ b/usr/src/lib/libdll/i386/src/lib/libdll/FEATURE/dll @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libdll/features/dll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libdll/features/dll by iffe version 2009-10-06 : : */ #ifndef _def_dll_dll #if !defined(__PROTO__) @@ -63,13 +63,16 @@ #define _def_dll_dll 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_dlfcn 1 /* #include <dlfcn.h> ok */ #define _LIB_dl 1 /* -ldl is a library */ #define _lib_dlopen 1 /* dlopen() in default lib(s) */ #define _DLL_NEXT_PATH "/usr/lib/libc.so.1" +#if defined(__MVS__) && !defined(__SUSV3) +#define __SUSV3 1 +#endif #include <dlfcn.h> #define DLL_INFO_PREVER 0x0001 /* pre-suffix style version */ @@ -112,6 +115,7 @@ typedef struct Dllscan_s extern __MANGLE__ Dllinfo_t* dllinfo __PROTO__((void)); extern __MANGLE__ __V_* dllplug __PROTO__((const char*, const char*, const char*, int, char*, size_t)); extern __MANGLE__ __V_* dllfind __PROTO__((const char*, const char*, int, char*, size_t)); +extern __MANGLE__ __V_* dllopen __PROTO__((const char*, int)); extern __MANGLE__ __V_* dllnext __PROTO__((int)); extern __MANGLE__ __V_* dlllook __PROTO__((__V_*, const char*)); diff --git a/usr/src/lib/libdll/i386/src/lib/libdll/dlldefs.h b/usr/src/lib/libdll/i386/src/lib/libdll/dlldefs.h index 9c30e76853..e881151555 100644 --- a/usr/src/lib/libdll/i386/src/lib/libdll/dlldefs.h +++ b/usr/src/lib/libdll/i386/src/lib/libdll/dlldefs.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libdll/features/dll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libdll/features/dll by iffe version 2009-10-06 : : */ #ifndef _def_dll_dll #if !defined(__PROTO__) @@ -63,13 +63,16 @@ #define _def_dll_dll 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_dlfcn 1 /* #include <dlfcn.h> ok */ #define _LIB_dl 1 /* -ldl is a library */ #define _lib_dlopen 1 /* dlopen() in default lib(s) */ #define _DLL_NEXT_PATH "/usr/lib/libc.so.1" +#if defined(__MVS__) && !defined(__SUSV3) +#define __SUSV3 1 +#endif #include <dlfcn.h> #define DLL_INFO_PREVER 0x0001 /* pre-suffix style version */ @@ -112,6 +115,7 @@ typedef struct Dllscan_s extern __MANGLE__ Dllinfo_t* dllinfo __PROTO__((void)); extern __MANGLE__ __V_* dllplug __PROTO__((const char*, const char*, const char*, int, char*, size_t)); extern __MANGLE__ __V_* dllfind __PROTO__((const char*, const char*, int, char*, size_t)); +extern __MANGLE__ __V_* dllopen __PROTO__((const char*, int)); extern __MANGLE__ __V_* dllnext __PROTO__((int)); extern __MANGLE__ __V_* dlllook __PROTO__((__V_*, const char*)); diff --git a/usr/src/lib/libdll/sparc/src/lib/libdll/FEATURE/dll b/usr/src/lib/libdll/sparc/src/lib/libdll/FEATURE/dll index 46b5eaa630..646bf17ba5 100644 --- a/usr/src/lib/libdll/sparc/src/lib/libdll/FEATURE/dll +++ b/usr/src/lib/libdll/sparc/src/lib/libdll/FEATURE/dll @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libdll/features/dll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libdll/features/dll by iffe version 2009-10-06 : : */ #ifndef _def_dll_dll #if !defined(__PROTO__) @@ -63,13 +63,16 @@ #define _def_dll_dll 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_dlfcn 1 /* #include <dlfcn.h> ok */ #define _LIB_dl 1 /* -ldl is a library */ #define _lib_dlopen 1 /* dlopen() in default lib(s) */ #define _DLL_NEXT_PATH "/usr/lib/libc.so.1" +#if defined(__MVS__) && !defined(__SUSV3) +#define __SUSV3 1 +#endif #include <dlfcn.h> #define DLL_INFO_PREVER 0x0001 /* pre-suffix style version */ @@ -112,6 +115,7 @@ typedef struct Dllscan_s extern __MANGLE__ Dllinfo_t* dllinfo __PROTO__((void)); extern __MANGLE__ __V_* dllplug __PROTO__((const char*, const char*, const char*, int, char*, size_t)); extern __MANGLE__ __V_* dllfind __PROTO__((const char*, const char*, int, char*, size_t)); +extern __MANGLE__ __V_* dllopen __PROTO__((const char*, int)); extern __MANGLE__ __V_* dllnext __PROTO__((int)); extern __MANGLE__ __V_* dlllook __PROTO__((__V_*, const char*)); diff --git a/usr/src/lib/libdll/sparc/src/lib/libdll/dlldefs.h b/usr/src/lib/libdll/sparc/src/lib/libdll/dlldefs.h index 46b5eaa630..646bf17ba5 100644 --- a/usr/src/lib/libdll/sparc/src/lib/libdll/dlldefs.h +++ b/usr/src/lib/libdll/sparc/src/lib/libdll/dlldefs.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libdll/features/dll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libdll/features/dll by iffe version 2009-10-06 : : */ #ifndef _def_dll_dll #if !defined(__PROTO__) @@ -63,13 +63,16 @@ #define _def_dll_dll 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_dlfcn 1 /* #include <dlfcn.h> ok */ #define _LIB_dl 1 /* -ldl is a library */ #define _lib_dlopen 1 /* dlopen() in default lib(s) */ #define _DLL_NEXT_PATH "/usr/lib/libc.so.1" +#if defined(__MVS__) && !defined(__SUSV3) +#define __SUSV3 1 +#endif #include <dlfcn.h> #define DLL_INFO_PREVER 0x0001 /* pre-suffix style version */ @@ -112,6 +115,7 @@ typedef struct Dllscan_s extern __MANGLE__ Dllinfo_t* dllinfo __PROTO__((void)); extern __MANGLE__ __V_* dllplug __PROTO__((const char*, const char*, const char*, int, char*, size_t)); extern __MANGLE__ __V_* dllfind __PROTO__((const char*, const char*, int, char*, size_t)); +extern __MANGLE__ __V_* dllopen __PROTO__((const char*, int)); extern __MANGLE__ __V_* dllnext __PROTO__((int)); extern __MANGLE__ __V_* dlllook __PROTO__((__V_*, const char*)); diff --git a/usr/src/lib/libdll/sparcv9/src/lib/libdll/FEATURE/dll b/usr/src/lib/libdll/sparcv9/src/lib/libdll/FEATURE/dll index 4e35e0f408..1d012283e9 100644 --- a/usr/src/lib/libdll/sparcv9/src/lib/libdll/FEATURE/dll +++ b/usr/src/lib/libdll/sparcv9/src/lib/libdll/FEATURE/dll @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libdll/features/dll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libdll/features/dll by iffe version 2009-10-06 : : */ #ifndef _def_dll_dll #if !defined(__PROTO__) @@ -63,13 +63,16 @@ #define _def_dll_dll 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_dlfcn 1 /* #include <dlfcn.h> ok */ #define _LIB_dl 1 /* -ldl is a library */ #define _lib_dlopen 1 /* dlopen() in default lib(s) */ #define _DLL_NEXT_PATH "/usr/lib/libc.so.1" +#if defined(__MVS__) && !defined(__SUSV3) +#define __SUSV3 1 +#endif #include <dlfcn.h> #define DLL_INFO_PREVER 0x0001 /* pre-suffix style version */ @@ -112,6 +115,7 @@ typedef struct Dllscan_s extern __MANGLE__ Dllinfo_t* dllinfo __PROTO__((void)); extern __MANGLE__ __V_* dllplug __PROTO__((const char*, const char*, const char*, int, char*, size_t)); extern __MANGLE__ __V_* dllfind __PROTO__((const char*, const char*, int, char*, size_t)); +extern __MANGLE__ __V_* dllopen __PROTO__((const char*, int)); extern __MANGLE__ __V_* dllnext __PROTO__((int)); extern __MANGLE__ __V_* dlllook __PROTO__((__V_*, const char*)); diff --git a/usr/src/lib/libdll/sparcv9/src/lib/libdll/dlldefs.h b/usr/src/lib/libdll/sparcv9/src/lib/libdll/dlldefs.h index 4e35e0f408..1d012283e9 100644 --- a/usr/src/lib/libdll/sparcv9/src/lib/libdll/dlldefs.h +++ b/usr/src/lib/libdll/sparcv9/src/lib/libdll/dlldefs.h @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libdll/features/dll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libdll/features/dll by iffe version 2009-10-06 : : */ #ifndef _def_dll_dll #if !defined(__PROTO__) @@ -63,13 +63,16 @@ #define _def_dll_dll 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_dlfcn 1 /* #include <dlfcn.h> ok */ #define _LIB_dl 1 /* -ldl is a library */ #define _lib_dlopen 1 /* dlopen() in default lib(s) */ #define _DLL_NEXT_PATH "/usr/lib/libc.so.1" +#if defined(__MVS__) && !defined(__SUSV3) +#define __SUSV3 1 +#endif #include <dlfcn.h> #define DLL_INFO_PREVER 0x0001 /* pre-suffix style version */ @@ -112,6 +115,7 @@ typedef struct Dllscan_s extern __MANGLE__ Dllinfo_t* dllinfo __PROTO__((void)); extern __MANGLE__ __V_* dllplug __PROTO__((const char*, const char*, const char*, int, char*, size_t)); extern __MANGLE__ __V_* dllfind __PROTO__((const char*, const char*, int, char*, size_t)); +extern __MANGLE__ __V_* dllopen __PROTO__((const char*, int)); extern __MANGLE__ __V_* dllnext __PROTO__((int)); extern __MANGLE__ __V_* dlllook __PROTO__((__V_*, const char*)); diff --git a/usr/src/lib/libpp/Makefile.com b/usr/src/lib/libpp/Makefile.com index 8ed741ebdf..ebdedc2806 100644 --- a/usr/src/lib/libpp/Makefile.com +++ b/usr/src/lib/libpp/Makefile.com @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -84,10 +84,11 @@ CPPFLAGS = \ $(DTEXTDOM) $(DTS_ERRNO) \ -I. \ -I$(ROOT)/usr/include/ast \ + -I$(ROOT)/usr/include \ -D_PACKAGE_ast \ '-DUSAGE_LICENSE=\ "[-author?Glenn Fowler <gsf@research.att.com>]"\ - "[-copyright?Copyright (c) 1986-2008 AT&T Intellectual Property]"\ + "[-copyright?Copyright (c) 1986-2009 AT&T Intellectual Property]"\ "[-license?http://www.opensource.org/licenses/cpl1.0.txt]"\ "[--catalog?libpp]"' @@ -100,8 +101,8 @@ CFLAGS64 += \ pics/ppcall.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED pics/ppcontrol.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED pics/ppcpp.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED -pics/pplex.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED pics/ppexpr.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED +pics/pplex.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED pics/ppop.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED pics/ppsearch.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED pics/ppsearch.o := CERRWARN += -_gcc=-Wno-sequence-point diff --git a/usr/src/lib/libpp/common/RELEASE b/usr/src/lib/libpp/common/RELEASE index 80a3c89a48..0e09f6089d 100644 --- a/usr/src/lib/libpp/common/RELEASE +++ b/usr/src/lib/libpp/common/RELEASE @@ -1,3 +1,12 @@ +09-02-02 pp.probe,probe.win32: check for compiler supplied __FUNCTION__ +09-02-02 ppop.c: include pp_default.h/probe at end of builtin script +09-01-20 probe.win32: elide #pragma comment.*linker.*manifest +09-01-06 ppcall.c: fix macro definition overwrite bug -- I know +09-01-05 ppcontrol.c: fix multiple include guard for #include outside guard +08-12-07 pp.h,ppdata.c: fix ancient pptype and ppctype[] off by one +08-11-15 ppsearch.c: '\\' => '/' in first step; msvc complains about '\\' in #line!! +08-10-31 ppsearch.c: relax pp:nomultiple pedantry +08-10-30 pplex.c: handle =#x S_CHRB|SPLICE bug 08-05-11 ppproto.c: fix proto test 10 regression 07-09-21 ppproto.c: add "Public Domain" to the noticed list 07-08-11 probe.win32: add cl.exe setuid workaround, CC.VERSION[.STRING] diff --git a/usr/src/lib/libpp/common/gentab.sh b/usr/src/lib/libpp/common/gentab.sh index d843868970..5000d3ab90 100644 --- a/usr/src/lib/libpp/common/gentab.sh +++ b/usr/src/lib/libpp/common/gentab.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1986-2008 AT&T Intellectual Property # +# Copyright (c) 1986-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libpp/common/pp.h b/usr/src/lib/libpp/common/pp.h index 08eee17b16..c8c30ae074 100644 --- a/usr/src/lib/libpp/common/pp.h +++ b/usr/src/lib/libpp/common/pp.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -82,7 +82,7 @@ #define ppsymset(t,n) (struct ppsymbol*)hashlook(t,n,HASH_CREATE|HASH_SIZE(sizeof(struct ppsymbol)),NiL) #if CHAR_MIN < 0 -#define pptype (ppctype-(CHAR_MIN)+1) +#define pptype (ppctype-(CHAR_MIN)) #else #define pptype (ppctype) #endif diff --git a/usr/src/lib/libpp/common/pp.probe b/usr/src/lib/libpp/common/pp.probe index 285f23da71..5d18c26eda 100644 --- a/usr/src/lib/libpp/common/pp.probe +++ b/usr/src/lib/libpp/common/pp.probe @@ -2,7 +2,7 @@ # Glenn Fowler # AT&T Research # -# @(#)pp.probe (AT&T Research) 2006-09-05 +# @(#)pp.probe (AT&T Research) 2009-02-02 # # C probe for libpp # @@ -25,6 +25,7 @@ architecture= cpu= model= machine= +undef_predef= # # path cleanup @@ -575,6 +576,13 @@ do echo "#include <sys/$i.h>" > t.$src eval sys_$i=$x done +echo "char* fun() { return (char*)__FUNCTION__; } +int main() { return !fun(); }" > fun.$src +rm -f fun.exe +if $cc -o fun.exe fun.$src && test -x fun.exe +then undef_predef="$undef_predef __FUNCTION__" +fi + case "`grep -c '__STDC__[-0 ]*[=!]=[ ]*0' $usrinclude/stdio.h 2>/dev/null`" in 0) ;; *) hostedtransition=1 ;; @@ -1033,6 +1041,13 @@ case $so:$dynamic:$static in *) echo "#define #dialect(dynamic)" ;; esac echo +case $undef_predef in +?*) for m in $undef_predef + do echo "#undef $m" + done + echo + ;; +esac case $plusplus in ?*) echo "#pragma pp:plusplus" ;; esac diff --git a/usr/src/lib/libpp/common/ppargs.c b/usr/src/lib/libpp/common/ppargs.c index 52da340da3..567b216512 100644 --- a/usr/src/lib/libpp/common/ppargs.c +++ b/usr/src/lib/libpp/common/ppargs.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: cpp (AT&T Research) 2007-03-11 $\n]" +"[-?\n@(#)$Id: cpp (AT&T Research) 2009-02-02 $\n]" USAGE_LICENSE "[+NAME?cpp - C language preprocessor]" "[+DESCRIPTION?\bcpp\b is the preprocessor for all C language dialects. It is" diff --git a/usr/src/lib/libpp/common/ppbuiltin.c b/usr/src/lib/libpp/common/ppbuiltin.c index 4e58af0251..e33d2641d4 100644 --- a/usr/src/lib/libpp/common/ppbuiltin.c +++ b/usr/src/lib/libpp/common/ppbuiltin.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppcall.c b/usr/src/lib/libpp/common/ppcall.c index b06a5961f9..2c18530e6e 100644 --- a/usr/src/lib/libpp/common/ppcall.c +++ b/usr/src/lib/libpp/common/ppcall.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -51,6 +51,7 @@ ppcall(register struct ppsymbol* sym, int tok) int last_line; long old_state; char* last_file; + char* old_next; char* old_token; struct ppmacstk* mp; struct ppinstk* old_in; @@ -183,6 +184,7 @@ ppcall(register struct ppsymbol* sym, int tok) for (p = pp.in->nextchr; isspace(*p); p++); if ((c = *p) != '(' && c != '/' && c != 0 && c != MARK) goto disable; + old_next = (c == MARK) ? pp.in->nextchr : NiL; old_token = pp.token; mp = pp.macp->next; if ((pp.token = (char*)&mp->arg[mac->arity + 1]) > pp.maxmac) @@ -200,24 +202,29 @@ ppcall(register struct ppsymbol* sym, int tok) if (c != '(') { pp.state = old_state; - if (c) + if (old_next) + pp.in->nextchr = old_next; + else { - p = pp.toknxt; - while (p > pp.token) - ungetchr(*--p); + if (c) + { + p = pp.toknxt; + while (p > pp.token) + ungetchr(*--p); #if COMPATIBLE - if ((pp.state & (COMPATIBILITY|STRICT)) == (COMPATIBILITY|STRICT)) - error(1, "%s: macro arguments omitted", sym->name); + if ((pp.state & (COMPATIBILITY|STRICT)) == (COMPATIBILITY|STRICT)) + error(1, "%s: macro arguments omitted", sym->name); #endif - if (c == T_ID && !(pp.state & HIDDEN)) - ungetchr(' '); - } - if (pp.hidden != old_hidden) - { - ungetchr('\n'); - error_info.line--; - if (pp.hidden && !--pp.hidden) - pp.state &= ~HIDDEN; + if (c == T_ID && !(pp.state & HIDDEN)) + ungetchr(' '); + } + if (pp.hidden != old_hidden) + { + ungetchr('\n'); + error_info.line--; + if (pp.hidden && !--pp.hidden) + pp.state &= ~HIDDEN; + } } pp.token = old_token; goto disable; diff --git a/usr/src/lib/libpp/common/ppcomment.c b/usr/src/lib/libpp/common/ppcomment.c index 75e5f1e843..8099e46dac 100644 --- a/usr/src/lib/libpp/common/ppcomment.c +++ b/usr/src/lib/libpp/common/ppcomment.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppcontext.c b/usr/src/lib/libpp/common/ppcontext.c index 7bba261a5f..f87a2fff33 100644 --- a/usr/src/lib/libpp/common/ppcontext.c +++ b/usr/src/lib/libpp/common/ppcontext.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppcontrol.c b/usr/src/lib/libpp/common/ppcontrol.c index fff96641f3..10fb841965 100644 --- a/usr/src/lib/libpp/common/ppcontrol.c +++ b/usr/src/lib/libpp/common/ppcontrol.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -450,6 +450,7 @@ ppcontrol(void) } pp.state &= ~DISABLE; pp.state |= HEADER|STRIP; + pp.in->flags |= IN_noguard; switch (c = pplex()) { case T_STRING: @@ -1468,11 +1469,12 @@ ppcontrol(void) { case T_STRING: s = error_info.file; - if (*(p = pp.token)) pathcanon(p, 0); + if (*(p = pp.token)) + pathcanon(p, 0); fp = ppsetfile(p); error_info.file = fp->name; if (error_info.line == 1) - ppmultiple(fp, INC_TEST); + ppmultiple(fp, INC_IGNORE); switch (c = pplex()) { case '\n': @@ -1953,8 +1955,8 @@ ppcontrol(void) break; case X_MULTIPLE: n = 1; - if (pp.in->type == IN_FILE) - ppmultiple(ppsetfile(error_info.file), i0 ? INC_CLEAR : INC_TEST); + if (pp.in->type == IN_FILE || pp.in->type == IN_RESCAN) + ppmultiple(ppsetfile(error_info.file), i0 ? INC_CLEAR : INC_IGNORE); break; case X_NATIVE: setoption(NATIVE, i0); diff --git a/usr/src/lib/libpp/common/ppcpp.c b/usr/src/lib/libpp/common/ppcpp.c index e9bdae545a..a886799950 100644 --- a/usr/src/lib/libpp/common/ppcpp.c +++ b/usr/src/lib/libpp/common/ppcpp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppdata.c b/usr/src/lib/libpp/common/ppdata.c index 555773e334..f06f64feb7 100644 --- a/usr/src/lib/libpp/common/ppdata.c +++ b/usr/src/lib/libpp/common/ppdata.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -48,7 +48,7 @@ * only within macro bodies */ -static const char id[] = "\n@(#)$Id: libpp (AT&T Research) 2007-06-12 $\0\n"; +static const char id[] = "\n@(#)$Id: libpp (AT&T Research) 2009-02-02 $\0\n"; #include "pplib.h" @@ -176,4 +176,4 @@ struct ppglobals pp = /* the rest are implicitly initialized */ }; -char ppctype[UCHAR_MAX]; +char ppctype[UCHAR_MAX+1]; diff --git a/usr/src/lib/libpp/common/pperror.c b/usr/src/lib/libpp/common/pperror.c index e7f575a908..531a08a57d 100644 --- a/usr/src/lib/libpp/common/pperror.c +++ b/usr/src/lib/libpp/common/pperror.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppexpr.c b/usr/src/lib/libpp/common/ppexpr.c index 219b707cb5..225034b97d 100644 --- a/usr/src/lib/libpp/common/ppexpr.c +++ b/usr/src/lib/libpp/common/ppexpr.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppfsm.c b/usr/src/lib/libpp/common/ppfsm.c index 42a7f4ef1a..05b28a64ef 100644 --- a/usr/src/lib/libpp/common/ppfsm.c +++ b/usr/src/lib/libpp/common/ppfsm.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppfsm.h b/usr/src/lib/libpp/common/ppfsm.h index ac471e0e80..4640bcebc2 100644 --- a/usr/src/lib/libpp/common/ppfsm.h +++ b/usr/src/lib/libpp/common/ppfsm.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppincref.c b/usr/src/lib/libpp/common/ppincref.c index 5d4362cb9d..6080d3ed54 100644 --- a/usr/src/lib/libpp/common/ppincref.c +++ b/usr/src/lib/libpp/common/ppincref.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppinput.c b/usr/src/lib/libpp/common/ppinput.c index 0fac34d9e1..b940fa9fe9 100644 --- a/usr/src/lib/libpp/common/ppinput.c +++ b/usr/src/lib/libpp/common/ppinput.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppkey.c b/usr/src/lib/libpp/common/ppkey.c index 8bb10531fd..6953a01908 100644 --- a/usr/src/lib/libpp/common/ppkey.c +++ b/usr/src/lib/libpp/common/ppkey.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppkey.h b/usr/src/lib/libpp/common/ppkey.h index d87543fed2..6c8515fe8f 100644 --- a/usr/src/lib/libpp/common/ppkey.h +++ b/usr/src/lib/libpp/common/ppkey.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/pplex.c b/usr/src/lib/libpp/common/pplex.c index a421393b60..4fd2bbae0b 100644 --- a/usr/src/lib/libpp/common/pplex.c +++ b/usr/src/lib/libpp/common/pplex.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -2036,7 +2036,7 @@ ppcpp(void) SYNCIN(); PUSH_QUOTE(pp.macp->arg[c - ARGOFFSET], pp.macp->line); CACHEIN(); - bp = ip - 1; + *(bp = ip - 1) = '"'; if (st & (COLLECTING|EOF2NL|JOINING)) rp = fsm[START]; if (state = rp[c = '"']) goto fsm_next; goto fsm_get; diff --git a/usr/src/lib/libpp/common/pplib.h b/usr/src/lib/libpp/common/pplib.h index a450eb63a9..5738078f3a 100644 --- a/usr/src/lib/libpp/common/pplib.h +++ b/usr/src/lib/libpp/common/pplib.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppline.c b/usr/src/lib/libpp/common/ppline.c index 62e56c3a73..5bd0014bde 100644 --- a/usr/src/lib/libpp/common/ppline.c +++ b/usr/src/lib/libpp/common/ppline.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppmacref.c b/usr/src/lib/libpp/common/ppmacref.c index efe97e63ce..4b54d66bd0 100644 --- a/usr/src/lib/libpp/common/ppmacref.c +++ b/usr/src/lib/libpp/common/ppmacref.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppmisc.c b/usr/src/lib/libpp/common/ppmisc.c index 22a989ada4..f4dea77f5c 100644 --- a/usr/src/lib/libpp/common/ppmisc.c +++ b/usr/src/lib/libpp/common/ppmisc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppop.c b/usr/src/lib/libpp/common/ppop.c index 61f9983469..16c0260cd2 100644 --- a/usr/src/lib/libpp/common/ppop.c +++ b/usr/src/lib/libpp/common/ppop.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -841,8 +841,6 @@ ppop(int op, ...) if (!(pp.ppdefault = pathprobe(pp.path, NiL, "C", pp.pass, pp.probe ? pp.probe : PPPROBE, 0))) error(1, "cannot determine default definitions for %s", pp.probe ? pp.probe : PPPROBE); } - if (pp.ppdefault) - sfprintf(sp, "#%s \"%s\"\n", dirname(INCLUDE), pp.ppdefault); if (pp.probe) pp.lastdir->next->type = c; } @@ -908,9 +906,6 @@ ppop(int op, ...) ); sfprintf(sp, "\ -#%s __STDC__\n\ -#%s __STDC__ #(STDC)\n\ -#%s\n\ #%s #%s(%s)\n\ #%s %s:%s\n\ #%s %s:%s\n\ @@ -918,9 +913,6 @@ ppop(int op, ...) #%s\n\ #%s\n\ " - , dirname(IFNDEF) - , dirname(DEFINE) - , dirname(ENDIF) , dirname(IF) , keyname(X_OPTION) , keyname(X_STRICT) @@ -978,6 +970,18 @@ ppop(int op, ...) , pp.pass , keyname(X_BUILTIN) ); + if (pp.ppdefault && *pp.ppdefault) + sfprintf(sp, "#%s \"%s\"\n", dirname(INCLUDE), pp.ppdefault); + sfprintf(sp, +"\ +#%s !defined(__STDC__) && (!#option(compatibility) || #option(transition))\n\ +#%s __STDC__ #(STDC)\n\ +#%s\n\ +" + , dirname(IF) + , dirname(DEFINE) + , dirname(ENDIF) + ); t = sfstruse(sp); debug((-9, "\n/* begin initialization */\n%s/* end initialization */", t)); ppcomment = pp.comment; diff --git a/usr/src/lib/libpp/common/pppragma.c b/usr/src/lib/libpp/common/pppragma.c index bb442471e3..99d3dfa388 100644 --- a/usr/src/lib/libpp/common/pppragma.c +++ b/usr/src/lib/libpp/common/pppragma.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppprintf.c b/usr/src/lib/libpp/common/ppprintf.c index d1c1f9707a..4a7f09e8ba 100644 --- a/usr/src/lib/libpp/common/ppprintf.c +++ b/usr/src/lib/libpp/common/ppprintf.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppproto.c b/usr/src/lib/libpp/common/ppproto.c index b3e6794921..147aecf87c 100644 --- a/usr/src/lib/libpp/common/ppproto.c +++ b/usr/src/lib/libpp/common/ppproto.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/ppsearch.c b/usr/src/lib/libpp/common/ppsearch.c index 83b956bca9..9730ad177f 100644 --- a/usr/src/lib/libpp/common/ppsearch.c +++ b/usr/src/lib/libpp/common/ppsearch.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -82,7 +82,7 @@ ppmultiple(register struct ppfile* fp, register struct ppsymbol* test) { if (status != INC_CLEAR) { - if (status != INC_TEST && status->macro || !(pp.mode & ALLMULTIPLE) && !(pp.state & STRICT)) + if (status == INC_TEST || status->macro) { if ((pp.mode & (ALLMULTIPLE|LOADING)) == LOADING) fp->guard = INC_IGNORE; @@ -96,6 +96,8 @@ ppmultiple(register struct ppfile* fp, register struct ppsymbol* test) } if ((pp.mode & (ALLMULTIPLE|LOADING)) == LOADING) test = INC_IGNORE; + else + return 1; } fp->guard = test; return 1; @@ -605,8 +607,14 @@ ppsearch(char* file, int type, int flags) pp.include = 0; fd = -1; - dospath = 0; chop = 0; + if (s = strchr(file, '\\')) + { + do *s++ = '/'; while (s = strchr(s, '\\')); + dospath = 1; + } + else + dospath = 0; again: pathcanon(file, 0); if (chop) @@ -757,15 +765,6 @@ ppsearch(char* file, int type, int flags) switch (dospath) { - case 0: - if (s = strchr(file, '\\')) - { - do *s++ = '/'; while (s = strchr(s, '\\')); - pathcanon(file, 0); - dospath = 1; - goto again; - } - /*FALLTHROUGH*/ case 1: if (ppisid(file[0]) && file[1] == ':' && file[2] == '/') { diff --git a/usr/src/lib/libpp/common/ppsym.c b/usr/src/lib/libpp/common/ppsym.c index 5fa4d7ff23..1fd5ea9105 100644 --- a/usr/src/lib/libpp/common/ppsym.c +++ b/usr/src/lib/libpp/common/ppsym.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libpp/common/pptrace.c b/usr/src/lib/libpp/common/pptrace.c index a10117f4bd..d46e50e23d 100644 --- a/usr/src/lib/libpp/common/pptrace.c +++ b/usr/src/lib/libpp/common/pptrace.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2008 AT&T Intellectual Property * +* Copyright (c) 1986-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/Makefile b/usr/src/lib/libshell/Makefile index c30d0df3ed..b584728d5f 100644 --- a/usr/src/lib/libshell/Makefile +++ b/usr/src/lib/libshell/Makefile @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -63,7 +63,7 @@ $(SUBDIRS): FRC FRC: -# rules to install demo files in $(ROOT)/usr/demo/ksh/ include Makefile.demo +include Makefile.doc include ../Makefile.targ diff --git a/usr/src/lib/libshell/Makefile.com b/usr/src/lib/libshell/Makefile.com index 54857c5329..1e76e04af0 100644 --- a/usr/src/lib/libshell/Makefile.com +++ b/usr/src/lib/libshell/Makefile.com @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -37,8 +37,10 @@ OBJECTS= \ bltins/getopts.o \ bltins/hist.o \ bltins/misc.o \ + bltins/poll_solaris.o \ bltins/print.o \ bltins/read.o \ + bltins/regress.o \ bltins/shiocmd_solaris.o \ bltins/sleep.o \ bltins/test.o \ diff --git a/usr/src/lib/libshell/Makefile.demo b/usr/src/lib/libshell/Makefile.demo index f59b5dd5a5..58924e6285 100644 --- a/usr/src/lib/libshell/Makefile.demo +++ b/usr/src/lib/libshell/Makefile.demo @@ -27,18 +27,14 @@ ROOTDEMODIRBASE= $(ROOT)/usr/demo/ksh DEMOFILES= \ - doc/RELEASE \ - doc/README \ - doc/TYPES \ - doc/DESIGN \ - doc/COMPATIBILITY \ - doc/OBSOLETE \ + bin/cpvprint \ bin/crawlsrccomments \ bin/filemutexdemo1 \ bin/filetree1 \ bin/gnaw \ bin/mandelbrotset1 \ bin/multifollow \ + bin/numtree1 \ bin/primenumbers1 \ bin/rssread \ bin/shcalc \ @@ -49,6 +45,8 @@ DEMOFILES= \ bin/shpiano \ bin/shtinyurl \ bin/shtwitter \ + bin/simplefileattributetree1 \ + bin/simplefiletree1 \ bin/svcproptree1 \ bin/termclock \ bin/test_net_sctp \ @@ -57,6 +55,31 @@ DEMOFILES= \ fun/popd \ fun/pushd \ fun/title \ + src/cpvprint.sh \ + src/crawlsrccomments.sh \ + src/filemutexdemo1.sh \ + src/filetree1.sh \ + src/gnaw.sh \ + src/mandelbrotset1.sh \ + src/multifollow.sh \ + src/numtree1.sh \ + src/primenumbers1.sh \ + src/rssread.sh \ + src/shcalc.sh \ + src/shircbot.sh \ + src/shlint.sh \ + src/shman.sh \ + src/shnote.sh \ + src/shpiano.sh \ + src/shtinyurl.sh \ + src/shtwitter.sh \ + src/simplefileattributetree1.sh \ + src/simplefiletree1.sh \ + src/svcproptree1.sh \ + src/termclock.sh \ + src/test_net_sctp.sh \ + src/xmldocumenttree1.sh \ + tests/README.tests \ tests/shtests \ tests/alias.sh \ tests/append.sh \ @@ -79,7 +102,6 @@ DEMOFILES= \ tests/grep.sh \ tests/heredoc.sh \ tests/io.sh \ - tests/locale.sh \ tests/nameref.sh \ tests/options.sh \ tests/path.sh \ @@ -93,7 +115,14 @@ DEMOFILES= \ tests/sigchld.sh \ tests/signal.sh \ tests/statics.sh \ + tests/subshell.sh \ + tests/substring.sh \ + tests/sun_solaris_array_default_datatype.sh \ + tests/sun_solaris_builtin_poll.sh \ tests/sun_solaris_builtin_sum.sh \ + tests/sun_solaris_builtin_tail.sh \ + tests/sun_solaris_command_substitution.sh \ + tests/sun_solaris_compound_nameref.sh \ tests/sun_solaris_compoundvario.sh \ tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh \ tests/sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh \ @@ -102,18 +131,29 @@ DEMOFILES= \ tests/sun_solaris_cr_6754020_weird_square_bracket_expansion.sh \ tests/sun_solaris_cr_6763594_command_failure_execs_twice.sh \ tests/sun_solaris_cr_6766246_pattern_matching_bug.sh \ + tests/sun_solaris_cr_6769332_substitutions_terminate_shell_after_257_iterations.sh \ + tests/sun_solaris_cr_6777491_lacks_arithmetric_function_iszero.sh \ + tests/sun_solaris_cr_6778077_sigthaw_trap.sh \ + tests/sun_solaris_cr_6789247_printf_hexfloat_rounding.sh \ tests/sun_solaris_cr_6800929_large_command_substitution_hang.sh \ + tests/sun_solaris_cr_6805792_varmovetest1.sh \ + tests/sun_solaris_cr_6805794_character_to_wchar_not_working.sh \ + tests/sun_solaris_cr_6805795_negative_zero.sh \ tests/sun_solaris_cr_6807179_shellpattern_uses_getpwnam.sh \ + tests/sun_solaris_cr_6835835_builtin_cat_n_broken.sh \ + tests/sun_solaris_cr_6848486_echo_test_with_test_undefined_executes_test_builtin.sh \ + tests/sun_solaris_cr_6855875_typeset_hexfloat_has_too_few_digits.sh \ + tests/sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.sh \ + tests/sun_solaris_cr_6881017_background_process_in_subshell_hangs_caller.sh \ tests/sun_solaris_getconf.sh \ tests/sun_solaris_local_compound_nameref001.sh \ tests/sun_solaris_staticvariables.sh \ tests/sun_solaris_vartree001.sh \ tests/sun_solaris_vartree002.sh \ tests/sun_solaris_vartree003.sh \ - tests/substring.sh \ - tests/subshell.sh \ tests/tilde.sh \ tests/timetype.sh \ + tests/treemove.sh \ tests/types.sh \ tests/variables.sh \ tests/vartree1.sh \ @@ -132,18 +172,14 @@ $(ROOTDEMODIRBASE)/bin/%: common/scripts/%.sh cat "$<" >"$(@F)" $(INS) -s -m $(FILEMODE) -f $(@D) "$(@F)" $(RM) "$(@F)" - -# Documentation rules -$(ROOTDEMODIRBASE)/doc/%: common/% - $(INS.file) -$(ROOTDEMODIRBASE)/doc/%: misc/% +$(ROOTDEMODIRBASE)/src/%.sh: common/scripts/%.sh $(INS.file) - + ROOTDEMODIRS= $(ROOTDEMODIRBASE) .WAIT \ $(ROOTDEMODIRBASE)/bin \ - $(ROOTDEMODIRBASE)/doc \ $(ROOTDEMODIRBASE)/fun \ + $(ROOTDEMODIRBASE)/src \ $(ROOTDEMODIRBASE)/tests install: $(ROOTDEMODIRS) .WAIT $(ROOTDEMOFILES) diff --git a/usr/src/lib/libshell/Makefile.doc b/usr/src/lib/libshell/Makefile.doc new file mode 100644 index 0000000000..4853d91daa --- /dev/null +++ b/usr/src/lib/libshell/Makefile.doc @@ -0,0 +1,91 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +ROOTDOCDIRBASE= $(ROOT)/usr/share/doc/ksh + +DOCFILES= \ + RELEASE \ + README \ + TYPES \ + DESIGN \ + COMPATIBILITY \ + OBSOLETE \ + shell_styleguide.docbook \ + shell_styleguide.html \ + images/tag_bourne.png \ + images/tag_i18n.png \ + images/tag_ksh88.png \ + images/tag_ksh93.png \ + images/tag_ksh.png \ + images/tag_l10n.png \ + images/tag_perf.png \ + images/callouts/1.png \ + images/callouts/2.png \ + images/callouts/3.png \ + images/callouts/4.png \ + images/callouts/5.png \ + images/callouts/6.png \ + images/callouts/7.png \ + images/callouts/8.png \ + images/callouts/9.png \ + images/callouts/10.png + +# Documentation rules +$(ROOTDOCDIRBASE)/%: common/% + $(INS.file) + +$(ROOTDOCDIRBASE)/%: misc/% + $(INS.file) + +ROOTDOCDIRS= \ + $(ROOTDOCDIRBASE) .WAIT \ + $(ROOTDOCDIRBASE)/images .WAIT \ + $(ROOTDOCDIRBASE)/images/callouts + +$(ROOTDOCDIRBASE)/%.html: misc/%.docbook + /usr/bin/xsltproc \ + --nonet \ + --stringparam generate.section.toc.level 0 \ + --stringparam toc.max.depth 3 \ + --stringparam toc.section.depth 12 \ + --xinclude \ + -o "$(@F)" \ + /usr/share/sgml/docbook/xsl-stylesheets/html/docbook.xsl \ + "$<" >xsltproc.log 2>&1 + $(INS) -s -m $(FILEMODE) -f "$(@D)" "$(@F)" + $(RM) "$(@F)" + +# Generic documentation rules +DOCFILESRCDIR= common +ROOTDOCFILES= $(DOCFILES:%=$(ROOTDOCDIRBASE)/%) +$(ROOTDOCDIRS) := OWNER = root +$(ROOTDOCDIRS) := GROUP = bin +$(ROOTDOCDIRS) := DIRMODE = 755 + +$(ROOTDOCDIRS): + $(INS.dir) + +install: $(ROOTDOCDIRS) .WAIT $(ROOTDOCFILES) diff --git a/usr/src/lib/libshell/amd64/include/ast/history.h b/usr/src/lib/libshell/amd64/include/ast/history.h index bfac5d3b35..0159773f4d 100644 --- a/usr/src/lib/libshell/amd64/include/ast/history.h +++ b/usr/src/lib/libshell/amd64/include/ast/history.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/amd64/include/ast/nval.h b/usr/src/lib/libshell/amd64/include/ast/nval.h index c11fd66143..a81d34b84a 100644 --- a/usr/src/lib/libshell/amd64/include/ast/nval.h +++ b/usr/src/lib/libshell/amd64/include/ast/nval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -276,6 +276,7 @@ extern __MANGLE__ Namfun_t *nv_isvtree __PROTO__((Namval_t*)); extern __MANGLE__ Namval_t *nv_lastdict __PROTO__((void)); extern __MANGLE__ Namval_t *nv_mkinttype __PROTO__((char*, size_t, int, const char*, Namdisc_t*)); extern __MANGLE__ void nv_newattr __PROTO__((Namval_t*,unsigned,int)); +extern __MANGLE__ void nv_newtype __PROTO__((Namval_t*)); extern __MANGLE__ Namval_t *nv_open __PROTO__((const char*,Dt_t*,int)); extern __MANGLE__ void nv_putval __PROTO__((Namval_t*,const char*,int)); extern __MANGLE__ void nv_putv __PROTO__((Namval_t*,const char*,int,Namfun_t*)); diff --git a/usr/src/lib/libshell/amd64/include/ast/shell.h b/usr/src/lib/libshell/amd64/include/ast/shell.h index adcefac221..b5d87afc94 100644 --- a/usr/src/lib/libshell/amd64/include/ast/shell.h +++ b/usr/src/lib/libshell/amd64/include/ast/shell.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -146,8 +146,8 @@ struct Shell_s int inlineno; /* line number of current input file */ int exitval; /* most recent exit value */ unsigned char trapnote; /* set when trap/signal is pending */ - char subshell; /* set for virtual subshell */ char shcomp; /* set when runing shcomp */ + short subshell; /* set for virtual subshell */ #ifdef _SH_PRIVATE _SH_PRIVATE #endif /* _SH_PRIVATE */ diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/acct b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/acct index a1aab9f098..6282d28a47 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/acct +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/acct @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_acct_ksh93 #define _def_acct_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_acct 1 /* acct() in default lib(s) */ diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/cmds b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/cmds index a94a278e7d..71d68caeae 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/cmds +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/cmds @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/cmds by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/cmds by iffe version 2009-10-06 : : */ #ifndef _def_cmds_ksh93 #define _def_cmds_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _cmd_newgrp 1 /* newgrp in ?(/usr)/(bin|etc|ucb) */ diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/dynamic b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/dynamic index 75cfcd4ac6..d13667da0b 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/dynamic +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/dynamic @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/dynamic by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/dynamic by iffe version 2009-10-06 : : */ #ifndef _def_dynamic_ksh93 #define _def_dynamic_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #if SHOPT_DYNAMIC diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/execargs b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/execargs index e84962fedf..070a127da3 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/execargs +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/execargs @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_execargs_ksh93 #define _def_execargs_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #endif diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/externs b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/externs index ef4d91917c..66abda8ba9 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/externs +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/externs @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/externs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/externs by iffe version 2009-10-06 : : */ #ifndef _def_externs_ksh93 #if !defined(__PROTO__) @@ -63,10 +63,10 @@ #define _def_externs_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_exec_attr 1 /* #include <exec_attr.h> ok */ diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/locale b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/locale index 6ec3192f18..dec6103584 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/locale +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/locale @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/locale by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/locale by iffe version 2009-10-06 : : */ #ifndef _def_locale_ksh93 #define _def_locale_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_locale 1 /* #include <locale.h> ok */ diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/math b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/math index a978df9136..e11378591b 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/math +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/math @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/math.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/math.sh by iffe version 2009-10-06 : : */ #ifndef _def_math_ksh93 #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -62,15 +62,15 @@ #define _def_math_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ -/* : : generated by iffe from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/data/math.tab : : */ +/* : : generated by iffe from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/data/math.tab : : */ typedef Sfdouble_t (*Math_f) __PROTO__((Sfdouble_t,...)); @@ -88,7 +88,13 @@ static int local_isless __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTO static int local_islessequal __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return islessequal(a1,a2);} static int local_islessgreater __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return islessgreater(a1,a2);} static int local_isnormal __PARAM__((Sfdouble_t a1), (a1)) __OTORP__(Sfdouble_t a1;){return isnormal(a1);} +#ifdef FP_SUBNORMAL +static int local_issubnormal __PARAM__((Sfdouble_t x), (x)) __OTORP__(Sfdouble_t x;){ return fpclassify(x) == FP_SUBNORMAL; } +#endif static int local_isunordered __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return isunordered(a1,a2);} +#ifdef FP_ZERO +static int local_iszero __PARAM__((Sfdouble_t x), (x)) __OTORP__(Sfdouble_t x;){ return fpclassify(x) == FP_ZERO; } +#endif static int local_signbit __PARAM__((Sfdouble_t a1), (a1)) __OTORP__(Sfdouble_t a1;){return signbit(a1);} /* @@ -136,9 +142,19 @@ const struct mathtab shtab_math[] = "\012islessgreater", (Math_f)local_islessgreater, "\011isnan", (Math_f)isnanl, "\011isnormal", (Math_f)local_isnormal, +#ifdef FP_SUBNORMAL + "\011issubnormal", (Math_f)local_issubnormal, +#endif "\012isunordered", (Math_f)local_isunordered, +#ifdef FP_ZERO + "\011iszero", (Math_f)local_iszero, +#endif + "\001j0", (Math_f)j0l, + "\001j1", (Math_f)j1l, + "\002jn", (Math_f)jnl, "\001lgamma", (Math_f)lgammal, "\001log", (Math_f)logl, + "\001log10", (Math_f)log10l, "\001log1p", (Math_f)log1pl, "\001log2", (Math_f)log2l, "\001logb", (Math_f)logbl, @@ -159,6 +175,9 @@ const struct mathtab shtab_math[] = "\001tanh", (Math_f)tanhl, "\001tgamma", (Math_f)tgammal, "\001trunc", (Math_f)truncl, + "\001y0", (Math_f)y0l, + "\001y1", (Math_f)y1l, + "\002yn", (Math_f)ynl, "", (Math_f)0 }; #endif diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/options b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/options index e8f9d39ebf..eee9524c79 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/options +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/options @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/options by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/options by iffe version 2009-10-06 : : */ #ifndef _def_options_ksh93 #define _def_options_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define SHELLMAGIC 1 diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/poll b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/poll index b7142aab89..d3590e8d73 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/poll +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/poll @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/poll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/poll by iffe version 2009-10-06 : : */ #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 <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_poll 1 /* #include <poll.h> ok */ diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/pstat b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/pstat index 763f166f96..2ad9d1c5ea 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/pstat +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/pstat @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_pstat_ksh93 #define _def_pstat_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #endif diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/rlimits b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/rlimits index 1a813d00d6..15bdcad01d 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/rlimits +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/rlimits @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/rlimits by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/rlimits by iffe version 2009-10-06 : : */ #ifndef _def_rlimits_ksh93 #define _def_rlimits_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/setjmp b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/setjmp index 3ba561b4bc..19cc1b9719 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/setjmp +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/setjmp @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/setjmp by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/setjmp by iffe version 2009-10-06 : : */ #ifndef _def_setjmp_ksh93 #define _def_setjmp_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_sigsetjmp 1 /* sigsetjmp() in default lib(s) */ diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/sigfeatures b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/sigfeatures index 9bad743681..6f4ad9835d 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/sigfeatures +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/sigfeatures @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/sigfeatures by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/sigfeatures by iffe version 2009-10-06 : : */ #ifndef _def_sigfeatures_ksh93 #define _def_sigfeatures_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_sigrelse 1 /* sigrelse() in default lib(s) */ diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/time b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/time index e5bd1182f5..9efb09e58c 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/time +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/time @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ksh93 #define _def_time_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_utime 1 /* #include <utime.h> ok */ diff --git a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/ttys b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/ttys index e665fc6b9e..564720fc11 100644 --- a/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/ttys +++ b/usr/src/lib/libshell/amd64/src/cmd/ksh93/FEATURE/ttys @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/cmd/ksh93/features/ttys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/cmd/ksh93/features/ttys by iffe version 2009-10-06 : : */ #ifndef _def_ttys_ksh93 #define _def_ttys_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_termios 1 /* #include <termios.h> ok */ diff --git a/usr/src/lib/libshell/common/RELEASE b/usr/src/lib/libshell/common/RELEASE index f368dd1531..ad43ff6b45 100644 --- a/usr/src/lib/libshell/common/RELEASE +++ b/usr/src/lib/libshell/common/RELEASE @@ -1,3 +1,248 @@ +09-10-12 --- Release ksh93t+ --- +09-10-12 A bug in which a function loaded in a subshell could leave side + effects in the parent shell has been fixed. +09-10-12 A bug in converting a printf %d operand to a number when the operand + contains multiple subscripts for the same variable has been fixed. +09-10-09 A bug in the handling of the escape character \ in directory prefixes + in command completion has been fixed. +09-10-09 $PATH processing has been changed to delay dir stat() and .paths + lookup until the directory is needed in the path search. +09-09-28 Call the ast setlocale() intercept on unset too. +09-09-24 A bug in which LANG=foo; LC_ALL=foo; unset LC_ALL; did not revert + LC_CTYPE etc. to the LANG value has been fixed. +09-09-17 A bug in which unsetting SVLVL could cause a script invoked by + name without #! to core dump has been fixed. +09-09-16 A bug in which a pipeline in a here-document could hang when the + pipefail option was on has been fixed. +09-09-09 A bug in the processing of line joining in here documents which + occurred when a buffer began with <escape><new-line> has been fixed. +09-09-09 A leading ; with commands in a brace group or parenthesis group + no longer causes an error. It now is used for the "showme" option. +09-09-09 A bug in which a subshell containing a background process could + block until the background process completed has been fixed. +09-09-04 A bug in handing ${var[sub]}, where var is a nameref has been fixed. +09-09-03 A bug which caused an index array to have the wrong number of elements + when it was converted from a compound variable by adding an another + element has been fixed. +09-09-03 Specifying export for a compound variable now generates an error. +09-09-02 $"..." localizations strings are no longer recognized inside `...`. +09-09-01 A bug in the for loop optimizer in the handling of type static + variables has been fixed. +09-09-01 An error message is not displayed when * and @ are used as subscripts. +09-09-01 Several bugs in the processing for types that included an associative + array of another type has been fixed. +09-09-01 A bug in the tracing of [[ a < b ]] and [[ a > b ]] has been fixed. +09-08-26 The .sh.file variable was not being set for a script that was run + by name and didn't start with #! and this has been fixed. +09-08-25 A bug in which a function called to deeply from command substitution + did not display an error message has been fixed. +09-08-24 When processing profiles, ksh93 now violates the POSIX standard and + treats &> as a redirection operator similar to bash. +09-08-23 A bug in the handling of the trap on SIGPIPE that could lead to am + memory fault has been fixed. +09-08-21 A bug in the handling of the comma operator in arithmetic expressions + that could cause a core dump on some systems has been fixed. +09-08-20 A bug in which a compound variable containing an array of a type + that doesn't have any elements now expands correctly. +09-08-19 A bug which disabled function tracing inside a function after + a call to another function has been fixed. +09-08-19 A bug in which initializing a compound variable instance to another + compound variable by name has been fixed. +09-08-18 A bug in which compound variable instances could be lost after + an instance that invoked a type method discipline has been fixed. +09-08-18 A bug in which a discipline function for a type applied to an + array instance when invoked in a function ignored the subscript + has been fixed. +09-08-18 A scoping error with variables in arithmetic expression with + type variables when reference with a name reference has been fixed. +09-08-10 Several memory leaks were fixed primarily related to subshells. +09-08-06 A bug in which setting the trap on CHLD to ignore could cause + a script to hang has been fixed. +09-07-08 A bug in the processing of name reference assignments when it + contained pattern expansions with quoting has been fixed. +09-06-22 The default width for typeset -X has been changed so that there + should be no loss of precision when converting to a string. +09-06-19 A bug in the printing of array elements for binary variables with + printf %B has been fixed. +09-06-19 A bug which caused a core dump with trap DEBUG set with an array + assignment with no elements has been fixed. +09-06-19 A bug with read with typeset -b -Z<num> has been fixed. +09-06-19 Two bugs related to read -b for array variables has been fixed. +09-06-19 A bug with typeset for compound variables containing arrays of + compound variables has been fixed. +09-06-18 A bug in appending a compound variable to a an indexed array of + compound variables has been fixed. +09-06-18 A bug which occurs when appending a compound variable to an indexed + array element has been fixed. +09-06-18 Setting VISUAL to a value other than one ending in vi or emacs will + no longer unset the edit mode. +09-06-17 A bug in typeset -m when moving a local compound variable to a + global compound variable via a name reference has been fixed. +09-06-17 A bug in appending to nodes of an array of compound variables when + addressing them via nameref has been fixed. +09-06-17 A bug in typeset -p var, when var is an array of compound variables + in which the output only contained on array element has been fixed. +09-06-17 The prefix expansion ${!y.@} now works when y is a name + reference to an element of an array. +09-06-16 Traps on signals that are ignored when the shell is invoked + no longer display. Previously they were ignored as required but + would be listed with trap -p. +09-06-12 A bug in vi edit mode in which hitting the up arrow key at the + end of a line longer than 40 characters which caused a core dump + has been fixed. +09-06-11 A bug in which "eval non-builtin &" would create two processes, + one for the & and another for non-builtin has been fixed. +09-06-08 When var is an identifier and is unset, ${var} no longer tries to + run command substitution on the command var. +09-06-08 Process substitution arguments of the form <(command) can now be + used following the < redirection operator to redirect from command. +09-05-13 A bug in which redirections of the form 2>&1 1>&5 inside command + substitution could cause the command substitution to hang has been + fixed. +09-05-12 To conform with POSIX, the -u option only checks for unset variables + and subscript elements rather than checking for all parameters. +09-05-12 A bug which could cause a core dump when a variable whose name + begins with a . was referenced as part of a name reference inside + a function has been fixed. +09-05-01 A bug that caused a core dump when SIGWINCH was received and + both vi and emacs mode were off has been fixed. +09-04-22 Default alias compound='typeset -C' added. +09-04-15 A bug that caused ${...;} to hang for large files has ben fixed. +09-04-08 A change was made in the -n option which printed out an incorrect + warning with <>. +09-04-07 The emacs edit command M-_ and M_. and the vi command _ was fixed + to handle the case there there is no history file. +09-04-05 A bug in handling new-lines with read -n has been fixed. +09-04-05 The ENV variable defaults the the file named by $HOME/.kshrc rather + then to the string $HOME/.kshrc. +09-03-31 A bug in which a nested command substitution with redirections could + leave a file descriptor open has been fixed. +09-03-24 ksh now only uses the value of the _ variable on startup if it can + verify that it was set by the invoking process rather than being + inherited by some other ancestor. +09-03-24 When ksh is invoked without -p and ruid!=euid, and the shell is + compiled without SHOPT_P_UID or ruid<SHOPT_P_UID, the shell now + enables the -p option. The previous version instead set the + euid to the ruid as it does for set +p. +09-03-24 When SHOPT_P_UID is defined at compile time and the shell is started + without -p and ruid!=euid and ruid>=SHOPT_P_UID then euid is set + to ruid. A bug that did the wrong test (ruid<SHOPT_P_UID) was fixed. +09-03-17 The sleep(1) builtin now accept and ISO 8601 PnYnMnDTnHnMnS + duration or date(1) compatible date/time operand. +09-03-10 If a variable that was left or right justified or zero-filled was + changed with a typeset statement that was left or right justified + or zero-filled, then the original justification no longer affects + the result. +09-03-10 A bug in the handling of traps when the last command in a script + is a subshell grouping command has been fixed. +09-03-03 A bug in which an expansion of the form ${!prefix@} could generate + an exception after the return from a function has been fixed. +09-02-02 A bug in restricted mode in which the value of ENV could be + changed from within a function has been fixed. +09-02-02 A bug in which an erroneous message indicating that a process + terminated with a coredump has been fixed. +09-02-02 The exit status when exit was called without an argument from + a signal handler was incorrect and has been fixed. +09-02-02 A bug in which a function autoloaded in a subshell could cause + a core dump when the subshell completed has been fixed. +09-02-02 A bug in which 2>&1 inside a command substitution wasn't working + correctly has been fixed. +09-02-02 A bug in the call stack of arithmetic function with 2 args + returning int has been fixed. +09-01-30 A bug in which 'eval print \$0' inside a function was giving the + wrong value for $0 has been fixed. +09-01-28 A bug in which a command substitution could return an exit status + of 127 when the pipefail option is enabled has been fixed. +09-01-26 ksh93 now generates an error message if you attempt to create + a global name reference to a local variable. +09-01-26 The [[ -v var ]] operator was modified to test for array elements. +09-01-23 The redirection operator <>; was added. It is similar to <> + except that if the command it is applied to succeeds, the file + is truncated to the offset at the command completion. +09-01-23 The default file descriptor for <> was changed to 1. +09-01-20 A bug in which the exit status specified in an exit trap was + not used when a process terminated with a signal has been fixed. +09-01-19 A bug in which a signal whose default action is to terminate + a process could be ignored when the process is running a sub-shell + has been fixed. +09-01-19 A bug in which sending SIGWINCH to a process that reads from a pipe + could cause a memory fault has been fixed. +09-01-16 The -R unary operator was added to [[...]] and test to check whether + a variable is a name reference. +09-01-16 The -v unary operator was added to [[...]] and test to check whether + a variable is set. +09-01-14 The unset built-in was modified to return 0 exit status when + unsetting a variable that was unset to conform with the POSIX + standard. +09-01-14 The unset built-in was modified to continue to unset variables + after encountering a variable that it could not unset to + conform to the POSIX standard. +09-01-14 The parameter expansion ${x+value} no longer expands the value of + the variable x when determining whether x is set or not. +09-01-13 A bug in which background jobs and pipelines that were not waited + for could, in rare instances, cause the shell to go into an infinite + loop or fail has been fixed. +09-01-06 A bug in indexed arrays of compound variables in which referencing + non-existent sub-variable in an arithmetic expression could cause + the sub-variable to be created has been fixed. +09-01-05 A bug in which the \ character did not escape extended regular + expression pattern characters has been fixed. +08-12-24 A bug in which killing the last element of a pipe did not cause + a write to the pipe to generate a SIGPIPE has been fixed. +08-12-19 A bug which could cause command substitution to hang when the + last element of a pipeline in a command substitution was a built-in + and the output was more that PIPE_BUFF. +08-12-18 A bug which occurs when a here documented marker embedded in a + command substitution occurs on a buffer boundary has been fixed. +08-12-17 A bug in the output of typeset -p for variables that had attributes + but did not have a value has been fixed. +08-12-16 A bug in which a name reference to a name reference variable that + references an array element has been fixed. +08-12-16 A bug in which a variable given both the -A and -C attribute along + with an initial assignment didn't work correctly has been fixed. +08-12-10 The [[ -t fd ]] test was fixed to handle fd>9. +08-12-10 A bug where function stack misalignment could cause a bus error + has been fixed. +08-12-09 Command completion was changed to use \ to quote special characters + instead of quoting the argument in single quotes. +08-12-07 A bug in typeset -m which occurred when the target node was an + associative array element has been fixed. +08-12-07 A timing bug on some systems (for example darwin), that could + cause the last process of a pipeline entered interactively to fail + with an "Exec format error" has been fixed. +08-12-04 SHOPT_BGX enables background job extensions. Noted by "J" in + the version string when enabled. (1) JOBMAX=n limits the number + of concurrent & jobs to n; the n+1 & job will block until a + running background job completes. (2) SIGCHLD traps are queued + so that each completing background job gets its own trap; $! is + set to the job pid and $? is set to the job exit status at the + beginning of the trap. (3) sleep -s added to sleep until the time + expires or until a signal is delivered. +08-12-04 The sign of floating point zero is preserved across arithmetic + function calls. +08-12-04 A bug that caused print(1) to produce garbled stdout/stderr + output has been fixed. +08-12-04 A bug in which printf "%d\n" "'<euro>'" did not output the + numerical value of the EURO symbol, 8354, has been fixed. +08-11-24 /dev/fd* and /dev/std* redirections are first attempted with + open() to preserve seek semantics; failing that the corresponding + file descriptors are dup()'d. +08-11-20 A bug which could cause a core dump if a function compiled with + shcomp was found has been fixed. +08-11-20 A bug in which jobs were not cleared from the jobs table for + interactive shells when the pipefail option is on has been fixed. +08-11-11 A bug in which a field that was unset in a type definition and later + set for an instance could appear twice when displaying the variable + has been fixed. +08-11-11 A bug in which running a simple command & inside a function would + not return the correct process id has been fixed. +08=11-10 A bug in which the exit status of a command could be lost if the pid + was that of the most recent command substitution that had completed + has been fixed. +08-11-10 The maximum depth for subshells has been increased from 256 to 65536. +08-11-06 A bug which could cause a core dump when the _ reference variable was + used as an embedded type with a compound assignment has been fixed. + 08-10-31 --- Release ksh93t --- 08-10-31 Variable scoping/initialization bugs that could dump core were fixed. 08-10-24 The lexer now accepts all RE characters for patterns prefixed @@ -6,7 +251,7 @@ 08-10-18 A bug in array scoping that could dump core has been fixed. 08-10-10 read -n and -N fixed to count characters in multibyte locales. 08-10-10 A bug that mishandled _.array[] type references has been fixed. -08-10-09 ${.sh.version} now contains a catenation of the following (after +08-10-09 ${.sh.version} now contains a concatenation of the following (after 'Version') denoting compile time features: A SHOPT_AUDIT B SHOPT_BASH @@ -115,7 +360,7 @@ jobs completed has been fixed. 08-06-23 KSH_VERSION added as a name reference to .sh.version. 08-06-20 type now outputs 'special builtin' for special builtins. -08-06-19 A couple of bugs in multi-dimensional arrays have been fxied. +08-06-19 A couple of bugs in multi-dimensional arrays have been fixed. 08-06-19 A bug in which a syntax error in a dot script could generated a syntax error in the next subsequent command has been fixed. 08-06-17 Reduced the maximum function call depth to 2048 to avoid exceptions @@ -865,7 +1110,7 @@ used inside ${...} has been fixed. 03-07-15 An error in which expanding an indexed array inside a compound variable could cause a core dump has been fixed. -03-07-15 A bug in which under on rare occassions a job completion interrupt +03-07-15 A bug in which on rare occasions a job completion interrupt could cause to core dump has been fixed. 03-06-26 A bug in which process substitution embedded within command substitution would generate a syntax error has been fixed. diff --git a/usr/src/lib/libshell/common/bltins/alarm.c b/usr/src/lib/libshell/common/bltins/alarm.c index ff3369d293..17d8442e01 100644 --- a/usr/src/lib/libshell/common/bltins/alarm.c +++ b/usr/src/lib/libshell/common/bltins/alarm.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/bltins/cd_pwd.c b/usr/src/lib/libshell/common/bltins/cd_pwd.c index ac9d3f426f..58a90a42c4 100644 --- a/usr/src/lib/libshell/common/bltins/cd_pwd.c +++ b/usr/src/lib/libshell/common/bltins/cd_pwd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -37,7 +37,6 @@ #include "name.h" #include "builtins.h" #include <ls.h> -#include <ctype.h> /* * Invalidate path name bindings to relative paths diff --git a/usr/src/lib/libshell/common/bltins/cflow.c b/usr/src/lib/libshell/common/bltins/cflow.c index 6afe9d584f..cc50817e4c 100644 --- a/usr/src/lib/libshell/common/bltins/cflow.c +++ b/usr/src/lib/libshell/common/bltins/cflow.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -33,7 +33,6 @@ #include "defs.h" #include <ast.h> #include <error.h> -#include <ctype.h> #include "shnodes.h" #include "builtins.h" @@ -65,7 +64,7 @@ done: errormsg(SH_DICT,ERROR_usage(2),"%s",optusage((char*)0)); pp->mode = (**argv=='e'?SH_JMPEXIT:SH_JMPFUN); argv += opt_info.index; - n = (((arg= *argv)?(int)strtol(arg, (char**)0, 10):shp->oldexit)&SH_EXITMASK); + n = (((arg= *argv)?(int)strtol(arg, (char**)0, 10)&SH_EXITMASK:shp->oldexit)); /* return outside of function, dotscript and profile is exit */ if(shp->fn_depth==0 && shp->dot_depth==0 && !sh_isstate(SH_PROFILE)) pp->mode = SH_JMPEXIT; diff --git a/usr/src/lib/libshell/common/bltins/enum.c b/usr/src/lib/libshell/common/bltins/enum.c index c4d8bf03e9..487f9cf1c9 100644 --- a/usr/src/lib/libshell/common/bltins/enum.c +++ b/usr/src/lib/libshell/common/bltins/enum.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/bltins/getopts.c b/usr/src/lib/libshell/common/bltins/getopts.c index be48cc8886..5cb81ae4fe 100644 --- a/usr/src/lib/libshell/common/bltins/getopts.c +++ b/usr/src/lib/libshell/common/bltins/getopts.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/bltins/hist.c b/usr/src/lib/libshell/common/bltins/hist.c index b248515a06..d35aec2070 100644 --- a/usr/src/lib/libshell/common/bltins/hist.c +++ b/usr/src/lib/libshell/common/bltins/hist.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -22,7 +22,6 @@ #include <stak.h> #include <ls.h> #include <error.h> -#include <ctype.h> #include "variables.h" #include "io.h" #include "name.h" diff --git a/usr/src/lib/libshell/common/bltins/misc.c b/usr/src/lib/libshell/common/bltins/misc.c index 22a1410fc3..c66dff20bf 100644 --- a/usr/src/lib/libshell/common/bltins/misc.c +++ b/usr/src/lib/libshell/common/bltins/misc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -116,7 +116,7 @@ int B_login(int argc,char *argv[],void *extra) register struct argnod *arg=shp->envlist; register Namval_t* np; register char *cp; - if(shp->subshell) + if(shp->subshell && !shp->subshare) sh_subfork(); if(logp && logp->clear) { @@ -572,7 +572,7 @@ int b_universe(int argc, char *argv[],void *extra) case 2: if(!shp->lim.fs3d) goto failed; - if(shp->subshell) + if(shp->subshell && !shp->subshare) sh_subfork(); for(n=0;n<argc;n+=2) { diff --git a/usr/src/lib/libshell/common/bltins/mkservice.c b/usr/src/lib/libshell/common/bltins/mkservice.c index be16f45162..8136b4c296 100644 --- a/usr/src/lib/libshell/common/bltins/mkservice.c +++ b/usr/src/lib/libshell/common/bltins/mkservice.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/bltins/poll_solaris.c b/usr/src/lib/libshell/common/bltins/poll_solaris.c new file mode 100644 index 0000000000..1338b5df34 --- /dev/null +++ b/usr/src/lib/libshell/common/bltins/poll_solaris.c @@ -0,0 +1,390 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1982-2009 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 * +* * +* Roland Mainz <roland.mainz@nrubsig.org> * +* * +***********************************************************************/ +#pragma prototyped + +#include <shell.h> +#include <stdio.h> +#include <stdbool.h> +#include <option.h> +#include <stk.h> +#include <tm.h> +#include "name.h" +#undef nv_isnull +#ifndef SH_DICT +# define SH_DICT "libshell" +#endif +#include <poll.h> +#ifdef __GNUC__ +#include <alloca.h> +#endif /* __GNUC__ */ + +#define sh_contexttoshb(context) ((Shbltin_t*)(context)) +#define sh_contexttoshell(context) ((context)?(sh_contexttoshb(context)->shp):(NULL)) + +static const char sh_optpoll[] = +"[-?\n@(#)$Id: poll (AT&T Labs Research) 2009-05-14 $\n]" +"[-author?Roland Mainz <roland.mainz@nrubsig.org]" +"[-license?http://www.opensource.org/licenses/cpl1.0.txt]" +"[+NAME? poll - input/output multiplexing]" +"[+DESCRIPTION?The poll command provides applications with a mechanism " + "for multiplexing input/output over a set of file descriptors. " + "For each member of the array variable \bvar\b, " + "poll examines the given file descriptor in the subscript \b.fd\b " + "for the event(s) specified in the subscript \b.events\b." + "The poll command identifies those file descriptors on which an " + "application can read or write data, or on which certain events have " + "occurred.]" +"[+?The \bvar\b argument specifies the file descriptors to be examined " + "and the events of interest for each file descriptor. " + "It is a array of structured variables with one member for each open " + "file descriptor of interest. The array's members contain the following " + "subscripts:]{" + "[+?\b.fd\b # file descriptor]" + "[+?\b.events\b # requested events]" + "[+?\b.revents\b # returned event]" + "}" +"[+?The \bfd\b variable specifies an open file descriptor and the " + "\bevents\b and \brevents\b members are strings constructed from " + "a concaternation of the following event flags, seperated by '|':]" + "{ " + "[+POLLIN?Data other than high priority data may be " + "read without blocking. For STREAMS, this " + "flag is set in revents even if the message " + "is of zero length.]" + "[+POLLRDNORM?Normal data (priority band equals 0) may be " + "read without blocking. For STREAMS, this " + "flag is set in revents even if the message " + "is of zero length.]" + "[+POLLRDBAND?Data from a non-zero priority band may be " + "read without blocking. For STREAMS, this " + "flag is set in revents even if the message " + "is of zero length.]" + "[+POLLPRI?High priority data may be received without " + "blocking. For STREAMS, this flag is set in " + "revents even if the message is of zero " + "length.]" + "[+POLLOUT?Normal data (priority band equals 0) may be " + "written without blocking.]" + "[+POLLWRNORM?The same as POLLOUT.]" + "[+POLLWRBAND?Priority data (priority band > 0) may be " + "written. This event only examines bands " + "that have been written to at least once.]" + "[+POLLERR?An error has occurred on the device or " + "stream. This flag is only valid in the " + "revents bitmask; it is not used in the " + "events member.]" + "[+POLLHUP?A hangup has occurred on the stream. This " + "event and POLLOUT are mutually exclusive; a " + "stream can never be writable if a hangup has " + "occurred. However, this event and POLLIN, " + ", POLLRDBAND, or POLLPRI are not " + "mutually exclusive. This flag is only valid " + "in the revents bitmask; it is not used in " + "the events member.]" + "[+POLLNVAL?The specified fd value does not belong to an " + "open file. This flag is only valid in the " + "revents member; it is not used in the events " + "member.]" + "}" +"]" + +"[+?If the value fd is less than 0, events is ignored and " + "revents is set to 0 in that entry on return from poll.]" + +"[+?The results of the poll query are stored in the revents " + "member in the \bvar\b structure. POLL*-strings are set in the \brevents\b " + "variable to indicate which of the requested events are true. " + "If none are true, the \brevents\b will be an empty string when " + "the poll command returns. The event flags " + "POLLHUP, POLLERR, and POLLNVAL are always set in \brevents\b " + "if the conditions they indicate are true; this occurs even " + "though these flags were not present in events.]" + +"[+?If none of the defined events have occurred on any selected " + "file descriptor, poll waits at least timeout milliseconds " + "for an event to occur on any of the selected file descriptors. " + "On a computer where millisecond timing accuracy is not " + "available, timeout is rounded up to the nearest legal value " + "available on that system. If the value timeout is 0, poll " + "returns immediately. If the value of timeout is -1, poll " + "blocks until a requested event occurs or until the call is " + "interrupted.]" + +"[+?The poll function supports regular files, terminal and " + "pseudo-terminal devices, STREAMS-based files, FIFOs and " + "pipes. The behavior of poll on elements of fds that refer " + "to other types of file is unspecified.]" + +"[+?The poll function supports sockets.]" + +"[+?A file descriptor for a socket that is listening for connections " + "will indicate that it is ready for reading, once connections " + "are available. A file descriptor for a socket that " + "is connecting asynchronously will indicate that it is ready " + "for writing, once a connection has been established.]" + +"[+?Regular files always poll TRUE for reading and writing.]" + +"[e:eventarray]:[fdcount?Upon successful completion, an indexed array " + "of strings is returned which contains a list of array subscripts " + "in the poll array which received events.]" +"[t:timeout]:[seconds?Timeout in seconds. If the value timeout is 0, " + "poll returns immediately. If the value of timeout is -1, poll " + "blocks until a requested event occurs or until the call is " + "interrupted.]" +"[T:mtimeout]:[milliseconds?Timeout in milliseconds. If the value timeout is 0, " + "poll returns immediately. If the value of timeout is -1, poll " + "blocks until a requested event occurs or until the call is " + "interrupted.]" +"\n" +"\nvar\n" +"\n" +"[+EXIT STATUS?]{" + "[+0?Success.]" + "[+>0?An error occurred.]" +"}" +"[+SEE ALSO?\bopen\b(1),\btmpfile\b(1),\bdup\b(1),\bclose\b(1),\bpoll\b(2)]" +; + +/* + * |mystpcpy| - like |strcpy()| but returns the end of the buffer + * + * Copy string s2 to s1. s1 must be large enough. + * return s1-1 (position of string terminator ('\0') in destnation buffer). + */ +static +char *mystpcpy(char *s1, const char *s2) +{ + while (*s1++ = *s2++) + ; + return (s1-1); +} + +static +Namval_t *nv_open_fmt(Dt_t *dict, int flags, const char *namefmt, ...) +{ + char varnamebuff[PATH_MAX]; + va_list ap; + + va_start(ap, namefmt); + vsnprintf(varnamebuff, sizeof(varnamebuff), namefmt, ap); + va_end(ap); + + return nv_open(varnamebuff, dict, flags); +} + +static +int poll_strtoevents(const char *str) +{ + int events = 0; + + if (strstr(str, "POLLIN")) events |= POLLIN; + if (strstr(str, "POLLRDNORM")) events |= POLLRDNORM; + if (strstr(str, "POLLRDBAND")) events |= POLLRDBAND; + if (strstr(str, "POLLPRI")) events |= POLLPRI; + if (strstr(str, "POLLOUT")) events |= POLLOUT; + if (strstr(str, "POLLWRNORM")) events |= POLLWRNORM; + if (strstr(str, "POLLWRBAND")) events |= POLLWRBAND; + if (strstr(str, "POLLERR")) events |= POLLERR; + if (strstr(str, "POLLHUP")) events |= POLLHUP; + if (strstr(str, "POLLNVAL")) events |= POLLNVAL; + + return events; +} + + +static +void poll_eventstostr(char *s, int events) +{ + *s='\0'; + if (!events) + return; + + if (events & POLLIN) s=mystpcpy(s, "POLLIN|"); + if (events & POLLRDNORM) s=mystpcpy(s, "POLLRDNORM|"); + if (events & POLLRDBAND) s=mystpcpy(s, "POLLRDBAND|"); + if (events & POLLPRI) s=mystpcpy(s, "POLLPRI|"); + if (events & POLLOUT) s=mystpcpy(s, "POLLOUT|"); + if (events & POLLWRNORM) s=mystpcpy(s, "POLLWRNORM|"); + if (events & POLLWRBAND) s=mystpcpy(s, "POLLWRBAND|"); + if (events & POLLERR) s=mystpcpy(s, "POLLERR|"); + if (events & POLLHUP) s=mystpcpy(s, "POLLHUP|"); + if (events & POLLNVAL) s=mystpcpy(s, "POLLNVAL|"); + + /* Remove trailling '|' */ + s--; + if(*s=='|') + *s='\0'; +} + +#undef getconf +#define getconf(x) strtol(astconf(x,NiL,NiL),NiL,0) + +extern int b_poll(int argc, char *argv[], void *extra) +{ + Namval_t *np; + Shell_t *shp = sh_contexttoshell(extra); + char *varname; + int n; + int fd; + nfds_t numpollfd = 0; + int i; + char *s; + double timeout = -1.; + char buff[PATH_MAX*2+1]; /* enogth to hold two variable names */ + char *eventarrayname = NULL; + + while (n = optget(argv, sh_optpoll)) switch (n) + { + case 't': + case 'T': + errno = 0; + timeout = strtod(opt_info.arg, (char **)NULL); + if (errno != 0) + errormsg(SH_DICT, ERROR_system(1), "%s: invalid timeout", opt_info.arg); + + /* -t uses seconds, -T milliseconds */ + if (n == 't') + timeout *= 1000.; + break; + case 'e': + eventarrayname = opt_info.arg; + break; + case ':': + errormsg(SH_DICT, 2, "%s", opt_info.arg); + break; + case '?': + errormsg(SH_DICT, ERROR_usage(2), "%s", opt_info.arg); + break; + } + argc -= opt_info.index; + argv += opt_info.index; + if(argc!=1) + errormsg(SH_DICT, ERROR_usage(2), optusage((char*)0)); + + varname = argv[0]; + + Namval_t *array_np, *array_np_sub; + const char *subname; + + array_np = nv_open(varname, shp->var_tree, NV_NOFAIL|NV_NOADD); + if (!array_np) + errormsg(SH_DICT, ERROR_system(1), "cannot find array variable %s", varname); + if(!nv_isattr(array_np, NV_ARRAY)) + errormsg(SH_DICT, ERROR_system(1), "variable %s is not an array", varname); + + /* Count number of array elememts. We need to do it "manually" to + * handle sparse indexed and associative arrays */ + nv_putsub(array_np, NULL, ARRAY_SCAN); + array_np_sub = array_np; + do + { + if (!(subname=nv_getsub(array_np_sub))) + break; + numpollfd++; + } while( array_np_sub && nv_nextsub(array_np_sub) ); + +#ifdef __GNUC__ + /* + * Allocate stack space via |alloca()| for gcc builds since ctfconvert + * is unable to handle VLAs from gcc. We need this until CR #6379193 + * is fixed. + */ + struct pollfd *pollfd = alloca(sizeof(struct pollfd)*(numpollfd+1)); +#else + /* We must allocate one more entry with VLA with zero elements do not work with all compilers */ + struct pollfd pollfd[numpollfd+1]; +#endif /* __GNUC__ */ + + nv_putsub(array_np, NULL, ARRAY_SCAN); + array_np_sub = array_np; + i = 0; + do + { + if (!(subname=nv_getsub(array_np_sub))) + break; + + np = nv_open_fmt(shp->var_tree, NV_NOFAIL|NV_NOADD, "%s[%s].fd", varname, subname); + if (!np) + errormsg(SH_DICT, ERROR_system(1), "missing pollfd %s[%s].fd", varname, subname); + fd = (int)nv_getnum(np); + if (fd < 0 || fd > OPEN_MAX) + errormsg(SH_DICT, ERROR_system(1), "invalid pollfd fd %d", fd); + nv_close(np); + pollfd[i].fd = fd; + + np = nv_open_fmt(shp->var_tree, NV_NOFAIL|NV_NOADD, "%s[%s].events", varname, subname); + if (!np) + errormsg(SH_DICT, ERROR_system(1), "missing pollfd %s[%s].events", varname, subname); + + s = nv_getval(np); + if (!s) + errormsg(SH_DICT, ERROR_system(1), "missing pollfd events value"); + pollfd[i].events = poll_strtoevents(s); + nv_close(np); + + pollfd[i].revents = 0; + + i++; + } while( array_np_sub && nv_nextsub(array_np_sub) ); + + n = poll(pollfd, numpollfd, timeout); + /* FixMe: EGAIN and EINTR may require extra handling */ + if (n < 0) + errormsg(SH_DICT, ERROR_system(1), "failure"); + + if (eventarrayname) + { + np = nv_open_fmt(shp->var_tree, NV_VARNAME|NV_ARRAY|NV_NOFAIL, "%s", eventarrayname); + if (!np) + errormsg(SH_DICT, ERROR_system(1), "couldn't create poll count variable %s", eventarrayname); + nv_close(np); + } + + nv_putsub(array_np, NULL, ARRAY_SCAN); + array_np_sub = array_np; + i = 0; + do + { + if (!(subname=nv_getsub(array_np_sub))) + break; + + np = nv_open_fmt(shp->var_tree, NV_NOFAIL, "%s[%s].revents", varname, subname); + if (!np) + errormsg(SH_DICT, ERROR_system(1), "couldn't create pollfd %s[%s].revents", varname, subname); + + poll_eventstostr(buff, pollfd[i].revents); + + nv_putval(np, buff, 0); + nv_close(np); + + if (eventarrayname && pollfd[i].revents) + { + sprintf(buff, "%s+=( '%s' )", eventarrayname, subname); + sh_trap(buff, 0); + } + + i++; + } while( array_np_sub && nv_nextsub(array_np_sub) ); + + nv_close(array_np); + + return(0); +} diff --git a/usr/src/lib/libshell/common/bltins/print.c b/usr/src/lib/libshell/common/bltins/print.c index 513d46fb0a..18b51aab67 100644 --- a/usr/src/lib/libshell/common/bltins/print.c +++ b/usr/src/lib/libshell/common/bltins/print.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -36,7 +36,6 @@ #include "builtins.h" #include "streval.h" #include <tmx.h> -#include <ctype.h> #include <ccode.h> union types_t @@ -203,7 +202,10 @@ int b_print(int argc, char *argv[], void *extra) fd = -1; break; case 'v': - vflag=1; + vflag='v'; + break; + case 'C': + vflag='C'; break; case ':': /* The following is for backward compatibility */ @@ -240,7 +242,7 @@ int b_print(int argc, char *argv[], void *extra) if(error_info.errors || (argc<0 && !(format = *argv++))) errormsg(SH_DICT,ERROR_usage(2),"%s",optusage((char*)0)); if(vflag && format) - errormsg(SH_DICT,ERROR_usage(2),"-v and -f are mutually exclusive"); + errormsg(SH_DICT,ERROR_usage(2),"-%c and -f are mutually exclusive",vflag); skip: if(format) format = genformat(format); @@ -293,13 +295,19 @@ skip2: } while(*pdata.nextarg && pdata.nextarg!=argv); if(pdata.nextarg == nullarg && pdata.argsize>0) sfwrite(outfile,stakptr(staktell()),pdata.argsize); + if(sffileno(outfile)!=sffileno(sfstderr)) + sfsync(outfile); sfpool(sfstderr,pool,SF_WRITE); exitval = pdata.err; } else if(vflag) { while(*argv) - fmtbase64(outfile,*argv++,0); + { + fmtbase64(outfile,*argv++,vflag=='C'); + if(!nflag) + sfputc(outfile,'\n'); + } } else { @@ -519,7 +527,14 @@ static void *fmtbase64(char *string, ssize_t *sz, int alt) else { int n = nv_size(np); - cp = (char*)np->nvalue.cp; + if(nv_isarray(np)) + { + nv_onattr(np,NV_RAW); + cp = nv_getval(np); + nv_offattr(np,NV_RAW); + } + else + cp = (char*)np->nvalue.cp; if((size = n)==0) size = strlen(cp); size = sfwrite(iop, cp, size); @@ -593,6 +608,7 @@ static int extend(Sfio_t* sp, void* v, Sffmt_t* fe) union types_t* value = (union types_t*)v; struct printf* pp = (struct printf*)fe; register char* argp = *pp->nextarg; + char* w; if(fe->n_str>0 && varname(fe->t_str,fe->n_str) && (!argp || varname(argp,-1))) { @@ -712,7 +728,13 @@ static int extend(Sfio_t* sp, void* v, Sffmt_t* fe) fe->flags &= ~SFFMT_LONG; break; case 'c': - if(fe->base >=0) + if(mbwide() && (n = mbsize(argp)) > 1) + { + fe->fmt = 's'; + fe->size = n; + value->s = argp; + } + else if(fe->base >=0) value->s = argp; else value->c = *argp; @@ -737,8 +759,12 @@ static int extend(Sfio_t* sp, void* v, Sffmt_t* fe) { case '\'': case '"': - value->ll = ((unsigned char*)argp)[1]; - if(argp[2] && (argp[2] != argp[0] || argp[3])) + w = argp + 1; + if(mbwide() && mbsize(w) > 1) + value->ll = mbchar(w); + else + value->ll = *(unsigned char*)w++; + if(w[0] && (w[0] != argp[0] || w[1])) { errormsg(SH_DICT,ERROR_warn(0),e_charconst,argp); pp->err = 1; diff --git a/usr/src/lib/libshell/common/bltins/read.c b/usr/src/lib/libshell/common/bltins/read.c index 874b575986..d5df0ca53d 100644 --- a/usr/src/lib/libshell/common/bltins/read.c +++ b/usr/src/lib/libshell/common/bltins/read.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -28,7 +28,6 @@ #include <ast.h> #include <error.h> -#include <ctype.h> #include "defs.h" #include "variables.h" #include "lexstates.h" @@ -68,9 +67,14 @@ int b_read(int argc,char *argv[], void *extra) int save_prompt, fixargs=((Shbltin_t*)extra)->invariant; struct read_save *rp; static char default_prompt[3] = {ESC,ESC}; + rp = (struct read_save*)(((Shbltin_t*)extra)->data); if(argc==0) + { + if(rp) + free((void*)rp); return(0); - if(rp = (struct read_save*)(((Shbltin_t*)extra)->data)) + } + if(rp) { flags = rp->flags; timeout = rp->timeout; @@ -199,7 +203,7 @@ static void timedout(void *handle) int sh_readline(register Shell_t *shp,char **names, int fd, int flags,long timeout) { - register int c; + register ssize_t c; register unsigned char *cp; register Namval_t *np; register char *name, *val; @@ -217,7 +221,7 @@ int sh_readline(register Shell_t *shp,char **names, int fd, int flags,long timeo void *timeslot=0; int delim = '\n'; int jmpval=0; - int size = 0; + ssize_t size = 0; int binary; struct checkpt buff; if(!(iop=shp->sftable[fd]) && !(iop=sh_iostream(shp,fd))) @@ -225,9 +229,12 @@ int sh_readline(register Shell_t *shp,char **names, int fd, int flags,long timeo sh_stats(STAT_READS); if(names && (name = *names)) { + Namval_t *mp; if(val= strchr(name,'?')) *val = 0; np = nv_open(name,shp->var_tree,NV_NOASSIGN|NV_VARNAME); + if(np && nv_isarray(np) && (mp=nv_opensub(np))) + np = mp; if((flags&V_FLAG) && shp->ed_context) ((struct edit*)shp->ed_context)->e_default = np; if(flags&A_FLAG) @@ -311,7 +318,7 @@ int sh_readline(register Shell_t *shp,char **names, int fd, int flags,long timeo } if(flags&(N_FLAG|NN_FLAG)) { - char buf[64],*var=buf,*cur,*end,*up,*v; + char buf[256],*var=buf,*cur,*end,*up,*v; /* reserved buffer */ if((c=size)>=sizeof(buf)) { @@ -331,21 +338,24 @@ int sh_readline(register Shell_t *shp,char **names, int fd, int flags,long timeo } else { - int f,m; + ssize_t m; + int f; for (;;) { c = (flags&NN_FLAG) ? -size : -1; cp = sfreserve(iop,c,SF_LOCKR); f = 1; - if((m = sfvalue(iop)) > 0) + if(cp) + m = sfvalue(iop); + else { - if(!cp) - { - m = (cp = sfreserve(iop,size,0)) ? sfvalue(iop) : 0; - f = 0; - } - if(m>0 && (flags&N_FLAG) && !binary && (v=memchr(cp,'\n',m))) - m = v-(char*)cp; + m = (cp = sfreserve(iop,size,0)) ? sfvalue(iop) : 0; + f = 0; + } + if(m>0 && (flags&N_FLAG) && !binary && (v=memchr(cp,'\n',m))) + { + *v++ = 0; + m = v-(char*)cp; } if((c=m)>size) c = size; @@ -353,18 +363,18 @@ int sh_readline(register Shell_t *shp,char **names, int fd, int flags,long timeo { if(c > (end-cur)) { - int cx = cur - var, ux = up - var; + ssize_t cx = cur - var, ux = up - var; + m = (end - var) + (c - (end - cur)); if (var == buf) { - m = (end - var) + (c - (end - cur)); v = (char*)malloc(m+1); - memcpy(v, var, cur - var); + var = memcpy(v, var, cur - var); } else - v = newof(var, char, m, 1); - end = v + m; - cur = v + cx; - up = v + ux; + var = newof(var, char, m, 1); + end = var + m; + cur = var + cx; + up = var + ux; } memcpy((void*)cur,cp,c); if(f) @@ -375,7 +385,6 @@ int sh_readline(register Shell_t *shp,char **names, int fd, int flags,long timeo { int x; int z; - int y = cur - up; mbinit(); *cur = 0; @@ -402,16 +411,19 @@ int sh_readline(register Shell_t *shp,char **names, int fd, int flags,long timeo } if(timeslot) timerdel(timeslot); - if(binary) + if(binary && !((size=nv_size(np)) && nv_isarray(np) && c!=size)) { - if(c==nv_size(np)) + if((c==size) && np->nvalue.cp && !nv_isarray(np)) memcpy((char*)np->nvalue.cp,var,c); else { + Namval_t *mp; if(var==buf) var = memdup(var,c); nv_putval(np,var,NV_RAW); nv_setsize(np,c); + if(!nv_isattr(np,NV_IMPORT|NV_EXPORT) && (mp=(Namval_t*)np->nvenv)) + nv_setsize(mp,c); } } else diff --git a/usr/src/lib/libshell/common/bltins/regress.c b/usr/src/lib/libshell/common/bltins/regress.c new file mode 100644 index 0000000000..b736fd1534 --- /dev/null +++ b/usr/src/lib/libshell/common/bltins/regress.c @@ -0,0 +1,343 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1982-2009 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 * +* * +* David Korn <dgk@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped +/* + * regression test intercept control + * enable with SHOPT_REGRESS==1 in Makefile + * not for production use + * see --man for details + * all string constants inline here instead of in data/... + * + * David Korn + * at&t research + */ + +#include "defs.h" + +#if SHOPT_REGRESS + +#include <error.h> +#include <ls.h> +#include "io.h" +#include "builtins.h" +#include <tmx.h> + +#define REGRESS_HEADER "ksh:REGRESS:" + +#define TRACE(r,i,f) sh_regress(REGRESS_##r, i, sfprints f, __LINE__, __FILE__) + +static const char usage[] = +"[-1p0?\n@(#)$Id: __regress__ (AT&T Research) 2009-03-29 $\n]" +USAGE_LICENSE +"[+NAME?__regress__ - shell regression test intercept control]" +"[+DESCRIPTION?\b__regress__\b controls the regression test intercepts " + "for shells compiled with SHOPT_REGRESS==1. Shells compiled this way are " + "for testing only. In addition to \b__regress__\b and the \b--regress\b " + "command line option, these shells may contain system library function " + "intercepts that behave different from the native counterparts.]" +"[+?Each option controls a different test and possibly a different set " + "of intercepts. The options are interpreted \bdd\b(1) style -- '-' or " + "'--' prefix not required. This simplifies the specification of the " + "command line \b--regress\b=\avalue\a option, where \avalue\a is passed " + "as an option to the \b__regress__\b builtin. Typically regression test " + "intercepts are enabled with one or more command line \b--regress\b " + "options, with optional specific calls to \b__regress__\b in test " + "scripts to enable/disable intercepts as the test progresses.]" +"[+?Each enabled intercept may result in trace lines of the form \b" REGRESS_HEADER + "\aoption\a:\aintercept\a:\ainfo\a on the standard error, where " + "\aoption\a is one of the options below, \aintercept\a is the name of " + "the specific intercept for \aoption\a, and \ainfo\a is \aoption\a " + "specific information. Unless noted otherwise, one regression test trace " + "line is produced each time an enabled intercept is called.]" +"[101:egid?The intercept effective gid is set to \aoriginal-egid\a. The " + "effective gid of the underlying system process is not affected. The " + "trace line info is either \begid==rgid\b or \begid!=rgid\b. The " + "intercepts are:]#?[original-egid:=1]" + "{" + "[+getegid()?The intercept effecive gid is returned. The " + "\bsetgid\b() intercept may change this between the real gid and " + "\aoriginal-egid\a.]" + "[+setgid(gid)?Sets the intercept effective gid to \agid\a. " + "Fails if \agid\a is neither the real gid nor " + "\aoriginal-egid\a.]" + "}" +"[102:euid?The intercept effective uid is set to \aoriginal-euid\a. The " + "effective uid of the underlying system process is not affected. The " + "trace line info is either \beuid==ruid\b or \beuid!=ruid\b. The " + "intercepts are:]#?[original-euid:=1]" + "{" + "[+geteuid()?The intercept effecive uid is returned. The " + "\bsetuid\b() intercept may change this between the real uid and " + "\aoriginal-euid\a.]" + "[+setuid(uid)?Sets the intercept effective uid to \auid\a. " + "Fails if \auid\a is neither the real uid nor " + "\aoriginal-euid\a.]" + "}" +"[103:p_suid?Specifies a value for SHOPT_P_SUID. Effective uids greater " + "than the non-privileged-uid disable the priveleged mode. The intercepts " + "are:]#?[non-privileged-uid:=1]" + "{" + "[+SHOPT_P_SUID?The SHOPT_P_SUID macro value is overridden by " + "\bp_suid\b. A trace line is output for each SHOPT_P_SUID " + "access.]" + "}" +"[104:source?The intercepts are:]" + "{" + "[+sh_source()?The trace line info is the path of the script " + "being sourced. Used to trace shell startup scripts.]" + "}" +"[105:etc?Map file paths matching \b/etc/\b* to \aetc-dir\a/*. The " + "intercepts are:]:[etc-dir:=/etc]" + "{" + "[+sh_open()?Paths matching \b/etc/\b* are changed to " + "\aetc-dir\a/*.]" + "}" +"[+SEE ALSO?\bksh\b(1), \bregress\b(1), \brt\b(1)]" +; + +static const char* regress_options[] = +{ + "ERROR", + "egid", + "euid", + "p_suid", + "source", + "etc", +}; + +void sh_regress_init(Shell_t* shp) +{ + static Regress_t state; + + shp->regress = &state; +} + +/* + * regress info trace output + */ + +void sh_regress(unsigned int index, const char* intercept, const char* info, unsigned int line, const char* file) +{ + char* name; + char buf[16]; + + if (index >= 1 && index <= elementsof(regress_options)) + name = (char*)regress_options[index]; + else + sfsprintf(name = buf, sizeof(buf), "%u", index); + sfprintf(sfstderr, REGRESS_HEADER "%s:%s:%s\n", name, intercept, fmtesc(info)); +} + +/* + * egid intercepts + */ + +static gid_t intercept_sgid = 0; +static gid_t intercept_egid = -1; +static gid_t intercept_rgid = -1; + +gid_t getegid(void) +{ + if (intercept_rgid == -1) + intercept_rgid = getgid(); + if (sh_isregress(REGRESS_egid)) + { + TRACE(egid, "getegid", ("%s", intercept_egid == intercept_rgid ? "egid==rgid" : "egid!=rgid")); + return intercept_egid; + } + return intercept_rgid; +} + +int setgid(gid_t gid) +{ + if (intercept_rgid == -1) + intercept_rgid = getgid(); + if (sh_isregress(REGRESS_egid)) + { + if (gid != intercept_rgid && gid != intercept_sgid) + { + TRACE(egid, "setgid", ("%s", "EPERM")); + errno = EPERM; + return -1; + } + intercept_egid = gid; + TRACE(egid, "setgid", ("%s", intercept_egid == intercept_rgid ? "egid==rgid" : "egid!=rgid")); + } + else if (gid != intercept_rgid) + { + errno = EPERM; + return -1; + } + return 0; +} + +/* + * euid intercepts + */ + +static uid_t intercept_suid = 0; +static uid_t intercept_euid = -1; +static uid_t intercept_ruid = -1; + +uid_t geteuid(void) +{ + if (intercept_ruid == -1) + intercept_ruid = getuid(); + if (sh_isregress(REGRESS_euid)) + { + TRACE(euid, "geteuid", ("%s", intercept_euid == intercept_ruid ? "euid==ruid" : "euid!=ruid")); + return intercept_euid; + } + return intercept_ruid; +} + +int setuid(uid_t uid) +{ + if (intercept_ruid == -1) + intercept_ruid = getuid(); + if (sh_isregress(REGRESS_euid)) + { + if (uid != intercept_ruid && uid != intercept_suid) + { + TRACE(euid, "setuid", ("%s", "EPERM")); + errno = EPERM; + return -1; + } + intercept_euid = uid; + TRACE(euid, "setuid", ("%s", intercept_euid == intercept_ruid ? "euid==ruid" : "euid!=ruid")); + } + else if (uid != intercept_ruid) + { + errno = EPERM; + return -1; + } + return 0; +} + +/* + * p_suid intercept + */ + +static uid_t intercept_p_suid = 0x7fffffff; + +uid_t sh_regress_p_suid(unsigned int line, const char* file) +{ + REGRESS(p_suid, "SHOPT_P_SUID", ("%d", intercept_p_suid)); + return intercept_p_suid; +} + +/* + * p_suid intercept + */ + +static char* intercept_etc = 0; + +char* sh_regress_etc(const char* path, unsigned int line, const char* file) +{ + REGRESS(etc, "sh_open", ("%s => %s%s", path, intercept_etc, path+4)); + return intercept_etc; +} + +/* + * __regress__ builtin + */ + +int b___regress__(int argc, char** argv, void *extra) +{ + register Shell_t* shp = ((Shbltin_t*)extra)->shp; + int n; + + for (;;) + { + switch (n = optget(argv, usage)) + { + case '?': + errormsg(SH_DICT, ERROR_usage(2), "%s", opt_info.arg); + break; + case ':': + errormsg(SH_DICT, 2, "%s", opt_info.arg); + break; + case 0: + break; + default: + if (n < -100) + { + n = -(n + 100); + if (opt_info.arg || opt_info.number) + sh_onregress(n); + else + sh_offregress(n); + switch (n) + { + case REGRESS_egid: + if (sh_isregress(n)) + { + intercept_egid = intercept_sgid = (gid_t)opt_info.number; + TRACE(egid, argv[0], ("%d", intercept_egid)); + } + else + TRACE(egid, argv[0], ("%s", "off")); + break; + case REGRESS_euid: + if (sh_isregress(n)) + { + intercept_euid = intercept_suid = (uid_t)opt_info.number; + TRACE(euid, argv[0], ("%d", intercept_euid)); + } + else + TRACE(euid, argv[0], ("%s", "off")); + break; + case REGRESS_p_suid: + if (sh_isregress(n)) + { + intercept_p_suid = (uid_t)opt_info.number; + TRACE(p_suid, argv[0], ("%d", intercept_p_suid)); + } + else + TRACE(p_suid, argv[0], ("%s", "off")); + break; + case REGRESS_source: + TRACE(source, argv[0], ("%s", sh_isregress(n) ? "on" : "off")); + break; + case REGRESS_etc: + if (sh_isregress(n)) + { + intercept_etc = opt_info.arg; + TRACE(etc, argv[0], ("%s", intercept_etc)); + } + else + TRACE(etc, argv[0], ("%s", "off")); + break; + } + } + continue; + } + break; + } + if (error_info.errors || *(argv + opt_info.index)) + errormsg(SH_DICT, ERROR_usage(2), "%s", optusage(NiL)); + return 0; +} + +#else + +NoN(regress) + +#endif diff --git a/usr/src/lib/libshell/common/bltins/shiocmd_solaris.c b/usr/src/lib/libshell/common/bltins/shiocmd_solaris.c index 0f49eb982f..55e0e0357c 100644 --- a/usr/src/lib/libshell/common/bltins/shiocmd_solaris.c +++ b/usr/src/lib/libshell/common/bltins/shiocmd_solaris.c @@ -857,329 +857,6 @@ extern int b_stat(int argc, char *argv[], void *extra) return(0); } -static const char sh_optpoll[] = -"[-?\n@(#)$Id: poll (AT&T Labs Research) 2007-12-20 $\n]" -"[-author?Roland Mainz <roland.mainz@nrubsig.org]" -"[-license?http://www.opensource.org/licenses/cpl1.0.txt]" -"[+NAME? poll - input/output multiplexing]" -"[+DESCRIPTION?The poll command provides applications with a mechanism " - "for multiplexing input/output over a set of file descriptors. " - "For each member of the array variable \bvar\b, " - "poll examines the given file descriptor in the subscript \b.fd\b " - "for the event(s) specified in the subscript \b.events\b." - "The poll command identifies those file descriptors on which an " - "application can read or write data, or on which certain events have " - "occurred.]" -"[+?The \bvar\b argument specifies the file descriptors to be examined " - "and the events of interest for each file descriptor. " - "It is a array of structured variables with one member for each open " - "file descriptor of interest. The array's members contain the following " - "subscripts:]{" - "[+?\b.fd\b # file descriptor]" - "[+?\b.events\b # requested events]" - "[+?\b.revents\b # returned event]" - "}" -"[+?The \bfd\b variable specifies an open file descriptor and the " - "\bevents\b and \brevents\b members are strings constructed from " - "a concaternation of the following event flags, seperated by '|':]" - "{ " - "[+POLLIN?Data other than high priority data may be " - "read without blocking. For STREAMS, this " - "flag is set in revents even if the message " - "is of zero length.]" - "[+POLLRDNORM?Normal data (priority band equals 0) may be " - "read without blocking. For STREAMS, this " - "flag is set in revents even if the message " - "is of zero length.]" - "[+POLLRDBAND?Data from a non-zero priority band may be " - "read without blocking. For STREAMS, this " - "flag is set in revents even if the message " - "is of zero length.]" - "[+POLLPRI?High priority data may be received without " - "blocking. For STREAMS, this flag is set in " - "revents even if the message is of zero " - "length.]" - "[+POLLOUT?Normal data (priority band equals 0) may be " - "written without blocking.]" - "[+POLLWRNORM?The same as POLLOUT.]" - "[+POLLWRBAND?Priority data (priority band > 0) may be " - "written. This event only examines bands " - "that have been written to at least once.]" - "[+POLLERR?An error has occurred on the device or " - "stream. This flag is only valid in the " - "revents bitmask; it is not used in the " - "events member.]" - "[+POLLHUP?A hangup has occurred on the stream. This " - "event and POLLOUT are mutually exclusive; a " - "stream can never be writable if a hangup has " - "occurred. However, this event and POLLIN, " - ", POLLRDBAND, or POLLPRI are not " - "mutually exclusive. This flag is only valid " - "in the revents bitmask; it is not used in " - "the events member.]" - "[+POLLNVAL?The specified fd value does not belong to an " - "open file. This flag is only valid in the " - "revents member; it is not used in the events " - "member.]" - "}" -"]" - -"[+?If the value fd is less than 0, events is ignored and " - "revents is set to 0 in that entry on return from poll.]" - -"[+?The results of the poll query are stored in the revents " - "member in the \bvar\b structure. POLL*-strings are set in the \brevents\b " - "variable to indicate which of the requested events are true. " - "If none are true, the \brevents\b will be an empty string when " - "the poll command returns. The event flags " - "POLLHUP, POLLERR, and POLLNVAL are always set in \brevents\b " - "if the conditions they indicate are true; this occurs even " - "though these flags were not present in events.]" - -"[+?If none of the defined events have occurred on any selected " - "file descriptor, poll waits at least timeout milliseconds " - "for an event to occur on any of the selected file descriptors. " - "On a computer where millisecond timing accuracy is not " - "available, timeout is rounded up to the nearest legal value " - "available on that system. If the value timeout is 0, poll " - "returns immediately. If the value of timeout is -1, poll " - "blocks until a requested event occurs or until the call is " - "interrupted.]" - -"[+?The poll function supports regular files, terminal and " - "pseudo-terminal devices, STREAMS-based files, FIFOs and " - "pipes. The behavior of poll on elements of fds that refer " - "to other types of file is unspecified.]" - -"[+?The poll function supports sockets.]" - -"[+?A file descriptor for a socket that is listening for connections " - "will indicate that it is ready for reading, once connections " - "are available. A file descriptor for a socket that " - "is connecting asynchronously will indicate that it is ready " - "for writing, once a connection has been established.]" - -"[+?Regular files always poll TRUE for reading and writing.]" - -"[c:fdcount]:[fdcount?Upon successful completion, a non-negative value is " - "returned. A positive value indicates the total number of " - "file descriptors that has been selected (that is, file " - "descriptors for which the revents member is non-zero). A " - "value of 0 indicates that the call timed out and no file " - "descriptors have been selected. Upon failure, -1 is returned.]" -"[t:timeout]:[seconds?Timeout in seconds. If the value timeout is 0, " - "poll returns immediately. If the value of timeout is -1, poll " - "blocks until a requested event occurs or until the call is " - "interrupted.]" -"[T:mtimeout]:[milliseconds?Timeout in milliseconds. If the value timeout is 0, " - "poll returns immediately. If the value of timeout is -1, poll " - "blocks until a requested event occurs or until the call is " - "interrupted.]" -"\n" -"\nvar\n" -"\n" -"[+EXIT STATUS?]{" - "[+0?Success.]" - "[+>0?An error occurred.]" -"}" -"[+SEE ALSO?\bopen\b(1),\btmpfile\b(1),\bdup\b(1),\bclose\b(1),\bpoll\b(2)]" -; - -/* - * |mystpcpy| - like |strcpy()| but returns the end of the buffer - * - * Copy string s2 to s1. s1 must be large enough. - * return s1-1 (position of string terminator ('\0') in destnation buffer). - */ -static -char *mystpcpy(char *s1, const char *s2) -{ - while (*s1++ = *s2++) - ; - return (s1-1); -} - -static -Namval_t *nv_open_fmt(Dt_t *dict, int flags, const char *namefmt, ...) -{ - char varnamebuff[PATH_MAX]; - va_list ap; - - va_start(ap, namefmt); - vsnprintf(varnamebuff, sizeof(varnamebuff), namefmt, ap); - va_end(ap); - - return nv_open(varnamebuff, dict, flags); -} - -static -int poll_strtoevents(const char *str) -{ - int events = 0; - - if (strstr(str, "POLLIN")) events |= POLLIN; - if (strstr(str, "POLLRDNORM")) events |= POLLRDNORM; - if (strstr(str, "POLLRDBAND")) events |= POLLRDBAND; - if (strstr(str, "POLLPRI")) events |= POLLPRI; - if (strstr(str, "POLLOUT")) events |= POLLOUT; - if (strstr(str, "POLLWRNORM")) events |= POLLWRNORM; - if (strstr(str, "POLLWRBAND")) events |= POLLWRBAND; - if (strstr(str, "POLLERR")) events |= POLLERR; - if (strstr(str, "POLLHUP")) events |= POLLHUP; - if (strstr(str, "POLLNVAL")) events |= POLLNVAL; - - return events; -} - - -static -void poll_eventstostr(char *s, int events) -{ - *s='\0'; - if (!events) - return; - - if (events & POLLIN) s=mystpcpy(s, "POLLIN|"); - if (events & POLLRDNORM) s=mystpcpy(s, "POLLRDNORM|"); - if (events & POLLRDBAND) s=mystpcpy(s, "POLLRDBAND|"); - if (events & POLLPRI) s=mystpcpy(s, "POLLPRI|"); - if (events & POLLOUT) s=mystpcpy(s, "POLLOUT|"); - if (events & POLLWRNORM) s=mystpcpy(s, "POLLWRNORM|"); - if (events & POLLWRBAND) s=mystpcpy(s, "POLLWRBAND|"); - if (events & POLLERR) s=mystpcpy(s, "POLLERR|"); - if (events & POLLHUP) s=mystpcpy(s, "POLLHUP|"); - if (events & POLLNVAL) s=mystpcpy(s, "POLLNVAL|"); - - /* Remove trailling '|' */ - s--; - if(*s=='|') - *s='\0'; -} - -#undef getconf -#define getconf(x) strtol(astconf(x,NiL,NiL),NiL,0) - -extern int b_poll(int argc, char *argv[], void *extra) -{ - register Namval_t *np; - register int n; - Shell_t *shp = sh_contexttoshell(extra); - char *varname; - int fd; - unsigned int numpollfd = 0; - int i; - char *s; - double timeout = -1.; - char buff[256]; - char *pollfdcountvarname = NULL; - long open_max, - bpoll_max; - - if ((open_max = getconf("OPEN_MAX")) <= 0) - open_max = OPEN_MAX; - /* |bpoll_max| needs to be larger than |OPEN_MAX| to make sure we - * can listen to different sets of events per fd. - */ - bpoll_max = open_max*2L; - - while (n = optget(argv, sh_optpoll)) switch (n) - { - case 't': - case 'T': - errno = 0; - timeout = strtod(opt_info.arg, (char **)NULL); - if (errno != 0) - errormsg(SH_DICT, ERROR_system(1), "%s: invalid timeout", opt_info.arg); - - /* -t uses seconds, -T milliseconds */ - if (n == 't') - timeout *= 1000.; - break; - case 'c': - pollfdcountvarname = opt_info.arg; - break; - case ':': - errormsg(SH_DICT, 2, "%s", opt_info.arg); - break; - case '?': - errormsg(SH_DICT, ERROR_usage(2), "%s", opt_info.arg); - break; - } - argc -= opt_info.index; - argv += opt_info.index; - if(argc!=1) - errormsg(SH_DICT, ERROR_usage(2), optusage((char*)0)); - - varname = argv[0]; - -#ifdef __GNUC__ - /* - * Allocate one extra array entry to keep ctfconvert+gcc builds - * happy until CR #6379193 is fixed. - */ - struct pollfd pollfd[bpoll_max+1]; -#else - struct pollfd pollfd[bpoll_max]; -#endif - for(i=0 ; i < bpoll_max ; i++) - { - np = nv_open_fmt(shp->var_tree, NV_VARNAME|NV_NOFAIL|NV_NOADD, "%s[%d].fd", varname, i); - if (!np) - break; - fd = (int)nv_getnum(np); - if (fd < 0 || fd > OPEN_MAX) - errormsg(SH_DICT, ERROR_system(1), "invalid pollfd fd"); - nv_close(np); - pollfd[i].fd = fd; - - np = nv_open_fmt(shp->var_tree, NV_VARNAME|NV_NOFAIL|NV_NOADD, "%s[%d].events", varname, i); - if (!np) - errormsg(SH_DICT, ERROR_system(1), "missing pollfd events"); - - s = nv_getval(np); - if (!s) - errormsg(SH_DICT, ERROR_system(1), "missing pollfd events value"); - pollfd[i].events = poll_strtoevents(s); - nv_close(np); - - pollfd[i].revents = 0; - - numpollfd++; - } - - if (i == bpoll_max) - errormsg(SH_DICT, ERROR_system(1), "cannot handle more than %d entries.", bpoll_max); - - n = poll(pollfd, numpollfd, timeout); - /* FixMe: EGAIN and EINTR may require extra handling */ - if (n < 0) - errormsg(SH_DICT, ERROR_system(1), "failure"); - - if (pollfdcountvarname) - { - int32_t v = n; - - np = nv_open_fmt(shp->var_tree, NV_VARNAME|NV_NOFAIL, "%s", pollfdcountvarname); - if (!np) - errormsg(SH_DICT, ERROR_system(1), "couldn't create poll count variable %s", pollfdcountvarname); - nv_putval(np, (char *)&v, NV_INTEGER); - nv_close(np); - } - - for(i=0 ; i < numpollfd ; i++) - { - np = nv_open_fmt(shp->var_tree, NV_VARNAME|NV_NOFAIL, "%s[%d].revents", varname, i); - if (!np) - errormsg(SH_DICT, ERROR_system(1), "couldn't create pollfd %s[%d].revents", varname, i); - - poll_eventstostr(buff, pollfd[i].revents); - - nv_putval(np, buff, 0); - nv_close(np); - } - - return(0); -} static const char sh_optrewind[] = "[-?\n@(#)$Id: rewind (AT&T Labs Research) 2007-05-07 $\n]" diff --git a/usr/src/lib/libshell/common/bltins/sleep.c b/usr/src/lib/libshell/common/bltins/sleep.c index 48af7fe807..a0648632dd 100644 --- a/usr/src/lib/libshell/common/bltins/sleep.c +++ b/usr/src/lib/libshell/common/bltins/sleep.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -31,6 +31,7 @@ #undef sleep #include <error.h> #include <errno.h> +#include <tmx.h> #include "builtins.h" #include "FEATURE/time" #include "FEATURE/poll" @@ -44,14 +45,18 @@ int b_sleep(register int argc,char *argv[],void *extra) { register char *cp; - register double d; + register double d=0; register Shell_t *shp = ((Shbltin_t*)extra)->shp; + int sflag=0; time_t tloc = 0; char *last; if(!(shp->sigflag[SIGALRM]&(SH_SIGFAULT|SH_SIGOFF))) sh_sigtrap(SIGALRM); while((argc = optget(argv,sh_optsleep))) switch(argc) { + case 's': + sflag=1; + break; case ':': errormsg(SH_DICT,2, "%s", opt_info.arg); break; @@ -60,20 +65,47 @@ int b_sleep(register int argc,char *argv[],void *extra) break; } argv += opt_info.index; - if(error_info.errors || !(cp= *argv) || ((d=strtod(cp, (char**)&last)),*last)) - errormsg(SH_DICT,ERROR_usage(2),"%s",optusage((char*)0)); + if(cp = *argv) + { + d = strtod(cp, &last); + if(*last) + { + Time_t now,ns; + char* pp; + now = TMX_NOW; + if(*cp == 'P' || *cp == 'p') + ns = tmxdate(cp, &last, now); + else + { + if(pp = sfprints("exact %s", cp)) + ns = tmxdate(pp, &last, now); + if(*last && (pp = sfprints("p%s", cp))) + ns = tmxdate(pp, &last, now); + } + if(*last) + errormsg(SH_DICT,ERROR_exit(1),e_number,*argv); + d = ns - now; + d /= TMX_RESOLUTION; + } + if(argv[1]) + errormsg(SH_DICT,ERROR_exit(1),e_oneoperand); + } + else if(!sflag) + errormsg(SH_DICT,ERROR_exit(1),e_oneoperand); if(d > .10) { time(&tloc); tloc += (time_t)(d+.5); } - while(1) + if(sflag && d==0) + pause(); + else while(1) { time_t now; errno = 0; shp->lastsig=0; sh_delay(d); - if(tloc==0 || errno!=EINTR || shp->lastsig) + if(sflag || tloc==0 || errno!=EINTR || shp->lastsig) break; sh_sigcheck(); if(tloc < (now=time(NIL(time_t*)))) diff --git a/usr/src/lib/libshell/common/bltins/test.c b/usr/src/lib/libshell/common/bltins/test.c index 644f54eb1c..ec8095107d 100644 --- a/usr/src/lib/libshell/common/bltins/test.c +++ b/usr/src/lib/libshell/common/bltins/test.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -29,7 +29,6 @@ #include "defs.h" -#include <ctype.h> #include <error.h> #include <ls.h> #include "io.h" @@ -267,8 +266,11 @@ static int e3(struct test *tp) goto skip; if(c2_eq(arg,'-','t')) { - if(cp && isdigit(*cp)) - return(*(cp+1)?0:tty_check(*cp-'0')); + if(cp) + { + op = strtol(cp,&binop, 10); + return(*binop?0:tty_check(op)); + } else { /* test -t with no arguments */ @@ -300,7 +302,7 @@ skip: cp = nxtarg(tp,0); if(!op) errormsg(SH_DICT,ERROR_exit(2),e_badop,binop); - if(op==TEST_AND | op==TEST_OR) + if(op==TEST_AND || op==TEST_OR) tp->ap--; return(test_binop(op,arg,cp)); } @@ -415,9 +417,34 @@ int test_unop(register int op,register const char *arg) op = sh_lookopt(arg,&f); return(op && (f==(sh_isoption(op)!=0))); case 't': - if(isdigit(*arg) && arg[1]==0) - return(tty_check(*arg-'0')); - return(0); + { + char *last; + op = strtol(arg,&last, 10); + return(*last?0:tty_check(op)); + } + case 'v': + case 'R': + { + Namval_t *np; + Namarr_t *ap; + int isref; + if(!(np = nv_open(arg,sh.var_tree,NV_VARNAME|NV_NOFAIL|NV_NOADD|NV_NOREF))) + return(0); + isref = nv_isref(np); + if(op=='R') + return(isref); + if(isref) + { + if(np->nvalue.cp) + np = nv_refnode(np); + else + return(0); + + } + if(ap = nv_arrayptr(np)) + return(nv_arrayisset(np,ap)); + return(!nv_isnull(np) || nv_isattr(np,NV_INTEGER)); + } default: { static char a[3] = "-?"; diff --git a/usr/src/lib/libshell/common/bltins/trap.c b/usr/src/lib/libshell/common/bltins/trap.c index a298a35742..494d5d8431 100644 --- a/usr/src/lib/libshell/common/bltins/trap.c +++ b/usr/src/lib/libshell/common/bltins/trap.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -30,7 +30,6 @@ */ #include "defs.h" -#include <ctype.h> #include "jobs.h" #include "builtins.h" @@ -150,10 +149,11 @@ int b_trap(int argc,char *argv[],void *extra) { if(sig >= shp->st.trapmax) shp->st.trapmax = sig+1; - if(arg=shp->st.trapcom[sig]) - free(arg); - shp->st.trapcom[sig] = strdup(action); + arg = shp->st.trapcom[sig]; sh_sigtrap(sig); + shp->st.trapcom[sig] = (shp->sigflag[sig]&SH_SIGOFF) ? Empty : strdup(action); + if(arg && arg != Empty) + free(arg); } } } @@ -260,6 +260,12 @@ static int sig_number(const char *string) { sig = 1; o += 3; + if(isdigit(*stakptr(o))) + { + n = strtol(stakptr(o),&last,10); + if(!*last) + return(n); + } } tp = sh_locate(stakptr(o),(const Shtable_t*)shtab_signals,sizeof(*shtab_signals)); n = tp->sh_number; @@ -279,7 +285,7 @@ static int sig_number(const char *string) if(n < SH_TRAP) n--; } - if(n<0 && (name=stakptr(o)) && *name++=='R' && *name++=='T') + if(n<0 && sh.sigruntime[1] && (name=stakptr(o)) && *name++=='R' && *name++=='T') { if(name[0]=='M' && name[1]=='I' && name[2]=='N' && name[3]=='+') { @@ -348,7 +354,7 @@ static char* sig_name(int sig, char* buf, int pfx) static void sig_list(register Shell_t *shp,register int flag) { register const struct shtable2 *tp; - register int sig = shp->sigmax+1; + register int sig; register char *sname; char name[10]; const char *names[SH_TRAP]; @@ -357,16 +363,16 @@ static void sig_list(register Shell_t *shp,register int flag) if(flag<=0) { /* not all signals may be defined, so initialize */ - while(--sig >= 0) + for(sig=shp->sigmax; sig>=0; sig--) names[sig] = 0; for(sig=SH_DEBUGTRAP; sig>=0; sig--) traps[sig] = 0; } - while(*tp->sh_name) + for(; *tp->sh_name; tp++) { sig = tp->sh_number&((1<<SH_SIGBITS)-1); - if ((tp->sh_number>>SH_SIGBITS) & SH_SIGRUNTIME) - sig = sh.sigruntime[sig-1]+1; + if (((tp->sh_number>>SH_SIGBITS) & SH_SIGRUNTIME) && (sig = sh.sigruntime[sig-1]+1) == 1) + continue; if(sig==flag) { sfprintf(sfstdout,"%s\n",tp->sh_name); @@ -374,9 +380,8 @@ static void sig_list(register Shell_t *shp,register int flag) } else if(sig&SH_TRAP) traps[sig&~SH_TRAP] = (char*)tp->sh_name; - else if(sig < sizeof(names)/sizeof(char*)) + else if(sig-- && sig < elementsof(names)) names[sig] = (char*)tp->sh_name; - tp++; } if(flag > 0) sfputr(sfstdout, sig_name(flag-1,name,0), '\n'); @@ -391,7 +396,7 @@ static void sig_list(register Shell_t *shp,register int flag) { if(!(trap=trapcom[sig])) continue; - if(!(sname=(char*)names[sig+1])) + if(sig > shp->sigmax || !(sname=(char*)names[sig])) sname = sig_name(sig,name,1); sfprintf(sfstdout,trapfmt,sh_fmtq(trap),sname); } @@ -405,9 +410,9 @@ static void sig_list(register Shell_t *shp,register int flag) else { /* print all the signal names */ - for(sig=2; sig <= shp->sigmax; sig++) + for(sig=1; sig <= shp->sigmax; sig++) { - if(!(sname=(char*)names[sig+1])) + if(!(sname=(char*)names[sig])) sname = sig_name(sig,name,1); sfputr(sfstdout,sname,'\n'); } diff --git a/usr/src/lib/libshell/common/bltins/typeset.c b/usr/src/lib/libshell/common/bltins/typeset.c index 734651fd3a..6428248499 100644 --- a/usr/src/lib/libshell/common/bltins/typeset.c +++ b/usr/src/lib/libshell/common/bltins/typeset.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -248,7 +248,7 @@ int b_typeset(int argc,register char *argv[],void *extra) case 'F': case 'X': if(!opt_info.arg || (tdata.argnum = opt_info.num) <0) - tdata.argnum = 10; + tdata.argnum = (n=='X'?2*sizeof(Sfdouble_t):10); isfloat = 1; if(n=='E') { @@ -389,6 +389,8 @@ endargs: stkseek(stkp,offset); if(!tdata.tp) errormsg(SH_DICT,ERROR_exit(1),"%s: unknown type",tdata.prefix); + else if(nv_isnull(tdata.tp)) + nv_newtype(tdata.tp); tdata.tp->nvenv = tdata.help; flag &= ~NV_TYPE; } @@ -402,10 +404,15 @@ endargs: static void print_value(Sfio_t *iop, Namval_t *np, struct tdata *tp) { char *name; + int aflag=tp->aflag; if(nv_isnull(np)) - return; - sfputr(iop,nv_name(np),tp->aflag=='+'?'\n':'='); - if(tp->aflag=='+') + { + if(!np->nvflag) + return; + aflag = '+'; + } + sfputr(iop,nv_name(np),aflag=='+'?'\n':'='); + if(aflag=='+') return; if(nv_isarray(np) && nv_arrayptr(np)) { @@ -478,7 +485,7 @@ static int b_common(char **argv,register int flag,Dt_t *troot,struct tdata * print_namval(sfstdout,np,tp->aflag=='+',tp); continue; } - if(shp->subshell) + if(shp->subshell && !shp->subshare) sh_subfork(); if(tp->aflag=='-') nv_onattr(np,flag|NV_FUNCTION); @@ -539,12 +546,18 @@ static int b_common(char **argv,register int flag,Dt_t *troot,struct tdata * { if(comvar) { - _nv_unset(np,NV_RDONLY); - nv_onattr(np,NV_NOFREE); + Namarr_t *ap=nv_arrayptr(np); + if(ap) + ap->nelem |= ARRAY_TREE; + else + { + _nv_unset(np,NV_RDONLY); + nv_onattr(np,NV_NOFREE); + } } nv_setarray(np,nv_associative); } - else if(comvar && !nv_rename(np,flag|NV_COMVAR)) + else if(comvar && !nv_isvtree(np) && !nv_rename(np,flag|NV_COMVAR)) nv_setvtree(np); } if(flag&NV_MOVE) @@ -553,7 +566,7 @@ static int b_common(char **argv,register int flag,Dt_t *troot,struct tdata * nv_close(np); continue; } - if(tp->tp) + if(tp->tp && nv_type(np)!=tp->tp) { nv_settype(np,tp->tp,tp->aflag=='-'?0:NV_APPEND); flag = (np->nvflag&NV_NOCHANGE); @@ -562,9 +575,11 @@ static int b_common(char **argv,register int flag,Dt_t *troot,struct tdata * flag &= ~NV_ASSIGN; if(last=strchr(name,'=')) *last = 0; + if (shp->typeinit) + continue; if (tp->aflag == '-') { - if((flag&NV_EXPORT) && strchr(name,'.')) + if((flag&NV_EXPORT) && (strchr(name,'.') || nv_isvtree(np))) errormsg(SH_DICT,ERROR_exit(1),e_badexport,name); #if SHOPT_BSH if(flag&NV_EXPORT) @@ -769,6 +784,8 @@ int b_builtin(int argc,char *argv[],void *extra) memset(&tdata,0,sizeof(tdata)); tdata.sh = ((Shbltin_t*)extra)->shp; stkp = tdata.sh->stk; + if(!tdata.sh->pathlist) + path_absolute(argv[0],NIL(Pathcomp_t*)); while (n = optget(argv,sh_optbuiltin)) switch (n) { case 's': @@ -801,7 +818,7 @@ int b_builtin(int argc,char *argv[],void *extra) errormsg(SH_DICT,ERROR_exit(1),e_restricted,argv[-opt_info.index]); if(sh_isoption(SH_PFSH)) errormsg(SH_DICT,ERROR_exit(1),e_pfsh,argv[-opt_info.index]); - if(tdata.sh->subshell) + if(tdata.sh->subshell && !tdata.sh->subshare) sh_subfork(); } #if SHOPT_DYNAMIC @@ -922,7 +939,8 @@ static int b_unall(int argc, char **argv, register Dt_t *troot, Shell_t* shp) register const char *name; register int r; Dt_t *dp; - int nflag=0,all=0,isfun; + int nflag=0,all=0,isfun,jmpval; + struct checkpt buff; NOT_USED(argc); if(troot==shp->alias_tree) { @@ -963,13 +981,28 @@ static int b_unall(int argc, char **argv, register Dt_t *troot, Shell_t* shp) else nflag = NV_NOSCOPE; if(all) + { dtclear(troot); - else while(name = *argv++) + return(r); + } + sh_pushcontext(&buff,1); + while(name = *argv++) { - if(np=nv_open(name,troot,NV_NOADD|NV_NOFAIL|nflag)) + jmpval = sigsetjmp(buff.buff,0); + np = 0; + if(jmpval==0) + np=nv_open(name,troot,NV_NOADD|nflag); + else + { + r = 1; + continue; + } + if(np) { - if(is_abuiltin(np)) + if(is_abuiltin(np) || nv_isattr(np,NV_RDONLY)) { + if(nv_isattr(np,NV_RDONLY)) + errormsg(SH_DICT,ERROR_warn(0),e_readonly, nv_name(np)); r = 1; continue; } @@ -985,16 +1018,16 @@ static int b_unall(int argc, char **argv, register Dt_t *troot, Shell_t* shp) if(shp->subshell) np=sh_assignok(np,0); } - nv_unset(np); + if(!nv_isnull(np)) + nv_unset(np); nv_close(np); if(troot==shp->var_tree && shp->st.real_fun && (dp=shp->var_tree->walk) && dp==shp->st.real_fun->sdict) nv_delete(np,dp,NV_NOFREE); else if(isfun) nv_delete(np,troot,NV_NOFREE); } - else - r = 1; } + sh_popcontext(&buff); return(r); } diff --git a/usr/src/lib/libshell/common/bltins/ulimit.c b/usr/src/lib/libshell/common/bltins/ulimit.c index 53fd29def5..7c8e9378d3 100644 --- a/usr/src/lib/libshell/common/bltins/ulimit.c +++ b/usr/src/lib/libshell/common/bltins/ulimit.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -29,7 +29,7 @@ #include <ast.h> #include <sfio.h> #include <error.h> -#include <shell.h> +#include "defs.h" #include "builtins.h" #include "name.h" #include "ulimit.h" @@ -132,7 +132,7 @@ int b_ulimit(int argc,char *argv[],void *extra) unit = shtab_units[tp->type]; if(limit) { - if(shp->subshell) + if(shp->subshell && !shp->subshare) sh_subfork(); if(strcmp(limit,e_unlimited)==0) i = INFINITY; diff --git a/usr/src/lib/libshell/common/bltins/umask.c b/usr/src/lib/libshell/common/bltins/umask.c index fc5a684016..d8bc67647a 100644 --- a/usr/src/lib/libshell/common/bltins/umask.c +++ b/usr/src/lib/libshell/common/bltins/umask.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/bltins/whence.c b/usr/src/lib/libshell/common/bltins/whence.c index 39366f0e68..4714c78b10 100644 --- a/usr/src/lib/libshell/common/bltins/whence.c +++ b/usr/src/lib/libshell/common/bltins/whence.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/data/aliases.c b/usr/src/lib/libshell/common/data/aliases.c index 8a76dc7e82..5b7298b299 100644 --- a/usr/src/lib/libshell/common/data/aliases.c +++ b/usr/src/lib/libshell/common/data/aliases.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -36,6 +36,7 @@ const struct shtable2 shtab_aliases[] = #endif /* SHOPT_FS_3D */ "autoload", NV_NOFREE, "typeset -fu", "command", NV_NOFREE, "command ", + "compound", NV_NOFREE, "typeset -C", "fc", NV_NOFREE, "hist", "float", NV_NOFREE, "typeset -lE", "functions", NV_NOFREE, "typeset -f", diff --git a/usr/src/lib/libshell/common/data/bash_pre_rc.sh b/usr/src/lib/libshell/common/data/bash_pre_rc.sh index e8f51f428b..56767363dc 100644 --- a/usr/src/lib/libshell/common/data/bash_pre_rc.sh +++ b/usr/src/lib/libshell/common/data/bash_pre_rc.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libshell/common/data/builtins.c b/usr/src/lib/libshell/common/data/builtins.c index dad24caf31..94b34c77dd 100644 --- a/usr/src/lib/libshell/common/data/builtins.c +++ b/usr/src/lib/libshell/common/data/builtins.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -139,6 +139,9 @@ const struct shtable3 shtab_builtins[] = CMDLIST(wc) CMDLIST(sync) #endif +#if SHOPT_REGRESS + "__regress__", NV_BLTIN|BLT_ENV, bltin(__regress__), +#endif "", 0, 0 }; @@ -677,6 +680,7 @@ USAGE_LICENSE "\aflags\a with optional \anumber\a values may be specified to control " "option parsing. " "The flags are:]{" + "[++?Arguments beginning with + are considered options.]" "[+c?Cache this \aoptstring\a for multiple passes. Used to optimize " "builtins that may be called many times within the same process.]" "[+i?Ignore this \aoptstring\a when generating help. Used when " @@ -737,9 +741,7 @@ USAGE_LICENSE "[+8.?A group of the form [-\aname\a?\atext\a]] specifies entries " "for the \bIMPLEMENTATION\b section.]" "}" -"[+?If the leading character of \aoptstring\a is +, then arguments " - "beginning with + will also be considered options.]" -"[+?A leading : character or a : following a leading + in \aoptstring\a " +"[+?A leading : character in \aoptstring\a " "affects the way errors are handled. If an option character or longname " "argument not specified in \aoptstring\a is encountered when processing " "options, the shell variable whose name is \aname\a will be set to the ? " @@ -750,6 +752,8 @@ USAGE_LICENSE "Without the leading :, \aname\a will be set to the ? character, \bOPTARG\b " "will be unset, and an error message will be written to standard error " "when errors are encountered.]" +"[+?A leading + character or a + following a leading : in \aoptstring\a " + "specifies that arguments beginning with + will also be considered options.]" "[+?The end of options occurs when:]{" "[+1.?The special argument \b--\b is encountered.]" "[+2.?An argument that does not begin with a \b-\b is encountered.]" @@ -1060,7 +1064,7 @@ USAGE_LICENSE ; const char sh_optprint[] = -"[-1c?\n@(#)$Id: print (AT&T Research) 1999-04-07 $\n]" +"[-1c?\n@(#)$Id: print (AT&T Research) 2008-11-26 $\n]" USAGE_LICENSE "[+NAME?print - write arguments to standard output]" "[+DESCRIPTION?By default, \bprint\b writes each \astring\a operand to " @@ -1102,6 +1106,8 @@ USAGE_LICENSE "[u]:[fd:=1?Write to file descriptor number \afd\a instead of standard output.]" "[v?Treat each \astring\a as a variable name and write the value in \b%B\b " "format. Cannot be used with \b-f\b.]" +"[C?Treat each \astring\a as a variable name and write the value in \b%#B\b " + "format. Cannot be used with \b-f\b.]" "\n" "\n[string ...]\n" "\n" @@ -1113,7 +1119,7 @@ USAGE_LICENSE ; const char sh_optprintf[] = -"[-1c?\n@(#)$Id: printf (AT&T Research) 2006-10-26 $\n]" +"[-1c?\n@(#)$Id: printf (AT&T Research) 2009-02-02 $\n]" USAGE_LICENSE "[+NAME?printf - write formatted output]" "[+DESCRIPTION?\bprintf\b writes each \astring\a operand to " @@ -1161,7 +1167,7 @@ USAGE_LICENSE "in the underlying code set of the character following the " "\b\"\b or \b'\b. Otherwise, \astring\a is treated like a shell " "arithmetic expression and evaluated.]" -"[+?If a \astring\a operand cannot be completed converted into a value " +"[+?If a \astring\a operand cannot be completely converted into a value " "appropriate for that format specifier, an error will occur, " "but remaining \astring\a operands will continue to be processed.]" "[+?In addition to the format specifier extensions, the following " @@ -1174,8 +1180,10 @@ USAGE_LICENSE "[+-?The escape sequence \b\\x{\b\ahex\a\b}\b expands to the " "character corresponding to the hexidecimal value \ahex\a.]" "[+-?The format modifier flag \b=\b can be used to center a field to " - "a specified width. When the output is a terminal, the " - "character width is used rather than the number of bytes.]" + "a specified width.]" + "[+-?The format modifier flag \bL\b can be used with the \bc\b and " + "\bs\b formats to treat precision as character width instead " + "of byte count.]" "[+-?Each of the integral format specifiers can have a third " "modifier after width and precision that specifies the " "base of the conversion from 2 to 64. In this case the " @@ -1388,10 +1396,16 @@ USAGE_LICENSE "in \afile\a that can be used a separate shell script browser. The " "-R option requires a script to be specified as the first operand.]" #endif /* SHOPT_KIA */ +#if SHOPT_REGRESS +"[I:regress]:[intercept?Enable the regression test \aintercept\a. Must be " + "the first command line option(s).]" +#endif #if SHOPT_BASH "\fbash2\f" #endif "\fabc\f" +"?" +"[T?Enable implementation specific test code defined by mask.]#[mask]" "\n" "\n[arg ...]\n" "\n" @@ -1475,23 +1489,37 @@ USAGE_LICENSE ; const char sh_optsleep[] = -"[-1c?\n@(#)$Id: sleep (AT&T Research) 1999-04-07 $\n]" +"[-1c?\n@(#)$Id: sleep (AT&T Research) 2009-03-12 $\n]" USAGE_LICENSE "[+NAME?sleep - suspend execution for an interval]" "[+DESCRIPTION?\bsleep\b suspends execution for at least the time specified " - "by \aseconds\a or until a \bSIGALRM\b signal is received. " - "\aseconds\a can be specified as a floating point number but the " - "actual granularity depends on the underlying system, normally " - "around 1 millisecond.]" + "by \aduration\a or until a \bSIGALRM\b signal is received. " + "\aduration\a may be one of the following:]" +"{" + "[+integer?The number of seconds to sleep.]" + "[+floating point?The number of seconds to sleep. The actual " + "granularity depends on the underlying system, normally " + "around 1 millisecond.]" + "[+P\an\a\bY\b\an\a\bM\b\an\a\bDT\b\an\a\bH\b\an\a\bM\b\an\a\bS?An ISO 8601 duration " + "where at least one of the duration parts must be specified.]" + "[+P\an\a\bW?An ISO 8601 duration specifying \an\a weeks.]" + "[+p\an\a\bY\b\an\a\bM\b\an\a\bDT\b\an\a\bH\b\an\a\bm\b\an\a\bS?A case insensitive " + "ISO 8601 duration except that \bM\b specifies months, \bm\b before \bs\b or \bS\b " + "specifies minutes and after specifies milliseconds, \bu\b or \bU\b specifies " + "microseconds, and \bn\b specifies nanoseconds.]" + "[+date/time?Sleep until the \bdate\b(1) compatible date/time.]" +"}" +"[s?Sleep until a signal or a timeout is received. If \aduration\a is omitted " + "or 0 then no timeout will be used.]" "\n" -"\nseconds\n" +"\n[ duration ]\n" "\n" "[+EXIT STATUS?]{" - "[+0?The execution was successfully suspended for at least \atime\a " - "seconds, or a \bSIGALRM\b signal was received.]" + "[+0?The execution was successfully suspended for at least \aduration\a " + "or a \bSIGALRM\b signal was received.]" "[+>0?An error occurred.]" "}" -"[+SEE ALSO?\btime\b(1), \bwait\b(1)]" +"[+SEE ALSO?\bdate\b(1), \btime\b(1), \bwait\b(1)]" ; const char sh_opttrap[] = @@ -1566,9 +1594,10 @@ USAGE_LICENSE "options \b-i\b, \b-E\b, and \b-F\b cannot be specified with " "the justification options \b-L\b, \b-R\b, and \b-Z\b.]" "[+?Note that the following preset aliases are set by the shell:]{" - "[+float?\b\f?\f -E\b.]" + "[+compound?\b\f?\f -C\b.]" + "[+float?\b\f?\f -lE\b.]" "[+functions?\b\f?\f -f\b.]" - "[+integer?\b\f?\f -i\b.]" + "[+integer?\b\f?\f -li\b.]" "[+nameref?\b\f?\f -n\b.]" "}" "[+?If no \aname\as are specified then variables that have the specified " @@ -1640,8 +1669,8 @@ USAGE_LICENSE "[R]#?[n?Right justify. If \an\a is given it represents the field width. If " "the \b-Z\b attribute is also specified, then zeros will " "be used as the fill character. Otherwise, spaces are used.]" -"[X]#?[n:=10?Floating point number represented in hexadecimal notation. " - "\an\a specifies the number of significant figures when the " +"[X]#?[n:=2*sizeof(long long)?Floating point number represented in hexadecimal " + "notation. \an\a specifies the number of significant figures when the " "value is expanded.]" #ifdef SHOPT_TYPEDEF diff --git a/usr/src/lib/libshell/common/data/keywords.c b/usr/src/lib/libshell/common/data/keywords.c index 95e4bee1f6..ccacdb95ee 100644 --- a/usr/src/lib/libshell/common/data/keywords.c +++ b/usr/src/lib/libshell/common/data/keywords.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/data/lexstates.c b/usr/src/lib/libshell/common/data/lexstates.c index 438d58f568..3decd14dbc 100644 --- a/usr/src/lib/libshell/common/data/lexstates.c +++ b/usr/src/lib/libshell/common/data/lexstates.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -399,6 +399,7 @@ const char e_lexobsolete3[] = "line %d: '=' obsolete, use '=='"; const char e_lexobsolete4[] = "line %d: %s within [[...]] obsolete, use ((...))"; const char e_lexobsolete5[] = "line %d: set %s obsolete"; const char e_lexobsolete6[] = "line %d: `{' instead of `in' is obsolete"; +const char e_lexnonstandard[] = "line %d: `&>file' is nonstandard -- interpreted as `>file 2>&1' for profile input only"; const char e_lexusebrace[] = "line %d: use braces to avoid ambiguities with $id[...]"; const char e_lexusequote[] = "line %d: %c within ${} should be quoted"; const char e_lexescape[] = "line %d: escape %c to avoid ambiguities"; diff --git a/usr/src/lib/libshell/common/data/limits.c b/usr/src/lib/libshell/common/data/limits.c index 4c743f7050..ae13d21df5 100644 --- a/usr/src/lib/libshell/common/data/limits.c +++ b/usr/src/lib/libshell/common/data/limits.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/data/math.tab b/usr/src/lib/libshell/common/data/math.tab index 281389f105..412154c23a 100644 --- a/usr/src/lib/libshell/common/data/math.tab +++ b/usr/src/lib/libshell/common/data/math.tab @@ -1,6 +1,6 @@ # <return type: i:integer f:floating-point> <#floating-point-args> <function-name> [<alias> ...] # <function-name>l variants are handled by features/math.sh -# @(#)math.tab (AT&T Research) 2008-05-22 +# @(#)math.tab (AT&T Research) 2009-08-18 f 1 acos f 1 acosh f 1 asin @@ -33,16 +33,21 @@ i 1 isfinite i 2 isgreater i 2 isgreaterequal i 1 isinf +i 1 isinfinite i 2 isless i 2 islessequal i 2 islessgreater i 1 isnan i 1 isnormal -i 1 issubnormal +i 1 issubnormal fpclassify=FP_SUBNORMAL i 2 isunordered -i 1 iszero +i 1 iszero fpclassify=FP_ZERO +f 1 j0 +f 1 j1 +f 2 jn f 1 lgamma f 1 log +f 1 log10 f 1 log1p f 1 log2 f 1 logb @@ -63,3 +68,6 @@ f 1 tan f 1 tanh f 1 tgamma f 1 trunc +f 1 y0 +f 1 y1 +f 2 yn diff --git a/usr/src/lib/libshell/common/data/msg.c b/usr/src/lib/libshell/common/data/msg.c index 3a06ed3f8d..022aa5390d 100644 --- a/usr/src/lib/libshell/common/data/msg.c +++ b/usr/src/lib/libshell/common/data/msg.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -50,6 +50,7 @@ const char e_histopen[] = "history file cannot open"; const char e_option[] = "%s: bad option(s)"; const char e_toomany[] = "open file limit exceeded"; const char e_argtype[] = "invalid argument of type %c"; +const char e_oneoperand[] = "one operand expected"; const char e_formspec[] = "%c: unknown format specifier"; const char e_badregexp[] = "%s: invalid regular expression"; const char e_number[] = "%s: bad number"; @@ -85,6 +86,7 @@ const char e_access[] = "permission denied"; #endif /* _cmd_universe */ const char e_direct[] = "bad directory"; const char e_file[] = "%s: bad file unit number"; +const char e_redirect[] = "redirection failed"; const char e_trap[] = "%s: bad trap"; const char e_readonly[] = "%s: is read only"; const char e_badfield[] = "%d: negative field size"; @@ -93,12 +95,14 @@ const char e_badname[] = "%s: invalid name"; const char e_varname[] = "%s: invalid variable name"; const char e_badfun[] = "%s: invalid function name"; const char e_aliname[] = "%s: invalid alias name"; -const char e_badexport[] = "%s: invalid export name"; +const char e_badexport[] = "%s: only simple variables can be exported"; const char e_badref[] = "%s: reference variable cannot be an array"; +const char e_badsubscript[] = "%c: invalid subscript in assignment"; const char e_noarray[] = "%s: cannot be an array"; const char e_badappend[] = "%s: invalid append to associative array"; const char e_noref[] = "%s: no reference name"; const char e_selfref[] = "%s: invalid self reference"; +const char e_globalref[] = "%s: global reference cannot refer to local variable"; const char e_noalias[] = "%s: alias not found\n"; const char e_format[] = "%s: bad format"; const char e_redef[] = "%s: type cannot be redefined"; diff --git a/usr/src/lib/libshell/common/data/options.c b/usr/src/lib/libshell/common/data/options.c index cd49f6555c..b2894b90e7 100644 --- a/usr/src/lib/libshell/common/data/options.c +++ b/usr/src/lib/libshell/common/data/options.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -127,6 +127,8 @@ const Shtable_t shtab_attributes[] = {"-xexport", NV_EXPORT}, {"-rreadonly", NV_RDONLY}, {"-ttagged", NV_TAGGED}, + {"-Aassociative array", NV_ARRAY}, + {"-aindexed array", NV_ARRAY}, {"-llong", (NV_DOUBLE|NV_LONG)}, {"-Eexponential",(NV_DOUBLE|NV_EXPNOTE)}, {"-Xhexfloat", (NV_DOUBLE|NV_HEXFLOAT)}, @@ -142,8 +144,6 @@ const Shtable_t shtab_attributes[] = {"-Lleftjust", NV_LJUST}, {"-Rrightjust", NV_RJUST}, {"-uuppercase", NV_LTOU}, - {"-Aassociative array", NV_ARRAY}, - {"-aindexed array", NV_ARRAY}, {"++namespace", NV_TABLE}, {"", 0} }; diff --git a/usr/src/lib/libshell/common/data/signals.c b/usr/src/lib/libshell/common/data/signals.c index 7c3df373f9..371ffa2eac 100644 --- a/usr/src/lib/libshell/common/data/signals.c +++ b/usr/src/lib/libshell/common/data/signals.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -34,180 +34,205 @@ #define S(s) ERROR_dictionary(s) /* - * This is a table that gives numbers and default settings to each signal - * The signal numbers go in the low bits and the attributes go in the high bits + * This is a table that gives numbers and default settings to each signal. + * The signal numbers go in the low bits and the attributes go in the high bits. + * The names must be ASCII sorted lo-hi. */ const struct shtable2 shtab_signals[] = { #ifdef SIGABRT - "ABRT", VAL(SIGABRT,SH_SIGDONE), S("Abort"), + "ABRT", VAL(SIGABRT,SH_SIGDONE), S("Abort"), #endif /*SIGABRT */ #ifdef SIGAIO - "AIO", VAL(SIGAIO,SH_SIGIGNORE), S("Asynchronous I/O"), + "AIO", VAL(SIGAIO,SH_SIGIGNORE), S("Asynchronous I/O"), #endif /*SIGAIO */ #ifdef SIGALRM - "ALRM", VAL(SIGALRM,SH_SIGDONE), S("Alarm call"), + "ALRM", VAL(SIGALRM,SH_SIGDONE), S("Alarm call"), +#endif /* SIGALRM */ +#ifdef SIGALRM1 + "ALRM1", VAL(SIGALRM1,SH_SIGDONE), S("Scheduling - reserved"), #endif /* SIGALRM */ #ifdef SIGAPOLLO - "APOLLO", VAL(SIGAPOLLO,0), "SIGAPOLLO"), + "APOLLO", VAL(SIGAPOLLO,0), S("SIGAPOLLO"), #endif /* SIGAPOLLO */ #ifdef SIGBUS - "BUS", VAL(SIGBUS,SH_SIGDONE), S("Bus error"), + "BUS", VAL(SIGBUS,SH_SIGDONE), S("Bus error"), #endif /* SIGBUS */ #ifdef SIGCANCEL - "CANCEL", VAL(SIGCANCEL,SH_SIGIGNORE), S("Thread cancellation"), + "CANCEL", VAL(SIGCANCEL,SH_SIGIGNORE), S("Thread cancellation"), #endif /*SIGCANCEL */ #ifdef SIGCHLD - "CHLD", VAL(SIGCHLD,SH_SIGFAULT), S("Death of Child"), + "CHLD", VAL(SIGCHLD,SH_SIGFAULT), S("Death of Child"), # ifdef SIGCLD # if SIGCLD!=SIGCHLD - "CLD", VAL(SIGCLD,SH_SIGFAULT), S("Death of Child"), + "CLD", VAL(SIGCLD,SH_SIGFAULT), S("Death of Child"), # endif # endif /* SIGCLD */ #else # ifdef SIGCLD - "CLD", VAL(SIGCLD,SH_SIGFAULT), S("Death of Child"), + "CLD", VAL(SIGCLD,SH_SIGFAULT), S("Death of Child"), # endif /* SIGCLD */ #endif /* SIGCHLD */ #ifdef SIGCONT - "CONT", VAL(SIGCONT,SH_SIGIGNORE), S("Stopped process continued"), + "CONT", VAL(SIGCONT,SH_SIGIGNORE), S("Stopped process continued"), #endif /* SIGCONT */ - "DEBUG", VAL(TRAP(SH_DEBUGTRAP),0), "", +#ifdef SIGCPUFAIL + "CPUFAIL", VAL(SIGCPUFAIL,0), S("Predictive processor deconfiguration"), +#endif /* SIGRETRACT */ + "DEBUG", VAL(TRAP(SH_DEBUGTRAP),0), "", #ifdef SIGDANGER - "DANGER", VAL(SIGDANGER,0), S("System crash soon"), + "DANGER", VAL(SIGDANGER,0), S("System crash soon"), #endif /* SIGDANGER */ #ifdef SIGDIL - "DIL", VAL(SIGDIL,0), S("DIL signal"), + "DIL", VAL(SIGDIL,0), S("DIL signal"), #endif /* SIGDIL */ #ifdef SIGEMT - "EMT", VAL(SIGEMT,SH_SIGDONE), S("EMT trap"), + "EMT", VAL(SIGEMT,SH_SIGDONE), S("EMT trap"), #endif /* SIGEMT */ - "ERR", VAL(TRAP(SH_ERRTRAP),0), "", + "ERR", VAL(TRAP(SH_ERRTRAP),0), "", #ifdef SIGERR - "ERR", VAL(SIGERR,0), "", + "ERR", VAL(SIGERR,0), "", #endif /* SIGERR */ - "EXIT", VAL(0,0), "", - "FPE", VAL(SIGFPE,SH_SIGDONE), S("Floating exception"), + "EXIT", VAL(0,0), "", + "FPE", VAL(SIGFPE,SH_SIGDONE), S("Floating exception"), #ifdef SIGFREEZE - "FREEZE", VAL(SIGFREEZE,SH_SIGIGNORE), S("Special signal used by CPR"), + "FREEZE", VAL(SIGFREEZE,SH_SIGIGNORE), S("Special signal used by CPR"), #endif /* SIGFREEZE */ - "HUP", VAL(SIGHUP,SH_SIGDONE), S("Hangup"), - "ILL", VAL(SIGILL,SH_SIGDONE), S("Illegal instruction"), +#ifdef SIGGRANT + "GRANT", VAL(SIGGRANT,0), S("Grant monitor mode"), +#endif /* SIGGRANT */ + "HUP", VAL(SIGHUP,SH_SIGDONE), S("Hangup"), + "ILL", VAL(SIGILL,SH_SIGDONE), S("Illegal instruction"), #ifdef JOBS - "INT", VAL(SIGINT,SH_SIGINTERACTIVE), S("Interrupt"), + "INT", VAL(SIGINT,SH_SIGINTERACTIVE), S("Interrupt"), #else - "INT", VAL(SIGINT,SH_SIGINTERACTIVE), "", + "INT", VAL(SIGINT,SH_SIGINTERACTIVE), "", #endif /* JOBS */ #ifdef SIGIO - "IO", VAL(SIGIO,SH_SIGIGNORE), S("IO signal"), + "IO", VAL(SIGIO,SH_SIGDONE), S("IO signal"), #endif /* SIGIO */ #ifdef SIGIOT - "IOT", VAL(SIGIOT,SH_SIGDONE), S("Abort"), + "IOT", VAL(SIGIOT,SH_SIGDONE), S("Abort"), #endif /* SIGIOT */ #ifdef SIGJVM1 - "JVM1", VAL(SIGJVM1,SH_SIGIGNORE), S("Special signal used by Java Virtual Machine"), + "JVM1", VAL(SIGJVM1,SH_SIGIGNORE), S("Special signal used by Java Virtual Machine"), #endif /*SIGJVM1 */ #ifdef SIGJVM2 - "JVM2", VAL(SIGJVM2,SH_SIGIGNORE), S("Special signal used by Java Virtual Machine"), + "JVM2", VAL(SIGJVM2,SH_SIGIGNORE), S("Special signal used by Java Virtual Machine"), #endif /*SIGJVM2 */ - "KEYBD", VAL(TRAP(SH_KEYTRAP),0), "", + "KEYBD", VAL(TRAP(SH_KEYTRAP),0), "", #ifdef SIGKILL - "KILL", VAL(SIGKILL,0), S("Killed"), + "KILL", VAL(SIGKILL,0), S("Killed"), #endif /* SIGKILL */ #ifdef SIGLAB - "LAB", VAL(SIGLAB,0), S("Security label changed"), + "LAB", VAL(SIGLAB,0), S("Security label changed"), #endif /* SIGLAB */ #ifdef SIGLOST - "LOST", VAL(SIGLOST,SH_SIGDONE), S("Resources lost"), + "LOST", VAL(SIGLOST,SH_SIGDONE), S("Resources lost"), #endif /* SIGLOST */ #ifdef SIGLWP - "LWP", VAL(SIGLWP,SH_SIGIGNORE), S("Special signal used by thread library"), + "LWP", VAL(SIGLWP,SH_SIGIGNORE), S("Special signal used by thread library"), #endif /* SIGLWP */ +#ifdef SIGMIGRATE + "MIGRATE", VAL(SIGMIGRATE,0), S("Migrate process"), +#endif /* SIGMIGRATE */ +#ifdef SIGMSG + "MSG", VAL(SIGMSG,0), S("Ring buffer input data"), +#endif /* SIGMSG */ #ifdef SIGPHONE - "PHONE", VAL(SIGPHONE,0), S("Phone interrupt"), + "PHONE", VAL(SIGPHONE,0), S("Phone interrupt"), #endif /* SIGPHONE */ #ifdef SIGPIPE #ifdef JOBS - "PIPE", VAL(SIGPIPE,SH_SIGDONE), S("Broken Pipe"), + "PIPE", VAL(SIGPIPE,SH_SIGDONE), S("Broken Pipe"), #else - "PIPE", VAL(SIGPIPE,SH_SIGDONE), "", + "PIPE", VAL(SIGPIPE,SH_SIGDONE), "", #endif /* JOBS */ #endif /* SIGPIPE */ #ifdef SIGPOLL - "POLL", VAL(SIGPOLL,SH_SIGDONE), S("Polling alarm"), + "POLL", VAL(SIGPOLL,SH_SIGDONE), S("Polling alarm"), #endif /* SIGPOLL */ #ifdef SIGPROF - "PROF", VAL(SIGPROF,SH_SIGDONE), S("Profiling time alarm"), + "PROF", VAL(SIGPROF,SH_SIGDONE), S("Profiling time alarm"), #endif /* SIGPROF */ +#ifdef SIGPRE + "PRE", VAL(SIGPRE,SH_SIGDONE), S("Programming exception"), +#endif /* SIGPRE */ #ifdef SIGPWR # if SIGPWR>0 - "PWR", VAL(SIGPWR,SH_SIGIGNORE), S("Power fail"), + "PWR", VAL(SIGPWR,SH_SIGIGNORE), S("Power fail"), # endif #endif /* SIGPWR */ #ifdef SIGQUIT "QUIT", VAL(SIGQUIT,SH_SIGDONE|SH_SIGINTERACTIVE), S("Quit"), #endif /* SIGQUIT */ +#ifdef SIGRETRACT + "RETRACT", VAL(SIGRETRACT,0), S("Relinquish monitor mode"), +#endif /* SIGRETRACT */ #ifdef SIGRTMIN - "RTMIN", VAL(SH_SIGRTMIN,SH_SIGRUNTIME), S("Lowest priority realtime signal"), + "RTMIN", VAL(SH_SIGRTMIN,SH_SIGRUNTIME), S("Lowest priority realtime signal"), #endif /* SIGRTMIN */ #ifdef SIGRTMAX - "RTMAX", VAL(SH_SIGRTMAX,SH_SIGRUNTIME), S("Highest priority realtime signal"), + "RTMAX", VAL(SH_SIGRTMAX,SH_SIGRUNTIME), S("Highest priority realtime signal"), #endif /* SIGRTMAX */ - "SEGV", VAL(SIGSEGV,0), S("Memory fault"), +#ifdef SIGSAK + "SAK", VAL(SIGSAK,0), S("Secure attention key"), +#endif /* SIGSAK */ + "SEGV", VAL(SIGSEGV,0), S("Memory fault"), +#ifdef SIGSOUND + "SOUND", VAL(SIGSOUND,0), S("Sound completed"), +#endif /* SIGSOUND */ #ifdef SIGSTOP - "STOP", VAL(SIGSTOP,0), S("Stopped (SIGSTOP)"), + "STOP", VAL(SIGSTOP,0), S("Stopped (SIGSTOP)"), #endif /* SIGSTOP */ #ifdef SIGSYS - "SYS", VAL(SIGSYS,SH_SIGDONE), S("Bad system call"), + "SYS", VAL(SIGSYS,SH_SIGDONE), S("Bad system call"), #endif /* SIGSYS */ "TERM", VAL(SIGTERM,SH_SIGDONE|SH_SIGINTERACTIVE), S("Terminated"), +#ifdef SIGTHAW + "THAW", VAL(SIGTHAW,SH_SIGIGNORE), S("Special signal used by CPR"), +#endif /* SIGTHAW */ #ifdef SIGTINT # ifdef JOBS - "TINT", VAL(SIGTINT,0), S("Interrupt"), + "TINT", VAL(SIGTINT,0), S("Interrupt"), # else - "TINT", VAL(SIGTINT,0), "". + "TINT", VAL(SIGTINT,0), "", # endif /* JOBS */ #endif /* SIGTINT */ #ifdef SIGTRAP - "TRAP", VAL(SIGTRAP,SH_SIGDONE), S("Trace/BPT trap"), + "TRAP", VAL(SIGTRAP,SH_SIGDONE), S("Trace/BPT trap"), #endif /* SIGTRAP */ #ifdef SIGTSTP - "TSTP", VAL(SIGTSTP,0), S("Stopped"), + "TSTP", VAL(SIGTSTP,0), S("Stopped"), #endif /* SIGTSTP */ #ifdef SIGTTIN - "TTIN", VAL(SIGTTIN,0), S("Stopped (SIGTTIN)"), + "TTIN", VAL(SIGTTIN,0), S("Stopped (SIGTTIN)"), #endif /* SIGTTIN */ #ifdef SIGTTOU - "TTOU", VAL(SIGTTOU,0), S("Stopped(SIGTTOU)"), + "TTOU", VAL(SIGTTOU,0), S("Stopped(SIGTTOU)"), #endif /* SIGTTOU */ #ifdef SIGURG - "URG", VAL(SIGURG,SH_SIGIGNORE), S("Socket interrupt"), + "URG", VAL(SIGURG,SH_SIGIGNORE), S("Socket interrupt"), #endif /* SIGURG */ #ifdef SIGUSR1 - "USR1", VAL(SIGUSR1,SH_SIGDONE), S("User signal 1"), + "USR1", VAL(SIGUSR1,SH_SIGDONE), S("User signal 1"), #endif /* SIGUSR1 */ #ifdef SIGUSR2 - "USR2", VAL(SIGUSR2,SH_SIGDONE), S("User signal 2"), + "USR2", VAL(SIGUSR2,SH_SIGDONE), S("User signal 2"), #endif /* SIGUSR2 */ +#ifdef SIGVIRT + "VIRT", VAL(SIGVIRT,0), S("Virtual timer alarm"), +#endif /* SIGVIRT */ #ifdef SIGVTALRM - "VTALRM", VAL(SIGVTALRM,SH_SIGDONE), S("Virtual time alarm"), + "VTALRM", VAL(SIGVTALRM,SH_SIGDONE), S("Virtual time alarm"), #endif /* SIGVTALRM */ -#ifdef SIGWINCH - "WINCH", VAL(SIGWINCH,SH_SIGIGNORE), S("Window size change"), -#endif /* SIGWINCH */ -#ifdef SIGMIGRATE - "MIGRATE", VAL(SIGMIGRATE,0), S("Migrate process"), -#endif /* SIGMIGRATE */ -#ifdef SIGSOUND - "SOUND", VAL(SIGSOUND,0), S("Sound completed"), -#endif /* SIGSOUND */ -#ifdef SIGTHAW - "THAW", VAL(SIGTHAW,SH_SIGIGNORE), S("Special signal used by CPR"), -#endif /* SIGTHAW */ #ifdef SIGWAITING - "WAITING", VAL(SIGWAITING,SH_SIGIGNORE), S("All threads blocked"), + "WAITING", VAL(SIGWAITING,SH_SIGIGNORE), S("All threads blocked"), #endif /* SIGWAITING */ +#ifdef SIGWINCH + "WINCH", VAL(SIGWINCH,SH_SIGIGNORE), S("Window size change"), +#endif /* SIGWINCH */ #ifdef SIGXCPU "XCPU", VAL(SIGXCPU,SH_SIGDONE|SH_SIGINTERACTIVE), S("Exceeded CPU time limit"), #endif /* SIGXCPU */ diff --git a/usr/src/lib/libshell/common/data/solaris_cmdlist.h b/usr/src/lib/libshell/common/data/solaris_cmdlist.h index 29c75aaa7d..4cb7672636 100644 --- a/usr/src/lib/libshell/common/data/solaris_cmdlist.h +++ b/usr/src/lib/libshell/common/data/solaris_cmdlist.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -70,6 +70,7 @@ extern "C" { /* undo ast_map.h #defines to avoid collision */ #undef basename #undef dirname +#undef mktemp /* Generated data, do not edit. */ XPG4CMDLIST(basename) @@ -82,36 +83,52 @@ ASTCMDLIST(chmod) XPG4CMDLIST(chown) BINCMDLIST(chown) ASTCMDLIST(chown) +BINCMDLIST(cksum) +ASTCMDLIST(cksum) +BINCMDLIST(cmp) ASTCMDLIST(cmp) +BINCMDLIST(comm) ASTCMDLIST(comm) XPG4CMDLIST(cp) ASTCMDLIST(cp) +BINCMDLIST(cut) ASTCMDLIST(cut) XPG4CMDLIST(date) ASTCMDLIST(date) ASTCMDLIST(dirname) +ASTCMDLIST(egrep) XPG4CMDLIST(expr) ASTCMDLIST(expr) ASTCMDLIST(fds) +ASTCMDLIST(fgrep) ASTCMDLIST(fmt) +BINCMDLIST(fold) ASTCMDLIST(fold) +ASTCMDLIST(grep) BINCMDLIST(head) ASTCMDLIST(head) XPG4CMDLIST(id) ASTCMDLIST(id) +BINCMDLIST(join) ASTCMDLIST(join) XPG4CMDLIST(ln) ASTCMDLIST(ln) BINCMDLIST(logname) ASTCMDLIST(logname) +ASTCMDLIST(md5sum) BINCMDLIST(mkdir) ASTCMDLIST(mkdir) BINCMDLIST(mkfifo) ASTCMDLIST(mkfifo) +BINCMDLIST(mktemp) +ASTCMDLIST(mktemp) XPG4CMDLIST(mv) ASTCMDLIST(mv) +BINCMDLIST(paste) ASTCMDLIST(paste) +BINCMDLIST(pathchk) ASTCMDLIST(pathchk) +ASTCMDLIST(readlink) BINCMDLIST(rev) ASTCMDLIST(rev) XPG4CMDLIST(rm) @@ -127,6 +144,7 @@ SBINCMDLIST(sync) BINCMDLIST(sync) ASTCMDLIST(sync) XPG4CMDLIST(tail) +BINCMDLIST(tail) ASTCMDLIST(tail) BINCMDLIST(tee) ASTCMDLIST(tee) @@ -137,6 +155,7 @@ BINCMDLIST(uniq) ASTCMDLIST(uniq) BINCMDLIST(wc) ASTCMDLIST(wc) +ASTCMDLIST(xgrep) /* Mandatory for ksh93 test suite and AST scripts */ BINCMDLIST(getconf) diff --git a/usr/src/lib/libshell/common/data/strdata.c b/usr/src/lib/libshell/common/data/strdata.c index f980c834f3..4642c2826b 100644 --- a/usr/src/lib/libshell/common/data/strdata.c +++ b/usr/src/lib/libshell/common/data/strdata.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/data/testops.c b/usr/src/lib/libshell/common/data/testops.c index e00e4857c9..230ec4cbf8 100644 --- a/usr/src/lib/libshell/common/data/testops.c +++ b/usr/src/lib/libshell/common/data/testops.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -104,6 +104,7 @@ USAGE_LICENSE "open and is associated with a terminal device.]" "[+-u \afile\a?True if \afile\a exists and has its set-user-id bit " "set.]" + "[+-v \avarname\a?True if \avarname\a is a valid variable name that is set.]" "[+-w \afile\a?True if \afile\a exists and is writable.]" "[+-x \afile\a?True if \afile\a exists and is executable. For a " "directory it means that it can be searched.]" @@ -115,7 +116,12 @@ USAGE_LICENSE "it was last read.]" "[+-O \afile\a?True if \afile\a exists and owner is the effective " "user id of the current process.]" + "[+-R \avarname\a?True if \avarname\a is a name reference.]" "[+-S \afile\a?True if \afile\a exists and is a socket.]" +#if SHOPT_FS_3D + "[+-V \afile\a?True if \afile\a exists and is a version " + "directory.]" +#endif /* SHOPT_FS_3D */ "}" "[+?Binary expressions can be one of the following:]{" "[+\astring1\a = \astring2\a?True if \astring1\a is equal to " @@ -156,7 +162,7 @@ USAGE_LICENSE "[+SEE ALSO?\blet\b(1), \bexpr\b(1)]" ; -const char test_opchars[] = "HLNSVOGCaeohrwxdcbfugk" +const char test_opchars[] = "HLNRSVOGCaeohrwxdcbfugkv" #if SHOPT_TEST_L "l" #endif diff --git a/usr/src/lib/libshell/common/data/variables.c b/usr/src/lib/libshell/common/data/variables.c index 65b1985d29..bb8d7441fe 100644 --- a/usr/src/lib/libshell/common/data/variables.c +++ b/usr/src/lib/libshell/common/data/variables.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -47,7 +47,7 @@ const struct shtable2 shtab_variables[] = "EDITOR", 0, (char*)0, "MAILCHECK", NV_NOFREE|NV_INTEGER, (char*)0, "RANDOM", NV_NOFREE|NV_INTEGER, (char*)0, - "ENV", NV_NOFREE, "$HOME/.kshrc", + "ENV", NV_NOFREE, (char*)0, "HISTFILE", 0, (char*)0, "HISTSIZE", 0, (char*)0, "HISTEDIT", NV_NOFREE, (char*)0, @@ -77,6 +77,7 @@ const struct shtable2 shtab_variables[] = "LC_NUMERIC", 0, (char*)0, "FIGNORE", 0, (char*)0, "KSH_VERSION", 0, (char*)0, + "JOBMAX", NV_NOFREE|NV_INTEGER, (char*)0, ".sh", NV_TABLE|NV_RDONLY|NV_NOFREE|NV_NOPRINT,(char*)0, ".sh.edchar", 0, (char*)0, ".sh.edcol", 0, (char*)0, @@ -108,7 +109,7 @@ const struct shtable2 shtab_variables[] = "", 0, (char*)0 }; -const char *nv_discnames[] = { "get", "set", "append", "unset", 0 }; +const char *nv_discnames[] = { "get", "set", "append", "unset", "getn", 0 }; #ifdef SHOPT_STATS const Shtable_t shtab_stats[] = diff --git a/usr/src/lib/libshell/common/edit/completion.c b/usr/src/lib/libshell/common/edit/completion.c index 54b4212470..f90f7af9c6 100644 --- a/usr/src/lib/libshell/common/edit/completion.c +++ b/usr/src/lib/libshell/common/edit/completion.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -24,7 +24,6 @@ */ #include "defs.h" -#include <ctype.h> #include <ast_wchar.h> #include "lexstates.h" #include "path.h" @@ -32,6 +31,31 @@ #include "edit.h" #include "history.h" +#if !SHOPT_MULTIBYTE +#define mbchar(p) (*(unsigned char*)p++) +#endif + +static char *fmtx(const char *string) +{ + register const char *cp = string; + register int n,c; + unsigned char *state = (unsigned char*)sh_lexstates[2]; + int offset; + while((c=mbchar(cp)),(c>UCHAR_MAX)||(n=state[c])==0); + if(n==S_EOF) + return((char*)string); + offset = staktell(); + stakwrite(string,--cp-string); + while(c=mbchar(cp)) + { + if(state[c]) + stakputc('\\'); + stakputc(c); + } + stakputc(0); + return(stakptr(offset)); +} + static int charcmp(int a, int b, int nocase) { if(nocase) @@ -337,7 +361,7 @@ int ed_expand(Edit_t *ep, char outbuff[],int *cur,int *eol,int mode, int count) { char **savcom = com; while (*com) - size += strlen(cp=sh_fmtq(*com++)); + size += strlen(cp=fmtx(*com++)); com = savcom; } } @@ -364,7 +388,7 @@ int ed_expand(Edit_t *ep, char outbuff[],int *cur,int *eol,int mode, int count) var = 0; } else - out = strcopy(begin,sh_fmtq(*com)); + out = strcopy(begin,fmtx(*com)); com++; } else @@ -394,7 +418,7 @@ int ed_expand(Edit_t *ep, char outbuff[],int *cur,int *eol,int mode, int count) out = strcopy(begin,cp); } /* add quotes if necessary */ - if((cp=sh_fmtq(begin))!=begin) + if((cp=fmtx(begin))!=begin) out = strcopy(begin,cp); if(var=='$' && begin[-1]=='{') *out = '}'; @@ -402,11 +426,11 @@ int ed_expand(Edit_t *ep, char outbuff[],int *cur,int *eol,int mode, int count) *out = ' '; *++out = 0; } - else if(out[-1]=='/' && (cp=sh_fmtq(begin))!=begin) + else if((cp=fmtx(begin))!=begin) { out = strcopy(begin,cp); if(out[-1] =='"' || out[-1]=='\'') - *--out = 0;; + *--out = 0; } if(*begin==0) ed_ringbell(); @@ -416,7 +440,7 @@ int ed_expand(Edit_t *ep, char outbuff[],int *cur,int *eol,int mode, int count) while (*com) { *out++ = ' '; - out = strcopy(out,sh_fmtq(*com++)); + out = strcopy(out,fmtx(*com++)); } } if(ep->e_nlist) diff --git a/usr/src/lib/libshell/common/edit/edit.c b/usr/src/lib/libshell/common/edit/edit.c index fbee33ca57..7fe6a99c47 100644 --- a/usr/src/lib/libshell/common/edit/edit.c +++ b/usr/src/lib/libshell/common/edit/edit.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -30,7 +30,6 @@ #include <ast.h> #include <errno.h> #include <ccode.h> -#include <ctype.h> #include "FEATURE/options" #include "FEATURE/time" #include "FEATURE/cmds" @@ -43,6 +42,7 @@ # include "defs.h" # include "variables.h" #else +# include <ctype.h> extern char ed_errbuf[]; char e_version[] = "\n@(#)$Id: Editlib version 1993-12-28 r $\0\n"; #endif /* KSHELL */ @@ -818,7 +818,7 @@ int ed_read(void *context, int fd, char *buff, int size, int reedit) { if(shp->trapnote&(SH_SIGSET|SH_SIGTRAP)) goto done; - if(ep->sh->winch) + if(ep->sh->winch && sh_isstate(SH_INTERACTIVE) && (sh_isoption(SH_VI) || sh_isoption(SH_EMACS))) { Edpos_t lastpos; int n, rows, newsize; @@ -857,9 +857,12 @@ int ed_read(void *context, int fd, char *buff, int size, int reedit) buff[2] = 'a'; return(3); } - buff[0] = cntl('L'); + if(sh_isoption(SH_EMACS) || sh_isoption(SH_VI)) + buff[0] = cntl('L'); return(1); } + else + ep->sh->winch = 0; /* an interrupt that should be ignored */ errno = 0; if(!waitevent || (rv=(*waitevent)(fd,-1L,0))>=0) diff --git a/usr/src/lib/libshell/common/edit/emacs.c b/usr/src/lib/libshell/common/edit/emacs.c index 02842994ab..8faf4c7856 100644 --- a/usr/src/lib/libshell/common/edit/emacs.c +++ b/usr/src/lib/libshell/common/edit/emacs.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -62,10 +62,11 @@ One line screen editor for any program */ #include <ast.h> -#include <ctype.h> #include "FEATURE/cmds" #if KSHELL # include "defs.h" +#else +# include <ctype.h> #endif /* KSHELL */ #include "io.h" @@ -207,7 +208,9 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit) ed_setup(ep->ed,fd,reedit); out = (genchar*)buff; #if SHOPT_MULTIBYTE - out = (genchar*)roundof((char*)out-(char*)0,sizeof(genchar)); + out = (genchar*)roundof(buff-(char*)0,sizeof(genchar)); + if(reedit) + ed_internal(buff,out); #endif /* SHOPT_MULTIBYTE */ if(!kstack) { @@ -907,13 +910,11 @@ static int escape(register Emacs_t* ep,register genchar *out,int count) char buf[MAXLINE]; char *ptr; ptr = hist_word(buf,MAXLINE,(count?count:-1)); -#if !KSHELL if(ptr==0) { beep(); break; } -#endif /* KSHELL */ if ((eol - cur) >= sizeof(name)) { beep(); @@ -1072,6 +1073,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count) beep(); return(-1); } + return(-1); } diff --git a/usr/src/lib/libshell/common/edit/hexpand.c b/usr/src/lib/libshell/common/edit/hexpand.c index 49444ca464..497f8170d5 100644 --- a/usr/src/lib/libshell/common/edit/hexpand.c +++ b/usr/src/lib/libshell/common/edit/hexpand.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -41,8 +41,6 @@ NoN(hexpand) #else -#include <ctype.h> - static char *modifiers = "htrepqxs&"; static int mod_flags[] = { 0, 0, 0, 0, HIST_PRINT, HIST_QUOTE, HIST_QUOTE|HIST_QUOTE_BR, 0, 0 }; diff --git a/usr/src/lib/libshell/common/edit/history.c b/usr/src/lib/libshell/common/edit/history.c index da875d70c4..b0a3c8db27 100644 --- a/usr/src/lib/libshell/common/edit/history.c +++ b/usr/src/lib/libshell/common/edit/history.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -74,7 +74,6 @@ #include <sfio.h> #include "FEATURE/time" #include <error.h> -#include <ctype.h> #include <ls.h> #if KSHELL # include "defs.h" @@ -82,6 +81,8 @@ # include "path.h" # include "builtins.h" # include "io.h" +#else +# include <ctype.h> #endif /* KSHELL */ #include "history.h" @@ -1071,14 +1072,7 @@ char *hist_word(char *string,int size,int word) register int flag = 0; History_t *hp = hist_ptr; if(!hp) -#if KSHELL - { - strncpy(string,((Shell_t*)hp->histshell)->lastarg,size); - return(string); - } -#else return(NIL(char*)); -#endif /* KSHELL */ hist_copy(string,size,(int)hp->histind-1,-1); for(;c = *cp;cp++) { diff --git a/usr/src/lib/libshell/common/edit/vi.c b/usr/src/lib/libshell/common/edit/vi.c index 391999b5e9..b374aa4b0d 100644 --- a/usr/src/lib/libshell/common/edit/vi.c +++ b/usr/src/lib/libshell/common/edit/vi.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -34,8 +34,8 @@ #else # include <ast.h> # include "FEATURE/options" +# include <ctype.h> #endif /* KSHELL */ -#include <ctype.h> #include "io.h" #include "history.h" @@ -581,7 +581,11 @@ int ed_viread(void *context, int fd, register char *shbuf, int nchar, int reedit vp->U_saved = 0; if(reedit) + { + cur_phys = vp->first_wind; + vp->ofirst_wind = INVALID; refresh(vp,INPUT); + } if(viraw) getline(vp,APPEND); else if(last_virt>=0 && virtual[last_virt]==term_char) @@ -1566,9 +1570,10 @@ static int mvcursor(register Vi_t* vp,register int motion) if(cur_virt>=0 && cur_virt<(SEARCHSIZE-2) && cur_virt == last_virt) { virtual[last_virt + 1] = '\0'; - gencpy(&((genchar*)lsearch)[1], virtual); #if SHOPT_MULTIBYTE - ed_external(&((genchar*)lsearch)[1],lsearch+1); + ed_external(virtual,lsearch+1); +#else + strcpy(lsearch+1,virtual); #endif /* SHOPT_MULTIBYTE */ *lsearch = '^'; vp->direction = -2; @@ -2381,13 +2386,11 @@ addin: if(vp->repeat_set==0) vp->repeat = -1; p = (genchar*)hist_word((char*)tmpbuf,MAXLINE,vp->repeat); -#if !KSHELL if(p==0) { ed_ringbell(); break; } -#endif /* KSHELL */ #if SHOPT_MULTIBYTE ed_internal((char*)p,tmpbuf); p = tmpbuf; diff --git a/usr/src/lib/libshell/common/features/math.sh b/usr/src/lib/libshell/common/features/math.sh index 4db6d7b3e3..5d7a498921 100644 --- a/usr/src/lib/libshell/common/features/math.sh +++ b/usr/src/lib/libshell/common/features/math.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -20,10 +20,10 @@ : generate the ksh math builtin table : include math.tab -# @(#)math.sh (AT&T Research) 2008-08-29 +# @(#)math.sh (AT&T Research) 2009-08-18 command=$0 -iffeflags="-n -v -F ast_standards.h" +iffeflags="-n -v" iffehdrs="math.h ieeefp.h" iffelibs="-lm" table=/dev/null @@ -39,6 +39,13 @@ tests= eval `iffe $iffeflags -c "$cc" - typ long.double 2>&$stderr` +: check ast_standards.h + +eval `iffe $iffeflags -F ast_standards.h -c "$cc" - tst use_ast_standards -lm 'note{' 'math.h needs ast_standards.h' '}end' 'link{' '#include <math.h>' '#ifndef isgreater' '#define isgreater(a,b) 0' '#endif' 'int main() { return isgreater(0.0,1.0); }' '}end'` +case $_use_ast_standards in +1) iffeflags="$iffeflags -F ast_standards.h" ;; +esac + : read the table exec < $table @@ -80,13 +87,14 @@ cat <<! typedef Sfdouble_t (*Math_f)(Sfdouble_t,...); ! -echo "#include <ast_standards.h>" +case $_use_ast_standards in +1) echo "#include <ast_standards.h>" ;; +esac echo "#include <math.h>" case $_hdr_ieeefp in -1) echo "#include <ieeefp.h>" - echo - ;; +1) echo "#include <ieeefp.h>" ;; esac +echo : generate the intercept functions and table entries @@ -105,7 +113,23 @@ do eval x='$'_lib_${name}l y='$'_lib_${name} r='$'TYPE_${name} a='$'ARGS_${name} t=double local=$_typ_long_double ;; - *) continue + *) case $aka in + *=*) f=${aka%%=*} + v=${aka#*=} + eval x='$'_lib_${f}l y='$'_lib_${f} + case $x:$y in + 1:*) f=${f}l + ;; + *:1) ;; + *) continue + ;; + esac + L=local_$name r=int R=1 + echo "#ifdef $v${nl}static $r $L(Sfdouble_t x) { return $f(x) == $v; }${nl}#endif" + tab="$tab$nl#ifdef $v$nl$ht\"\\0${R}${a}${name}\",$ht(Math_f)${L},${nl}#endif" + ;; + esac + continue ;; esac eval n='$'_npt_$f m='$'_mac_$f d='$'_dat_$f diff --git a/usr/src/lib/libshell/common/include/argnod.h b/usr/src/lib/libshell/common/include/argnod.h index 7d59fb41f1..524cc49d61 100644 --- a/usr/src/lib/libshell/common/include/argnod.h +++ b/usr/src/lib/libshell/common/include/argnod.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -61,6 +61,8 @@ struct slnod /* struct for link list of stacks */ struct slnod *slnext; struct slnod *slchild; Stak_t *slptr; + /* slpad aligns struct functnod = struct slnod + 1 on some architectures */ + struct slnod *slpad; }; /* diff --git a/usr/src/lib/libshell/common/include/builtins.h b/usr/src/lib/libshell/common/include/builtins.h index 9fc32de97d..900bc35937 100644 --- a/usr/src/lib/libshell/common/include/builtins.h +++ b/usr/src/lib/libshell/common/include/builtins.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -124,6 +124,7 @@ extern const char e_badbase[]; extern const char e_overlimit[]; extern const char e_eneedsarg[]; +extern const char e_oneoperand[]; extern const char e_toodeep[]; extern const char e_badname[]; extern const char e_badsyntax[]; diff --git a/usr/src/lib/libshell/common/include/defs.h b/usr/src/lib/libshell/common/include/defs.h index f5e03fd98e..57c39b6dec 100644 --- a/usr/src/lib/libshell/common/include/defs.h +++ b/usr/src/lib/libshell/common/include/defs.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -37,6 +37,7 @@ #include "fault.h" #include "argnod.h" #include "name.h" +#include <ctype.h> #define _SH_PRIVATE #include <shcmd.h> #undef _SH_PRIVATE @@ -149,6 +150,7 @@ struct limits pid_t bckpid; /* background process id */ \ pid_t cpid; \ pid_t spid; /* subshell process id */ \ + pid_t pipepid; \ int32_t ppid; /* parent process id of shell */ \ int topfd; \ int sigmax; /* maximum number of signals */ \ @@ -167,6 +169,7 @@ struct limits char indebug; /* set when in debug trap */ \ unsigned char lastsig; /* last signal received */ \ char subshare; /* set when in ${..} comsub */ \ + char toomany; /* set when out of fd's */ \ char *readscript; /* set before reading a script */ \ int *inpipe; /* input pipe pointer */ \ int *outpipe; /* output pipe pointer */ \ @@ -226,10 +229,12 @@ struct limits Shopt_t glob_options; \ Namval_t *typeinit; \ int *stats; \ - Namfun_t nvfun; + Namfun_t nvfun; \ + struct Regress_s*regress; #include <shell.h> +#include "regress.h" /* error exits from various parts of shell */ #define NIL(type) ((type)0) @@ -248,8 +253,7 @@ struct limits /* states */ /* low numbered states are same as options */ -#define SH_NOFORK 0 /* set when fork not necessary, not a state */ -#define SH_COMPLETE 0 /* set for command completion */ +#define SH_NOFORK 0 /* set when fork not necessary */ #define SH_FORKED 7 /* set when process has been forked */ #define SH_PROFILE 8 /* set when processing profiles */ #define SH_NOALIAS 9 /* do not expand non-exported aliases */ @@ -262,6 +266,7 @@ struct limits #define SH_TTYWAIT 16 /* waiting for keyboard input */ #define SH_FCOMPLETE 17 /* set for filename completion */ #define SH_PREINIT 18 /* set with SH_INIT before parsing options */ +#define SH_COMPLETE 19 /* set for command completion */ #define SH_BASH 41 #define SH_BRACEEXPAND 42 @@ -335,6 +340,7 @@ struct limits #define MATCH_MAX 64 #define SH_READEVAL 0x4000 /* for sh_eval */ +#define SH_FUNEVAL 0x10000 /* for sh_eval for function load */ extern Shell_t *nv_shell(Namval_t*); extern int sh_addlib(void*); @@ -343,6 +349,7 @@ extern char **sh_argbuild(Shell_t*,int*,const struct comnod*,int); extern struct dolnod *sh_argfree(Shell_t *, struct dolnod*,int); extern struct dolnod *sh_argnew(Shell_t*,char*[],struct dolnod**); extern void *sh_argopen(Shell_t*); +extern struct argnod *sh_argprocsub(Shell_t*,struct argnod*); extern void sh_argreset(Shell_t*,struct dolnod*,struct dolnod*); extern Namval_t *sh_assignok(Namval_t*,int); extern struct dolnod *sh_arguse(Shell_t*); diff --git a/usr/src/lib/libshell/common/include/edit.h b/usr/src/lib/libshell/common/include/edit.h index c477130ed1..3e8fe73f8d 100644 --- a/usr/src/lib/libshell/common/include/edit.h +++ b/usr/src/lib/libshell/common/include/edit.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/include/env.h b/usr/src/lib/libshell/common/include/env.h index 93db7f5c27..c8b30a2c68 100644 --- a/usr/src/lib/libshell/common/include/env.h +++ b/usr/src/lib/libshell/common/include/env.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/include/fault.h b/usr/src/lib/libshell/common/include/fault.h index e754ea56eb..97a4280b0d 100644 --- a/usr/src/lib/libshell/common/include/fault.h +++ b/usr/src/lib/libshell/common/include/fault.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/include/fcin.h b/usr/src/lib/libshell/common/include/fcin.h index b498efa7f2..310cc6693c 100644 --- a/usr/src/lib/libshell/common/include/fcin.h +++ b/usr/src/lib/libshell/common/include/fcin.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/include/history.h b/usr/src/lib/libshell/common/include/history.h index 53e2b24964..40351707f9 100644 --- a/usr/src/lib/libshell/common/include/history.h +++ b/usr/src/lib/libshell/common/include/history.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/include/io.h b/usr/src/lib/libshell/common/include/io.h index 4f3d280262..bd2a8bdb87 100644 --- a/usr/src/lib/libshell/common/include/io.h +++ b/usr/src/lib/libshell/common/include/io.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -92,6 +92,7 @@ extern const char e_create[]; extern const char e_tmpcreate[]; extern const char e_exists[]; extern const char e_file[]; +extern const char e_redirect[]; extern const char e_formspec[]; extern const char e_badregexp[]; extern const char e_open[]; diff --git a/usr/src/lib/libshell/common/include/jobs.h b/usr/src/lib/libshell/common/include/jobs.h index 068f0a1abe..513667e1ab 100644 --- a/usr/src/lib/libshell/common/include/jobs.h +++ b/usr/src/lib/libshell/common/include/jobs.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -84,6 +84,9 @@ struct jobs unsigned int in_critical; /* >0 => in critical region */ int savesig; /* active signal */ int numpost; /* number of posted jobs */ +#ifdef SHOPT_BGX + int numbjob; /* number of background jobs */ +#endif /* SHOPT_BGX */ short fd; /* tty descriptor number */ #ifdef JOBS int suspend; /* suspend character */ @@ -116,9 +119,17 @@ extern struct jobs job; #define vmbusy() 0 #endif - #define job_lock() (job.in_critical++) -#define job_unlock() do{if(!--job.in_critical&&job.savesig&&!vmbusy())job_reap(job.savesig);}while(0) +#define job_unlock() \ + do { \ + int sig; \ + if (!--job.in_critical && (sig = job.savesig)) \ + { \ + if (!job.in_critical++ && !vmbusy()) \ + job_reap(sig); \ + job.in_critical--; \ + } \ + } while(0) extern const char e_jobusage[]; extern const char e_done[]; @@ -153,6 +164,9 @@ extern int job_wait(pid_t); extern int job_post(pid_t,pid_t); extern void *job_subsave(void); extern void job_subrestore(void*); +#ifdef SHOPT_BGX +extern void job_chldtrap(Shell_t*, const char*,int); +#endif /* SHOPT_BGX */ #ifdef JOBS extern void job_init(Shell_t*,int); extern int job_close(Shell_t*); diff --git a/usr/src/lib/libshell/common/include/lexstates.h b/usr/src/lib/libshell/common/include/lexstates.h index 77f351c88d..e3f75446e4 100644 --- a/usr/src/lib/libshell/common/include/lexstates.h +++ b/usr/src/lib/libshell/common/include/lexstates.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -138,6 +138,7 @@ extern const char e_lexobsolete3[]; extern const char e_lexobsolete4[]; extern const char e_lexobsolete5[]; extern const char e_lexobsolete6[]; +extern const char e_lexnonstandard[]; extern const char e_lexusebrace[]; extern const char e_lexusequote[]; extern const char e_lexescape[]; diff --git a/usr/src/lib/libshell/common/include/name.h b/usr/src/lib/libshell/common/include/name.h index 60821ee706..80d970055c 100644 --- a/usr/src/lib/libshell/common/include/name.h +++ b/usr/src/lib/libshell/common/include/name.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -107,7 +107,7 @@ struct Ufunction /* attributes of Namval_t items */ /* The following attributes are for internal use */ -#define NV_NOCHANGE (NV_EXPORT|NV_IMPORT|NV_RDONLY|NV_TAGGED|NV_NOFREE) +#define NV_NOCHANGE (NV_EXPORT|NV_IMPORT|NV_RDONLY|NV_TAGGED|NV_NOFREE|NV_ARRAY) #define NV_ATTRIBUTES (~(NV_NOSCOPE|NV_ARRAY|NV_NOARRAY|NV_IDENT|NV_ASSIGN|NV_REF|NV_VARNAME|NV_STATIC)) #define NV_PARAM NV_NODISC /* expansion use positional params */ @@ -115,6 +115,7 @@ struct Ufunction #define NV_TYPE 0x1000000 #define NV_STATIC 0x2000000 #define NV_COMVAR 0x4000000 +#define NV_UNJUST 0x8000000 /* clear justify attributes */ #define NV_FUNCTION (NV_RJUST|NV_FUNCT) /* value is shell function */ #define NV_FPOSIX NV_LJUST /* posix function semantics */ #define NV_FTMP NV_ZFILL /* function source in tmpfile */ @@ -166,12 +167,13 @@ 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_arrayisset(Namval_t*, Namarr_t*); extern int nv_arraysettype(Namval_t*, Namval_t*,const char*,int); extern int nv_aimax(Namval_t*); extern int nv_atypeindex(Namval_t*, const char*); extern int nv_setnotify(Namval_t*,char **); extern int nv_unsetnotify(Namval_t*,char **); -extern void nv_setlist(struct argnod*, int); +extern void nv_setlist(struct argnod*, int, Namval_t*); extern struct argnod* nv_onlist(struct argnod*, const char*); extern void nv_optimize(Namval_t*); extern void nv_outname(Sfio_t*,char*, int); @@ -197,6 +199,7 @@ extern int nv_compare(Dt_t*, Void_t*, Void_t*, Dtdisc_t*); extern void nv_outnode(Namval_t*,Sfio_t*, int, int); extern int nv_subsaved(Namval_t*); extern void nv_typename(Namval_t*, Sfio_t*); +extern void nv_newtype(Namval_t*); extern const Namdisc_t RESTRICTED_disc; extern const Namdisc_t ENUM_disc; @@ -219,6 +222,7 @@ extern const char e_notenum[]; extern const char e_aliname[]; extern const char e_badexport[]; extern const char e_badref[]; +extern const char e_badsubscript[]; extern const char e_noref[]; extern const char e_selfref[]; extern const char e_envmarker[]; @@ -228,4 +232,5 @@ extern const char e_redef[]; extern const char e_required[]; extern const char e_badappend[]; extern const char e_unknowntype[]; +extern const char e_globalref[]; #endif /* _NV_PRIVATE */ diff --git a/usr/src/lib/libshell/common/include/national.h b/usr/src/lib/libshell/common/include/national.h index 542bb583d6..41fe6e5316 100644 --- a/usr/src/lib/libshell/common/include/national.h +++ b/usr/src/lib/libshell/common/include/national.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/include/nval.h b/usr/src/lib/libshell/common/include/nval.h index def26ebb18..2a4c61f0ac 100644 --- a/usr/src/lib/libshell/common/include/nval.h +++ b/usr/src/lib/libshell/common/include/nval.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -265,6 +265,7 @@ extern Namfun_t *nv_isvtree(Namval_t*); extern Namval_t *nv_lastdict(void); extern Namval_t *nv_mkinttype(char*, size_t, int, const char*, Namdisc_t*); extern void nv_newattr(Namval_t*,unsigned,int); +extern void nv_newtype(Namval_t*); extern Namval_t *nv_open(const char*,Dt_t*,int); extern void nv_putval(Namval_t*,const char*,int); extern void nv_putv(Namval_t*,const char*,int,Namfun_t*); diff --git a/usr/src/lib/libshell/common/include/path.h b/usr/src/lib/libshell/common/include/path.h index 15c4e9694b..39f45e8883 100644 --- a/usr/src/lib/libshell/common/include/path.h +++ b/usr/src/lib/libshell/common/include/path.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -44,7 +44,7 @@ #define PATH_STD_DIR 0100 /* directory is on $(getconf PATH) */ #define PATH_OFFSET 2 /* path offset for path_join */ -#define MAXDEPTH (sizeof(char*)==2?64:2048) /* maximum recursion depth*/ +#define MAXDEPTH (sizeof(char*)==2?64:1024) /* maximum recursion depth*/ /* * path component structure for path searching diff --git a/usr/src/lib/libshell/common/include/regress.h b/usr/src/lib/libshell/common/include/regress.h new file mode 100644 index 0000000000..e47cc2cf17 --- /dev/null +++ b/usr/src/lib/libshell/common/include/regress.h @@ -0,0 +1,66 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1982-2009 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 * +* * +* David Korn <dgk@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped +/* + * David Korn + * AT&T Labs + * + * Shell interface private definitions + * + */ + +#ifndef _REGRESS_H +#define _REGRESS_H 1 + +#if SHOPT_REGRESS + +typedef struct Regress_s +{ + Shopt_t options; +} Regress_t; + +#define sh_isregress(r) is_option(&sh.regress->options,r) +#define sh_onregress(r) on_option(&sh.regress->options,r) +#define sh_offregress(r) off_option(&sh.regress->options,r) + +#define REGRESS(r,i,f) do { if (sh_isregress(REGRESS_##r)) sh_regress(REGRESS_##r, i, sfprints f, __LINE__, __FILE__); } while (0) + +#define REGRESS_egid 1 +#define REGRESS_euid 2 +#define REGRESS_p_suid 3 +#define REGRESS_source 4 +#define REGRESS_etc 5 + +#undef SHOPT_P_SUID +#define SHOPT_P_SUID sh_regress_p_suid(__LINE__, __FILE__) + +extern int b___regress__(int, char**, void*); +extern void sh_regress_init(Shell_t*); +extern void sh_regress(unsigned int, const char*, const char*, unsigned int, const char*); +extern uid_t sh_regress_p_suid(unsigned int, const char*); +extern char* sh_regress_etc(const char*, unsigned int, const char*); + +#else + +#define REGRESS(r,i,f) + +#endif /* SHOPT_REGRESS */ + +#endif /* _REGRESS_H */ diff --git a/usr/src/lib/libshell/common/include/shell.h b/usr/src/lib/libshell/common/include/shell.h index b82e582cfc..d649dbf271 100644 --- a/usr/src/lib/libshell/common/include/shell.h +++ b/usr/src/lib/libshell/common/include/shell.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -137,8 +137,8 @@ struct Shell_s int inlineno; /* line number of current input file */ int exitval; /* most recent exit value */ unsigned char trapnote; /* set when trap/signal is pending */ - char subshell; /* set for virtual subshell */ char shcomp; /* set when runing shcomp */ + short subshell; /* set for virtual subshell */ #ifdef _SH_PRIVATE _SH_PRIVATE #endif /* _SH_PRIVATE */ diff --git a/usr/src/lib/libshell/common/include/shlex.h b/usr/src/lib/libshell/common/include/shlex.h index 8f5277c246..371e01b001 100644 --- a/usr/src/lib/libshell/common/include/shlex.h +++ b/usr/src/lib/libshell/common/include/shlex.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -41,6 +41,7 @@ typedef struct _shlex_ int lastline; /* last line number */ int lasttok; /* previous token number */ int digits; /* numerical value with word token */ + int nonstandard; /* nonstandard construct in profile */ char aliasok; /* on when alias is legal */ char assignok; /* on when name=value is legal */ char inexec; /* on when processing exec */ @@ -110,6 +111,7 @@ typedef struct _shlex_ #define FALLTHRUSYM (SYMAMP|';') #define COOPSYM (SYMAMP|'|') #define IORDWRSYM (SYMGT|'<') +#define IORDWRSYMT (SYMSEMI|'<') #define IOCLOBSYM (SYMPIPE|'>') #define IPROCSYM (SYMLPAR|'<') #define OPROCSYM (SYMLPAR|'>') diff --git a/usr/src/lib/libshell/common/include/shnodes.h b/usr/src/lib/libshell/common/include/shnodes.h index e55cfc42eb..176a0d9e5f 100644 --- a/usr/src/lib/libshell/common/include/shnodes.h +++ b/usr/src/lib/libshell/common/include/shnodes.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -186,6 +186,7 @@ struct arithnod #define IOARITH 0x40000 /* arithmetic seek <# ((expr)) */ #define IOREWRITE 0x80000 /* arithmetic seek <# ((expr)) */ #define IOCOPY IOCLOB /* copy skipped lines onto standard output */ +#define IOPROCSUB IOARITH /* process substitution redirection */ union Shnode_u { diff --git a/usr/src/lib/libshell/common/include/shtable.h b/usr/src/lib/libshell/common/include/shtable.h index 041372b431..f8953f651d 100644 --- a/usr/src/lib/libshell/common/include/shtable.h +++ b/usr/src/lib/libshell/common/include/shtable.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/include/streval.h b/usr/src/lib/libshell/common/include/streval.h index 4ec3181f15..001f2d1ea1 100644 --- a/usr/src/lib/libshell/common/include/streval.h +++ b/usr/src/lib/libshell/common/include/streval.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -151,13 +151,14 @@ typedef struct _arith_ #define A_JMPZ 44 #define A_JMPNZ 45 #define A_JMP 46 -#define A_CALL0 47 -#define A_CALL1 48 -#define A_CALL2 49 -#define A_CALL3 50 -#define A_DOT 51 -#define A_LIT 52 -#define A_NOTNOT 53 +#define A_CALL1F 47 +#define A_CALL2F 48 +#define A_CALL3F 49 +#define A_CALL1I 50 +#define A_CALL2I 51 +#define A_DOT 52 +#define A_LIT 53 +#define A_NOTNOT 54 /* define error messages */ diff --git a/usr/src/lib/libshell/common/include/terminal.h b/usr/src/lib/libshell/common/include/terminal.h index a0e813c935..7192039013 100644 --- a/usr/src/lib/libshell/common/include/terminal.h +++ b/usr/src/lib/libshell/common/include/terminal.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/include/test.h b/usr/src/lib/libshell/common/include/test.h index 593bd5852b..1a38632d44 100644 --- a/usr/src/lib/libshell/common/include/test.h +++ b/usr/src/lib/libshell/common/include/test.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -51,8 +51,8 @@ #define TEST_EF 3 #define TEST_NT 10 #define TEST_OT 12 -#define TEST_SLT 15 -#define TEST_SGT 16 +#define TEST_SLT 16 +#define TEST_SGT 17 #define TEST_END 8 #define TEST_REP 20 diff --git a/usr/src/lib/libshell/common/include/timeout.h b/usr/src/lib/libshell/common/include/timeout.h index 803c6b09d2..276cf131a1 100644 --- a/usr/src/lib/libshell/common/include/timeout.h +++ b/usr/src/lib/libshell/common/include/timeout.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/include/ulimit.h b/usr/src/lib/libshell/common/include/ulimit.h index d5f3b21391..39fedeed78 100644 --- a/usr/src/lib/libshell/common/include/ulimit.h +++ b/usr/src/lib/libshell/common/include/ulimit.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/include/variables.h b/usr/src/lib/libshell/common/include/variables.h index ac9c5a536b..098e8743aa 100644 --- a/usr/src/lib/libshell/common/include/variables.h +++ b/usr/src/lib/libshell/common/include/variables.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -69,40 +69,41 @@ #define LCNUMNOD (sh.bltin_nodes+39) #define FIGNORENOD (sh.bltin_nodes+40) #define VERSIONNOD (sh.bltin_nodes+41) -#define DOTSHNOD (sh.bltin_nodes+42) -#define ED_CHRNOD (sh.bltin_nodes+43) -#define ED_COLNOD (sh.bltin_nodes+44) -#define ED_TXTNOD (sh.bltin_nodes+45) -#define ED_MODENOD (sh.bltin_nodes+46) -#define SH_NAMENOD (sh.bltin_nodes+47) -#define SH_SUBSCRNOD (sh.bltin_nodes+48) -#define SH_VALNOD (sh.bltin_nodes+49) -#define SH_VERSIONNOD (sh.bltin_nodes+50) -#define SH_DOLLARNOD (sh.bltin_nodes+51) -#define SH_MATCHNOD (sh.bltin_nodes+52) -#define SH_COMMANDNOD (sh.bltin_nodes+53) -#define SH_PATHNAMENOD (sh.bltin_nodes+54) -#define SH_FUNNAMENOD (sh.bltin_nodes+55) -#define SH_SUBSHELLNOD (sh.bltin_nodes+56) -#define SH_LEVELNOD (sh.bltin_nodes+57) -#define SH_LINENO (sh.bltin_nodes+58) -#define SH_STATS (sh.bltin_nodes+59) -#define SHLVL (sh.bltin_nodes+60) +#define JOBMAXNOD (sh.bltin_nodes+42) +#define DOTSHNOD (sh.bltin_nodes+43) +#define ED_CHRNOD (sh.bltin_nodes+44) +#define ED_COLNOD (sh.bltin_nodes+45) +#define ED_TXTNOD (sh.bltin_nodes+46) +#define ED_MODENOD (sh.bltin_nodes+47) +#define SH_NAMENOD (sh.bltin_nodes+48) +#define SH_SUBSCRNOD (sh.bltin_nodes+49) +#define SH_VALNOD (sh.bltin_nodes+50) +#define SH_VERSIONNOD (sh.bltin_nodes+51) +#define SH_DOLLARNOD (sh.bltin_nodes+52) +#define SH_MATCHNOD (sh.bltin_nodes+53) +#define SH_COMMANDNOD (sh.bltin_nodes+54) +#define SH_PATHNAMENOD (sh.bltin_nodes+55) +#define SH_FUNNAMENOD (sh.bltin_nodes+56) +#define SH_SUBSHELLNOD (sh.bltin_nodes+57) +#define SH_LEVELNOD (sh.bltin_nodes+58) +#define SH_LINENO (sh.bltin_nodes+59) +#define SH_STATS (sh.bltin_nodes+60) +#define SHLVL (sh.bltin_nodes+61) #if SHOPT_FS_3D -# define VPATHNOD (sh.bltin_nodes+61) +# define VPATHNOD (sh.bltin_nodes+62) # define NFS_3D 1 #else # define NFS_3D 0 #endif /* SHOPT_FS_3D */ #if SHOPT_VPIX -# define DOSPATHNOD (sh.bltin_nodes+61+NFS_3D) -# define VPIXNOD (sh.bltin_nodes+62+NFS_3D) +# define DOSPATHNOD (sh.bltin_nodes+62+NFS_3D) +# define VPIXNOD (sh.bltin_nodes+63+NFS_3D) # define NVPIX (NFS_3D+2) #else # define NVPIX NFS_3D #endif /* SHOPT_VPIX */ #ifdef apollo -# define SYSTYPENOD (sh.bltin_nodes+61+NVPIX) +# define SYSTYPENOD (sh.bltin_nodes+62+NVPIX) #endif /* apollo */ #endif /* SH_VALNOD */ diff --git a/usr/src/lib/libshell/common/include/version.h b/usr/src/lib/libshell/common/include/version.h index 8f025169ff..b22c513e65 100644 --- a/usr/src/lib/libshell/common/include/version.h +++ b/usr/src/lib/libshell/common/include/version.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -17,4 +17,4 @@ * David Korn <dgk@research.att.com> * * * ***********************************************************************/ -#define SH_RELEASE "93t 2008-11-04" +#define SH_RELEASE "93t+ 2009-10-12" diff --git a/usr/src/lib/libshell/common/scripts/cpvprint.sh b/usr/src/lib/libshell/common/scripts/cpvprint.sh new file mode 100644 index 0000000000..bcf2daa985 --- /dev/null +++ b/usr/src/lib/libshell/common/scripts/cpvprint.sh @@ -0,0 +1,185 @@ +#!/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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# cpvprint - compound variable pretty printer +# + +# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant +export PATH=/usr/xpg6/bin:/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 -u2 "${progname}: $*" + exit 1 +} + +function prettyprint_compoundvar +{ + nameref var=$1 + + # print tree + str="${ print -v var ; }" + # do some "pretty-printing" for human users (the output is still a + # valid compound variable value) + # (note: This does not scale well with large files) + str="${str//$'\t'typeset -l -E /$'\t'float }" + str="${str//$'\t'typeset -l -i /$'\t'integer }" + str="${str//$'\t'typeset -C /$'\t'compound }" + print -r -- "${str}" + + return 0 +} + +function usage +{ + OPTIND=0 + getopts -a "${progname}" "${cpvprint_usage}" OPT '-?' + exit 2 +} + +# HTML constants +compound -r hc=( + compound -r doctype=( + compound -r xhtml=( + typeset -r transitional=$'<!DOCTYPE html\n\tPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n\t"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n' + ) + ) + compound -r namespace=( + typeset -r xhtml=$'http://www.w3.org/1999/xhtml' + ) + typeset -r xml_head=$'<?xml version="1.0" encoding="UTF-8"?>\n' +) + +# main +builtin basename + +set -o noglob +set -o errexit +set -o nounset + +# tree variable +compound tree + +typeset progname="${ basename "${0}" ; }" + +typeset -r cpvprint_usage=$'+ +[-?\n@(#)\$Id: cpvprint (Roland Mainz) 2009-06-15 \$\n] +[-author?Roland Mainz <roland.mainz@nrubsig.org>] +[+NAME?cpvprint - render compound variable trees in various formats] +[+DESCRIPTION?\bcpvprint\b is converter which reads a ksh compound + variable and prints it on a different format. Supported + formats are \'default\', \'altdefault\', + \'tree\', \'alttree\', + \'pretty\', \'pretty.html\', \'list\' and \'fulllist\'] + +format [ arguments ] + +[+SEE ALSO?\bksh93\b(1), \bcpvlint\b(1)] +' + +while getopts -a "${progname}" "${cpvprint_usage}" OPT ; do +# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" + case ${OPT} in + *) usage ;; + esac +done +shift $((OPTIND-1)) + +# prechecks +(( $# > 0 )) || usage + +printformat="$1" +shift + +# read variable +case $# in + 0) + read -C tree || fatal_error $"Read error." + ;; + 1) + integer fd + + redirect {fd}<> "$1" || fatal_error $"Cannot open file." + read -u${fd} -C tree || fatal_error $"Read error." + redirect {fd}<&- || fatal_error $"Close error." + ;; + 2) + print -u2 -f $"%s: Unsupported number of arguments.\n" "$0" + exit 1 + ;; +esac + +# print variable +case ${printformat} in + 'default' | 'tree') + print -v tree + ;; + 'altdefault' | 'alttree') + print -C tree + ;; + 'pretty') + # print variable tree (same as $ print -v filetree # except that it "looks better") + prettyprint_compoundvar tree + ;; + 'pretty.html') + printf '%s%s<html xmlns="%s" xml:lang="en" lang="en">\n<head><meta name="generator" content="%H" /><title>%H</title></head>\n<body><pre>%H\n</pre></body></html>\n' \ + "${hc.xml_head}" \ + "${hc.doctype.xhtml.transitional}" \ + "${hc.namespace.xhtml}" \ + "ksh Compound Variable Pretty Printer (cpvprint)" \ + "" \ + "$(prettyprint_compoundvar tree)" | iconv -f "UTF-8" - - + ;; + 'list') + set | egrep '^tree.' | sed 's/^tree\.//' | egrep -v '^[[:alnum:]]+(\.([[:alnum:]\.]+)(\[.*\])*)*=\(' + ;; + 'fulllist') + set | egrep "^tree." + ;; + *) + fatal_error $"Unsupported format." + ;; +esac + +exit 0 +# EOF. diff --git a/usr/src/lib/libshell/common/scripts/crawlsrccomments.sh b/usr/src/lib/libshell/common/scripts/crawlsrccomments.sh index 520d48f118..bdcecd00cf 100644 --- a/usr/src/lib/libshell/common/scripts/crawlsrccomments.sh +++ b/usr/src/lib/libshell/common/scripts/crawlsrccomments.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -44,7 +44,7 @@ fi export LC_NUMERIC=C # constants values for tokenizer/parser stuff -typeset -r ch=( +compound -r ch=( newline=$'\n' tab=$'\t' formfeed=$'\f' @@ -317,7 +317,7 @@ function enumerate_comments_cpp integer content_length integer file_pos # file position - typeset line_pos=( + compound line_pos=( integer x=0 # X position in line integer y=0 # Y position in line (line number) ) @@ -325,20 +325,20 @@ function enumerate_comments_cpp typeset comment - typeset state=( + compound state=( # C comment state typeset in_c_comment=false # C++ comment state - typeset cxx=( + compound cxx=( typeset in_comment=false typeset comment_continued=false # position of current //-pos - typeset comment_pos=( + compound comment_pos=( integer x=-1 integer y=-1 ) # position of previous //-pos - typeset comment_prev_pos=( + compound comment_prev_pos=( integer x=-1 integer y=-1 ) @@ -708,56 +708,99 @@ function cat_http_body return 0 } -function cat_http +function cat_url { typeset protocol="${1%://*}" typeset path1="${1#*://}" # "http://foo.bat.net/x/y.html" ----> "foo.bat.net/x/y.html" - - typeset host="${path1%%/*}" - typeset path="${path1#*/}" - typeset port="${host##*:}" + + if [[ "${protocol}" == "file" ]] ; then + cat "${path1}" + return $? + elif [[ "${protocol}" == ~(Elr)http(|s) ]] ; then + typeset host="${path1%%/*}" + typeset path="${path1#*/}" + typeset port="${host##*:}" - integer netfd - typeset -C httpresponse # http response - - # If URL did not contain a port number in the host part then look at the - # protocol to get the port number - if [[ "${port}" == "${host}" ]] ; then - case "${protocol}" in - "http") port=80 ;; - *) port="$(getent services "${protocol}" | sed 's/[^0-9]*//;s/\/.*//')" ;; - esac - else - host="${host%:*}" - fi + integer netfd + compound httpresponse # http response + + # If URL did not contain a port number in the host part then look at the + # protocol to get the port number + if [[ "${port}" == "${host}" ]] ; then + case "${protocol}" in + "http") port=80 ;; + "https") port=443 ;; + *) port="$(getent services "${protocol}" | sed 's/[^0-9]*//;s/\/.*//')" ;; + esac + else + host="${host%:*}" + fi - printmsg "protocol=${protocol} port=${port} host=${host} path=${path}" + printmsg "protocol=${protocol} port=${port} host=${host} path=${path}" - # prechecks - [[ "${protocol}" == "" ]] && { print -u2 -f "%s: protocol not set.\n" "$0" ; return 1 ; } - [[ "${port}" == "" ]] && { print -u2 -f "%s: port not set.\n" "$0" ; return 1 ; } - [[ "${host}" == "" ]] && { print -u2 -f "%s: host not set.\n" "$0" ; return 1 ; } - [[ "${path}" == "" ]] && { print -u2 -f "%s: path not set.\n" "$0" ; return 1 ; } - - # open TCP channel - redirect {netfd}<>"/dev/tcp/${host}/${port}" - (( $? != 0 )) && { print -u2 -f "%s: Couldn't open %s\n" "$0" "${1}" ; return 1 ; } - - # send HTTP request - request="GET /${path} HTTP/1.1\r\n" - request+="Host: ${host}\r\n" - request+="User-Agent: crawlsrccomments/ksh93 (2008-06-14; $(uname -s -r -p))\r\n" - request+="Connection: close\r\n" - print -n -- "${request}\r\n" >&${netfd} + # prechecks + [[ "${protocol}" != "" ]] || { print -u2 -f "%s: protocol not set.\n" "$0" ; return 1 ; } + [[ "${port}" != "" ]] || { print -u2 -f "%s: port not set.\n" "$0" ; return 1 ; } + [[ "${host}" != "" ]] || { print -u2 -f "%s: host not set.\n" "$0" ; return 1 ; } + [[ "${path}" != "" ]] || { print -u2 -f "%s: path not set.\n" "$0" ; return 1 ; } + + # open TCP channel + if [[ "${protocol}" == "https" ]] ; then + compound sslfifo + sslfifo.dir="$(mktemp -d)" + sslfifo.in="${sslfifo.dir}/in" + sslfifo.out="${sslfifo.dir}/out" + + # register an EXIT trap and use "errexit" to leave it at the first error + # (this saves lots of if/fi tests for error checking) + trap "rm -r \"${sslfifo.dir}\"" EXIT + set -o errexit + + mkfifo "${sslfifo.in}" "${sslfifo.out}" + + # create async openssl child to handle https + openssl s_client -quiet -connect "${host}:${port}" <"${sslfifo.in}" >>"${sslfifo.out}" & + + # send HTTP request + request="GET /${path} HTTP/1.1\r\n" + request+="Host: ${host}\r\n" + request+="User-Agent: crawlsrccomments/ksh93(ssl) (2009-05-08; $(uname -s -r -p))\r\n" + request+="Connection: close\r\n" + print -n -- "${request}\r\n" >> "${sslfifo.in}" + + # collect response and send it to stdout + { + parse_http_response httpresponse + cat_http_body "${httpresponse.transfer_encoding}" + } <"${sslfifo.out}" + + wait || { print -u2 -f "%s: openssl failed.\n" ; exit 1 ; } + + return 0 + else + redirect {netfd}<> "/dev/tcp/${host}/${port}" + (( $? != 0 )) && { print -u2 -f "%s: Could not open %s\n" "$0" "${1}" ; return 1 ; } + + # send HTTP request + request="GET /${path} HTTP/1.1\r\n" + request+="Host: ${host}\r\n" + request+="User-Agent: crawlsrccomments/ksh93 (2009-05-08; $(uname -s -r -p))\r\n" + request+="Connection: close\r\n" + print -n -- "${request}\r\n" >&${netfd} - # collect response and send it to stdout - parse_http_response httpresponse <&${netfd} - cat_http_body "${httpresponse.transfer_encoding}" <&${netfd} + # collect response and send it to stdout + parse_http_response httpresponse <&${netfd} + cat_http_body "${httpresponse.transfer_encoding}" <&${netfd} - # close connection - redirect {netfd}<&- - - return 0 + # close connection + redirect {netfd}<&- + + return 0 + fi + else + return 1 + fi + # notreached } function print_stats @@ -765,7 +808,7 @@ function print_stats set -o errexit # gather some statistics - typeset stats=( + compound stats=( integer files_with_comments=0 integer files_without_comments=0 @@ -797,7 +840,7 @@ function print_stats (( stats.total_num_files++ )) done - printf "%B\n" stats + print -v stats return 0 } @@ -951,7 +994,7 @@ function do_crawl { set -o errexit - typeset options=( + compound options=( integer max_filesize_for_scan=$((256*1024)) integer max_num_comments=$((2**62)) # FIXME: This should be "+Inf" (=Infinite) ) @@ -967,7 +1010,7 @@ function do_crawl done shift $((OPTIND-1)) - typeset scan=( + compound scan=( typeset -A records ) @@ -978,8 +1021,7 @@ function do_crawl done # print compound variable array (we strip the "typeset -A records" for now) - printf "%B\n" scan | - sed $'s/^#.*$//;s/^\(//;s/^\)//;s/^\ttypeset -A records=\(//;s/^\t\)//' >"crawlsrccomments_extracted_comments.cpv" + print -v scan >"crawlsrccomments_extracted_comments.cpv" print "# Wrote results to crawlsrccomments_extracted_comments.cpv" @@ -991,22 +1033,20 @@ function do_getcomments set -o errexit # vars - typeset scan=( - typeset -A records - ) + compound scan typeset database typeset tmp - typeset options=( + compound options=( typeset database="crawlsrccomments_extracted_comments.cpv" typeset print_stats=false typeset zapduplicates=false - typeset filepattern=( + compound filepattern=( typeset accept="*" typeset reject="" ) - typeset commentpattern=( + compound commentpattern=( typeset accept="~(Ei)(license|copyright)" typeset reject="" ) @@ -1035,11 +1075,11 @@ function do_getcomments trap 'set -o errexit ; print -u2 "# Cleaning up..." ; ((${#tmpfiles[@]} > 0)) && rm -- "${tmpfiles[@]}" ; print -u2 "# Done."' EXIT # Support for HTTP URLs - if [[ "${options.database}" == ~(El)http://.* ]] ; then - database="/tmp/extract_license_cat_http_${PPID}_$$.tmp" + if [[ "${options.database}" == ~(El)(http|https)://.* ]] ; then + database="/tmp/extract_license_cat_url_${PPID}_$$.tmp" tmpfiles+=( "${database}" ) print -u2 "# Loading URL..." - cat_http "${options.database}" >"${database}" + cat_url "${options.database}" >"${database}" print -u2 "# Loading URL done." else database="${options.database}" @@ -1071,11 +1111,7 @@ function do_getcomments # Read compound variable which contain all recorded comments print -u2 "# reading records..." - { - printf "(" - cat "${database}" - printf ")\n" - } | read -C scan.records || fatal_error 'Error reading data.' + read -C scan <"${database}" || fatal_error 'Error reading data.' print -u2 -f "# reading %d records done.\n" "${#scan.records[@]}" # print comments @@ -1105,7 +1141,7 @@ function usage } typeset -r do_getcomments_usage=$'+ -[-?\n@(#)\$Id: getcomments (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: getcomments (Roland Mainz) 2009-05-09 \$\n] [-author?Roland Mainz <roland.mainz@sun.com>] [+NAME?getcomments - extract license information from source files] [+DESCRIPTION?\bgetcomments\b is a small utilty script which extracts @@ -1117,7 +1153,7 @@ typeset -r do_getcomments_usage=$'+ the comments and stores this information in a "database" file called "crawlsrccomments_extracted_comments.cpv" and then \bextract_license\b allows queries on this database.] -[D:database?Database file for input (either file or http://-URL).]:[database] +[D:database?Database file for input (either file, http:// or https://-URL).]:[database] [l:acceptfilepattern?Process only files which match pattern.]:[pattern] [L:rejectfilepattern?Process only files which do not match pattern.]:[pattern] [c:acceptcommentpattern?Match comments which match pattern. Defaults to ~(Ei)(license|copyright)]:[pattern] @@ -1128,7 +1164,7 @@ typeset -r do_getcomments_usage=$'+ ' typeset -r do_crawl_usage=$'+ -[-?\n@(#)\$Id: crawl (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: crawl (Roland Mainz) 2009-05-09 \$\n] [-author?Roland Mainz <roland.mainz@sun.com>] [+NAME?crawl - crawl comment information from source files] [+DESCRIPTION?\bcrawl\b is a small utilty script which reads @@ -1144,7 +1180,7 @@ typeset -r do_crawl_usage=$'+ ' typeset -r crawlsrccomments_usage=$'+ -[-?\n@(#)\$Id: crawlsrccomments (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: crawlsrccomments (Roland Mainz) 2009-05-09 \$\n] [-author?Roland Mainz <roland.mainz@sun.com>] [+NAME?crawlsrccomments - extract and filter comment information from source files] [+DESCRIPTION?\bcrawlsrccomments\b is a small utilty script which reads diff --git a/usr/src/lib/libshell/common/scripts/filetree1.sh b/usr/src/lib/libshell/common/scripts/filetree1.sh index 6946fca4fb..243c9758cf 100644 --- a/usr/src/lib/libshell/common/scripts/filetree1.sh +++ b/usr/src/lib/libshell/common/scripts/filetree1.sh @@ -60,8 +60,8 @@ function do_directory typeset i typeset dummy - typeset -A tree.files - typeset -A tree.dirs + typeset -C -A tree.files + typeset -C -A tree.dirs find "${basedir}"/* -prune 2>/dev/null | while read i ; do dirname="$(dirname "$i")" @@ -169,7 +169,7 @@ builtin uname typeset progname="${ basename "${0}" ; }" typeset -r filetree1_usage=$'+ -[-?\n@(#)\$Id: filetree1 (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: filetree1 (Roland Mainz) 2009-05-06 \$\n] [-author?Roland Mainz <roland.mainz@sun.com>] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [+NAME?filetree1 - file tree demo] @@ -177,7 +177,7 @@ typeset -r filetree1_usage=$'+ which accepts a directory name as input, and then builds tree nodes for all files+directories and stores all file attributes in these notes and then outputs the tree in the format - specified by viewmode (either "list", "namelist" or "tree")..] + specified by viewmode (either "list", "namelist", "tree" or "compacttree")..] viewmode dirs @@ -195,7 +195,7 @@ shift $((OPTIND-1)) typeset viewmode="$1" shift -if [[ "${viewmode}" != ~(Elr)(list|namelist|tree) ]] ; then +if [[ "${viewmode}" != ~(Elr)(list|namelist|tree|compacttree) ]] ; then fatal_error $"Invalid view mode \"${viewmode}\"." fi @@ -216,7 +216,10 @@ case "${viewmode}" in typeset + | egrep "^myfiletree\[" ;; tree) - printf "%B\n" myfiletree + print -v myfiletree + ;; + compacttree) + print -C myfiletree ;; *) fatal_error $"Invalid view mode \"${viewmode}\"." diff --git a/usr/src/lib/libshell/common/scripts/gnaw.sh b/usr/src/lib/libshell/common/scripts/gnaw.sh index 880e18118b..878f2899ac 100644 --- a/usr/src/lib/libshell/common/scripts/gnaw.sh +++ b/usr/src/lib/libshell/common/scripts/gnaw.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -926,7 +926,7 @@ builtin wc typeset progname="${ basename "${0}" ; }" # terminal size rect -typeset -C termsize=( +compound termsize=( integer columns=-1 integer lines=-1 ) @@ -942,7 +942,7 @@ integer game_use_colors=0 integer game_use_unicode=0 typeset -r gnaw_usage=$'+ -[-?\n@(#)\$Id: gnaw (Roland Mainz) 2008-11-04 \$\n] +[-?\n@(#)\$Id: gnaw (Roland Mainz) 2009-05-09 \$\n] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [+NAME?gnaw - maze game written in ksh93] [+DESCRIPTION?\bgnaw\b is a maze game. diff --git a/usr/src/lib/libshell/common/scripts/mandelbrotset1.sh b/usr/src/lib/libshell/common/scripts/mandelbrotset1.sh index 2b01d33f4e..b9ae173df9 100644 --- a/usr/src/lib/libshell/common/scripts/mandelbrotset1.sh +++ b/usr/src/lib/libshell/common/scripts/mandelbrotset1.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -71,12 +71,6 @@ function get_term_size return 0 } -function print_color -{ - print -r -n -- "${symbollist:${1}:1}" - return 0 -} - function mandelbrot { nameref result=$1 @@ -109,16 +103,19 @@ function mandelbrot function loop_serial { integer value + typeset line="" for (( y=y_min ; y < y_max ; y+=stepwidth )) ; do for (( x=x_min ; x < x_max ; x+=stepwidth )) ; do mandelbrot value ${x} ${y} ${x} ${y} 1 ${symbollistlen} - print_color ${value} + line+="${symbollist:value:1}" done - print + line+=$'\n' done - + + print -r -- "${line}" + return 0 } @@ -128,6 +125,7 @@ function loop_parallel integer numjobs=0 # the following calculation suffers from rounding errors integer lines_per_job=$(( ((m_height+(numcpus-1)) / numcpus) )) + typeset tmpjobdir printmsg $"# lines_per_job=${lines_per_job}" printmsg $"# numcpus=${numcpus}" @@ -135,16 +133,15 @@ function loop_parallel # "renice" worker jobs set -o bgnice - if [[ "${TMPDIR}" == "" ]] ; then - TMPDIR="/tmp" - fi + tmpjobdir="$(mktemp --default=/tmp --directory "mandelbrotset1${PPID}_$$_XXXXXX")" || fatal_error $"Could not create temporary directory." + trap "rm -r ${tmpjobdir}" EXIT # cleanup # try to generate a job identifer prefix which is unique across multiple hosts jobident="job_host_$(uname -n)pid_$$_ppid${PPID}" printmsg $"## prepare..." for (( y=y_min ; y < y_max ; y+=(stepwidth*lines_per_job) )) ; do - rm -f "${TMPDIR}/mandelbrot_${jobident}_child_$y.joboutput" + rm -f "${tmpjobdir}/${jobident}_child_$y.joboutput" (( numjobs++ )) done @@ -153,15 +150,21 @@ function loop_parallel for (( y=y_min ; y < y_max ; y+=(stepwidth*lines_per_job) )) ; do ( integer value + typeset line="" + # save file name since we're going to modify "y" + typeset filename="${tmpjobdir}/${jobident}_child_$y.joboutput" for (( ; y < y_max && lines_per_job-- > 0 ; y+=stepwidth )) ; do for (( x=x_min ; x < x_max ; x+=stepwidth )) ; do mandelbrot value ${x} ${y} ${x} ${y} 1 ${symbollistlen} - print_color ${value} + line+="${symbollist:value:1}" done - print - done >"${TMPDIR}/mandelbrot_${jobident}_child_$y.joboutput" + line+=$'\n' + done + print -r -- "${line}" >"${filename}" + + exit 0 ) & done @@ -170,8 +173,8 @@ function loop_parallel printmsg $"## output:" for (( y=y_min ; y < y_max ; y+=(stepwidth*lines_per_job) )) ; do - print -- "$( < "${TMPDIR}/mandelbrot_${jobident}_child_$y.joboutput")" - rm "${TMPDIR}/mandelbrot_${jobident}_child_$y.joboutput" + print -r -- "$( < "${tmpjobdir}/${jobident}_child_$y.joboutput")" + # EXIT trap will cleanup temporary files done return 0 @@ -189,6 +192,10 @@ builtin basename builtin cat builtin rm builtin uname # loop_parallel needs the ksh93 builtin version to generate unique job file names +builtin mktemp + +set -o noglob +set -o nounset typeset progname="${ basename "${0}" ; }" @@ -203,7 +210,7 @@ float stepwidth integer numcpus # terminal size rect -typeset -C termsize=( +compound termsize=( integer columns=-1 integer lines=-1 ) @@ -221,7 +228,7 @@ numcpus=16 (( m_width=termsize.columns-1 , m_height=termsize.lines-2 )) typeset -r mandelbrotset1_usage=$'+ -[-?\n@(#)\$Id: mandelbrotset1 (Roland Mainz) 2008-11-04 \$\n] +[-?\n@(#)\$Id: mandelbrotset1 (Roland Mainz) 2009-06-14 \$\n] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [+NAME?mandelbrotset1 - generate mandelbrot set fractals with ksh93] [+DESCRIPTION?\bmandelbrotset1\b mandelbrot set fractal generator @@ -247,7 +254,9 @@ while getopts -a "${progname}" "${mandelbrotset1_usage}" OPT ; do m) max_mag="${OPTARG}" ;; p) stepwidth="${OPTARG}" ;; S) mode="serial" ;; + +S) mode="parallel" ;; P) mode="parallel" ;; + +P) mode="serial" ;; M) mode="${OPTARG}" ;; C) numcpus="${OPTARG}" ;; *) usage ;; diff --git a/usr/src/lib/libshell/common/scripts/multifollow.sh b/usr/src/lib/libshell/common/scripts/multifollow.sh index d0323ef915..b5d5cb7bb2 100644 --- a/usr/src/lib/libshell/common/scripts/multifollow.sh +++ b/usr/src/lib/libshell/common/scripts/multifollow.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -64,7 +64,7 @@ builtin cat typeset progname="$(basename "${0}")" typeset -r multifollow_usage=$'+ -[-?\n@(#)\$Id: multifollow (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: multifollow (Roland Mainz) 2009-04-08 \$\n] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [+NAME?multifollow - use tail -f on multiple files] [+DESCRIPTION?\bmultifollow\b is a small utilty which can "follow" multiple @@ -109,7 +109,7 @@ for (( ; $# > 0 ; numfiles++ )) ; do ) mkfifo "${files[${numfiles}].pipename}" - redirect {files[numfiles].fd}<>"${files[numfiles].pipename}" + redirect {files[numfiles].fd}<> "${files[numfiles].pipename}" tail -f "${files[${numfiles}].name}" >"${files[${numfiles}].pipename}" & files[${numfiles}].childpid=$! diff --git a/usr/src/lib/libshell/common/scripts/numtree1.sh b/usr/src/lib/libshell/common/scripts/numtree1.sh new file mode 100644 index 0000000000..beca4aae76 --- /dev/null +++ b/usr/src/lib/libshell/common/scripts/numtree1.sh @@ -0,0 +1,219 @@ +#!/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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# numtree1 - basic compound variable tree demo+benchmark +# + +# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant +export PATH=/usr/xpg6/bin:/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 -u2 "${progname}: $*" + exit 1 +} + +function add_number_to_tree +{ + typeset treename=$1 + integer num=$2 + integer i + typeset nodepath # full name of compound variable + integer -a pe # path elements + + # first built an array containing the names of each path element + # (e.g. "135" results in an array containing "( 1 3 5 )") + for (( i=$(rev <<<$num) ; i > 0 ; i=i/10 )) ; do + pe+=( $((i % 10)) ) + done + + # walk path described via the "pe" array and build nodes if + # there aren't any nodes yet + nodepath="${treename}" + for (( i=0 ; i < ${#pe[@]} ; i++ )) ; do + nameref x="${nodepath}" + [[ ! -v x.node ]] && compound -C -a x.nodes + + nodepath+=".nodes[${pe[i]}]" + done + + # insert element + nameref node="${nodepath}" + [[ ! -v node.elements ]] && integer -a node.elements + node.elements+=( ${num} ) + + return 0 +} + + +# floating-point version of "seq" +function floatseq +{ + float i + float arg1=$1 + float arg2=$2 + float arg3=$3 + + case $# in + 1) + for (( i=1. ; i <= arg1 ; i=i+1. )) ; do + printf "%a\n" i + done + ;; + 2) + for (( i=arg1 ; i <= arg2 ; i=i+1. )) ; do + printf "%a\n" i + done + ;; + 3) + for (( i=arg1 ; i <= arg3 ; i+=arg2 )) ; do + printf "%a\n" i + done + ;; + *) + print -u2 -f "%s: Illegal number of arguments %d\n" "$0" $# + return 1 + ;; + esac + + return 0 +} + + +function usage +{ + OPTIND=0 + getopts -a "${progname}" "${numtree1_usage}" OPT '-?' + exit 2 +} + +# main +builtin basename +builtin rev + +set -o noglob +set -o errexit +set -o nounset + +compound base + +compound bench=( + float start + float stop +) + +integer i + +typeset progname="${ basename "${0}" ; }" + +typeset -r numtree1_usage=$'+ +[-?\n@(#)\$Id: numtree1 (Roland Mainz) 2009-08-17 \$\n] +[-author?Roland Mainz <roland.mainz@nrubsig.org>] +[+NAME?numtree1 - generate sorted variable tree containing numbers] +[+DESCRIPTION?\bnumtree1\b is a simple variable tree generator + sorts a given set of numbers into a ksh compound variable tree). + the application supports two different modes: \'seq\' takes + 1-3 arguments to specify the set of numbers via seq(1) and + \'stdin\' reads the numbers from stdin (one per line)] + +method [ arguments ] + +[+SEE ALSO?\bksh93\b(1), \bseq\b(1)] +' + +while getopts -a "${progname}" "${numtree1_usage}" OPT ; do +# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" + case ${OPT} in + *) usage ;; + esac +done +shift $((OPTIND-1)) + +# prechecks +(( $# > 0 )) || usage + +cmd=$1 +shift + +# Read numbers from stdin outside benchmark loop +if [[ ${cmd} == 'stdin' ]] ; then + stdin_numbers="$( cat /dev/stdin )" || fatal_error "stdin read error" +fi + +(( bench.start=SECONDS )) + +case ${cmd} in + "seq") + for i in ${ floatseq "$@" ; } ; do + add_number_to_tree base "${i}" + done + ;; + "stdin") + for i in ${stdin_numbers} ; do + add_number_to_tree base "${i}" + done + ;; + "demo1") + for i in 1 32 33 34 34 38 90 ; do + add_number_to_tree base "${i}" + done + ;; + "demo2") + for (( i=1000000000 ; i < 1000000000+10 ; i++ )) ; do + add_number_to_tree base "$i" + done + ;; + *) + fatal_error "Invalid command ${cmd}." + ;; +esac + +(( bench.stop=SECONDS )) + +print -u2 -f "# time used: %f\n" $((bench.stop - bench.start)) + +# print tree +print -v base + +exit 0 +# EOF. diff --git a/usr/src/lib/libshell/common/scripts/rssread.sh b/usr/src/lib/libshell/common/scripts/rssread.sh index fea8627178..1010a7d873 100644 --- a/usr/src/lib/libshell/common/scripts/rssread.sh +++ b/usr/src/lib/libshell/common/scripts/rssread.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -51,112 +51,223 @@ function fatal_error exit 1 } -# parse HTTP return code, cookies etc. -function parse_http_response -{ - nameref response="$1" - typeset h statuscode statusmsg i - - # we use '\r' as additional IFS to filter the final '\r' - IFS=$' \t\r' read -r h statuscode statusmsg # read HTTP/1.[01] <code> - [[ "$h" != ~(Eil)HTTP/.* ]] && { print -u2 -f $"%s: HTTP/ header missing\n" "$0" ; return 1 ; } - [[ "$statuscode" != ~(Elr)[0-9]* ]] && { print -u2 -f $"%s: invalid status code\n" "$0" ; return 1 ; } - response.statuscode="$statuscode" - response.statusmsg="$statusmsg" - - # skip remaining headers - while IFS='' read -r i ; do - [[ "$i" == $'\r' ]] && break - - # strip '\r' at the end - i="${i/~(Er)$'\r'/}" - - case "$i" in - ~(Eli)Content-Type:.*) - response.content_type="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Content-Length:[[:blank:]]*[0-9]*) - integer response.content_length="${i/~(El).*:[[:blank:]]*/}" - ;; - ~(Eli)Transfer-Encoding:.*) - response.transfer_encoding="${i/~(El).*:[[:blank:]]*/}" - ;; - esac - done +typeset -T urlconnection_t=( + # public + typeset user_agent="ksh93/urlconnection_t" - return 0 -} + # private variables + typeset protocol + typeset path1 + typeset host + typeset path + typeset port + + compound netfd=( + integer in=-1 # incoming traffic + integer out=-1 # outgoing traffic + ) -function cat_http_body -{ - typeset emode="$1" - typeset hexchunksize="0" - integer chunksize=0 - - if [[ "${emode}" == "chunked" ]] ; then - while IFS=$'\r' read hexchunksize && - [[ "${hexchunksize}" == ~(Elri)[0-9abcdef]* ]] && - (( chunksize=16#${hexchunksize} )) && (( chunksize > 0 )) ; do - dd bs=1 count="${chunksize}" 2>/dev/null + # only used for https + compound ssl=( + compound fifo=( + typeset dir="" + typeset in="" + typeset out="" + ) + integer openssl_client_pid=-1 + ) + + # parse HTTP return code, cookies etc. + function parse_http_response + { + nameref response="$1" + typeset h statuscode statusmsg i + + # we use '\r' as additional IFS to filter the final '\r' + IFS=$' \t\r' read -r h statuscode statusmsg # read HTTP/1.[01] <code> + [[ "$h" != ~(Eil)HTTP/.* ]] && { print -u2 -f $"%s: HTTP/ header missing\n" "$0" ; return 1 ; } + [[ "$statuscode" != ~(Elr)[0-9]* ]] && { print -u2 -f $"%s: invalid status code\n" "$0" ; return 1 ; } + response.statuscode="$statuscode" + response.statusmsg="$statusmsg" + + # skip remaining headers + while IFS='' read -r i ; do + [[ "$i" == $'\r' ]] && break + + # strip '\r' at the end + i="${i/~(Er)$'\r'/}" + + case "$i" in + ~(Eli)Content-Type:.*) + response.content_type="${i/~(El).*:[[:blank:]]*/}" + ;; + ~(Eli)Content-Length:[[:blank:]]*[0-9]*) + integer response.content_length="${i/~(El).*:[[:blank:]]*/}" + ;; + ~(Eli)Transfer-Encoding:.*) + response.transfer_encoding="${i/~(El).*:[[:blank:]]*/}" + ;; + esac done - else - cat - fi - - return 0 -} -function cat_http -{ - typeset protocol="${1%://*}" - typeset path1="${1#*://}" # "http://foo.bat.net/x/y.html" ----> "foo.bat.net/x/y.html" + return 0 + } + + function cat_http_body + { + typeset emode="$1" + typeset hexchunksize="0" + integer chunksize=0 + + if [[ "${emode}" == "chunked" ]] ; then + while IFS=$'\n' read hexchunksize ; do + hexchunksize="${hexchunksize//$'\r'/}" + [[ "${hexchunksize}" != "" ]] || continue + [[ "${hexchunksize}" == ~(Elri)[0-9abcdef]+ ]] || break + (( chunksize=16#${hexchunksize} )) + (( chunksize > 0 )) || break + dd bs=1 count="${chunksize}" 2>/dev/null + done + else + cat + fi - typeset host="${path1%%/*}" - typeset path="${path1#*/}" - typeset port="${host##*:}" - - integer netfd - typeset -C httpresponse # http response - - # If URL did not contain a port number in the host part then look at the - # protocol to get the port number - if [[ "${port}" == "${host}" ]] ; then - case "${protocol}" in - "http") port=80 ;; - *) port="$(getent services "${protocol}" | sed 's/[^0-9]*//;s/\/.*//')" ;; - esac - else - host="${host%:*}" - fi - - printmsg "protocol=${protocol} port=${port} host=${host} path=${path}" - - # prechecks - [[ "${protocol}" == "" ]] && { print -u2 -f "%s: protocol not set.\n" "$0" ; return 1 ; } - [[ "${port}" == "" ]] && { print -u2 -f "%s: port not set.\n" "$0" ; return 1 ; } - [[ "${host}" == "" ]] && { print -u2 -f "%s: host not set.\n" "$0" ; return 1 ; } - [[ "${path}" == "" ]] && { print -u2 -f "%s: path not set.\n" "$0" ; return 1 ; } - - # open TCP channel - redirect {netfd}<>"/dev/tcp/${host}/${port}" - (( $? != 0 )) && { print -u2 -f "%s: Couldn't open %s\n" "$0" "${1}" ; return 1 ; } - - # send HTTP request - request="GET /${path} HTTP/1.1\r\n" - request+="Host: ${host}\r\n" - request+="User-Agent: rssread/ksh93 (2008-10-14; $(uname -s -r -p))\r\n" - request+="Connection: close\r\n" - print -n -- "${request}\r\n" >&${netfd} - - # collect response and send it to stdout - parse_http_response httpresponse <&${netfd} - cat_http_body "${httpresponse.transfer_encoding}" <&${netfd} - + return 0 + } + + function init_url + { + _.protocol="${1%://*}" + _.path1="${1#*://}" # "http://foo.bat.net/x/y.html" ----> "foo.bat.net/x/y.html" + + if [[ "${_.protocol}" == ~(Elr)http(|s) ]] ; then + _.host="${_.path1%%/*}" + _.path="${_.path1#*/}" + _.port="${_.host##*:}" + fi + + return 0 + } + # close connection - redirect {netfd}<&- + function close_connection + { + integer ret + + if (( _.netfd.in != -1 )) ; then + redirect {_.netfd.in}<&- + (( _.netfd.in=-1 )) + fi + + if (( _.netfd.in != _.netfd.out && _.netfd.out != -1 )) ; then + redirect {_.netfd.out}<&- + (( _.netfd.out=-1 )) + fi + + if [[ "${_.protocol}" == "https" ]] ; then + wait ${_.ssl.openssl_client_pid} || { print -u2 -f "%s: openssl failed.\n" ; return 1 ; } + (( _.ssl.openssl_client_pid=-1 )) + + rm -r \"${_.ssl.fifo.dir}\" + _.ssl.fifo.dir="" + fi + + return 0 + } - return 0 -} + function open_connection + { + if [[ "${_.protocol}" == "https" ]] ; then + _.ssl.fifo.dir="$(mktemp -d)" + _.ssl.fifo.in="${_.ssl.fifo.dir}/in" + _.ssl.fifo.out="${_.ssl.fifo.dir}/out" + + # Use "errexit" to leave it at the first error + # (this saves lots of if/fi tests for error checking) + set -o errexit + + mkfifo "${_.ssl.fifo.in}" "${_.ssl.fifo.out}" + + # create async openssl child to handle https + openssl s_client -quiet -connect "${_.host}:${_.port}" <"${_.ssl.fifo.in}" >>"${_.ssl.fifo.out}" & + + _.ssl.openssl_client_pid=$! + else + redirect {_.netfd.in}<> "/dev/tcp/${_.host}/${_.port}" + (( $? != 0 )) && { print -u2 -f "%s: Could not open %s\n" "$0" "${1}" ; return 1 ; } + (( _.netfd.out=_.netfd.in )) + fi + return 0 + } + + function send_request + { + typeset request="$1" + + set -o errexit + + if [[ "${_.protocol}" == "https" ]] ; then + print -n -- "${request}\r\n" >> "${_.ssl.fifo.in}" + + redirect {_.netfd.in}< "${_.ssl.fifo.out}" + else + print -n -- "${request}\r\n" >&${_.netfd.out} + fi + return 0 + } + + function cat_url + { + if [[ "${_.protocol}" == "file" ]] ; then + cat "${_.path1}" + return $? + elif [[ "${_.protocol}" == ~(Elr)http(|s) ]] ; then + compound httpresponse # http response + + # If URL did not contain a port number in the host part then look at the + # protocol to get the port number + if [[ "${_.port}" == "${_.host}" ]] ; then + case "${_.protocol}" in + "http") _.port=80 ;; + "https") _.port=443 ;; + *) _.port="$(getent services "${_.protocol}" | sed 's/[^0-9]*//;s/\/.*//')" ;; + esac + else + _.host="${_.host%:*}" + fi + + printmsg "protocol=${_.protocol} port=${_.port} host=${_.host} path=${_.path}" + + # prechecks + [[ "${_.protocol}" != "" ]] || { print -u2 -f "%s: protocol not set.\n" "$0" ; return 1 ; } + [[ "${_.port}" != "" ]] || { print -u2 -f "%s: port not set.\n" "$0" ; return 1 ; } + [[ "${_.host}" != "" ]] || { print -u2 -f "%s: host not set.\n" "$0" ; return 1 ; } + [[ "${_.path}" != "" ]] || { print -u2 -f "%s: path not set.\n" "$0" ; return 1 ; } + + _.open_connection + + # send HTTP request + request="GET /${_.path} HTTP/1.1\r\n" + request+="Host: ${_.host}\r\n" + request+="User-Agent: ${_.user_agent}\r\n" + request+="Connection: close\r\n" + _.send_request "${request}\r\n" + + # collect response and send it to stdout + { + _.parse_http_response httpresponse + _.cat_http_body "${httpresponse.transfer_encoding}" + } <&${_.netfd.in} + + _.close_connection + + return 0 + else + return 1 + fi + # notreached + } +) function html_entity_to_ascii { @@ -448,10 +559,21 @@ function do_rssread LC_TIME="en_US.UTF-8" \ LANG="en_US.UTF-8" - # need extra newline after cat_http to terminate line with $'\n' + # return non-zero exit code for this function if the rss processing below fails + set -o errexit + + urlconnection_t hc + hc.user_agent="rssread/ksh93(ssl) (2009-08-14; $(uname -s -r -p))" + hc.init_url "$1" + + # need extra newline after cat_url to terminate line with $'\n' # to make "xml_tok" happy - { cat_http "$1" ; print ; } | - xml_tok "rsstok_cb" + data="${ hc.cat_url ; print ; }" + + print -u2 -f "# Got %d lines of RSS data, processing...\n" "${ wc -l <<< "${data}" ; }" + + xml_tok "rsstok_cb" <<< "${data}" + return 0 } @@ -465,6 +587,7 @@ function usage # make sure we use the ksh93 builtin versions builtin basename builtin cat +builtin mkfifo typeset -A rsstok_cb # callbacks for xml_tok rsstok_cb["tag_begin"]="handle_rss" @@ -488,11 +611,14 @@ bookmark_urls=( ["google_blogs_ksh"]="http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&q=(%22ksh93%22%7C%22ksh+93%22+%7C+%22korn93%22+%7C+%22korn+93%22)&ie=utf-8&num=100&output=rss" # OpenSolaris.org sites ["ksh93_integration"]="http://www.opensolaris.org/rss/os/project/ksh93-integration/announcements/rss2.xml" + ["ksh93_integration_ssl"]="https://www.opensolaris.org/rss/os/project/ksh93-integration/announcements/rss2.xml" ["shell"]="http://www.opensolaris.org/rss/os/project/shell/announcements/rss2.xml" ["systemz"]="http://www.opensolaris.org/rss/os/project/systemz/announcements/rss2.xml" + ["systemz_ssl"]="https://www.opensolaris.org/rss/os/project/systemz/announcements/rss2.xml" # some Sun staff/sites ["blogs_sun_com"]="http://blogs.sun.com/main/feed/entries/rss" ["bigadmin"]="http://www.sun.com/bigadmin/content/rss/motd.xml" + ["bigadmin_scripts"]="https://www.sun.com/bigadmin/content/rss/scripts.xml" ["jmcp"]="http://www.jmcp.homeunix.com/roller/jmcp/feed/entries/rss" ["katakai"]="http://blogs.sun.com/katakai/feed/entries/rss" ["alanc"]="http://blogs.sun.com/alanc/feed/entries/rss" @@ -502,12 +628,13 @@ bookmark_urls=( ["theregister_uk"]="http://www.theregister.co.uk/headlines.rss" ["heise"]="http://www.heise.de/newsticker/heise.rdf" ["slashdot"]="http://rss.slashdot.org/Slashdot/slashdot" + ["wikipedia_command_shells"]="http://en.wikipedia.org/w/index.php?title=Comparison_of_command_shells&feed=rss&action=history" ) typeset progname="${ basename "${0}" ; }" typeset -r rssread_usage=$'+ -[-?\n@(#)\$Id: rssread (Roland Mainz) 2008-11-10 \$\n] +[-?\n@(#)\$Id: rssread (Roland Mainz) 2009-08-14 \$\n] [-author?Roland Mainz <roland.mainz@sun.com>] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [+NAME?rssread - fetch RSS messages and convert them to plain text] diff --git a/usr/src/lib/libshell/common/scripts/shircbot.sh b/usr/src/lib/libshell/common/scripts/shircbot.sh index 2ce067ad6c..3c99355222 100644 --- a/usr/src/lib/libshell/common/scripts/shircbot.sh +++ b/usr/src/lib/libshell/common/scripts/shircbot.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -55,7 +55,7 @@ function fatal_error # Definition for a IRC session class typeset -T ircsession_t=( - typeset -C server=( + compound server=( typeset name integer port ) @@ -74,7 +74,7 @@ typeset -T ircsession_t=( _.server.port=$2 _.nick=$3 - redirect {_.fd}<>"/dev/tcp/${_.server.name}/${_.server.port}" + redirect {_.fd}<> "/dev/tcp/${_.server.name}/${_.server.port}" (( $? == 0 )) || { print -n2 $"Could not open server connection." ; return 1 ; } printf "fd=%d\n" _.fd @@ -111,9 +111,7 @@ typeset -T ircsession_t=( linebuf_t serverbuf linebuf_t clientbuf integer fd=${_.fd} - - set -o xtrace - + _.login while ${_.running} ; do @@ -148,13 +146,13 @@ typeset -T ircsession_t=( case "${line}" in ~(El)PING) - typeset -C ping_args=( + compound ping_args=( line="$line" ) _.serverevent_ping "ping_args" ;; ~(El):.*\ PRIVMSG) - typeset -C privmsg_args=( + compound privmsg_args=( typeset line="$line" typeset msguser="${line/~(Elr)([^ ]+) ([^ ]+) ([^ ]+) (.*)/\1}" typeset msgchannel="${line/~(Elr)([^ ]+) ([^ ]+) ([^ ]+) (.*)/\3}" @@ -163,7 +161,7 @@ typeset -T ircsession_t=( _.serverevent_privmsg "privmsg_args" ;; ~(El):.*\ INVITE) - typeset -C invite_args=( + compound invite_args=( typeset line="$line" typeset inviteuser="${line/~(Elr)([^ ]+) ([^ ]+) ([^ ]+) (.*)/\1}" typeset invitenick="${line/~(Elr)([^ ]+) ([^ ]+) ([^ ]+) (.*)/\3}" @@ -270,7 +268,7 @@ builtin sum typeset progname="${ basename "${0}" ; }" typeset -r shircbot_usage=$'+ -[-?\n@(#)\$Id: shircbot (Roland Mainz) 2008-10-31 \$\n] +[-?\n@(#)\$Id: shircbot (Roland Mainz) 2009-09-09 \$\n] [-author?Roland Mainz <roland.mainz@sun.com>] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [+NAME?shircbot - simple IRC bot demo] @@ -282,7 +280,7 @@ typeset -r shircbot_usage=$'+ [+SEE ALSO?\bksh93\b(1)] ' -typeset -C config=( +compound config=( typeset nickname="${LOGNAME}bot" typeset servername="irc.freenode.net" integer port=6667 @@ -306,6 +304,8 @@ if (( ${#config.join_channels[@]} == 0 )) ; then config.join_channels+=( "#opensolaris" ) config.join_channels+=( "#opensolaris-dev" ) config.join_channels+=( "#opensolaris-arc" ) + config.join_channels+=( "#opensolaris-meeting" ) + config.join_channels+=( "#ospkg" ) config.join_channels+=( "#ksh" ) elif [[ "${config.servername}" == ~(E)irc.(sfbay|sweden) ]] ; then config.join_channels+=( "#onnv" ) @@ -344,9 +344,9 @@ function mybot.serverevent_privmsg case "$msg" in ~(Eli)date) - _.send_privmsg "$msgchannel" "$( - ( printf "%(%Y-%m-%d, %Th/%Z)T\n" ) - )" + _.send_privmsg "$msgchannel" "${ + printf "%(%Y-%m-%d, %Th/%Z)T\n" + }" ;; ~(Eli)echo) _.send_privmsg "$msgchannel" "${msg#*echo}" @@ -358,10 +358,10 @@ function mybot.serverevent_privmsg fi ;; ~(Eli)help) - _.send_privmsg "$msgchannel" "$( + _.send_privmsg "$msgchannel" "${ printf "Hello, this is shircbot, written in ksh93 (%s). " "${.sh.version}" printf "Subcommands are 'say hello', 'math <math-expr>', 'stocks', 'uuid', 'date' and 'echo'." - )" + }" ;; ~(Eli)math) if [[ "${msg}" == ~(E)[\`\$] ]] ; then @@ -371,9 +371,9 @@ function mybot.serverevent_privmsg typeset mathexpr="${msg#*math}" printf "Calculating '%s'\n" "${mathexpr}" - _.send_privmsg "$msgchannel" "$( - ( printf 'export PATH=/usr/$RANDOM/foo ; set -o restricted ; printf "%%s = %%.40g\n" "%s" $(( %s ))\n' "${mathexpr}" "${mathexpr}" | source /dev/stdin 2>&1 ) - )" + _.send_privmsg "$msgchannel" "${ + ( printf 'export PATH=/usr/${RANDOM}/$$/${RANDOM}/foo ; set -o restricted ; printf "%%s = %%.40g\n" "%s" $(( %s ))\n' "${mathexpr}" "${mathexpr}" | source /dev/stdin 2>&1 ) + }" fi ;; ~(Eli)say\ hello) @@ -381,15 +381,15 @@ function mybot.serverevent_privmsg ;; ~(Eli)stocks) typeset stockmsg tickersymbol - for tickersymbol in "JAVA" "IBM" "AAPL" "HPQ" ; do + for tickersymbol in "JAVA" "ORCL" "IBM" "AAPL" "HPQ" ; do stockmsg="$( /usr/sfw/bin/wget -q -O /dev/stdout "http://quote.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&e=.csv&s=${tickersymbol}" 2>&1 )" _.send_privmsg "$msgchannel" "${tickersymbol}: ${stockmsg//,/ }" done ;; ~(Eli)uuid) - _.send_privmsg "$msgchannel" "$( - ( print "%(%Y%M%D%S%N)T$((RANDOM))%s\n" "${msguser}" | sum -x sha256 ) - )" + _.send_privmsg "$msgchannel" "${ + print "%(%Y%M%D%S%N)T$((RANDOM))%s\n" "${msguser}" | sum -x sha256 + }" ;; esac diff --git a/usr/src/lib/libshell/common/scripts/shlint.sh b/usr/src/lib/libshell/common/scripts/shlint.sh index 640fb14837..aea60a4951 100644 --- a/usr/src/lib/libshell/common/scripts/shlint.sh +++ b/usr/src/lib/libshell/common/scripts/shlint.sh @@ -66,7 +66,7 @@ builtin basename typeset progname="${ basename "${0}" ; }" typeset -r shlint_usage=$'+ -[-?\n@(#)\$Id: shlint (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: shlint (Roland Mainz) 2009-03-15 \$\n] [-author?Roland Mainz <roland.mainz@sun.com>] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [+NAME?shlint - lint for POSIX shell scripts] @@ -82,13 +82,15 @@ while getopts -a "${progname}" "${shlint_usage}" OPT ; do done shift $((OPTIND-1)) +(( $# > 0 )) || usage + file="$1" [[ ! -f "$file" ]] && fatal_error $"File ${file} not found." [[ ! -r "$file" ]] && fatal_error $"File ${file} not readable." -x="$( /usr/bin/ksh93 -n "${file}" 2>&1 1>/dev/null )" +x="$( /usr/bin/shcomp -n "${file}" /dev/null 2>&1 1>/dev/null )" -printf "%s" "$x" +printf "%s\n" "$x" [[ "$x" != "" ]] && exit 1 || exit 0 # EOF. diff --git a/usr/src/lib/libshell/common/scripts/shman.sh b/usr/src/lib/libshell/common/scripts/shman.sh index 57e57cec23..56c2e42c12 100644 --- a/usr/src/lib/libshell/common/scripts/shman.sh +++ b/usr/src/lib/libshell/common/scripts/shman.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -174,7 +174,7 @@ function browse_manpage # /usr/bin/man <keyword> function show_manpage { - typeset -a -C mandirs + compound -a mandirs integer i integer j @@ -236,7 +236,7 @@ function show_manpage # /usr/bin/man -l <keyword> function list_manpages { - typeset -a -C mandirs + compound -a mandirs enumerate_mandirs mandirs #debug_print -- "${mandirs[@]}" @@ -320,7 +320,7 @@ builtin date typeset progname="$(basename "${0}")" typeset -r man_usage=$'+ -[-?\n@(#)\$Id: shman (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: shman (Roland Mainz) 2009-06-26 \$\n] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [-author?Roland Mainz <roland.mainz@sun.com>] [+NAME?man - find and display reference manual pages] @@ -372,16 +372,24 @@ shift $((OPTIND-1)) # cd /usr/man; LC_MESSAGES=C /usr/lib/sgml/sgml2roff /usr/man/sman1as/asadmin-list-timers.1as | tbl | eqn | nroff -u0 -Tlp -man - | col -x > /tmp/mpLQaqac -typeset manname="$1" -debug_print -f "# searching for %s ...\n" "${manname}" +# prechecks +(( $# > 0 )) || usage -if ${do_keyword} ; then - list_keywords -elif ${do_list} ; then - list_manpages -else - show_manpage -fi +# process arguments +while (( $# > 0 )) ; do + typeset manname="$1" + shift + + debug_print -f "# searching for %s ...\n" "${manname}" + + if ${do_keyword} ; then + list_keywords + elif ${do_list} ; then + list_manpages + else + show_manpage + fi +done # todo: better exit codes exit 0 diff --git a/usr/src/lib/libshell/common/scripts/shnote.sh b/usr/src/lib/libshell/common/scripts/shnote.sh index 1361feb8a7..b449f257c0 100644 --- a/usr/src/lib/libshell/common/scripts/shnote.sh +++ b/usr/src/lib/libshell/common/scripts/shnote.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -181,11 +181,11 @@ function print_history fi # open history file - redirect {histfd}<>"${history_file}" - (( $? != 0 )) && { print -u2 "Couldn't open history file." ; return 1 ; } + redirect {histfd}<> "${history_file}" + (( $? != 0 )) && { print -u2 "Could not open history file." ; return 1 ; } while read -u${histfd} line ; do - typeset -C rec + compound rec printf "( %s )\n" "${line}" | read -C rec @@ -213,13 +213,13 @@ function put_note_pastebin_ca typeset url_path="/quiet-paste.php?api=${pastebin_ca_key}" typeset url="http://${url_host}${url_path}" integer netfd # http stream number - typeset -C httpresponse + compound httpresponse (( $# != 1 )) && { print -u2 -f $"%s: Wrong number of arguments.\n" "$0" ; return 1 ; } (( ${#1} == 0 )) && { print -u2 -f $"%s: No data.\n" "$0" ; return 1 ; } # argument for "encode_multipart_form_data" - typeset mimeform=( + compound mimeform=( # input typeset boundary typeset -a form @@ -252,8 +252,8 @@ function put_note_pastebin_ca request+="Content-Type: multipart/form-data; boundary=${boundary}\r\n" request+="Content-Length: $(( mimeform.content_length ))\r\n" - redirect {netfd}<>"/dev/tcp/${url_host}/80" - (( $? != 0 )) && { print -u2 -f $"$0: Couldn't open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } + redirect {netfd}<> "/dev/tcp/${url_host}/80" + (( $? != 0 )) && { print -u2 -f $"%s: Could not open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } # send http post { @@ -274,7 +274,7 @@ function put_note_pastebin_ca printf "SUCCESS: http://opensolaris.pastebin.ca/%s\n" "${response_token}" # write history entry - typeset histrec=( + compound histrec=( title="${mimeform.form[0].data}" description="${mimeform.form[3].data}" providertoken="${response_token}" @@ -321,8 +321,8 @@ function get_note_pastebin_ca # I hereby curse Solaris for not having an entry for "http" in /etc/services # open TCP channel - redirect {netfd}<>"/dev/tcp/${url_host}/80" - (( $? != 0 )) && { print -u2 -f $"%s: Couldn't open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } + redirect {netfd}<> "/dev/tcp/${url_host}/80" + (( $? != 0 )) && { print -u2 -f $"%s: Could not open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } # send HTTP request request="GET ${url_path} HTTP/1.1\r\n" @@ -359,14 +359,14 @@ builtin uname typeset progname="${ basename "${0}" ; }" # HTTP protocol client identifer -typeset -r http_user_agent="shnote/ksh93 (2008-10-14; $(uname -s -r -p))" +typeset -r http_user_agent="shnote/ksh93 (2009-05-09; $(uname -s -r -p))" # name of history log (the number after "history" is some kind of version # counter to handle incompatible changes to the history file format) typeset -r history_file="${HOME}/.shnote/history0.txt" typeset -r shnote_usage=$'+ -[-?\n@(#)\$Id: shnote (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: shnote (Roland Mainz) 2009-05-09 \$\n] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [+NAME?shnote - read/write text data to internet clipboards] [+DESCRIPTION?\bshnote\b is a small utilty which can read and write text diff --git a/usr/src/lib/libshell/common/scripts/shpiano.sh b/usr/src/lib/libshell/common/scripts/shpiano.sh index 4690fee5ed..e20813a75a 100644 --- a/usr/src/lib/libshell/common/scripts/shpiano.sh +++ b/usr/src/lib/libshell/common/scripts/shpiano.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -58,7 +58,7 @@ function beep # array which holds frequency and sample data # (the data are created on demand, "sample_set" indicates whether the "sample" variable # needs to be filled or not) -typeset -A tones=( +compound -A tones=( ["C3"]=( float freq=261.63 ; typeset sample_set="false" ; typeset -b sample ) ["C#3"]=( float freq=277.18 ; typeset sample_set="false" ; typeset -b sample ) ["D3"]=( float freq=293.66 ; typeset sample_set="false" ; typeset -b sample ) @@ -91,7 +91,7 @@ typeset -A tones=( # alias table which translates the various names of "notes" to the matching entry # in the "tones" table -typeset -r -A notes=( +compound -r -A notes=( ["C3"]=( val=tones["C3"] ) ["key_d"]=( val=tones["C3"] ) ["C#3"]=( val=tones["C#3"] ) ["key_r"]=( val=tones["C#3"] ) ["D3"]=( val=tones["D3"] ) ["key_f"]=( val=tones["D3"] ) @@ -1278,18 +1278,24 @@ builtin basename typeset progname="${ basename "${0}" ; }" typeset -r shpiano_usage=$'+ -[-?\n@(#)\$Id: shpiano (Roland Mainz) 2008-11-03 \$\n] +[-?\n@(#)\$Id: shpiano (Roland Mainz) 2009-05-09 \$\n] [-author?Roland Mainz <roland.mainz@nrubsig.org>] +[-author?Valeria Elisabeth Mainz <valeria.mainz@no.such.email.toddler>] [+NAME?shpiano - simple audio demo] [+DESCRIPTION?\bshpiano\b is a small demo application which converts keyboard input into 8bit Mu-law audio samples which are send to /dev/audio.] +[b:babymode?Mode to entertain toddlers. Plays a sound for any key + and ignores SIGINT. Requires ESC to quit the application.] [+SEE ALSO?\bksh93\b(1), \bau\b(4), \baudio\b(7i)] ' +typeset babymode=false while getopts -a "${progname}" "${shpiano_usage}" OPT ; do # printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" case ${OPT} in + b) babymode=true ;; + +b) babymode=false ;; *) usage ;; esac done @@ -1304,19 +1310,30 @@ float w # temporary "wave" value integer i integer audiofd # audio device file descriptor typeset key -typeset audio=( typeset -i currpos=0 ; typeset -a -i data=( [0]=0 ) ) # stack object +compound audio=( integer currpos=0 ; integer -a data=( [0]=0 ) ) # stack object clear print_piano_layout +if ${babymode} ; then + [[ -x /usr/bin/banner ]] || fatal_error "-n requires /usr/bin/banner" + + typeset lastkeys + + nameref curr_note=tones["A#4"] + (( freq=curr_note.freq )) + + trap "" INT +fi + if [[ "${AUDIODEV}" == "" ]] ; then AUDIODEV="/dev/audio" fi -print -u2 -f $"Playing sound to device\n" "${AUDIODEV}" +print -u2 -f $"Playing sound to device %s\n" "${AUDIODEV}" # open channel to audio device -redirect {audiofd}<>"${AUDIODEV}" -(( $? != 0 )) && fatal_error $"Couldn't open audio device." +redirect {audiofd}<> "${AUDIODEV}" +(( $? != 0 )) && fatal_error $"Could not open audio device." # build pause sample stack_init audio @@ -1332,20 +1349,32 @@ typeset -b au_header=${ bytearraytobase64 audio.data ; } # begin playing printf "%B" au_header >&${audiofd} + # warning: the math used here is so wrong that your head may # explode when you continue reading this while read -r -N 1 key?$'\r > ' ; do - if [[ ${key} == ~(E)($'\E'|'q'|'Q') ]] ; then + if [[ ${key} == $'\E' ]] || [[ ${babymode} != "true" && ${key} == ~(E)($'\E'|'q'|'Q') ]] ; then break # quit fi printf "\r" - if [[ -z "${notes[key_${key}]}" ]] ; then - nameref curr_note=tones["p"] - (( freq=1.*(1./duration) )) - else + if [[ -v notes[key_${key}] ]] ; then nameref curr_note="${notes[key_${key}].val}" (( freq=curr_note.freq )) + else + if ${babymode} ; then + nameref curr_note=tones["A#4"] + (( freq=curr_note.freq )) + else + nameref curr_note=tones["p"] + (( freq=1.*(1./duration) )) + fi + fi + + # babymode: print "keys" to screen via /usr/bin/banner + if ${babymode} ; then + lastkeys="${lastkeys/~(Er).*(........)/\1}${key}" + banner "${lastkeys}" fi # printf "note=%s sample_rate=%f, freq=%f\n" "${!curr_note}" sample_rate freq >&2 diff --git a/usr/src/lib/libshell/common/scripts/shtinyurl.sh b/usr/src/lib/libshell/common/scripts/shtinyurl.sh index 1d3e70bf67..fb18627081 100644 --- a/usr/src/lib/libshell/common/scripts/shtinyurl.sh +++ b/usr/src/lib/libshell/common/scripts/shtinyurl.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -112,7 +112,7 @@ function request_tinyurl typeset url="http://${url_host}${url_path}" integer netfd # http stream number typeset inputurl="$1" - typeset -C httpresponse # http response + compound httpresponse # http response typeset request="" # we assume "inputurl" is a correctly encoded URL which doesn't @@ -124,8 +124,8 @@ function request_tinyurl request+="User-Agent: ${http_user_agent}\r\n" request+="Connection: close\r\n" - redirect {netfd}<>"/dev/tcp/${url_host}/80" - (( $? != 0 )) && { print -u2 -f $"%s: Couldn't open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } + redirect {netfd}<> "/dev/tcp/${url_host}/80" + (( $? != 0 )) && { print -u2 -f $"%s: Could not open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } # send http post { @@ -150,6 +150,53 @@ function request_tinyurl # not reached } +function request_trimurl +{ + # site setup + typeset url_host="api.tr.im" + typeset url_path="/api/trim_url.xml" + typeset url="http://${url_host}${url_path}" + integer netfd # http stream number + typeset inputurl="$1" + compound httpresponse # http response + typeset request="" + + # we assume "inputurl" is a correctly encoded URL which doesn't + # require any further mangling + url_path+="?url=${inputurl}" + + request="GET ${url_path} HTTP/1.1\r\n" + request+="Host: ${url_host}\r\n" + request+="User-Agent: ${http_user_agent}\r\n" + request+="Connection: close\r\n" + + redirect {netfd}<> "/dev/tcp/${url_host}/80" + (( $? != 0 )) && { print -u2 -f $"%s: Could not open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } + + # send http post + { + print -n -- "${request}\r\n" + } >&${netfd} + + # process reply + parse_http_response httpresponse <&${netfd} + response="${ cat_http_body "${httpresponse.transfer_encoding}" <&${netfd} ; }" + + # close connection + redirect {netfd}<&- + + if (( httpresponse.statuscode >= 200 && httpresponse.statuscode <= 299 )) ; then + # the statement below should really parse the XML... + print -r -- "${response/~(Elr).*(\<url\>)(.*)(\<\/url\>).*/\2}" + return 0 + else + print -u2 -f $"tr.im response was (%s,%s):\n%s\n" "${httpresponse.statuscode}" "${httpresponse.statusmsg}" "${response}" + return 1 + fi + + # not reached +} + function usage { OPTIND=0 @@ -166,37 +213,54 @@ builtin uname typeset progname="${ basename "${0}" ; }" # HTTP protocol client identifer -typeset -r http_user_agent="shtinyurl/ksh93 (2008-10-14; ${ uname -s -r -p ; })" +typeset -r http_user_agent="shtinyurl/ksh93 (2009-08-12; ${ uname -s -r -p ; })" typeset -r shtinyurl_usage=$'+ -[-?\n@(#)\$Id: shtinyurl (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: shtinyurl (Roland Mainz) 2009-08-12 \$\n] [-author?Roland Mainz <roland.mainz@nrubsig.org>] -[+NAME?shtinyurl - create short tinyurl.com alias URL from long URL] +[+NAME?shtinyurl - create short alias URL from long URL] [+DESCRIPTION?\bshtinyurl\b is a small utility which passes a given URL - to the tinyurl.com service which creates short aliases in the - form of http://tinyurl.com/XXXXXXXX to redirect long URLs.] + to internet service which creates short aliases in the + form of http://<servicename>/XXXXXXXX to redirect long URLs.] [+?The first arg \burl\b describes a long URL which is transformed into a tinyurl.com short alias.] +[P:provider?Service provider (either \'tinyurl.com\' or \'tr.im\').]:[mode] url -[+SEE ALSO?\bksh93\b(1), \brssread\b(1), \bshtwitter\b(1), http://www.tinyurl.com] +[+SEE ALSO?\bksh93\b(1), \brssread\b(1), \bshtwitter\b(1), http://www.tinyurl.com, http://tr.im] ' +typeset service_provider="tr.im" + while getopts -a "${progname}" "${shtinyurl_usage}" OPT ; do # printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" case ${OPT} in + P) service_provider="${OPTARG}" ;; *) usage ;; esac done shift $((OPTIND-1)) # expecting at least one more argument -(($# >= 1)) || usage +(( $# >= 1 )) || usage typeset url="$1" shift -request_tinyurl "${url}" -exit $? +case "${service_provider}" in + "tinyurl.com") + request_tinyurl "${url}" + exit $? + ;; + "tr.im") + request_trimurl "${url}" + exit $? + ;; + *) + fatal_error "Unsupported service provider." +esac + +# not reached + # EOF. diff --git a/usr/src/lib/libshell/common/scripts/shtwitter.sh b/usr/src/lib/libshell/common/scripts/shtwitter.sh index 9eca33bcbd..c7672dde6c 100644 --- a/usr/src/lib/libshell/common/scripts/shtwitter.sh +++ b/usr/src/lib/libshell/common/scripts/shtwitter.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -192,12 +192,14 @@ function put_twitter_message typeset url="http://${url_host}${url_path}" integer netfd # http stream number typeset msgtext="$1" - typeset -C httpresponse # http response + compound httpresponse # http response # argument for "encode_x_www_form_urlencoded" - typeset urlform=( + compound urlform=( # input - typeset -a form + compound -a form=( + ( name="status" data="${msgtext}" ) + ) # output typeset content integer content_length @@ -206,10 +208,6 @@ function put_twitter_message typeset request="" typeset content="" - urlform.form=( - ( name="status" data="${msgtext}" ) - ) - encode_x_www_form_urlencoded urlform content="${urlform.content}" @@ -222,7 +220,7 @@ function put_twitter_message request+="Content-Type: application/x-www-form-urlencoded\r\n" request+="Content-Length: $(( urlform.content_length ))\r\n" - redirect {netfd}<>"/dev/tcp/${url_host}/80" + redirect {netfd}<> "/dev/tcp/${url_host}/80" (( $? != 0 )) && { print -u2 -f "%s: Could not open connection to %s\n." "$0" "${url_host}" ; return 1 ; } # send http post @@ -261,7 +259,7 @@ function verify_twitter_credentials typeset url_path="/account/verify_credentials.xml" typeset url="http://${url_host}${url_path}" integer netfd # http stream number - typeset -C httpresponse # http response + compound httpresponse # http response typeset request="" @@ -273,7 +271,7 @@ function verify_twitter_credentials request+="Content-Type: application/x-www-form-urlencoded\r\n" request+="Content-Length: 0\r\n" # dummy - redirect {netfd}<>"/dev/tcp/${url_host}/80" + redirect {netfd}<> "/dev/tcp/${url_host}/80" (( $? != 0 )) && { print -u2 -f $"%s: Could not open connection to %s.\n" "$0" "${url_host}" ; return 1 ; } # send http post @@ -315,10 +313,10 @@ builtin uname typeset progname="${ basename "${0}" ; }" # HTTP protocol client identifer -typeset -r http_user_agent="shtwitter/ksh93 (2008-10-14; ${ uname -s -r -p ; })" +typeset -r http_user_agent="shtwitter/ksh93 (2009-06-15; ${ uname -s -r -p ; })" typeset -r shtwitter_usage=$'+ -[-?\n@(#)\$Id: shtwitter (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: shtwitter (Roland Mainz) 2009-06-15 \$\n] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [+NAME?shtwitter - read/write text data to internet clipboards] [+DESCRIPTION?\bshtwitter\b is a small utility which can read and write text diff --git a/usr/src/lib/libshell/common/scripts/simplefileattributetree1.sh b/usr/src/lib/libshell/common/scripts/simplefileattributetree1.sh new file mode 100644 index 0000000000..95a36063dc --- /dev/null +++ b/usr/src/lib/libshell/common/scripts/simplefileattributetree1.sh @@ -0,0 +1,273 @@ +#!/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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# simplefileattributetree1 - build a simple file tree (including file attributes) +# + +# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant +export PATH=/usr/xpg6/bin:/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 add_file_to_tree +{ + typeset treename=$1 + typeset filename=$2 + nameref destnodename=$3 + integer i + typeset nodepath # full name of compound variable + typeset -a pe # path elements + + # first built an array containing the names of each path element + # (e.g. "foo/var/baz"" results in an array containing "( 'foo' 'bar' 'baz' )") + typeset IFS='/' + pe+=( ${filename} ) + + [[ ${pe[0]} == '' ]] && pe[0]='/' + + # walk path described via the "pe" array and build nodes if + # there aren't any nodes yet + nodepath="${treename}" + for (( i=0 ; i < (${#pe[@]}-1) ; i++ )) ; do + nameref x="${nodepath}" + [[ ! -v x.node ]] && compound -A x.nodes + + nodepath+=".nodes[${pe[i]}]" + done + + # insert element + nameref node="${nodepath}" + [[ ! -v node.elements ]] && compound -A node.elements + node.elements[${pe[i]}]=( + filepath="${filename}" + ) + + destnodename="${!node}.elements[${pe[i]}]" + + return 0 +} + +function parse_findls +{ + nameref out=$1 + typeset str="$2" + + # find -ls on Solaris uses the following output format by default: + #604302 3 -rw-r--r-- 1 test001 users 2678 May 9 00:46 ./httpsresdump + + integer out.inodenum="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\1}" + integer out.kbblocks="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\2}" + typeset out.mode="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\3}" + integer out.numlinks="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\4}" + compound out.owner=( + typeset user="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\5}" + typeset group="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\6}" + ) + integer out.filesize="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\7}" + typeset out.date="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\8}" + typeset out.filepath="${str/~(Elr)[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]-]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]*[[:space:]]+[[:digit:]]*[[:space:]]+[[:digit:]:]+)[[:space:]]+(.+)/\9}" + + return 0 +} + +function usage +{ + OPTIND=0 + getopts -a "${progname}" "${simplefileattributetree1_usage}" OPT '-?' + exit 2 +} + +# main +builtin basename +builtin dirname + +set -o noglob +set -o nounset + +# tree base +compound filetree + +# benchmark data +compound bench=( + float start + float stop +) + +compound appconfig=( + typeset do_benchmarking=false + compound do_record=( + typeset content=false + typeset filetype=false + ) +) + + +integer i + +typeset progname="${ basename "${0}" ; }" + +typeset -r simplefileattributetree1_usage=$'+ +[-?\n@(#)\$Id: simplefileattributetree1 (Roland Mainz) 2009-06-26 \$\n] +[-author?Roland Mainz <roland.mainz@nrubsig.org>] +[+NAME?simplefileattributetree1 - generate compound variable tree which contains file names and their attributes] +[+DESCRIPTION?\bsimplefileattributetree1\b is a simple variable tree + demo which builds a compound variable tree based on the output + of /usr/xpg4/bin/file which contains the file name, the file attributes + and optionally file type and content] +[b:benchmark?Print time needed to generate the tree.] +[c:includecontent?Include the file\'s content in the tree, split into 1kb blocks.] +[t:includefiletype?Include the file type (output of /usr/xpg4/bin/file).] + +path + +[+SEE ALSO?\bksh93\b(1), \bfile\b(1), \bfind\b(1)] +' + +while getopts -a "${progname}" "${simplefileattributetree1_usage}" OPT ; do +# printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|" + case ${OPT} in + b) appconfig.do_benchmarking="true" ;; + +b) appconfig.do_benchmarking="false" ;; + c) appconfig.do_record.content="true" ;; + +c) appconfig.do_record.content="false" ;; + t) appconfig.do_record.filetype="true" ;; + +t) appconfig.do_record.filetype="false" ;; + *) usage ;; + esac +done +shift $((OPTIND-1)) + + +# argument prechecks +if (( $# == 0 )) ; then + print -u2 -f "%s: Missing <path> argument.\n" "${progname}" + exit 1 +fi + + +print -u2 -f "# reading file names...\n" +while (( $# > 0 )) ; do + # "ulimit -c 0" use used to force ksh93 to use a seperate process for subshells, + # this is used to work around a bug with LC_ALL changes bleeding through subshells + IFS=$'\n' ; typeset -a findls_lines=( $(ulimit -c 0 ; LC_ALL=C find "$1" -type f -ls) ) ; IFS=$' \t\n' + shift +done + + +print -u2 -f "# building tree...\n" + +${appconfig.do_benchmarking} && (( bench.start=SECONDS )) + +for (( i=0 ; i < ${#findls_lines[@]} ; i++ )) ; do + compound parseddata + typeset treenodename + + # parse "find -ls" output + parse_findls parseddata "${findls_lines[i]}" + + # add node to tree and return it's absolute name in "treenodename" + add_file_to_tree filetree "${parseddata.filepath}" treenodename + + # merge parsed "find -ls" output into tree node + nameref treenode="${treenodename}" + treenode+=parseddata + + # extras (calculated from the existing values in "parseddata") + typeset treenode.dirname="${ dirname "${treenode.filepath}" ; }" + typeset treenode.basename="${ basename "${treenode.filepath}" ; }" + + if ${appconfig.do_record.filetype} ; then + # Using /usr/(xpg4/)*/bin/file requires a |fork()|+|exec()| which makes the script a few hundred times slower... ;-( + typeset treenode.filetype="$(file "${treenode.filepath}")" + fi + + if ${appconfig.do_record.content} ; then + if [[ -r "${treenode.filepath}" ]] ; then + # We use an array of compound variables here to support + # files with holes (and later alternative streams, too) + compound -a treenode.content + integer cl=0 + while \ + { + treenode.content[${cl}]=( + typeset type="data" # (todo: "add support for "holes" (sparse files)) + typeset -b bin + ) + read -n1024 treenode.content[${cl}].bin + } ; do + (( cl++ )) + done < "${treenode.filepath}" + unset treenode.content[${cl}] + + typeset -A treenode.hashsum=( + [md5]="$(sum -x md5 < "${treenode.filepath}")" + [sha512]="$(sum -x sha512 < "${treenode.filepath}")" + ) + + # we do this for internal debugging only + if [[ "${ { + integer j + for (( j=0 ; j < ${#treenode.content[@]} ; j++ )) ; do + printf "%B" treenode.content[$j].bin + done + } | sum -x sha512 ; }" != "${treenode.hashsum[sha512]}" ]] ; then + # this should never happen... + print -u2 -f "fatal hash mismatch for %s\n" "${treenode.filepath}" + unset treenode.content treenode.hashsum + fi + fi + fi +done + +${appconfig.do_benchmarking} && (( bench.stop=SECONDS )) + + +if ${appconfig.do_benchmarking} ; then + # print benchmark data + print -u2 -f "# time used: %f\n" $((bench.stop - bench.start)) +fi + +# print variable tree +print -v filetree + +exit 0 +# EOF. diff --git a/usr/src/lib/libshell/common/scripts/simplefiletree1.sh b/usr/src/lib/libshell/common/scripts/simplefiletree1.sh new file mode 100644 index 0000000000..5b79aae8f8 --- /dev/null +++ b/usr/src/lib/libshell/common/scripts/simplefiletree1.sh @@ -0,0 +1,126 @@ +#!/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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# simplefiletree1 - build a simple file tree +# + +# Solaris needs /usr/xpg6/bin:/usr/xpg4/bin because the tools in /usr/bin are not POSIX-conformant +export PATH=/usr/xpg6/bin:/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 add_file_to_tree +{ + typeset treename=$1 + typeset filename=$2 + integer i + typeset nodepath # full name of compound variable + typeset -a pe # path elements + + # first built an array containing the names of each path element + # (e.g. "foo/var/baz"" results in an array containing "( 'foo' 'bar' 'baz' )") + typeset IFS='/' + pe+=( ${filename} ) + + [[ ${pe[0]} == '' ]] && pe[0]='/' + + # walk path described via the "pe" array and build nodes if + # there aren't any nodes yet + nodepath="${treename}" + for (( i=0 ; i < (${#pe[@]}-1) ; i++ )) ; do + nameref x="${nodepath}" + [[ ! -v x.node ]] && compound -A x.nodes + + nodepath+=".nodes[${pe[i]}]" + done + + # insert element + nameref node="${nodepath}" + [[ ! -v node.elements ]] && typeset -a node.elements + node.elements+=( "${pe[i]}" ) + + return 0 +} + +# main +builtin rev + +# tree base +compound filetree + +# benchmark data +compound bench=( + float start + float stop +) + +typeset i + +# argument prechecks +if (( $# == 0 )) ; then + print -u2 -f "%s: Missing <path> argument." "$0" + exit 1 +fi + +print -u2 "# reading file names" +while (( $# > 0 )) ; do + IFS=$'\n' ; typeset -a filenames=( $(find "$1" -type f) ) ; IFS=$' \t\n' + shift +done +print -u2 "# building tree..." + +(( bench.start=SECONDS )) + +for ((i=0 ; i < ${#filenames[@]} ; i++ )) ; do + add_file_to_tree filetree "${filenames[i]}" +done + +(( bench.stop=SECONDS )) + +# print benchmark data +print -u2 -f "# time used: %f\n" $((bench.stop - bench.start)) + +# print tree +print -v filetree + +exit 0 +# EOF. diff --git a/usr/src/lib/libshell/common/scripts/svcproptree1.sh b/usr/src/lib/libshell/common/scripts/svcproptree1.sh index e196fb413a..d3f1ee9742 100644 --- a/usr/src/lib/libshell/common/scripts/svcproptree1.sh +++ b/usr/src/lib/libshell/common/scripts/svcproptree1.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -74,11 +74,11 @@ function svcproptovartree servicename="${servicename/~(El)svc:\//}" # strip "svc:/" propname="${name#~(El).*:properties/}" - if [[ "${tree["${servicename}"].properties[*]}" == "" ]] ; then - typeset -A tree["${servicename}"].properties=( ) + if [[ "$(typeset -p "tree[${servicename}].properties")" == "" ]] ; then + compound -A tree[${servicename}].properties fi - nameref node=tree["${servicename}"].properties["${propname}"] + nameref node=tree[${servicename}].properties[${propname}] node=( typeset datatype="${datatype}" @@ -110,14 +110,14 @@ builtin uname typeset progname="${ basename "${0}" ; }" typeset -r svcproptree1_usage=$'+ -[-?\n@(#)\$Id: svcproptree1 (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: svcproptree1 (Roland Mainz) 2009-06-26 \$\n] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [+NAME?svcproptree1 - SMF tree demo] [+DESCRIPTION?\bsvcproptree1\b is a small ksh93 compound variable demo which reads accepts a SMF service pattern name input file, reads the matching service properties and converts them into an internal variable tree representation and outputs it in the format - specified by viewmode (either "list", "namelist" or "tree")..] + specified by viewmode (either "list", "namelist", "tree" or "compacttree")..] pattern viewmode @@ -135,11 +135,11 @@ shift $((OPTIND-1)) typeset svcpattern="$1" typeset viewmode="$2" -if [[ "${viewmode}" != ~(Elr)(list|namelist|tree) ]] ; then +if [[ "${viewmode}" != ~(Elr)(list|namelist|tree|compacttree) ]] ; then fatal_error $"Invalid view mode \"${viewmode}\"." fi -typeset svc=( +compound svc=( typeset -A proptree ) @@ -159,7 +159,10 @@ case "${viewmode}" in typeset + | egrep "^svc.proptree\[" ;; tree) - printf "%B\n" svc + print -v svc + ;; + compacttree) + print -C svc ;; *) fatal_error $"Invalid view mode \"${viewmode}\"." diff --git a/usr/src/lib/libshell/common/scripts/termclock.sh b/usr/src/lib/libshell/common/scripts/termclock.sh index edcadd4e10..582e70ad62 100644 --- a/usr/src/lib/libshell/common/scripts/termclock.sh +++ b/usr/src/lib/libshell/common/scripts/termclock.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -193,7 +193,7 @@ function main_loop 6<#((0)) cat <&6 - redirect 6<&- ; rm -f "${scratchfile}" ; redirect 6<>"${scratchfile}" + redirect 6<&- ; rm -f "${scratchfile}" ; redirect 6<> "${scratchfile}" c="" ; read -r -t ${update_interval} -N 1 c if [[ "$c" != "" ]] ; then @@ -221,6 +221,7 @@ function usage builtin basename builtin cat builtin date +builtin mktemp builtin rm typeset progname="${ basename "${0}" ; }" @@ -228,14 +229,14 @@ typeset progname="${ basename "${0}" ; }" float -r M_PI=3.14159265358979323846 # terminal size rect -typeset -C termsize=( +compound termsize=( integer columns=-1 integer lines=-1 ) typeset init_screen="true" -typeset -C clock=( +compound clock=( float middle_x float middle_y integer len_x @@ -244,17 +245,17 @@ typeset -C clock=( # set clock properties -typeset -C seconds=( +compound seconds=( float val typeset ch float scale integer length ) -typeset -C minutes=( +compound minutes=( float val typeset ch float scale integer length ) -typeset -C hours=( +compound hours=( float val typeset ch float scale @@ -267,7 +268,7 @@ hours.length=50 hours.scale=12 hours.ch=$"h" float update_interval=0.9 typeset -r termclock_usage=$'+ -[-?\n@(#)\$Id: termclock (Roland Mainz) 2008-11-04 \$\n] +[-?\n@(#)\$Id: termclock (Roland Mainz) 2009-05-09 \$\n] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [-author?David Korn <dgk@research.att.com>] [+NAME?termclock - analog clock for terminals] @@ -290,7 +291,6 @@ shift $((OPTIND-1)) # prechecks which tput >/dev/null || fatal_error $"tput not found." -which mktemp >/dev/null || fatal_error $"mktemp not found." (( update_interval >= 0. && update_interval <= 7200. )) || fatal_error $"invalid update_interval value." # create temporary file for double-buffering and register an EXIT trap @@ -298,7 +298,7 @@ which mktemp >/dev/null || fatal_error $"mktemp not found." scratchfile="${ mktemp "/tmp/termclock.ppid${PPID}_pid$$.XXXXXX" ; }" [[ "${scratchfile}" != "" ]] || fatal_error $"Could not create temporary file name." trap 'rm -f "${scratchfile}"' EXIT -rm -f "${scratchfile}" ; redirect 6<>"${scratchfile}" || fatal_error $"Could not create temporary file." +rm -f "${scratchfile}" ; redirect 6<> "${scratchfile}" || fatal_error $"Could not create temporary file." # register trap to handle window size changes trap 'init_screen="true"' WINCH diff --git a/usr/src/lib/libshell/common/scripts/test_net_sctp.sh b/usr/src/lib/libshell/common/scripts/test_net_sctp.sh index a17aaba62f..92b805f2dd 100644 --- a/usr/src/lib/libshell/common/scripts/test_net_sctp.sh +++ b/usr/src/lib/libshell/common/scripts/test_net_sctp.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -44,13 +44,13 @@ print "# testing SCTP support" print "# (via fetching the main page of http://www.sctp.org/ via SCTP)" # open sctp stream and print it's number -redirect {netfd}<>/dev/sctp/www.sctp.org/80 +redirect {netfd}<> /dev/sctp/www.sctp.org/80 print "sctp fd=${netfd}" # send HTTP request request="GET / HTTP/1.1\r\n" request+="Host: www.sctp.org\r\n" -request+="User-Agent: ksh93/test_net_sctp (2008-10-14; $(uname -s -r -p))\r\n" +request+="User-Agent: ksh93/test_net_sctp (2009-04-08; $(uname -s -r -p))\r\n" request+="Connection: close\r\n" print -u${netfd} -n -- "${request}\r\n" diff --git a/usr/src/lib/libshell/common/scripts/xmldocumenttree1.sh b/usr/src/lib/libshell/common/scripts/xmldocumenttree1.sh index ab6517f372..9bb25b855a 100644 --- a/usr/src/lib/libshell/common/scripts/xmldocumenttree1.sh +++ b/usr/src/lib/libshell/common/scripts/xmldocumenttree1.sh @@ -22,7 +22,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -106,8 +106,8 @@ function handle_document nodepath[${nodesnum}]+=( typeset tagtype="element" typeset tagname="${tag_value}" - typeset -A tagattributes=( ) - typeset -A nodes=( ) + compound -A tagattributes + compound -A nodes integer nodesnum=0 ) @@ -268,13 +268,13 @@ builtin uname typeset progname="${ basename "${0}" ; }" typeset -r xmldocumenttree1_usage=$'+ -[-?\n@(#)\$Id: xmldocumenttree1 (Roland Mainz) 2008-10-14 \$\n] +[-?\n@(#)\$Id: xmldocumenttree1 (Roland Mainz) 2009-05-09 \$\n] [-author?Roland Mainz <roland.mainz@nrubsig.org>] [+NAME?xmldocumenttree1 - XML tree demo] [+DESCRIPTION?\bxmldocumenttree\b is a small ksh93 compound variable demo which reads a XML input file, converts it into an internal variable tree representation and outputs it in the format - specified by viewmode (either "list", "namelist" or "tree").] + specified by viewmode (either "list", "namelist", "tree" or "compacttree").] file viewmode @@ -296,15 +296,15 @@ if [[ "${xmlfile}" == "" ]] ; then fatal_error $"No file given." fi -if [[ "${viewmode}" != ~(Elr)(list|namelist|tree) ]] ; then +if [[ "${viewmode}" != ~(Elr)(list|namelist|tree|compacttree) ]] ; then fatal_error $"Invalid view mode \"${viewmode}\"." fi -typeset -C xdoc -typeset -A xdoc.nodes +compound xdoc +compound -A xdoc.nodes integer xdoc.nodesnum=0 -typeset -C stack +compound stack typeset -a stack.items=( [0]="doc.nodes" ) integer stack.pos=0 @@ -343,7 +343,10 @@ case "${viewmode}" in typeset + | egrep "xdoc.*(tagname|tagtype|tagval|tagattributes)" ;; tree) - print -- "${xdoc}" + print -v xdoc + ;; + compacttree) + print -C xdoc ;; *) fatal_error $"Invalid view mode \"${viewmode}\"." diff --git a/usr/src/lib/libshell/common/sh.1 b/usr/src/lib/libshell/common/sh.1 index 4ebbb41a31..365b11fd5c 100644 --- a/usr/src/lib/libshell/common/sh.1 +++ b/usr/src/lib/libshell/common/sh.1 @@ -4,6 +4,7 @@ .\" .\" @(#)sh.1 (dgk@research.att.com) 12/28/93 .\" +.xx labels=5 .nr Z 1 \" set to 1 when command name is ksh, 2 for ksh93 .ds OK [\| .ds CK \|] @@ -20,15 +21,14 @@ .\} .SH NAME .if \nZ=0 \{\ -sh, rsh, pfsh \- shell, the +sh, rsh, pfsh \- shell, the standard/restricted command and programming language .\} .if \nZ=1 \{\ -ksh, rksh, pfksh \- KornShell, a +ksh, rksh, pfksh \- KornShell, a standard/restricted command and programming language .\} .if \nZ=2 \{\ -ksh93, rksh93, pfksh93 \- KornShell, a +ksh93, rksh93, pfksh93 \- KornShell, a standard/restricted command and programming language .\} -standard/restricted command and programming language .SH SYNOPSIS .if \nZ=0 \{\ .B sh @@ -699,7 +699,7 @@ current ones provided that the types are compatible. The right hand side of a variable assignment undergoes all the expansion list below except word splitting, brace expansion, and file name generation. When the left hand side is an assignment is a compound variable and -the right hand is the name of a compound variable, the coumpound variable +the right hand is the name of a compound variable, the compound variable on the right will be copied or appended to the compound variable on the left. .SS Comments. .PD 0 @@ -765,6 +765,8 @@ but can be unset or redefined: .TP .B "command=\(fmcommand \(fm" .TP +.B "compound=\(fmtypeset \-C\(fm" +.TP .B "fc=hist" .TP .B "float=\(fmtypeset \-lE\(fm" @@ -945,6 +947,14 @@ is a UNIX so programs that expect to .IR lseek (2) on the file will not work. +.PP +Process substitution of the form +\f3<(\fP\f2list\^\fP\f3)\fP +can also be used with the +.B < +redirection operator which causes the output of +.I list\^ +to be standard input or the input for whatever file descriptor is specified. .SS Parameter Expansion. A .I parameter\^ @@ -1179,7 +1189,7 @@ elements between .I sub1\^ and .I sub2\^ -inclusive (or all elments for +inclusive (or all elements for .B \(** and .BR @ ) @@ -1916,6 +1926,12 @@ then two adjacent characters delimit a null field. .TP .B +.SM JOBMAX +This variable defines the maximum number running background jobs +that can run at a time. When this limit is reached, the +shell will wait for a job to complete before staring a new job. +.TP +.B .SM LANG This variable determines the locale category for any category not specifically selected with a variable @@ -2856,8 +2872,8 @@ can be used within an arithmetic expression: .PP .if t .RS .B -.if n abs acos acosh asin asinh atan atan2 atanh cbrt copysign cos cosh erf erfc exp exp2 expm1 fabs fdim finite floor fma fmax fmod hypot ilogb int isinf isnan lgamma log log2 logb nearbyint nextafter nexttoward pow remainder rint round sin sinh sqrt tan tanh tgamma trunc -.if t abs acos acosh asin asinh atan atan2 atanh cbrt copysign cos cosh erf erfc exp exp2 expm1 fabs fdim finite floor fma fmax fmod hypot ilogb int isinf isnan lgamma log log2 logb nearbyint nextafter nexttoward pow rint round sin sinh sqrt tan tanh tgamma trunc +.if n abs acos acosh asin asinh atan atan2 atanh cbrt copysign cos cosh erf erfc exp exp2 expm1 fabs fdim finite floor fma fmax fmod hypot ilogb int isinf isnan j0 j1 jn lgamma log log2 logb nearbyint nextafter nexttoward pow remainder rint round sin sinh sqrt tan tanh tgamma trunc y0 y1 yn +.if t abs acos acosh asin asinh atan atan2 atanh cbrt copysign cos cosh erf erfc exp exp2 expm1 fabs fdim finite floor fma fmax fmod j0 j1 jn hypot ilogb int isinf isnan lgamma log log2 logb nearbyint nextafter nexttoward pow rint round sin sinh sqrt tan tanh tgamma trunc y0 y1 yn .if t .RE .PP An internal representation of a @@ -3305,6 +3321,16 @@ except that it overrides the .B noclobber option. .TP +.BI >; word +Write output to a temporary file. If the command completes +successfully rename it to +.IR word , +otherwise, delete the temporary file. +.BI >; word +cannot be used with the +.IR exec (2). +built-in. +.TP .BI >> word Use file .I word\^ @@ -3316,7 +3342,18 @@ otherwise, the file is created. Open file .I word\^ for reading and writing -as standard input. +as standard output. +.TP +.BI <>; word +The same as +.BI <> word +except that if the command completes successfully, +.I word\^ +is truncated to the offset at command completion. +.BI <>; word +cannot be used with the +.IR exec (2). +built-in. .TP \f3<<\fP\*(OK\f3\-\fP\*(CK\f2word\fP The shell input is read up to a line that is the same as @@ -5772,7 +5809,7 @@ The pathname is used for each of the parameters that requires .IR pathname . .TP -\f3getopts\fP \*(OK \f3\ -a\fP \f2name\^\fP \*(CK \f2optstring vname\^\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK +\f3getopts\fP \*(OK \f3\ \-a\fP \f2name\^\fP \*(CK \f2optstring vname\^\fP \*(OK \f2arg\^\fP .\|.\|. \*(CK Checks .I arg for legal options. @@ -6038,7 +6075,7 @@ Equivalent to .BI "exec /bin/newgrp" " arg\^" \&.\|.\|.\^. .TP -\f3print\fP \*(OK \f3\-Renprs\^\fP \*(CK \*(OK \f3\-u\fP \f2unit\^\fP\*(CK \*(OK \f3\-f\fP \f2format\^\fP \*(CK \*(OK \f2arg\^\fP .\|.\|. \*(CK +\f3print\fP \*(OK \f3\-CRenprsv\^\fP \*(CK \*(OK \f3\-u\fP \f2unit\^\fP\*(CK \*(OK \f3\-f\fP \f2format\^\fP \*(CK \*(OK \f2arg\^\fP .\|.\|. \*(CK With no options or with option .B \- or @@ -6060,9 +6097,11 @@ In this case, any options are ignored. Otherwise, unless the -.B \-R -or +.BR \-C , +.BR \-R , .BR \-r , +or +.B \-v are specified, the following escape conventions will be applied: .RS @@ -6133,6 +6172,24 @@ of the process spawned with .B \(bv& instead of standard output. The +.B \-v +option treats each +.I arg\^ +as a variable name and writes the value in +the +.B printf +.B %B +format. +The +.B \-C +option treats each +.I arg\^ +as a variable name and writes the value in +the +.B printf +.B %#B +format. +The .B \-s option causes the arguments to be written onto the history file @@ -6164,8 +6221,10 @@ format specifications, the .B format\^ string is reused to format remaining arguments. The following extensions can also be used: -.BL -.LI +.RS +.PD 0 +.TP +.B %b A .B %b format can be used instead of @@ -6174,16 +6233,21 @@ to cause escape sequences in the corresponding .I arg\^ to be expanded as described in .BR print. -.LI +.TP +.B %B A .B %B option causes each of the arguments to be treated as variable names and the binary value of variable will be printed. -This is most useful for variables whose attribute +The alternate flag +.B # +causes a compound variable to be output on a single line. +This is most useful for compound variables and variables whose attribute is .BR \-b . -.LI +.TP +.B %H A .B %H format can be used instead of @@ -6192,7 +6256,8 @@ to cause characters in .I arg\^ that are special in HTML and XML to be output as their entity name. -.LI +.TP +.B %P A .B %P format can be used instead of @@ -6201,7 +6266,8 @@ to cause .I arg\^ to be interpreted as an extended regular expression and be printed as a shell pattern. -.LI +.TP +.B %R A .B %R format can be used instead of @@ -6210,14 +6276,16 @@ to cause .I arg\^ to be interpreted as a shell pattern and to be printed as an extended regular expression. -.LI +.TP +.B %q A .B %q format can be used instead of .B %s to cause the resulting string to be quoted in a manner than can be reinput to the shell. -.LI +.TP +.BI %( date-format )T A .BI %( date-format )T format can be use to treat an argument as a date/time string @@ -6226,11 +6294,13 @@ and to format the date/time according to the as defined for the .BR date (1) command. -.LI +.TP +.B %Z A .B %Z format will output a byte whose value is 0. -.LI +.TP +.B %d The precision field of the .B %d format can be followed by a @@ -6241,7 +6311,8 @@ In this case, the flag character causes .IB base # to be prepended. -.LI +.TP +.B # The .B # flag when used with the @@ -6250,7 +6321,6 @@ specifier without an output base, causes the output to be displayed in thousands units with one of the suffixes .B "k M G T P E" to indicate the unit. -.LI The .B # flag when used with the @@ -6258,11 +6328,14 @@ flag when used with the specifier causes the output to be displayed in 1024 with one of the suffixes .B "Ki Mi Gi Ti Pi Ei" to indicate the unit. -.LI +.TP +.B = The .B = flag has been added to center the output within the specified field width. -.LE +.PD +.PP +.RE .TP \f3pwd\fP \*(OK \f3\-LP\fP \*(CK Outputs the value of the current working @@ -6881,6 +6954,18 @@ The command with no arguments prints a list of commands associated with each signal number. +.PP +An +.B exit +or +.B return +without an argument in a trap action will +preserve the exit status of the command that invoked the trap. +.TP +\f3true\fP +Does nothing, and exits 0. Used with +.B while +for infinite loops. .TP \f3true\fP Does nothing, and exits 0. Used with @@ -7122,7 +7207,7 @@ This is usually used to reference a variable inside a function whose name has been passed as an argument. .TP .B \-p -The name, attributes and values for the give +The name, attributes and values for the given .IR vname s are written on standard output in a form that can be used as shell input. diff --git a/usr/src/lib/libshell/common/sh/args.c b/usr/src/lib/libshell/common/sh/args.c index 06ae7dbd38..d70e58c048 100644 --- a/usr/src/lib/libshell/common/sh/args.c +++ b/usr/src/lib/libshell/common/sh/args.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -264,8 +264,13 @@ int sh_argopts(int argc,register char *argv[], void *context) ap->kiafile = opt_info.arg; n = 'n'; } - /* FALL THRU */ + /*FALLTHROUGH*/ #endif /* SHOPT_KIA */ +#if SHOPT_REGRESS + goto skip; + case 'I': + continue; +#endif /* SHOPT_REGRESS */ skip: default: if(cp=strchr(optksh,n)) @@ -384,9 +389,9 @@ void sh_applyopts(Shell_t* shp,Shopt_t newflags) off_option(&newflags,SH_NOEXEC); if(is_option(&newflags,SH_PRIVILEGED)) on_option(&newflags,SH_NOUSRPROFILE); - if(is_option(&newflags,SH_PRIVILEGED) != sh_isoption(SH_PRIVILEGED)) + if(!sh_isstate(SH_INIT) && is_option(&newflags,SH_PRIVILEGED) != sh_isoption(SH_PRIVILEGED) || sh_isstate(SH_INIT) && is_option(&((Arg_t*)shp->arg_context)->sh->offoptions,SH_PRIVILEGED) && shp->userid!=shp->euserid) { - if(sh_isoption(SH_PRIVILEGED)) + if(!is_option(&newflags,SH_PRIVILEGED)) { setuid(shp->userid); setgid(shp->groupid); @@ -789,6 +794,42 @@ static int arg_pipe(register int pv[]) } #endif +struct argnod *sh_argprocsub(Shell_t *shp,struct argnod *argp) +{ + /* argument of the form <(cmd) or >(cmd) */ + register struct argnod *ap; + int monitor, fd, pv[2]; + int subshell = shp->subshell; + ap = (struct argnod*)stkseek(shp->stk,ARGVAL); + ap->argflag |= ARG_MAKE; + ap->argflag &= ~ARG_RAW; + sfwrite(shp->stk,e_devfdNN,8); + sh_pipe(pv); + fd = argp->argflag&ARG_RAW; + sfputr(shp->stk,fmtbase((long)pv[fd],10,0),0); + ap = (struct argnod*)stkfreeze(shp->stk,0); + shp->inpipe = shp->outpipe = 0; + if(monitor = (sh_isstate(SH_MONITOR)!=0)) + sh_offstate(SH_MONITOR); + shp->subshell = 0; + if(fd) + { + shp->inpipe = pv; + sh_exec((Shnode_t*)argp->argchn.ap,(int)sh_isstate(SH_ERREXIT)); + } + else + { + shp->outpipe = pv; + sh_exec((Shnode_t*)argp->argchn.ap,(int)sh_isstate(SH_ERREXIT)); + } + shp->subshell = subshell; + if(monitor) + sh_onstate(SH_MONITOR); + close(pv[1-fd]); + sh_iosave(shp,-pv[fd], shp->topfd, (char*)0); + return(ap); +} + /* Argument expansion */ static int arg_expand(Shell_t *shp,register struct argnod *argp, struct argnod **argchain,int flag) { @@ -797,37 +838,11 @@ static int arg_expand(Shell_t *shp,register struct argnod *argp, struct argnod * #if SHOPT_DEVFD if(*argp->argval==0 && (argp->argflag&ARG_EXP)) { - /* argument of the form (cmd) */ - register struct argnod *ap; - int monitor, fd, pv[2]; - ap = (struct argnod*)stkseek(shp->stk,ARGVAL); - ap->argflag |= ARG_MAKE; - ap->argflag &= ~ARG_RAW; + struct argnod *ap; + ap = sh_argprocsub(shp,argp); ap->argchn.ap = *argchain; *argchain = ap; count++; - sfwrite(shp->stk,e_devfdNN,8); - sh_pipe(pv); - fd = argp->argflag&ARG_RAW; - sfputr(shp->stk,fmtbase((long)pv[fd],10,0),0); - ap = (struct argnod*)stkfreeze(shp->stk,0); - shp->inpipe = shp->outpipe = 0; - if(monitor = (sh_isstate(SH_MONITOR)!=0)) - sh_offstate(SH_MONITOR); - if(fd) - { - shp->inpipe = pv; - sh_exec((Shnode_t*)argp->argchn.ap,(int)sh_isstate(SH_ERREXIT)); - } - else - { - shp->outpipe = pv; - sh_exec((Shnode_t*)argp->argchn.ap,(int)sh_isstate(SH_ERREXIT)); - } - if(monitor) - sh_onstate(SH_MONITOR); - close(pv[1-fd]); - sh_iosave(shp,-pv[fd], shp->topfd, (char*)0); } else #endif /* SHOPT_DEVFD */ diff --git a/usr/src/lib/libshell/common/sh/arith.c b/usr/src/lib/libshell/common/sh/arith.c index f21b79ad6f..bb17fc936d 100644 --- a/usr/src/lib/libshell/common/sh/arith.c +++ b/usr/src/lib/libshell/common/sh/arith.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -25,7 +25,6 @@ */ #include "defs.h" -#include <ctype.h> #include "lexstates.h" #include "name.h" #include "streval.h" @@ -65,6 +64,7 @@ static Namval_t *scope(Shell_t *shp,register Namval_t *np,register struct lval * register Namval_t *mp; int flags = HASH_NOSCOPE|HASH_SCOPE|HASH_BUCKET; Dt_t *sdict = (shp->st.real_fun? shp->st.real_fun->sdict:0); + Dt_t *root = shp->var_tree; assign = assign?NV_ASSIGN:NV_NOASSIGN; if(cp>=lvalue->expr && cp < lvalue->expr+lvalue->elen) { @@ -79,7 +79,11 @@ static Namval_t *scope(Shell_t *shp,register Namval_t *np,register struct lval * cp[flag] = c; return(&FunNode); } - np = nv_open(cp,shp->var_tree,assign|NV_VARNAME); + if(!np && assign) + np = nv_open(cp,shp->var_tree,assign|NV_VARNAME); + if(!np) + return(0); + root = shp->last_root; cp[flag] = c; if(cp[flag+1]=='[') flag++; @@ -87,7 +91,7 @@ static Namval_t *scope(Shell_t *shp,register Namval_t *np,register struct lval * flag = 0; cp = (char*)np; } - if((lvalue->emode&ARITH_COMP) && dtvnext(shp->var_tree) && ((mp=nv_search(cp,shp->var_tree,flags))||(sdict && (mp=nv_search(cp,sdict,flags))))) + if((lvalue->emode&ARITH_COMP) && dtvnext(root) && ((mp=nv_search(cp,root,flags))||(sdict && (mp=nv_search(cp,sdict,flags))))) { while(nv_isref(mp)) { @@ -100,10 +104,7 @@ static Namval_t *scope(Shell_t *shp,register Namval_t *np,register struct lval * { if(!sub) sub = (char*)&lvalue->expr[flag]; - if(((ap=nv_arrayptr(np)) && array_assoc(ap)) || (lvalue->emode&ARITH_COMP)) - nv_endsubscript(np,sub,NV_ADD|NV_SUBQUOTE); - else - nv_putsub(np, NIL(char*),flag); + nv_endsubscript(np,sub,NV_ADD|NV_SUBQUOTE); } return(np); } @@ -239,28 +240,18 @@ static Sfdouble_t arith(const char **ptr, struct lval *lvalue, int type, Sfdoubl if(!np && lvalue->value) break; lvalue->value = (char*)np; - if((lvalue->emode&ARITH_COMP) || (nv_isarray(np) && nv_aindex(np)<0)) - { - /* bind subscript later */ - lvalue->flag = 0; - if(c=='[') - { - lvalue->flag = (str-lvalue->expr); - do - str = nv_endsubscript(np,str,0); - while((c= *str)=='['); - } - break; - } + /* bind subscript later */ + if(nv_isattr(np,NV_DOUBLE)==NV_DOUBLE) + lvalue->isfloat=1; + lvalue->flag = 0; if(c=='[') { + lvalue->flag = (str-lvalue->expr); do - str = nv_endsubscript(np,str,NV_ADD|NV_SUBQUOTE); - while((c=*str)=='['); + str = nv_endsubscript(np,str,0); + while((c= *str)=='['); + break; } - if(nv_isattr(np,NV_DOUBLE)==NV_DOUBLE) - lvalue->isfloat=1; - lvalue->flag = nv_aindex(np); } else { @@ -317,9 +308,19 @@ static Sfdouble_t arith(const char **ptr, struct lval *lvalue, int type, Sfdoubl if(sh_isoption(SH_NOEXEC)) return(0); np = scope(shp,np,lvalue,0); + if(!np) + { + if(sh_isoption(SH_NOUNSET)) + { + *ptr = lvalue->value; + goto skip; + } + return(0); + } if(((lvalue->emode&2) || lvalue->level>1 || sh_isoption(SH_NOUNSET)) && nv_isnull(np) && !nv_isattr(np,NV_INTEGER)) { *ptr = nv_name(np); + skip: lvalue->value = (char*)ERROR_dictionary(e_notset); lvalue->emode |= 010; return(0); diff --git a/usr/src/lib/libshell/common/sh/array.c b/usr/src/lib/libshell/common/sh/array.c index ed46e84738..0346b9fb59 100644 --- a/usr/src/lib/libshell/common/sh/array.c +++ b/usr/src/lib/libshell/common/sh/array.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -189,6 +189,18 @@ static union Value *array_getup(Namval_t *np, Namarr_t *arp, int update) return(up); } +int nv_arrayisset(Namval_t *np, Namarr_t *arp) +{ + register struct index_array *ap = (struct index_array*)arp; + union Value *up; + if(is_associative(ap)) + return((np = nv_opensub(np)) && !nv_isnull(np)); + if(ap->cur >= ap->maxi) + return(0); + up = &(ap->val[ap->cur]); + return(up->cp && up->cp!=Empty); +} + /* * Get the Value pointer for an array. * Delete space as necessary if flag is ARRAY_DELETE @@ -487,7 +499,7 @@ static void array_putval(Namval_t *np, const char *string, int flags, Namfun_t * scan = ap->nelem&ARRAY_SCAN; if(mp && mp!=np) { - if(!is_associative(ap) && string && !nv_type(np) && nv_isvtree(mp)) + if(!is_associative(ap) && string && !(flags&NV_APPEND) && !nv_type(np) && nv_isvtree(mp)) { if(!nv_isattr(np,NV_NOFREE)) _nv_unset(mp,flags&NV_RDONLY); @@ -529,7 +541,7 @@ static void array_putval(Namval_t *np, const char *string, int flags, Namfun_t * ap->nelem--; } } - if(array_elem(ap)==0 && ((ap->nelem&ARRAY_SCAN) || !is_associative(ap))) + if(array_elem(ap)==0 && (ap->nelem&ARRAY_SCAN)) { if(is_associative(ap)) (*ap->fun)(np, NIL(char*), NV_AFREE); @@ -602,12 +614,13 @@ static const Namdisc_t array_disc = static void array_copytree(Namval_t *np, Namval_t *mp) { - char *val; Namfun_t *fp = nv_disc(np,NULL,NV_POP); nv_offattr(np,NV_ARRAY); nv_clone(np,mp,0); + if(np->nvalue.cp && !nv_isattr(np,NV_NOFREE)) + free((void*)np->nvalue.cp); + np->nvalue.cp = 0; np->nvalue.up = &mp->nvalue; - val = sfstruse(sh.strbuf); fp->nofree &= ~1; nv_disc(np,(Namfun_t*)fp, NV_FIRST); fp->nofree |= 1; @@ -662,22 +675,21 @@ static struct index_array *array_grow(Namval_t *np, register struct index_array if(nv_hasdisc(np,&array_disc) || nv_isvtree(np)) { ap->header.table = dtopen(&_Nvdisc,Dtoset); - mp = nv_search("0", ap->header.table, 0); - + mp = nv_search("0", ap->header.table,NV_ADD); if(mp && nv_isnull(mp)) { Namfun_t *fp; ap->val[0].np = mp; array_setbit(ap->bits,0,ARRAY_CHILD); for(fp=np->nvfun; fp && !fp->disc->readf; fp=fp->next); - if(fp) + if(fp && fp->disc && fp->disc->readf) (*fp->disc->readf)(mp,(Sfio_t*)0,0,fp); i++; } } else if((ap->val[0].cp=np->nvalue.cp)) i++; - else if(nv_isattr(np,NV_INTEGER)) + else if(nv_isattr(np,NV_INTEGER) && !nv_isnull(np)) { Sfdouble_t d= nv_getnum(np); i++; @@ -1077,9 +1089,15 @@ char *nv_endsubscript(Namval_t *np, register char *cp, int mode) } if(mode && np) { + Namarr_t *ap = nv_arrayptr(np); + int scan = 0; + if(ap) + scan = ap->nelem&ARRAY_SCAN; if((mode&NV_ASSIGN) && (cp[1]=='=' || cp[1]=='+')) mode |= NV_ADD; nv_putsub(np, sp, ((mode&NV_ADD)?ARRAY_ADD:0)|(cp[1]&&(mode&NV_ADD)?ARRAY_FILL:mode&ARRAY_FILL)); + if(scan) + ap->nelem |= scan; } if(quoted) stakseek(count); @@ -1252,7 +1270,7 @@ void *nv_associative(register Namval_t *np,const char *sp,int mode) else if(ap->header.nelem&ARRAY_NOSCOPE) mode = HASH_NOSCOPE; if(*sp==0 && (mode&NV_ADD)) - sfprintf(sfstderr,"adding empty subscript\n"); + errormsg(SH_DICT,ERROR_warn(0),"adding empty subscript"); if(sh.subshell && (mp=nv_search(sp,ap->header.table,0)) && nv_isnull(mp)) ap->cur = mp; if((mp || (mp=nv_search(sp,ap->header.table,mode))) && nv_isnull(mp) && (mode&NV_ADD)) @@ -1280,7 +1298,9 @@ void *nv_associative(register Namval_t *np,const char *sp,int mode) ap->nextpos = (Namval_t*)dtnext(ap->header.table,mp); } np = mp; - if(ap->pos != np && !(ap->header.nelem&ARRAY_SCAN)) + if(ap->pos && ap->pos==np) + ap->header.nelem |= ARRAY_SCAN; + else if(!(ap->header.nelem&ARRAY_SCAN)) ap->pos = 0; ap->cur = np; } diff --git a/usr/src/lib/libshell/common/sh/bash.c b/usr/src/lib/libshell/common/sh/bash.c index 4b2def3b22..41945b4d53 100644 --- a/usr/src/lib/libshell/common/sh/bash.c +++ b/usr/src/lib/libshell/common/sh/bash.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/sh/defs.c b/usr/src/lib/libshell/common/sh/defs.c index 8b8a6aa323..b535ac2bce 100644 --- a/usr/src/lib/libshell/common/sh/defs.c +++ b/usr/src/lib/libshell/common/sh/defs.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/sh/deparse.c b/usr/src/lib/libshell/common/sh/deparse.c index c5704d2cf9..88b135262d 100644 --- a/usr/src/lib/libshell/common/sh/deparse.c +++ b/usr/src/lib/libshell/common/sh/deparse.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/sh/env.c b/usr/src/lib/libshell/common/sh/env.c index d1f9361975..0e007ce796 100644 --- a/usr/src/lib/libshell/common/sh/env.c +++ b/usr/src/lib/libshell/common/sh/env.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/sh/expand.c b/usr/src/lib/libshell/common/sh/expand.c index 15004a09be..49862d75cb 100644 --- a/usr/src/lib/libshell/common/sh/expand.c +++ b/usr/src/lib/libshell/common/sh/expand.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -32,6 +32,7 @@ # include "test.h" #else # include <ast.h> +# include <ctype.h> # include <setjmp.h> #endif /* KSHELL */ #include <glob.h> diff --git a/usr/src/lib/libshell/common/sh/fault.c b/usr/src/lib/libshell/common/sh/fault.c index 60af63972d..fc90ad573e 100644 --- a/usr/src/lib/libshell/common/sh/fault.c +++ b/usr/src/lib/libshell/common/sh/fault.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -98,7 +98,7 @@ void sh_fault(register int sig) } return; } - if(shp->subshell && sig!=SIGINT && sig!=SIGQUIT && sig!=SIGWINCH) + if(shp->subshell && sig!=SIGINT && sig!=SIGQUIT && sig!=SIGWINCH && sig!=SIGCONT) { shp->exitval = SH_EXITSIG|sig; sh_subfork(); @@ -141,7 +141,7 @@ void sh_fault(register int sig) } /* mark signal and continue */ shp->trapnote |= SH_SIGSET; - if(sig < shp->sigmax) + if(sig <= shp->sigmax) shp->sigflag[sig] |= SH_SIGSET; #if defined(VMFL) && (VMALLOC_VERSION>=20031205L) if(abortsig(sig)) @@ -186,7 +186,6 @@ void sh_fault(register int sig) #endif /* SIGTSTP */ } #ifdef ERROR_NOTIFY - /* This is obsolete */ if((error_info.flags&ERROR_NOTIFY) && shp->bltinfun) action = (*shp->bltinfun)(-sig,(char**)0,(void*)0); if(action>0) @@ -198,7 +197,7 @@ void sh_fault(register int sig) return; } shp->trapnote |= flag; - if(sig < shp->sigmax) + if(sig <= shp->sigmax) shp->sigflag[sig] |= flag; if(pp->mode==SH_JMPCMD && sh_isstate(SH_STOPOK)) { @@ -215,23 +214,28 @@ void sh_fault(register int sig) void sh_siginit(void *ptr) { Shell_t *shp = (Shell_t*)ptr; - register int sig, n=SIGTERM+1; + register int sig, n; register const struct shtable2 *tp = shtab_signals; sig_begin(); /* find the largest signal number in the table */ -#ifdef SIGRTMIN - shp->sigruntime[SH_SIGRTMIN] = SIGRTMIN; -#endif /* SIGRTMIN */ -#ifdef SIGRTMAX - shp->sigruntime[SH_SIGRTMAX] = SIGRTMAX; -#endif /* SIGRTMAX */ +#if defined(SIGRTMIN) && defined(SIGRTMAX) + if ((n = SIGRTMIN) > 0 && (sig = SIGRTMAX) > n && sig < SH_TRAP) + { + shp->sigruntime[SH_SIGRTMIN] = n; + shp->sigruntime[SH_SIGRTMAX] = sig; + } +#endif /* SIGRTMIN && SIGRTMAX */ + n = SIGTERM; while(*tp->sh_name) { - sig = tp->sh_number&((1<<SH_SIGBITS)-1); - if ((tp->sh_number>>SH_SIGBITS) & SH_SIGRUNTIME) - sig = shp->sigruntime[sig-1]; - if(sig>n && sig<SH_TRAP) - n = sig; + sig = (tp->sh_number&((1<<SH_SIGBITS)-1)); + if (!(sig-- & SH_TRAP)) + { + if ((tp->sh_number>>SH_SIGBITS) & SH_SIGRUNTIME) + sig = shp->sigruntime[sig]; + if(sig>n && sig<SH_TRAP) + n = sig; + } tp++; } shp->sigmax = n++; @@ -241,7 +245,7 @@ void sh_siginit(void *ptr) for(tp=shtab_signals; sig=tp->sh_number; tp++) { n = (sig>>SH_SIGBITS); - if((sig &= ((1<<SH_SIGBITS)-1)) > shp->sigmax) + if((sig &= ((1<<SH_SIGBITS)-1)) > (shp->sigmax+1)) continue; sig--; if(n&SH_SIGRUNTIME) @@ -291,7 +295,7 @@ void sh_sigdone(void) { register int flag, sig = sh.sigmax; sh.sigflag[0] |= SH_SIGFAULT; - while(--sig>0) + for(sig=sh.sigmax; sig>0; sig--) { flag = sh.sigflag[sig]; if((flag&(SH_SIGDONE|SH_SIGIGNORE|SH_SIGINTERACTIVE)) && !(flag&(SH_SIGFAULT|SH_SIGOFF))) @@ -321,7 +325,8 @@ void sh_sigreset(register int mode) } else if(sig && mode>1) { - signal(sig,SIG_IGN); + if(sig!=SIGCHLD) + signal(sig,SIG_IGN); flag &= ~SH_SIGFAULT; flag |= SH_SIGOFF; } @@ -396,13 +401,25 @@ void sh_chktrap(void) } if(sh.sigflag[SIGALRM]&SH_SIGALRM) sh_timetraps(); +#ifdef SHOPT_BGX + if((sh.sigflag[SIGCHLD]&SH_SIGTRAP) && sh.st.trapcom[SIGCHLD]) + job_chldtrap(&sh,sh.st.trapcom[SIGCHLD],1); + while(--sig>=0 && sig!=SIGCHLD) +#else while(--sig>=0) +#endif /* SHOPT_BGX */ { if(sh.sigflag[sig]&SH_SIGTRAP) { sh.sigflag[sig] &= ~SH_SIGTRAP; if(trap=sh.st.trapcom[sig]) - sh_trap(trap,0); + { + Sfio_t *fp; + if(sig==SIGPIPE && (fp=sfpool((Sfio_t*)0,sh.outpool,SF_WRITE)) && sferror(fp)) + sfclose(fp); + sh.oldexit = SH_EXITSIG|sig; + sh_trap(trap,0); + } } } } @@ -465,7 +482,7 @@ int sh_trap(const char *trap, int mode) if(was_verbose) sh_onstate(SH_VERBOSE); exitset(); - if(jmpval>SH_JMPTRAP) + if(jmpval>SH_JMPTRAP && (((struct checkpt*)shp->jmpbuffer)->prev || ((struct checkpt*)shp->jmpbuffer)->mode==SH_JMPSCRIPT)) siglongjmp(*shp->jmplist,jmpval); return(shp->exitval); } @@ -568,8 +585,8 @@ void sh_done(void *ptr, register int sig) register int savxit = shp->exitval; shp->trapnote = 0; indone=1; - if(sig==0) - sig = shp->lastsig; + if(sig) + savxit = SH_EXITSIG|sig; if(shp->userinit) (*shp->userinit)(shp, -1); if(t=shp->st.trapcom[0]) @@ -604,6 +621,8 @@ void sh_done(void *ptr, register int sig) sfsync((Sfio_t*)sfstdin); sfsync((Sfio_t*)shp->outpool); sfsync((Sfio_t*)sfstdout); + if(savxit&SH_EXITSIG) + sig = savxit&SH_EXITMASK; if(sig) { /* generate fault termination code */ diff --git a/usr/src/lib/libshell/common/sh/fcin.c b/usr/src/lib/libshell/common/sh/fcin.c index 9618bb9ac0..0fd7e7cd70 100644 --- a/usr/src/lib/libshell/common/sh/fcin.c +++ b/usr/src/lib/libshell/common/sh/fcin.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/sh/init.c b/usr/src/lib/libshell/common/sh/init.c index 0bd2f92b79..7371b8de98 100644 --- a/usr/src/lib/libshell/common/sh/init.c +++ b/usr/src/lib/libshell/common/sh/init.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -29,7 +29,6 @@ #include "defs.h" #include <stak.h> -#include <ctype.h> #include <ccode.h> #include <pwd.h> #include <tmx.h> @@ -44,6 +43,7 @@ #include "builtins.h" #include "FEATURE/time" #include "FEATURE/dynamic" +#include "FEATURE/externs" #include "lexstates.h" #include "version.h" @@ -56,6 +56,10 @@ char e_version[] = "\n@(#)$Id: Version " #define ATTRS 1 "B" #endif +#if SHOPT_BGX +#define ATTRS 1 + "J" +#endif #if SHOPT_ACCT #define ATTRS 1 "L" @@ -68,6 +72,10 @@ char e_version[] = "\n@(#)$Id: Version " #define ATTRS 1 "P" #endif +#if SHOPT_REGRESS +#define ATTRS 1 + "R" +#endif #if ATTRS " " #endif @@ -162,6 +170,7 @@ static int nbltins; static void env_init(Shell_t*); static Init_t *nv_init(Shell_t*); static Dt_t *inittree(Shell_t*,const struct shtable2*); +static int shlvl; #ifdef _WINIX # define EXE "?(.exe)" @@ -195,22 +204,27 @@ static char *nospace(int unused) static void put_ed(register Namval_t* np,const char *val,int flags,Namfun_t *fp) { register const char *cp, *name=nv_name(np); + register int newopt=0; Shell_t *shp = nv_shell(np); if(*name=='E' && nv_getval(sh_scoped(shp,VISINOD))) goto done; - sh_offoption(SH_VI); - sh_offoption(SH_EMACS); - sh_offoption(SH_GMACS); if(!(cp=val) && (*name=='E' || !(cp=nv_getval(sh_scoped(shp,EDITNOD))))) goto done; /* turn on vi or emacs option if editor name is either*/ cp = path_basename(cp); if(strmatch(cp,"*[Vv][Ii]*")) - sh_onoption(SH_VI); + newopt=SH_VI; else if(strmatch(cp,"*gmacs*")) - sh_onoption(SH_GMACS); + newopt=SH_GMACS; else if(strmatch(cp,"*macs*")) - sh_onoption(SH_EMACS); + newopt=SH_EMACS; + if(newopt) + { + sh_offoption(SH_VI); + sh_offoption(SH_EMACS); + sh_offoption(SH_GMACS); + sh_onoption(newopt); + } done: nv_putv(np, val, flags, fp); } @@ -220,11 +234,12 @@ static void put_history(register Namval_t* np,const char *val,int flags,Namfun_t { Shell_t *shp = nv_shell(np); void *histopen = shp->hist_ptr; + char *cp; if(val && histopen) { - if(np==HISTFILE && strcmp(val,nv_getval(HISTFILE))==0) + if(np==HISTFILE && (cp=nv_getval(np)) && strcmp(val,cp)==0) return; - if(np==HISTSIZE && sh_arith(val)==nv_getnum(HISTSIZE)) + if(np==HISTSIZE && sh_arith(val)==nv_getnum(HISTSIZE)) return; hist_close(shp->hist_ptr); } @@ -340,13 +355,17 @@ static void put_cdpath(register Namval_t* np,const char *val,int flags,Namfun_t } #endif - /* Trap for LC_ALL, LC_TYPE, LC_MESSAGES, LC_COLLATE and LANG */ + /* Trap for LC_ALL, LC_CTYPE, LC_MESSAGES, LC_COLLATE and LANG */ static void put_lang(Namval_t* np,const char *val,int flags,Namfun_t *fp) { Shell_t *shp = nv_shell(np); int type; char *lc_all = nv_getval(LCALLNOD); char *name = nv_name(np); + if((shp->test&1) && !val && !nv_getval(np)) + return; + if(shp->test&2) + nv_putv(np, val, flags, fp); if(name==(LCALLNOD)->nvname) type = LC_ALL; else if(name==(LCTYPENOD)->nvname) @@ -357,22 +376,30 @@ static void put_cdpath(register Namval_t* np,const char *val,int flags,Namfun_t type = LC_COLLATE; else if(name==(LCNUMNOD)->nvname) type = LC_NUMERIC; - else if(name==(LANGNOD)->nvname && (!lc_all || *lc_all==0)) - type = LC_ALL; +#ifdef LC_LANG + else if(name==(LANGNOD)->nvname) + type = LC_LANG; +#else +#define LC_LANG LC_ALL + else if(name==(LANGNOD)->nvname && (!lc_all || !*lc_all)) + type = LC_LANG; +#endif else type= -1; if(sh_isstate(SH_INIT) && type>=0 && type!=LC_ALL && lc_all && *lc_all) type= -1; - if(type>=0 || type==LC_ALL) + if(type>=0 || type==LC_ALL || type==LC_LANG) { - if(!setlocale(type,val?val:"")) + if(!setlocale(type,val?val:"-") && val) { if(!sh_isstate(SH_INIT) || shp->login_sh==0) errormsg(SH_DICT,0,e_badlocale,val); return; } } - if(CC_NATIVE==CC_ASCII && (type==LC_ALL || type==LC_CTYPE)) + if(!(shp->test&2)) + nv_putv(np, val, flags, fp); + if(CC_NATIVE==CC_ASCII && (type==LC_ALL || type==LC_LANG || type==LC_CTYPE)) { if(sh_lexstates[ST_BEGIN]!=sh_lexrstates[ST_BEGIN]) free((void*)sh_lexstates[ST_BEGIN]); @@ -423,7 +450,6 @@ static void put_cdpath(register Namval_t* np,const char *val,int flags,Namfun_t if(type==LC_ALL || type==LC_MESSAGES) error_info.translate = msg_translate; #endif - nv_putv(np, val, flags, fp); } #endif /* _hdr_locale */ @@ -431,10 +457,18 @@ static void put_cdpath(register Namval_t* np,const char *val,int flags,Namfun_t static void put_ifs(register Namval_t* np,const char *val,int flags,Namfun_t *fp) { register struct ifs *ip = (struct ifs*)fp; + Shell_t *shp; ip->ifsnp = 0; + if(!val) + { + fp = nv_stack(np, NIL(Namfun_t*)); + if(fp && !fp->nofree) + free((void*)fp); + } if(val != np->nvalue.cp) nv_putv(np, val, flags, fp); - + if(!val && !(flags&NV_CLONE) && (fp=np->nvfun) && !fp->disc && (shp=(Shell_t*)(fp->last))) + nv_stack(np,&((Init_t*)shp->init_context)->IFS_init.hdr); } /* @@ -505,8 +539,10 @@ static void put_seconds(register Namval_t* np,const char *val,int flags,Namfun_t struct tms tp; if(!val) { - nv_stack(np, NIL(Namfun_t*)); - nv_unset(np); + fp = nv_stack(np, NIL(Namfun_t*)); + if(fp && !fp->nofree) + free((void*)fp); + nv_putv(np, val, flags, fp); return; } if(!np->nvalue.dp) @@ -552,7 +588,9 @@ static void put_rand(register Namval_t* np,const char *val,int flags,Namfun_t *f register long n; if(!val) { - nv_stack(np, NIL(Namfun_t*)); + fp = nv_stack(np, NIL(Namfun_t*)); + if(fp && !fp->nofree) + free((void*)fp); nv_unset(np); return; } @@ -608,7 +646,9 @@ static void put_lineno(Namval_t* np,const char *val,int flags,Namfun_t *fp) Shell_t *shp = nv_shell(np); if(!val) { - nv_stack(np, NIL(Namfun_t*)); + fp = nv_stack(np, NIL(Namfun_t*)); + if(fp && !fp->nofree) + free((void*)fp); nv_unset(np); return; } @@ -627,8 +667,11 @@ static char* get_lineno(register Namval_t* np, Namfun_t *fp) static char* get_lastarg(Namval_t* np, Namfun_t *fp) { - Shell_t *shp = nv_shell(np); - NOT_USED(np); + Shell_t *shp = nv_shell(np); + char *cp; + int pid; + if(sh_isstate(SH_INIT) && (cp=shp->lastarg) && *cp=='*' && (pid=strtol(cp+1,&cp,10)) && *cp=='*') + nv_putval(np,(pid==getppid()?cp+1:0),0); return(shp->lastarg); } @@ -640,14 +683,15 @@ static void put_lastarg(Namval_t* np,const char *val,int flags,Namfun_t *fp) sfprintf(shp->strbuf,"%.*g",12,*((double*)val)); val = sfstruse(shp->strbuf); } + if(val) + val = strdup(val); if(shp->lastarg && !nv_isattr(np,NV_NOFREE)) free((void*)shp->lastarg); else nv_offattr(np,NV_NOFREE); - if(val) - shp->lastarg = strdup(val); - else - shp->lastarg = 0; + shp->lastarg = (char*)val; + nv_offattr(np,NV_EXPORT); + np->nvenv = 0; } static int hasgetdisc(register Namfun_t *fp) @@ -979,6 +1023,7 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit) register int n; int type; static char *login_files[3]; + memfatal(); n = strlen(e_version); if(e_version[n-1]=='$' && e_version[n-2]==' ') e_version[n-2]=0; @@ -1001,6 +1046,41 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit) #if ERROR_VERSION >= 20000102L error_info.catalog = e_dict; #endif +#if SHOPT_REGRESS + { + Opt_t* nopt; + Opt_t* oopt; + char* a; + char** av = argv; + char* regress[3]; + + sh_regress_init(shp); + regress[0] = "__regress__"; + regress[2] = 0; + /* NOTE: only shp is used by __regress__ at this point */ + shp->bltindata.shp = shp; + while ((a = *++av) && a[0] == '-' && (a[1] == 'I' || a[1] == '-' && a[2] == 'r')) + { + if (a[1] == 'I') + { + if (a[2]) + regress[1] = a + 2; + else if (!(regress[1] = *++av)) + break; + } + else if (strncmp(a+2, "regress", 7)) + break; + else if (a[9] == '=') + regress[1] = a + 10; + else if (!(regress[1] = *++av)) + break; + nopt = optctx(0, 0); + oopt = optctx(nopt, 0); + b___regress__(2, regress, &shp->bltindata); + optctx(oopt, nopt); + } + } +#endif shp->cpipe[0] = -1; shp->coutpipe = -1; shp->userid=getuid(); @@ -1051,6 +1131,11 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit) shp->login_sh = 2; } env_init(shp); + if(!ENVNOD->nvalue.cp) + { + sfprintf(shp->strbuf,"%s/.kshrc",nv_getval(HOME)); + nv_putval(ENVNOD,sfstruse(shp->strbuf),NV_RDONLY); + } *SHLVL->nvalue.ip +=1; #if SHOPT_SPAWN { @@ -1058,15 +1143,20 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit) * try to find the pathname for this interpreter * try using environment variable _ or argv[0] */ - char *last, *cp=nv_getval(L_ARGNOD); + char *cp=nv_getval(L_ARGNOD); char buff[PATH_MAX+1]; shp->shpath = 0; +#if _AST_VERSION >= 20090202L + if((n = pathprog(NiL, buff, sizeof(buff))) > 0 && n <= sizeof(buff)) + shp->shpath = strdup(buff); +#else sfprintf(shp->strbuf,"/proc/%d/exe",getpid()); if((n=readlink(sfstruse(shp->strbuf),buff,sizeof(buff)-1))>0) { buff[n] = 0; shp->shpath = strdup(buff); } +#endif else if((cp && (sh_type(cp)&SH_TYPE_SH)) || (argc>0 && strchr(cp= *argv,'/'))) { if(*cp=='/') @@ -1168,17 +1258,16 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit) /* set[ug]id scripts require the -p flag */ if(shp->userid!=shp->euserid || shp->groupid!=shp->egroupid) { -#if SHOPT_P_SUID +#ifdef SHOPT_P_SUID /* require sh -p to run setuid and/or setgid */ - if(!sh_isoption(SH_PRIVILEGED) && shp->euserid < SHOPT_P_SUID) + if(!sh_isoption(SH_PRIVILEGED) && shp->userid >= SHOPT_P_SUID) { setuid(shp->euserid=shp->userid); setgid(shp->egroupid=shp->groupid); } else -#else - sh_onoption(SH_PRIVILEGED); #endif /* SHOPT_P_SUID */ + sh_onoption(SH_PRIVILEGED); #ifdef SHELLMAGIC /* careful of #! setuid scripts with name beginning with - */ if(shp->login_sh && argv[1] && strcmp(argv[0],argv[1])==0) @@ -1305,7 +1394,14 @@ int sh_reinit(char *argv[]) sh_offstate(SH_FORKED); shp->fn_depth = shp->dot_depth = 0; sh_sigreset(0); + if(!(SHLVL->nvalue.ip)) + { + shlvl = 0; + SHLVL->nvalue.ip = &shlvl; + nv_onattr(SHLVL,NV_INTEGER|NV_EXPORT|NV_NOFREE); + } *SHLVL->nvalue.ip +=1; + shp->st.filename = strdup(shp->lastarg); return(1); } @@ -1314,7 +1410,7 @@ int sh_reinit(char *argv[]) */ Namfun_t *nv_cover(register Namval_t *np) { - if(np==IFSNOD || np==PATHNOD || np==SHELLNOD || np==FPATHNOD || np==CDPNOD || np==SECONDS) + if(np==IFSNOD || np==PATHNOD || np==SHELLNOD || np==FPATHNOD || np==CDPNOD || np==SECONDS || np==ENVNOD) return(np->nvfun); #ifdef _hdr_locale if(np==LCALLNOD || np==LCTYPENOD || np==LCMSGNOD || np==LCCOLLNOD || np==LCNUMNOD || np==LANGNOD) @@ -1433,7 +1529,6 @@ static void stat_init(Shell_t *shp) */ static Init_t *nv_init(Shell_t *shp) { - static int shlvl=0; Namval_t *np; register Init_t *ip; double d=0; diff --git a/usr/src/lib/libshell/common/sh/io.c b/usr/src/lib/libshell/common/sh/io.c index 50fa35561f..547a67aa27 100644 --- a/usr/src/lib/libshell/common/sh/io.c +++ b/usr/src/lib/libshell/common/sh/io.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -31,7 +31,6 @@ #include <fcin.h> #include <ls.h> #include <stdarg.h> -#include <ctype.h> #include <regex.h> #include "variables.h" #include "path.h" @@ -406,7 +405,7 @@ void sh_ioinit(Shell_t *shp) sh_iostream(shp,0); /* all write steams are in the same pool and share outbuff */ shp->outpool = sfopen(NIL(Sfio_t*),NIL(char*),"sw"); /* pool identifier */ - shp->outbuff = (char*)malloc(IOBSIZE); + shp->outbuff = (char*)malloc(IOBSIZE+4); shp->errbuff = (char*)malloc(IOBSIZE/4); sfsetbuf(sfstderr,shp->errbuff,IOBSIZE/4); sfsetbuf(sfstdout,shp->outbuff,IOBSIZE); @@ -548,7 +547,11 @@ static void io_preserve(Shell_t* shp, register Sfio_t *sp, register int f2) if(f2==shp->infd) shp->infd = fd; if(fd<0) + { + shp->toomany = 1; + ((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT; errormsg(SH_DICT,ERROR_system(1),e_toomany); + } if(shp->fdptrs[fd]=shp->fdptrs[f2]) { if(f2==job.fd) @@ -717,6 +720,20 @@ int sh_open(register const char *path, int flags, ...) } if (fd >= 0) { + int nfd= -1; + if (flags & O_CREAT) + { + struct stat st; + if (stat(path,&st) >=0) + nfd = open(path,flags,st.st_mode); + } + else + nfd = open(path,flags); + if(nfd>=0) + { + fd = nfd; + goto ok; + } if((mode=sh_iocheckfd(shp,fd))==IOCLOSE) return(-1); flags &= O_ACCMODE; @@ -727,12 +744,21 @@ int sh_open(register const char *path, int flags, ...) if((fd=dup(fd))<0) return(-1); } - else while((fd = open(path, flags, mode)) < 0) - if(errno!=EINTR || sh.trapnote) - return(-1); -#ifdef O_SERVICE - ok: + else + { +#if SHOPT_REGRESS + char buf[PATH_MAX]; + if(strncmp(path,"/etc/",5)==0) + { + sfsprintf(buf, sizeof(buf), "%s%s", sh_regress_etc(path, __LINE__, __FILE__), path+4); + path = buf; + } #endif + while((fd = open(path, flags, mode)) < 0) + if(errno!=EINTR || sh.trapnote) + return(-1); + } + ok: flags &= O_ACCMODE; if(flags==O_WRONLY) mode = IOWRITE; @@ -939,10 +965,11 @@ int sh_redirect(Shell_t *shp,struct ionod *iop, int flag) const char *message = e_open; int o_mode; /* mode flag for open */ static char io_op[7]; /* used for -x trace info */ - int clexec=0, fn, traceon; + int trunc=0, clexec=0, fn, traceon; int r, indx = shp->topfd, perm= -1; char *tname=0, *after="", *trace = shp->st.trap[SH_DEBUGTRAP]; Namval_t *np=0; + int isstring = shp->subshell?(sfset(sfstdout,0,0)&SF_STRING):0; if(flag==2) clexec = 1; if(iop) @@ -951,7 +978,7 @@ int sh_redirect(Shell_t *shp,struct ionod *iop, int flag) { iof=iop->iofile; fn = (iof&IOUFD); - if(fn==1 && shp->subshell && (flag==2 || (sfset(sfstdout,0,0)&SF_STRING))) + if(fn==1 && shp->subshell && !shp->subshare && (flag==2 || isstring)) sh_subfork(); io_op[0] = '0'+(iof&IOUFD); if(iof&IOPUT) @@ -978,6 +1005,16 @@ int sh_redirect(Shell_t *shp,struct ionod *iop, int flag) strcpy(ap->argval,iop->ioname); fname=sh_macpat(shp,ap,(iof&IOARITH)?ARG_ARITH:ARG_EXP); } + else if(iof&IOPROCSUB) + { + struct argnod *ap = (struct argnod*)stakalloc(ARGVAL+strlen(iop->ioname)); + memset(ap, 0, ARGVAL); + if(iof&IOPUT) + ap->argflag = ARG_RAW; + ap->argchn.ap = (struct argnod*)fname; + ap = sh_argprocsub(shp,ap); + fname = ap->argval; + } else fname=sh_mactrim(shp,fname,(!sh_isoption(SH_NOGLOB)&&sh_isoption(SH_INTERACTIVE))?2:0); } @@ -1033,7 +1070,7 @@ int sh_redirect(Shell_t *shp,struct ionod *iop, int flag) message = e_file; goto fail; } - if(shp->subshell && dupfd==1) + if(shp->subshell && dupfd==1 && (sfset(sfstdout,0,0)&SF_STRING)) { sh_subtmpfile(0); dupfd = sffileno(sfstdout); @@ -1083,6 +1120,8 @@ int sh_redirect(Shell_t *shp,struct ionod *iop, int flag) errormsg(SH_DICT,ERROR_exit(1),e_restricted,fname); io_op[2] = '>'; o_mode = O_RDWR|O_CREAT; + if(iof&IOREWRITE) + trunc = io_op[2] = ';'; goto openit; } else if(!(iof&IOPUT)) @@ -1197,7 +1236,10 @@ int sh_redirect(Shell_t *shp,struct ionod *iop, int flag) if((off = file_offset(shp,fn,fname))<0) goto fail; if(sp) + { off=sfseek(sp, off, SEEK_SET); + sfsync(sp); + } else off=lseek(fn, off, SEEK_SET); if(off<0) @@ -1245,7 +1287,7 @@ int sh_redirect(Shell_t *shp,struct ionod *iop, int flag) sh_close(fn); } } - sh_iosave(shp,fn,indx,tname?fname:0); + sh_iosave(shp,fn,indx,tname?fname:(trunc?Empty:0)); } else if(sh_subsavefd(fn)) sh_iosave(shp,fn,indx|IOSUBSHELL,tname?fname:0); @@ -1422,7 +1464,11 @@ void sh_iosave(Shell_t *shp, register int origfd, int oldtop, char *name) #endif /* SHOPT_DEVFD */ { if((savefd = sh_fcntl(origfd, F_DUPFD, 10)) < 0 && errno!=EBADF) + { + shp->toomany=1; + ((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT; errormsg(SH_DICT,ERROR_system(1),e_toomany); + } } filemap[shp->topfd].tname = name; filemap[shp->topfd].subshell = flag; @@ -1492,7 +1538,9 @@ void sh_iorestore(Shell_t *shp, int last, int jmpval) continue; } origfd = filemap[fd].orig_fd; - if(filemap[fd].tname) + if(filemap[fd].tname == Empty && shp->exitval==0) + ftruncate(origfd,lseek(origfd,0,SEEK_CUR)); + else if(filemap[fd].tname) io_usename(filemap[fd].tname,(int*)0,shp->exitval?2:1); sh_close(origfd); if ((savefd = filemap[fd].save_fd) >= 0) @@ -1638,7 +1686,10 @@ static ssize_t piperead(Sfio_t *iop,void *buff,register size_t size,Sfdisc_t *ha int fd = sffileno(iop); NOT_USED(handle); if(job.waitsafe && job.savesig) - job_reap(job.savesig); + { + job_lock(); + job_unlock(); + } if(sh.trapnote) { errno = EINTR; @@ -1942,14 +1993,7 @@ static void sftrack(Sfio_t* sp, int flag, void* data) if(mode&SF_READ) flag |= IOREAD; shp->fdstatus[fd] = flag; -#if 0 - if(flag==IOWRITE) - sfpool(sp,shp->outpool,SF_WRITE); - else -#else - if(flag!=IOWRITE) -#endif - sh_iostream(shp,fd); + sh_iostream(shp,fd); } if((pp=(struct checkpt*)shp->jmplist) && pp->mode==SH_JMPCMD) { diff --git a/usr/src/lib/libshell/common/sh/jobs.c b/usr/src/lib/libshell/common/sh/jobs.c index 0c9724ce0f..778be37706 100644 --- a/usr/src/lib/libshell/common/sh/jobs.c +++ b/usr/src/lib/libshell/common/sh/jobs.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -30,7 +30,6 @@ */ #include "defs.h" -#include <ctype.h> #include <wait.h> #include "io.h" #include "jobs.h" @@ -77,24 +76,6 @@ static void init_savelist(void) } } -/* - * return next on link list of jobsave free list - */ -static struct jobsave *jobsave_create(pid_t pid) -{ - register struct jobsave *jp = job_savelist; - if(jp) - { - njob_savelist--; - job_savelist = jp->next; - } - else - jp = newof(0,struct jobsave,1,0); - if(jp) - jp->pid = pid; - return(jp); -} - struct back_save { int count; @@ -132,6 +113,9 @@ struct back_save #define P_COREDUMP 0100 #define P_DISOWN 0200 #define P_FG 0400 +#ifdef SHOPT_BGX +#define P_BG 01000 +#endif /* SHOPT_BGX */ static int job_chksave(pid_t); static struct process *job_bypid(pid_t); @@ -151,7 +135,6 @@ static Sfio_t *outfile; static pid_t lastpid; static struct back_save bck; - #ifdef JOBS static void job_set(struct process*); static void job_reset(struct process*); @@ -195,6 +178,62 @@ static struct back_save bck; typedef int (*Waitevent_f)(int,long,int); +#ifdef SHOPT_BGX +void job_chldtrap(Shell_t *shp, const char *trap, int unpost) +{ + register struct process *pw,*pwnext; + pid_t bckpid; + int oldexit; + job_lock(); + shp->sigflag[SIGCHLD] &= ~SH_SIGTRAP; + for(pw=job.pwlist;pw;pw=pwnext) + { + pwnext = pw->p_nxtjob; + if((pw->p_flag&(P_BG|P_DONE)) != (P_BG|P_DONE)) + continue; + pw->p_flag &= ~P_BG; + bckpid = shp->bckpid; + oldexit = shp->savexit; + shp->bckpid = pw->p_pid; + shp->savexit = pw->p_exit; + if(pw->p_flag&P_SIGNALLED) + shp->savexit |= SH_EXITSIG; + sh_trap(trap,0); + shp->savexit = oldexit; + shp->bckpid = bckpid; + if(unpost) + job_unpost(pw,0); + } + job_unlock(); +} +#endif /* SHOPT_BGX */ + +/* + * return next on link list of jobsave free list + */ +static struct jobsave *jobsave_create(pid_t pid) +{ + register struct jobsave *jp = job_savelist; + job_chksave(pid); + if(++bck.count > sh.lim.child_max) + job_chksave(0); + if(jp) + { + njob_savelist--; + job_savelist = jp->next; + } + else + jp = newof(0,struct jobsave,1,0); + if(jp) + { + jp->pid = pid; + jp->next = bck.list; + bck.list = jp; + jp->exitval = 0; + } + return(jp); +} + /* * Reap one job * When called with sig==0, it does a blocking wait @@ -206,7 +245,6 @@ int job_reap(register int sig) struct process *px; register int flags; struct jobsave *jp; - struct back_save *bp; int nochild=0, oerrno, wstat; Waitevent_f waitevent = sh.waitevent; static int wcontinued = WCONTINUED; @@ -268,14 +306,7 @@ int job_reap(register int sig) pw->p_exitmin = 0; if(job.toclear) job_clear(); - if(++bck.count > sh.lim.child_max) - job_chksave(0); - if(jp = jobsave_create(pid)) - { - jp->next = bck.list; - bck.list = jp; - jp->exitval = 0; - } + jp = jobsave_create(pid); pw->p_flag = 0; lastpid = pw->p_pid = pid; px = 0; @@ -344,6 +375,22 @@ int job_reap(register int sig) if(WEXITSTATUS(wstat) > pw->p_exitmin) pw->p_exit = WEXITSTATUS(wstat); } +#ifdef SHOPT_BGX + if((pw->p_flag&P_DONE) && (pw->p_flag&P_BG)) + { + job.numbjob--; + if(sh.st.trapcom[SIGCHLD]) + { + sh.sigflag[SIGCHLD] |= SH_SIGTRAP; + if(sig==0) + job_chldtrap(&sh,sh.st.trapcom[SIGCHLD],0); + else + sh.trapnote |= SH_SIGTRAP; + } + else + pw->p_flag &= ~P_BG; + } +#endif /* SHOPT_BGX */ if(pw->p_pgrp==0) pw->p_flag &= ~P_NOTIFY; } @@ -367,15 +414,20 @@ int job_reap(register int sig) if(!px) tcsetpgrp(JOBTTY,job.mypid); } +#ifndef SHOPT_BGX if(!sh.intrap && sh.st.trapcom[SIGCHLD] && pid>0 && (pwfg!=job_bypid(pid))) { sh.sigflag[SIGCHLD] |= SH_SIGTRAP; sh.trapnote |= SH_SIGTRAP; } +#endif } if(errno==ECHILD) { errno = oerrno; +#ifdef SHOPT_BGX + job.numbjob = 0; +#endif /* SHOPT_BGX */ nochild = 1; } sh.waitevent = waitevent; @@ -1045,6 +1097,9 @@ void job_clear(void) init_savelist(); job.pwlist = NIL(struct process*); job.numpost=0; +#ifdef SHOPT_BGX + job.numbjob = 0; +#endif /* SHOPT_BGX */ job.waitall = 0; job.curpgid = 0; job.toclear = 0; @@ -1064,16 +1119,28 @@ int job_post(pid_t pid, pid_t join) { register struct process *pw; register History_t *hp = sh.hist_ptr; +#ifdef SHOPT_BGX + int val,bg=0; +#else int val; +#endif sh.jobenv = sh.curenv; - if(njob_savelist < NJOB_SAVELIST) - init_savelist(); if(job.toclear) { job_clear(); return(0); } job_lock(); +#ifdef SHOPT_BGX + if(join==1) + { + join = 0; + bg = P_BG; + job.numbjob++; + } +#endif /* SHOPT_BGX */ + if(njob_savelist < NJOB_SAVELIST) + init_savelist(); if(pw = job_bypid(pid)) job_unpost(pw,0); if(join && (pw=job_bypid(join))) @@ -1090,6 +1157,7 @@ int job_post(pid_t pid, pid_t join) freelist = pw->p_nxtjob; else pw = new_of(struct process,0); + pw->p_flag = 0; job.numpost++; if(join && job.pwlist) { @@ -1109,7 +1177,8 @@ int job_post(pid_t pid, pid_t join) job.pwlist = pw; pw->p_env = sh.curenv; pw->p_pid = pid; - pw->p_flag = P_EXITSAVE; + if(!sh.outpipe || sh_isoption(SH_PIPEFAIL)) + pw->p_flag = P_EXITSAVE; pw->p_exitmin = sh.xargexit; pw->p_exit = 0; if(sh_isstate(SH_MONITOR)) @@ -1140,9 +1209,18 @@ int job_post(pid_t pid, pid_t join) pw->p_flag |= (P_SIGNALLED|P_STOPPED); pw->p_exit = 0; } + else if(pw->p_exit >= SH_EXITSIG) + { + pw->p_flag |= P_DONE|P_SIGNALLED; + pw->p_exit &= SH_EXITMASK; + } else pw->p_flag |= (P_DONE|P_NOTIFY); } +#ifdef SHOPT_BGX + if(bg && !(pw->p_flag&P_DONE)) + pw->p_flag |= P_BG; +#endif /* SHOPT_BGX */ lastpid = 0; job_unlock(); return(pw->p_job); @@ -1334,13 +1412,8 @@ int job_wait(register pid_t pid) px->p_flag &= ~P_EXITSAVE; } } - if(!job.waitall) - { - if(!sh_isoption(SH_PIPEFAIL)) - job_unpost(pw,1); - break; - } - else if(!(px=job_unpost(pw,1))) + px = job_unpost(pw,1); + if(!px || !sh_isoption(SH_PIPEFAIL)) break; pw = px; continue; @@ -1430,6 +1503,9 @@ int job_switch(register struct process *pw,int bgflag) { sfprintf(outfile,"[%d]\t",(int)pw->p_job); sh.bckpid = pw->p_pid; +#ifdef SHOPT_BGX + pw->p_flag |= P_BG; +#endif msg = "&"; } else @@ -1451,6 +1527,9 @@ int job_switch(register struct process *pw,int bgflag) } job.waitall = 1; pw->p_flag |= P_FG; +#ifdef SHOPT_BGX + pw->p_flag &= ~P_BG; +#endif job_wait(pw->p_pid); job.waitall = 0; } @@ -1515,6 +1594,10 @@ static struct process *job_unpost(register struct process *pwtop,int notify) sfsync(sfstderr); #endif /* DEBUG */ pwtop = pw = job_byjid((int)pwtop->p_job); +#ifdef SHOPT_BGX + if(pw->p_flag&P_BG) + return(pw); +#endif /* SHOPT_BGX */ for(; pw && (pw->p_flag&P_DONE)&&(notify||!(pw->p_flag&P_NOTIFY)||pw->p_env); pw=pw->p_nxtproc); if(pw) return(pw); @@ -1527,12 +1610,8 @@ static struct process *job_unpost(register struct process *pwtop,int notify) { struct jobsave *jp; /* save status for future wait */ - if(bck.count++ > sh.lim.child_max) - job_chksave(0); if(jp = jobsave_create(pw->p_pid)) { - jp->next = bck.list; - bck.list = jp; jp->exitval = pw->p_exit; if(pw->p_flag&P_SIGNALLED) jp->exitval |= SH_EXITSIG; @@ -1630,7 +1709,7 @@ static char *job_sigmsg(int sig) if ( sig == SIGAPOLLO ) return( apollo_error() ); #endif /* apollo */ - if(sig<sh.sigmax && sh.sigmsg[sig]) + if(sig<=sh.sigmax && sh.sigmsg[sig]) return(sh.sigmsg[sig]); #if defined(SIGRTMIN) && defined(SIGRTMAX) if(sig>=sh.sigruntime[SH_SIGRTMIN] && sig<=sh.sigruntime[SH_SIGRTMAX]) @@ -1656,7 +1735,8 @@ static int job_chksave(register pid_t pid) { register struct jobsave *jp = bck.list, *jpold=0; register int r= -1; - while(jp) + register int count=bck.count; + while(jp && count-->0) { if(jp->pid==pid) break; @@ -1712,6 +1792,7 @@ void job_subrestore(void* ptr) { jp->next = bp->list; bp->list = jp; + bp->count++; } else job_chksave(jp->pid); @@ -1719,7 +1800,7 @@ void job_subrestore(void* ptr) for(pw=job.pwlist; pw; pw=pwnext) { pwnext = pw->p_nxtjob; - if(pw->p_env != sh.curenv) + if(pw->p_env != sh.curenv || pw->p_pid==sh.pipepid) continue; for(px=pw; px; px=px->p_nxtproc) px->p_flag |= P_DONE; diff --git a/usr/src/lib/libshell/common/sh/lex.c b/usr/src/lib/libshell/common/sh/lex.c index 9753ea8074..b5a0761dae 100644 --- a/usr/src/lib/libshell/common/sh/lex.c +++ b/usr/src/lib/libshell/common/sh/lex.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -100,6 +100,7 @@ struct lexdata int lex_max; int *lex_match; int lex_state; + int docextra; #if SHOPT_KIA off_t kiaoff; #endif @@ -196,6 +197,12 @@ static void lex_advance(Sfio_t *iop, const char *buff, register int size, void * #endif if(lp->lexd.nocopy) return; + if(lp->lexd.dolparen && lp->lexd.docword) + { + int n = size - (lp->lexd.docend-(char*)buff); + sfwrite(shp->strbuf,lp->lexd.docend,n); + lp->lexd.docextra += n; + } if(lp->lexd.first) { size -= (lp->lexd.first-(char*)buff); @@ -222,12 +229,13 @@ static int lexfill(Lex_t *lp) register int c; Lex_t savelex; struct argnod *ap; - int aok; + int aok,docextra; savelex = *lp; ap = lp->arg; c = fcfill(); if(ap) lp->arg = ap; + docextra = lp->lexd.docextra; lp->lex = savelex.lex; lp->lexd = savelex.lexd; if(fcfile() || c) @@ -237,6 +245,11 @@ static int lexfill(Lex_t *lp) memcpy(lp, &savelex, offsetof(Lex_t,lexd)); lp->arg = ap; lp->aliasok = aok; + if(lp->lexd.docword && docextra) + { + lp->lexd.docextra = docextra; + lp->lexd.docend = fcseek(0)-1; + } return(c); } @@ -533,14 +546,17 @@ int sh_lex(Lex_t* lp) return(lp->token=c); else if(c=='&') { -#if SHOPT_BASH - if(!sh_isoption(SH_POSIX) && n=='>') + if(!sh_isoption(SH_POSIX) && n=='>' && (sh_isoption(SH_BASH) || sh_isstate(SH_PROFILE))) { + if(!sh_isoption(SH_BASH) && !lp->nonstandard) + { + lp->nonstandard = 1; + errormsg(SH_DICT,ERROR_warn(0),e_lexnonstandard,shp->inlineno); + } lp->digits = -1; c = '>'; } else -#endif n = 0; } else if(n=='&') @@ -556,7 +572,20 @@ int sh_lex(Lex_t* lp) else if(n=='|') c |= SYMPIPE; else if(c=='<' && n=='>') + { + lp->digits = 1; c = IORDWRSYM; + fcgetc(n); + if(fcgetc(n)==';') + { + lp->token = c = IORDWRSYMT; + if(lp->inexec) + sh_syntax(lp); + } + else if(n>0) + fcseek(-1); + n= 0; + } else if(n=='#' && (c=='<'||c=='>')) c |= SYMSHARP; else if(n==';' && c=='>') @@ -577,7 +606,7 @@ int sh_lex(Lex_t* lp) } else { - if((n=fcpeek(0))!=RPAREN && n!=LPAREN && lp->lexd.warn) + if(lp->lexd.warn && (n=fcpeek(0))!=RPAREN && n!=' ' && n!='\t') errormsg(SH_DICT,ERROR_warn(0),e_lexspace,shp->inlineno,c,n); } } @@ -762,7 +791,7 @@ int sh_lex(Lex_t* lp) lp->lastline = shp->inlineno; pushlevel(lp,c,mode); } - ingrave = (c=='`'); + ingrave ^= (c=='`'); mode = ST_QUOTE; continue; } @@ -985,7 +1014,7 @@ int sh_lex(Lex_t* lp) { if(lp->lexd.warn && c!='/' && sh_lexstates[ST_NORM][c]!=S_BREAK && (c!='"' || mode==ST_QUOTE)) errormsg(SH_DICT,ERROR_warn(0),e_lexslash,shp->inlineno); - else if(c=='"' && mode!=ST_QUOTE) + else if(c=='"' && mode!=ST_QUOTE && !ingrave) wordflags |= ARG_MESSAGE; fcseek(-1); } @@ -1111,6 +1140,16 @@ int sh_lex(Lex_t* lp) (oldmode(lp)==ST_NONE) || (mode==ST_NAME && (lp->assignok||lp->lexd.level))) { + if(mode==ST_NAME) + { + fcgetc(n); + if(n>0) + { + if(n==']') + errormsg(SH_DICT,ERROR_exit(SYNBAD),e_lexsyntax1, shp->inlineno, "[]", "empty subscript"); + fcseek(-1); + } + } pushlevel(lp,RBRACT,mode); wordflags |= ARG_QUOTED; mode = ST_NESTED; @@ -1522,6 +1561,7 @@ static int comsub(register Lex_t *lp, int endtok) fcseek(-1); break; case IODOCSYM: + lp->lexd.docextra = 0; sh_lex(lp); break; case 0: @@ -1564,9 +1604,14 @@ static void nested_here(register Lex_t *lp) if(offset=stktell(stkp)) base = stkfreeze(stkp,0); n = fcseek(0)-lp->lexd.docend; - iop = newof(0,struct ionod,1,n+ARGVAL); + iop = newof(0,struct ionod,1,lp->lexd.docextra+n+ARGVAL); iop->iolst = lp->heredoc; stkseek(stkp,ARGVAL); + if(lp->lexd.docextra) + { + sfseek(lp->sh->strbuf,(Sfoff_t)0, SEEK_SET); + sfmove(lp->sh->strbuf,stkp,lp->lexd.docextra,-1); + } sfwrite(stkp,lp->lexd.docend,n); lp->arg = sh_endword(lp->sh,0); iop->ioname = (char*)(iop+1); @@ -1839,9 +1884,9 @@ static int here_copy(Lex_t *lp,register struct ionod *iop) { /* new-line joining */ lp->sh->inlineno++; - if(!lp->lexd.dolparen && (n=(fcseek(0)-bufp)-n)>0) + if(!lp->lexd.dolparen && (n=(fcseek(0)-bufp)-n)>=0) { - if((n=sfwrite(sp,bufp,n))>0) + if(n && (n=sfwrite(sp,bufp,n))>0) iop->iosize += n; bufp = fcseek(0)+1; } @@ -1872,6 +1917,7 @@ done: */ static char *fmttoken(Lex_t *lp, register int sym, char *tok) { + int n=1; if(sym < 0) return((char*)sh_translate(e_lexzerobyte)); if(sym==0) @@ -1891,7 +1937,7 @@ static char *fmttoken(Lex_t *lp, register int sym, char *tok) return((char*)sh_translate(e_newline)); tok[0] = sym; if(sym&SYMREP) - tok[1] = sym; + tok[n++] = sym; else { switch(sym&SYMMASK) @@ -1912,14 +1958,16 @@ static char *fmttoken(Lex_t *lp, register int sym, char *tok) sym = '#'; break; case SYMSEMI: + if(tok[0]=='<') + tok[n++] = '>'; sym = ';'; break; default: sym = 0; } - tok[1] = sym; + tok[n++] = sym; } - tok[2] = 0; + tok[n] = 0; return(tok); } diff --git a/usr/src/lib/libshell/common/sh/macro.c b/usr/src/lib/libshell/common/sh/macro.c index cb938764d6..684e2d0464 100644 --- a/usr/src/lib/libshell/common/sh/macro.c +++ b/usr/src/lib/libshell/common/sh/macro.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -38,6 +38,7 @@ #include "variables.h" #include "shlex.h" #include "io.h" +#include "jobs.h" #include "shnodes.h" #include "path.h" #include "national.h" @@ -529,8 +530,13 @@ static void copyto(register Mac_t *mp,int endch, int newquote) { /* preserve \digit for pattern matching */ /* also \alpha for extended patterns */ - if(!mp->lit && !mp->quote && (n==S_DIG || ((paren+ere) && sh_lexstates[ST_DOL][*(unsigned char*)cp]==S_ALP))) - break; + if(!mp->lit && !mp->quote) + { + if((n==S_DIG || ((paren+ere) && sh_lexstates[ST_DOL][*(unsigned char*)cp]==S_ALP))) + break; + if(ere && mp->pattern==1 && strchr(".[()*+?{|^$&!",*cp)) + break; + } /* followed by file expansion */ if(!mp->lit && (n==S_ESC || (!mp->quote && (n==S_PAT||n==S_ENDCH||n==S_SLASH||n==S_BRACT||*cp=='-')))) @@ -647,8 +653,14 @@ static void copyto(register Mac_t *mp,int endch, int newquote) int offset=0,oldpat = mp->pattern; int oldarith = mp->arith, oldsub=mp->subcopy; sfwrite(stkp,first,++c); - if((mp->assign&1) && first[c-2]=='.') - offset = stktell(stkp); + if(mp->assign&1) + { + if(first[c-2]=='.') + offset = stktell(stkp); + if(isastchar(*cp) && cp[1]==']') + errormsg(SH_DICT,ERROR_exit(1), +e_badsubscript,*cp); + } first = fcseek(c); mp->pattern = 4; mp->arith = 0; @@ -678,7 +690,7 @@ static void copyto(register Mac_t *mp,int endch, int newquote) { char *p = cp; while((c=mbchar(p)) && c!=RPAREN && c!='E'); - ere = c=='E'; + ere = (c=='E'||c=='A'); } } else if(n==RPAREN) @@ -892,7 +904,7 @@ static char *getdolarg(Shell_t *shp, int n, int *size) static char *prefix(Shell_t *shp, char *id) { Namval_t *np; - register char *cp = strchr(id,'.'); + register char *sub=0, *cp = strchr(id,'.'); if(cp) { *cp = 0; @@ -905,11 +917,23 @@ static char *prefix(Shell_t *shp, char *id) int n; char *sp; shp->argaddr = 0; - while(nv_isref(np)) + while(nv_isref(np) && np->nvalue.cp) + { + sub = nv_refsub(np); np = nv_refnode(np); - id = (char*)malloc(strlen(cp)+1+(n=strlen(sp=nv_name(np)))+1); - strcpy(&id[n],cp); + if(sub) + nv_putsub(np,sub,0L); + } + id = (char*)malloc(strlen(cp)+1+(n=strlen(sp=nv_name(np)))+ (sub?strlen(sub)+3:1)); memcpy(id,sp,n); + if(sub) + { + id[n++] = '['; + strcpy(&id[n],sub); + n+= strlen(sub)+1; + id[n-1] = ']'; + } + strcpy(&id[n],cp); return(id); } } @@ -961,7 +985,7 @@ int sh_macfun(Shell_t *shp, const char *name, int offset) tp = (Shnode_t*)&node; tp->com.comarg = (struct argnod*)dp; tp->com.comline = shp->inlineno; - dp->dolnum = 2; + dp->dolnum = 1; dp->dolval[0] = strdup(name); stkseek(shp->stk,offset); comsubst((Mac_t*)shp->mac_context,tp,2); @@ -1009,14 +1033,14 @@ static int varsub(Mac_t *mp) Namarr_t *ap=0; int dolmax=0, vsize= -1, offset= -1, nulflg, replen=0, bysub=0; char idbuff[3], *id = idbuff, *pattern=0, *repstr, *arrmax=0; - int addsub=0,oldpat=mp->pattern,idnum=0,flag=0,d; + int var=1,addsub=0,oldpat=mp->pattern,idnum=0,flag=0,d; Stk_t *stkp = mp->shp->stk; retry1: mp->zeros = 0; idbuff[0] = 0; idbuff[1] = 0; c = fcget(); - switch(c>0x7f?S_ALP:sh_lexstates[ST_DOL][c]) + switch(isascii(c)?sh_lexstates[ST_DOL][c]:S_ALP) { case S_RBRA: if(type<M_SIZE) @@ -1053,6 +1077,7 @@ retry1: } /* FALL THRU */ case S_SPC2: + var = 0; *id = c; v = special(mp->shp,c); if(isastchar(c)) @@ -1081,6 +1106,7 @@ retry1: comsubst(mp,(Shnode_t*)0,1); return(1); case S_DIG: + var = 0; c -= '0'; mp->shp->argaddr = 0; if(type) @@ -1117,7 +1143,7 @@ retry1: np = 0; do sfputc(stkp,c); - while(((c=fcget()),(c>0x7f||isaname(c)))||type && c=='.'); + while(((c=fcget()),(!isascii(c)||isaname(c)))||type && c=='.'); while(c==LBRACT && (type||mp->arrayok)) { mp->shp->argaddr=0; @@ -1204,10 +1230,14 @@ retry1: } else #endif /* SHOPT_FILESCAN */ - if(mp->shp->argaddr) - flag &= ~NV_NOADD; - np = nv_open(id,mp->shp->var_tree,flag|NV_NOFAIL); - if((!np || nv_isnull(np)) && type==M_BRACE && c==RBRACE && !(flag&NV_ARRAY)) + { + if(mp->shp->argaddr) + flag &= ~NV_NOADD; + np = nv_open(id,mp->shp->var_tree,flag|NV_NOFAIL); + } + if(isastchar(mode)) + var = 0; + if((!np || nv_isnull(np)) && type==M_BRACE && c==RBRACE && !(flag&NV_ARRAY) && strchr(id,'.')) { if(sh_macfun(mp->shp,id,offset)) { @@ -1215,6 +1245,13 @@ retry1: return(1); } } + if(np && (flag&NV_NOADD) && nv_isnull(np)) + { + if(nv_isattr(np,NV_NOFREE)) + nv_offattr(np,NV_NOFREE); + else + np = 0; + } ap = np?nv_arrayptr(np):0; if(type) { @@ -1299,7 +1336,15 @@ retry1: v = nv_getvtree(np,(Namfun_t*)0); else { - v = nv_getval(np); + if(type && fcpeek(0)=='+') + { + if(ap) + v = nv_arrayisset(np,ap)?(char*)"x":0; + else + v = nv_isnull(np)?0:(char*)"x"; + } + else + v = nv_getval(np); /* special case --- ignore leading zeros */ if( (mp->arith||mp->let) && (np->nvfun || nv_isattr(np,(NV_LJUST|NV_RJUST|NV_ZFILL))) && (offset==0 || !isalnum(c))) mp->zeros = 1; @@ -1345,6 +1390,7 @@ retry1: mac_error(np); if(type==M_NAMESCAN || type==M_NAMECOUNT) { + mp->shp->last_root = mp->shp->var_tree; id = prefix(mp->shp,id); stkseek(stkp,offset); if(type==M_NAMECOUNT) @@ -1432,6 +1478,7 @@ retry1: int quoted = mp->quoted; int arith = mp->arith; int zeros = mp->zeros; + int assign = mp->assign; if(newops) { type = fcget(); @@ -1446,6 +1493,7 @@ retry1: mp->pattern = 1+(c=='/'); mp->split = 0; mp->quoted = 0; + mp->assign &= ~1; mp->arith = mp->zeros = 0; newquote = 0; } @@ -1459,6 +1507,7 @@ retry1: mp->quoted = quoted; mp->arith = arith; mp->zeros = zeros; + mp->assign = assign; /* add null byte */ sfputc(stkp,0); stkseek(stkp,stktell(stkp)-1); @@ -1803,7 +1852,7 @@ retry2: mac_error(np); } } - else if(sh_isoption(SH_NOUNSET) && (!np || nv_isnull(np) || (nv_isarray(np) && !np->nvalue.cp))) + else if(var && sh_isoption(SH_NOUNSET) && (!np || nv_isnull(np) || (nv_isarray(np) && !np->nvalue.cp))) { if(np) { @@ -2467,7 +2516,6 @@ static char *sh_tilde(Shell_t *shp,register const char *string) */ static char *special(Shell_t *shp,register int c) { - register Namval_t *np; if(c!='$') shp->argaddr = 0; switch(c) @@ -2497,10 +2545,10 @@ static char *special(Shell_t *shp,register int c) case '?': return(ltos(shp->savexit)); case 0: - if(sh_isstate(SH_PROFILE) || !error_info.id || ((np=nv_search(error_info.id,shp->bltin_tree,0)) && nv_isattr(np,BLT_SPC))) + if(sh_isstate(SH_PROFILE) || shp->fn_depth==0 || !shp->st.cmdname) return(shp->shname); else - return(error_info.id); + return(shp->st.cmdname); } return(NIL(char*)); } diff --git a/usr/src/lib/libshell/common/sh/main.c b/usr/src/lib/libshell/common/sh/main.c index 793e978b56..54949b0d85 100644 --- a/usr/src/lib/libshell/common/sh/main.c +++ b/usr/src/lib/libshell/common/sh/main.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -37,6 +37,7 @@ #include "path.h" #include "io.h" #include "jobs.h" +#include "shlex.h" #include "shnodes.h" #include "history.h" #include "timeout.h" @@ -114,10 +115,14 @@ int sh_source(Shell_t *shp, Sfio_t *iop, const char *file) int fd; if (!file || !*file || (fd = path_open(file, PATHCOMP)) < 0) + { + REGRESS(source, "sh_source", ("%s:ENOENT", file)); return 0; + } oid = error_info.id; nid = error_info.id = strdup(file); shp->st.filename = path_fullname(stakptr(PATH_OFFSET)); + REGRESS(source, "sh_source", ("%s", file)); exfile(shp, iop, fd); error_info.id = oid; free(nid); @@ -177,6 +182,7 @@ int sh_main(int ac, char *av[], Shinit_f userinit) if((beenhere++)==0) { sh_onstate(SH_PROFILE); + ((Lex_t*)shp->lex_context)->nonstandard = 0; if(shp->ppid==1) shp->login_sh++; if(shp->login_sh >= 2) @@ -274,8 +280,10 @@ int sh_main(int ac, char *av[], Shinit_f userinit) /* open stream should have been passed into shell */ if(strmatch(name,e_devfdNN)) { +#if !_WINIX char *cp; int type; +#endif fdin = (int)strtol(name+8, (char**)0, 10); if(fstat(fdin,&statb)<0) errormsg(SH_DICT,ERROR_system(1),e_open,name); diff --git a/usr/src/lib/libshell/common/sh/name.c b/usr/src/lib/libshell/common/sh/name.c index bbdeeb83dd..2189a3a42a 100644 --- a/usr/src/lib/libshell/common/sh/name.c +++ b/usr/src/lib/libshell/common/sh/name.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -26,7 +26,6 @@ #define putenv ___putenv #include "defs.h" -#include <ctype.h> #include "variables.h" #include "path.h" #include "lexstates.h" @@ -88,6 +87,7 @@ struct adata struct Cache_entry { Dt_t *root; + Dt_t *last_root; char *name; Namval_t *np; Namval_t *last_table; @@ -283,7 +283,7 @@ struct argnod *nv_onlist(struct argnod *arg, const char *name) * Perform parameter assignment for a linked list of parameters * <flags> contains attributes for the parameters */ -void nv_setlist(register struct argnod *arg,register int flags) +void nv_setlist(register struct argnod *arg,register int flags, Namval_t *typ) { Shell_t *shp = &sh; register char *cp; @@ -340,6 +340,8 @@ void nv_setlist(register struct argnod *arg,register int flags) else cp = fp->fornam; error_info.line = fp->fortyp-shp->st.firstline; + if(!array && tp->tre.tretyp!=TLST && tp->com.comset && !tp->com.comarg && tp->com.comset->argval[0]==0 && tp->com.comset->argval[1]=='[') + array |= (tp->com.comset->argflag&ARG_MESSAGE)?NV_IARRAY:NV_ARRAY; if(shp->fn_depth && (Namval_t*)tp->com.comnamp==SYSTYPESET) flag |= NV_NOSCOPE; if(prefix && tp->com.comset && *cp=='[') @@ -359,13 +361,15 @@ void nv_setlist(register struct argnod *arg,register int flags) } } np = nv_open(cp,shp->var_tree,flag|NV_ASSIGN); + if(typ && !array && (nv_isnull(np) || nv_isarray(np))) + nv_settype(np,typ,0); if((flags&NV_STATIC) && !nv_isnull(np)) #if SHOPT_TYPEDEF goto check_type; #else continue; #endif /* SHOPT_TYPEDEF */ - if(array) + if(array && (!(ap=nv_arrayptr(np)) || !ap->hdr.type)) { if(!(arg->argflag&ARG_APPEND)) nv_unset(np); @@ -377,7 +381,9 @@ void nv_setlist(register struct argnod *arg,register int flags) { nv_onattr(np,NV_ARRAY); } - if(tp->tre.tretyp!=TLST && !tp->com.comset && !tp->com.comarg) + } + if(array && tp->tre.tretyp!=TLST && !tp->com.comset && !tp->com.comarg) + { #if SHOPT_TYPEDEF goto check_type; #else @@ -444,7 +450,7 @@ void nv_setlist(register struct argnod *arg,register int flags) if(!(array&NV_IARRAY) && !(tp->com.comset->argflag&ARG_MESSAGE)) nv_setarray(np,nv_associative); } - nv_setlist(tp->com.comset,flags); + nv_setlist(tp->com.comset,flags,0); shp->prefix = prefix; if(tp->com.comset->argval[1]!='[') nv_setvtree(np); @@ -496,17 +502,25 @@ void nv_setlist(register struct argnod *arg,register int flags) else shp->prefix = cp; shp->last_table = 0; - memset(&nr,0,sizeof(nr)); - memcpy(&node,L_ARGNOD,sizeof(node)); - L_ARGNOD->nvalue.nrp = &nr; - nr.np = np; - nr.root = shp->last_root; - nr.table = shp->last_table; - L_ARGNOD->nvflag = NV_REF|NV_NOFREE; - L_ARGNOD->nvfun = 0; + if(shp->prefix) + { + if(*shp->prefix=='_' && shp->prefix[1]=='.' && nv_isref(L_ARGNOD)) + { + sfprintf(stkstd,"%s%s",nv_name(L_ARGNOD->nvalue.nrp->np),shp->prefix+1); + shp->prefix = stkfreeze(stkstd,1); + } + memset(&nr,0,sizeof(nr)); + memcpy(&node,L_ARGNOD,sizeof(node)); + L_ARGNOD->nvalue.nrp = &nr; + nr.np = np; + nr.root = shp->last_root; + nr.table = shp->last_table; + L_ARGNOD->nvflag = NV_REF|NV_NOFREE; + L_ARGNOD->nvfun = 0; + } sh_exec(tp,sh_isstate(SH_ERREXIT)); #if SHOPT_TYPEDEF - if(!maketype) + if(shp->prefix) #endif { L_ARGNOD->nvalue.nrp = node.nvalue.nrp; @@ -523,7 +537,7 @@ void nv_setlist(register struct argnod *arg,register int flags) tp = tp->lst.lstrit; } - if(!nv_isarray(np) && (tp->com.comarg || !tp->com.comset || tp->com.comset->argval[0]!='[')) + if(!nv_isarray(np) && !typ && (tp->com.comarg || !tp->com.comset || tp->com.comset->argval[0]!='[')) nv_setvtree(np); #if SHOPT_TYPEDEF goto check_type; @@ -776,7 +790,10 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp) if(top) { if(nq==np) + { flags &= ~NV_NOSCOPE; + root = shp->var_base; + } else if(nq) { if(nv_isnull(np) && c!='.' && (np->nvfun=nv_cover(nq))) @@ -798,7 +815,7 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp) #endif if(c=='.') /* don't optimize */ shp->argaddr = 0; - else if((flags&NV_NOREF) && (c!='[' || *cp!='.')) + else if((flags&NV_NOREF) && (c!='[' && *cp!='.')) { if(c && !(flags&NV_NOADD)) nv_unref(np); @@ -835,6 +852,9 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp) flags &= ~NV_NOSCOPE; } flags |= NV_NOREF; + if(nv_isnull(np)) + nv_onattr(np,NV_NOFREE); + } shp->last_root = root; if(cp[1]=='.') @@ -867,8 +887,13 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp) { char *sub=0; int n = 0; + mode &= ~HASH_NOSCOPE; if(c=='[') { +#if 0 + Namarr_t *ap = nv_arrayptr(np); + int scan = ap?(ap->nelem&ARRAY_SCAN):0; +#endif n = mode|nv_isarray(np); if(!mode && (flags&NV_ARRAY) && ((c=sp[1])=='*' || c=='@') && sp[2]==']') { @@ -881,6 +906,10 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp) if(flags&NV_ASSIGN) n |= NV_ADD; cp = nv_endsubscript(np,sp,n|(flags&NV_ASSIGN)); +#if 0 + if(scan) + nv_putsub(np,NIL(char*),ARRAY_SCAN); +#endif } else cp = sp; @@ -1000,6 +1029,7 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp) if((nq = (*fp->disc->createf)(np,cp+1,flags,fp)) == np) { add = NV_ADD; + shp->last_table = 0; break; } else if(np=nq) @@ -1075,6 +1105,7 @@ void nv_delete(Namval_t* np, Dt_t *root, int flags) * If <flags> & NV_NOREF then don't follow reference * If <flags> & NV_NOFAIL then don't generate an error message on failure * If <flags> & NV_STATIC then unset before an assignment + * If <flags> & NV_UNJUST then unset attributes before assignment * SH_INIT is only set while initializing the environment */ Namval_t *nv_open(const char *name, Dt_t *root, int flags) @@ -1175,6 +1206,7 @@ Namval_t *nv_open(const char *name, Dt_t *root, int flags) if(nv_isarray(np)) nv_putsub(np,NIL(char*),ARRAY_UNDEF); shp->last_table = xp->last_table; + shp->last_root = xp->last_root; goto nocache; } } @@ -1209,6 +1241,7 @@ Namval_t *nv_open(const char *name, Dt_t *root, int flags) xp->root = root; xp->np = np; xp->last_table = shp->last_table; + xp->last_root = shp->last_root; xp->flags = (flags&(NV_ARRAY|NV_NOSCOPE)); nvcache.index = (nvcache.index+1)&(NVCACHE-1); } @@ -1241,7 +1274,6 @@ skip: if(np && shp->mktype) np = nv_addnode(np,0); #endif /* SHOPT_TYPEDEF */ - if(c=='=' && np && (flags&NV_ASSIGN)) { cp++; @@ -1259,7 +1291,10 @@ skip: if((flags&NV_STATIC) && !shp->mktype) { if(!nv_isnull(np)) + { + shp->prefix = prefix; return(np); + } } isref = nv_isref(np); if(sh_isoption(SH_XTRACE) && nv_isarray(np)) @@ -1267,9 +1302,18 @@ skip: c = msg==e_aliname? 0: (append | (flags&NV_EXPORT)); if(isref) nv_offattr(np,NV_REF); + if(!append && (flags&NV_UNJUST)) + { + nv_offattr(np,NV_LJUST|NV_RJUST|NV_ZFILL); + np->nvsize = 0; + } nv_putval(np, cp, c); if(isref) + { + if(nv_search((char*)np,shp->var_base,HASH_BUCKET)) + shp->last_root = shp->var_base; nv_setref(np,(Dt_t*)0,NV_VARNAME); + } savesub = sub; shp->prefix = prefix; } @@ -1325,7 +1369,7 @@ void nv_putval(register Namval_t *np, const char *string, int flags) sh.argaddr = 0; if(sh.subshell && !nv_local) np = sh_assignok(np,1); - if(np->nvfun && np->nvfun->disc && !(flags&NV_NODISC) && !nv_isattr(np,NV_REF)) + if(np->nvfun && np->nvfun->disc && !(flags&NV_NODISC) && !nv_isref(np)) { /* This function contains disc */ if(!nv_local) @@ -1387,7 +1431,7 @@ void nv_putval(register Namval_t *np, const char *string, int flags) up->ldp = new_of(Sfdouble_t,0); else if(flags&NV_APPEND) old = *(up->ldp); - *(up->ldp) = ld+old; + *(up->ldp) = old?ld+old:ld; } else { @@ -1407,7 +1451,7 @@ void nv_putval(register Namval_t *np, const char *string, int flags) up->dp = new_of(double,0); else if(flags&NV_APPEND) od = *(up->dp); - *(up->dp) = d+od; + *(up->dp) = od?d+od:d; } } else @@ -1957,7 +2001,7 @@ static int scanfilter(Dt_t *dict, void *arg, void *data) register struct adata *tp = (struct adata*)sp->scandata; NOT_USED(dict); #if SHOPT_TYPEDEF - if(tp && tp->tp && nv_type(np)!=tp->tp) + if(tp && !is_abuiltin(np) && tp && tp->tp && nv_type(np)!=tp->tp) return(0); #endif /*SHOPT_TYPEDEF */ if(sp->scanmask?(k&sp->scanmask)==sp->scanflags:(!sp->scanflags || (k&sp->scanflags))) @@ -2014,7 +2058,7 @@ void sh_scope(Shell_t *shp, struct argnod *envlist, int fun) { dtview(newscope,(Dt_t*)shp->var_tree); shp->var_tree = newscope; - nv_setlist(envlist,NV_EXPORT|NV_NOSCOPE|NV_IDENT|NV_ASSIGN); + nv_setlist(envlist,NV_EXPORT|NV_NOSCOPE|NV_IDENT|NV_ASSIGN,0); if(!fun) return; shp->var_tree = dtview(newscope,0); @@ -2039,6 +2083,10 @@ void sh_envnolocal (register Namval_t *np, void *data) { char *cp=0; NOT_USED(data); + if(np==VERSIONNOD && nv_isref(np)) + return; + if(np==L_ARGNOD) + return; if(nv_isattr(np,NV_EXPORT) && nv_isarray(np)) { nv_putsub(np,NIL(char*),0); @@ -2047,7 +2095,7 @@ void sh_envnolocal (register Namval_t *np, void *data) } if(nv_isattr(np,NV_EXPORT|NV_NOFREE)) { - if(nv_isref(np)) + if(nv_isref(np) && np!=VERSIONNOD) { nv_offattr(np,NV_NOFREE|NV_REF); free((void*)np->nvalue.nrp); @@ -2082,7 +2130,11 @@ static void table_unset(Shell_t *shp, register Dt_t *root, int flags, Dt_t *oroo for(np=(Namval_t*)dtfirst(root);np;np=npnext) { if(nv_isref(np)) - nv_unref(np); + { + free((void*)np->nvalue.nrp); + np->nvalue.cp = 0; + np->nvflag = 0; + } if(nq=dtsearch(oroot,np)) { if(nv_cover(nq)) @@ -2094,6 +2146,8 @@ static void table_unset(Shell_t *shp, register Dt_t *root, int flags, Dt_t *oroo Sfdouble_t d = nv_getnum(nq); nv_putval(nq,(char*)&d,NV_LDOUBLE); } + else if(shp->test&4) + nv_putval(nq, strdup(nv_getval(nq)), NV_RDONLY); else nv_putval(nq, nv_getval(nq), NV_RDONLY); shp->subshell = subshell; @@ -2200,6 +2254,11 @@ void _nv_unset(register Namval_t *np,int flags) /* called from disc, assign the actual value */ nv_local=0; } + if(nv_isattr(np,NV_INT16P) == NV_INT16) + { + np->nvalue.cp = nv_isarray(np)?Empty:0; + goto done; + } if(nv_isarray(np) && np->nvalue.cp!=Empty && np->nvfun) up = np->nvalue.up; else @@ -2604,6 +2663,7 @@ void nv_newattr (register Namval_t *np, unsigned newatts, int size) Namarr_t *ap = 0; int oldsize,oldatts; Namfun_t *fp= (newatts&NV_NODISC)?np->nvfun:0; + char *prefix = sh.prefix; newatts &= ~NV_NODISC; /* check for restrictions */ @@ -2623,7 +2683,8 @@ void nv_newattr (register Namval_t *np, unsigned newatts, int size) sh_envput(sh.env,np); } #endif - if((size==0||(n&NV_INTEGER)) && ((n^newatts)&~NV_NOCHANGE)==0) + oldsize = nv_size(np); + if((size==oldsize|| (n&NV_INTEGER)) && ((n^newatts)&~NV_NOCHANGE)==0) { if(size) nv_setsize(np,size); @@ -2684,6 +2745,7 @@ void nv_newattr (register Namval_t *np, unsigned newatts, int size) np->nvfun = fp; if(ap) ap->nelem--; + sh.prefix = prefix; return; } @@ -2800,11 +2862,20 @@ static char *lastdot(register char *cp, int eq) while(c= *cp++) { if(c=='[') - cp = nv_endsubscript((Namval_t*)0,ep=cp,0); + { + if(*cp==']') + cp++; + else + cp = nv_endsubscript((Namval_t*)0,ep=cp,0); + } else if(c=='.') { if(*cp=='[') - cp = nv_endsubscript((Namval_t*)0,cp,0); + { + cp = nv_endsubscript((Namval_t*)0,ep=cp,0); + if((ep=sh_checkid(ep+1,cp)) < cp) + cp=strcpy(ep,cp); + } ep = 0; } else if(eq && c == '=') @@ -2822,6 +2893,7 @@ int nv_rename(register Namval_t *np, int flags) Namval_t *last_table = shp->last_table; Dt_t *last_root = shp->last_root; Dt_t *hp = 0; + char *prefix=shp->prefix,*nvenv = 0; if(nv_isattr(np,NV_PARAM) && shp->st.prevst) { if(!(hp=(Dt_t*)shp->st.prevst->save_tree)) @@ -2837,6 +2909,7 @@ int nv_rename(register Namval_t *np, int flags) errormsg(SH_DICT,ERROR_exit(1),e_varname,nv_name(np)); if(nv_isarray(np) && !(mp=nv_opensub(np))) index=nv_aindex(np); + shp->prefix = 0; if(!hp) hp = shp->var_tree; if(!(nr = nv_open(cp, hp, flags|NV_ARRAY|NV_NOREF|NV_NOSCOPE|NV_NOADD|NV_NOFAIL))) @@ -2845,6 +2918,7 @@ int nv_rename(register Namval_t *np, int flags) hp = shp->last_root; if(!nr) nr= nv_open(cp, hp, flags|NV_NOREF|((flags&NV_MOVE)?0:NV_NOFAIL)); + shp->prefix = prefix; if(!nr) { if(!nv_isvtree(np)) @@ -2859,7 +2933,10 @@ int nv_rename(register Namval_t *np, int flags) mp->nvenv = (void*)np; } if(mp) + { + nvenv = (char*)np; np = mp; + } if(nr==np) { if(index<0) @@ -2868,6 +2945,8 @@ int nv_rename(register Namval_t *np, int flags) cp = strdup(cp); } _nv_unset(np,0); + if(!nv_isattr(np,NV_MINIMAL)) + np->nvenv = nvenv; if(nr==np) { nv_putsub(np,(char*)0, index); @@ -2892,7 +2971,9 @@ void nv_setref(register Namval_t *np, Dt_t *hp, int flags) { Shell_t *shp = &sh; register Namval_t *nq, *nr=0; - register char *ep,*cp; + register char *ep,*cp; + Dt_t *root = shp->last_root; + Namarr_t *ap; if(nv_isref(np)) return; if(nv_isarray(np)) @@ -2908,13 +2989,22 @@ void nv_setref(register Namval_t *np, Dt_t *hp, int flags) if(!hp) hp = shp->var_tree; if(!(nr = nq = nv_open(cp, hp, flags|NV_NOSCOPE|NV_NOADD|NV_NOFAIL))) - hp = shp->var_base; + hp = shp->last_root==shp->var_tree?shp->var_tree:shp->var_base; else if(shp->last_root) hp = shp->last_root; if(nq && ep && nv_isarray(nq) && !nv_getsub(nq)) nv_endsubscript(nq,ep-1,NV_ADD); if(!nr) + { nr= nq = nv_open(cp, hp, flags); + hp = shp->last_root; + } + if(shp->last_root == shp->var_tree && root!=shp->var_tree) + { + _nv_unset(np,NV_RDONLY); + nv_onattr(np,NV_REF); + errormsg(SH_DICT,ERROR_exit(1),e_globalref,nv_name(np)); + } if(nr==np) { if(shp->namespace && nv_dict(shp->namespace)==hp) @@ -2923,6 +3013,8 @@ void nv_setref(register Namval_t *np, Dt_t *hp, int flags) if(!(hp=dtvnext(hp)) || (nq=nv_search((char*)np,hp,NV_ADD|HASH_BUCKET))==np) errormsg(SH_DICT,ERROR_exit(1),e_selfref,nv_name(np)); } + if(nq && !ep && (ap=nv_arrayptr(nq)) && !(ap->nelem&(ARRAY_UNDEF|ARRAY_SCAN))) + ep = nv_getsub(nq); if(ep) { /* cause subscript evaluation and return result */ @@ -3017,8 +3109,10 @@ void nv_unref(register Namval_t *np) Namval_t *nq; if(!nv_isref(np)) return; - nq = nv_refnode(np); nv_offattr(np,NV_NOFREE|NV_REF); + if(!np->nvalue.nrp) + return; + nq = nv_refnode(np); free((void*)np->nvalue.nrp); np->nvalue.cp = strdup(nv_name(nq)); #if SHOPT_OPTIMIZE diff --git a/usr/src/lib/libshell/common/sh/nvdisc.c b/usr/src/lib/libshell/common/sh/nvdisc.c index bcf987b9a6..94b2d28ca9 100644 --- a/usr/src/lib/libshell/common/sh/nvdisc.c +++ b/usr/src/lib/libshell/common/sh/nvdisc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -150,16 +150,17 @@ void nv_putv(Namval_t *np, const char *value, int flags, register Namfun_t *nfp) } } -#define LOOKUP 0 +#define LOOKUPS 0 #define ASSIGN 1 #define APPEND 2 #define UNASSIGN 3 +#define LOOKUPN 4 #define BLOCKED ((Namval_t*)&nv_local) struct vardisc { Namfun_t fun; - Namval_t *disc[4]; + Namval_t *disc[5]; }; struct blocked @@ -281,12 +282,12 @@ static void assign(Namval_t *np,const char* val,int flags,Namfun_t *handle) { int bflag; block(bp,type); - if (type==APPEND && (bflag= !isblocked(bp,LOOKUP))) - block(bp,LOOKUP); + if (type==APPEND && (bflag= !isblocked(bp,LOOKUPS))) + block(bp,LOOKUPS); sh_fun(nq,np,(char**)0); unblock(bp,type); if(bflag) - unblock(bp,LOOKUP); + unblock(bp,LOOKUPS); if(!vp->disc[type]) chktfree(np,vp); } @@ -351,15 +352,15 @@ done: * This function executes a lookup disc and then performs * the lookup on the given node <np> */ -static char* lookup(Namval_t *np, Namfun_t *handle) +static char* lookup(Namval_t *np, int type, Sfdouble_t *dp,Namfun_t *handle) { register struct vardisc *vp = (struct vardisc*)handle; struct blocked block, *bp = block_info(np, &block); - register Namval_t *nq = vp->disc[LOOKUP]; + register Namval_t *nq = vp->disc[type]; register char *cp=0; Namval_t node; union Value *up = np->nvalue.up; - if(nq && !isblocked(bp,LOOKUP)) + if(nq && !isblocked(bp,type)) { node = *SH_VALNOD; if(!nv_isnull(SH_VALNOD)) @@ -367,16 +368,24 @@ static char* lookup(Namval_t *np, Namfun_t *handle) nv_onattr(SH_VALNOD,NV_NOFREE); nv_unset(SH_VALNOD); } - block(bp,LOOKUP); + if(type==LOOKUPN) + { + nv_onattr(SH_VALNOD,NV_DOUBLE|NV_INTEGER); + nv_setsize(SH_VALNOD,10); + } + block(bp,type); sh_fun(nq,np,(char**)0); - unblock(bp,LOOKUP); - if(!vp->disc[LOOKUP]) + unblock(bp,type); + if(!vp->disc[type]) chktfree(np,vp); - if(cp = nv_getval(SH_VALNOD)) + if(type==LOOKUPN) { - cp = stkcopy(stkstd,cp); - _nv_unset(SH_VALNOD,NV_RDONLY); + cp = (char*)(SH_VALNOD->nvalue.cp); + *dp = nv_getnum(SH_VALNOD); } + else if(cp = nv_getval(SH_VALNOD)) + cp = stkcopy(stkstd,cp); + _nv_unset(SH_VALNOD,NV_RDONLY); if(!nv_isnull(&node)) { /* restore everything but the nvlink field */ @@ -386,19 +395,29 @@ static char* lookup(Namval_t *np, Namfun_t *handle) if(nv_isarray(np)) np->nvalue.up = up; if(!cp) - cp = nv_getv(np,handle); + { + if(type==LOOKUPS) + cp = nv_getv(np,handle); + else + *dp = nv_getn(np,handle); + } if(bp== &block) block_done(bp); return(cp); } +static char* lookups(Namval_t *np, Namfun_t *handle) +{ + return(lookup(np,LOOKUPS,(Sfdouble_t*)0,handle)); +} -static const Namdisc_t shdisc = +static Sfdouble_t lookupn(Namval_t *np, Namfun_t *handle) { - sizeof(struct vardisc), - assign, - lookup -}; + Sfdouble_t d; + lookup(np,LOOKUPN, &d ,handle); + return(d); +} + /* * Set disc on given <event> to <action> @@ -465,11 +484,16 @@ char *nv_setdisc(register Namval_t* np,register const char *event,Namval_t *acti vp = 0; if(!vp) { + Namdisc_t *dp; if(action==np) return((char*)action); - if(!(vp = newof(NIL(struct vardisc*),struct vardisc,1,0))) + if(!(vp = newof(NIL(struct vardisc*),struct vardisc,1,sizeof(Namdisc_t)))) return(0); - vp->fun.disc = &shdisc; + dp = (Namdisc_t*)(vp+1); + vp->fun.disc = dp; + memset(dp,0,sizeof(*dp)); + dp->dsize = sizeof(struct vardisc); + dp->putval = assign; nv_stack(np, (Namfun_t*)vp); } if(action==np) @@ -478,7 +502,14 @@ char *nv_setdisc(register Namval_t* np,register const char *event,Namval_t *acti empty = 0; } else if(action) + { + Namdisc_t *dp = (Namdisc_t*)vp->fun.disc; + if(type==LOOKUPS) + dp->getval = lookups; + else if(type==LOOKUPN) + dp->getnum = lookupn; vp->disc[type] = action; + } else { struct blocked *bp; @@ -573,13 +604,14 @@ Namfun_t *nv_clone_disc(register Namfun_t *fp, int flags) { register Namfun_t *nfp; register int size; + if(!fp->disc && !fp->next && (fp->nofree&1)) + return(fp); if(!(size=fp->dsize) && (!fp->disc || !(size=fp->disc->dsize))) size = sizeof(Namfun_t); if(!(nfp=newof(NIL(Namfun_t*),Namfun_t,1,size-sizeof(Namfun_t)))) return(0); memcpy(nfp,fp,size); - if(flags&NV_COMVAR) - nfp->nofree &= ~1; + nfp->nofree &= ~1; nfp->nofree |= (flags&NV_RDONLY)?1:0; return(nfp); } @@ -901,7 +933,10 @@ int nv_clone(Namval_t *np, Namval_t *mp, int flags) return(1); } if(nv_isattr(np,NV_INTEGER) && mp->nvalue.ip!=np->nvalue.ip) + { mp->nvalue.ip = (int*)num_clone(np,(void*)np->nvalue.ip); + nv_offattr(mp,NV_NOFREE); + } else if(flags&NV_NOFREE) nv_onattr(np,NV_NOFREE); return(1); @@ -972,7 +1007,7 @@ Namval_t *nv_search(const char *name, Dt_t *root, int mode) } else { - if(*name=='.' && root==sh.var_tree) + if(*name=='.' && root==sh.var_tree && !dp) root = sh.var_base; np = dtmatch(root,(void*)name); } diff --git a/usr/src/lib/libshell/common/sh/nvtree.c b/usr/src/lib/libshell/common/sh/nvtree.c index d493b5d602..36d7d933e3 100644 --- a/usr/src/lib/libshell/common/sh/nvtree.c +++ b/usr/src/lib/libshell/common/sh/nvtree.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -193,6 +193,8 @@ void *nv_diropen(Namval_t *np,const char *name) last = 0; } } + else + dp->hp = (Namval_t*)dtfirst(dp->root); } else dp->hp = (Namval_t*)dtfirst(dp->root); @@ -283,7 +285,7 @@ char *nv_dirnext(void *dir) if(nv_isarray(np)) nv_putsub(np,(char*)0, ARRAY_UNDEF); dp->hp = nextnode(dp); - if(nv_isnull(np) && !nv_isarray(np)) + if(nv_isnull(np) && !nv_isarray(np) && !nv_isattr(np,NV_INTEGER)) continue; last_table = sh.last_table; #if 0 @@ -417,7 +419,7 @@ void nv_attribute(register Namval_t *np,Sfio_t *out,char *prefix,int noname) { if(nv_isvtree(np)) sfprintf(out,"%s -C ",prefix); - else if(!np->nvalue.cp && nv_isattr(np,~NV_NOFREE)==NV_MINIMAL && strcmp(np->nvname,"_")) + else if((!np->nvalue.cp||np->nvalue.cp==Empty) && nv_isattr(np,~NV_NOFREE)==NV_MINIMAL && strcmp(np->nvname,"_")) sfputr(out,prefix,' '); } return; @@ -478,7 +480,7 @@ void nv_attribute(register Namval_t *np,Sfio_t *out,char *prefix,int noname) } else if(tp->sh_name[1]=='A') continue; - if(ap && (ap->nelem&ARRAY_TREE)) + if((ap && (ap->nelem&ARRAY_TREE)) || (!ap && nv_isattr(np,NV_NOFREE))) { if(prefix && *prefix) sfwrite(out,"-C ",3); @@ -592,6 +594,8 @@ void nv_outnode(Namval_t *np, Sfio_t* out, int indent, int special) if(mp && nv_isvtree(mp)) nv_onattr(mp,NV_EXPORT); ep = nv_getval(mp?mp:np); + if(ep==Empty) + ep = 0; xp = 0; if(!ap && nv_isattr(np,NV_INTEGER|NV_LJUST)==NV_LJUST) { @@ -681,7 +685,7 @@ static void outval(char *name, const char *vname, struct Walk *wp) if(!xp) return; } - if((nv_isnull(np) || np->nvalue.cp==Empty) && !nv_isarray(np)) + if(nv_isnull(np) && !nv_isarray(np) && !nv_isattr(np,NV_INTEGER)) return; if(special || (nv_isarray(np) && nv_arrayptr(np))) { @@ -718,7 +722,7 @@ static void outval(char *name, const char *vname, struct Walk *wp) if(*name!='.') nv_attribute(np,wp->out,"typeset",'='); nv_outname(wp->out,name,-1); - if(np->nvalue.cp || nv_isattr(np,~(NV_MINIMAL|NV_NOFREE)) || nv_isvtree(np)) + if((np->nvalue.cp && np->nvalue.cp!=Empty) || nv_isattr(np,~(NV_MINIMAL|NV_NOFREE)) || nv_isvtree(np)) sfputc(wp->out,(isarray==2?'\n':'=')); if(isarray==2) return; @@ -819,15 +823,24 @@ static char **genvalue(char **argv, const char *prefix, int n, struct Walk *wp) } else if(outfile && !wp->nofollow && argv[1] && memcmp(arg,argv[1],l=strlen(arg))==0 && argv[1][l]=='[') { + int k=1; + Namarr_t *ap=0; Namval_t *np = nv_open(arg,wp->root,NV_VARNAME|NV_NOADD|NV_NOASSIGN|wp->noscope); if(!np) continue; - wp->array = nv_isarray(np); + if((wp->array = nv_isarray(np)) && (ap=nv_arrayptr(np))) + k = array_elem(ap); + if(wp->indent>0) sfnputc(outfile,'\t',wp->indent); nv_attribute(np,outfile,"typeset",1); nv_close(np); - sfputr(outfile,arg+m+r+(n?n:0),'='); + sfputr(outfile,arg+m+r+(n?n:0),(k?'=':'\n')); + if(!k) + { + wp->array=0; + continue; + } wp->nofollow=1; argv = genvalue(argv,cp,cp-arg ,wp); sfputc(outfile,wp->indent<0?';':'\n'); @@ -1031,7 +1044,7 @@ static void put_tree(register Namval_t *np, const char *val, int flags,Namfun_t Shell_t *shp = sh_getinterp(); Namval_t *last_table = shp->last_table; Dt_t *last_root = shp->last_root; - Namval_t *mp = val?nv_open(val,shp->var_tree,NV_VARNAME|NV_NOADD|NV_NOASSIGN|NV_NOFAIL):0; + Namval_t *mp = val?nv_open(val,shp->var_tree,NV_VARNAME|NV_NOADD|NV_NOASSIGN|NV_ARRAY|NV_NOFAIL):0; if(mp && nv_isvtree(mp)) { shp->prev_table = shp->last_table; diff --git a/usr/src/lib/libshell/common/sh/nvtype.c b/usr/src/lib/libshell/common/sh/nvtype.c index a17bc99fda..82eab00d83 100644 --- a/usr/src/lib/libshell/common/sh/nvtype.c +++ b/usr/src/lib/libshell/common/sh/nvtype.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -248,6 +248,13 @@ static void put_chtype(Namval_t* np, const char* val, int flag, Namfun_t* fp) } } +static Namfun_t *clone_chtype(Namval_t* np, Namval_t *mp, int flags, Namfun_t *fp) +{ + if(flags&NV_NODISC) + return(0); + return(nv_clone_disc(fp,flags)); +} + static const Namdisc_t chtype_disc = { sizeof(Namchld_t), @@ -256,7 +263,7 @@ static const Namdisc_t chtype_disc = 0, 0, 0, - 0, + clone_chtype, name_chtype }; @@ -394,7 +401,7 @@ static Namfun_t *clone_type(Namval_t* np, Namval_t *mp, int flags, Namfun_t *fp) nrp++; nq = nq->nvalue.nrp->np; } - if(nq->nvalue.cp || nv_isarray(nq) || nv_isattr(nq,NV_RDONLY)) + if(nq->nvalue.cp || !nv_isvtree(nq) || nv_isattr(nq,NV_RDONLY)) { /* see if default value has been overwritten */ if(!mp->nvname) @@ -796,7 +803,7 @@ void nv_addtype(Namval_t *np, const char *optstr, Optdisc_t *op, size_t optsz) nv_onattr(np, NV_RDONLY); } -static void addtype(Namval_t *mp) +void nv_newtype(Namval_t *mp) { struct { Optdisc_t opt; @@ -1113,8 +1120,10 @@ else sfprintf(sfstderr,"tp==NULL\n"); if(nv_isarray(nq) && !nq->nvfun) { nv_putsub(nq, (char*)0, ARRAY_FILL); - ((Namarr_t*)nq->nvfun)->nelem--; - + if(nv_isattr(nq,NV_INTEGER)) + nv_putval(nq, "0",0); + else + ((Namarr_t*)nq->nvfun)->nelem--; } nv_disc(nq, &pp->childfun.fun, NV_LAST); if(nq->nvfun) @@ -1139,6 +1148,8 @@ else sfprintf(sfstderr,"tp==NULL\n"); if(!j) free((void*)np->nvalue.cp); } + if(!nq->nvalue.cp && nq->nvfun== &pp->childfun.fun) + nq->nvalue.cp = Empty; np->nvalue.cp = 0; #if 0 offset += dsize; @@ -1170,7 +1181,7 @@ else sfprintf(sfstderr,"tp==NULL\n"); } if(mnodes!=nodes) free((void*)mnodes); - addtype(mp); + nv_newtype(mp); return(mp); } @@ -1207,7 +1218,7 @@ Namval_t *nv_mkinttype(char *name, size_t size, int sign, const char *help, Namd if(!sign) nv_onattr(mp,NV_UNSIGN); nv_disc(mp, fp, NV_LAST); - addtype(mp); + nv_newtype(mp); return(mp); } @@ -1230,6 +1241,11 @@ void nv_typename(Namval_t *tp, Sfio_t *out) Namval_t *nv_type(Namval_t *np) { Namfun_t *fp; + if(nv_isattr(np,NV_BLTIN|BLT_DCL)==(NV_BLTIN|BLT_DCL)) + { + Namdecl_t *ntp = (Namdecl_t*)nv_context(np); + return(ntp?ntp->tp:0); + } for(fp=np->nvfun; fp; fp=fp->next) { if(fp->type) @@ -1326,6 +1342,7 @@ int nv_settype(Namval_t* np, Namval_t *tp, int flags) np->nvalue.up = 0; nofree = ap->hdr.nofree; ap->hdr.nofree = 0; + ap->hdr.type = tp; nv_disc(np, &ap->hdr, NV_FIRST); ap->hdr.nofree = nofree; nv_onattr(np,NV_ARRAY); @@ -1492,7 +1509,7 @@ Namval_t *nv_mkstruct(const char *name, int rsize, Fields_t *fields) nv_setsize(mp,rsize); nv_disc(mp, &pp->fun, NV_LAST); mp->nvalue.cp = pp->data; - addtype(mp); + nv_newtype(mp); return(mp); } diff --git a/usr/src/lib/libshell/common/sh/parse.c b/usr/src/lib/libshell/common/sh/parse.c index bccbd49d50..c7290d20e7 100644 --- a/usr/src/lib/libshell/common/sh/parse.c +++ b/usr/src/lib/libshell/common/sh/parse.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -32,8 +32,8 @@ #include "defs.h" #else #include <shell.h> -#endif #include <ctype.h> +#endif #include <fcin.h> #include <error.h> #include "shlex.h" @@ -293,7 +293,7 @@ void *sh_parse(Shell_t *shp, Sfio_t *iop, int flag) Fcin_t sav_input; struct argnod *sav_arg = lexp->arg; int sav_prompt = shp->nextprompt; - if(shp->binscript && sffileno(iop)==shp->infd) + if(shp->binscript && (sffileno(iop)==shp->infd || (flag&SH_FUNEVAL))) return((void*)sh_trestore(shp,iop)); fcsave(&sav_input); shp->st.staklist = 0; @@ -323,12 +323,13 @@ void *sh_parse(Shell_t *shp, Sfio_t *iop, int flag) lexp->arg = sav_arg; if(version > 3) errormsg(SH_DICT,ERROR_exit(1),e_lexversion); - if(sffileno(iop)==shp->infd) + if(sffileno(iop)==shp->infd || (flag&SH_FUNEVAL)) shp->binscript = 1; sfgetc(iop); return((void*)sh_trestore(shp,iop)); } } + flag &= ~SH_FUNEVAL; if((flag&SH_NL) && (shp->inlineno=error_info.line+shp->st.firstline)==0) shp->inlineno=1; #if KSHELL @@ -718,7 +719,7 @@ static Shnode_t *funct(Lex_t *lexp) { if(fcfill() >= 0) fcseek(-1); - if(sh_isstate(SH_HISTORY)) + if(sh_isstate(SH_HISTORY) && shp->hist_ptr) t->funct.functloc = sfseek(shp->hist_ptr->histfp,(off_t)0,SEEK_CUR); else { @@ -1177,13 +1178,13 @@ static Shnode_t *item(Lex_t *lexp,int flag) case LBRACE: comsub = lexp->comsub; lexp->comsub = 0; - t = sh_cmd(lexp,RBRACE,SH_NL); + t = sh_cmd(lexp,RBRACE,SH_NL|SH_SEMI); lexp->comsub = comsub; break; case LPAREN: t = getnode(parnod); - t->par.partre=sh_cmd(lexp,RPAREN,SH_NL); + t->par.partre=sh_cmd(lexp,RPAREN,SH_NL|SH_SEMI); t->par.partyp=TPAR; break; @@ -1224,6 +1225,20 @@ done: return(t); } +static struct argnod *process_sub(Lex_t *lexp,int tok) +{ + struct argnod *argp; + Shnode_t *t; + int mode = (tok==OPROCSYM); + t = sh_cmd(lexp,RPAREN,SH_NL); + argp = (struct argnod*)stkalloc(lexp->sh->stk,sizeof(struct argnod)); + *argp->argval = 0; + argp->argchn.ap = (struct argnod*)makeparent(lexp,mode?TFORK|FPIN|FAMP|FPCL:TFORK|FPOU,t); + argp->argflag = (ARG_EXP|mode); + return(argp); +} + + /* * This is for a simple command, for list, or compound assignment */ @@ -1278,7 +1293,7 @@ static Shnode_t *simple(Lex_t *lexp,int flag, struct ionod *io) if(assignment==1) { last = strchr(argp->argval,'='); - if((cp=strchr(argp->argval,'[')) && (cp < last)) + if(last && (last[-1]==']'|| (last[-1]=='+' && last[-2]==']')) && (cp=strchr(argp->argval,'[')) && (cp < last)) last = cp; stkseek(stkp,ARGVAL); sfwrite(stkp,argp->argval,last-argp->argval); @@ -1338,17 +1353,11 @@ static Shnode_t *simple(Lex_t *lexp,int flag, struct ionod *io) #if SHOPT_DEVFD if((tok==IPROCSYM || tok==OPROCSYM)) { - Shnode_t *t; - int mode = (tok==OPROCSYM); - t = sh_cmd(lexp,RPAREN,SH_NL); - argp = (struct argnod*)stkalloc(stkp,sizeof(struct argnod)); - *argp->argval = 0; + argp = process_sub(lexp,tok); argmax = 0; argno = -1; *argtail = argp; argtail = &(argp->argnxt.ap); - argp->argchn.ap = (struct argnod*)makeparent(lexp,mode?TFORK|FPIN|FAMP|FPCL:TFORK|FPOU,t); - argp->argflag = (ARG_EXP|mode); goto retry; } #endif /* SHOPT_DEVFD */ @@ -1502,9 +1511,7 @@ static struct ionod *inout(Lex_t *lexp,struct ionod *lastio,int flag) register struct ionod *iop; Stk_t *stkp = lexp->sh->stk; char *iovname=0; -#if SHOPT_BASH register int errout=0; -#endif if(token==IOVNAME) { iovname=lexp->arg->argval+1; @@ -1518,6 +1525,8 @@ static struct ionod *inout(Lex_t *lexp,struct ionod *lastio,int flag) iof |= (IODOC|IORAW); else if(token==IOMOV0SYM) iof |= IOMOV; + else if(token==IORDWRSYMT) + iof |= IORDW|IOREWRITE; else if(token==IORDWRSYM) iof |= IORDW; else if((token&SYMSHARP) == SYMSHARP) @@ -1532,13 +1541,11 @@ static struct ionod *inout(Lex_t *lexp,struct ionod *lastio,int flag) break; case '>': -#if SHOPT_BASH if(iof<0) { errout = 1; iof = 1; } -#endif iof |= IOPUT; if(token==IOAPPSYM) iof |= IOAPP; @@ -1570,10 +1577,18 @@ static struct ionod *inout(Lex_t *lexp,struct ionod *lastio,int flag) } else if(token==EXPRSYM && (iof&IOLSEEK)) iof |= IOARITH; + else if(((token==IPROCSYM && !(iof&IOPUT)) || (token==OPROCSYM && (iof&IOPUT))) && !(iof&(IOLSEEK|IOREWRITE|IOMOV|IODOC))) + { + lexp->arg = process_sub(lexp,token); + iof |= IOPROCSUB; + } else sh_syntax(lexp); } - iop->ioname=lexp->arg->argval; + if( (iof&IOPROCSUB) && !(iof&IOLSEEK)) + iop->ioname= (char*)lexp->arg->argchn.ap; + else + iop->ioname=lexp->arg->argval; iop->iovname = iovname; if(iof&IODOC) { @@ -1622,18 +1637,17 @@ static struct ionod *inout(Lex_t *lexp,struct ionod *lastio,int flag) { struct ionod *ioq=iop; sh_lex(lexp); -#if SHOPT_BASH if(errout) { /* redirect standard output to standard error */ ioq = (struct ionod*)stkalloc(stkp,sizeof(struct ionod)); + memset(ioq,0,sizeof(*ioq)); ioq->ioname = "1"; ioq->iolst = 0; ioq->iodelim = 0; ioq->iofile = IORAW|IOPUT|IOMOV|2; iop->ionxt=ioq; } -#endif ioq->ionxt=inout(lexp,lastio,flag); } else diff --git a/usr/src/lib/libshell/common/sh/path.c b/usr/src/lib/libshell/common/sh/path.c index fc91fb34e4..94af2fe682 100644 --- a/usr/src/lib/libshell/common/sh/path.c +++ b/usr/src/lib/libshell/common/sh/path.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -57,6 +57,7 @@ static int canexecute(char*,int); static void funload(Shell_t*,int,const char*); static void exscript(Shell_t*,char*, char*[], char**); static int path_chkpaths(Pathcomp_t*,Pathcomp_t*,Pathcomp_t*,int); +static void path_checkdup(register Pathcomp_t*); static const char *std_path; @@ -352,6 +353,7 @@ static char *path_lib(Pathcomp_t *pp, char *path) char save[8]; for( ;pp; pp=pp->next) { + path_checkdup(pp); if(pp->ino==statb.st_ino && pp->dev==statb.st_dev && pp->mtime==statb.st_mtime) return(pp->lib); } @@ -380,19 +382,63 @@ void path_dump(register Pathcomp_t *pp) #endif /* + * check for duplicate directories on PATH + */ +static void path_checkdup(register Pathcomp_t *pp) +{ + register char *name = pp->name; + register Pathcomp_t *oldpp,*first; + register int flag=0; + struct stat statb; + if(stat(name,&statb)<0 || !S_ISDIR(statb.st_mode)) + { + pp->flags |= PATH_SKIP; + pp->dev = *name=='/'; + return; + } + pp->mtime = statb.st_mtime; + pp->ino = statb.st_ino; + pp->dev = statb.st_dev; + if(*name=='/' && onstdpath(name)) + flag = PATH_STD_DIR; + first = (pp->flags&PATH_CDPATH)?pp->shp->cdpathlist:path_get(""); + for(oldpp=first; oldpp && oldpp!=pp; oldpp=oldpp->next) + { + if(pp->ino==oldpp->ino && pp->dev==oldpp->dev && pp->mtime==oldpp->mtime) + { + flag |= PATH_SKIP; + break; + } + } + pp->flags |= flag; + if(((pp->flags&(PATH_PATH|PATH_SKIP))==PATH_PATH)) + { + int offset = staktell(); + stakputs(name); + path_chkpaths(first,0,pp,offset); + stakseek(offset); + } +} + +/* * write the next path to search on the current stack * if last is given, all paths that come before <last> are skipped * the next pathcomp is returned. */ Pathcomp_t *path_nextcomp(register Pathcomp_t *pp, const char *name, Pathcomp_t *last) { + Pathcomp_t *ppnext; stakseek(PATH_OFFSET); if(*name=='/') pp = 0; else { - for(;pp && pp!=last;pp=pp->next) + for(;pp && pp!=last;pp=ppnext) { + if(ppnext=pp->next) + ppnext->shp = pp->shp; + if(!pp->dev && !pp->ino) + path_checkdup(pp); if(pp->flags&PATH_SKIP) continue; if(!last || *pp->name!='/') @@ -523,6 +569,13 @@ static int path_opentype(const char *name, register Pathcomp_t *pp, int fun) if(fd>=0 && (fd = sh_iomovefd(fd)) > 0) { fcntl(fd,F_SETFD,FD_CLOEXEC); + if(!shp) + { + shp = sh_getinterp(); +#if _UWIN + close(0x10001); /* this results in a /var/log/uwin message with "0x10001" for debugging */ +#endif + } shp->fdstatus[fd] |= IOCLEX; } return(fd); @@ -581,16 +634,17 @@ static void funload(Shell_t *shp,int fno, const char *name) pname = path_fullname(stakptr(PATH_OFFSET)); if(shp->fpathdict && (rp = dtmatch(shp->fpathdict,(void*)pname))) { + Dt_t *funtree = sh_subfuntree(1); do { - if((np = dtsearch(shp->fun_tree,rp->np)) && is_afunction(np)) + if((np = dtsearch(funtree,rp->np)) && is_afunction(np)) { if(np->nvalue.rp) np->nvalue.rp->fdict = 0; - nv_delete(np,shp->fun_tree,NV_NOFREE); + nv_delete(np,funtree,NV_NOFREE); } - dtinsert(shp->fun_tree,rp->np); - rp->fdict = shp->fun_tree; + dtinsert(funtree,rp->np); + rp->fdict = funtree; } while((rp=dtnext(shp->fpathdict,rp)) && strcmp(pname,rp->fname)==0); return; @@ -601,7 +655,7 @@ static void funload(Shell_t *shp,int fno, const char *name) shp->st.filename = pname; shp->funload = 1; error_info.line = 0; - sh_eval(sfnew(NIL(Sfio_t*),buff,IOBSIZE,fno,SF_READ),0); + sh_eval(sfnew(NIL(Sfio_t*),buff,IOBSIZE,fno,SF_READ),SH_FUNEVAL); shp->readscript = 0; free((void*)shp->st.filename); shp->funload = oldload; @@ -652,10 +706,17 @@ int path_search(register const char *name,Pathcomp_t **oldpp, int flag) path_init(shp); if(flag) { + if((np=nv_search(name,shp->track_tree,0)) && !nv_isattr(np,NV_NOALIAS) && (pp=(Pathcomp_t*)np->nvalue.cp)) + { + stakseek(PATH_OFFSET); + path_nextcomp(pp,name,pp); + stakputc(0); + return(0); + } pp = path_absolute(name,oldpp?*oldpp:NIL(Pathcomp_t*)); if(oldpp) *oldpp = pp; - if(!pp && (np=nv_search(name,sh.fun_tree,HASH_NOSCOPE))&&np->nvalue.ip) + if(!pp && (np=nv_search(name,shp->fun_tree,HASH_NOSCOPE))&&np->nvalue.ip) return(1); if(!pp) *stakptr(PATH_OFFSET) = 0; @@ -685,11 +746,9 @@ int path_search(register const char *name,Pathcomp_t **oldpp, int flag) return(0); } - /* * do a path search and find the full pathname of file name */ - Pathcomp_t *path_absolute(register const char *name, Pathcomp_t *pp) { register int f,isfun; @@ -706,7 +765,18 @@ Pathcomp_t *path_absolute(register const char *name, Pathcomp_t *pp) sh_sigcheck(); isfun = (pp->flags&PATH_FPATH); if(oldpp=pp) + { pp = path_nextcomp(pp,name,0); + while(oldpp->flags&PATH_SKIP) + { + if(!(oldpp=oldpp->next)) + { + shp->path_err = ENOENT; + return(0); + } + } + } + if(!isfun && !sh_isoption(SH_RESTRICTED)) { if(*stakptr(PATH_OFFSET)=='/' && nv_search(stakptr(PATH_OFFSET),sh.bltin_tree,0)) @@ -717,6 +787,7 @@ Pathcomp_t *path_absolute(register const char *name, Pathcomp_t *pp) typedef int (*Fptr_t)(int, char*[], void*); Fptr_t addr; int n = staktell(); + int libcmd; char *cp; stakputs("b_"); stakputs(name); @@ -727,7 +798,7 @@ Pathcomp_t *path_absolute(register const char *name, Pathcomp_t *pp) cp++; else cp = oldpp->blib; - if(strcmp(cp,LIBCMD)==0 && (addr=(Fptr_t)dlllook((void*)0,stakptr(n)))) + if((libcmd = !strcmp(cp,LIBCMD)) && (addr=(Fptr_t)dlllook((void*)0,stakptr(n)))) { if((np = sh_addbuiltin(stakptr(PATH_OFFSET),addr,NiL)) && nv_isattr(np,NV_BLTINOPT)) return(oldpp); @@ -737,7 +808,21 @@ Pathcomp_t *path_absolute(register const char *name, Pathcomp_t *pp) #else if (oldpp->bltin_lib = dllfind(oldpp->blib, NiL, RTLD_LAZY, NiL, 0)) #endif - sh_addlib(oldpp->bltin_lib); + { + /* + * this detects the 2007-05-11 builtin context change and also + * the 2008-03-30 opt_info.num change that hit libcmd::b_head + */ + + if (libcmd && !dlllook(oldpp->bltin_lib, "b_pids")) + { + dlclose(oldpp->bltin_lib); + oldpp->bltin_lib = 0; + oldpp->blib = 0; + } + else + sh_addlib(oldpp->bltin_lib); + } } if((addr=(Fptr_t)dlllook(oldpp->bltin_lib,stakptr(n))) && (!(np = sh_addbuiltin(stakptr(PATH_OFFSET),NiL,NiL)) || np->nvalue.bfp!=addr) && @@ -753,7 +838,8 @@ Pathcomp_t *path_absolute(register const char *name, Pathcomp_t *pp) f = canexecute(stakptr(PATH_OFFSET),isfun); if(isfun && f>=0) { - nv_onattr(nv_open(name,shp->fun_tree,NV_NOARRAY|NV_IDENT|NV_NOSCOPE),NV_LTOU|NV_FUNCTION); + nv_onattr(nv_open(name,sh_subfuntree(1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE),NV_LTOU|NV_FUNCTION); + funload(shp,f,name); close(f); f = -1; return(0); @@ -881,7 +967,7 @@ void path_exec(register const char *arg0,register char *argv[],struct argnod *lo Pathcomp_t *libpath, *pp=0; Shell_t *shp = &sh; int slash=0; - nv_setlist(local,NV_EXPORT|NV_IDENT|NV_ASSIGN); + nv_setlist(local,NV_EXPORT|NV_IDENT|NV_ASSIGN,0); envp = sh_envgen(); if(strchr(arg0,'/')) { @@ -896,6 +982,8 @@ void path_exec(register const char *arg0,register char *argv[],struct argnod *lo sfsync(NIL(Sfio_t*)); timerdel(NIL(void*)); /* find first path that has a library component */ + while(pp && (pp->flags&PATH_SKIP)) + pp = pp->next; if(pp || slash) do { sh_sigcheck(); @@ -926,15 +1014,16 @@ pid_t path_spawn(const char *opath,register char **argv, char **envp, Pathcomp_t char **xp=0, *xval, *libenv = (libpath?libpath->lib:0); Namval_t* np; char *s, *v; - int r, n; + int r, n, pidsize; pid_t pid= -1; /* leave room for inserting _= pathname in environment */ envp--; #if _lib_readlink /* save original pathname */ stakseek(PATH_OFFSET); + pidsize = sfprintf(stkstd,"*%d*",spawn?getpid():getppid()); stakputs(opath); - opath = stakfreeze(1)+PATH_OFFSET; + opath = stakfreeze(1)+PATH_OFFSET+pidsize; np=nv_search(argv[0],shp->track_tree,0); while(libpath && !libpath->lib) libpath=libpath->next; @@ -1012,7 +1101,7 @@ pid_t path_spawn(const char *opath,register char **argv, char **envp, Pathcomp_t } if(!opath) opath = stakptr(PATH_OFFSET); - envp[0] = (char*)opath-PATH_OFFSET; + envp[0] = (char*)opath-(PATH_OFFSET+pidsize); envp[0][0] = '_'; envp[0][1] = '='; sfsync(sfstderr); @@ -1219,6 +1308,8 @@ static void exscript(Shell_t *shp,register char *path,register char *argv[],char (HISTCUR)->nvalue.lp = 0; } sh_offstate(SH_FORKED); + if(shp->sigflag[SIGCHLD]==SH_SIGOFF) + shp->sigflag[SIGCHLD] = SH_SIGFAULT; siglongjmp(*shp->jmplist,SH_JMPSCRIPT); } @@ -1322,7 +1413,6 @@ static void exscript(Shell_t *shp,register char *path,register char *argv[],char static Pathcomp_t *path_addcomp(Pathcomp_t *first, Pathcomp_t *old,const char *name, int flag) { register Pathcomp_t *pp, *oldpp; - struct stat statb; int len, offset=staktell(); if(!(flag&PATH_BFPATH)) { @@ -1344,65 +1434,26 @@ static Pathcomp_t *path_addcomp(Pathcomp_t *first, Pathcomp_t *old,const char *n return(first); } } - if(old && (old=path_dirfind(old,name,0))) - { - statb.st_ino = old->ino; - statb.st_dev = old->dev; - statb.st_mtime = old->mtime; - if(old->ino==0 && old->dev==0) - flag |= PATH_SKIP; - } - else if(stat(name,&statb)<0 || !S_ISDIR(statb.st_mode)) - { - if(*name=='/') - { - if(strcmp(name,SH_CMDLIB_DIR)) - return(first); - statb.st_dev = 1; - } - else - { - flag |= PATH_SKIP; - statb.st_dev = 0; - } - statb.st_ino = 0; - statb.st_mtime = 0; - } - if(*name=='/' && onstdpath(name)) - flag |= PATH_STD_DIR; - for(pp=first, oldpp=0; pp; oldpp=pp, pp=pp->next) - { - if(pp->ino==statb.st_ino && pp->dev==statb.st_dev && pp->mtime==statb.st_mtime) - { - /* if both absolute paths, eliminate second */ - pp->flags |= flag; - if(*name=='/' && *pp->name=='/') - return(first); - /* keep the path but mark it as skip */ - flag |= PATH_SKIP; - } - } + for(pp=first, oldpp=0; pp; oldpp=pp, pp=pp->next); pp = newof((Pathcomp_t*)0,Pathcomp_t,1,len+1); pp->refcount = 1; memcpy((char*)(pp+1),name,len+1); pp->name = (char*)(pp+1); pp->len = len; - pp->dev = statb.st_dev; - pp->ino = statb.st_ino; - pp->mtime = statb.st_mtime; if(oldpp) oldpp->next = pp; else first = pp; pp->flags = flag; - if(pp->ino==0 && pp->dev==1) + if(strcmp(name,SH_CMDLIB_DIR)==0) { + pp->dev = 1; pp->flags |= PATH_BUILTIN_LIB; pp->blib = malloc(4); strcpy(pp->blib,LIBCMD); return(first); } - if((flag&(PATH_PATH|PATH_SKIP))==PATH_PATH) + if(old && ((flag&(PATH_PATH|PATH_SKIP))==PATH_PATH)) path_chkpaths(first,old,pp,offset); return(first); } diff --git a/usr/src/lib/libshell/common/sh/pmain.c b/usr/src/lib/libshell/common/sh/pmain.c index 5c61ce4107..8cab334192 100644 --- a/usr/src/lib/libshell/common/sh/pmain.c +++ b/usr/src/lib/libshell/common/sh/pmain.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/sh/shcomp.c b/usr/src/lib/libshell/common/sh/shcomp.c index a1b717f3e7..1cd0383673 100644 --- a/usr/src/lib/libshell/common/sh/shcomp.c +++ b/usr/src/lib/libshell/common/sh/shcomp.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/sh/streval.c b/usr/src/lib/libshell/common/sh/streval.c index f39cc24e9b..92a8256594 100644 --- a/usr/src/lib/libshell/common/sh/streval.c +++ b/usr/src/lib/libshell/common/sh/streval.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -78,11 +78,13 @@ struct vars /* vars stacked per invocation */ Sfdouble_t (*convert)(const char**,struct lval*,int,Sfdouble_t); }; -typedef int (*Math_0_f)(Sfdouble_t); -typedef Sfdouble_t (*Fun_t)(Sfdouble_t,...); -typedef Sfdouble_t (*Math_1_f)(Sfdouble_t); -typedef Sfdouble_t (*Math_2_f)(Sfdouble_t,Sfdouble_t); -typedef Sfdouble_t (*Math_3_f)(Sfdouble_t,Sfdouble_t,Sfdouble_t); +typedef Sfdouble_t (*Math_f)(Sfdouble_t,...); +typedef Sfdouble_t (*Math_1f_f)(Sfdouble_t); +typedef int (*Math_1i_f)(Sfdouble_t); +typedef Sfdouble_t (*Math_2f_f)(Sfdouble_t,Sfdouble_t); +typedef int (*Math_2i_f)(Sfdouble_t,Sfdouble_t); +typedef Sfdouble_t (*Math_3f_f)(Sfdouble_t,Sfdouble_t,Sfdouble_t); +typedef int (*Math_3i_f)(Sfdouble_t,Sfdouble_t,Sfdouble_t); #define getchr(vp) (*(vp)->nextchr++) #define peekchr(vp) (*(vp)->nextchr) @@ -155,7 +157,7 @@ Sfdouble_t arith_exec(Arith_t *ep) register char *tp; Sfdouble_t small_stack[SMALL_STACK+1]; const char *ptr = ""; - Fun_t fun; + Math_f fun; struct lval node; node.emode = ep->emode; node.expr = ep->expr; @@ -257,11 +259,12 @@ Sfdouble_t arith_exec(Arith_t *ep) node.value = (char*)dp; node.flag = c; num = (*ep->fun)(&ptr,&node,ASSIGN,num); + c=0; break; case A_PUSHF: - cp = roundptr(ep,cp,Fun_t); + cp = roundptr(ep,cp,Math_f); *++sp = (Sfdouble_t)(cp-ep->code); - cp += sizeof(Fun_t); + cp += sizeof(Math_f); *++tp = *cp++; continue; case A_PUSHN: @@ -368,29 +371,35 @@ Sfdouble_t arith_exec(Arith_t *ep) num = (sp[-1]<num); type=0; break; - case A_CALL0: + case A_CALL1F: sp--,tp--; - fun = *((Fun_t*)(ep->code+(int)(*sp))); + fun = *((Math_f*)(ep->code+(int)(*sp))); type = 0; - num = (*((Math_0_f)fun))(num); + num = (*((Math_1f_f)fun))(num); break; - case A_CALL1: + case A_CALL1I: sp--,tp--; - fun = *((Fun_t*)(ep->code+(int)(*sp))); + fun = *((Math_f*)(ep->code+(int)(*sp))); type = *tp; - num = (*fun)(num); + num = (*((Math_1i_f)fun))(num); break; - case A_CALL2: + case A_CALL2F: sp-=2,tp-=2; - fun = *((Fun_t*)(ep->code+(int)(*sp))); + fun = *((Math_f*)(ep->code+(int)(*sp))); + type = 0; + num = (*((Math_2f_f)fun))(sp[1],num); + break; + case A_CALL2I: + sp-=2,tp-=2; + fun = *((Math_f*)(ep->code+(int)(*sp))); type = *tp; - num = (*((Math_2_f)fun))(sp[1],num); + num = (*((Math_2i_f)fun))(sp[1],num); break; - case A_CALL3: + case A_CALL3F: sp-=3,tp-=3; - fun = *((Fun_t*)(ep->code+(int)(*sp))); - type = *tp; - num = (*((Math_3_f)fun))(sp[1],sp[2],num); + fun = *((Math_f*)(ep->code+(int)(*sp))); + type = 0; + num = (*((Math_3f_f)fun))(sp[1],sp[2],num); break; } if(c&T_BINARY) @@ -593,7 +602,10 @@ again: vp->staksize--; } if(!expr(vp,c)) + { + stakseek(-1); return(0); + } lvalue.value = 0; break; @@ -610,7 +622,7 @@ again: vp->stakmaxsize = vp->staksize; vp->infun=1; stakputc(A_PUSHF); - stakpush(vp,fun,Fun_t); + stakpush(vp,fun,Math_f); stakputc(1); } else @@ -623,13 +635,13 @@ again: vp->paren--; if(fun) { - int x= (nargs>7); + int x= (nargs>7)?2:-1; nargs &= 7; if(vp->infun != nargs) ERROR(vp,e_argcount); if(vp->staksize+=nargs>=vp->stakmaxsize) vp->stakmaxsize = vp->staksize+nargs; - stakputc(A_CALL0+nargs -x); + stakputc(A_CALL1F+nargs+x); vp->staksize -= nargs; } vp->infun = infun; diff --git a/usr/src/lib/libshell/common/sh/string.c b/usr/src/lib/libshell/common/sh/string.c index b7c9c7d63c..89b34159e5 100644 --- a/usr/src/lib/libshell/common/sh/string.c +++ b/usr/src/lib/libshell/common/sh/string.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -27,7 +27,6 @@ #include <ast_wchar.h> #include "defs.h" #include <stak.h> -#include <ctype.h> #include <ccode.h> #include "shtable.h" #include "lexstates.h" diff --git a/usr/src/lib/libshell/common/sh/subshell.c b/usr/src/lib/libshell/common/sh/subshell.c index 4d54449c27..9f6eeafdd9 100644 --- a/usr/src/lib/libshell/common/sh/subshell.c +++ b/usr/src/lib/libshell/common/sh/subshell.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -102,38 +102,48 @@ void sh_subtmpfile(int pflag) Shell_t *shp = &sh; int fds[2]; Sfoff_t off; + register struct checkpt *pp = (struct checkpt*)shp->jmplist; + register struct subshell *sp = subshell_data->pipe; if(sfset(sfstdout,0,0)&SF_STRING) { register int fd; - register struct checkpt *pp = (struct checkpt*)shp->jmplist; - register struct subshell *sp = subshell_data->pipe; /* save file descriptor 1 if open */ if((sp->tmpfd = fd = fcntl(1,F_DUPFD,10)) >= 0) { fcntl(fd,F_SETFD,FD_CLOEXEC); shp->fdstatus[fd] = shp->fdstatus[1]|IOCLEX; close(1); + shp->fdstatus[1] = IOCLOSE; } else if(errno!=EBADF) + { + ((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT; + shp->toomany = 1; errormsg(SH_DICT,ERROR_system(1),e_toomany); - if(!pflag) + } + if(shp->subshare || !pflag) { sfdisc(sfstdout,SF_POPDISC); if((fd=sffileno(sfstdout))>=0) { - sh.fdstatus[fd] = IOREAD|IOWRITE; + shp->fdstatus[fd] = IOREAD|IOWRITE; sfsync(sfstdout); if(fd==1) fcntl(1,F_SETFD,0); else { sfsetfd(sfstdout,1); - sh.fdstatus[1] = sh.fdstatus[fd]; - sh.fdstatus[fd] = IOCLOSE; + shp->fdstatus[1] = shp->fdstatus[fd]; + shp->fdstatus[fd] = IOCLOSE; } goto skip; } } + } + if(sp && (shp->fdstatus[1]==IOCLOSE || (!shp->subshare && !(shp->fdstatus[1]&IONOSEEK)))) + { + struct stat statb,statx; + int fd; sh_pipe(fds); sp->pipefd = fds[0]; sh_fcntl(sp->pipefd,F_SETFD,FD_CLOEXEC); @@ -143,10 +153,22 @@ void sh_subtmpfile(int pflag) write(fds[1],sfsetbuf(sfstdout,(Void_t*)sfstdout,0),(size_t)off); sfpurge(sfstdout); } + if((sfset(sfstdout,0,0)&SF_STRING) || fstat(1,&statb)<0) + statb.st_ino = 0; sfclose(sfstdout); if((sh_fcntl(fds[1],F_DUPFD, 1)) != 1) - errormsg(SH_DICT,ERROR_system(1),e_file+4); + errormsg(SH_DICT,ERROR_system(1),e_redirect); sh_close(fds[1]); + if(statb.st_ino) for(fd=0; fd < 10; fd++) + { + if(fd==1 || ((shp->fdstatus[fd]&(IONOSEEK|IOSEEK|IOWRITE))!=(IOSEEK|IOWRITE)) || fstat(fd,&statx)<0) + continue; + if(statb.st_ino==statx.st_ino && statb.st_dev==statx.st_dev) + { + sh_close(fd); + fcntl(1,F_DUPFD, fd); + } + } skip: sh_iostream(shp,1); sfset(sfstdout,SF_SHARE|SF_PUBLIC,1); @@ -156,6 +178,7 @@ void sh_subtmpfile(int pflag) } } + /* * This routine creates a temp file if necessary and creates a subshell. * The parent routine longjmps back to sh_subshell() @@ -167,16 +190,21 @@ void sh_subfork(void) Shell_t *shp = sp->shp; int curenv = shp->curenv; pid_t pid; + char *trap = shp->st.trapcom[0]; + if(trap) + trap = strdup(trap); /* see whether inside $(...) */ if(sp->pipe) sh_subtmpfile(1); shp->curenv = 0; - if(pid = sh_fork(0,NIL(int*))) + if(pid = sh_fork(FSHOWME,NIL(int*))) { shp->curenv = curenv; /* this is the parent part of the fork */ if(sp->subpid==0) sp->subpid = pid; + if(trap) + free((void*)trap); siglongjmp(*shp->jmplist,SH_JMPSUB); } else @@ -190,6 +218,7 @@ void sh_subfork(void) shp->subshell = 0; SH_SUBSHELLNOD->nvalue.s = 0; sp->subpid=0; + shp->st.trapcom[0] = trap; } } @@ -225,7 +254,7 @@ Namval_t *sh_assignok(register Namval_t *np,int add) Namarr_t *ap; int save; /* don't bother with this */ - if(!sp->shpwd || (nv_isnull(np) && !add)) + if(!sp->shpwd || (nv_isnull(np) && !add) || np==SH_LEVELNOD) return(np); /* don't bother to save if in newer scope */ if(!(rp=shp->st.real_fun) || !(dp=rp->sdict)) @@ -305,7 +334,7 @@ static void nv_restore(struct subshell *sp) continue; if(nv_isarray(mp)) nv_putsub(mp,NIL(char*),ARRAY_SCAN); - _nv_unset(mp,NV_RDONLY); + _nv_unset(mp,NV_RDONLY|NV_CLONE); if(nv_isarray(np)) { nv_clone(np,mp,NV_MOVE); @@ -317,7 +346,11 @@ static void nv_restore(struct subshell *sp) mp->nvfun = np->nvfun; mp->nvflag = np->nvflag; if(nv_cover(mp)) - nv_putval(mp, np->nvalue.cp,0); + { + nv_putval(mp, nv_getval(np),np->nvflag|NV_NOFREE); + if(!nv_isattr(np,NV_NOFREE)) + nv_offattr(mp,NV_NOFREE); + } else mp->nvalue.cp = np->nvalue.cp; np->nvfun = 0; @@ -386,7 +419,7 @@ static void table_unset(register Dt_t *root,int fun) { nq = (Namval_t*)dtnext(root,np); flag=0; - if(fun && np->nvalue.rp->fname && *np->nvalue.rp->fname=='/') + if(fun && np->nvalue.rp && np->nvalue.rp->fname && *np->nvalue.rp->fname=='/') { np->nvalue.rp->fdict = 0; flag = NV_NOFREE; @@ -437,7 +470,7 @@ Sfio_t *sh_subshell(Shnode_t *t, int flags, int comsub) Shell_t *shp = &sh; struct subshell sub_data; register struct subshell *sp = &sub_data; - int jmpval,nsig=0; + int jmpval,nsig=0,duped=0; int savecurenv = shp->curenv; int savejobpgid = job.curpgid; int16_t subshell; @@ -498,7 +531,6 @@ Sfio_t *sh_subshell(Shnode_t *t, int flags, int comsub) sp->cpid = shp->cpid; sp->coutpipe = shp->coutpipe; sp->cpipe = shp->cpipe[1]; - shp->coutpipe = shp->cpipe[1] = -1; shp->cpid = 0; sh_sigreset(0); } @@ -554,6 +586,7 @@ Sfio_t *sh_subshell(Shnode_t *t, int flags, int comsub) subshell_data = sp->prev; if(jmpval==SH_JMPSCRIPT) siglongjmp(*shp->jmplist,jmpval); + shp->exitval &= SH_EXITMASK; sh_done(shp,0); } if(comsub) @@ -584,7 +617,11 @@ Sfio_t *sh_subshell(Shnode_t *t, int flags, int comsub) { int fd=sfsetfd(iop,3); if(fd<0) + { + shp->toomany = 1; + ((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT; errormsg(SH_DICT,ERROR_system(1),e_toomany); + } shp->sftable[fd] = iop; fcntl(fd,F_SETFD,FD_CLOEXEC); shp->fdstatus[fd] = (shp->fdstatus[1]|IOCLEX); @@ -597,7 +634,8 @@ Sfio_t *sh_subshell(Shnode_t *t, int flags, int comsub) if(sp->tmpfd>=0) { close(1); - fcntl(sp->tmpfd,F_DUPFD,1); + if (fcntl(sp->tmpfd,F_DUPFD,1) != 1) + duped++; sh_close(sp->tmpfd); } shp->fdstatus[1] = sp->fdstatus; @@ -609,8 +647,6 @@ Sfio_t *sh_subshell(Shnode_t *t, int flags, int comsub) shp->exitval = 0; if(comsub) shp->spid = sp->subpid; - else - job_wait(sp->subpid); } if(comsub && iop && sp->pipefd<0) sfseek(iop,(off_t)0,SEEK_SET); @@ -671,7 +707,7 @@ Sfio_t *sh_subshell(Shnode_t *t, int flags, int comsub) free((void*)sp->pwd); if(sp->mask!=shp->mask) umask(shp->mask=sp->mask); - if(shp->coutpipe>=0) + if(shp->coutpipe!=sp->coutpipe) { sh_close(shp->coutpipe); sh_close(shp->cpipe[1]); @@ -683,6 +719,11 @@ Sfio_t *sh_subshell(Shnode_t *t, int flags, int comsub) shp->subshare = sp->subshare; if(shp->subshell) SH_SUBSHELLNOD->nvalue.s = --shp->subshell; + subshell = shp->subshell; + subshell_data = sp->prev; + sh_argfree(shp,argsav,0); + if(shp->topfd != buff.topfd) + sh_iorestore(shp,buff.topfd|IOSUBSHELL,jmpval); if(sp->sig) { if(sp->prev) @@ -693,17 +734,23 @@ Sfio_t *sh_subshell(Shnode_t *t, int flags, int comsub) sh_chktrap(); } } - subshell = shp->subshell; - subshell_data = sp->prev; - sh_argfree(shp,argsav,0); + sh_sigcheck(); shp->trapnote = 0; - if(shp->topfd != buff.topfd) - sh_iorestore(shp,buff.topfd|IOSUBSHELL,jmpval); + if(sp->subpid && !comsub) + job_wait(sp->subpid); if(shp->exitval > SH_EXITSIG) { int sig = shp->exitval&SH_EXITMASK; if(sig==SIGINT || sig== SIGQUIT) sh_fault(sig); } + if(duped) + { + ((struct checkpt*)shp->jmplist)->mode = SH_JMPERREXIT; + shp->toomany = 1; + errormsg(SH_DICT,ERROR_system(1),e_redirect); + } + if(jmpval && shp->toomany) + siglongjmp(*shp->jmplist,jmpval); return(iop); } diff --git a/usr/src/lib/libshell/common/sh/suid_exec.c b/usr/src/lib/libshell/common/sh/suid_exec.c index 461dc7879a..04fad8051e 100644 --- a/usr/src/lib/libshell/common/sh/suid_exec.c +++ b/usr/src/lib/libshell/common/sh/suid_exec.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/sh/tdump.c b/usr/src/lib/libshell/common/sh/tdump.c index c5d6b25c99..afdd6336dd 100644 --- a/usr/src/lib/libshell/common/sh/tdump.c +++ b/usr/src/lib/libshell/common/sh/tdump.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/sh/timers.c b/usr/src/lib/libshell/common/sh/timers.c index 796b43cf5a..7508525834 100644 --- a/usr/src/lib/libshell/common/sh/timers.c +++ b/usr/src/lib/libshell/common/sh/timers.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/sh/trestore.c b/usr/src/lib/libshell/common/sh/trestore.c index b9fc63d82f..98ae02a004 100644 --- a/usr/src/lib/libshell/common/sh/trestore.c +++ b/usr/src/lib/libshell/common/sh/trestore.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -134,16 +134,22 @@ static Shnode_t *r_tree(Shell_t *shp) { Stak_t *savstak; struct slnod *slp; + struct functnod *fp; t = getnode(shp->stk,functnod); t->funct.functloc = -1; t->funct.functline = sfgetu(infile); t->funct.functnam = r_string(shp->stk); savstak = stakcreate(STAK_SMALL); savstak = stakinstall(savstak, 0); - slp = (struct slnod*)stkalloc(shp->stk,sizeof(struct slnod)); + slp = (struct slnod*)stkalloc(shp->stk,sizeof(struct slnod)+sizeof(struct functnod)); slp->slchild = 0; slp->slnext = shp->st.staklist; shp->st.staklist = 0; + fp = (struct functnod*)(slp+1); + memset(fp, 0, sizeof(*fp)); + fp->functtyp = TFUN|FAMP; + if(shp->st.filename) + fp->functnam = stkcopy(shp->stk,shp->st.filename); t->funct.functtre = r_tree(shp); t->funct.functstak = slp; slp->slptr = stakinstall(savstak,0); diff --git a/usr/src/lib/libshell/common/sh/waitevent.c b/usr/src/lib/libshell/common/sh/waitevent.c index f187a3085d..d04ea1d809 100644 --- a/usr/src/lib/libshell/common/sh/waitevent.c +++ b/usr/src/lib/libshell/common/sh/waitevent.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/common/sh/xec.c b/usr/src/lib/libshell/common/sh/xec.c index 1c93fa9dab..2e59e8a8f2 100644 --- a/usr/src/lib/libshell/common/sh/xec.c +++ b/usr/src/lib/libshell/common/sh/xec.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -352,7 +352,12 @@ static void put_level(Namval_t* np,const char *val,int flags,Namfun_t *fp) int16_t level, oldlevel = (int16_t)nv_getnum(np); nv_putv(np,val,flags,fp); if(!val) + { + fp = nv_stack(np, NIL(Namfun_t*)); + if(fp && !fp->nofree) + free((void*)fp); return; + } level = nv_getnum(np); if(level<0 || level > lp->maxlevel) { @@ -414,7 +419,7 @@ int sh_debug(Shell_t *shp, const char *trap, const char *name, const char *subsc n -= 2; sfwrite(iop,cp,n); } - if(!(flags&ARG_RAW)) + if(*argv && !(flags&ARG_RAW)) out_string(iop, *argv++,' ', 0); n = (flags&ARG_ARITH); while(cp = *argv++) @@ -466,7 +471,9 @@ int sh_eval(register Sfio_t *iop, int mode) struct checkpt buff; static Sfio_t *io_save; volatile int traceon=0, lineno=0; + int binscript=shp->binscript; io_save = iop; /* preserve correct value across longjmp */ + shp->binscript = 0; #define SH_TOPFUN 0x8000 /* this is a temporary tksh hack */ if (mode & SH_TOPFUN) { @@ -476,7 +483,7 @@ int sh_eval(register Sfio_t *iop, int mode) sh_pushcontext(&buff,SH_JMPEVAL); buff.olist = pp->olist; jmpval = sigsetjmp(buff.buff,0); - if(jmpval==0) + while(jmpval==0) { if(mode&SH_READEVAL) { @@ -484,22 +491,28 @@ int sh_eval(register Sfio_t *iop, int mode) if(traceon=sh_isoption(SH_XTRACE)) sh_offoption(SH_XTRACE); } - t = (Shnode_t*)sh_parse(shp,iop,(mode&SH_READEVAL)?0:SH_NL); - if(mode&SH_READEVAL) - mode &= SH_READEVAL; - else - sfclose(iop); - io_save = 0; + t = (Shnode_t*)sh_parse(shp,iop,(mode&(SH_READEVAL|SH_FUNEVAL))?mode&SH_FUNEVAL:SH_NL); + if(!(mode&SH_FUNEVAL) || !sfreserve(iop,0,0)) + { + if(!(mode&SH_READEVAL)) + sfclose(iop); + io_save = 0; + mode &= ~SH_FUNEVAL; + } + mode &= ~SH_READEVAL; if(!sh_isoption(SH_VERBOSE)) sh_offstate(SH_VERBOSE); - if(mode && shp->hist_ptr) + if((mode&~SH_FUNEVAL) && shp->hist_ptr) { hist_flush(shp->hist_ptr); mode = sh_state(SH_INTERACTIVE); } - sh_exec(t,sh_isstate(SH_ERREXIT)|mode); + sh_exec(t,sh_isstate(SH_ERREXIT)|sh_isstate(SH_NOFORK)|(mode&~SH_FUNEVAL)); + if(!(mode&SH_FUNEVAL)) + break; } sh_popcontext(&buff); + shp->binscript = binscript; if(traceon) sh_onoption(SH_XTRACE); if(lineno) @@ -597,12 +610,14 @@ static void free_list(struct openlist *olist) */ static int set_instance(Namval_t *nq, Namval_t *node, struct Namref *nr) { - char *cp = nv_name(nq); + char *sp=0,*cp = nv_name(nq); Namarr_t *ap; memset(nr,0,sizeof(*nr)); nr->np = nq; nr->root = sh.var_tree; nr->table = sh.last_table; + if((ap=nv_arrayptr(nq)) && (sp = nv_getsub(nq))) + sp = strdup(sp); if(sh.var_tree!=sh.var_base && !nv_open(cp,nr->root,NV_VARNAME|NV_NOREF|NV_NOSCOPE|NV_NOADD|NV_NOFAIL)) nr->root = sh.var_base; nv_putval(SH_NAMENOD, cp, NV_NOFREE); @@ -611,9 +626,9 @@ static int set_instance(Namval_t *nq, Namval_t *node, struct Namref *nr) L_ARGNOD->nvflag = NV_REF|NV_NOFREE; L_ARGNOD->nvfun = 0; L_ARGNOD->nvenv = 0; - if((ap=nv_arrayptr(nq)) && (cp = nv_getsub(nq)) && (cp = strdup(cp))) + if(sp) { - nv_putval(SH_SUBSCRNOD,nr->sub=cp,NV_NOFREE); + nv_putval(SH_SUBSCRNOD,nr->sub=sp,NV_NOFREE); return(ap->nelem&ARRAY_SCAN); } return(0); @@ -644,9 +659,12 @@ int sh_exec(register const Shnode_t *t, int flags) register char *com0 = 0; int errorflg = (type&sh_state(SH_ERREXIT))|OPTIMIZE; int execflg = (type&sh_state(SH_NOFORK)); + int execflg2 = (type&sh_state(SH_FORKED)); int mainloop = (type&sh_state(SH_INTERACTIVE)); #if SHOPT_AMP || SHOPT_SPAWN int ntflag = (type&sh_state(SH_NTFORK)); +#else + int ntflag = 0; #endif int topfd = shp->topfd; char *sav=stkptr(stkp,0); @@ -659,6 +677,8 @@ int sh_exec(register const Shnode_t *t, int flags) int echeck = 0; if(flags&sh_state(SH_INTERACTIVE)) { + if(pipejob==2) + job_unlock(); pipejob = 0; job.curpgid = 0; flags &= ~sh_state(SH_INTERACTIVE); @@ -746,6 +766,7 @@ int sh_exec(register const Shnode_t *t, int flags) { if(argn==0 || (np && nv_isattr(np,BLT_SPC))) { + Namval_t *tp=0; if(argn) { if(checkopt(com,'A')) @@ -771,13 +792,18 @@ int sh_exec(register const Shnode_t *t, int flags) #endif { if(np!=SYSTYPESET) + { shp->typeinit = np; + tp = nv_type(np); + } if(checkopt(com,'C')) flgs |= NV_COMVAR; if(checkopt(com,'S')) flgs |= NV_STATIC; if(checkopt(com,'n')) flgs |= NV_NOREF; + else if(!shp->typeinit && (checkopt(com,'L') || checkopt(com,'R') || checkopt(com,'Z'))) + flgs |= NV_UNJUST; #if SHOPT_TYPEDEF else if(argn>=3 && checkopt(com,'T')) { @@ -799,7 +825,7 @@ int sh_exec(register const Shnode_t *t, int flags) if(OPTIMIZE) flgs |= NV_TAGGED; #endif - nv_setlist(argp,flgs); + nv_setlist(argp,flgs,tp); if(np==shp->typeinit) shp->typeinit = 0; shp->envlist = argp; @@ -875,6 +901,11 @@ int sh_exec(register const Shnode_t *t, int flags) np = 0; } } + if(np && pipejob==2) + { + job_unlock(); + pipejob = 1; + } /* check for builtins */ if(np && is_abuiltin(np)) { @@ -882,6 +913,7 @@ int sh_exec(register const Shnode_t *t, int flags) volatile void *save_ptr; volatile void *save_data; int jmpval, save_prompt; + int was_nofork = execflg?sh_isstate(SH_NOFORK):0; struct checkpt buff; unsigned long was_vi=0, was_emacs=0, was_gmacs=0; struct stat statb; @@ -902,6 +934,8 @@ int sh_exec(register const Shnode_t *t, int flags) sh_offoption(SH_EMACS); sh_offoption(SH_GMACS); } + if(execflg) + sh_onstate(SH_NOFORK); sh_pushcontext(&buff,SH_JMPCMD); jmpval = sigsetjmp(buff.buff,1); if(jmpval == 0) @@ -999,6 +1033,8 @@ int sh_exec(register const Shnode_t *t, int flags) } if(bp && bp->ptr!= nv_context(np)) np->nvfun = (Namfun_t*)bp->ptr; + if(execflg && !was_nofork) + sh_offstate(SH_NOFORK); if(!(nv_isattr(np,BLT_ENV))) { if(bp->nosfio && shp->pwd) @@ -1019,7 +1055,7 @@ int sh_exec(register const Shnode_t *t, int flags) } sh_popcontext(&buff); errorpop(&buff.err); - error_info.flags &= ~ERROR_SILENT; + error_info.flags &= ~(ERROR_SILENT|ERROR_NOTIFY); shp->bltinfun = 0; if(buff.olist) free_list(buff.olist); @@ -1127,15 +1163,19 @@ int sh_exec(register const Shnode_t *t, int flags) register pid_t parent; int no_fork,jobid; int pipes[2]; - no_fork = (execflg && !(type&(FAMP|FPOU)) && -#if SHOPT_AMP || SHOPT_SPAWN - !ntflag && -#endif - !shp->subshell && !shp->st.trapcom[0] && - !shp->st.trap[SH_ERRTRAP] && shp->fn_depth==0 && - !(pipejob && sh_isoption(SH_PIPEFAIL))); if(shp->subshell) - sh_subtmpfile(1); + { + if(shp->subshare) + sh_subtmpfile(1); + else + sh_subfork(); + } + no_fork = !ntflag && !(type&(FAMP|FPOU)) && + !shp->st.trapcom[0] && !shp->st.trap[SH_ERRTRAP] && + (execflg2 || (execflg && + !shp->subshell && shp->fn_depth==0 && + !(pipejob && sh_isoption(SH_PIPEFAIL)) + )); if(sh_isstate(SH_PROFILE) || shp->dot_depth) { /* disable foreground job monitor */ @@ -1150,6 +1190,18 @@ int sh_exec(register const Shnode_t *t, int flags) job.parent=parent=0; else { +#ifdef SHOPT_BGX + int maxjob; + if(((type&(FAMP|FINT)) == (FAMP|FINT)) && (maxjob=nv_getnum(JOBMAXNOD))>0) + { + while(job.numbjob >= maxjob) + { + job_lock(); + job_reap(0); + job_unlock(); + } + } +#endif /* SHOPT_BGX */ if(type&FCOOP) coproc_init(shp,pipes); nv_getval(RANDNOD); @@ -1183,6 +1235,11 @@ int sh_exec(register const Shnode_t *t, int flags) * It may or may not wait for the child */ { + if(pipejob==2) + { + pipejob = 1; + job_unlock(); + } if(type&FPCL) sh_close(shp->inpipe[0]); if(type&(FCOOP|FAMP)) @@ -1197,11 +1254,13 @@ int sh_exec(register const Shnode_t *t, int flags) sh_sigtrap(SIGINT); shp->trapnote |= SH_SIGIGNORE; } - if(execflg && shp->subshell) + if(execflg && shp->subshell && !shp->subshare) { shp->spid = parent; job.pwlist->p_env--; } + else if(shp->pipepid) + shp->pipepid = parent; else job_wait(parent); if(!sh_isoption(SH_MONITOR)) @@ -1294,7 +1353,7 @@ int sh_exec(register const Shnode_t *t, int flags) */ if(!no_fork && !(type&FPOU)) job_clear(); - sh_exec(t->fork.forktre,flags|sh_state(SH_NOFORK)); + sh_exec(t->fork.forktre,flags|sh_state(SH_NOFORK)|sh_state(SH_FORKED)); } else if(com0) { @@ -1317,7 +1376,8 @@ int sh_exec(register const Shnode_t *t, int flags) * save and restore io-streams */ pid_t pid; - int jmpval, waitall; + int jmpval, waitall; + int simple = (t->fork.forktre->tre.tretyp&COMMSK)==TCOM; struct checkpt buff; if(shp->subshell) execflg = 0; @@ -1326,14 +1386,14 @@ int sh_exec(register const Shnode_t *t, int flags) { was_interactive = sh_isstate(SH_INTERACTIVE); sh_offstate(SH_INTERACTIVE); - if(!execflg) - sh_iosave(shp,0,shp->topfd,(char*)0); + sh_iosave(shp,0,shp->topfd,(char*)0); + shp->pipepid = simple; sh_iorenumber(shp,shp->inpipe[0],0); /* * if read end of pipe is a simple command * treat as non-sharable to improve performance */ - if((t->fork.forktre->tre.tretyp&COMMSK)==TCOM) + if(simple) sfset(sfstdin,SF_PUBLIC|SF_SHARE,0); waitall = job.waitall; job.waitall = 0; @@ -1346,7 +1406,7 @@ int sh_exec(register const Shnode_t *t, int flags) { sh_redirect(shp,t->fork.forkio,execflg); (t->fork.forktre)->tre.tretyp |= t->tre.tretyp&FSHOWME; - sh_exec(t->fork.forktre,flags); + sh_exec(t->fork.forktre,flags&~simple); } else sfsync(shp->outpool); @@ -1361,11 +1421,23 @@ int sh_exec(register const Shnode_t *t, int flags) if(!(type&SH_EXITSIG)) { /* wait for remainder of pipline */ - job_wait(waitall?pid:0); + if(shp->pipepid>1) + { + job_wait(shp->pipepid); + type = shp->exitval; + } + else + job_wait(waitall?pid:0); if(type || !sh_isoption(SH_PIPEFAIL)) shp->exitval = type; } + shp->pipepid = 0; shp->st.ioset = 0; + if(simple && was_errexit) + { + echeck = 1; + sh_onstate(SH_ERREXIT); + } } if(jmpval>SH_JMPIO) siglongjmp(*shp->jmplist,jmpval); @@ -1377,8 +1449,17 @@ int sh_exec(register const Shnode_t *t, int flags) flags &= ~OPTIMIZE_FLAG; if(!shp->subshell && !shp->st.trapcom[0] && !shp->st.trap[SH_ERRTRAP] && (flags&sh_state(SH_NOFORK))) { - int jmpval; + char *savsig; + int nsig,jmpval; struct checkpt buff; + shp->st.otrapcom = 0; + if((nsig=shp->st.trapmax*sizeof(char*))>0 || shp->st.trapcom[0]) + { + nsig += sizeof(char*); + memcpy(savsig=malloc(nsig),(char*)&shp->st.trapcom[0],nsig); + shp->st.otrapcom = (char**)savsig; + } + sh_sigreset(0); sh_pushcontext(&buff,SH_JMPEXIT); jmpval = sigsetjmp(buff.buff,0); if(jmpval==0) @@ -1419,6 +1500,7 @@ int sh_exec(register const Shnode_t *t, int flags) job.waitall = 1; else job.waitall |= !pipejob && sh_isstate(SH_MONITOR); + job_lock(); do { #if SHOPT_FASTPIPE @@ -1442,6 +1524,7 @@ int sh_exec(register const Shnode_t *t, int flags) while(!type && t->tre.tretyp==TFIL); shp->inpipe = pvn; shp->outpipe = 0; + pipejob = 2; if(type == 0) { /* @@ -1454,6 +1537,8 @@ int sh_exec(register const Shnode_t *t, int flags) else /* execution failure, close pipe */ sh_pclose(pvn); + if(pipejob==2) + job_unlock(); pipejob = savepipe; #ifdef SIGTSTP if(!pipejob && sh_isstate(SH_MONITOR)) @@ -1651,7 +1736,7 @@ int sh_exec(register const Shnode_t *t, int flags) shp->offsets[0] = -1; shp->offsets[1] = 0; if(tt->com.comset) - nv_setlist(tt->com.comset,NV_IDENT|NV_ASSIGN); + nv_setlist(tt->com.comset,NV_IDENT|NV_ASSIGN,0); } #endif /*SHOPT_FILESCAN */ shp->st.loopcnt++; @@ -2336,7 +2421,15 @@ pid_t _sh_fork(register pid_t parent,int flags,int *jobid) job.curpgid = parent; if(flags&FCOOP) shp->cpid = parent; +#ifdef SHOPT_BGX + if(!postid && (flags&(FAMP|FINT)) == (FAMP|FINT)) + postid = 1; myjob = job_post(parent,postid); + if(postid==1) + postid = 0; +#else + myjob = job_post(parent,postid); +#endif /* SHOPT_BGX */ if(flags&FAMP) job.curpgid = curpgid; if(jobid) @@ -2388,7 +2481,8 @@ pid_t _sh_fork(register pid_t parent,int flags,int *jobid) #endif /* SHOPT_ACCT */ /* Reset remaining signals to parent */ /* except for those `lost' by trap */ - sh_sigreset(2); + if(!(flags&FSHOWME)) + sh_sigreset(2); shp->subshell = 0; if((flags&FAMP) && shp->coutpipe>1) sh_close(shp->coutpipe); @@ -2463,6 +2557,8 @@ int sh_funscope(int argn, char *argv[],int(*fun)(void*),void *arg,int execflg) struct funenv *fp; struct checkpt buff; Namval_t *nspace = shp->namespace; + Dt_t *last_root = shp->last_root; + Shopt_t options = shp->options; if(shp->fn_depth==0) shp->glob_options = shp->options; else @@ -2534,7 +2630,10 @@ int sh_funscope(int argn, char *argv[],int(*fun)(void*),void *arg,int execflg) if(jmpval == 0) { if(shp->fn_depth++ > MAXDEPTH) + { + shp->toomany = 1; siglongjmp(*shp->jmplist,SH_JMPERRFN); + } else if(fun) r= (*fun)(arg); else @@ -2567,7 +2666,8 @@ int sh_funscope(int argn, char *argv[],int(*fun)(void*),void *arg,int execflg) shp->trapnote=0; if(nsig) stakset(savstak,0); - shp->options = shp->glob_options; + shp->options = options; + shp->last_root = last_root; if(trap) { sh_trap(trap,0); @@ -2588,7 +2688,8 @@ static void sh_funct(Shell_t *shp,Namval_t *np,int argn, char *argv[],struct arg struct funenv fun; char *fname = nv_getval(SH_FUNNAMENOD); struct Level *lp =(struct Level*)(SH_LEVELNOD->nvfun); - int level; + int level, pipepid=shp->pipepid; + shp->pipepid = 0; sh_stats(STAT_FUNCT); if(!lp->hdr.disc) lp = init_level(0); @@ -2632,6 +2733,7 @@ static void sh_funct(Shell_t *shp,Namval_t *np,int argn, char *argv[],struct arg nv_putval(SH_FUNNAMENOD,fname,NV_NOFREE); #endif nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE); + shp->pipepid = pipepid; } /* @@ -3136,7 +3238,7 @@ static pid_t sh_ntfork(Shell_t *shp,const Shnode_t *t,char *argv[],int *jobid,in { sh_unscope(shp); if(jmpval==SH_JMPSCRIPT) - nv_setlist(t->com.comset,NV_EXPORT|NV_IDENT|NV_ASSIGN); + nv_setlist(t->com.comset,NV_EXPORT|NV_IDENT|NV_ASSIGN,0); } if(t->com.comio) sh_iorestore(shp,buff.topfd,jmpval); diff --git a/usr/src/lib/libshell/common/tests/README.tests b/usr/src/lib/libshell/common/tests/README.tests new file mode 100644 index 0000000000..c78d32d9b1 --- /dev/null +++ b/usr/src/lib/libshell/common/tests/README.tests @@ -0,0 +1,53 @@ + +#### ksh93 test suite + +## Intro +The directory /usr/demo/ksh/tests/ contains the ksh93 test suite +which is used to verify the correct behaviour of ksh93. + +The test suite is split into modules with the ending *.sh +and a frontend called "shtests" which is used to run the tests. + + +## Basic description: +/usr/demo/ksh/tests/shtests <options> <varname=value> <testmodule> + +<options> may be: + -a execute test module one time as normal script code + and a 2nd time as compiled shell script. The env + variable SHCOMP defines the version of the shell + compiler being used (default is "${SHELL%/*}/shcomp", + however it is recommended to explicitly set SHCOMP + to /usr/bin/shcomp). + -c execute test module as compiled shell script + -s execute test module as normal shell script + -t do not print timing information + -v use VMDEBUG +<varname=value> + Sets one or more environment variables to value "value". +<testmodule> + file name of test module + + +## Basic usage in Solaris >= 11 and OpenSolaris/Indiana: +The tests can be executed like this: +$ export SHELL=<path-to-ksh93-executable> +$ export SHCOMP=/usr/bin/shcomp +for t in /usr/demo/ksh/tests/*.sh ; do + $SHELL /usr/demo/ksh/tests/shtests -a "$t" +done + +Note that you MUST NOT use "/usr/bin/ksh93" as value for +SHELL since /usr/bin/ksh93 on Solaris is a wrapper which +selects a suitable executable in /usr/bin/<isa>/ksh93 +based on the hardware capabilities defined via /usr/bin/isalist + +Valid values for SHELL are: +- SHELL=/usr/bin/i86/ksh93 # 32bit i386 +- SHELL=/usr/bin/amd64/ksh93 # 64bit AMD64 +- SHELL=/usr/bin/sparcv7/ksh93 # 32bit SPARC +- SHELL=/usr/bin/sparcv9/ksh93 # 64bit SPARC +- SHELL=/usr/bin/s390/ksh93 # 32bit SystemZ +- SHELL=/usr/bin/s390x/ksh93 # 64bit SystemZ + +# EOF. diff --git a/usr/src/lib/libshell/common/tests/alias.sh b/usr/src/lib/libshell/common/tests/alias.sh index e001668ef7..f527faf23e 100644 --- a/usr/src/lib/libshell/common/tests/alias.sh +++ b/usr/src/lib/libshell/common/tests/alias.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -27,6 +27,10 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + alias foo='print hello' if [[ $(foo) != hello ]] then err_exit 'foo, where foo is alias for "print hello" failed' @@ -66,7 +70,7 @@ alias !!=print if [[ $(!! hello 2>/dev/null) != hello ]] then err_exit 'alias for !!=print not working' fi -alias foo=echo +alias foo=echo if [[ $(print "$(foo bar)" ) != bar ]] then err_exit 'alias in command substitution not working' fi @@ -81,14 +85,12 @@ then [[ ! $(alias -t | grep rm= ) ]] && err_exit 'tracked alias not set' [[ $(alias -t | grep rm= ) ]] && err_exit 'tracked alias not cleared' fi if hash -r 2>/dev/null && [[ ! $(hash) ]] -then mkdir /tmp/ksh$$ || err_exit "mkdir /tmp/ksh$$ failed" - trap "cd /; rm -rf /tmp/ksh$$" EXIT - PATH=/tmp/ksh$$:/bin:/usr/bin +then PATH=$tmp:/bin:/usr/bin for i in foo -foo -- - do print ':' > /tmp/ksh$$/$i - chmod +x /tmp/ksh$$/$i + do print ':' > $tmp/$i + chmod +x $tmp/$i hash -r -- $i 2>/dev/null || err_exit "hash -r -- $i failed" - [[ $(hash) == $i=/tmp/ksh$$/$i ]] || err_exit "hash -r -- $i failed, expected $i=/tmp/ksh$$/$i, got $(hash)" + [[ $(hash) == $i=$tmp/$i ]] || err_exit "hash -r -- $i failed, expected $i=$tmp/$i, got $(hash)" done else err_exit 'hash -r failed' fi diff --git a/usr/src/lib/libshell/common/tests/append.sh b/usr/src/lib/libshell/common/tests/append.sh index 00c432520a..d3e10c9100 100644 --- a/usr/src/lib/libshell/common/tests/append.sh +++ b/usr/src/lib/libshell/common/tests/append.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libshell/common/tests/arith.sh b/usr/src/lib/libshell/common/tests/arith.sh index c330abce90..47c9619c75 100644 --- a/usr/src/lib/libshell/common/tests/arith.sh +++ b/usr/src/lib/libshell/common/tests/arith.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -26,8 +26,13 @@ function err_exit alias err_exit='err_exit $LINENO' Command=${0##*/} -trap '' FPE # NOTE: osf.alpha requires this (no ieee math) integer Errors=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + +trap '' FPE # NOTE: osf.alpha requires this (no ieee math) + integer x=1 y=2 z=3 if (( 2+2 != 4 )) then err_exit 2+2!=4 @@ -135,7 +140,7 @@ if [[ $? == 0 ]] then err_exit 'floating point allowed with % operator' fi x=.125 -if [[ $(( 4 * x/2 )) != 0.25 ]] +if [[ $(( 4 * x/2 )) != 0.25 ]] then err_exit '(( 4 * x/2 )) is not 0.25, with x=.125' fi if [[ $(( pow(2,3) )) != 8 ]] @@ -190,7 +195,7 @@ then err_exit "&= not working" fi function newscope { - float x=1.5 + float x=1.5 (( x += 1 )) print -r -- $x } @@ -342,7 +347,7 @@ for ((i=0; i < 4; i++)) do (( ipx = ip % 256 )) (( ip /= 256 )) (( ipx != hex[3-i] )) && err_exit "hex digit $((3-i)) not correct" -done +done unset x x=010 (( x == 8 )) || err_exit 'leading zeros not treated as octal arithmetic' @@ -365,8 +370,7 @@ i=2 unset i; typeset -i i=01-2 (( i == -1 )) || err_exit "01-2 is not -1" -trap 'rm -f /tmp/script$$ /tmp/data$$.[12]' EXIT -cat > /tmp/script$$ <<-\! +cat > $tmp/script <<-\! tests=$* typeset -A blop function blop.get @@ -412,14 +416,14 @@ function mkobj } mkobj bla ! -chmod +x /tmp/script$$ -[[ $(/tmp/script$$ 1) != '( bar=2 baz=3 foo=1 )' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' -[[ $(/tmp/script$$ 2) != '( faz=0 )' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' -[[ $(/tmp/script$$ 3) != '( foz=777 )' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' -[[ $(/tmp/script$$ 4) != '( foz=777 )' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' -[[ $(/tmp/script$$ 5) != '( fuz=777 )' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' -[[ $(/tmp/script$$ 6) != '0' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' -[[ $(/tmp/script$$ 7) != '0' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' +chmod +x $tmp/script +[[ $($tmp/script 1) != '( bar=2 baz=3 foo=1 )' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' +[[ $($tmp/script 2) != '( faz=0 )' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' +[[ $($tmp/script 3) != '( foz=777 )' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' +[[ $($tmp/script 4) != '( foz=777 )' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' +[[ $($tmp/script 5) != '( fuz=777 )' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' +[[ $($tmp/script 6) != '0' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' +[[ $($tmp/script 7) != '0' ]] 2>/dev/null && err_exit 'compound var arithmetic failed' unset foo typeset -F1 foo=123456789.19 [[ $foo == 123456789.2 ]] || err_exit 'typeset -F1 not working correctly' @@ -434,7 +438,7 @@ for expr in '1/(1.0/2)' '1/(1/2.0)' do [[ $( ( $SHELL -c "( print -r -- \$(($expr)) )" ) 2>/dev/null ) == 2 ]] || err_exit "invalid value for: $expr" done [[ $((5||0)) == 1 ]] || err_exit '$((5||0))'" == $((5||0)) should be 1" -$SHELL -c 'integer x=3 y=2; (( (y += x += 2) == 7 && x==5))' 2> /dev/null || err_exit '((y += x += 2)) not working' +$SHELL -c 'integer x=3 y=2; (( (y += x += 2) == 7 && x==5))' 2> /dev/null || err_exit '((y += x += 2)) not working' $SHELL -c 'b=0; [[ $((b?a=1:b=9)) == 9 ]]' 2> /dev/null || err_exit 'b?a=1:b=9 not working' unset x (( x = 4*atan(1.0) )) @@ -483,4 +487,46 @@ $SHELL -c '(( x=));:' 2> /dev/null && err_exit '((x=)) should be an error' $SHELL -c '(( x+=));:' 2> /dev/null && err_exit '((x+=)) should be an error' $SHELL -c '(( x=+));:' 2> /dev/null && err_exit '((x=+)) should be an error' $SHELL -c 'x=();x.arr[0]=(z=3); ((x.arr[0].z=2))' 2> /dev/null || err_exit '(((x.arr[0].z=2)) should not be an error' + +float t +typeset a b r +v="-0.0 0.0 +0.0 -1.0 1.0 +1.0" +for a in $v +do for b in $v + do (( r = copysign(a,b) )) + (( t = copysign(a,b) )) + [[ $r == $t ]] || err_exit $(printf "float t=copysign(%3.1f,%3.1f) => %3.1f -- expected %3.1f\n" a b t r) + done +done + +typeset -l y y_ascii +(( y=sin(90) )) +y_ascii=$y +(( y == y_ascii )) || err_exit "no match,\n\t$(printf "%a\n" y)\n!=\n\t$(printf "%a\n" y_ascii)" + +( $SHELL <<- \EOF + p=5 + t[p]=6 + while (( t[p] != 0 )) ; do + (( + p+=1 , + t[p]+=2 , + p+=3 , + t[p]+=5 , + p+=1 , + t[p]+=2 , + p+=1 , + t[p]+=1 , + p-=6 , + t[p]-=1 + )) + : + done +EOF) 2> /dev/null || err_exit 'error with comma expression' + +N=(89551 89557) +i=0 j=1 +[[ $(printf "%d" N[j]-N[i]) == 6 ]] || err_exit 'printf %d N[i]-N[j] failed' +[[ $((N[j]-N[i])) == 6 ]] || err_exit '$((N[j]-N[i])) incorrect' + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/arrays.sh b/usr/src/lib/libshell/common/tests/arrays.sh index 14504edc00..996101409f 100644 --- a/usr/src/lib/libshell/common/tests/arrays.sh +++ b/usr/src/lib/libshell/common/tests/arrays.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -25,6 +25,12 @@ function err_exit } alias err_exit='err_exit $LINENO' +Command=${0##*/} +integer Errors=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + function fun { integer i @@ -34,8 +40,6 @@ function fun done } -Command=${0##*/} -integer Errors=0 set -A x zero one two three four 'five six' if [[ $x != zero ]] then err_exit '$x is not element 0' @@ -268,7 +272,7 @@ fi export foo typeset -i foo [[ $($SHELL -c "print $foo") == 143 ]]' -) 2> /dev/null || +) 2> /dev/null || err_exit 'exporting associative array not exporting 0-th element' unset foo typeset -A foo @@ -283,7 +287,7 @@ for i in one three four five do : ${foo[$i]} done if [[ ${!foo[@]} != two ]] -then err_exit 'Error in subscript names' +then err_exit 'error in subscript names' fi unset x x=( 1 2 3) @@ -329,24 +333,23 @@ bam[foo]=value [[ $bam == value ]] && err_exit 'unset associative array element error' : only first element of an array can be exported unset bam -trap 'rm -f /tmp/sharr$$' EXIT -print 'print ${var[0]} ${var[1]}' > /tmp/sharr$$ -chmod +x /tmp/sharr$$ -[[ $($SHELL -c "var=(foo bar);export var;/tmp/sharr$$") == foo ]] || err_exit 'export array not exporting just first element' +print 'print ${var[0]} ${var[1]}' > $tmp/script +chmod +x $tmp/script +[[ $($SHELL -c "var=(foo bar);export var;$tmp/script") == foo ]] || err_exit 'export array not exporting just first element' unset foo set -o allexport foo=one foo[1]=two foo[0]=three [[ $foo == three ]] || err_exit 'export all not working with arrays' -cat > /tmp/sharr$$ <<- \! +cat > $tmp/script <<- \! typeset -A foo print foo${foo[abc]} ! # 04-05-24 bug fix unset foo -[[ $($SHELL -c "typeset -A foo;/tmp/sharr$$") == foo ]] 2> /dev/null || err_exit 'empty associative arrays not being cleared correctly before scripts' -[[ $($SHELL -c "typeset -A foo;foo[abc]=abc;/tmp/sharr$$") == foo ]] 2> /dev/null || err_exit 'associative arrays not being cleared correctly before scripts' +[[ $($SHELL -c "typeset -A foo;$tmp/script") == foo ]] 2> /dev/null || err_exit 'empty associative arrays not being cleared correctly before scripts' +[[ $($SHELL -c "typeset -A foo;foo[abc]=abc;$tmp/script") == foo ]] 2> /dev/null || err_exit 'associative arrays not being cleared correctly before scripts' unset foo foo=(one two) [[ ${foo[@]:1} == two ]] || err_exit '${foo[@]:1} == two' @@ -406,7 +409,7 @@ x=${bar[$foo[5]]} test_array[3]=4 print "val=${test_array[3]}" ++EOF+++ -) == val=4 ]] 2> /dev/null || err_exit 'after reading array[j] and assign array[j] fails' +) == val=4 ]] 2> /dev/null || err_exit 'after reading array[j] and assign array[j] fails' [[ $($SHELL <<- \+++EOF+++ pastebin=( typeset -a form) pastebin.form+=( name="name" data="clueless" ) @@ -464,4 +467,10 @@ a[6]=six [[ ${a[-1]} == six ]] || err_exit 'a[-1] should be six' [[ ${a[-3]} == four ]] || err_exit 'a[-3] should be four' [[ ${a[-3..-1]} == 'four six' ]] || err_exit "a[-3,-1] should be 'four six'" + +FILTER=(typeset scope) +FILTER[0].scope=include +FILTER[1].scope=exclude +[[ ${#FILTER[@]} == 2 ]] || err_exit "FILTER array should have two elements not ${#FILTER[@]}" + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/arrays2.sh b/usr/src/lib/libshell/common/tests/arrays2.sh index 56bce796ae..ee8f0ae315 100644 --- a/usr/src/lib/libshell/common/tests/arrays2.sh +++ b/usr/src/lib/libshell/common/tests/arrays2.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libshell/common/tests/attributes.sh b/usr/src/lib/libshell/common/tests/attributes.sh index 2d4f1e3d21..474972c03b 100644 --- a/usr/src/lib/libshell/common/tests/attributes.sh +++ b/usr/src/lib/libshell/common/tests/attributes.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -27,6 +27,10 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + r=readonly u=Uppercase l=Lowercase i=22 i8=10 L=abc L5=def uL5=abcdef xi=20 x=export t=tagged H=hostname LZ5=026 RZ5=026 Z5=123 lR5=ABcdef R5=def n=l for option in u l i i8 L L5 LZ5 RZ5 Z5 r x H t R5 uL5 lR5 xi n @@ -115,18 +119,18 @@ fi sz=(typeset -E y=2.2) string="$(print $sz)" if [[ "${sz}" == *'typeset -E -F'* ]] -then err_exit 'print of exponential shows both -E and -F attributes' +then err_exit 'print of exponential shows both -E and -F attributes' fi -print 'typeset -i m=48/4+1;print -- $m' > /tmp/ksh$$ -chmod +x /tmp/ksh$$ +print 'typeset -i m=48/4+1;print -- $m' > $tmp/script +chmod +x $tmp/script typeset -Z2 m -if [[ $(/tmp/ksh$$) != 13 ]] +if [[ $($tmp/script) != 13 ]] then err_exit 'attributes not cleared for script execution' fi -print 'print VAR=$VAR' > /tmp/ksh$$ +print 'print VAR=$VAR' > $tmp/script typeset -L70 VAR=var -/tmp/ksh$$ > /tmp/ksh$$.1 -[[ $(< /tmp/ksh$$.1) == VAR= ]] || err_exit 'typeset -L should not be inherited' +$tmp/script > $tmp/script.1 +[[ $(< $tmp/script.1) == VAR= ]] || err_exit 'typeset -L should not be inherited' typeset -Z LAST=00 unset -f foo function foo @@ -145,7 +149,6 @@ if (( ${#LAST} != 2 )) then err_exit 'LAST!=2' fi [[ $(set | grep LAST) == LAST=02 ]] || err_exit "LAST not correct in set list" -rm -rf /tmp/ksh$$* set -a unset foo foo=bar @@ -195,7 +198,9 @@ hello worldhello worldhello world ! [[ $v1 == "$b1" ]] || err_exit "v1=$v1 should be $b1" [[ $v2 == "$x" ]] || err_exit "v1=$v2 should be $x" -[[ $(env - '!=1' $SHELL -c 'echo ok' 2>/dev/null) == ok ]] || err_exit 'malformed environment terminates shell' +if env '!=1' >/dev/null 2>&1 +then [[ $(env '!=1' $SHELL -c 'echo ok' 2>/dev/null) == ok ]] || err_exit 'malformed environment terminates shell' +fi unset var typeset -b var printf '12%Z34' | read -r -N 5 var @@ -211,10 +216,10 @@ unset foo bar unset -f fun function fun { - export foo=hello + export foo=hello typeset -x bar=world [[ $foo == hello ]] || err_exit 'export scoping problem in function' -} +} fun [[ $(export | grep foo) == 'foo=hello' ]] || err_exit 'export not working in functions' [[ $(export | grep bar) ]] && err_exit 'typeset -x not local' @@ -224,9 +229,9 @@ fred[66]=88 unset x y z typeset -LZ3 x=abcd y z=00abcd y=03 -[[ $y == "3 " ]] || err_exit '-LZ3 not working for value 03' -[[ $x == "abc" ]] || err_exit '-LZ3 not working for value abcd' -[[ $x == "abc" ]] || err_exit '-LZ3 not working for value 00abcd' +[[ $y == "3 " ]] || err_exit '-LZ3 not working for value 03' +[[ $x == "abc" ]] || err_exit '-LZ3 not working for value abcd' +[[ $x == "abc" ]] || err_exit '-LZ3 not working for value 00abcd' unset x z set +a [[ $(typeset -p z) ]] && err_exit "typeset -p for z undefined failed" @@ -280,4 +285,43 @@ function foo } bar=xxx [[ $(foo) == bar=xxx ]] || err_exit 'typeset -p not working inside a function' +unset foo +typeset -L5 foo +[[ $(typeset -p foo) == 'typeset -L 5 foo' ]] || err_exit 'typeset -p not working for variables with attributes but without a value' +{ $SHELL <<- EOF + typeset -L3 foo=aaa + typeset -L6 foo=bbbbbb + [[ \$foo == bbbbbb ]] +EOF +} || err_exit 'typeset -L should not preserve old attributes' +{ $SHELL <<- EOF + typeset -R3 foo=aaa + typeset -R6 foo=bbbbbb + [[ \$foo == bbbbbb ]] +EOF +} 2> /dev/null || err_exit 'typeset -R should not preserve old attributes' + +expected='YWJjZGVmZ2hpag==' +unset foo +typeset -b -Z10 foo +read foo <<< 'abcdefghijklmnop' +[[ $foo == "$expected" ]] || err_exit 'read foo, where foo is "typeset -b -Z10" not working' +unset foo +typeset -b -Z10 foo +read -N10 foo <<< 'abcdefghijklmnop' +[[ $foo == "$expected" ]] || err_exit 'read -N10 foo, where foo is "typeset -b -Z10" not working' +unset foo +typeset -b -A foo +read -N10 foo[4] <<< 'abcdefghijklmnop' +[[ ${foo[4]} == "$expected" ]] || err_exit 'read -N10 foo, where foo is "typeset -b -A" foo not working' +unset foo +typeset -b -a foo +read -N10 foo[4] <<< 'abcdefghijklmnop' +[[ ${foo[4]} == "$expected" ]] || err_exit 'read -N10 foo, where foo is "typeset -b -a" foo not working' +[[ $(printf %B foo[4]) == abcdefghij ]] || err_exit 'printf %B for binary associative array element not working' +[[ $(printf %B foo[4]) == abcdefghij ]] || err_exit 'printf %B for binary indexed array element not working' +unset foo + +$SHELL 2> /dev/null -c 'export foo=(bar=3)' && err_exit 'compound variables cannot be exported' + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/basic.sh b/usr/src/lib/libshell/common/tests/basic.sh index 3911f9c472..597833e74f 100644 --- a/usr/src/lib/libshell/common/tests/basic.sh +++ b/usr/src/lib/libshell/common/tests/basic.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -25,9 +25,13 @@ function err_exit } alias err_exit='err_exit $LINENO' -# test basic file operations like redirection, pipes, file expansion Command=${0##*/} integer Errors=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + +# test basic file operations like redirection, pipes, file expansion set -- \ go+r 0000 \ go-r 0044 \ @@ -53,11 +57,9 @@ umask u=rwx,go=rx || err_exit "umask u=rws,go=rx failed" if [[ $(umask -S) != u=rwx,g=rx,o=rx ]] then err_exit 'umask -S incorrect' fi -mkdir /tmp/ksh$$ || err_exit "mkdir /tmp/ksh$$ failed" -trap "cd /; rm -rf /tmp/ksh$$" EXIT pwd=$PWD [[ $SHELL != /* ]] && SHELL=$pwd/$SHELL -cd /tmp/ksh$$ || err_exit "cd /tmp/ksh$$ failed" +cd $tmp || { err_exit "cd $tmp failed"; exit 1; } um=$(umask -S) ( umask 0777; > foobar ) rm -f foobar @@ -70,11 +72,11 @@ rm -f foobar for i in 1 2 do print foobar* rm -f foobar -done > out$$ -if [[ "$(<out$$)" != "foobar"$'\n'"foobar*" ]] +done > out +if [[ "$(<out)" != "foobar"$'\n'"foobar*" ]] then print -u2 "optimizer bug with file expansion" fi -rm -f out$$ foobar +rm -f out foobar mkdir dir if [[ $(print */) != dir/ ]] then err_exit 'file expansion with trailing / not working' @@ -100,7 +102,7 @@ set -- dat* if (( $# != 5 )) then err_exit "dat* matches only $# files" fi -if (command > foo\\abc) 2> /dev/null +if (command > foo\\abc) 2> /dev/null then set -- foo* if [[ $1 != 'foo\abc' ]] then err_exit 'foo* does not match foo\abc' @@ -113,15 +115,14 @@ then set -- TT* fi fi cd ~- || err_exit "cd back failed" -cat > /tmp/ksh$$/script <<- ! +cat > $tmp/script <<- ! #! $SHELL print -r -- \$0 ! -chmod 755 /tmp/ksh$$/script -if [[ $(/tmp/ksh$$/script) != "/tmp/ksh$$/script" ]] +chmod 755 $tmp/script +if [[ $($tmp/script) != "$tmp/script" ]] then err_exit '$0 not correct for #! script' fi -rm -r /tmp/ksh$$ || err_exit "rm -r /tmp/ksh$$ failed" bar=foo eval foo=\$bar if [[ $foo != foo ]] @@ -140,9 +141,9 @@ fi ( sleep 2; cat <<! foobar ! -) | cat > /tmp/foobar$$ & +) | cat > $tmp/foobar & wait $! -foobar=$( < /tmp/foobar$$) +foobar=$( < $tmp/foobar) if [[ $foobar != foobar ]] then err_exit "$foobar is not foobar" fi @@ -150,26 +151,26 @@ fi print foo /bin/echo bar print bam -} > /tmp/foobar$$ -if [[ $( < /tmp/foobar$$) != $'foo\nbar\nbam' ]] -then err_exit "Output file pointer not shared correctly." +} > $tmp/foobar +if [[ $( < $tmp/foobar) != $'foo\nbar\nbam' ]] +then err_exit "output file pointer not shared correctly" fi -cat > /tmp/foobar$$ <<\! +cat > $tmp/foobar <<\! print foo /bin/echo bar print bam ! -chmod +x /tmp/foobar$$ -if [[ $(/tmp/foobar$$) != $'foo\nbar\nbam' ]] -then err_exit "Script not working." +chmod +x $tmp/foobar +if [[ $($tmp/foobar) != $'foo\nbar\nbam' ]] +then err_exit "script not working" fi -if [[ $(/tmp/foobar$$ | /bin/cat) != $'foo\nbar\nbam' ]] -then err_exit "Script | cat not working." +if [[ $($tmp/foobar | /bin/cat) != $'foo\nbar\nbam' ]] +then err_exit "script | cat not working" fi -if [[ $( /tmp/foobar$$) != $'foo\nbar\nbam' ]] -then err_exit "Output file pointer not shared correctly." +if [[ $( $tmp/foobar) != $'foo\nbar\nbam' ]] +then err_exit "output file pointer not shared correctly" fi -rm -f /tmp/foobar$$ +rm -f $tmp/foobar x=$( (print foo) ; (print bar) ) if [[ $x != $'foo\nbar' ]] then err_exit " ( (print foo);(print bar ) failed" @@ -182,7 +183,7 @@ x=$( (/bin/echo foo) ; (/bin/echo bar) ) if [[ $x != $'foo\nbar' ]] then err_exit " ( (/bin/echo);(/bin/echo bar ) failed" fi -cat > /tmp/ksh$$ <<\! +cat > $tmp/script <<\! if [[ -p /dev/fd/0 ]] then builtin cat cat - > /dev/null @@ -190,33 +191,30 @@ then builtin cat else print no fi ! -chmod +x /tmp/ksh$$ -case $( (print) | /tmp/ksh$$;:) in +chmod +x $tmp/script +case $( (print) | $tmp/script;:) in ok) ;; no) err_exit "[[ -p /dev/fd/0 ]] fails for standard input pipe" ;; *) err_exit "builtin replaces standard input pipe" ;; esac -print 'print $0' > /tmp/ksh$$ -print ". /tmp/ksh$$" > /tmp/ksh$$x -chmod +x /tmp/ksh$$x -if [[ $(/tmp/ksh$$x) != /tmp/ksh$$x ]] +print 'print $0' > $tmp/script +print ". $tmp/script" > $tmp/scriptx +chmod +x $tmp/scriptx +if [[ $($tmp/scriptx) != $tmp/scriptx ]] then err_exit '$0 not correct for . script' fi -rm -r /tmp/ksh$$ /tmp/ksh$$x -mkdir /tmp/ksh$$ || err_exit "mkdir /tmp/ksh$$ failed" -cd /tmp/ksh$$ || err_exit "cd /tmp/ksh$$ failed" -print ./b > ./a; print ./c > b; print ./d > c; print ./e > d; print "echo \"hello there\"" > e +cd $tmp || { err_exit "cd $tmp failed"; exit 1; } +print ./b > ./a; print ./c > b; print ./d > c; print ./e > d; print "echo \"hello there\"" > e chmod 755 a b c d e x=$(./a) if [[ $x != "hello there" ]] -then err_exit "nested scripts failed" +then err_exit "nested scripts failed" fi x=$( (./a) | cat) if [[ $x != "hello there" ]] -then err_exit "scripts in subshells fail" +then err_exit "scripts in subshells fail" fi cd ~- || err_exit "cd back failed" -rm -r /tmp/ksh$$ || err_exit "rm -r /tmp/ksh$$ failed" x=$( (/bin/echo foo) 2> /dev/null ) if [[ $x != foo ]] then err_exit "subshell in command substitution fails" @@ -239,29 +237,29 @@ x=$( (/bin/echo hello) 2> /dev/null ) if [[ $x != hello ]] then err_exit "subshell in command substitution with 1 closed fails" fi -cat > /tmp/ksh$$ <<- \! +cat > $tmp/script <<- \! read line 2> /dev/null print done ! -if [[ $($SHELL /tmp/ksh$$ <&-) != done ]] +if [[ $($SHELL $tmp/script <&-) != done ]] then err_exit "executing script with 0 closed fails" fi trap '' INT -cat > /tmp/ksh$$ <<- \! +cat > $tmp/script <<- \! trap 'print bad' INT kill -s INT $$ print good ! -chmod +x /tmp/ksh$$ -if [[ $($SHELL /tmp/ksh$$) != good ]] +chmod +x $tmp/script +if [[ $($SHELL $tmp/script) != good ]] then err_exit "traps ignored by parent not ignored" fi trap - INT -cat > /tmp/ksh$$ <<- \! +cat > $tmp/script <<- \! read line /bin/cat ! -if [[ $($SHELL /tmp/ksh$$ <<! +if [[ $($SHELL $tmp/script <<! one two ! @@ -305,7 +303,7 @@ wait # not running --pipefail which would interfere with subsequent tests sleep 20 & pids=$! if [[ $(jobs -p) != $! ]] -then err_exit 'jobs -p not reporting a background job' +then err_exit 'jobs -p not reporting a background job' fi sleep 20 & pids="$pids $!" @@ -323,32 +321,31 @@ kill $pids command exec 3<> /dev/null if cat /dev/fd/3 >/dev/null 2>&1 then [[ $($SHELL -c 'cat <(print foo)' 2> /dev/null) == foo ]] || err_exit 'process substitution not working' - [[ $($SHELL -c 'print $(cat <(print foo) )' 2> /dev/null) == foo ]] || err_exit 'process substitution in subshell not working' - [[ $($SHELL -c $'tee >(grep \'1$\' > /tmp/ksh'$$'x) > /dev/null <<- \!!! + [[ $($SHELL -c $'tee >(grep \'1$\' > '$tmp/scriptx$') > /dev/null <<- \!!! line0 line1 line2 !!! wait - cat /tmp/ksh'$$x 2> /dev/null) == line1 ]] || err_exit '>() process substitution fails' - > /tmp/ksh$$x + cat '$tmp/scriptx 2> /dev/null) == line1 ]] || err_exit '>() process substitution fails' + > $tmp/scriptx [[ $($SHELL -c $' for i in 1 - do tee >(grep \'1$\' > /tmp/ksh'$$'x) > /dev/null <<- \!!! + do tee >(grep \'1$\' > '$tmp/scriptx$') > /dev/null <<- \!!! line0 line1 line2 !!! done wait - cat /tmp/ksh'$$x 2>> /dev/null) == line1 ]] || err_exit '>() process substitution fails in for loop' + cat '$tmp/scriptx 2>> /dev/null) == line1 ]] || err_exit '>() process substitution fails in for loop' [[ $({ $SHELL -c 'cat <(for i in x y z; do print $i; done)';} 2> /dev/null) == $'x\ny\nz' ]] || err_exit 'process substitution of compound commands not working' fi [[ $($SHELL -r 'command -p :' 2>&1) == *restricted* ]] || err_exit 'command -p not restricted' -print cat > /tmp/ksh$$x -chmod +x /tmp/ksh$$x -[[ $($SHELL -c "print foo | /tmp/ksh$$x ;:" 2> /dev/null ) == foo ]] || err_exit 'piping into script fails' +print cat > $tmp/scriptx +chmod +x $tmp/scriptx +[[ $($SHELL -c "print foo | $tmp/scriptx ;:" 2> /dev/null ) == foo ]] || err_exit 'piping into script fails' [[ $($SHELL -c 'X=1;print -r -- ${X:=$(expr "a(0)" : '"'a*(\([^)]\))')}'" 2> /dev/null) == 1 ]] || err_exit 'x=1;${x:=$(..."...")} failure' [[ $($SHELL -c 'print -r -- ${X:=$(expr "a(0)" : '"'a*(\([^)]\))')}'" 2> /dev/null) == 0 ]] || err_exit '${x:=$(..."...")} failure' exec 3<&- @@ -357,19 +354,18 @@ then [[ $(cat <(print hello) ) == hello ]] || err_exit "process substitution not $SHELL -c '[[ $(for i in 1;do cat <(print hello);done ) == hello ]]' 2> /dev/null|| err_exit "process substitution not working in for or while loop" fi exec 3> /dev/null -print 'print foo "$@"' > /tmp/ksh$$x -[[ $( print "(/tmp/ksh$$x bar)" | $SHELL 2>/dev/null) == 'foo bar' ]] || err_exit 'script pipe to shell fails' -print "#! $SHELL" > /tmp/ksh$$x -print 'print -- $0' >> /tmp/ksh$$x -chmod +x /tmp/ksh$$x -[[ $(/tmp/ksh$$x) == /tmp/ksh$$x ]] || err_exit "\$0 is $0 instead of /tmp/ksh$$x" -cat > /tmp/ksh$$x <<- \EOF +print 'print foo "$@"' > $tmp/scriptx +[[ $( print "($tmp/scriptx bar)" | $SHELL 2>/dev/null) == 'foo bar' ]] || err_exit 'script pipe to shell fails' +print "#! $SHELL" > $tmp/scriptx +print 'print -- $0' >> $tmp/scriptx +chmod +x $tmp/scriptx +[[ $($tmp/scriptx) == $tmp/scriptx ]] || err_exit "\$0 is $0 instead of $tmp/scriptx" +cat > $tmp/scriptx <<- \EOF myfilter() { x=$(print ok | cat); print -r -- $SECONDS;} set -o pipefail sleep 3 | myfilter EOF -(( $($SHELL /tmp/ksh$$x) > 2.0 )) && err_exit 'command substitution causes pipefail option to hang' -rm -f /tmp/ksh$$x +(( $($SHELL $tmp/scriptx) > 2.0 )) && err_exit 'command substitution causes pipefail option to hang' exec 3<&- ( typeset -r foo=bar) 2> /dev/null || err_exit 'readonly variables set in a subshell cannot unset' $SHELL -c 'x=${ print hello;}; [[ $x == hello ]]' 2> /dev/null || err_exit '${ command;} not supported' @@ -406,13 +402,8 @@ $SHELL 2> /dev/null <<- \EOF || err_exit '${ command;}xxx not working' EOF unset foo -function foo -{ - print bar -} -[[ ${foo} == bar ]] || err_exit '${foo} is not command substitution when foo unset' -[[ ! ${foo[@]} ]] || err_exit '${foo[@]} is not empty when foo is unset' -[[ ! ${foo[3]} ]] || err_exit '${foo[3]} is not empty when foo is unset' +[[ ! ${foo[@]} ]] || err_exit '${foo[@]} is not empty when foo is unset' +[[ ! ${foo[3]} ]] || err_exit '${foo[3]} is not empty when foo is unset' [[ $(print "[${ print foo }]") == '[foo]' ]] || err_exit '${...} not working when } is followed by ]' [[ $(print "${ print "[${ print foo }]" }") == '[foo]' ]] || err_exit 'nested ${...} not working when } is followed by ]' unset foo @@ -421,10 +412,57 @@ expected=foreback got=$(print -n fore;(sleep 2;print back)&) [[ $got == $expected ]] || err_exit "command substitution background process output error -- got '$got', expected '$expected'" -for false in false $(whence -p false) +binfalse=$(whence -p false) +for false in false $binfalse do x=$($false) && err_exit "x=\$($false) should fail" $($false) && err_exit "\$($false) should fail" $($false) > /dev/null && err_exit "\$($false) > /dev/null should fail" done -[[ $(env 'x-a=y' $SHELL -c 'env | grep x-a') == *x-a=y* ]] || err_exit 'invalid environment variables not preserved' +if env x-a=y >/dev/null 2>&1 +then [[ $(env 'x-a=y' $SHELL -c 'env | grep x-a') == *x-a=y* ]] || err_exit 'invalid environment variables not preserved' +fi +float s=SECONDS +sleep=$(whence -p sleep) +for i in 1 2 +do print $i +done | while read sec; do ( $sleep $sec; $sleep $sec) done +(( (SECONDS-s) < 4)) && err_exit '"command | while read...done" finishing too fast' +s=SECONDS +set -o pipefail +for ((i=0; i < 30; i++)) +do print hello + sleep .1 +done | $sleep 1 +(( (SECONDS-s) < 2 )) || err_exit 'early termination not causing broken pipe' +[[ $({ trap 'print trap' 0; print -n | $(whence -p cat); } & wait $!) == trap ]] || err_exit 'trap on exit not getting triggered' +var=$({ trap 'print trap' ERR; print -n | $binfalse; } & wait $!) +[[ $var == trap ]] || err_exit 'trap on ERR not getting triggered' + +exp= +got=$( + function fun + { + $binfalse && echo FAILED + } + : works if this line deleted : | + fun + : works if this line deleted : +) +[[ $got == $exp ]] || err_exit "pipe to function with conditional fails -- expected '$exp', got '$got'" +got=$( + : works if this line deleted : | + { $binfalse && echo FAILED; } + : works if this line deleted : +) +[[ $got == $exp ]] || err_exit "pipe to { ... } with conditional fails -- expected '$exp', got '$got'" + +got=$( + : works if this line deleted : | + ( $binfalse && echo FAILED ) + : works if this line deleted : +) +[[ $got == $exp ]] || err_exit "pipe to ( ... ) with conditional fails -- expected '$exp', got '$got'" + +( $SHELL -c 'trap : DEBUG; x=( $foo); exit 0') 2> /dev/null || err_exit 'trap DEBUG fails' + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/bracket.sh b/usr/src/lib/libshell/common/tests/bracket.sh index 0b36806fbf..496fdae5a4 100644 --- a/usr/src/lib/libshell/common/tests/bracket.sh +++ b/usr/src/lib/libshell/common/tests/bracket.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -27,17 +27,19 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + null='' if [[ ! -z $null ]] then err_exit "-z: null string should be of zero length" fi -file=/tmp/regresso$$ -newer_file=/tmp/regressn$$ +file=$tmp/original +newer_file=$tmp/newer if [[ -z $file ]] then err_exit "-z: $file string should not be of zero length" fi -trap "rm -f $file $newer_file" EXIT -rm -f $file if [[ -a $file ]] then err_exit "-a: $file shouldn't exist" fi @@ -119,11 +121,11 @@ fi if [[ $file -nt $newer_file ]] then err_exit "$newer_file should be newer than $file" fi -if [[ $file != /tmp/* ]] -then err_exit "$file should match /tmp/*" +if [[ $file != $tmp/* ]] +then err_exit "$file should match $tmp/*" fi -if [[ $file = '/tmp/*' ]] -then err_exit "$file should not equal /tmp/*" +if [[ $file = $tmp'/*' ]] +then err_exit "$file should not equal $tmp'/*'" fi [[ ! ( ! -z $null && ! -z x) ]] || err_exit "negation and grouping" [[ -z '' || -z '' || -z '' ]] || err_exit "three ors not working" @@ -211,17 +213,17 @@ done [[ aaaa == {2,5}(a) ]] || err_exit 'aaaa != {2,4}(a)' [[ abcdcdabcd == {3,6}(ab|cd) ]] || err_exit 'abcdcdabcd == {3,4}(ab|cd)' [[ abcdcdabcde == {5}(ab|cd)e ]] || err_exit 'abcdcdabcd == {5}(ab|cd)e' -) || err_exit 'Errors with {..}(...) patterns' +) || err_exit 'errors with {..}(...) patterns' [[ D290.2003.02.16.temp == D290.+(2003.02.16).temp* ]] || err_exit 'pattern match bug with +(...)' rm -rf $file { -[[ -N $file ]] && err_exit 'test -N /tmp/*: st_mtime>st_atime after creat' +[[ -N $file ]] && err_exit 'test -N $tmp/*: st_mtime>st_atime after creat' sleep 2 print 'hello world' -[[ -N $file ]] || err_exit 'test -N /tmp/*: st_mtime<=st_atime after write' +[[ -N $file ]] || err_exit 'test -N $tmp/*: st_mtime<=st_atime after write' sleep 2 read -[[ -N $file ]] && err_exit 'test -N /tmp/*: st_mtime>st_atime after read' +[[ -N $file ]] && err_exit 'test -N $tmp/*: st_mtime>st_atime after read' } > $file < $file if rm -rf "$file" && ln -s / "$file" then [[ -L "$file" ]] || err_exit '-L not working' @@ -242,4 +244,80 @@ i=hell test '(' = ')' && err_exit '"test ( = )" should not be true' [[ $($SHELL -c 'case F in ~(Eilr)[a-z0-9#]) print ok;;esac' 2> /dev/null) == ok ]] || err_exit '~(Eilr) not working in case command' [[ $($SHELL -c "case Q in ~(Fi)q | \$'\E') print ok;;esac" 2> /dev/null) == ok ]] || err_exit '~(Fi)q | \E not working in case command' + +for l in C en_US.ISO8859-15 +do [[ $($SHELL -c "LC_COLLATE=$l" 2>&1) ]] && continue + export LC_COLLATE=$l + set -- \ + 'A' 0 1 1 0 1 1 1 0 0 1 0 0 \ + 'Z' 0 1 1 0 1 1 1 0 0 1 0 0 \ + '/' 0 0 0 0 0 0 1 1 1 1 1 1 \ + '.' 0 0 0 0 0 0 1 1 1 1 1 1 \ + '_' 0 0 0 0 0 0 1 1 1 1 1 1 \ + '-' 1 1 1 1 1 1 0 0 0 0 0 0 \ + '%' 0 0 0 0 0 0 1 1 1 1 1 1 \ + '@' 0 0 0 0 0 0 1 1 1 1 1 1 \ + '!' 0 0 0 0 0 0 1 1 1 1 1 1 \ + '^' 0 0 0 0 0 0 1 1 1 1 1 1 \ + # retain this line # + while (( $# >= 13 )) + do c=$1 + shift + for p in \ + '[![.-.]]' \ + '[![.-.][:upper:]]' \ + '[![.-.]A-Z]' \ + '[!-]' \ + '[!-[:upper:]]' \ + '[!-A-Z]' \ + '[[.-.]]' \ + '[[.-.][:upper:]]' \ + '[[.-.]A-Z]' \ + '[-]' \ + '[-[:upper:]]' \ + '[-A-Z]' \ + # retain this line # + do e=$1 + shift + [[ $c == $p ]] + g=$? + [[ $g == $e ]] || err_exit "[[ '$c' == $p ]] for LC_COLLATE=$l failed -- expected $e, got $g" + done + done +done +integer n +if ( : < /dev/tty ) 2>/dev/null && exec {n}< /dev/tty +then [[ -t $n ]] || err_exit "[[ -t n ]] fails when n > 9" +fi +foo=([1]=a [2]=b [3]=c) +[[ -v foo[1] ]] || err_exit 'foo[1] should be set' +[[ ${foo[1]+x} ]] || err_exit '${foo[1]+x} should be x' +[[ ${foo[@]+x} ]] || err_exit '${foo[@]+x} should be x' +unset foo[1] +[[ -v foo[1] ]] && err_exit 'foo[1] should not be set' +[[ ${foo[1]+x} ]] && err_exit '${foo[1]+x} should be empty' +bar=(a b c) +[[ -v bar[1] ]] || err_exit 'bar[1] should be set' +[[ ${bar[1]+x} ]] || err_exit '${foo[1]+x} should be x' +unset bar[1] +[[ ${bar[1]+x} ]] && err_exit '${foo[1]+x} should be empty' +[[ -v bar ]] || err_exit 'bar should be set' +[[ -v bar[1] ]] && err_exit 'bar[1] should not be set' +integer z=( 1 2 4) +[[ -v z[1] ]] || err_exit 'z[1] should be set' +unset z[1] +[[ -v z[1] ]] && err_exit 'z[1] should not be set' +typeset -si y=( 1 2 4) +[[ -v y[6] ]] && err_exit 'y[6] should not be set' +[[ -v y[1] ]] || err_exit 'y[1] should be set' +unset y[1] +[[ -v y[1] ]] && err_exit 'y[1] should not be set' +x=abc +[[ -v x[0] ]] || err_exit 'x[0] should be set' +[[ ${x[0]+x} ]] || err_exit print '${x[0]+x} should be x' +[[ -v x[3] ]] && err_exit 'x[3] should not be set' +[[ ${x[3]+x} ]] && err_exit '${x[0]+x} should be Empty' +unset x +[[ ${x[@]+x} ]] && err_exit '${x[@]+x} should be Empty' +unset x y z foo bar exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/builtins.sh b/usr/src/lib/libshell/common/tests/builtins.sh index 08dac83a4e..cbd78fa98b 100644 --- a/usr/src/lib/libshell/common/tests/builtins.sh +++ b/usr/src/lib/libshell/common/tests/builtins.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -25,9 +25,13 @@ function err_exit } alias err_exit='err_exit $LINENO' -# test shell builtin commands Command=${0##*/} integer Errors=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + +# test shell builtin commands builtin getconf : ${foo=bar} || err_exit ": failed" [[ $foo = bar ]] || err_exit ": side effects failed" @@ -171,30 +175,31 @@ if [[ $(command -v if) != if ]] then err_exit 'command -v not working' fi read -r var <<\! - + ! if [[ $var != "" ]] then err_exit "read -r of blank line not working" fi -mkdir -p /tmp/ksh$$/a/b/c 2>/dev/null || err_exit "mkdir -p failed" -$SHELL -c "cd /tmp/ksh$$/a/b; cd c" 2>/dev/null || err_exit "initial script relative cd fails" -rm -r /tmp/ksh$$ || err_exit "rm -r /tmp/ksh$$ failed" -trap 'print HUP' HUP -if [[ $(trap) != "trap -- 'print HUP' HUP" ]] -then err_exit '$(trap) not working' -fi -if [[ $(trap -p HUP) != 'print HUP' ]] -then err_exit '$(trap -p HUP) not working' -fi +mkdir -p $tmp/a/b/c 2>/dev/null || err_exit "mkdir -p failed" +$SHELL -c "cd $tmp/a/b; cd c" 2>/dev/null || err_exit "initial script relative cd fails" + +trap 'print TERM' TERM +exp=$'trap -- \'print TERM\' TERM\ntrap -- \'cd /; rm -rf '$tmp$'\' EXIT' +got=$(trap) +[[ $got == $exp ]] || err_exit "\$(trap) failed -- expected \"$exp\", got \"$got\"" +exp='print TERM' +got=$(trap -p TERM) +[[ $got == $exp ]] || err_exit "\$(trap -p TERM) failed -- expected \"$exp\", got \"$got\"" + [[ $($SHELL -c 'trap "print ok" SIGTERM; kill -s SIGTERM $$' 2> /dev/null) == ok ]] || err_exit 'SIGTERM not recognized' [[ $($SHELL -c 'trap "print ok" sigterm; kill -s sigterm $$' 2> /dev/null) == ok ]] || err_exit 'SIGTERM not recognized' [[ $($SHELL -c '( trap "" TERM);kill $$;print bad' == bad) ]] 2> /dev/null && err_exit 'trap ignored in subshell causes it to be ignored by parent' ${SHELL} -c 'kill -1 -$$' 2> /dev/null -[[ $(kill -l $?) == HUP ]] || err_exit 'kill -1 -pid not working' +[[ $(kill -l $?) == HUP ]] || err_exit 'kill -1 -pid not working' ${SHELL} -c 'kill -1 -$$' 2> /dev/null -[[ $(kill -l $?) == HUP ]] || err_exit 'kill -n1 -pid not working' +[[ $(kill -l $?) == HUP ]] || err_exit 'kill -n1 -pid not working' ${SHELL} -c 'kill -s HUP -$$' 2> /dev/null -[[ $(kill -l $?) == HUP ]] || err_exit 'kill -HUP -pid not working' +[[ $(kill -l $?) == HUP ]] || err_exit 'kill -HUP -pid not working' n=123 typeset -A base base[o]=8# @@ -266,23 +271,23 @@ OPTIND=1 if [[ $(getopts $'[+?X\ffoobar\fX]' v --man 2>&1) != *'Xhello world'X* ]] then err_exit '\f...\f not working in getopts usage strings' fi -if [[ $(printf '%H\n' $'<>"& \'\tabc') != '<>"& '	abc' ]] +if [[ $(printf '%H\n' $'<>"& \'\tabc') != '<>"& '	abc' ]] then err_exit 'printf %H not working' fi -if [[ $(printf '%R %R %R %R\n' 'a.b' '*.c' '^' '!(*.*)') != '^a\.b$ \.c$ ^\^$ ^(.*\..*)!$' ]] +if [[ $(printf '%R %R %R %R\n' 'a.b' '*.c' '^' '!(*.*)') != '^a\.b$ \.c$ ^\^$ ^(.*\..*)!$' ]] then err_exit 'printf %R not working' fi if [[ $(printf '%..:c\n' abc) != a:b:c ]] -then err_exit "printf '%..:c' not working" +then err_exit "printf '%..:c' not working" fi if [[ $(printf '%..*c\n' : abc) != a:b:c ]] -then err_exit "printf '%..*c' not working" +then err_exit "printf '%..*c' not working" fi if [[ $(printf '%..:s\n' abc def ) != abc:def ]] -then err_exit "printf '%..:s' not working" +then err_exit "printf '%..:s' not working" fi if [[ $(printf '%..*s\n' : abc def) != abc:def ]] -then err_exit "printf '%..*s' not working" +then err_exit "printf '%..*s' not working" fi [[ $(printf '%q\n') == '' ]] || err_exit 'printf "%q" with missing arguments' # we won't get hit by the one second boundary twice, right? @@ -296,12 +301,18 @@ behead() } print $'line1\nline2' | behead if [[ $left != line2 ]] -then err_exit "read reading ahead on a pipe" +then err_exit "read reading ahead on a pipe" fi -print -n $'{ read -r line;print $line;}\nhello' > /tmp/ksh$$ -chmod 755 /tmp/ksh$$ -trap 'rm -rf /tmp/ksh$$' EXIT -if [[ $($SHELL < /tmp/ksh$$) != hello ]] +read -n1 y <<! +abc +! +exp=a +if [[ $y != $exp ]] +then err_exit "read -n1 failed -- expected '$exp', got '$y'" +fi +print -n $'{ read -r line;print $line;}\nhello' > $tmp/script +chmod 755 $tmp/script +if [[ $($SHELL < $tmp/script) != hello ]] then err_exit 'read of incomplete line not working correctly' fi set -f @@ -321,19 +332,13 @@ wait $pid1 (( $? == 1 )) || err_exit "wait not saving exit value" wait $pid2 (( $? == 127 )) || err_exit "subshell job known to parent" -set --noglob -ifs=$IFS -IFS=, -set -- $(getconf LIBPATH) -IFS=$ifs env= -for v -do IFS=: - set -- $v - IFS=$ifs - eval [[ \$$2 ]] && env="$env $2=\"\$$2\"" +v=$(getconf LIBPATH) +for v in ${v//,/ } +do v=${v#*:} + v=${v%%:*} + eval [[ \$$v ]] && env="$env $v=\"\$$v\"" done -set --glob if [[ $(foo=bar; eval foo=\$foo $env exec -c \$SHELL -c \'print \$foo\') != bar ]] then err_exit '"name=value exec -c ..." not working' fi @@ -364,7 +369,7 @@ do arg=$1 val=$2 code=$3 err=$(printf "$fmt" "$arg" 2>&1 >/dev/null) printf "$fmt" "$arg" >/dev/null 2>&1 ret=$? - [[ $out == $val ]] || err_exit "printf $fmt $arg failed -- expected $val, got $out" + [[ $out == $val ]] || err_exit "printf $fmt $arg failed -- expected '$val', got '$out'" if (( $code )) then [[ $err ]] || err_exit "printf $fmt $arg failed, error message expected" else [[ $err ]] && err_exit "$err: printf $fmt $arg failed, error message not expected -- got '$err'" @@ -398,6 +403,50 @@ do case $opt in *) err_exit "getopts $options failed -- got flag $opt" ;; esac done + +unset a +{ read -N3 a; read -N1 b;} <<! +abcdefg +! +exp=abc +[[ $a == $exp ]] || err_exit "read -N3 here-document failed -- expected '$exp', got '$a'" +exp=d +[[ $b == $exp ]] || err_exit "read -N1 here-document failed -- expected '$exp', got '$b'" +read -n3 a <<! +abcdefg +! +exp=abc +[[ $a == $exp ]] || err_exit "read -n3 here-document failed -- expected '$exp', got '$a'" +#(print -n a;sleep 1; print -n bcde) | { read -N3 a; read -N1 b;} +#[[ $a == $exp ]] || err_exit "read -N3 from pipe failed -- expected '$exp', got '$a'" +#exp=d +#[[ $b == $exp ]] || err_exit "read -N1 from pipe failed -- expected '$exp', got '$b'" +#(print -n a;sleep 1; print -n bcde) | read -n3 a +#exp=a +#[[ $a == $exp ]] || err_exit "read -n3 from pipe failed -- expected '$exp', got '$a'" +#rm -f $tmp/fifo +#if mkfifo $tmp/fifo 2> /dev/null +#then (print -n a; sleep 1;print -n bcde) > $tmp/fifo & +# { +# read -u5 -n3 -t2 a || err_exit 'read -n3 from fifo timedout' +# read -u5 -n1 -t2 b || err_exit 'read -n1 from fifo timedout' +# } 5< $tmp/fifo +# exp=a +# [[ $a == $exp ]] || err_exit "read -n3 from fifo failed -- expected '$exp', got '$a'" +# rm -f $tmp/fifo +# mkfifo $tmp/fifo 2> /dev/null +# (print -n a; sleep 1;print -n bcde) > $tmp/fifo & +# { +# read -u5 -N3 -t2 a || err_exit 'read -N3 from fifo timed out' +# read -u5 -N1 -t2 b || err_exit 'read -N1 from fifo timedout' +# } 5< $tmp/fifo +# exp=abc +# [[ $a == $exp ]] || err_exit "read -N3 from fifo failed -- expected '$exp', got '$a'" +# exp=d +# [[ $b == $exp ]] || err_exit "read -N1 from fifo failed -- expected '$exp', got '$b'" +#fi +#rm -f $tmp/fifo + function longline { integer i @@ -437,33 +486,43 @@ getconf UNIVERSE - ucb [[ $($SHELL -c 'echo -3') == -3 ]] || err_exit "echo -3 not working in ucb universe" typeset -F3 start_x=SECONDS total_t delay=0.02 typeset reps=50 leeway=5 -sleep $(( 2 * leeway * reps * delay )) | -for (( i=0 ; i < reps ; i++ )) -do read -N1 -t $delay -done -(( total_t = SECONDS - start_x )) -if (( total_t > leeway * reps * delay )) -then err_exit "read -t in pipe taking $total_t secs - $(( reps * delay )) minimum - too long" -elif (( total_t < reps * delay )) -then err_exit "read -t in pipe taking $total_t secs - $(( reps * delay )) minimum - too fast" -fi -$SHELL -c 'sleep $(printf "%a" .95)' 2> /dev/null || err_exit "sleep doesn't except %a format constants" -$SHELL -c 'test \( ! -e \)' 2> /dev/null ; [[ $? == 1 ]] || err_exit 'test \( ! -e \) not working' +#sleep $(( 2 * leeway * reps * delay )) | +#for (( i=0 ; i < reps ; i++ )) +#do read -N1 -t $delay +#done +#(( total_t = SECONDS - start_x )) +#if (( total_t > leeway * reps * delay )) +#then err_exit "read -t in pipe taking $total_t secs - $(( reps * delay )) minimum - too long" +#elif (( total_t < reps * delay )) +#then err_exit "read -t in pipe taking $total_t secs - $(( reps * delay )) minimum - too fast" +#fi +#$SHELL -c 'sleep $(printf "%a" .95)' 2> /dev/null || err_exit "sleep doesn't except %a format constants" +#$SHELL -c 'test \( ! -e \)' 2> /dev/null ; [[ $? == 1 ]] || err_exit 'test \( ! -e \) not working' [[ $(ulimit) == "$(ulimit -fS)" ]] || err_exit 'ulimit is not the same as ulimit -fS' -tmpfile=${TMP-/tmp}/ksh$$.2 -trap 'rm -f /tmp/ksh$$ "$tmpfile"' EXIT +tmpfile=$tmp/file.2 print $'\nprint -r -- "${.sh.file} ${LINENO} ${.sh.lineno}"' > $tmpfile [[ $( . "$tmpfile") == "$tmpfile 2 1" ]] || err_exit 'dot command not working' print -r -- "'xxx" > $tmpfile [[ $($SHELL -c ". $tmpfile"$'\n print ok' 2> /dev/null) == ok ]] || err_exit 'syntax error in dot command affects next command' -float sec=$SECONDS del=4 -exec 3>&2 2>/dev/null -$SHELL -c "( sleep 1; kill -ALRM \$\$ ) & sleep $del" 2> /dev/null -exitval=$? -(( sec = SECONDS - sec )) -exec 2>&3- -(( exitval )) && err_exit "sleep doesn't exit 0 with ALRM interupt" -(( sec > (del - 1) )) || err_exit "ALRM signal causes sleep to terminate prematurely -- expected 3 sec, got $sec" +#float sec=$SECONDS del=4 +#exec 3>&2 2>/dev/null +#$SHELL -c "( sleep 1; kill -ALRM \$\$ ) & sleep $del" 2> /dev/null +#exitval=$? +#(( sec = SECONDS - sec )) +#exec 2>&3- +#(( exitval )) && err_exit "sleep doesn't exit 0 with ALRM interupt" +#(( sec > (del - 1) )) || err_exit "ALRM signal causes sleep to terminate prematurely -- expected 3 sec, got $sec" +typeset -r z=3 +y=5 +for i in 123 z %x a.b.c +do ( unset $i) 2>/dev/null && err_exit "unset $i should fail" +done +a=() +for i in y y y[8] t[abc] y.d a.b a +do unset $i || print -u2 "err_exit unset $i should not fail" +done +[[ $($SHELL -c 'y=3; unset 123 y;print $?$y') == 1 ]] 2> /dev/null || err_exit 'y is not getting unset with unset 123 y' +[[ $($SHELL -c 'trap foo TERM; (trap;(trap) )') == 'trap -- foo TERM' ]] || err_exit 'traps not getting reset when subshell is last process' exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/case.sh b/usr/src/lib/libshell/common/tests/case.sh index cca84686bd..1f04cfd30d 100644 --- a/usr/src/lib/libshell/common/tests/case.sh +++ b/usr/src/lib/libshell/common/tests/case.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libshell/common/tests/comvar.sh b/usr/src/lib/libshell/common/tests/comvar.sh index dfc9d9acfd..00eac1d188 100644 --- a/usr/src/lib/libshell/common/tests/comvar.sh +++ b/usr/src/lib/libshell/common/tests/comvar.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -85,7 +85,7 @@ foo=(integer x=3) if [[ ${foo} != *x=3* ]] then err_exit "compound variable with integer subvariable not working" fi -$SHELL -c $'x=(foo=bar)\n[[ x == x ]]' 2> /dev/null || +$SHELL -c $'x=(foo=bar)\n[[ x == x ]]' 2> /dev/null || err_exit '[[ ... ]] not working after compound assignment' unset foo [[ ${!foo.@} ]] && err_exit 'unset compound variable leaves subvariables' @@ -194,7 +194,7 @@ localvar [[ $($SHELL -c 'foo=();foo.[x]=(y z); print ${foo.x[@]}') == 'y z' ]] 2> /dev/null || err_exit 'foo=( [x]=(y z) not working' function staticvar { - if [[ $1 ]] + if [[ $1 ]] then print -r -- "$point" return fi @@ -291,7 +291,7 @@ foo=( ) eval foo2="$foo" foo2.hello=notok foo2.yes.yex=no foo2.extra=yes. -typeset -C bar bam +typeset -C bar bam { read -Cu3 bar read -Cu3 bam @@ -422,5 +422,120 @@ data.samples+=( command2="grrrr2" ) -[[ $data == %(()) ]] || err_exit "unbalanced parenthesis with compound variable containing array of compound variables" +[[ $data == %(()) ]] || err_exit "unbalanced parenthesis with compound variable containing array of compound variables" +typeset -C -A hello=( [foo]=bar) +[[ $(typeset -p hello) == 'typeset -C -A hello=([foo]=bar)' ]] || err_exit 'typeset -A -C with intial assignment not working' +# this caused a core dump before ksh93t+ +[[ $($SHELL -c 'foo=(x=3 y=4);function bar { typeset z=4;: $z;};bar;print ${!foo.@}') == 'foo.x foo.y' ]] 2> /dev/null || err_exit '${!foo.@} after function not working' + +function foo +{ + typeset tmp + read -C tmp + read -C tmp +} +foo 2> /dev/null <<- \EOF || err_exit 'deleting compound variable in function failed' + ( + typeset -A myarray3=( + [a]=( foo=bar) + [b]=( foo=bar) + [c d]=( foo=bar) + [e]=( foo=bar) + [f]=( foo=bar) + [g]=( foo=bar) + [h]=( foo=bar) + [i]=( foo=bar) + [j]=( foo=bar) + ) + ) + hello +EOF + +typeset -C -a mica01 +mica01[4]=( a_string="foo bar" ) +typeset -C more_content=( + some_stuff="hello" +) +mica01[4]+=more_content +expected=$'typeset -C -a mica01=([4]=(a_string=\'foo bar\';some_stuff=hello;))' +[[ $(typeset -p mica01) == "$expected" ]] || err_exit 'appened to indexed array compound variable not working' + +unset x +compound x=( integer x ; ) +[[ ! -v x.x ]] && err_exit 'x.x should be set' +expected=$'(\n\ttypeset -l -i x=0\n)' +[[ $(print -v x) == "$expected" ]] || err_exit "'print -v x' should be $expected" + +typeset -C -A hello19=( + [19]=( + one="xone 19" + two="xtwo 19" + ) + [23]=( + one="xone 23" + two="xtwo 23" + ) +) +expected="typeset -C -A hello19=([19]=(one='xone 19';two='xtwo 19';) [23]=(one='xone 23';two='xtwo 23';))" +[[ $(typeset -p hello19) == "$expected" ]] || print -u2 'typeset -p hello19 incorrect' +expected=$'(\n\tone=\'xone 19\'\n\ttwo=\'xtwo 19\'\n) (\n\tone=\'xone 23\'\n\ttwo=\'xtwo 23\'\n)' +[[ ${hello19[@]} == "$expected" ]] || print -u2 '${hello19[@]} incorrect' + +typeset -C -A foo1=( abc="alphabet" ) foo2=( abc="alphabet" ) +function add_one +{ + nameref left_op=$1 + typeset -C info + info.hello="world" + nameref x=info + left_op+=x +} +nameref node1="foo1[1234]" +add_one "node1" +add_one "foo2[1234]" +[[ "${foo1[1234]}" == "${foo2[1234]}" ]] || err_exit "test failed\n$(diff -u <( print -r -- "${foo1[1234]}") <(print -r -- "${foo2[1234]}"))." + +typeset -C tree +function f1 +{ + nameref tr=$1 + typeset -A tr.subtree + typeset -C node + node.one="hello" + node.two="world" + + # move local note into the array + typeset -m tr.subtree["a_node"]=node +} +f1 tree +expected=$'(\n\ttypeset -A subtree=(\n\t\t[a_node]=(\n\t\t\tone=hello\n\t\t\ttwo=world\n\t\t)\n\t)\n)' +[[ $tree == "$expected" ]] || err_exit 'move of compound local variable to global variable not working' + +typeset -C -A array +float array[12].amount=2.9 +expected='typeset -C -A array=([12]=(typeset -l -E amount=2.9;))' +[[ $(typeset -p array) == "$expected" ]] || err_exit 'typeset with compound variable with compound variable array not working' + +typeset -T foo_t=( + function diff + { + print 1.0 + return 0 + } +) +foo_t sw +compound output=( + integer one=1 + float mydiff=sw.diff + float end=.314 +) +[[ $output == *end=* ]] || err_exit "The field 'name' end is missing" + +compound cpv1=( integer f=2 ) +compound x=( + integer a=1 + compound b=cpv1 +) +[[ $x == *f=2* ]] || err_exit "The field b containg 'f=2' is missing" + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/coprocess.sh b/usr/src/lib/libshell/common/tests/coprocess.sh index feff0bace2..dde9a49805 100644 --- a/usr/src/lib/libshell/common/tests/coprocess.sh +++ b/usr/src/lib/libshell/common/tests/coprocess.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -29,6 +29,9 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + if [[ -d /cygdrive ]] then err_exit cygwin detected - coprocess tests disabled - enable at the risk of wedging your system exit $((Errors)) @@ -46,11 +49,11 @@ function ping # id cat |& print -p "hello" read -p line -[[ $line == hello ]] || err_exit 'coprocessing fails' +[[ $line == hello ]] || err_exit 'coprocessing fails' exec 5>&p 6<&p print -u5 'hello again' || err_exit 'write on u5 fails' read -u6 line -[[ $line == 'hello again' ]] || err_exit 'coprocess after moving fds fails' +[[ $line == 'hello again' ]] || err_exit 'coprocess after moving fds fails' exec 5<&- 6<&- wait $! @@ -87,8 +90,7 @@ do (( count-- )) done kill $(jobs -p) 2>/dev/null -file=/tmp/regress$$ -trap "rm -f $file" EXIT +file=$tmp/regress cat > $file <<\! /bin/cat |& ! @@ -100,15 +102,24 @@ exec 5<&- 6>&- kill $(jobs -p) 2>/dev/null ${SHELL-ksh} |& -print -p $'print hello | cat\nprint Done' +cop=$! +exp=Done +print -p $'print hello | cat\nprint '$exp read -t 5 -p read -t 5 -p -if [[ $REPLY != Done ]] -then err_exit "${SHELL-ksh} coprocess not working" +got=$REPLY +if [[ $got != $exp ]] +then err_exit "${SHELL-ksh} coprocess io failed -- got '$got', expected '$exp'" fi exec 5<&p 6>&p exec 5<&- 6>&- -wait $! +{ sleep 4; kill $cop; } 2>/dev/null & +spy=$! +if wait $cop 2>/dev/null +then kill $spy 2>/dev/null +else err_exit "coprocess hung after 'exec 5<&p 6>&p; exec 5<&- 6>&-'" +fi +wait { echo line1 | grep 'line2' @@ -123,7 +134,7 @@ then err_exit "read -p hanging (SECONDS=$SECONDS count=$count)" fi wait $! -( sleep 3 |& sleep 1 && kill $!; sleep 1; sleep 3 |& sleep 1 && kill $! ) || +( sleep 3 |& sleep 1 && kill $!; sleep 1; sleep 3 |& sleep 1 && kill $! ) || err_exit "coprocess cleanup not working correctly" { : |& } 2>/dev/null || err_exit "subshell coprocess lingers in parent" @@ -163,7 +174,7 @@ r= print -u6 ok exec 6>&- sleep 1 - kill $! 2> /dev/null + kill $! 2> /dev/null ) && err_exit 'coprocess with subshell would hang' for sig in IOT ABRT do if ( trap - $sig ) 2> /dev/null @@ -178,7 +189,7 @@ do if ( trap - $sig ) 2> /dev/null kill -$sig $$ kill $pid sleep 2 - kill $$ + kill $$ ) & read -p ++EOF++ @@ -206,7 +217,7 @@ trap - TERM trap 'sleep_pid=; kill $pid; err_exit "coprocess 2 hung"' TERM { sleep 5; kill $$; } & sleep_pid=$! -cat |& +cat |& pid=$! print foo >&p 2> /dev/null || err_exit 'first write of foo to coprocess failed' print foo >&p 2> /dev/null || err_exit 'second write of foo to coprocess failed' @@ -218,7 +229,7 @@ trap - TERM trap 'sleep_pid=; kill $pid; err_exit "coprocess 3 hung"' TERM { sleep 5; kill $$; } & sleep_pid=$! -cat |& +cat |& pid=$! print -p foo print -p bar @@ -231,4 +242,72 @@ wait $pid 2> /dev/null trap - TERM [[ $sleep_pid ]] && kill $sleep_pid +exp=ksh +got=$(print -r $'#00315 +COATTRIBUTES=\'label=make \' +# @(#)$Id: libcoshell (AT&T Research) 2008-04-28 $ +_COSHELL_msgfd=5 +{ { (eval \'function fun { trap \":\" 0; return 1; }; trap \"exit 0\" 0; fun; exit 1\') && PATH= print -u$_COSHELL_msgfd ksh; } || { times && echo bsh >&$_COSHELL_msgfd; } || { echo osh >&$_COSHELL_msgfd; }; } >/dev/null 2>&1' | $SHELL 5>&1) +[[ $got == $exp ]] || err_exit "coshell(3) identification sequence failed -- expected '$exp', got '$got'" + +function cop +{ + read + print ok +} + +exp=ok + +cop |& +pid=$! +if print -p yo 2>/dev/null +then read -p got +else got='no coprocess' +fi +[[ $got == $exp ]] || err_exit "main coprocess main query failed -- expected $exp, got '$got'" +kill $pid 2>/dev/null +wait + +cop |& +pid=$! +( +if print -p yo 2>/dev/null +then read -p got +else got='no coprocess' +fi +[[ $got == $exp ]] || err_exit "main coprocess subshell query failed -- expected $exp, got '$got'" +) +kill $pid 2>/dev/null +wait + +exp='no coprocess' + +( +cop |& +print $! > $tmp/pid +) +pid=$(<$tmp/pid) +if print -p yo 2>/dev/null +then read -p got +else got=$exp +fi +[[ $got == $exp ]] || err_exit "subshell coprocess main query failed -- expected $exp, got '$got'" +kill $pid 2>/dev/null +wait + +( +cop |& +print $! > $tmp/pid +) +pid=$(<$tmp/pid) +( +if print -p yo 2>/dev/null +then read -p got +else got=$exp +fi +[[ $got == $exp ]] || err_exit "subshell coprocess subshell query failed -- expected $exp, got '$got'" +kill $pid 2>/dev/null +wait +) + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/cubetype.sh b/usr/src/lib/libshell/common/tests/cubetype.sh index f3597d258d..4a718d4a38 100644 --- a/usr/src/lib/libshell/common/tests/cubetype.sh +++ b/usr/src/lib/libshell/common/tests/cubetype.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -120,7 +120,7 @@ typeset -T Cube_t=( for ((i=0; i < n; i++)) do Box_t b=(name=box2) -[[ ${b.name} == box2 ]] || err_exit "\${b.name} incorrect -- expected box2, got '${b.name}'" +[[ ${b.name} == box2 ]] || err_exit "\${b.name} incorrect -- expected box2, got '${b.name}'" (( b.len == 5 )) || err_exit "b.len incorrect for box2 -- expected 5, got '$(( b.len ))'" (( b.count == 1 )) || err_exit "b.count incorrect -- expected 1, got '$(( b.count ))'" Cube_t c=(name=cube1) @@ -134,7 +134,7 @@ Cube_t c=(name=cube1) (( c.count == 2 )) || err_exit 'c.count != 2' (( c.count == b.count )) || err_exit 'c.count != b.count' c.count=0 -Cube_t d=c +Cube_t d=c [[ $d == "$c" ]] || err_exit '$d != $c' eval "Cube_t zzz=$c" [[ $zzz == "$c" ]] || err_exit '$zzz != $c' @@ -149,6 +149,7 @@ for ((i=0; i < n; i++)) do Cube_t cc cc[2]=(x=2 y=3 name=two colors+=([table]=white) items+=(pencil) z=6) +[[ ${cc[0].x} == 8 ]] || err_exit 'cc[0].x !=8' [[ ${cc[2].y} == 3 ]] || err_exit '${cc[2].y} != 3' (( cc[2].y == 3 )) || err_exit '(( cc[2].y != 3))' [[ ${cc[2].colors[table]} == white ]] || err_exit '${cc[2].colors[table]} != white' @@ -162,7 +163,7 @@ unset cc[2].x cc[2].y cc[2].z (( cc[2].len == cc.len )) || err_exit 'cc[2].len != cc.len' (( cc[2].count == 6 )) || err_exit 'cc[2].count != 6' unset cc[2].name cc[2].colors cc[2].items -[[ $cc == "${cc[2]}" ]] || err_exit '$cc != ${cc[2]}' +[[ $cc == "${cc[2]}" ]] || err_exit '$cc != ${cc[2]}' cc.count=0 unset cc Cube_t -A cc @@ -181,7 +182,7 @@ unset cc[two].x cc[two].y cc[two].z (( cc[two].len == cc[one].len )) || err_exit 'cc[two].len != cc[one].len' (( cc[two].count == 4 )) || err_exit 'cc[two].count != 4' unset cc[two].name unset cc[two].colors cc[two].items -[[ ${cc[one]} == "${cc[two]}" ]] || err_exit '${cc[one]} != ${cc[two]}' +[[ ${cc[one]} == "${cc[two]}" ]] || err_exit '${cc[one]} != ${cc[two]}' cc[two].count=0 unset cc Cube_t cc=( diff --git a/usr/src/lib/libshell/common/tests/enum.sh b/usr/src/lib/libshell/common/tests/enum.sh index 35d2a27952..1929472bb5 100644 --- a/usr/src/lib/libshell/common/tests/enum.sh +++ b/usr/src/lib/libshell/common/tests/enum.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -43,8 +43,8 @@ x[2]=green [[ $x == orange ]] || err_exit '$x is no longer orange' Color_t -A y y[foo]=yellow -[[ ${y[foo]} == yellow ]] || err_exit '${y[foo]} != yellow' -(( y[foo] == 4 )) || err_exit '(( y[foo] != 4))' +[[ ${y[foo]} == yellow ]] || err_exit '${y[foo]} != yellow' +(( y[foo] == 4 )) || err_exit '(( y[foo] != 4))' unset y typeset -a [Color_t] z z[green]=xyz diff --git a/usr/src/lib/libshell/common/tests/exit.sh b/usr/src/lib/libshell/common/tests/exit.sh index 01c407bf18..a14b0dcbec 100644 --- a/usr/src/lib/libshell/common/tests/exit.sh +++ b/usr/src/lib/libshell/common/tests/exit.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -25,6 +25,12 @@ function err_exit } alias err_exit='err_exit $LINENO' +Command=${0##*/} +integer Errors=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + function abspath { base=$(basename $SHELL) @@ -34,28 +40,20 @@ function abspath print $newdir/$base } #test for proper exit of shell -Command=${0##*/} -integer Errors=0 builtin getconf ABSHELL=$(abspath) -mkdir /tmp/ksh$$ || err_exit "mkdir /tmp/ksh$$ failed" -cd /tmp/ksh$$ || err_exit "cd /tmp/ksh$$ failed" +cd $tmp || { err_exit "cd $tmp failed"; exit 1; } print exit 0 >.profile ${ABSHELL} <<! HOME=$PWD \ PATH=$PATH \ SHELL=$ABSSHELL \ $( - set --noglob - ifs=$IFS - IFS=, - set -- $(getconf LIBPATH) - IFS=$ifs - for v - do IFS=: - set -- $v - IFS=$ifs - eval [[ \$$2 ]] && eval print -n \" \"\$2=\"\$$2\" + v=$(getconf LIBPATH) + for v in ${v//,/ } + do v=${v#*:} + v=${v%%:*} + eval [[ \$$v ]] && eval print -n \" \"\$v=\"\$$v\" done ) \ exec -c -a -ksh ${ABSHELL} -c "exit 1" 1>/dev/null 2>&1 @@ -77,6 +75,6 @@ if [[ $($SHELL ./run.sh) != 123 ]] then err_exit 'subshell trap on exit overwrites parent trap' fi cd ~- || err_exit "cd back failed" -rm -r /tmp/ksh$$ || err_exit "rm -r /tmp/ksh$$ failed" $SHELL -c 'builtin -f cmd getconf; getconf --"?-version"; exit 0' >/dev/null 2>&1 || err_exit 'ksh plugin exit failed -- was ksh built with CCFLAGS+=$(CC.EXPORT.DYNAMIC)?' + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/expand.sh b/usr/src/lib/libshell/common/tests/expand.sh index 5dd46bdd8f..c63e7eb3e2 100644 --- a/usr/src/lib/libshell/common/tests/expand.sh +++ b/usr/src/lib/libshell/common/tests/expand.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libshell/common/tests/functions.sh b/usr/src/lib/libshell/common/tests/functions.sh index 0eaa17c688..146b537743 100644 --- a/usr/src/lib/libshell/common/tests/functions.sh +++ b/usr/src/lib/libshell/common/tests/functions.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -28,12 +28,10 @@ alias err_exit='err_exit $LINENO' integer Errors=0 Command=${0##*/} -tmp=/tmp/kshtf$$ -function cleanup -{ - rm -rf $tmp -} -mkdir $tmp || err_exit "mkdir $tmp failed" +ulimit -c 0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT integer foo=33 bar=bye @@ -89,11 +87,11 @@ function foobar { (return 0) } -> $tmp/shtests$$.1 +> $tmp/test1 { foobar -if [ -r $tmp/shtests$$.1 ] -then rm -r $tmp/shtests$$.1 +if [ -r $tmp/test1 ] +then rm -r $tmp/test1 else err_exit 'return within subshell inside function error' fi } @@ -138,37 +136,36 @@ fun() /bin/echo hello if [[ $(fun) != hello ]] then err_exit one line functions not working fi -trap cleanup EXIT -cat > $tmp/script$$ <<-\! +cat > $tmp/script <<-\! print -r -- "$1" ! -chmod +x $tmp/script$$ +chmod +x $tmp/script function passargs { - $tmp/script$$ "$@" + $tmp/script "$@" } if [[ $(passargs one) != one ]] then err_exit 'passing args from functions to scripts not working' fi -cat > $tmp/script$$ <<-\! +cat > $tmp/script <<-\! trap 'exit 0' EXIT function foo { - /tmp > /dev/null 2>&1 + /tmp > /dev/null 2>&1 } foo ! -if ! $tmp/script$$ -then err_exit 'exit trap incorrectly triggered' +if ! $tmp/script +then err_exit 'exit trap incorrectly triggered' fi -if ! $SHELL -c $tmp/script$$ -then err_exit 'exit trap incorrectly triggered when invoked with -c' +if ! $SHELL -c $tmp/script +then err_exit 'exit trap incorrectly triggered when invoked with -c' fi -$SHELL -c "trap 'rm $tmp/script$$' EXIT" -if [[ -f $tmp/script$$ ]] -then err_exit 'exit trap not triggered when invoked with -c' +$SHELL -c "trap 'rm $tmp/script' EXIT" +if [[ -f $tmp/script ]] +then err_exit 'exit trap not triggered when invoked with -c' fi -cat > $tmp/script$$ <<- \EOF +cat > $tmp/script <<- \EOF foobar() { return @@ -177,8 +174,8 @@ cat > $tmp/script$$ <<- \EOF foobar print -r -- "$1" EOF -chmod +x $tmp/script$$ -if [[ $( $SHELL $tmp/script$$ arg1 arg2) != arg2 ]] +chmod +x $tmp/script +if [[ $( $SHELL $tmp/script arg1 arg2) != arg2 ]] then err_exit 'arguments not restored by posix functions' fi function foo @@ -212,18 +209,17 @@ x=1 if [[ $(foo) != 3 ]] then err_exit 'variable assignment list not using parent scope' fi -unset -f foo$$ -#trap "rm -f $tmp/foo$$" EXIT INT -cat > $tmp/foo$$ <<! -function foo$$ +unset -f foobar +cat > $tmp/foobar <<! +function foobar { print foo } ! -chmod +x $tmp/foo$$ +chmod +x $tmp/foobar FPATH=$tmp -autoload foo$$ -if [[ $(foo$$ 2>/dev/null) != foo ]] +autoload foobar +if [[ $(foobar 2>/dev/null) != foo ]] then err_exit 'autoload not working' fi unset -f foobar @@ -233,14 +229,14 @@ function foobar return 0 } ( foobar ) 2> /dev/null || err_exit "cannot unset readonly variable in function" -if $SHELL -n 2> /dev/null <<-! +if $SHELL -n 2> /dev/null <<-! abc() ! then err_exit 'abc() without a function body is not a syntax error' fi function winpath { - usage='q pathname ...' + usage='q pathname ...' typeset var format=s while getopts "$usage" var do case $var in @@ -296,7 +292,7 @@ then err_exit 'set -e not inherited for posix functions' fi trap - ERR -function myexport +function myexport { nameref var=$1 if (( $# > 1 )) @@ -309,7 +305,6 @@ function myexport typeset val val=$(export | grep "^$1=") print ${val#"$1="} - } export dgk=base val=$(myexport dgk fun) @@ -384,8 +379,26 @@ function closure return $r } closure 0 || err_exit -u2 'for loop function optimization bug2' -mkdir $tmp/ksh$$ || err_exit "mkdir $tmp/ksh$$ failed" -cd $tmp/ksh$$ || err_exit "cd $tmp/ksh$$ failed" +dir=$tmp/dir +mkdir $dir +cd $dir || { err_exit "cd $dir failed"; exit 1; } + +( + function a { + print a + } + function b { + print 1 + a + print 2 + } > /dev/null + typeset -ft a b + PS4=X + b +) > file 2>&1 +[[ $(<file) == *'Xprint 2'* ]] || err_exit 'function trace disabled by function call' +rm -f file + print 'false' > try chmod +x try cat > tst <<- EOF @@ -400,18 +413,19 @@ EOF if [[ $($SHELL < tst) == error ]] then err_exit 'ERR trap not cleared' fi -FPATH=$tmp/ksh$$ -print ': This does nothing' > $tmp/ksh$$/foobar -chmod +x $tmp/ksh$$/foobar -unset -f foobar -{ foobar;} 2> /dev/null -if [[ $? != 126 ]] -then err_exit 'function file without function definition processes wrong error' +FPATH=$dir +print ': This does nothing' > foobar +chmod +x foobar +unset -f foobar +{ foobar; } 2>/dev/null +got=$? +exp=126 +if [[ $got != $exp ]] +then err_exit "function file without function definition processes wrong error -- expected '$exp', got '$got'" fi -print 'set a b c' > dotscript +print 'set a b c' > dotscript [[ $(PATH=$PATH: $SHELL -c '. dotscript;print $#') == 3 ]] || err_exit 'positional parameters not preserved with . script without arguments' cd ~- || err_exit "cd back failed" -cd /; rm -r $tmp/ksh$$ || err_exit "rm -r $tmp/ksh$$ failed" function errcheck { trap 'print ERR; return 1' ERR @@ -439,7 +453,7 @@ a() b() { : ;} [[ $(a) == a ]] || err_exit '.sh.fun not set correctly in a function' print $'a(){\ndate\n}' | $SHELL 2> /dev/null || err_exit 'parser error in a(){;date;}' -cat > $tmp/data$$.1 << '++EOF' +cat > $tmp/data1 << '++EOF' 1 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 2 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 3 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @@ -461,7 +475,7 @@ cat > $tmp/data$$.1 << '++EOF' 19 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 20 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ++EOF -cat > $tmp/script$$ << '++EOF' +cat > $tmp/script << '++EOF' # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @@ -727,10 +741,10 @@ f() { cat <<\M ++EOF -cat $tmp/data$$.1 >> $tmp/script$$ -printf 'M\n}\n\nf\n\n' >> $tmp/script$$ -$SHELL -c $tmp/script$$ > $tmp/data$$.2 -cmp -s $tmp/data$$.[12] || err_exit 'error with long functions' +cat $tmp/data1 >> $tmp/script +printf 'M\n}\n\nf\n\n' >> $tmp/script +$SHELL -c $tmp/script > $tmp/data2 +cmp -s $tmp/data[12] || err_exit 'error with long functions' v=1 function f { @@ -776,7 +790,7 @@ x=$( integer count=0 function err_f { - if ((count++==3)) + if ((count++==3)) then print failed else false fi @@ -785,7 +799,6 @@ x=$( false ) [[ $x == failed ]] && err_exit 'ERR trap executed multiple times' -trap cleanup EXIT export environment typeset global function f @@ -819,17 +832,17 @@ function f } f local global environment literal positional $SHELL -c ' - print exit 0 > '$tmp'/script$$ - chmod +x '$tmp'/script$$ + print exit 0 > '$tmp'/script + chmod +x '$tmp'/script unset var var=( ident=1 ) function fun { - PATH='$tmp' script$$ + PATH='$tmp' script } fun ' || err_exit "compound variable cleanup before script exec failed" -( $SHELL << \++EOF++ +( $SHELL << \++EOF++ function main { typeset key @@ -921,10 +934,7 @@ unset -f .sh.fun.set # tests for debug functions basefile=${.sh.file} integer baseline -cleanup -trap 'rm $tmp' EXIT -tmp=${TMPDIR:-/tmp}/ksh$$.1 -cat > $tmp << \+++ +cat > $tmp/debug << \+++ : line 1 : line 3 @@ -943,7 +953,7 @@ function _Dbg_print_frame [[ $arg == DEBUG ]] && ((baseline++)) [[ $line == "$baseline" ]] || err_exit "line number for level 0 is $line not $baseline" elif ((pos==1)) - then [[ $filename == "$tmp" ]] || err_exit "filename for level 1 is $filename not $tmp" + then [[ $filename == "$tmp/debug" ]] || err_exit "filename for level 1 is $filename not $tmp/debug" [[ $* == 'foo bar' ]] || err_exit "args are '$*', not 'foo bar'" [[ $line == $arg ]] || err_exit "line number for level 1 is $line not $arg" else err_exit "level should be 0 or 1 but is $pos" @@ -963,9 +973,9 @@ function _Dbg_debug_trap_handler ((baseline=LINENO+2)) trap '_Dbg_debug_trap_handler' DEBUG -. $tmp foo bar +. $tmp/debug foo bar trap '' DEBUG - + caller() { integer .level=.sh.level .max=.sh.level-1 while((--.level>=0)) @@ -978,4 +988,84 @@ bar() { caller;} set -- $(bar) [[ $1 == $2 ]] && err_exit ".sh.inline optimization bug" ( $SHELL -c ' function foo { typeset x=$1;print $1;};z=();z=($(foo bar)) ') 2> /dev/null || err_exit 'using a function to set an array in a command sub fails' + +{ +got=$( +s=$(ulimit -s) +if [[ $s == +([[:digit:]]) ]] && (( s < 16384 )) +then ulimit -s 16384 2>/dev/null +fi +$SHELL << \+++ +f() +{ + if (($1>1)) + then x=$(f $(($1-1))) || exit 1 + fi + return 0 +} +f 257 && print ok ++++ +) +} 2>/dev/null +[[ $got == ok ]] || err_exit 'cannot handle comsub depth > 256 in function' + +tmp1=$tmp/job.1 +tmp2=$tmp/job.2 +cat > $tmp1 << +++ +#! $SHELL +print \$\$ ++++ +chmod +x $tmp1 +function foo +{ + typeset pid + $tmp1 > $tmp2 & pid=$! + wait $! + [[ $(< $tmp2) == $pid ]] || err_exit 'wrong pid for & job in function' +} +foo +# make sure compiled functions work +[[ $(tmp=$tmp $SHELL <<- \++++ + cat > $tmp/functions <<- \EOF + function bar + { + print foo + } + function foobar + { + bar + } + EOF + ${SHCOMP:-${SHELL%/*}/shcomp} $tmp/functions > $tmp/foobar + rm -f "$tmp/functions" + chmod +x $tmp/foobar + rm $tmp/!(dir|foobar) + FPATH=$tmp + PATH=$FPATH:$PATH + foobar +++++ +) == foo ]] > /dev/null || err_exit 'functions compiled with shcomp not working' +# test for functions in shell having side effects. +unset -f foo foobar bar +cd "$tmp" +FPATH=$PWD +PATH=$FPATH:$PATH +cat > foo <<- \EOF + function bar + { + print foobar + } + function foo + { + bar + } +EOF +chmod +x foo +: $(foo) +[[ $(typeset +f) == *foo* ]] && err_exit 'function in subshell leaving side effect of function foo' +unset -f foo bar +: $(foo) +[[ $(typeset +f) == *foo* ]] && err_exit 'function in subshell leaving side effects of function foo after reload' +[[ $(typeset +f) == *bar* ]] && err_exit 'function in subshell leaving side effects of function bar after reload' + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/glob.sh b/usr/src/lib/libshell/common/tests/glob.sh index 2c3ccd09d3..fa22291c96 100644 --- a/usr/src/lib/libshell/common/tests/glob.sh +++ b/usr/src/lib/libshell/common/tests/glob.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -24,7 +24,11 @@ function err_exit } alias err_exit='err_exit $LINENO' -integer aware=0 contrary=0 ignorant=0 +Command=${0##*/} +integer aware=0 contrary=0 errors=0 ignorant=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT function test_glob { @@ -84,17 +88,11 @@ function test_case } alias test_case='test_case $LINENO' -Command=${0##*/} -tmp=/tmp/ksh$$ -integer errors=0 unset undefined export LC_COLLATE=C -mkdir $tmp || err_exit "mkdir $tmp failed" -trap "cd /; rm -rf $tmp" EXIT -cd $tmp || err_exit "cd $tmp failed" -rm -rf * +cd $tmp || { err_exit "cd $tmp failed"; exit 1; } touch B b set -- * diff --git a/usr/src/lib/libshell/common/tests/grep.sh b/usr/src/lib/libshell/common/tests/grep.sh index 82c0e13cac..40a80a07a7 100644 --- a/usr/src/lib/libshell/common/tests/grep.sh +++ b/usr/src/lib/libshell/common/tests/grep.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -28,6 +28,9 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + function grep { # @@ -84,8 +87,7 @@ function grep let tc # set the return value } -trap 'rm -f /tmp/grep$$' EXIT -cat > /tmp/grep$$ <<\! +cat > $tmp/grep <<\! this is a food bar test to see how many lines find both foo and bar. Some line contain foo only, @@ -96,7 +98,7 @@ There should be six lines with foo and bar. There are only two line with out foo but with bar. ! -if (( $(grep -c 'foo*bar' /tmp/grep$$ ) != 6)) +if (( $(grep -c 'foo*bar' $tmp/grep ) != 6)) then err_exit fi exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/heredoc.sh b/usr/src/lib/libshell/common/tests/heredoc.sh index aadc9cdeec..7b3c923bf0 100644 --- a/usr/src/lib/libshell/common/tests/heredoc.sh +++ b/usr/src/lib/libshell/common/tests/heredoc.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -27,9 +27,12 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 -f=/tmp/here1$$ -g=/tmp/here2$$ -trap "rm -f $f $g" EXIT + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + +f=$tmp/here1 +g=$tmp/here2 cat > $f <<! hello world ! @@ -143,7 +146,7 @@ abc EOF) != $'#abc\nabc' ]] then err_exit 'comments not preserved in here-documents' fi -cat > "$f" <<- '!!!!' +cat > "$f" <<- '!!!!' builtin cat : << EOF $PWD @@ -173,7 +176,7 @@ chmod 755 "$f" if [[ $($SHELL "$f") != abc ]] then err_exit 'here document descritor was closed' fi -cat > "$f" <<- '!!!!' +cat > "$f" <<- '!!!!' exec 0<&- foobar() { @@ -207,9 +210,9 @@ if [[ $($SHELL "$f") != foobar ]] then err_exit 'here document with stdin closed failed' fi printf $'cat <<# \\!!!\n\thello\n\t\tworld\n!!!' > $f -[[ $($SHELL "$f") == $'hello\n\tworld' ]] || err_exit "<<# not working for quoted here documents" +[[ $($SHELL "$f") == $'hello\n\tworld' ]] || err_exit "<<# not working for quoted here documents" printf $'w=world;cat <<# !!!\n\thello\n\t\t$w\n!!!' > $f -[[ $($SHELL "$f") == $'hello\n\tworld' ]] || err_exit "<<# not working for non-quoted here documents" +[[ $($SHELL "$f") == $'hello\n\tworld' ]] || err_exit "<<# not working for non-quoted here documents" [[ $( $SHELL <<- \++++ S=( typeset a ) function S.a.get @@ -226,4 +229,27 @@ printf $'w=world;cat <<# !!!\n\thello\n\t\t$w\n!!!' > $f ${ g;} EOF ' 2> /dev/null) == ok ]] || err_exit '${ command;} not working in heredoc' +script=$f +{ +for ((i=0; i < 406; i++)) +do print ': 23456789012345678' +done +print : 123456789123 +cat <<- \EOF +eval "$( + { cat ; } <<MARKER + print hello + MARKER +)" +EOF +} > $script +chmod +x $script +[[ $($SHELL $script) == hello ]] 2> /dev/null || err_exit 'heredoc embeded in command substitution fails at buffer boundary' + +got=$( cat << EOF +\ +abc +EOF) +[[ $got == abc ]] || err_exit 'line continuation at start of buffer not working' + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/io.sh b/usr/src/lib/libshell/common/tests/io.sh index a8b1b8a030..3468fe9429 100644 --- a/usr/src/lib/libshell/common/tests/io.sh +++ b/usr/src/lib/libshell/common/tests/io.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -28,29 +28,29 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + unset HISTFILE function fun { - while command exec 3>&1 - do break + while command exec 3>&1 + do break done 2> /dev/null print -u3 good } -print 'read -r a;print -r -u$1 -- "$a"' > /tmp/mycat$$ -chmod 755 /tmp/mycat$$ +print 'read -r a;print -r -u$1 -- "$a"' > $tmp/mycat +chmod 755 $tmp/mycat for ((i=3; i < 10; i++)) do - eval "a=\$(print foo | /tmp/mycat$$" $i $i'>&1 > /dev/null |cat)' 2> /dev/null + eval "a=\$(print foo | $tmp/mycat" $i $i'>&1 > /dev/null |cat)' 2> /dev/null [[ $a == foo ]] || err_exit "bad file descriptor $i in comsub script" done -rm -f /tmp/mycat$$ exec 3> /dev/null [[ $(fun) == good ]] || err_exit 'file 3 closed before subshell completes' exec 3>&- -mkdir /tmp/ksh$$ || err_exit "mkdir /tmp/ksh$$ failed" -trap 'rm -rf /tmp/ksh$$' EXIT -cd /tmp/ksh$$ || err_exit "cd /tmp/ksh$$ failed" +cd $tmp || { err_exit "cd $tmp failed"; exit ; } print foo > file1 print bar >> file1 if [[ $(<file1) != $'foo\nbar' ]] @@ -59,19 +59,55 @@ fi set -o noclobber exec 3<> file1 read -u3 line -if [[ $line != foo ]] -then err_exit '<> not working right with read' +exp=foo +if [[ $line != $exp ]] +then err_exit "read on <> fd failed -- expected '$exp', got '$line'" fi if ( 4> file1 ) 2> /dev/null then err_exit 'noclobber not causing exclusive open' fi set +o noclobber -if command exec 4< /dev/fd/3 -then read -u4 line - if [[ $line != bar ]] - then '4< /dev/fd/3 not working correctly' - fi + +FDFS=( + ( dir=/proc/self/fd semantics='open' ) + ( dir=/proc/$$/fd semantics='open' ) + ( dir=/dev/fd semantics='open|dup' ) + ( dir=/dev/fd semantics='dup' ) +) +for ((fdfs=0; fdfs<${#FDFS[@]}-1; fdfs++)) +do [[ -e ${FDFS[fdfs].dir} ]] && { command : > ${FDFS[fdfs].dir}/1; } 2>/dev/null && break +done + +exec 3<> file1 +if command exec 4< ${FDFS[fdfs].dir}/3 +then read -u3 got + read -u4 got + exp='foo|bar' + case $got in + foo) semantics='open' ;; + bar) semantics='dup' ;; + *) semantics='failed' ;; + esac + [[ $semantics == @(${FDFS[fdfs].semantics}) ]] || err_exit "'4< ${FDFS[fdfs].dir}/3' $semantics semantics instead of ${FDFS[fdfs].semantics} -- expected '$exp', got '$got'" fi + +# 2004-11-25 ancient /dev/fd/N redirection bug fix +got=$( + { + print -n 1 + print -n 2 > ${FDFS[fdfs].dir}/2 + print -n 3 + print -n 4 > ${FDFS[fdfs].dir}/2 + } 2>&1 +) +exp='1234|4' +case $got in +1234) semantics='dup' ;; +4) semantics='open' ;; +*) semantics='failed' ;; +esac +[[ $semantics == @(${FDFS[fdfs].semantics}) ]] || err_exit "${FDFS[fdfs].dir}/N $semantics semantics instead of ${FDFS[fdfs].semantics} -- expected '$exp', got '$got'" + cat > close0 <<\! exec 0<&- echo $(./close1) @@ -91,15 +127,15 @@ cat > close0 <<\! ! ./close0 2> /dev/null || err_exit "multiple exec 4< /dev/null can fail" $SHELL -c ' - trap "rm -f in$$ out$$" EXIT + trap "rm -f in out" EXIT for ((i = 0; i < 1000; i++)) do print -r -- "This is a test" - done > in$$ - > out$$ - exec 1<> out$$ + done > in + > out + exec 1<> out builtin cat - print -r -- "$(cat in$$)" - cmp -s in$$ out$$' 2> /dev/null + print -r -- "$(<in)" + cmp -s in out' 2> /dev/null [[ $? == 0 ]] || err_exit 'builtin cat truncates files' cat >| script <<-\! print hello @@ -122,7 +158,7 @@ read line if [[ $line != foo ]] then err_exit 'file descriptor not restored after exec in subshell' fi -exec 3>&- 4>&-; cd /; rm -r /tmp/ksh$$ || err_exit "rm -r /tmp/ksh$$ failed" +exec 3>&- 4>&- [[ $( { read -r line;print -r -- "$line" ( @@ -137,37 +173,26 @@ line 2 line 3 !) == $'line 1\nline 2\nline 3' ]] || err_exit 'read error with subshells' # 2004-05-11 bug fix -cat > /tmp/io$$.1 <<- \++EOF++ - script=/tmp/io$$.2 - trap 'rm -f $script' EXIT - exec 9> $script +cat > $tmp/1 <<- ++EOF++ + script=$tmp/2 + trap "rm -f \$script" EXIT + exec 9> \$script for ((i=3; i<9; i++)) - do eval "while read -u$i; do : ;done $i</dev/null" - print -u9 "exec $i< /dev/null" + do eval "while read -u\$i; do : ;done \$i</dev/null" + print -u9 "exec \$i< /dev/null" done for ((i=0; i < 60; i++)) do print -u9 -f "%.80c\n" ' ' done print -u9 'print ok' exec 9<&- - chmod +x $script - $script + chmod +x \$script + \$script ++EOF++ -chmod +x /tmp/io$$.1 -[[ $($SHELL /tmp/io$$.1) == ok ]] || err_exit "parent i/o causes child script to fail" -rm -rf /tmp/io$$.[12] -# 2004-11-25 ancient /dev/fd/NN redirection bug fix -x=$( - { - print -n 1 - print -n 2 > /dev/fd/2 - print -n 3 - print -n 4 > /dev/fd/2 - } 2>&1 -) -[[ $x == "1234" ]] || err_exit "/dev/fd/NN redirection fails to dup" -# 2004-12-20 redirction loss bug fix -cat > /tmp/io$$.1 <<- \++EOF++ +chmod +x $tmp/1 +[[ $($SHELL $tmp/1) == ok ]] || err_exit "parent i/o causes child script to fail" +# 2004-12-20 redirection loss bug fix +cat > $tmp/1 <<- \++EOF++ function a { trap 'print ok' EXIT @@ -175,49 +200,47 @@ cat > /tmp/io$$.1 <<- \++EOF++ } a ++EOF++ -chmod +x /tmp/io$$.1 -[[ $(/tmp/io$$.1) == ok ]] || err_exit "trap on EXIT loses last command redirection" -print > /dev/null {n}> /tmp/io$$.1 -[[ ! -s /tmp/io$$.1 ]] && newio=1 -rm -rf /tmp/io$$.1 -if [[ $newio && $(print hello | while read -u$n; do print $REPLY; done {n}<&0) != hello ]] +chmod +x $tmp/1 +[[ $($tmp/1) == ok ]] || err_exit "trap on EXIT loses last command redirection" +print > /dev/null {n}> $tmp/1 +[[ ! -s $tmp/1 ]] && newio=1 +if [[ $newio && $(print hello | while read -u$n; do print $REPLY; done {n}<&0) != hello ]] then err_exit "{n}<&0 not working with for loop" fi [[ $({ read -r;read -u3 3<&0; print -- "$REPLY" ;} <<! hello world !) == world ]] || err_exit 'I/O not synchronized with <&' -trap 'rm -f /tmp/seek$$; exit $((Errors+1))' EXIT x="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNSPQRSTUVWXYZ1234567890" for ((i=0; i < 62; i++)) do printf "%.39c\n" ${x:i:1} -done > /tmp/seek$$ -if command exec 3<> /tmp/seek$$ +done > $tmp/seek +if command exec 3<> $tmp/seek then (( $(3<#) == 0 )) || err_exit "not at position 0" (( $(3<# ((EOF))) == 40*62 )) || err_exit "not at end-of-file" - command exec 3<# ((40*8)) || err_exit "absolute seek fails" + command exec 3<# ((40*8)) || err_exit "absolute seek fails" read -u3 - [[ $REPLY == +(i) ]] || err_exit "expecting iiii..." + [[ $REPLY == +(i) ]] || err_exit "expected iiii..., got $REPLY" [[ $(3<#) == $(3<# ((CUR)) ) ]] || err_exit '$(3<#)!=$(3<#((CUR)))' command exec 3<# ((CUR+80)) read -u3 - [[ $REPLY == {39}(l) ]] || err_exit "expecting lll..." + [[ $REPLY == {39}(l) ]] || err_exit "expected lll..., got $REPLY" command exec 3<# ((EOF-80)) read -u3 - [[ $REPLY == +(9) ]] || err_exit "expecting 999...; got $REPLY" + [[ $REPLY == +(9) ]] || err_exit "expected 999..., got $REPLY" command exec 3># ((80)) print -u3 -f "%.39c\n" @ command exec 3># ((80)) read -u3 - [[ $REPLY == +(@) ]] || err_exit "expecting @@@..." + [[ $REPLY == +(@) ]] || err_exit "expected @@@..., got $REPLY" read -u3 - [[ $REPLY == +(d) ]] || err_exit "expecting ddd..." + [[ $REPLY == +(d) ]] || err_exit "expected ddd..., got $REPLY" command exec 3># ((EOF)) print -u3 -f "%.39c\n" ^ (( $(3<# ((CUR-0))) == 40*63 )) || err_exit "not at extended end-of-file" - command exec 3<# ((40*62)) + command exec 3<# ((40*62)) read -u3 - [[ $REPLY == +(^) ]] || err_exit "expecting ddd..." + [[ $REPLY == +(^) ]] || err_exit "expected ddd..., got $REPLY" command exec 3<# ((0)) command exec 3<# *jjjj* read -u3 @@ -227,24 +250,22 @@ then (( $(3<#) == 0 )) || err_exit "not at position 0" [[ $REPLY == {39}(l) ]] || err_exit "<## pattern failed to position" command exec 3<# *abc* read -u3 && err_exit "not found pattern not positioning at eof" - cat /tmp/seek$$ | read -r <# *WWW* + cat $tmp/seek | read -r <# *WWW* [[ $REPLY == *WWWWW* ]] || err_exit '<# not working for pipes' - { < /tmp/seek$$ <# ((2358336120)) ;} 2> /dev/null || err_exit 'long seek not working' -else err_exit "/tmp/seek$$: cannot open for reading" + { < $tmp/seek <# ((2358336120)) ;} 2> /dev/null || err_exit 'long seek not working' +else err_exit "$tmp/seek: cannot open for reading" fi command exec 3<&- || 'cannot close 3' for ((i=0; i < 62; i++)) do printf "%.39c\n" ${x:i:1} -done > /tmp/seek$$ -if command exec {n}<> /tmp/seek$$ +done > $tmp/seek +if command exec {n}<> $tmp/seek then { command exec {n}<#((EOF)) ;} 2> /dev/null || err_exit '{n}<# not working' if $SHELL -c '{n}</dev/null' 2> /dev/null then (( $({n}<#) == 40*62)) || err_exit '$({n}<#) not working' else err_exit 'not able to parse {n}</dev/null' fi fi -trap "" EXIT -rm -f /tmp/seek$$ $SHELL -ic ' { print -u2 || exit 2 @@ -258,9 +279,8 @@ $SHELL -ic ' } 3> /dev/null 4> /dev/null 5> /dev/null 6> /dev/null 7> /dev/null 8> /dev/null 9> /dev/null' > /dev/null 2>&1 exitval=$? (( exitval )) && err_exit "print to unit $exitval failed" -trap 'rm -rf /tmp/io.sh$$*' EXIT -$SHELL -c "{ > /tmp/io.sh$$.1 ; date;} >&- 2> /dev/null" > /tmp/io.sh$$.2 -[[ -s /tmp/io.sh$$.1 || -s /tmp/io.sh$$.2 ]] && err_exit 'commands with standard output closed produce output' +$SHELL -c "{ > $tmp/1 ; date;} >&- 2> /dev/null" > $tmp/2 +[[ -s $tmp/1 || -s $tmp/2 ]] && err_exit 'commands with standard output closed produce output' $SHELL -c "$SHELL -c ': 3>&1' 1>&- 2>/dev/null" && err_exit 'closed standard output not passed to subshell' [[ $(cat <<- \EOF | $SHELL do_it_all() @@ -273,12 +293,26 @@ $SHELL -c "$SHELL -c ': 3>&1' 1>&- 2>/dev/null" && err_exit 'closed standard out EOF) == 'hello world' ]] || err_exit 'invalid readahead on stdin' $SHELL -c 'exec 3>; /dev/null' 2> /dev/null && err_exit '>; with exec should be an error' $SHELL -c ': 3>; /dev/null' 2> /dev/null || err_exit '>; not working with at all' -print hello > /tmp/io.sh$$.1 -if ! $SHELL -c "false >; /tmp/io.sh$$.1" 2> /dev/null -then [[ $(</tmp/io.sh$$.1) == hello ]] || err_exit '>; not preserving file on failure' +print hello > $tmp/1 +if ! $SHELL -c "false >; $tmp/1" 2> /dev/null +then [[ $(<$tmp/1) == hello ]] || err_exit '>; not preserving file on failure' fi -if ! $SHELL -c "sed -e 's/hello/hello world/' /tmp/io.sh$$.1" >; /tmp/io.sh$$.1 2> /dev/null -then [[ $(</tmp/io.sh$$.1) == 'hello world' ]] || err_exit '>; not updating file on success' +if ! $SHELL -c "sed -e 's/hello/hello world/' $tmp/1" >; $tmp/1 2> /dev/null +then [[ $(<$tmp/1) == 'hello world' ]] || err_exit '>; not updating file on success' +fi + +$SHELL -c 'exec 3<>; /dev/null' 2> /dev/null && err_exit '<>; with exec should be an error' +$SHELL -c ': 3<>; /dev/null' 2> /dev/null || err_exit '<>; not working with at all' +print $'hello\nworld' > $tmp/1 +if ! $SHELL -c "false <>; $tmp/1" 2> /dev/null +then [[ $(<$tmp/1) == $'hello\nworld' ]] || err_exit '<>; not preserving file on failure' +fi +if ! $SHELL -c "head -1 $tmp/1" <>; $tmp/1 2> /dev/null +then [[ $(<$tmp/1) == hello ]] || err_exit '<>; not truncating file on success of head' +fi +print $'hello\nworld' > $tmp/1 +if ! $SHELL -c head < $tmp/1 <#((6)) <>; $tmp/1 2> /dev/null +then [[ $(<$tmp/1) == world ]] || err_exit '<>; not truncating file on success of behead' fi unset y @@ -303,25 +337,41 @@ abcdefg [[ $b == d ]] || err_exit 'read -N1 from pipe not working' (print -n a;sleep 1; print -n bcde) |read -n3 a [[ $a == a ]] || err_exit 'read -n3 from pipe not working' -rm -f /tmp/fifo$$ -if mkfifo /tmp/fifo$$ 2> /dev/null -then (print -n a; sleep 1;print -n bcde) > /tmp/fifo$$ & +if mkfifo $tmp/fifo 2> /dev/null +then (print -n a; sleep 1;print -n bcde) > $tmp/fifo & { read -u5 -n3 -t2 a || err_exit 'read -n3 from fifo timedout' read -u5 -n1 -t2 b || err_exit 'read -n1 from fifo timedout' - } 5< /tmp/fifo$$ + } 5< $tmp/fifo [[ $a == a ]] || err_exit 'read -n3 from fifo not working' - rm -f /tmp/fifo$$ - mkfifo /tmp/fifo$$ 2> /dev/null - (print -n a; sleep 1;print -n bcde) > /tmp/fifo$$ & + rm -f $tmp/fifo + mkfifo $tmp/fifo 2> /dev/null + (print -n a; sleep 1;print -n bcde) > $tmp/fifo & { read -u5 -N3 -t2 a || err_exit 'read -N3 from fifo timed out' read -u5 -N1 -t2 b || err_exit 'read -N1 from fifo timedout' - } 5< /tmp/fifo$$ + } 5< $tmp/fifo [[ $a == abc ]] || err_exit 'read -N3 from fifo not working' [[ $b == d ]] || err_exit 'read -N1 from fifo not working' fi -rm -f /tmp/fifo$$ +( + print -n 'prompt1: ' + sleep .1 + print line2 + sleep .1 + print -n 'prompt2: ' + sleep .1 +) | { + read -t2 -n 1000 line1 + read -t2 -n 1000 line2 + read -t2 -n 1000 line3 + read -t2 -n 1000 line4 +} +[[ $? == 0 ]] && err_exit 'should have time out' +[[ $line1 == 'prompt1: ' ]] || err_exit "line1 should be 'prompt1: '" +[[ $line2 == line2 ]] || err_exit "line2 should be line2" +[[ $line3 == 'prompt2: ' ]] || err_exit "line3 should be 'prompt2: '" +[[ ! $line4 ]] || err_exit "line4 should be empty" if $SHELL -c "export LC_ALL=en_US.UTF-8; c=$'\342\202\254'; [[ \${#c} == 1 ]]" 2>/dev/null then lc_utf8=en_US.UTF-8 @@ -370,4 +420,32 @@ then export LC_ALL=en_US.UTF-8 fi fi +exec 3<&2 +file=$tmp/file +redirect 5>$file 2>&5 +print -u5 -f 'This is a test\n' +print -u2 OK +exec 2<&3 +exp=$'This is a test\nOK' +got=$(< $file) +[[ $got == $exp ]] || err_exit "output garbled when stderr is duped -- expected $(printf %q "$exp"), got $(printf %q "$got")" +print 'hello world' > $file +1<>; $file 1># ((5)) +(( $(wc -c < $file) == 5 )) || err_exit "$file was not truncate to 5 bytes" + +$SHELL -c "PS4=':2:' + exec 1> $tmp/21.out 2> $tmp/22.out + set -x + printf ':1:A:' + print \$(:) + print :1:Z:" 1> $tmp/11.out 2> $tmp/12.out +[[ -s $tmp/11.out ]] && err_exit "standard output leaked past redirection" +[[ -s $tmp/12.out ]] && err_exit "standard error leaked past redirection" +exp=$':1:A:\n:1:Z:' +got=$(<$tmp/21.out) +[[ $exp == "$got" ]] || err_exit "standard output garbled -- expected $(printf %q "$exp"), got $(printf %q "$got")" +exp=$':2:printf :1:A:\n:2::\n:2:print\n:2:print :1:Z:' +got=$(<$tmp/22.out) +[[ $exp == "$got" ]] || err_exit "standard error garbled -- expected $(printf %q "$exp"), got $(printf %q "$got")" + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/locale.sh b/usr/src/lib/libshell/common/tests/locale.sh deleted file mode 100644 index ab94722e2d..0000000000 --- a/usr/src/lib/libshell/common/tests/locale.sh +++ /dev/null @@ -1,104 +0,0 @@ -######################################################################## -# # -# This software is part of the ast package # -# Copyright (c) 1982-2008 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 # -# # -# David Korn <dgk@research.att.com> # -# # -######################################################################## -function err_exit -{ - print -u2 -n "\t" - print -u2 -r ${Command}[$1]: "${@:2}" - let Errors+=1 -} -alias err_exit='err_exit $LINENO' - -Command=${0##*/} -integer Errors=0 - -# LC_ALL=debug is an ast specific debug/test locale - -if [[ "$(LC_ALL=debug $SHELL <<- \+EOF+ - x=a<1z>b<2yx>c - print ${#x} - +EOF+)" != 5 - ]] -then err_exit '${#x} not working with multibyte locales' -fi - -export LC_ALL=C -if (( $($SHELL -c $'export LC_ALL=en_US.UTF-8; print -r "\342\202\254\342\202\254\342\202\254\342\202\254w\342\202\254\342\202\254\342\202\254\342\202\254" | wc -m' 2>/dev/null) == 10 )) -then LC_ALL=en_US.UTF-8 $SHELL -c b1=$'"\342\202\254\342\202\254\342\202\254\342\202\254w\342\202\254\342\202\254\342\202\254\342\202\254"; [[ ${b1:4:1} == w ]]' || err_exit 'Multibyte ${var:offset:len} not working correctly' -fi - -export LC_ALL=C -a=$($SHELL -c '/' 2>&1 | sed -e "s,.*: *,," -e "s, *\[.*,,") -b=$($SHELL -c '(LC_ALL=debug / 2>/dev/null); /' 2>&1 | sed -e "s,.*: *,," -e "s, *\[.*,,") -[[ "$b" == "$a" ]] || err_exit "locale not restored after subshell -- expected '$a', got '$b'" -b=$($SHELL -c '(LC_ALL=debug; / 2>/dev/null); /' 2>&1 | sed -e "s,.*: *,," -e "s, *\[.*,,") -[[ "$b" == "$a" ]] || err_exit "locale not restored after subshell -- expected '$a', got '$b'" - -# test shift-jis \x81\x40 ... \x81\x7E encodings -# (shift char followed by 7 bit ascii) - -typeset -i16 chr -for lc_all in $(PATH=/bin:/usr/bin locale -a 2>/dev/null | grep -i jis) -do export LC_ALL=$lc_all - for ((chr=0x40; chr<=0x7E; chr++)) - do c=${chr#16#} - for s in \\x81\\x$c \\x$c - do b="$(printf "$s")" - eval n=\$\'$s\' - [[ $b == "$n" ]] || err_exit "LC_ALL=$lc_all printf difference for \"$s\" -- expected '$n', got '$b'" - u=$(print -- $b) - q=$(print -- "$b") - [[ $u == "$q" ]] || err_exit "LC_ALL=$lc_all quoted print difference for \"$s\" -- $b => '$u' vs \"$b\" => '$q'" - done - done -done - -# test multibyte value/trace format -- $'\303\274' is UTF-8 u-umlaut - -LC_ALL=C -lc_all=de_DE.UTF-8 -c=$(LC_ALL=C $SHELL -c "printf $':%2s:\n' $'\303\274'") -u=$(LC_ALL=$lc_all $SHELL -c "printf $':%2s:\n' $'\303\274'" 2>/dev/null) -if [[ "$c" != "$u" ]] -then LC_ALL=$lc_all - x=$'+2+ typeset item.text\ -+3+ item.text=\303\274\ -+4+ print -- \303\274\ -\303\274\ -+5+ eval $\'arr[0]=(\\n\\ttext=\\303\\274\\n)\' -+2+ arr[0].text=ü\ -+6+ print -- \303\274\ -ü\ -+7+ eval txt=$\'(\\n\\ttext=\\303\\274\\n)\' -+2+ txt.text=\303\274\ -+8+ print -- \'(\' text=$\'\\303\\274\' \')\'\ -( text=\303\274 )' - u=$(LC_ALL=$lc_all PS4='+$LINENO+ ' $SHELL -x -c " - item=(typeset text) - item.text=$'\303\274' - print -- \"\${item.text}\" - eval \"arr[0]=\$item\" - print -- \"\${arr[0].text}\" - eval \"txt=\${arr[0]}\" - print -- \$txt - " 2>&1) - [[ "$u" == "$x" ]] || err_exit LC_ALL=$lc_all multibyte value/trace format failed -fi - -exit $Errors diff --git a/usr/src/lib/libshell/common/tests/nameref.sh b/usr/src/lib/libshell/common/tests/nameref.sh index 21a672db14..7bb9ec2c91 100644 --- a/usr/src/lib/libshell/common/tests/nameref.sh +++ b/usr/src/lib/libshell/common/tests/nameref.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -27,6 +27,10 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + function checkref { nameref foo=$1 bar=$2 @@ -80,7 +84,7 @@ nameref x=.foo.bar if [[ ${!x} != .foo.bar ]] then err_exit "${!x} not working" fi -typeset +n x $(typeset +n) +typeset +n x $(typeset +n) unset x nameref x=.foo.bar function x.set @@ -96,7 +100,7 @@ fi if [[ $(typeset -n) != x=.foo.bar ]] then err_exit "typeset +n doesn't list values of reference variables" fi -file=/tmp/shtest$$ +file=$tmp/test typeset +n foo bar 2> /dev/null unset foo bar export bar=foo @@ -104,7 +108,6 @@ nameref foo=bar if [[ $foo != foo ]] then err_exit "value of nameref foo != $foo" fi -trap "rm -f $file" EXIT INT cat > $file <<\! print -r -- $foo ! @@ -113,7 +116,7 @@ y=$( $file) if [[ $y != '' ]] then err_exit "reference variable not cleared" fi -{ +{ command nameref xx=yy command nameref yy=xx } 2> /dev/null && err_exit "self reference not detected" @@ -127,7 +130,7 @@ then err_exit 'nameref of positional paramters outside of function not working' fi unset foo bar bar=123 -function foobar +function foobar { typeset -n foo=bar typeset -n foo=bar @@ -216,7 +219,7 @@ function local qs=(integer a=3; integer b=4) } local 2> /dev/null || err_exit 'function local has non-zero exit status' -[[ ${qs.a} == 3 ]] || err_exit 'function cannot set compound global variable' +[[ ${qs.a} == 3 ]] || err_exit 'function cannot set compound global variable' unset fun i foo=(x=hi) function fun @@ -297,4 +300,66 @@ vars=(data=()) vars.data._1.a=a.1 vars.data._1.b=b.1 [[ $(a) == 'a.1 b.1' ]] || err_exit 'nameref choosing wrong scope -- ' +typeset +n bam zip foo +unset bam zip foo +typeset -A foo +foo[2]=bar +typeset -n bam=foo[2] +typeset -n zip=bam +[[ $zip == bar ]] || err_exit 'nameref to another nameref to array element fails' +[[ -R zip ]] || err_exit '[[ -R zip ]] should detect that zip is a reference' +[[ -R bam ]] || err_exit '[[ -R bam ]] should detect that bam is a reference' +[[ -R zip ]] || err_exit '[[ -v zip ]] should detect that zip is set' +[[ -v bam ]] || err_exit '[[ -v bam ]] should detect that bam is set' +[[ -R 123 ]] && err_exit '[[ -R 123 ]] should detect that 123 is not a reference' +[[ -v 123 ]] && err_exit '[[ -v 123 ]] should detect that 123 is not set' + +unset ref x +typeset -n ref +x=3 +function foobar +{ + typeset xxx=3 + ref=xxx + return 0 +} +foobar 2> /dev/null && err_exit 'invalid reference should cause foobar to fail' +[[ -v ref ]] && err_exit '$ref should be unset' +ref=x +[[ $ref == 3 ]] || err_exit "\$ref is $ref, it should be 3" +function foobar +{ + typeset fvar=() + typeset -n ref=fvar.foo + ref=ok + print -r $ref +} +[[ $(foobar) == ok ]] 2> /dev/null || err_exit 'nameref in function not creating variable in proper scope' +function foobar +{ + nameref doc=docs + nameref bar=doc.num + [[ $bar == 2 ]] || err_exit 'nameref scoping error' +} + +docs=(num=2) +foobar + +typeset +n x y +unset x y +typeset -A x +x[a]=(b=c) +typeset -n y=x[a] +[[ ${!y.@} == 'x[a].b' ]] || err_exit 'reference to array element not expanded with ${!y.@}' + +typeset +n v +v=() +k=a.b.c/d +command typeset -n n=v.${k//['./']/_} 2> /dev/null || err_exit 'patterns with quotes not handled correctly with name reference assignment' + +typeset _n sp +nameref sp=addrsp +sp[14]=( size=1 ) +[[ -v sp[19] ]] && err_exit '[[ -v sp[19] ]] where sp is a nameref should not be set' + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/options.sh b/usr/src/lib/libshell/common/tests/options.sh index 07608efa1e..cebb405a27 100644 --- a/usr/src/lib/libshell/common/tests/options.sh +++ b/usr/src/lib/libshell/common/tests/options.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -29,11 +29,17 @@ Command=${0##*/} integer Errors=0 unset HISTFILE +export LC_ALL=C ENV= + +ulimit -c 0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT if [[ $( ${SHELL-ksh} -s hello<<-\! print $1 ! - ) != hello ]] + ) != hello ]] then err_exit "${SHELL-ksh} -s not working" fi x=$( @@ -42,102 +48,118 @@ x=$( print good ) if [[ $x != good ]] -then err_exit 'sh -e not workuing' +then err_exit 'sh -e not working' fi [[ $($SHELL -D -c 'print hi; print $"hello"') == '"hello"' ]] || err_exit 'ksh -D not working' -tmp=/tmp/ksh$$ -mkdir $tmp +env=$tmp/.env +print $'(print -u1 aha) &>/dev/null\n(print -u2 aha) &>/dev/null' > $env rc=$tmp/.kshrc print $'PS1=""\nfunction env_hit\n{\n\tprint OK\n}' > $rc -export ENV='${nosysrc}'$rc +export ENV=/.$env +if [[ ! -o privileged ]] +then + got=$($SHELL -E -c : 2>/dev/null) + if [[ $g ]] + then + got=$(printf %q "$got") + err_exit "\$ENV file &>/dev/null does not redirect stdout -- expected '', got $got" + fi + got=$($SHELL -E -c : 2>&1 >/dev/null) + if [[ $got != *nonstandard* || $got == *$'\n'* ]] + then + got=$(printf %q "$got") + err_exit "\$ENV file &>/dev/null does not redirect stderr -- expected one diagnostic line, got $got" + fi +fi + +export ENV=/.$rc if [[ -o privileged ]] then - [[ $(print env_hit | $SHELL 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | $SHELL 2>&1) == "OK" ]] && err_exit 'privileged nointeractive shell reads $ENV file' - [[ $(print env_hit | $SHELL -E 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | $SHELL -E 2>&1) == "OK" ]] && err_exit 'privileged -E reads $ENV file' - [[ $(print env_hit | $SHELL +E 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | $SHELL +E 2>&1) == "OK" ]] && err_exit 'privileged +E reads $ENV file' - [[ $(print env_hit | $SHELL --rc 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | $SHELL --rc 2>&1) == "OK" ]] && err_exit 'privileged --rc reads $ENV file' - [[ $(print env_hit | $SHELL --norc 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | $SHELL --norc 2>&1) == "OK" ]] && err_exit 'privileged --norc reads $ENV file' else - [[ $(print env_hit | $SHELL 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | $SHELL 2>&1) == "OK" ]] && err_exit 'nointeractive shell reads $ENV file' - [[ $(print env_hit | $SHELL -E 2>/dev/null) == "OK" ]] || + [[ $(print env_hit | $SHELL -E 2>&1) == "OK" ]] || err_exit '-E ignores $ENV file' - [[ $(print env_hit | $SHELL +E 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | $SHELL +E 2>&1) == "OK" ]] && err_exit '+E reads $ENV file' - [[ $(print env_hit | $SHELL --rc 2>/dev/null) == "OK" ]] || + [[ $(print env_hit | $SHELL --rc 2>&1) == "OK" ]] || err_exit '--rc ignores $ENV file' - [[ $(print env_hit | $SHELL --norc 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | $SHELL --norc 2>&1) == "OK" ]] && err_exit '--norc reads $ENV file' - [[ $(print env_hit | $SHELL -i 2>/dev/null) == "OK" ]] || + [[ $(print env_hit | $SHELL -i 2>&1) == "OK" ]] || err_exit '-i ignores $ENV file' fi export ENV= if [[ -o privileged ]] then - [[ $(print env_hit | HOME=$tmp $SHELL 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL 2>&1) == "OK" ]] && err_exit 'privileged nointeractive shell reads $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL -E 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL -E 2>&1) == "OK" ]] && err_exit 'privileged -E ignores empty $ENV' - [[ $(print env_hit | HOME=$tmp $SHELL +E 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL +E 2>&1) == "OK" ]] && err_exit 'privileged +E reads $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL --rc 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL --rc 2>&1) == "OK" ]] && err_exit 'privileged --rc ignores empty $ENV' - [[ $(print env_hit | HOME=$tmp $SHELL --norc 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL --norc 2>&1) == "OK" ]] && err_exit 'privileged --norc reads $HOME/.kshrc file' else - [[ $(print env_hit | HOME=$tmp $SHELL 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL 2>&1) == "OK" ]] && err_exit 'nointeractive shell reads $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL -E 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL -E 2>&1) == "OK" ]] && err_exit '-E ignores empty $ENV' - [[ $(print env_hit | HOME=$tmp $SHELL +E 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL +E 2>&1) == "OK" ]] && err_exit '+E reads $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL --rc 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL --rc 2>&1) == "OK" ]] && err_exit '--rc ignores empty $ENV' - [[ $(print env_hit | HOME=$tmp $SHELL --norc 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL --norc 2>&1) == "OK" ]] && err_exit '--norc reads $HOME/.kshrc file' fi unset ENV if [[ -o privileged ]] then - [[ $(print env_hit | HOME=$tmp $SHELL 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL 2>&1) == "OK" ]] && err_exit 'privileged nointeractive shell reads $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL -E 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL -E 2>&1) == "OK" ]] && err_exit 'privileged -E reads $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL +E 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL +E 2>&1) == "OK" ]] && err_exit 'privileged +E reads $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL --rc 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL --rc 2>&1) == "OK" ]] && err_exit 'privileged --rc reads $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL --norc 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL --norc 2>&1) == "OK" ]] && err_exit 'privileged --norc reads $HOME/.kshrc file' else - [[ $(print env_hit | HOME=$tmp $SHELL 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL 2>&1) == "OK" ]] && err_exit 'nointeractive shell reads $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL -E 2>/dev/null) == "OK" ]] || + [[ $(print env_hit | HOME=$tmp $SHELL -E 2>&1) == "OK" ]] || err_exit '-E ignores $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL +E 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL +E 2>&1) == "OK" ]] && err_exit '+E reads $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL --rc 2>/dev/null) == "OK" ]] || + [[ $(print env_hit | HOME=$tmp $SHELL --rc 2>&1) == "OK" ]] || err_exit '--rc ignores $HOME/.kshrc file' - [[ $(print env_hit | HOME=$tmp $SHELL --norc 2>/dev/null) == "OK" ]] && + [[ $(print env_hit | HOME=$tmp $SHELL --norc 2>&1) == "OK" ]] && err_exit '--norc reads $HOME/.kshrc file' fi -rm -rf $tmp +rm -rf $tmp/.kshrc if command set -G 2> /dev/null -then mkdir /tmp/ksh$$ - cd /tmp/ksh$$ +then cd $tmp mkdir bar foo - > bar.c > bam.c + > bar.c > bam.c > bar/foo.c > bar/bam.c > foo/bam.c set -- **.c @@ -157,49 +179,48 @@ then mkdir /tmp/ksh$$ [[ $* == $expected ]] || err_exit "-G **/bam.c failed -- expected '$expected', got '$*'" cd ~- - rm -rf /tmp/ksh$$ fi -mkdir /tmp/ksh$$ -cd /tmp/ksh$$ +cd $tmp t="<$$>.profile.<$$>" echo "echo '$t'" > .profile cp $SHELL ./-ksh if [[ -o privileged ]] then - [[ $(HOME=$PWD $SHELL -l </dev/null 2>/dev/null) == *$t* ]] && + [[ $(HOME=$PWD $SHELL -l </dev/null 2>&1) == *$t* ]] && err_exit 'privileged -l reads .profile' - [[ $(HOME=$PWD $SHELL --login </dev/null 2>/dev/null) == *$t* ]] && + [[ $(HOME=$PWD $SHELL --login </dev/null 2>&1) == *$t* ]] && err_exit 'privileged --login reads .profile' - [[ $(HOME=$PWD $SHELL --login-shell </dev/null 2>/dev/null) == *$t* ]] && + [[ $(HOME=$PWD $SHELL --login-shell </dev/null 2>&1) == *$t* ]] && err_exit 'privileged --login-shell reads .profile' - [[ $(HOME=$PWD $SHELL --login_shell </dev/null 2>/dev/null) == *$t* ]] && + [[ $(HOME=$PWD $SHELL --login_shell </dev/null 2>&1) == *$t* ]] && err_exit 'privileged --login_shell reads .profile' - [[ $(HOME=$PWD exec -a -ksh $SHELL </dev/null 2>/dev/null) == *$t* ]] && + [[ $(HOME=$PWD exec -a -ksh $SHELL </dev/null 2>&1) == *$t* ]] && err_exit 'privileged exec -a -ksh ksh reads .profile' - [[ $(HOME=$PWD ./-ksh -i </dev/null 2>/dev/null) == *$t* ]] && + [[ $(HOME=$PWD ./-ksh -i </dev/null 2>&1) == *$t* ]] && err_exit 'privileged ./-ksh reads .profile' - [[ $(HOME=$PWD ./-ksh -ip </dev/null 2>/dev/null) == *$t* ]] && + [[ $(HOME=$PWD ./-ksh -ip </dev/null 2>&1) == *$t* ]] && err_exit 'privileged ./-ksh -p reads .profile' else - [[ $(HOME=$PWD $SHELL -l </dev/null 2>/dev/null) == *$t* ]] || + [[ $(HOME=$PWD $SHELL -l </dev/null 2>&1) == *$t* ]] || err_exit '-l ignores .profile' - [[ $(HOME=$PWD $SHELL --login </dev/null 2>/dev/null) == *$t* ]] || + [[ $(HOME=$PWD $SHELL --login </dev/null 2>&1) == *$t* ]] || err_exit '--login ignores .profile' - [[ $(HOME=$PWD $SHELL --login-shell </dev/null 2>/dev/null) == *$t* ]] || + [[ $(HOME=$PWD $SHELL --login-shell </dev/null 2>&1) == *$t* ]] || err_exit '--login-shell ignores .profile' - [[ $(HOME=$PWD $SHELL --login_shell </dev/null 2>/dev/null) == *$t* ]] || + [[ $(HOME=$PWD $SHELL --login_shell </dev/null 2>&1) == *$t* ]] || err_exit '--login_shell ignores .profile' - [[ $(HOME=$PWD exec -a -ksh $SHELL </dev/null 2>/dev/null) == *$t* ]] || - err_exit 'exec -a -ksh ksh ignores .profile' - [[ $(HOME=$PWD ./-ksh -i </dev/null 2>/dev/null) == *$t* ]] || + [[ $(HOME=$PWD exec -a -ksh $SHELL </dev/null 2>/dev/null) == *$t* ]] || + err_exit 'exec -a -ksh ksh 2>/dev/null ignores .profile' + [[ $(HOME=$PWD exec -a -ksh $SHELL </dev/null 2>&1) == *$t* ]] || + err_exit 'exec -a -ksh ksh 2>&1 ignores .profile' + [[ $(HOME=$PWD ./-ksh -i </dev/null 2>&1) == *$t* ]] || err_exit './-ksh ignores .profile' - [[ $(HOME=$PWD ./-ksh -ip </dev/null 2>/dev/null) == *$t* ]] && + [[ $(HOME=$PWD ./-ksh -ip </dev/null 2>&1) == *$t* ]] && err_exit './-ksh -p does not ignore .profile' fi cd ~- -rm -rf /tmp/ksh$$ - +rm -rf $tmp/.profile # { exec interactive login_shell restricted xtrace } in the following test @@ -333,44 +354,146 @@ set $restore state=$(set --state) [[ $state == "set $restore" ]] || err_exit "set --state after restore failed: expected 'set $restore', got '$state'" -false | true | true || err_exit 'pipe not exiting exit value of last element' -true | true | false && err_exit 'pipe not exiting false' -set -o pipefail -false | true | true && err_exit 'pipe with first not failing with pipefail' -true | false | true && err_exit 'pipe middle not failing with pipefail' -true | true | false && err_exit 'pipe last not failing with pipefail' -print hi | (sleep 1;/bin/cat) > /dev/null || err_exit 'pipeline fails with pipefail' +typeset -a pipeline +pipeline=( + ( nopipefail=0 pipefail=1 command='false|true|true' ) + ( nopipefail=0 pipefail=1 command='true|false|true' ) + ( nopipefail=1 pipefail=1 command='true|true|false' ) + ( nopipefail=1 pipefail=1 command='false|false|false' ) + ( nopipefail=0 pipefail=0 command='true|true|true' ) + ( nopipefail=0 pipefail=0 command='print hi|(sleep 1;/bin/cat)>/dev/null' ) +) +set --nopipefail +for ((i = 0; i < ${#pipeline[@]}; i++ )) +do eval ${pipeline[i].command} + status=$? + expected=${pipeline[i].nopipefail} + [[ $status == $expected ]] || + err_exit "--nopipefail '${pipeline[i].command}' exit status $status -- expected $expected" +done +ftt=0 +set --pipefail +for ((i = 0; i < ${#pipeline[@]}; i++ )) +do eval ${pipeline[i].command} + status=$? + expected=${pipeline[i].pipefail} + if [[ $status != $expected ]] + then err_exit "--pipefail '${pipeline[i].command}' exit status $status -- expected $expected" + (( i == 0 )) && ftt=1 + fi +done +if (( ! ftt )) +then exp=10 + got=$(for((n=1;n<exp;n++))do $SHELL --pipefail -c '(sleep 0.1;false)|true|true' && break; done; print $n) + [[ $got == $exp ]] || err_exit "--pipefail -c '(sleep 0.1;false)|true|true' fails with exit status 0 (after $got/$exp iterations)" +fi + +echo=$(whence -p echo) +for ((i=0; i < 20; i++)) +do if ! x=$(true | $echo 123) + then err_exit 'command substitution with wrong exit status with pipefai' + break + fi +done ( set -o pipefail false | true (( $? )) || err_exit 'pipe not failing in subshell with pipefail' ) | wc >/dev/null $SHELL -c 'set -o pipefail; false | $(whence -p true);' && err_exit 'pipefail not returning failure with sh -c' -[[ $( set -o pipefail +exp='1212 or 1221' +got=$( + set --pipefail pipe() { date | cat > /dev/null ;} print $'1\n2' | - while read i - do if pipe /tmp - then { print enter $i; sleep 2; print leave $i; } & + while read i + do if pipe $tmp + then { print -n $i; sleep 2; print -n $i; } & fi done - wait) == $'enter 1\nenter 2'* ]] || err_exit '& job delayed by pipefail' -$SHELL -c '[[ $- == *c* ]]' || err_exit 'option c not in $-' -trap 'rm -f /tmp/.profile' EXIT -> /tmp/.profile -for i in i l r s D E a b e f h k n r t u v x B C G H -do HOME=/tmp ENV= $SHELL -$i 2> /dev/null <<- ++EOF++ || err_exit "option $i not in \$-" - [[ \$- == *$i* ]] || exit 1 + wait +) +[[ $got == @((12|21)(12|21)) ]] || err_exit "& job delayed by --pipefail, expected '$exp', got '$got'" +$SHELL -c '[[ $- == *c* ]]' || err_exit 'option c not in $-' +> $tmp/.profile +for i in i l r s D E a b e f h k n t u v x B C G H +do HOME=$tmp ENV= $SHELL -$i >/dev/null 2>&1 <<- ++EOF++ || err_exit "option $i not in \$-" + [[ \$- == *$i* ]] || exit 1 ++EOF++ done letters=ilrabefhknuvxBCGE integer j=0 -for i in interactive login restricted allexport notify errexit \ - noglob trackall keyword noexec nounset verbose xtrace braceexpand \ +for i in interactive login restricted allexport notify errexit \ + noglob trackall keyword noexec nounset verbose xtrace braceexpand \ noclobber globstar rc -do HOME=/tmp ENV= $SHELL -o $i 2> /dev/null <<- ++EOF++ || err_exit "option $i not equivalent to ${letters:j:1}" - [[ \$- == *${letters:j:1}* ]] || exit 1 +do HOME=$tmp ENV= $SHELL -o $i >/dev/null 2>&1 <<- ++EOF++ || err_exit "option $i not equivalent to ${letters:j:1}" + [[ \$- == *${letters:j:1}* ]] || exit 1 ++EOF++ ((j++)) done + +export ENV= +histfile=$tmp/history +exp=$(HISTFILE=$histfile $SHELL -c $'function foo\n{\ncat\n}\ntype foo') +for var in HISTSIZE HISTFILE +do got=$( ( HISTFILE=$histfile $SHELL -ic $'unset '$var$'\nfunction foo\n{\ncat\n}\ntype foo\nexit' ) 2>&1 ) + got=${got##*': '} + [[ $got == "$exp" ]] || err_exit "function definition inside (...) with $var unset fails -- got '$got', expected '$exp'" + got=$( { HISTFILE=$histfile $SHELL -ic $'unset '$var$'\nfunction foo\n{\ncat\n}\ntype foo\nexit' ;} 2>&1 ) + got=${got##*': '} + [[ $got == "$exp" ]] || err_exit "function definition inside {...;} with $var unset fails -- got '$got', expected '$exp'" +done +( unset HISTFILE; $SHELL -ic "HISTFILE=$histfile" 2>/dev/null ) || err_exit "setting HISTFILE when not in environment fails" + +# the next tests loop on all combinations of +# { SUB PAR CMD ADD } + +SUB=( + ( BEG='$( ' END=' )' ) + ( BEG='${ ' END='; }' ) +) +PAR=( + ( BEG='( ' END=' )' ) + ( BEG='{ ' END='; }' ) +) +CMD=( command-kill script-kill ) +ADD=( '' '; :' ) + +cd $tmp +print $'#!'$SHELL$'\nkill -KILL $$' > command-kill +print $'kill -KILL $$' > script-kill +chmod +x command-kill script-kill +export PATH=.:$PATH +exp='Killed' +for ((S=0; S<${#SUB[@]}; S++)) +do for ((P=0; P<${#PAR[@]}; P++)) + do for ((C=0; C<${#CMD[@]}; C++)) + do for ((A=0; A<${#ADD[@]}; A++)) + do cmd="${SUB[S].BEG}${PAR[P].BEG}${CMD[C]}${PAR[P].END} 2>&1${ADD[A]}${SUB[S].END}" + eval got="$cmd" + got=${got##*': '} + got=${got%%'('*} + [[ $got == "$exp" ]] || err_exit "$cmd failed -- got '$got', expected '$exp'" + done + done + done +done + +$SHELL 2> /dev/null -c '{; true ;}' || err_exit 'leading ; causes syntax error in brace group' +$SHELL 2> /dev/null -c '(; true ;)' || err_exit 'leading ; causes syntax error in parenthesis group' + +print 'for ((i = 0; i < ${1:-10000}; i++ )); do printf "%.*c\n" 15 x; done' > pipefail +chmod +x pipefail +$SHELL --pipefail -c './pipefail 10000 | sed 1q' >/dev/null 2>&1 & +tst=$! +{ sleep 4; kill $tst; } 2>/dev/null & +spy=$! +wait $tst 2>/dev/null +status=$? +if [[ $status == 0 || $(kill -l $status) == PIPE ]] +then kill $spy 2>/dev/null +else err_exit "pipefail pipeline bypasses SIGPIPE and hangs" +fi +wait + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/path.sh b/usr/src/lib/libshell/common/tests/path.sh index 2e46e2bd48..edf7621663 100644 --- a/usr/src/lib/libshell/common/tests/path.sh +++ b/usr/src/lib/libshell/common/tests/path.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -24,12 +24,14 @@ function err_exit let Errors+=1 } alias err_exit='err_exit $LINENO' + Command=${0##*/} integer Errors=0 -mkdir /tmp/ksh$$ -cd /tmp/ksh$$ -trap "PATH=$PATH; cd /; rm -rf /tmp/ksh$$" EXIT +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + +cd $tmp || exit type /xxxxxx > out1 2> out2 [[ -s out1 ]] && err_exit 'type should not write on stdout for not found case' [[ -s out2 ]] || err_exit 'type should write on stderr for not found case' @@ -69,37 +71,36 @@ PATH=$FPATH:$p PATH=$p (PATH="/bin") [[ $($SHELL -c 'print -r -- "$PATH"') == "$PATH" ]] || err_exit 'export PATH lost in subshell' -cat > bug1 <<- \EOF - print print ok > /tmp/ok$$ - /bin/chmod 755 /tmp/ok$$ - trap 'cd /; rm -f /tmp/ok$$' EXIT +cat > bug1 <<- EOF + print print ok > $tmp/ok + /bin/chmod 755 $tmp/ok function a { - typeset -x PATH=/tmp - ok$$ + typeset -x PATH=$tmp + ok } - path=$PATH + path=\$PATH unset PATH a - PATH=$path + PATH=\$path } EOF -[[ $($SHELL ./bug1 2> /dev/null) == ok ]] || err_exit "PATH in function not working" +[[ $($SHELL ./bug1 2>/dev/null) == ok ]] || err_exit "PATH in function not working" cat > bug1 <<- \EOF function lock_unlock { typeset PATH=/usr/bin typeset -x PATH='' } - + PATH=/usr/bin : $(PATH=/usr/bin getconf PATH) typeset -ft lock_unlock lock_unlock EOF ($SHELL ./bug1) 2> /dev/null || err_exit "path_delete bug" -mkdir tdir$$ -if $SHELL tdir$$ > /dev/null 2>&1 +mkdir tdir +if $SHELL tdir > /dev/null 2>&1 then err_exit 'not an error to run ksh on a directory' fi @@ -121,7 +122,7 @@ var=$(whence date) dir=$(basename "$var") for i in 1 2 3 4 5 6 7 8 9 0 do if ! whence notfound$i 2> /dev/null - then cmd=notfound$i + then cmd=notfound$i break fi done @@ -132,7 +133,7 @@ chmod +x "$cmd" > foo chmod 755 foo for PATH in $path :$path $path: .:$path $path: $path:. $PWD::$path $PWD:.:$path $path:$PWD $path:.:$PWD -do +do # print path=$PATH $(whence date) # print path=$PATH $(whence "$cmd") date @@ -155,19 +156,60 @@ fi status=$? [[ $status == 126 ]] || err_exit "exit status of non-executable is $status -- 126 expected" builtin -d rm 2> /dev/null +chmod=$(whence chmod) rm=$(whence rm) d=$(dirname "$rm") + +chmod=$(whence chmod) + +for cmd in date foo +do exp="$cmd found" + print print $exp > $cmd + $chmod +x $cmd + got=$($SHELL -c "unset FPATH; PATH=/dev/null; $cmd" 2>&1) + [[ $got == $exp ]] && err_exit "$cmd as last command should not find ./$cmd with PATH=/dev/null" + got=$($SHELL -c "unset FPATH; PATH=/dev/null; $cmd" 2>&1) + [[ $got == $exp ]] && err_exit "$cmd should not find ./$cmd with PATH=/dev/null" + exp=$PWD/./$cmd + got=$(unset FPATH; PATH=/dev/null; whence ./$cmd) + [[ $got == $exp ]] || err_exit "whence $cmd should find ./$cmd with PATH=/dev/null" + exp=$PWD/$cmd + got=$(unset FPATH; PATH=/dev/null; whence $PWD/$cmd) + [[ $got == $exp ]] || err_exit "whence \$PWD/$cmd should find ./$cmd with PATH=/dev/null" +done + +exp='' +got=$($SHELL -c "unset FPATH; PATH=/dev/null; whence ./notfound" 2>&1) +[[ $got == $exp ]] || err_exit "whence ./$cmd failed -- expected '$exp', got '$got'" +got=$($SHELL -c "unset FPATH; PATH=/dev/null; whence $PWD/notfound" 2>&1) +[[ $got == $exp ]] || err_exit "whence \$PWD/$cmd failed -- expected '$exp', got '$got'" + unset FPATH PATH=/dev/null -if date > /dev/null 2>&1 -then err_exit 'programs in . should not be found' -fi -[[ $(whence ./foo) != "$PWD/"./foo ]] && err_exit 'whence ./foo not working' -[[ $(whence "$PWD/foo") != "$PWD/foo" ]] && err_exit 'whence $PWD/foo not working' -[[ $(whence ./xxxxx) ]] && err_exit 'whence ./xxxx not working' +for cmd in date foo +do exp="$cmd found" + print print $exp > $cmd + $chmod +x $cmd + got=$($cmd 2>&1) + [[ $got == $exp ]] && err_exit "$cmd as last command should not find ./$cmd with PATH=/dev/null" + got=$($cmd 2>&1; :) + [[ $got == $exp ]] && err_exit "$cmd should not find ./$cmd with PATH=/dev/null" + exp=$PWD/./$cmd + got=$(whence ./$cmd) + [[ $got == $exp ]] || err_exit "whence ./$cmd should find ./$cmd with PATH=/dev/null" + exp=$PWD/$cmd + got=$(whence $PWD/$cmd) + [[ $got == $exp ]] || err_exit "whence \$PWD/$cmd should find ./$cmd with PATH=/dev/null" +done +exp='' +got=$(whence ./notfound) +[[ $got == $exp ]] || err_exit "whence ./$cmd failed -- expected '$exp', got '$got'" +got=$(whence $PWD/notfound) +[[ $got == $exp ]] || err_exit "whence \$PWD/$cmd failed -- expected '$exp', got '$got'" + PATH=$d: -cp "$rm" kshrm$$ -if [[ $(whence kshrm$$) != $PWD/kshrm$$ ]] +cp "$rm" kshrm +if [[ $(whence kshrm) != $PWD/kshrm ]] then err_exit 'trailing : in pathname not working' fi cp "$rm" rm @@ -196,7 +238,7 @@ then PATH= then err_exit 'unsetting path not working' fi fi -PATH=/dev:/tmp/ksh$$ +PATH=/dev:$tmp x=$(whence rm) typeset foo=$(PATH=/xyz:/abc :) y=$(whence rm) @@ -212,11 +254,11 @@ PATH=$PWD:.:${x%/ls} [[ $(whence ls) == "$x" ]] || err_exit 'PATH search bug when :$PWD:. in path' cd "${x%/ls}" [[ $(whence ls) == /* ]] || err_exit 'whence not generating absolute pathname' -status=$($SHELL -c $'trap \'print $?\' EXIT;/a/b/c/d/e 2> /dev/null') +status=$($SHELL -c $'trap \'print $?\' EXIT;/xxx/a/b/c/d/e 2> /dev/null') [[ $status == 127 ]] || err_exit "not found command exit status $status -- expected 127" status=$($SHELL -c $'trap \'print $?\' EXIT;/dev/null 2> /dev/null') [[ $status == 126 ]] || err_exit "non executable command exit status $status -- expected 126" -status=$($SHELL -c $'trap \'print $?\' ERR;/a/b/c/d/e 2> /dev/null') +status=$($SHELL -c $'trap \'print $?\' ERR;/xxx/a/b/c/d/e 2> /dev/null') [[ $status == 127 ]] || err_exit "not found command with ERR trap exit status $status -- expected 127" status=$($SHELL -c $'trap \'print $?\' ERR;/dev/null 2> /dev/null') [[ $status == 126 ]] || err_exit "non executable command ERR trap exit status $status -- expected 126" @@ -231,7 +273,7 @@ getconf UNIVERSE - att # override sticky default 'UNIVERSE = foo' PATH=$path -scr=/tmp/ksh$$/foo +scr=$tmp/script exp=126 : > $scr diff --git a/usr/src/lib/libshell/common/tests/pointtype.sh b/usr/src/lib/libshell/common/tests/pointtype.sh index 25b9f5fbc5..28b60c499c 100644 --- a/usr/src/lib/libshell/common/tests/pointtype.sh +++ b/usr/src/lib/libshell/common/tests/pointtype.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libshell/common/tests/quoting.sh b/usr/src/lib/libshell/common/tests/quoting.sh index b15739da08..a1df26a230 100644 --- a/usr/src/lib/libshell/common/tests/quoting.sh +++ b/usr/src/lib/libshell/common/tests/quoting.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -212,12 +212,12 @@ fi foo=bar bar=$(print -r -- ${foo+\\n\ }) if [[ $bar != '\n ' ]] -then err_exit '${foo+\\n\ } expansion error' +then err_exit '${foo+\\n\ } expansion error' fi unset bar bar=$(print -r -- ${foo+\\n\ $bar}) if [[ $bar != '\n ' ]] -then err_exit '${foo+\\n\ $bar} expansion error with bar unset' +then err_exit '${foo+\\n\ $bar} expansion error with bar unset' fi x='\\(..\\)|&\|\|\\&\\|' if [[ $(print -r -- $x) != "$x" ]] @@ -326,7 +326,7 @@ string='&foo' { x=x x=${x:-`id | sed 's/^[^(]*(\([^)]*\)).*/\1/'`} -} 2> /dev/null || err_exit 'skipping over `` failed' +} 2> /dev/null || err_exit 'skipping over `` failed' [[ $x == x ]] || err_exit 'assignment ${x:=`...`} failed' [[ $($SHELL -c 'print a[') == 'a[' ]] || err_exit "unbalanced '[' in command arg fails" $SHELL -c $'false && (( `wc -l /dev/null | nawk \'{print $1}\'` > 2 )) && true;:' 2> /dev/null || err_exit 'syntax error with ` in arithmetic expression' @@ -334,4 +334,9 @@ $SHELL -c $'false && (( `wc -l /dev/null | nawk \'{print $1}\'` > 2 )) && true;: varname=foobarx x=`print '"\$'${varname}'"'` [[ $x == '"$foobarx"' ]] || err_exit $'\\$\' not handled correctly inside ``' + +copy1=5 copynum=1 +foo="`eval echo "$"{copy$copynum"-0}"`" +[[ $foo == "$copy1" ]] || err_exit '$"..." not being ignored inside ``' + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/quoting2.sh b/usr/src/lib/libshell/common/tests/quoting2.sh index 334ed40e7c..dab0992f6b 100644 --- a/usr/src/lib/libshell/common/tests/quoting2.sh +++ b/usr/src/lib/libshell/common/tests/quoting2.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -197,11 +197,13 @@ foo=foo [[ "$" == '$' ]] || err_exit '"$" != $' [[ "${foo}$" == 'foo$' ]] || err_exit 'foo=foo;"${foo}$" != foo$' [[ "${foo}${foo}$" == 'foofoo$' ]] || err_exit 'foo=foo;"${foo}${foo}$" != foofoo$' -foo='$ ' +foo='$ ' [[ "$foo" == ~(Elr)(\\\$|#)\ ]] || err_exit $'\'$ \' not matching RE \\\\\\$|#\'' -[[ "$foo" == ~(Elr)('\$'|#)\ ]] || err_exit $'\'$ \' not matching RE \'\\$\'|#\'' +[[ "$foo" == ~(Elr)('\$'|#)\ ]] || err_exit $'\'$ \' not matching RE \'\\$\'|#\'' foo='# ' -[[ "$foo" == ~(Elr)(\\\$|#)\ ]] || err_exit $'\'# \' not matching RE \\'\$|#\'' +[[ "$foo" == ~(Elr)(\\\$|#)\ ]] || err_exit $'\'# \' not matching RE \\'\$|#\'' [[ "$foo" == ~(Elr)('\$'|#)\ ]] || err_exit $'\'# \' not matching RE \'\\$\'|#\'' [[ '\$' == '\$'* ]] || err_exit $'\'\\$\' not matching \'\\$\'*' +[[ a+a == ~(E)a\+a ]] || err_exit '~(E)a\+a not matching a+a' +[[ a+a =~ a\+a ]] || err_exit 'RE a\+a not matching a+a' exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/recttype.sh b/usr/src/lib/libshell/common/tests/recttype.sh index 8fe1f3d4ff..b2bca80f50 100644 --- a/usr/src/lib/libshell/common/tests/recttype.sh +++ b/usr/src/lib/libshell/common/tests/recttype.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libshell/common/tests/restricted.sh b/usr/src/lib/libshell/common/tests/restricted.sh index 9cc28c7303..eca93ce6f2 100644 --- a/usr/src/lib/libshell/common/tests/restricted.sh +++ b/usr/src/lib/libshell/common/tests/restricted.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -25,11 +25,13 @@ function err_exit } alias err_exit='err_exit $LINENO' -# test restricted shell Command=${0##*/} integer Errors=0 -mkdir /tmp/ksh$$ || err_exit "mkdir /tmp/ksh$$ failed" -trap "cd /; rm -rf /tmp/ksh$$" EXIT + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + +# test restricted shell pwd=$PWD case $SHELL in /*) ;; @@ -40,14 +42,14 @@ function check_restricted { rm -f out rksh -c "$@" 2> out > /dev/null - grep restricted out > /dev/null 2>&1 + grep restricted out > /dev/null 2>&1 } [[ $SHELL != /* ]] && SHELL=$pwd/$SHELL -cd /tmp/ksh$$ || err_exit "cd /tmp/ksh$$ failed" +cd $tmp || err_exit "cd $tmp failed" ln -s $SHELL rksh PATH=$PWD:$PATH -rksh -c '[[ -o restricted ]]' || err_exit 'restricted option not set' +rksh -c '[[ -o restricted ]]' || err_exit 'restricted option not set' [[ $(rksh -c 'print hello') == hello ]] || err_exit 'unable to run print' check_restricted /bin/echo || err_exit '/bin/echo not resticted' check_restricted ./echo || err_exit './echo not resticted' @@ -74,4 +76,7 @@ print hello ! ! check_restricted 'script;:' || err_exit 'script with #! pathname should run in restricted mode' ! check_restricted 'script' || err_exit 'script with #! pathname should run in restricted mode even if last command in script' +for i in PATH ENV FPATH +do check_restricted "function foo { typeset $i=foobar;};foo" || err_exit "$i can be changed in function by using typeset" +done exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/return.sh b/usr/src/lib/libshell/common/tests/return.sh index ac9d2761c0..c9bbf0f33c 100644 --- a/usr/src/lib/libshell/common/tests/return.sh +++ b/usr/src/lib/libshell/common/tests/return.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -26,14 +26,17 @@ function err_exit let Errors+=1 } alias err_exit='err_exit $LINENO' + Command=${0##*/} integer Errors=0 +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + unset HISTFILE foo=NOVAL bar=NOVAL -file=/tmp/shtest$$ -trap "rm -f $file" EXIT INT +file=$tmp/test function foo { typeset foo=NOEXIT @@ -125,7 +128,7 @@ then err_exit "return in script is $ret should be 3" fi cat > $file <<! : line 1 -# next line should fail and cause an exit +# next line should fail and cause an exit : > / exit 4 ! diff --git a/usr/src/lib/libshell/common/tests/select.sh b/usr/src/lib/libshell/common/tests/select.sh index 578fca2e11..2728f85a40 100644 --- a/usr/src/lib/libshell/common/tests/select.sh +++ b/usr/src/lib/libshell/common/tests/select.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -27,10 +27,13 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 -trap "rm -f /tmp/Sh$$*" EXIT + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + PS3='ABC ' -cat > /tmp/Sh$$.1 <<\! +cat > $tmp/1 <<\! 1) foo 2) bar 3) bam @@ -57,7 +60,7 @@ do case $i in ( set -u; : $i ) || err_exit "select: i not set to null" 2>&3 break;; esac -done 3>&2 2> /tmp/Sh$$.2 <<! +done 3>&2 2> $tmp/2 <<! foo ! exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/shtests b/usr/src/lib/libshell/common/tests/shtests index 63b8db0462..37a36c29ef 100644 --- a/usr/src/lib/libshell/common/tests/shtests +++ b/usr/src/lib/libshell/common/tests/shtests @@ -1,13 +1,15 @@ # This program runs ksh regression tests # shtests [ name=value ... ] [ --all | --compile ] [ --time ] [ a.sh b.sh ... ] -unset DISPLAY ENV FIGNORE +timesensitive='*@(options|sigchld|subshell).sh' + +unset DISPLAY ENV FIGNORE HISTFILE LANG=C LC_ALL=C compile=1 script=1 time=1 -vmdebug=1 +vmdebug=a while : do case $1 in -a|--a*)compile=2 @@ -38,9 +40,11 @@ do case $1 in done if [[ ! $vmdebug ]] then unset VMDEBUG -elif [[ ! $VMDEBUG ]] -then export VMDEBUG=a +elif [[ $VMDEBUG ]] +then vmdebug=$VMDEBUG +else export VMDEBUG=$vmdebug fi +[[ $VMDEBUG ]] || timesensitive=. export LANG LC_ALL PATH PWD SHELL PWD=`pwd` SHELL=${SHELL-ksh} @@ -65,9 +69,8 @@ fi if [[ $compile ]] then SHCOMP=${SHCOMP:-shcomp} if whence $SHCOMP > /dev/null - then tmp=/tmp/ksh-$$ - trap 'rm -rf $tmp' EXIT - mkdir $tmp || exit + then tmp=$(mktemp -dt) || { echo mktemp -dt failed >&2; exit 1; } + trap "cd /; rm -rf $tmp" EXIT elif [[ $compile != 1 ]] then echo $0: --compile: $SHCOMP not found >&2 exit 1 @@ -88,6 +91,9 @@ do t=$(grep -c err_exit $i) E=error if [[ $script ]] then echo test $i begins ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} + if [[ $i == $timesensitive ]] + then unset VMDEBUG + fi if $SHELL $i then echo test $i passed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} "[ $t $T 0 ${E}s ]" else e=$? @@ -100,6 +106,9 @@ do t=$(grep -c err_exit $i) fi echo test $i failed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ $t $T $e $E ]" fi + if [[ $i == $timesensitive ]] + then export VMDEBUG=$vmdebug + fi fi done if [[ $compile ]] @@ -114,7 +123,10 @@ then for i in ${*-*.sh} echo test $o begins ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} E=error if $SHCOMP $i > $tmp/$o - then if $SHELL $tmp/$o + then if [[ $i == $timesensitive ]] + then unset VMDEBUG + fi + if $SHELL $tmp/$o then echo test $o passed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} "[ $t $T 0 ${E}s ]" else e=$? if (( e > 256 )) @@ -126,6 +138,9 @@ then for i in ${*-*.sh} fi echo test $o failed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ $t $T $e $E ]" fi + if [[ $i == $timesensitive ]] + then export VMDEBUG=$vmdebug + fi else e=$? t=1 T=test diff --git a/usr/src/lib/libshell/common/tests/sigchld.sh b/usr/src/lib/libshell/common/tests/sigchld.sh index 018eb9fbc0..0b2bf8e03f 100644 --- a/usr/src/lib/libshell/common/tests/sigchld.sh +++ b/usr/src/lib/libshell/common/tests/sigchld.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -59,7 +59,55 @@ print foreground=$foreground background=$background eval $s -(( foreground == FOREGROUND )) || err_exit "expected $FOREGROUND foreground -- got $foreground (DELAY=$DELAY)" -(( background == BACKGROUND )) || err_exit "expected $BACKGROUND background -- got $background (DELAY=$DELAY)" +(( foreground == FOREGROUND )) || err_exit "expected '$FOREGROUND foreground' -- got '$foreground' (DELAY=$DELAY)" +(( background == BACKGROUND )) || err_exit "expected '$BACKGROUND background' -- got '$background' (DELAY=$DELAY)" + +set --noerrexit + +if [[ ${.sh.version} == Version?*([[:upper:]])J* ]] +then + + jobmax=4 + got=$($SHELL -c ' + JOBMAX='$jobmax' JOBCOUNT=$(('$jobmax'*2)) + integer running=0 maxrunning=0 + trap "((running--))" CHLD + for ((i=0; i<JOBCOUNT; i++)) + do sleep 1 & + if ((++running > maxrunning)) + then ((maxrunning=running)) + fi + done + wait + print running=$running maxrunning=$maxrunning + ') + exp='running=0 maxrunning='$jobmax + [[ $got == $exp ]] || err_exit "SIGCHLD trap queueing failed -- expected '$exp', got '$got'" + + got=$($SHELL -c ' + typeset -A proc + + trap " + print \${proc[\$!].name} \${proc[\$!].status} \$? + unset proc[\$!] + " CHLD + + { sleep 3; print a; exit 1; } & + proc[$!]=( name=a status=1 ) + + { sleep 2; print b; exit 2; } & + proc[$!]=( name=b status=2 ) + + { sleep 1; print c; exit 3; } & + proc[$!]=( name=c status=3 ) + + while (( ${#proc[@]} )) + do sleep -s + done + ') + exp='c\nc 3 3\nb\nb 2 2\na\na 1 1' + [[ $got == $exp ]] || err_exit "SIGCHLD trap queueing failed -- expected $(printf %q "$exp"), got $(printf %q "$got")" + +fi exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/signal.sh b/usr/src/lib/libshell/common/tests/signal.sh index 12b06d6fca..bab844fc4d 100644 --- a/usr/src/lib/libshell/common/tests/signal.sh +++ b/usr/src/lib/libshell/common/tests/signal.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -28,14 +28,39 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 -mkdir /tmp/ksh$$ || err_exit "mkdir /tmp/ksh$$ failed" -trap 'cd /; rm -rf /tmp/ksh$$' EXIT -cd /tmp/ksh$$ || err_exit "cd /tmp/ksh$$ failed" +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + +cd $tmp || err_exit "cd $tmp failed" + +( + set --pipefail + { + $SHELL 2> out2 <<- \EOF + g=false + trap 'print -u2 PIPED; $g && exit 0;g=true' PIPE + while : + do print hello + done + EOF + } | head > /dev/null + (( $? == 0)) || err_exit "SIGPIPE with wrong error code $?" + [[ $(<out2) == $'PIPED\nPIPED' ]] || err_exit 'SIGPIPE output on standard error is not correct' +) & +cop=$! +{ sleep 4; kill $cop; } 2>/dev/null & +spy=$! +if wait $cop 2>/dev/null +then kill $spy 2>/dev/null +else err_exit "pipe with --pipefail PIPE trap hangs" +fi +wait +rm -f out2 [[ $( trap 'print -n got_child' SIGCHLD sleep 2 & for ((i=0; i < 4; i++)) - do sleep .9 + do sleep .75 print -n $i done) == 01got_child23 ]] || err_exit 'SIGCHLD not working' @@ -55,7 +80,8 @@ cat > tst <<'!' # # d call next script directly, otherwise via $SHELL -c # t trap, echo, and kill self on SIGINT, otherwise x or SIGINT default if no x -# x trap, echo on SIGINT, and exit 0, otherwise SIGINT default +# x trap, echo on SIGINT, and tst-3 exit 0, tst-2 exit, otherwise SIGINT default +# z trap, echo on SIGINT, and tst-3 exit 0, tst-2 exit 0, otherwise SIGINT default # # Usage: tst [-v] [-options] shell-to-test ... @@ -71,7 +97,7 @@ set -o monitor function gen { typeset o t x d - for x in - x + for x in - x z do case $x in [$1]) for t in - t do case $t in @@ -153,6 +179,11 @@ sleep 2 ! cat > tst-2 <<'!' case $1 in +*z*) trap ' + echo 2-intr + exit 0 + ' INT + ;; *x*) trap ' echo 2-intr exit @@ -176,7 +207,7 @@ printf '2-%04d\n' $status ! cat > tst-3 <<'!' case $1 in -*x*) trap ' +*[xz]*) trap ' sleep 2 echo 3-intr exit 0 @@ -206,10 +237,14 @@ expected[---]="3-intr" expected[--d]="3-intr" expected[-t-]="3-intr 2-intr 1-intr 1-0258" expected[-td]="3-intr 2-intr 1-intr 1-0258" -expected[x--]="3-intr 2-intr 1-0000" -expected[x-d]="3-intr 2-intr 1-0000" -expected[xt-]="3-intr 2-intr 1-intr 1-0000" -expected[xtd]="3-intr 2-intr 1-intr 1-0000" +expected[x--]="3-intr 2-intr" +expected[x-d]="3-intr 2-intr" +expected[xt-]="3-intr 2-intr 1-intr 1-0258" +expected[xtd]="3-intr 2-intr 1-intr 1-0258" +expected[z--]="3-intr 2-intr 1-0000" +expected[z-d]="3-intr 2-intr 1-0000" +expected[zt-]="3-intr 2-intr 1-intr 1-0000" +expected[ztd]="3-intr 2-intr 1-intr 1-0000" tst $SHELL > tst.got @@ -218,9 +253,71 @@ do [[ $out == ${expected[$ops]} ]] || err_exit "interrupt $ops test failed -- ex done < tst.got float s=$SECONDS -[[ $($SHELL -c 'trap "print SIGUSR1 ; exit 0" USR1; (trap "" USR1 ; exec kill -USR1 $$ & sleep 5); print done') == SIGUSR1 ]] || err_exit 'subshell ignoring signal does not send signal to parent' +[[ $($SHELL -c 'trap "print SIGUSR1 ; exit 0" USR1; (trap "" USR1 ; exec kill -USR1 $$ & sleep 5); print done') == SIGUSR1 ]] || err_exit 'subshell ignoring signal does not send signal to parent' (( (SECONDS-s) < 4 )) && err_exit 'parent does not wait for child to complete before handling signal' ((s = SECONDS)) -[[ $($SHELL -c 'trap "print SIGUSR1 ; exit 0" USR1; (trap "exit" USR1 ; exec kill -USR1 $$ & sleep 5); print done') == SIGUSR1 ]] || err_exit 'subshell catching signal does not send signal to parent' +[[ $($SHELL -c 'trap "print SIGUSR1 ; exit 0" USR1; (trap "exit" USR1 ; exec kill -USR1 $$ & sleep 5); print done') == SIGUSR1 ]] || err_exit 'subshell catching signal does not send signal to parent' (( SECONDS-s < 4 )) && err_exit 'parent completes early' + +unset n s t +for s in $(kill -l) +do if ! n=$(kill -l $s 2>/dev/null) + then err_exit "'kill -l $s' failed" + continue + fi + if ! t=$(kill -l $n 2>/dev/null) + then err_exit "'kill -l $n' failed" + continue + fi + if [[ $s == ?(SIG)$t ]] + then continue + fi + if ! m=$(kill -l $t 2>/dev/null) + then err_exit "'kill -l $t' failed" + continue + fi + if [[ $m == $n ]] + then continue + fi + err_exit "'kill -l $s' => $n, 'kill -l $n' => $t, kill -l $t => $m -- expected $n" +done +yes=$(whence -p yes) +[[ $yes ]] && for exp in TERM VTALRM PIPE +do { $SHELL <<- EOF + foo() { return 0; } + trap foo EXIT + { sleep 2; kill -$exp \$\$; sleep 3; kill -0 \$\$ && kill -KILL \$\$; } & + $yes | while read yes; do + (/bin/date; sleep .1) + done > /dev/null + EOF + } 2>> /dev/null + got=$(kill -l $?) + [[ $exp == $got ]] || err_exit "kill -$exp \$\$ failed, required termination by signal '$got'" +done + +SECONDS=0 +$SHELL 2> /dev/null -c 'sleep 2 && kill $$ & trap "print done;exit 3" EXIT; (sleep 5);print finished' > $tmp/sig +(( $?==3)) || err_exit "wrong exit status expecting 3 got $?" +x=$(<$tmp/sig) +[[ $x == done ]] || err_exit "wrong result - execting done got $x" +(( SECONDS > 3.5 )) && err_exit "took $SECONDS seconds, expecting around 2" + +SECONDS=0 +{ $SHELL 2> /dev/null -c 'sleep 2 && kill $$ & trap "print done;exit" EXIT; (sleep 5);print finished' > $tmp/sig ;} 2> /dev/null +[[ $(kill -l $?) == TERM ]] || err_exit "wrong exit status expecting TERM got $(kill -l $?)" +x=$(<$tmp/sig) +[[ $x == done ]] || err_exit "wrong result - execting done got $x" +(( SECONDS > 3.5 )) && err_exit "took $SECONDS seconds, expecting around 2" + +SECONDS=0 +x=$($SHELL 2> /dev/null -c 'sleep 2 && kill $$ & trap "print done;exit 3" EXIT; (sleep 5);print finished') +(( $?==3)) || err_exit "wrong exit status expecting 3 got $?" +[[ $x == done ]] || err_exit "wrong result - execting done got $x" +(( SECONDS < 4 )) && err_exit "took $SECONDS seconds, expecting around 5" + +trap '' SIGBUS +[[ $($SHELL -c 'trap date SIGBUS;trap -p SIGBUS') ]] && err_exit 'SIGBUS should not have a trap' +trap -- - SIGBUS + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/statics.sh b/usr/src/lib/libshell/common/tests/statics.sh index d6af9c7c91..21175c08db 100644 --- a/usr/src/lib/libshell/common/tests/statics.sh +++ b/usr/src/lib/libshell/common/tests/statics.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -30,9 +30,9 @@ function testfunc typeset cmd="$2" typeset expected_output="$3" typeset output - + output="$($SHELL -c "${cmd}" 2>&1 )" - + [[ "${output}" != "${expected_output}" ]] && err_exit2 ${line_number} "${output} != ${expected_output}" } alias testfunc='testfunc $LINENO' @@ -60,9 +60,9 @@ testfunc '(function l { float -S x=0.5 ; (( x+=.5 )) ; $1 && print "$x" ; } ; function l { typeset -S s=( a=0 b=0 ) - + (( s.a++, s.b++ )) - + $1 && printf 'a=%d, b=%d\n' s.a s.b } l false ; l false ; l true @@ -75,9 +75,9 @@ got=$( function ar { typeset -a -S s=( "hello" ) - + s+=( "an element" ) - + $1 && { printf '%s' "${s[@]}" ; printf '\n' ; } } ar false ; ar false ; ar true diff --git a/usr/src/lib/libshell/common/tests/subshell.sh b/usr/src/lib/libshell/common/tests/subshell.sh index 985aba6eaa..bc63bde995 100644 --- a/usr/src/lib/libshell/common/tests/subshell.sh +++ b/usr/src/lib/libshell/common/tests/subshell.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -24,9 +24,15 @@ function err_exit (( Errors+=1 )) } alias err_exit='err_exit $LINENO' + Command=${0##*/} integer Errors=0 Error_fd=2 +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + +bincat=$(PATH=$(getconf PATH) whence -p cat) + z=() z.foo=( [one]=hello [two]=(x=3 y=4) [three]=hi) z.bar[0]=hello @@ -70,7 +76,7 @@ false [[ ${z.bar[1]} == yes ]] || err_exit 'index array assignment to compound variable in subshell not working' ) [[ $z == "$val" ]] || err_exit 'compound variable changes after associative array assignment' - + x=( foo=( qqq=abc rrr=def) bar=( zzz=no rst=fed) @@ -97,8 +103,6 @@ while whence $TEST_notfound >/dev/null 2>&1 do TEST_notfound=notfound-$RANDOM done -tmp=/tmp/kshsubsh$$ -trap "rm -f $tmp" EXIT integer BS=1024 nb=64 ss=60 bs no for bs in $BS 1 do $SHELL -c ' @@ -109,8 +113,8 @@ do $SHELL -c ' set -- $(printf %.'$(($BS*$nb))'c x | dd bs='$bs') print ${#1} kill $! - ' > $tmp 2>/dev/null - no=$(<$tmp) + ' > $tmp/sub 2>/dev/null + no=$(<$tmp/sub) (( no == (BS * nb) )) || err_exit "shell hangs on command substitution output size >= $BS*$nb with write size $bs -- expected $((BS*nb)), got ${no:-0}" done # this time with redirection on the trailing command @@ -124,8 +128,8 @@ do $SHELL -c ' set -- $(printf %.'$(($BS*$nb))'c x | dd bs='$bs' 2>/dev/null) print ${#1} kill $! - ' > $tmp 2>/dev/null - no=$(<$tmp) + ' > $tmp/sub 2>/dev/null + no=$(<$tmp/sub) (( no == (BS * nb) )) || err_exit "shell hangs on command substitution output size >= $BS*$nb with write size $bs and trailing redirection -- expected $((BS*nb)), got ${no:-0}" done @@ -220,4 +224,230 @@ do for TEST_exec in '' 'exec' done done +$SHELL -c '( autoload xxxxx);print -n' || err_exit 'autoloaded functions in subshells can cause failure' +foo=$($SHELL <<- ++EOF++ + (trap 'print bar' EXIT;print -n foo) + ++EOF++ +) +[[ $foo == foobar ]] || err_exit 'trap on exit when last commands is subshell is not triggered' + +err=$( + $SHELL 2>&1 <<- \EOF + date=$(whence -p date) + function foo + { + x=$( $date > /dev/null 2>&1 ;:) + } + # consume almost all fds to push the test to the fd limit # + integer max=$(ulimit --nofile) + (( max -= 6 )) + for ((i=20; i < max; i++)) + do exec {i}>&1 + done + for ((i=0; i < 20; i++)) + do y=$(foo) + done + EOF +) || { + err=${err%%$'\n'*} + err=${err#*:} + err=${err##[[:space:]]} + err_exit "nested command substitution with redirections failed -- $err" +} + +exp=0 +$SHELL -c $' + function foobar + { + print "hello world" + } + [[ $(getopts \'[+?X\ffoobar\fX]\' v --man 2>&1) == *"Xhello worldX"* ]] + exit '$exp$' +' +got=$? +[[ $got == $exp ]] || err_exit "getopts --man runtime callout with nonzero exit terminates shell -- expected '$exp', got '$got'" +exp=ok +got=$($SHELL -c $' + function foobar + { + print "hello world" + } + [[ $(getopts \'[+?X\ffoobar\fX]\' v --man 2>&1) == *"Xhello worldX"* ]] + print '$exp$' +') +[[ $got == $exp ]] || err_exit "getopts --man runtime callout with nonzero exit terminates shell -- expected '$exp', got '$got'" + +# command substitution variations # +set -- \ + '$(' ')' \ + '${ ' '; }' \ + '$(ulimit -c 0; ' ')' \ + '$( (' ') )' \ + '${ (' '); }' \ + '`' '`' \ + '`(' ')`' \ + '`ulimit -c 0; ' '`' \ + # end of table # +exp=ok +testcase[1]=' + if %sexpr "NOMATCH" : ".*Z" >/dev/null%s + then print error + else print ok + fi + exit %s +' +testcase[2]=' + function bar + { + pipeout=%1$sprintf Ok | tr O o%2$s + print $pipeout + return 0 + } + foo=%1$sbar%2$s || foo="exit status $?" + print $foo + exit %3$s +' +while (( $# >= 2 )) +do for ((TEST=1; TEST<=${#testcase[@]}; TEST++)) + do body=${testcase[TEST]} + for code in 0 2 + do got=${ printf "$body" "$1" "$2" "$code" | $SHELL 2>&1 } + status=$? + if (( status != code )) + then err_exit "test $TEST '$1...$2 exit $code' failed -- exit status $status, expected $code" + elif [[ $got != $exp ]] + then err_exit "test $TEST '$1...$2 exit $code' failed -- got '$got', expected '$exp'" + fi + done + done + shift 2 +done + +# the next tests loop on all combinations of +# { SUB CAT INS TST APP } X { file-sizes } +# where the file size starts at 1Ki and doubles up to and including 1Mi +# +# the tests and timeouts are done in async subshells to prevent +# the test harness from hanging + +SUB=( + ( BEG='$( ' END=' )' ) + ( BEG='${ ' END='; }' ) +) +CAT=( cat $bincat ) +INS=( "" "builtin cat; " "builtin -d cat $bincat; " ": > /dev/null; " ) +APP=( "" "; :" ) +TST=( + ( CMD='print foo | $cat' EXP=3 ) + ( CMD='$cat < $tmp/lin' ) + ( CMD='cat $tmp/lin | $cat' ) + ( CMD='read v < $tmp/buf; print $v' LIM=4*1024 ) + ( CMD='cat $tmp/buf | read v; print $v' LIM=4*1024 ) +) + +command exec 3<> /dev/null +if cat /dev/fd/3 >/dev/null 2>&1 +then T=${#TST[@]} + TST[T].CMD='$cat <(print foo)' + TST[T].EXP=3 +fi + +# prime the two data files to 512 bytes each +# $tmp/lin has newlines every 16 bytes and $tmp/buf has no newlines +# the outer loop doubles the file size at top + +buf=$'1234567890abcdef' +lin=$'\n1234567890abcde' +for ((i=0; i<5; i++)) +do buf=$buf$buf + lin=$lin$lin +done +print -n "$buf" > $tmp/buf +print -n "$lin" > $tmp/lin + +unset SKIP +for ((n=1024; n<=1024*1024; n*=2)) +do cat $tmp/buf $tmp/buf > $tmp/tmp + mv $tmp/tmp $tmp/buf + cat $tmp/lin $tmp/lin > $tmp/tmp + mv $tmp/tmp $tmp/lin + for ((S=0; S<${#SUB[@]}; S++)) + do for ((C=0; C<${#CAT[@]}; C++)) + do cat=${CAT[C]} + for ((I=0; I<${#INS[@]}; I++)) + do for ((A=0; A<${#APP[@]}; A++)) + do for ((T=0; T<${#TST[@]}; T++)) + do #undent...# + + if [[ ! ${SKIP[S][C][I][A][T]} ]] + then eval "{ x=${SUB[S].BEG}${INS[I]}${TST[T].CMD}${APP[A]}${SUB[S].END}; print \${#x}; } >\$tmp/out &" + m=$! + { sleep 4; kill -9 $m; } & + k=$! + wait $m + h=$? + kill -9 $k + wait $k + got=$(<$tmp/out) + if [[ ! $got ]] && (( h )) + then got=HUNG + fi + if [[ ${TST[T].EXP} ]] + then exp=${TST[T].EXP} + else exp=$n + fi + if [[ $got != $exp ]] + then # on failure skip similar tests on larger files sizes # + SKIP[S][C][I][A][T]=1 + siz=$(printf $'%#i' $exp) + cmd=${TST[T].CMD//\$cat/$cat} + cmd=${cmd//\$tmp\/buf/$siz.buf} + cmd=${cmd//\$tmp\/lin/$siz.lin} + err_exit "'x=${SUB[S].BEG}${INS[I]}${cmd}${APP[A]}${SUB[S].END} && print \${#x}' failed -- expected '$exp', got '$got'" + elif [[ ${TST[T].EXP} ]] || (( TST[T].LIM >= n )) + then SKIP[S][C][I][A][T]=1 + fi + fi + + #...indent# + done + done + done + done + done +done + +# specifics -- there's more? + +{ + cmd='{ exec 5>/dev/null; print "$(eval ls -d . 2>&1 1>&5)"; } >$tmp/out &' + eval $cmd + m=$! + { sleep 4; kill -9 $m; } & + k=$! + wait $m + h=$? + kill -9 $k + wait $k + got=$(<$tmp/out) +} 2>/dev/null +exp='' +if [[ ! $got ]] && (( h )) +then got=HUNG +fi +if [[ $got != $exp ]] +then err_exit "eval '$cmd' failed -- expected '$exp', got '$got'" +fi + +float t1=$SECONDS +sleep=$(whence -p sleep) +if [[ $sleep ]] +then + $SHELL -c "( $sleep 5 </dev/null >/dev/null 2>&1 & );exit 0" | cat + (( (SECONDS-t1) > 4 )) && err_exit '/bin/sleep& in subshell hanging' + ((t1=SECONDS)) +fi +$SHELL -c '( sleep 5 </dev/null >/dev/null 2>&1 & );exit 0' | cat +(( (SECONDS-t1) > 4 )) && err_exit 'sleep& in subshell hanging' + exit $Errors diff --git a/usr/src/lib/libshell/common/tests/substring.sh b/usr/src/lib/libshell/common/tests/substring.sh index 8d283c6a29..0d7fc384a7 100644 --- a/usr/src/lib/libshell/common/tests/substring.sh +++ b/usr/src/lib/libshell/common/tests/substring.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -192,7 +192,7 @@ fi if [[ ${foo//\//_} != one_two_three ]] then err_exit 'escaping / in replacements failed' fi -function myexport +function myexport { nameref var=$1 if (( $# > 1 )) @@ -205,7 +205,7 @@ function myexport typeset val val=$(export | grep "^$1=") print ${val#"$1="} - + } export dgk=base if [[ $(myexport dgk fun) != fun ]] @@ -280,7 +280,7 @@ b='[abc 123 def]' [[ ${b//$a/\1} == 123 ]] || err_exit "\${var/pattern} not working with \[ in pattern" unset foo foo='(win32.i386) ' -[[ ${foo/'('/'(x11-'} == '(x11-win32.i386) ' ]] || err_exit "\${var/pattern} not working with ' in pattern" +[[ ${foo/'('/'(x11-'} == '(x11-win32.i386) ' ]] || err_exit "\${var/pattern} not working with ' in pattern" $SHELL -c $'v=\'$(hello)\'; [[ ${v//\'$(\'/-I\'$(\'} == -I"$v" ]]' 2> /dev/null || err_exit "\${var/pattern} not working with \$( as pattern" unset X $SHELL -c '[[ ! ${X[@]:0:300} ]]' 2> /dev/null || err_exit '${X[@]:0:300} with X undefined fails' @@ -303,7 +303,7 @@ done [[ $(string=$string $SHELL -c ": \${string/$pattern/}; print \${.sh.match[26]}") == Z ]] || err_exit -u2 'sh.match[26] not Z' : ${string/$pattern/} (( ${#.sh.match[@]} == 53 )) || err_exit '.sh.match has wrong number of elements' -[[ ${.sh.match[@]:2:4} == 'B C D E' ]] || err_exit '${.sh.match[@]:2:4} incorrect' +[[ ${.sh.match[@]:2:4} == 'B C D E' ]] || err_exit '${.sh.match[@]:2:4} incorrect' D=$';' E=$'\\\\' Q=$'"' S=$'\'' M='nested pattern substitution failed' @@ -501,7 +501,7 @@ pattern=00 var=100 [[ $( print $(( ${var%%00} )) ) == 1 ]] || err_exit "arithmetic with embeddded patterns fails" [[ $( print $(( ${var%%$pattern} )) ) == 1 ]] || err_exit "arithmetic with embeddded pattern variables fails" -if [[ ax == @(a)* ]] && [[ ${.sh.match[1]:0:${#.sh.match[1]}} != a ]] +if [[ ax == @(a)* ]] && [[ ${.sh.match[1]:0:${#.sh.match[1]}} != a ]] then err_exit '${.sh.match[1]:1:${#.sh.match[1]}} not expanding correctly' fi @@ -509,10 +509,10 @@ string='foo(d:\nt\box\something)bar' expected='d:\nt\box\something' [[ ${string/*\(+([!\)])\)*/\1} == "$expected" ]] || err_exit "substring expansion failed '${string/*\(+([!\)])\)*/\1}' returned -- '$expected' expected" if [[ $($SHELL -c $'export LC_ALL=en_US.UTF-8; print -r "\342\202\254\342\202\254\342\202\254\342\202\254w\342\202\254\342\202\254\342\202\254\342\202\254" | wc -m' 2>/dev/null) == 10 ]] -then LC_ALL=en_US.UTF-8 $SHELL -c b1=$'"\342\202\254\342\202\254\342\202\254\342\202\254w\342\202\254\342\202\254\342\202\254\342\202\254"; [[ ${b1:4:1} == w ]]' || err_exit 'Multibyte ${var:offset:len} not working correctly' +then LC_ALL=en_US.UTF-8 $SHELL -c b1=$'"\342\202\254\342\202\254\342\202\254\342\202\254w\342\202\254\342\202\254\342\202\254\342\202\254"; [[ ${b1:4:1} == w ]]' || err_exit 'multibyte ${var:offset:len} not working correctly' fi -{ $SHELL -c 'unset x;[[ ${SHELL:$x} == $SHELL ]]';} 2> /dev/null || err_exit '${var:$x} fails when x is not set' -{ $SHELL -c 'x=;[[ ${SHELL:$x} == $SHELL ]]';} 2> /dev/null || err_exit '${var:$x} fails when x is null' +{ $SHELL -c 'unset x;[[ ${SHELL:$x} == $SHELL ]]';} 2> /dev/null || err_exit '${var:$x} fails when x is not set' +{ $SHELL -c 'x=;[[ ${SHELL:$x} == $SHELL ]]';} 2> /dev/null || err_exit '${var:$x} fails when x is null' # subject mode pattern result # set -- \ diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_array_default_datatype.sh b/usr/src/lib/libshell/common/tests/sun_solaris_array_default_datatype.sh new file mode 100644 index 0000000000..45b3851f19 --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_array_default_datatype.sh @@ -0,0 +1,303 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test module checks whether indexed+associative arrays +# set the default datatype correctly if someone uses the "+=" +# operator to add a value to an array element which does not +# exist yet. +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +# the test cannot use "nounset" +Command=${0##*/} +integer Errors=0 + +compound bracketstat=( + integer bopen=0 + integer bclose=0 +) + +function count_brackets +{ + typeset x="$1" + typeset c + + integer i + (( bracketstat.bopen=0 , bracketstat.bclose=0 )) + + for (( i=0 ; i < ${#x} ; i++ )) ; do + c="${x:i:1}" + [[ "$c" == "(" ]] && (( bracketstat.bopen++ )) + [[ "$c" == ")" ]] && (( bracketstat.bclose++ )) + done + + (( bracketstat.bopen != bracketstat.bclose )) && return 1 + + return 0 +} + +# function to add the floating-point value 1.1 to array element "34" +# floating-point datatypes should increment by 1.1, integers by 1 +function add_float +{ + nameref arr=$1 + + arr[34]+=1.1 + + return 0 +} + +# function to add a compound variable called "val" to array element arr[34] +function add_compound +{ + nameref arr=$1 + + arr[34]+=( float val=1.1 ) + + return 0 +} + +# We run the tests in multiple cyles: +# First cycle uses a normal compound variable as basis +# Second cycle uses a nameref to a compound variable as basis +# Third cycle uses a nameref to a nameref to a compound variable as basis +for cycle in \ + c1 c2 c3 c4 \ + c2_sub c3_sub c4_sub \ + c2_indexed_array c3_indexed_array c4_indexed_array \ + c2_associative_array c3_associative_array c4_associative_array; do + case ${cycle} in + c1) + compound mycpv + ;; + c2) + compound rootcpv + nameref mycpv=rootcpv + ;; + c3) + compound rootcpv + nameref namereftoroot=rootcpv + nameref mycpv=namereftoroot + ;; + c4) + compound rootcpv + nameref namereftoroot0=rootcpv + nameref namereftoroot1=namereftoroot0 + nameref mycpv=namereftoroot1 + ;; + # same as cX but uses a subvariable of rootcpv + c2_sub) + compound rootcpv + compound rootcpv.sub + nameref mycpv=rootcpv.sub + ;; + c3_sub) + compound rootcpv + compound rootcpv.sub + nameref namereftoroot=rootcpv.sub + nameref mycpv=namereftoroot + ;; + c4_sub) + compound rootcpv + compound rootcpv.sub + nameref namereftoroot0=rootcpv.sub + nameref namereftoroot1=namereftoroot0 + nameref mycpv=namereftoroot1 + ;; + # same as cX but uses a subvariable of an indexed array + c2_indexed_array) + compound -a rootcpv + nameref mycpv=rootcpv[4] + ;; + c3_indexed_array) + compound -a rootcpv + nameref namereftoroot=rootcpv[4] + nameref mycpv=namereftoroot + ;; + c4_indexed_array) + compound -a rootcpv + nameref namereftoroot0=rootcpv[4] + nameref namereftoroot1=namereftoroot0 + nameref mycpv=namereftoroot1 + ;; + # same as cX but uses a subvariable of an indexed array + c2_associative_array) + compound -A rootcpv + nameref mycpv=rootcpv["hello world"] + ;; + c3_associative_array) + compound -A rootcpv + nameref namereftoroot=rootcpv["hello world"] + nameref mycpv=namereftoroot + ;; + c4_associative_array) + compound -A rootcpv + nameref namereftoroot0=rootcpv["hello world"] + nameref namereftoroot1=namereftoroot0 + nameref mycpv=namereftoroot1 + ;; + *) + err_exit "${cycle}: Should not happen." + ;; + esac + + + # Test 001: Test indexed floating-point array + float -a mycpv.myindexedfloatarray + + add_float mycpv.myindexedfloatarray + (( mycpv.myindexedfloatarray[34] == 1.1 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] == ${mycpv.myindexedfloatarray[34]}, expected 1.1" + add_float mycpv.myindexedfloatarray + (( mycpv.myindexedfloatarray[34] == 2.2 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] == ${mycpv.myindexedfloatarray[34]}, expected 2.2" + unset mycpv.myindexedfloatarray[34] + (( mycpv.myindexedfloatarray[34] == 0.0 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] == ${mycpv.myindexedfloatarray[34]}, expected 0.0" + + # 2nd try (we do this to check whether "unset" works properly) + add_float mycpv.myindexedfloatarray + (( mycpv.myindexedfloatarray[34] == 1.1 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] == ${mycpv.myindexedfloatarray[34]}, expected 1.1" + add_float mycpv.myindexedfloatarray + (( mycpv.myindexedfloatarray[34] == 2.2 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] == ${mycpv.myindexedfloatarray[34]}, expected 2.2" + unset mycpv.myindexedfloatarray[34] + (( mycpv.myindexedfloatarray[34] == 0.0 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] == ${mycpv.myindexedfloatarray[34]}, expected 0.0" + + + + # Test 002: Test associative floating-point array + float -A mycpv.myassociativefloatarray + add_float mycpv.myassociativefloatarray + (( mycpv.myassociativefloatarray[34] == 1.1 )) || err_exit "${cycle}: mycpv.myassociativefloatarray[34] == ${mycpv.myassociativefloatarray[34]}, expected 1.1" + add_float mycpv.myassociativefloatarray + (( mycpv.myassociativefloatarray[34] == 2.2 )) || err_exit "${cycle}: mycpv.myassociativefloatarray[34] == ${mycpv.myassociativefloatarray[34]}, expected 2.2" + unset mycpv.myassociativefloatarray[34] + (( mycpv.myassociativefloatarray[34] == 0.0 )) || err_exit "${cycle}: mycpv.myassociativefloatarray[34] == ${mycpv.myassociativefloatarray[34]}, expected 0.0" + + # 2nd try (we do this to check whether "unset" works properly) + add_float mycpv.myassociativefloatarray + (( mycpv.myassociativefloatarray[34] == 1.1 )) || err_exit "${cycle}: mycpv.myassociativefloatarray[34] == ${mycpv.myassociativefloatarray[34]}, expected 1.1" + add_float mycpv.myassociativefloatarray + (( mycpv.myassociativefloatarray[34] == 2.2 )) || err_exit "${cycle}: mycpv.myassociativefloatarray[34] == ${mycpv.myassociativefloatarray[34]}, expected 2.2" + unset mycpv.myassociativefloatarray[34] + (( mycpv.myassociativefloatarray[34] == 0.0 )) || err_exit "${cycle}: mycpv.myassociativefloatarray[34] == ${mycpv.myassociativefloatarray[34]}, expected 0.0" + + + + # Test 003: Test indexed integer array + integer -a mycpv.myindexedintegerarray + + add_float mycpv.myindexedintegerarray + (( mycpv.myindexedintegerarray[34] == 1 )) || err_exit "${cycle}: mycpv.myindexedintegerarray[34] == ${mycpv.myindexedintegerarray[34]}, expected 1" + add_float mycpv.myindexedintegerarray + (( mycpv.myindexedintegerarray[34] == 2 )) || err_exit "${cycle}: mycpv.myindexedintegerarray[34] == ${mycpv.myindexedintegerarray[34]}, expected 2" + unset mycpv.myindexedintegerarray[34] + (( mycpv.myindexedintegerarray[34] == 0 )) || err_exit "${cycle}: mycpv.myindexedintegerarray[34] == ${mycpv.myindexedintegerarray[34]}, expected 0" + + # 2nd try (we do this to check whether "unset" works properly) + add_float mycpv.myindexedintegerarray + (( mycpv.myindexedintegerarray[34] == 1 )) || err_exit "${cycle}: mycpv.myindexedintegerarray[34] == ${mycpv.myindexedintegerarray[34]}, expected 1" + add_float mycpv.myindexedintegerarray + (( mycpv.myindexedintegerarray[34] == 2 )) || err_exit "${cycle}: mycpv.myindexedintegerarray[34] == ${mycpv.myindexedintegerarray[34]}, expected 2" + unset mycpv.myindexedintegerarray[34] + (( mycpv.myindexedintegerarray[34] == 0 )) || err_exit "${cycle}: mycpv.myindexedintegerarray[34] == ${mycpv.myindexedintegerarray[34]}, expected 0" + + + + # Test 004: Test associative integer array + integer -A mycpv.myassociativeintegerarray + + add_float mycpv.myassociativeintegerarray + (( mycpv.myassociativeintegerarray[34] == 1 )) || err_exit "${cycle}: mycpv.myassociativeintegerarray[34] == ${mycpv.myassociativeintegerarray[34]}, expected 1" + add_float mycpv.myassociativeintegerarray + (( mycpv.myassociativeintegerarray[34] == 2 )) || err_exit "${cycle}: mycpv.myassociativeintegerarray[34] == ${mycpv.myassociativeintegerarray[34]}, expected 2" + unset mycpv.myassociativeintegerarray[34] + (( mycpv.myassociativeintegerarray[34] == 0 )) || err_exit "${cycle}: mycpv.myassociativeintegerarray[34] == ${mycpv.myassociativeintegerarray[34]}, expected 0" + + # 2nd try (we do this to check whether "unset" works properly) + add_float mycpv.myassociativeintegerarray + (( mycpv.myassociativeintegerarray[34] == 1 )) || err_exit "${cycle}: mycpv.myassociativeintegerarray[34] == ${mycpv.myassociativeintegerarray[34]}, expected 1" + add_float mycpv.myassociativeintegerarray + (( mycpv.myassociativeintegerarray[34] == 2 )) || err_exit "${cycle}: mycpv.myassociativeintegerarray[34] == ${mycpv.myassociativeintegerarray[34]}, expected 2" + unset mycpv.myassociativeintegerarray[34] + (( mycpv.myassociativeintegerarray[34] == 0 )) || err_exit "${cycle}: mycpv.myassociativeintegerarray[34] == ${mycpv.myassociativeintegerarray[34]}, expected 0" + + + + # Test 005: Tested indexed compound variable array + compound -a mycpv.myindexedcompoundarray + add_compound mycpv.myindexedcompoundarray + (( mycpv.myindexedcompoundarray[34].val == 1.1 )) || err_exit "${cycle}: mycpv.myindexedcompoundarray[34].val == ${mycpv.myindexedcompoundarray[34].val}, expected 1.1" + # try to add it a 2nd time - since the new element will replace the old + # one the value will _not_ be incremented (or better: The compound + # variable value "val" will be added, not the value of the "val" + # variable) + add_compound mycpv.myindexedcompoundarray + (( mycpv.myindexedcompoundarray[34].val == 1.1 )) || err_exit "${cycle}: mycpv.myindexedcompoundarray[34].val == ${mycpv.myindexedcompoundarray[34].val}, expected 1.1" + unset mycpv.myindexedcompoundarray[34] + [[ ! -v mycpv.myindexedcompoundarray[34].val ]] || err_exit "${cycle}: [[ ! -v mycpv.myindexedcompoundarray[34].val ]] should return failure, got $?" + (( mycpv.myindexedcompoundarray[34].val == 0.0 )) || err_exit "${cycle}: mycpv.myindexedcompoundarray[34].val == ${mycpv.myindexedcompoundarray[34].val}, expected 0.0" + [[ "${mycpv.myindexedcompoundarray[34]}" == "" ]] || err_exit "${cycle}: mycpv.myindexedcompoundarray[34] expected to be equal to an empty string but contains |${mycpv.myindexedcompoundarray[34]}|" + + + + # Test 006: Tested associative compound variable array + compound -A mycpv.myassociativecompoundarray + add_compound mycpv.myassociativecompoundarray + (( mycpv.myassociativecompoundarray[34].val == 1.1 )) || err_exit "${cycle}: mycpv.myassociativecompoundarray[34].val == ${mycpv.myassociativecompoundarray[34].val}, expected 1.1" + # try to add it a 2nd time - since the new element will replace the old + # one the value will _not_ be incremented (or better: The compound + # variable value "val" will be added, not the value of the "val" + # variable) + add_compound mycpv.myassociativecompoundarray + (( mycpv.myassociativecompoundarray[34].val == 1.1 )) || err_exit "${cycle}: mycpv.myassociativecompoundarray[34].val == ${mycpv.myassociativecompoundarray[34].val}, expected 1.1" + unset mycpv.myassociativecompoundarray[34] + [[ ! -v mycpv.myassociativecompoundarray[34].val ]] || err_exit "${cycle}: [[ ! -v mycpv.myassociativecompoundarray[34].val ]] should return failure, got $?" + (( mycpv.myassociativecompoundarray[34].val == 0.0 )) || err_exit "${cycle}: mycpv.myassociativecompoundarray[34].val == ${mycpv.myassociativecompoundarray[34].val}, expected 0.0" + [[ "${mycpv.myassociativecompoundarray[34]}" == "" ]] || err_exit "${cycle}: mycpv.myassociativecompoundarray[34] expected to be equal to an empty string but contains |${mycpv.myassociativecompoundarray[34]}|" + + + # check whether the compound variable output is still Ok + count_brackets "${mycpv}" || err_exit "${cycle}: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" + count_brackets "$(print -v mycpv)" || err_exit "${cycle}: print -v mycpy: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" + count_brackets "$(print -C mycpv)" || err_exit "${cycle}: print -C mycpy: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" + + + # reset + unset mycpv + [[ ! -v mycpv ]] || err_exit "${cycle}: mycpy should not exist" + [[ "${mycpv}" == "" ]] || err_exit "${cycle}: mycpv expected to be empty" +done + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_builtin_poll.sh b/usr/src/lib/libshell/common/tests/sun_solaris_builtin_poll.sh new file mode 100644 index 0000000000..5dc5f5cce1 --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_builtin_poll.sh @@ -0,0 +1,72 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Test whether the ksh93/poll builtin works as expected +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + + +builtin -f libshell.so.1 poll || err_exit "poll builtin not found." + +compound d1=( + compound -A u=( + [y]=( fd=5 events="POLLIN" revents="" ) + [x]=( fd=5 events="POLLIN" revents="" ) + ) +) + +# test 1: +cat /dev/zero | { redirect 5<&0 ; poll -e d1.res -t 5. d1.u ; } || err_exit "poll returned non-zero exit code $?" +[[ "${d1.u[x].revents}" == "POLLIN" ]] || err_exit "d1.u[x].revents contains '${d1.u[x].revents}', not POLLIN" +[[ "${d1.u[y].revents}" == "POLLIN" ]] || err_exit "d1.u[y].revents contains '${d1.u[y].revents}', not POLLIN" +[[ "${d1.res[*]}" == "x y" ]] || err_exit "d1.res contains '${d1.res[*]}', not 'x y'" + +# test 2: +unset d1.res + +d1.u[z]=( fd=5 events="POLLOUT" revents="" ) +{ poll -e d1.res -t 5. d1.u ; } 5</dev/null 5>/dev/null || err_exit "poll returned non-zero exit code $?" +[[ "${d1.u[x].revents}" == "POLLIN" ]] || err_exit "d1.u[x].revents contains '${d1.u[x].revents}', not 'POLLIN'" +[[ "${d1.u[y].revents}" == "POLLIN" ]] || err_exit "d1.u[y].revents contains '${d1.u[y].revents}', not 'POLLIN'" +[[ "${d1.u[z].revents}" == "POLLOUT|POLLWRNORM" ]] || err_exit "d1.u[z].revents contains '${d1.u[z].revents}', not 'POLLOUT|POLLWRNORM,'" +[[ "${d1.res[*]}" == "x y z" ]] || err_exit "d1.res contains '${d1.res[*]}', not 'x y z'" + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_builtin_sum.sh b/usr/src/lib/libshell/common/tests/sun_solaris_builtin_sum.sh index d2dc6db883..e80111a538 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_builtin_sum.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_builtin_sum.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -29,6 +29,7 @@ # Solaris/SystemV /usr/bin/sum # +# test setup function err_exit { print -u2 -n "\t" @@ -37,9 +38,11 @@ function err_exit } alias err_exit='err_exit $LINENO' +set -o nounset Command=${0##*/} integer Errors=0 + typeset x builtin sum || err_exit "sum builtin not found" diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_builtin_tail.sh b/usr/src/lib/libshell/common/tests/sun_solaris_builtin_tail.sh new file mode 100644 index 0000000000..69a7f1a6b9 --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_builtin_tail.sh @@ -0,0 +1,446 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Test whether the ksh93/libcmd tail builtin is compatible to +# Solaris/SystemV { /usr/bin/tail, /usr/xpg4/bin/tail } and +# POSIX "tail" +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + +# common functions +function isvalidpid +{ + kill -0 ${1} 2>/dev/null && return 0 + return 1 +} + +function waitpidtimeout +{ + integer pid=$1 + float timeout=$2 + float i + float -r STEP=0.5 # const + + (( timeout=timeout/STEP )) + + for (( i=0 ; i < timeout ; i+=STEP )) ; do + isvalidpid ${pid} || break + sleep ${STEP} + done + + return 0 +} + +function myintseq +{ + integer i + float arg1=$1 + float arg2=$2 + float arg3=$3 + + case $# in + 1) + for (( i=1 ; i <= arg1 ; i++ )) ; do + printf "%d\n" i + done + ;; + 2) + for (( i=arg1 ; i <= arg2 ; i++ )) ; do + printf "%d\n" i + done + ;; + 3) + for (( i=arg1 ; i <= arg3 ; i+=arg2 )) ; do + printf "%d\n" i + done + ;; + *) + print -u2 -f "%s: Illegal number of arguments %d\n" "$0" $# + return 1 + ;; + esac + + return 0 +} + +# quote input string but use double-backslash that "err_exit" prints +# the strings correctly +function doublebackslashquote +{ + typeset s + s="$(printf "%q\n" "$1")" + s="${s//\\/\\\\}" + print -r "$s" + return 0 +} + + +# main +builtin mktemp || err_exit "mktemp builtin not found" +builtin rm || err_exit "rm builtin not found" +builtin tail || err_exit "tail builtin not found" + +typeset ocwd +typeset tmpdir + +# create temporary test directory +ocwd="$PWD" +tmpdir="$(mktemp -d "test_sun_solaris_builtin_tail.XXXXXXXX")" || err_exit "Cannot create temporary directory" + +cd "${tmpdir}" || err_exit "cd ${tmpdir} failed." + + +# run tests: + +# test1: basic tests +compound -a testcases=( + ( + name="reverse_n" + input=$'hello\nworld' + compound -A tail_args=( + [legacy]=( argv=( "-r" ) ) + ) + expected_output=$'world\nhello' + ) + ( + name="revlist0n" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "-0" ) ) + [std_like]=( argv=( "-n" "0" ) ) + ) + expected_output=$'' + ) + ( + name="revlist0nr" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "-0r" ) ) + [std_like]=( argv=( "-n" "0" "-r" ) ) + [long_options]=( argv=( "--lines" "0" "--reverse" ) ) + ) + expected_output=$'' ) + ( + name="revlist1n" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "-1" ) ) + [std_like]=( argv=( "-n" "1" ) ) + [long_options]=( argv=( "--lines" "1" ) ) + ) + expected_output=$'4' ) + ( + name="revlist1nr" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "-1r" ) ) + [std_like]=( argv=( "-n" "1" "-r" ) ) + [long_options]=( argv=( "--lines" "1" "--reverse" ) ) + ) + expected_output=$'4' + ) + ( + name="revlist2n" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "-2" ) ) + [std_like]=( argv=( "-n" "2" ) ) + ) + expected_output=$'3\n4' + ) + ( + name="revlist2nr" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "-2r" ) ) + [std_like]=( argv=( "-n" "2" "-r" ) ) + ) + expected_output=$'4\n3' + ) + ( + name="revlist3nr" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "-3r" ) ) + [std_like]=( argv=( "-n" "3" "-r" ) ) + ) + expected_output=$'4\n3\n2' + ) + ( + name="revlist2p" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "+2" ) ) + [std_like]=( argv=( "-n" "+2" ) ) + ) + expected_output=$'2\n3\n4' + ) + ( + name="revlist2pr" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "+2r" ) ) + [std_like]=( argv=( "-n" "+2" "-r" ) ) + ) + expected_output=$'4\n3\n2' + ) + ( + name="revlist3p" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "+3" ) ) + [std_like]=( argv=( "-n" "+3" ) ) + ) + expected_output=$'3\n4' + ) + ( + name="revlist3pr" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "+3r" ) ) + [std_like]=( argv=( "-n" "+3" "-r" ) ) + ) + expected_output=$'4\n3' + ) + ( + name="revlist4p" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "+4" ) ) + [std_like]=( argv=( "-n" "+4" ) ) + ) + expected_output=$'4' + ) + ( + name="revlist4pr" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "+4r" ) ) + [std_like]=( argv=( "-n" "+4" "-r" ) ) + ) + expected_output=$'4' + ) + ( + name="revlist5p" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "+5" ) ) + [std_like]=( argv=( "-n" "+5" ) ) + ) + expected_output=$'' + ) + ( + name="revlist5pr" + input=$'1\n2\n3\n4' + compound -A tail_args=( + [legacy]=( argv=( "+5r" ) ) + [std_like]=( argv=( "-n" "+5" "-r" ) ) + ) + expected_output=$'' + ) +) + +for testid in "${!testcases[@]}" ; do + nameref tc=testcases[${testid}] + + for argv_variants in "${!tc.tail_args[@]}" ; do + nameref argv=tc.tail_args[${argv_variants}].argv + output=$( + #set -o pipefail + print -r -- "${tc.input}" | tail "${argv[@]}" + ) || err_exit "test ${tc.name}/${argv_variants}: command failed with exit code $?" + + [[ "${output}" == "${tc.expected_output}" ]] || err_exit "test ${tc.name}/${argv_variants}: Expected $(doublebackslashquote "${tc.expected_output}"), got $(doublebackslashquote "${output}")" + done +done + + +# test2: test "tail -r </etc/profile | rev -l" vs. "cat </etc/profile" +[[ "$(tail -r </etc/profile | rev -l)" == "$( cat /etc/profile )" ]] || err_exit "'tail -r </etc/profile | rev -l' output does not match 'cat /etc/profile'" + + +# test 3: ast-ksh.2009-05-05 "tail" builtin may crash if we pass unsupported long options +$SHELL -o errexit -c 'builtin tail ; print "hello" | tail --attack_of_chicken_monsters' >/dev/null 2>&1 +(( $? == 2 )) || err_exit "expected exit code 2 for unsupported long option, got $?" + + +# test 4: FIFO tests + +# FIFO test functions +# (we use functions here to do propper garbage collection) +function test_tail_fifo_1 +{ + typeset tail_cmd="$1" + integer i + integer tail_pid=-1 + + # cleanup trap + trap "rm -f tailtestfifo tailout" EXIT + + # create test FIFO + mkfifo tailtestfifo + + ${tail_cmd} -f <tailtestfifo >tailout & + tail_pid=$! + + myintseq 20 >tailtestfifo + + waitpidtimeout ${tail_pid} 5 + + if isvalidpid ${tail_pid} ; then + err_exit "test_tail_fifo_1: # tail hung (not expected)" + kill -KILL ${tail_pid} + fi + + wait || err_exit "tail child returned non-zero exit code=$?" + + [[ "$(cat tailout)" == $'11\n12\n13\n14\n15\n16\n17\n18\n19\n20' ]] || err_exit "test_tail_fifo_1: Expected $(doublebackslashquote '11\n12\n13\n14\n15\n16\n17\n18\n19\n20'), got $(doublebackslashquote "$(cat tailout)")" + + return 0 +} + +function test_tail_fifo_2 +{ + typeset tail_cmd="$1" + integer i + integer tail_pid=-1 + + # cleanup trap + trap "rm -f tailtestfifo tailout" EXIT + + # create test FIFO + mkfifo tailtestfifo + + ${tail_cmd} -f tailtestfifo >tailout & + tail_pid=$! + + myintseq 14 >tailtestfifo + + waitpidtimeout ${tail_pid} 5 + + if isvalidpid ${tail_pid} ; then + [[ "$(cat tailout)" == $'5\n6\n7\n8\n9\n10\n11\n12\n13\n14' ]] || err_exit "test_tail_fifo_2: Expected $(doublebackslashquote $'5\n6\n7\n8\n9\n10\n11\n12\n13\n14'), got $(doublebackslashquote "$(cat tailout)")" + + myintseq 15 >>tailtestfifo + + waitpidtimeout ${tail_pid} 5 + + if isvalidpid ${tail_pid} ; then + kill -KILL ${tail_pid} + else + err_exit "test_tail_fifo_2: # tail exit with return code $? (not expected)" + fi + fi + + wait || err_exit "tail child returned non-zero exit code=$?" + + [[ "$(cat tailout)" == $'5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15' ]] || err_exit "test_tail_fifo_2: Expected $(doublebackslashquote $'5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15'), got $(doublebackslashquote "$(cat tailout)")" + + return 0 +} + +# fixme: This should test /usr/bin/tail and /usr/xpg4/bin/tail in Solaris +test_tail_fifo_1 "tail" +test_tail_fifo_2 "tail" + + +# test 5: "tail -f" tests +function followtest1 +{ + typeset -r FOLLOWFILE="followfile.txt" + typeset -r OUTFILE="outfile.txt" + + typeset title="$1" + typeset testcmd="$2" + typeset usenewline=$3 + typeset followstr="" + typeset newline="" + integer i + integer tailchild=-1 + + if ${usenewline} ; then + newline=$'\n' + fi + + rm -f "${FOLLOWFILE}" "${OUTFILE}" + print -n "${newline}" > "${FOLLOWFILE}" + + ${testcmd} -f "${FOLLOWFILE}" >"${OUTFILE}" & + (( tailchild=$! )) + + for (( i=0 ; i < 10 ; i++)) ; do + followstr+="${newline}${i}" + print -n "${i}${newline}" >>"${FOLLOWFILE}" + sleep 2 + + [[ "$( < "${OUTFILE}")" == "${followstr}" ]] || err_exit "${title}: Expected $(doublebackslashquote "${followstr}"), got "$(doublebackslashquote "$( < "${OUTFILE}")")"" + done + + #kill -TERM ${tailchild} 2>/dev/null + kill -KILL ${tailchild} 2>/dev/null + waitpidtimeout ${tailchild} 5 + + if isvalidpid ${tailchild} ; then + err_exit "${title}: tail pid=${tailchild} hung." + kill -KILL ${tailchild} 2>/dev/null + fi + + wait ${tailchild} 2>/dev/null + + rm -f "${FOLLOWFILE}" "${OUTFILE}" + + return 0 +} + +followtest1 "test5a" "tail" true +# fixme: later we should test this, too: +#followtest1 "test5b" "tail" false +#followtest1 "test5c" "/usr/xpg4/bin/tail" true +#followtest1 "test5d" "/usr/xpg4/bin/tail" false +#followtest1 "test5e" "/usr/bin/tail" true +#followtest1 "test5f" "/usr/bin/tail" false + + +# cleanup +cd "${ocwd}" +rmdir "${tmpdir}" || err_exit "Cannot remove temporary directory ${tmpdir}". + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_command_substitution.sh b/usr/src/lib/libshell/common/tests/sun_solaris_command_substitution.sh new file mode 100644 index 0000000000..77ab14714e --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_command_substitution.sh @@ -0,0 +1,291 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Written by Roland Mainz <roland.mainz@nrubsig.org> +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + + +function isvalidpid +{ + kill -0 ${1} 2>/dev/null && return 0 + return 1 +} +integer testfilesize i maxwait +typeset tmpfile +integer testid + + +######################################################################## +#### test set 001: +# run loop and check various temp filesizes +# (Please keep this test syncted with sun_solaris_cr_6800929_large_command_substitution_hang.sh) + +# test 1: run loop and check various temp filesizes +tmpfile="$(mktemp "/tmp/ksh93_tests_command_substitution.${PPID}.$$.XXXXXX")" || err_exit "Cannot create temporary file." + +compound test1=( + compound -a testcases=( + # test 1a: Run test child for $(...) + # (note the pipe chain has to end in a builtin command, an external command may not trigger the bug) + ( name="test1a" cmd="builtin cat ; print -- \"\$(cat \"${tmpfile}\" | cat)\" ; true" ) + # test 1b: Same as test1a but uses ${... ; } instead if $(...) + ( name="test1b" cmd="builtin cat ; print -- \"\${ cat \"${tmpfile}\" | cat ; }\" ; true" ) + # test 1c: Same as test1a but does not use a pipe + ( name="test1c" cmd="builtin cat ; print -- \"\$(cat \"${tmpfile}\" ; true)\" ; true" ) + # test 1d: Same as test1a but does not use a pipe + ( name="test1d" cmd="builtin cat ; print -- \"\${ cat \"${tmpfile}\" ; true ; }\" ; true" ) + + # test 1e: Same as test1a but uses an external "cat" command + ( name="test1e" cmd="builtin -d cat /bin/cat ; print -- \"\$(cat \"${tmpfile}\" | cat)\" ; true" ) + # test 1f: Same as test1a but uses an external "cat" command + ( name="test1f" cmd="builtin -d cat /bin/cat ; print -- \"\${ cat \"${tmpfile}\" | cat ; }\" ; true" ) + # test 1g: Same as test1a but uses an external "cat" command + ( name="test1g" cmd="builtin -d cat /bin/cat ; print -- \"\$(cat \"${tmpfile}\" ; true)\" ; true" ) + # test 1h: Same as test1a but uses an external "cat" command + ( name="test1h" cmd="builtin -d cat /bin/cat ; print -- \"\${ cat \"${tmpfile}\" ; true ; }\" ; true" ) + ) +) + +for (( testfilesize=1*1024 ; testfilesize <= 1024*1024 ; testfilesize*=2 )) ; do + # Create temp file + { + for (( i=0 ; i < testfilesize ; i+=64 )) ; do + print "0123456789abcdef01234567890ABCDEF0123456789abcdef01234567890ABCDE" + done + } >"${tmpfile}" + + # wait up to log2(i) seconds for the child to terminate + # (this is 10 seconds for 1KB and 19 seconds for 512KB) + (( maxwait=log2(testfilesize) )) + + for testid in "${!test1.testcases[@]}" ; do + nameref currtst=test1.testcases[testid] + ${SHELL} -o errexit -c "${currtst.cmd}" >"${tmpfile}.out" & + (( childpid=$! )) + + for (( i=0 ; i < maxwait ; i++ )) ; do + isvalidpid ${childpid} || break + sleep 0.25 + done + + if isvalidpid ${childpid} ; then + err_exit "${currtst.name}: child (pid=${childpid}) still busy, filesize=${testfilesize}." + kill -KILL ${childpid} 2>/dev/null + fi + wait || err_exit "${currtst.name}: Child returned non-zero exit code." # wait for child (and/or avoid zombies/slime) + + # compare input/output + cmp -s "${tmpfile}" "${tmpfile}.out" || err_exit "${currtst.name}: ${tmpfile} and ${tmpfile}.out differ, filesize=${testfilesize}." + rm "${tmpfile}.out" + done + + # Cleanup + rm "${tmpfile}" +done + + +######################################################################## +#### test set 002: +# If a command substitution calls a function and that function contains +# a command substitution which contains a piped command, the original +# command substitution calling the function will return 127 instead of 0. +# This is causing problems in several VSC tests. +# If we remove the piped command from the simple +# case in the attached script, it returns 0. + +typeset str +typeset testbody +typeset testout + +testbody=$( +# <CS> means command substitution start, <CE> means command substitution end +cat <<EOF +myfunc () +{ + pipedcmd=<CS> printf "hi" | tr "h" "H" <CE> + echo \$pipedcmd + + return 0 +} + +foo=<CS>myfunc<CE> +retval=\$? + +if [ "\$foo"X != "HiX" ]; then + echo "myfunc returned '\${foo}'; expected 'Hi'" +fi + +if [ \$retval -ne 0 ]; then + echo "command substitution calling myfunc returned \"\${retval}\"; expected 0" +else + echo "command substitution calling myfunc successfully returned 0" +fi +EOF +) + + +# Test 002/a: Plain test +testout=${ printf "%B\n" testbody | sed 's/<CS>/$(/g;s/<CE>/)/g' | ${SHELL} 2>&1 || err_exit "command returned exit code $?" } +[[ "${testout}" == "command substitution calling myfunc successfully returned 0" ]] || err_exit "Expected 'command substitution calling myfunc successfully returned 0', got ${testout}" + +# Test 002/b: Same as test002/a but replaces "$(" with "${" +testout=${ printf "%B\n" testbody | sed 's/<CS>/${ /g;s/<CE>/ ; }/g' | ${SHELL} 2>&1 || err_exit "command returned exit code $?" } +[[ "${testout}" == "command substitution calling myfunc successfully returned 0" ]] || err_exit "Expected 'command substitution calling myfunc successfully returned 0', got ${testout}" + +# Test 002/c: Same as test002/a but forces |fork()| for a subshell via "ulimit -c 0" +testout=${ printf "%B\n" testbody | sed 's/<CS>/$( ulimit -c 0 ; /g;s/<CE>/)/g' | ${SHELL} 2>&1 || err_exit "command returned exit code $?" } +[[ "${testout}" == "command substitution calling myfunc successfully returned 0" ]] || err_exit "Expected 'command substitution calling myfunc successfully returned 0', got ${testout}" + +# Test 002/d: Same as test002/a but uses extra subshell +testout=${ printf "%B\n" testbody | sed 's/<CS>/$( ( /g;s/<CE>/) )/g' | ${SHELL} 2>&1 || err_exit "command returned exit code $?" } +[[ "${testout}" == "command substitution calling myfunc successfully returned 0" ]] || err_exit "Expected 'command substitution calling myfunc successfully returned 0', got ${testout}" + +# Test 002/e: Same as test002/b but uses extra subshell after "${ " +testout=${ printf "%B\n" testbody | sed 's/<CS>/${ ( /g;s/<CE>/) ; }/g' | ${SHELL} 2>&1 || err_exit "command returned exit code $?" } +[[ "${testout}" == "command substitution calling myfunc successfully returned 0" ]] || err_exit "Expected 'command substitution calling myfunc successfully returned 0', got ${testout}" + + + + +######################################################################## +#### test set 003: +# An expression within backticks which should return false, instead +# returns true (0). + +typeset str +typeset testbody +typeset testout + +testbody=$( +# <CS> means command substitution start, <CE> means command substitution end +cat <<EOF +if <CS>expr "NOMATCH" : ".*Z" > /dev/null<CE> ; then + echo "xerror" +else + echo "xok" +fi +EOF +) + + +# Test 003/a: Plain test +testout=${ printf "%B\n" testbody | sed 's/<CS>/$(/g;s/<CE>/)/g' | ${SHELL} 2>&1 || err_exit "command returned exit code $?" } +[[ "${testout}" == "xok" ]] || err_exit "Expected 'xok', got ${testout}" + +# Test 003/b: Same as test003/a but replaces "$(" with "${" +testout=${ printf "%B\n" testbody | sed 's/<CS>/${ /g;s/<CE>/ ; }/g' | ${SHELL} 2>&1 || err_exit "command returned exit code $?" } +[[ "${testout}" == "xok" ]] || err_exit "Expected 'xok', got ${testout}" + +# Test 003/c: Same as test003/a but forces |fork()| for a subshell via "ulimit -c 0" +testout=${ printf "%B\n" testbody | sed 's/<CS>/$( ulimit -c 0 ; /g;s/<CE>/)/g' | ${SHELL} 2>&1 || err_exit "command returned exit code $?" } +[[ "${testout}" == "xok" ]] || err_exit "Expected 'xok', got ${testout}" + +# Test 003/d: Same as test003/a but uses extra subshell +testout=${ printf "%B\n" testbody | sed 's/<CS>/$( ( /g;s/<CE>/) )/g' | ${SHELL} 2>&1 || err_exit "command returned exit code $?" } +[[ "${testout}" == "xok" ]] || err_exit "Expected 'xok', got ${testout}" + +# Test 003/e: Same as test003/b but uses extra subshell after "${ " +testout=${ printf "%B\n" testbody | sed 's/<CS>/${ ( /g;s/<CE>/) ; }/g' | ${SHELL} 2>&1 || err_exit "command returned exit code $?" } +[[ "${testout}" == "xok" ]] || err_exit "Expected 'xok', got ${testout}" + + +######################################################################## +#### test set 004: +# test pipe within ${... ; } command subtitution ending in a +# non-builtin command (therefore we use "/bin/cat" instead of "cat" below +# to force the use of the external "cat" command). ast-ksh.2009-01-20 +# had a bug which caused this test to fail. +testout=$( ${SHELL} -c 'pipedcmd=${ printf "hi" | /bin/cat ; } ; print $pipedcmd' ) +[[ "${testout}" == "hi" ]] || err_exit "test004: Expected 'hi', got '${testout}'" + + +######################################################################## +#### test set 005: +# Test whether the shell may hang in a +# 'exec 5>/dev/null; print $(eval ls -d . 2>&1 1>&5)' +# Originally discovered with ast-ksh.2009-05-05 which hung in +# the "configure" script of postgresql-8.3.7.tar.gz (e.g. +# configure --enable-thread-safety --without-readline) +compound test5=( + compound -a testcases=( + # gsf's reduced testcase + ( name="test5_a" cmd='exec 5>/dev/null; print $(eval ls -d . 2>&1 1>&5)done' ) + # gisburn's reduced testcase + ( name="test5_b" cmd='exec 5>/dev/null; print $(eval "/bin/printf hello\n" 2>&1 1>&5)done' ) + + ## The following tests do not trigger the problem but are included here for completeness + ## and to make sure we don't get other incarnations of the same problem later... + + # same as test5_a but uses ${ ... ; } instead of $(...) + ( name="test5_c" cmd='exec 5>/dev/null; print "${ eval ls -d . 2>&1 1>&5 ;}done"' ) + # same as test5_b but uses ${ ... ; } instead of $(...) + ( name="test5_d" cmd='exec 5>/dev/null; print "${ eval "/bin/printf hello\n" 2>&1 1>&5 ;}done"' ) + # same as test5_a but uses "ulimit -c 0" to force the shell to use a seperare process for $(...) + ( name="test5_e" cmd='exec 5>/dev/null; print $(ulimit -c 0 ; eval ls -d . 2>&1 1>&5)done' ) + # same as test5_b but uses "ulimit -c 0" to force the shell to use a seperare process for $(...) + ( name="test5_f" cmd='exec 5>/dev/null; print $(ulimit -c 0 ; eval "/bin/printf hello\n" 2>&1 1>&5)done' ) + ) +) + +maxwait=5 +for testid in "${!test5.testcases[@]}" ; do + nameref currtst=test5.testcases[testid] + ${SHELL} -o errexit -c "${currtst.cmd}" >"${tmpfile}.out" & + (( childpid=$! )) + + for (( i=0 ; i < maxwait ; i++ )) ; do + isvalidpid ${childpid} || break + sleep 0.25 + done + + if isvalidpid ${childpid} ; then + err_exit "${currtst.name}: child (pid=${childpid}) still busy." + kill -KILL ${childpid} 2>/dev/null + fi + wait || err_exit "${currtst.name}: Child returned non-zero exit code." # wait for child (and/or avoid zombies/slime) + + testout="$( < "${tmpfile}.out")" + rm "${tmpfile}.out" || err_exit "File '${tmpfile}.out' could not be removed." + [[ "${testout}" == "done" ]] || err_exit "test '${currtst.name}' failed, expected 'done', got '${testout}'" +done + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_compound_nameref.sh b/usr/src/lib/libshell/common/tests/sun_solaris_compound_nameref.sh new file mode 100644 index 0000000000..3714227449 --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_compound_nameref.sh @@ -0,0 +1,215 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + + + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + +# +# name reference test #001 +# Note we run this test in a seperate shell to make sure the memory +# corruption originally reported can be reproduced (which precisely +# depends on ordering in the testcase) +( +cat <<EOF + function err_exit + { + print -u2 -n "\t" + print -u2 -r \${Command}[\$1]: "\${@:2}" + (( Errors++ )) + } + alias err_exit='err_exit \$LINENO' + + function function2 + { + nameref v=\$1 + + v.x=19 + v.y=20 + } + + function function1 + { + typeset compound_var=() + + function2 compound_var + + printf "x=%d, y=%d\n" compound_var.x compound_var.y + } + + x="\$(function1)" + + [[ "\$x" == 'x=19, y=20' ]] || err_exit "expected 'x=19, y=20', got '\${x}'" + +EOF +) | ${SHELL} +(( Errors+=$? )) + + +# +# name reference test #002 +# Originally derived from the xmldocumenttree1.sh demo which failed +# with ast-ksh.2009-04-15 since the nodepath+nodesnum nameref calls +# were removing the compound variable members nodes+nodesnum (caused +# by a scoping bug) +# +( +cat <<EOF + compound xdoc + compound -A xdoc.nodes + integer xdoc.nodesnum=0 + + function test1 + { + nameref doc=xdoc + nameref nodepath="doc.nodes" + nameref nodesnum="doc.nodesnum" + print -v doc + } + + test1 +EOF +) | out=$( ${SHELL} ) || err_exit "shell returned exit code $?" + +(( ${ wc -l <<<"${out}" ; } == 4 )) || err_exit "Expected four lines of output, got ${out}" +(set -o errexit ; read -C tmp <<<"${out}" ; [[ "$(typeset +p tmp.nodes)" == *-A* ]]) || err_exit "missing variable tmp.nodes" +(set -o errexit ; read -C tmp <<<"${out}" ; [[ -v tmp.nodesnum ]]) || err_exit "missing variable tmp.nodesnum" + + +# +# name reference test #003a +# ast-ksh.2009-06-30 failed with the following compound variable/nameref test +# +( +cat <<EOF + compound -A addrsp + + nameref sp=addrsp + + sp[14]=( size=1 ) + + if [[ -v sp[19] ]] ; then + print "should not happen" + else + print "Ok" + fi +EOF +) | out=$( ${SHELL} ) || err_exit "shell returned exit code $?" +[[ "${out}" == "Ok" ]] || err_exit "Expected 'Ok', got ${out}" + + +# +# name reference test #003b +# (same as test #003a but uses a function) +# ast-ksh.2009-06-30 failed with the following compound variable/nameref test +# +( +cat <<EOF + compound -A addrsp + + function t1 + { + nameref sp=\$1 + + sp[14]=( size=1 ) + + if [[ -v sp[19] ]] ; then + print "should not happen" + else + print "Ok" + fi + } + + t1 addrsp +EOF +) | out=$( ${SHELL} ) || err_exit "shell returned exit code $?" +[[ "${out}" == "Ok" ]] || err_exit "Expected 'Ok', got ${out}" + + +# +# name reference test #004a +# (same as #003a but uses an indexed array instead of an associative one) +# ast-ksh.2009-06-30 failed with the following compound variable/nameref test +# +( +cat <<EOF + compound -a addrsp + + nameref sp=addrsp + + sp[14]=( size=1 ) + + if [[ -v sp[19] ]] ; then + print "should not happen" + else + print "Ok" + fi +EOF +) | out=$( ${SHELL} ) || err_exit "shell returned exit code $?" +[[ "${out}" == "Ok" ]] || err_exit "Expected 'Ok', got ${out}" + + +# +# name reference test #004b +# (same as test #004a but uses a function) +# ast-ksh.2009-06-30 failed with the following compound variable/nameref test +# +( +cat <<EOF + compound -a addrsp + + function t1 + { + nameref sp=\$1 + + sp[14]=( size=1 ) + + if [[ -v sp[19] ]] ; then + print "should not happen" + else + print "Ok" + fi + } + + t1 addrsp +EOF +) | out=$( ${SHELL} ) || err_exit "shell returned exit code $?" +[[ "${out}" == "Ok" ]] || err_exit "Expected 'Ok', got ${out}" + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_compoundvario.sh b/usr/src/lib/libshell/common/tests/sun_solaris_compoundvario.sh index 18aed2aa7a..52bc5dca82 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_compoundvario.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_compoundvario.sh @@ -20,20 +20,25 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' -typeset -C bracketstat=( +# "nounset" disabled for now +#set -o nounset +Command=${0##*/} +integer Errors=0 + +compound bracketstat=( integer bopen=0 integer bclose=0 ) @@ -57,7 +62,45 @@ function count_brackets return 0 } -integer Errors=0 +# compound variable "cat" nr.1, using $ print "%B\n" ... # +function cpvcat1 +{ + set -o errexit + compound tmp + + while read -C tmp ; do printf "%B\n" tmp ; done + return 0 +} + +# compound variable "cat" nr.2, using $ print "%#B\n" ... # +function cpvcat2 +{ + set -o errexit + compound tmp + + while read -C tmp ; do printf "%#B\n" tmp ; done + return 0 +} + +# compound variable "cat" nr.3, using $ print -C ... # +function cpvcat3 +{ + set -o errexit + compound tmp + + while read -C tmp ; do print -C tmp ; done + return 0 +} + +# compound variable "cat" nr.4, using $ print -v ... # +function cpvcat4 +{ + set -o errexit + compound tmp + + while read -C tmp ; do print -v tmp ; done + return 0 +} typeset s @@ -71,7 +114,7 @@ typeset s # -- snip -- # (additionally we test some extra stuff like bracket count) s=${ - typeset -C x=( + compound x=( a=1 b=2 typeset -a myarray=( 1 2 3 4 5 6 7 8 9 10 ) typeset -A myarray2=( [a]=1 [b]=2 ["c d"]=3 [e]=4 ["f"]=5 [g]=6 [h]=7 [i]=8 [j]=9 [k]=10 ) @@ -88,7 +131,7 @@ s=${ integer at=90 ) [e]=( - typeset -C nested_cpv=( + compound nested_cpv=( typeset -a myarray=( 1 2 3 4 5 6 7 8 9 10 ) typeset str=$'a \'string' ) @@ -96,13 +139,19 @@ s=${ [f]=( typeset g="f" ) + [a_nan]=( + float my_nan=-nan + ) + [a_hexfloat]=( + typeset -X my_hexfloat=1.1 + ) ) ) { printf "%B\n" x print "hello" - } | { + } | cpvcat1 | cpvcat2 | cpvcat3 | cpvcat4 | { read -C y read s } @@ -111,6 +160,8 @@ s=${ [[ "${s}" == "xhellox" ]] || err_exit "Expected 'xhellox', got ${s}" count_brackets "$y" || err_exit "y: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" +count_brackets "$(print -v y)" || err_exit "y: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" +count_brackets "$(print -C y)" || err_exit "y: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" # cleanup unset x y || err_exit "unset failed" @@ -128,11 +179,11 @@ unset x y || err_exit "unset failed" # <compound var> # -- snip -- s=${ - typeset -C x=( + compound x=( a=1 b=2 typeset -a myarray=( 1 2 3 4 5 6 7 8 9 10 ) typeset -A myarray2=( [a]=1 [b]=2 ["c d"]=3 [e]=4 ["f"]=5 [g]=6 [h]=7 [i]=8 [j]=9 [k]=10 ) - typeset -A myarray3=( + compound -A myarray3=( [a]=( float m1=0.5 float m2=0.6 @@ -145,7 +196,7 @@ s=${ integer at=90 ) [e]=( - typeset -C nested_cpv=( + compound nested_cpv=( typeset -a myarray=( 1 2 3 4 5 6 7 8 9 10 ) typeset str=$'a \'string' ) @@ -153,6 +204,12 @@ s=${ [f]=( typeset g="f" ) + [a_nan]=( + float my_nan=-nan + ) + [a_hexfloat]=( + typeset -X my_hexfloat=1.1 + ) ) ) @@ -160,7 +217,7 @@ s=${ printf "%B\n" x print "hello" printf "%B\n" x - } | { + } | cpvcat1 | cpvcat2 | cpvcat3 | cpvcat4 | { read -C y1 read s read -C y2 @@ -170,10 +227,22 @@ s=${ } || err_exit "test returned exit code $?" [[ "${s}" == "xhellox" ]] || err_exit "Expected 'xhellox', got ${s}." +[[ "${y1.myarray3[b].foo}" == "bar" ]] || err_exit "y1.myarray3[b].foo != bar" +[[ "${y2.myarray3[b].foo}" == "bar" ]] || err_exit "y2.myarray3[b].foo != bar" [[ "$y1" != "" ]] || err_exit "y1 is empty" [[ "$y2" != "" ]] || err_exit "y2 is empty" +(( ${#y1.myarray3[e].nested_cpv.myarray[@]} == 10 )) || err_exit "Expected 10 elements in y1.myarray3[e].nested_cpv, got ${#y1.myarray3[e].nested_cpv[@]}" +(( ${#y2.myarray3[e].nested_cpv.myarray[@]} == 10 )) || err_exit "Expected 10 elements in y2.myarray3[e].nested_cpv, got ${#y2.myarray3[e].nested_cpv[@]}" +(( isnan(y1.myarray3[a_nan].my_nan) )) || err_exit "y1.myarray3[a_nan].my_nan not a NaN" +(( isnan(y2.myarray3[a_nan].my_nan) )) || err_exit "y2.myarray3[a_nan].my_nan not a NaN" +(( signbit(y1.myarray3[a_nan].my_nan) )) || err_exit "y1.myarray3[a_nan].my_nan not negative" +(( signbit(y2.myarray3[a_nan].my_nan) )) || err_exit "y2.myarray3[a_nan].my_nan not negative" count_brackets "$y1" || err_exit "y1: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" +count_brackets "$(print -v y1)" || err_exit "y1: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" +count_brackets "$(print -C y1)" || err_exit "y1: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" count_brackets "$y2" || err_exit "y2: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" +count_brackets "$(print -v y2)" || err_exit "y2: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" +count_brackets "$(print -C y2)" || err_exit "y2: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" [[ "$y1" == "$y2" ]] || err_exit "Expected $(printf "%q\n" "${y1}") == $(printf "%q\n" "${y2}")." [[ "$x" == "$y1" ]] || err_exit "Expected $(printf "%q\n" "${x}") == $(printf "%q\n" "${y}")." @@ -185,11 +254,11 @@ unset x y1 y2 || err_exit "unset failed" # Test 3: Test compound variable copy operator vs. "read -C" -typeset -C x=( +compound x=( a=1 b=2 typeset -a myarray=( 1 2 3 4 5 6 7 8 9 10 ) typeset -A myarray2=( [a]=1 [b]=2 ["c d"]=3 [e]=4 ["f"]=5 [g]=6 [h]=7 [i]=8 [j]=9 [k]=10 ) - typeset -A myarray3=( + compound -A myarray3=( [a]=( float m1=0.5 float m2=0.6 @@ -202,7 +271,7 @@ typeset -C x=( integer at=90 ) [e]=( - typeset -C nested_cpv=( + compound nested_cpv=( typeset -a myarray=( 1 2 3 4 5 6 7 8 9 10 ) typeset str=$'a \'string' ) @@ -210,27 +279,41 @@ typeset -C x=( [f]=( typeset g="f" ) + [a_nan]=( + float my_nan=-nan + ) + [a_hexfloat]=( + typeset -X my_hexfloat=1.1 + ) ) ) -typeset -C x_copy=x || err_exit "x_copy copy failed" +compound x_copy=x || err_exit "x_copy copy failed" [[ "${x_copy}" != "" ]] || err_exit "x_copy should not be empty" count_brackets "${x_copy}" || err_exit "x_copy: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" +count_brackets "$(print -v x_copy)" || err_exit "x_copy: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" +count_brackets "$(print -C x_copy)" || err_exit "x_copy: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" -typeset -C nested_cpv_copy +compound nested_cpv_copy nested_cpv_copy=x.myarray3[e].nested_cpv || err_exit "x.myarray3[e].nested_cpv copy failed" +(( ${#nested_cpv_copy.myarray[@]} == 10 )) || err_exit "Expected 10 elements in nested_cpv_copy.myarray, got ${#nested_cpv_copy.myarray[@]}" # unset branch "x.myarray3[e].nested_cpv" of the variable tree "x" ... unset x.myarray3[e].nested_cpv || err_exit "unset x.myarray3[e].nested_cpv failed" [[ "${x.myarray3[e].nested_cpv}" == "" ]] || err_exit "x.myarray3[e].nested_cpv still has a value" # ... and restore it from the saved copy -printf "%B\n" nested_cpv_copy | read -C x.myarray3[e].nested_cpv || err_exit "read failed" +printf "%B\n" nested_cpv_copy | cpvcat1 | cpvcat2 | cpvcat3 | cpvcat4 | read -C x.myarray3[e].nested_cpv || err_exit "read failed" # compare copy of the original tree and the modified one [[ "${x}" == "${x_copy}" ]] || err_exit "x != x_copy" count_brackets "${x}" || err_exit "x: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" +count_brackets "$(print -v x)" || err_exit "x: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" +count_brackets "$(print -C x)" || err_exit "x: bracket open ${bracketstat.bopen} != bracket close ${bracketstat.bclose}" +(( ${#x.myarray3[e].nested_cpv.myarray[@]} == 10 )) || err_exit "Expected 10 elements in x.myarray3[e].nested_cpv, got ${#x.myarray3[e].nested_cpv[@]}" +(( isnan(x.myarray3[a_nan].my_nan) )) || err_exit "x.myarray3[a_nan].my_nan not a NaN" +(( signbit(x.myarray3[a_nan].my_nan) )) || err_exit "x.myarray3[a_nan].my_nan not negative" # cleanup unset x x_copy nested_cpv_copy || err_exit "unset failed" @@ -238,14 +321,15 @@ unset x x_copy nested_cpv_copy || err_exit "unset failed" # Test 4: Test "read -C" failure for missing bracket at the end typeset s -s=$($SHELL -c 'typeset -C myvar ; print "( unfinished=1" | read -C myvar 2>/dev/null || print "error $?"') || err_exit "shell failed" +s=$($SHELL -c 'compound myvar ; print "( unfinished=1" | read -C myvar 2>/dev/null || print "error $?"') || err_exit "shell failed" [[ "$s" == "error 3" ]] || err_exit "compound_read: expected error 3, got ${s}" # Test 5: Test "read -C" failure for missing bracket at the beginning typeset s -s=$($SHELL -c 'typeset -C myvar ; print " unfinished=1 )" | read -C myvar 2>/dev/null || print "error $?"') || err_exit "shell failed" +s=$($SHELL -c 'compound myvar ; print " unfinished=1 )" | read -C myvar 2>/dev/null || print "error $?"') || err_exit "shell failed" [[ "$s" == "error 3" ]] || err_exit "compound_read: expected error 3, got ${s}" + # tests done exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh index 335470aa79..27cac4aa88 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -46,6 +46,7 @@ # -- snip -- # +# test setup function err_exit { print -u2 -n "\t" @@ -54,15 +55,16 @@ function err_exit } alias err_exit='err_exit $LINENO' +set -o nounset +Command=${0##*/} +integer Errors=0 + function isvalidpid { kill -0 ${1} 2>/dev/null && return 0 return 1 } -Command=${0##*/} -integer Errors=0 - integer childpid typeset testdir integer childretval @@ -208,5 +210,6 @@ childretval=$? cd /tmp rmdir "${testdir}" || err_exit "Could not remove temporary test directory ${testdir}" + # tests done exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh index 4f03984951..28a84caff1 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -51,17 +51,20 @@ # ... provides the correct output. # +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' +set -o nounset +Command=${0##*/} integer Errors=0 + typeset var1 var2 # use unset, l=() compound syntax and print @@ -75,13 +78,13 @@ var2="$(${SHELL} -c '( ulimit -c 0 ; l=( a=1 b="BE" ) ; print "$l" ) ; print $l' [[ "${var1}" == "${var2}" ]] || err_exit "Non-fork()'ed subshell output differes from fork()'ed subshell output (without unset)." # use unset, typeset -C compound syntax and print -var1="$(${SHELL} -c 'unset l ; ( typeset -C l ; l.a=1 ; l.b="BE" ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." -var2="$(${SHELL} -c 'unset l ; ( ulimit -c 0 ; typeset -C l ; l.a=1 ; l.b="BE" ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." +var1="$(${SHELL} -c 'unset l ; ( compound l ; l.a=1 ; l.b="BE" ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." +var2="$(${SHELL} -c 'unset l ; ( ulimit -c 0 ; compound l ; l.a=1 ; l.b="BE" ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." [[ "${var1}" == "${var2}" ]] || err_exit "Non-fork()'ed subshell output differes from fork()'ed subshell output (with unset)." # do not use unset, typeset -C compound syntax and print -var1="$(${SHELL} -c '( typeset -C l ; l.a=1 ; l.b="BE" ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." -var2="$(${SHELL} -c '( ulimit -c 0 ; typeset -C l ; l.a=1 ; l.b="BE" ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." +var1="$(${SHELL} -c '( compound l ; l.a=1 ; l.b="BE" ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." +var2="$(${SHELL} -c '( ulimit -c 0 ; compound l ; l.a=1 ; l.b="BE" ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." [[ "${var1}" == "${var2}" ]] || err_exit "Non-fork()'ed subshell output differes from fork()'ed subshell output (with unset)." # use unset, l=() compound syntax and printf "%B\n" @@ -95,14 +98,15 @@ var2="$(${SHELL} -c '( ulimit -c 0 ; l=( a=1 b="BE" ) ; printf "%B\n" l) ; print [[ "${var1}" == "${var2}" ]] || err_exit "Non-fork()'ed subshell output differes from fork()'ed subshell output (without unset)." # use unset, typeset -C compound syntax and printf "%B\n" -var1="$(${SHELL} -c 'unset l ; ( typeset -C l ; l.a=1 ; l.b="BE" ; printf "%B\n" l) ; printf "%B\n" l')" || err_exit "Non-zero exit code." -var2="$(${SHELL} -c 'unset l ; ( ulimit -c 0 ; typeset -C l ; l.a=1 ; l.b="BE" ; printf "%B\n" l) ; printf "%B\n" l')" || err_exit "Non-zero exit code." +var1="$(${SHELL} -c 'unset l ; ( compound l ; l.a=1 ; l.b="BE" ; printf "%B\n" l) ; printf "%B\n" l')" || err_exit "Non-zero exit code." +var2="$(${SHELL} -c 'unset l ; ( ulimit -c 0 ; compound l ; l.a=1 ; l.b="BE" ; printf "%B\n" l) ; printf "%B\n" l')" || err_exit "Non-zero exit code." [[ "${var1}" == "${var2}" ]] || err_exit "Non-fork()'ed subshell output differes from fork()'ed subshell output (with unset)." # do not use unset, typeset -C compound syntax and printf "%B\n" -var1="$(${SHELL} -c '( typeset -C l ; l.a=1 ; l.b="BE" ; printf "%B\n" l) ; printf "%B\n" l')" || err_exit "Non-zero exit code." -var2="$(${SHELL} -c '( ulimit -c 0 ; typeset -C l ; l.a=1 ; l.b="BE" ; printf "%B\n" l) ; printf "%B\n" l')" || err_exit "Non-zero exit code." +var1="$(${SHELL} -c '( compound l ; l.a=1 ; l.b="BE" ; printf "%B\n" l) ; printf "%B\n" l')" || err_exit "Non-zero exit code." +var2="$(${SHELL} -c '( ulimit -c 0 ; compound l ; l.a=1 ; l.b="BE" ; printf "%B\n" l) ; printf "%B\n" l')" || err_exit "Non-zero exit code." [[ "${var1}" == "${var2}" ]] || err_exit "Non-fork()'ed subshell output differes from fork()'ed subshell output (with unset)." + # tests done exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6722134_background_CHLD_trap.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6722134_background_CHLD_trap.sh index 333f5cc1a0..793d53d20d 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6722134_background_CHLD_trap.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6722134_background_CHLD_trap.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -40,17 +40,20 @@ # -- snip -- # +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' +set -o nounset +Command=${0##*/} integer Errors=0 + ## ## test one: ## @@ -115,5 +118,6 @@ print "done" (( count=$(fgrep "got_child" <<< "$s" | wc -l) )) || err_exit "counting failed." (( count == 3 )) || err_exit "Expected count==3, got count==${count}." + # tests done exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6753538_subshell_leaks_umask.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6753538_subshell_leaks_umask.sh index c755f86c87..fa016f4c67 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6753538_subshell_leaks_umask.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6753538_subshell_leaks_umask.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -40,17 +40,20 @@ # -- snip -- +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' +set -o nounset +Command=${0##*/} integer Errors=0 + # # test set 1: Simple umask in subshell # @@ -93,5 +96,6 @@ x=$(${SHELL} -c 'umask 0; ( umask 20); umask') || err_exit "shell y=$(${SHELL} -c 'umask 0; (ulimit -c 0 ; umask 20); umask') || err_exit "shell failed." [[ "$x" == "$y" ]] || err_exit "$x != $y" + # tests done exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6754020_weird_square_bracket_expansion.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6754020_weird_square_bracket_expansion.sh index d4bd345833..6b0092d5ba 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6754020_weird_square_bracket_expansion.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6754020_weird_square_bracket_expansion.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -45,17 +45,20 @@ # ---- snip ---- +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' +set -o nounset +Command=${0##*/} integer Errors=0 + typeset s # test using "echo" diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6763594_command_failure_execs_twice.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6763594_command_failure_execs_twice.sh index f3ffae5e84..bc3426f063 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6763594_command_failure_execs_twice.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6763594_command_failure_execs_twice.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -63,17 +63,20 @@ # ---- snip ---- +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' +set -o nounset +Command=${0##*/} integer Errors=0 + typeset testtmpdir=/tmp/ksh93_test_cr_6763594_${PPID}_$$ mkdir "${testtmpdir}" || { err_exit "Could not create temporary directory ${testtmpdir}." ; exit ${Errors} ; } @@ -90,6 +93,7 @@ s=$( < out_stderr ) ; [[ "$s" == ~(Elr)(.*:\ \./myfoo:\ \./myfoo:\ .*\[.*\]) ]] rm "myfoo" "out_stdout" "out_stderr" || err_exit "rm failed." cd .. rmdir "${testtmpdir}" || err_exit "Failed to remove temporary directory ${testtmpdir}." - + + # tests done exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6766246_pattern_matching_bug.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6766246_pattern_matching_bug.sh index fc83db0e8a..7463baea5a 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6766246_pattern_matching_bug.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6766246_pattern_matching_bug.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -70,15 +70,17 @@ # ---- snip ---- +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' +set -o nounset +Command=${0##*/} integer Errors=0 @@ -168,5 +170,6 @@ while (( $# >= 13 )) ; do done done + # tests done exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6769332_substitutions_terminate_shell_after_257_iterations.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6769332_substitutions_terminate_shell_after_257_iterations.sh new file mode 100644 index 0000000000..7f76862bdd --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6769332_substitutions_terminate_shell_after_257_iterations.sh @@ -0,0 +1,124 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether ksh93 supports more than 256 recursive +# function+command substitution calls. +# +# This was reported as CR #6769332 ('Recursive function+command +# substitutions terminate shell after 257 iterations'): +# ------------ snip ------------ +# Recursive function+command substitutions +# (e.g. func1() { x=$( func2 ) ; } ; x=$( func1 ) ) terminate the +# ksh93 shell after 257 iterations with a exit code of "0" (it +# seems the shell just "quits" after the last "return 0" statement +# in the function). +# Running the attached testcase terminates the shell after 257 +# iterations (g=257 in the script) while 256 iterations (replace +# "257" with "256" in the script) just works fine. +# The same testcase works Ok in ksh88 (=/usr/bin/ksh in +# Solaris 10U5) +# +# Expected Result +# The script should output "done" and return the exit code 0. +# +# Actual Result +# No messsge. Exit code "0". +# +# Error Message(s) +# None (exit code is "0"). +# +# Test Case +# f1() +# { +# h=$1 +# (( h=h-1 )) +# (( h <= 0 )) && return 0 +# x=$(f1 "$h" "$l" "$g" d e "$l") || print -u2 "$g/$h: fail" +# return 0 +# } +# l="" +# g=257 +# i=0 +# while (( i < $g )) ; do +# l="${l}x" +# (( i=i+1 )) +# done +# f1 "$g" "$l" "$g" d e "$l" || print -u2 "$g: fail0" +# print "done" +# exit 0 +# +# Workaround +# - +# ------------ snip ------------ +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + +# +# test1: Testcase from CR #6769332 +# +( +cat <<EOF +# make sure we have enougth stack (needed for 64bit SPARC and SystemZ) +ulimit -s 65536 + +f1() +{ + h=\$1 + (( h=h-1 )) + (( h <= 0 )) && return 0 + x=\$(f1 "\$h" "\$l" "\$g" d e "\$l") || print -u2 "\$g/\$h: fail" + return 0 +} +l="" +g=257 +i=0 +while (( i < \$g )) ; do + l="\${l}x" + (( i=i+1 )) +done +f1 "\$g" "\$l" "\$g" d e "\$l" || print -u2 "\$g: fail0" +print "done" +EOF +) | out="$( ${SHELL} 2>&1 ; )" || err_exit "Shell returned non-zero exit code $?." + +[[ "${out}" == "done" ]] || err_exit "Output expected to be 'done', got '${out}'." + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6777491_lacks_arithmetric_function_iszero.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6777491_lacks_arithmetric_function_iszero.sh new file mode 100644 index 0000000000..2dd0fc997f --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6777491_lacks_arithmetric_function_iszero.sh @@ -0,0 +1,95 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether the arithmetric function "iszero" is available. +# +# This was reported as CR #6777491 ("*ksh93* lacks arithmetric function +# iszero()"): +# ------------ snip ------------ +# ksh93 lacks arithmetric function "iszero()" which limits the ability +# to classify floating-point values or even correctly match against +# zero (since IEEE754-1985/2008 floating-point math differs between +# positive and negaive zero values). +# Frequency +# Always +# Regression +# No +# Steps to Reproduce +# $ ksh93 -c '(( iszero(0) )) && print "0 is a zero"' +# Expected Result +# Output to stdout: +# -- snip -- +# 0 is a zero +# -- snip -- +# Actual Result +# ksh93 exists with: +# -- snip -- +# ksh93: iszero(0) : unknown function +# -- snip -- +# Error Message(s) +# ksh93: iszero(0) : unknown function +# Test Case +# ksh93 -c '(( iszero(0) )) && print "0 is a zero"' +# ------------ snip ------------ +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + +typeset str +integer i + +typeset -a tests=( + '(( iszero(0) )) && print "OK"' + '(( iszero(0.) )) && print "OK"' + '(( iszero(-0) )) && print "OK"' + '(( iszero(-0.) )) && print "OK"' + 'float n=0. ; (( iszero(n) )) && print "OK"' + 'float n=+0. ; (( iszero(n) )) && print "OK"' + 'float n=-0. ; (( iszero(n) )) && print "OK"' + 'float n=1. ; (( iszero(n) )) || print "OK"' + 'float n=1. ; (( iszero(n-1.) )) && print "OK"' + 'float n=-1. ; (( iszero(n+1.) )) && print "OK"' +) + +for (( i=0 ; i < ${#tests[@]} ; i++ )) ; do + str="$( $SHELL -o errexit -c "${tests[i]}" 2>&1 )" || err_exit "test $i: returned non-zero exit code $?" + [[ "${str}" == "OK" ]] || err_exit "test $i: expected 'OK', got '${str}'" +done + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6778077_sigthaw_trap.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6778077_sigthaw_trap.sh new file mode 100644 index 0000000000..24f99cb581 --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6778077_sigthaw_trap.sh @@ -0,0 +1,83 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether ksh93 supports traps for the SIGTHAW +# signal. +# +# This was reported as CR #6778077 ("*ksh93* does not understand "THAW" +# as a signal for use with trap"): +# -- snip -- +# While ksh93 understand THAW in the list of signals for kill it does +# not understand it for "trap' +# +# : pod5.eu TS 6 $; kill -l | egrep '(THAW|FREEZE)' +# FREEZE +# THAW +# : pod5.eu TS 7 $; trap "echo THAW" THAW +# ksh93: trap: THAW: bad trap +# : pod5.eu TS 8 $; +# +# Using the signal number (35) works around this. +# -- snip -- +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + + +## test one: Check whether the shell supports SIGTHAW as trap +${SHELL} -o errexit -c 'trap "true" SIGTHAW ; true' || err_exit "SIGTHAW not supported." +${SHELL} -o errexit -c 'trap "true" THAW ; true' || err_exit "THAW not supported." +${SHELL} -o errexit -c 'trap "true" 35 ; true' || err_exit "signal 35 not supported." + + +## test two: Check whether the shell supports SIGFREEZE as trap +## (we check this since it is SIGTHAW's counterpart) +${SHELL} -o errexit -c 'trap "true" SIGFREEZE ; true' || err_exit "SIGFREEZE not supported." +${SHELL} -o errexit -c 'trap "true" FREEZE ; true' || err_exit "FREEZE not supported." +${SHELL} -o errexit -c 'trap "true" 34 ; true' || err_exit "signal 34 not supported." + + +## test three: Check all other signals listed by "kill -l" +kill -l | while read i ; do + str="$( ${SHELL} -c "trap true $i ; print 'ok'" 2>&1 )" || err_exit "shell returned code $? for trap $i" + [[ "${str}" == "ok" ]] || err_exit "expected 'ok', got $str" +done + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6789247_printf_hexfloat_rounding.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6789247_printf_hexfloat_rounding.sh new file mode 100644 index 0000000000..69159a9f76 --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6789247_printf_hexfloat_rounding.sh @@ -0,0 +1,130 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether arithmetric math correctly supports +# negative zero values +# +# This was reported as CR #6789247 ("libast/ksh93 1-digit hexfloat base conversion rounds incorrectly"): +# ---- snip ---- +# Description +# [The same issue was described in http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2008-December/006737.html] +# This is basically a spin-off of http://bugs.opensolaris.org/view_bug.do?bug_id=6773712 ("1-digit hex fp +# base conversion of long double rounds incorrectly"). +# The bug description for Solaris libc says this: +# > The first line of output from this program is correct. The second line +# > is not. +# > +# > leviathan% cat a.c +# > #include <stdio.h> +# > +# > int main() +# > { +# > printf("%.0a\n", 1.5); +# > printf("%.0La\n", 1.5L); +# > return 0; +# > } +# > leviathan% cc -o a a.c +# > leviathan% a +# > 0x1p+1 +# > 0x1p+0 +# > leviathan% +# If I compile the testcase with libast on Solaris 11/B84 SPARC (which +# matches ast-open.2008-11-04) I get this: +# -- snip -- +# $ cc -xc99=%all -I/usr/include/ast -last a.c -o a && +# ./a +# 0x1p+00 +# 0x1p+00 +# -- snip -- +# ... which seems to be incorrect per the bugs comment above and should +# be: +# -- snip -- +# 0x1p+1 +# 0x1p+1 +# -- snip -- +# ksh93 has the same problem: +# $ ksh93 -c 'float r=1.5 ; printf "%.0a\n" r' +# 0x1p+00 +# Steps to Reproduce +# Compile and run testcase like this: +# -- snip -- +# $ cc -xc99=%all -I/usr/include/ast -last a.c -o a && +# ./a +# -- snip -- +# Expected Result +# 0x1p+1 +# 0x1p+1 +# Actual Result +# 0x1p+00 +# 0x1p+00 +# ---- snip ---- +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + + +float r +float result +typeset str + +# Test #001/a - check whether the result of a rounded 1.5 is 2.0 +r=1.5 +result=$(printf "%.0a\n" r) || err_exit "printf returned non-zero exit code" +(( result == 2.0 )) || err_exit "result expected to be 2.0, got ${result}" + + +# Test #001/b - same as test #001/a but uses "%.0A\n" instead of "%.0a\n" +r=1.5 +result=$(printf "%.0A\n" r) || err_exit "printf returned non-zero exit code" +(( result == 2.0 )) || err_exit "result expected to be 2.0, got ${result}" + + +# Test #002/a - check whether the hexfloat string value matches the expected pattern +r=1.5 +str=$(printf "%.0a\n" r) || err_exit "printf returned non-zero exit code" +[[ "${str}" == ~(Glri)0x0*1p\+0*1 ]] || err_exit "str expected to match ~(Glri)0x0*1p\+0*1, got |${str}|" + + +# Test #002/b - same as test #002/a but uses "%.0A\n" instead of "%.0a\n" +r=1.5 +str=$(printf "%.0A\n" r) || err_exit "printf returned non-zero exit code" +[[ "${str}" == ~(Glri)0x0*1p\+0*1 ]] || err_exit "str expected to match ~(Glri)0x0*1p\+0*1, got |${str}|" + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6800929_large_command_substitution_hang.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6800929_large_command_substitution_hang.sh index 396095ee63..de745b8a3a 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6800929_large_command_substitution_hang.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6800929_large_command_substitution_hang.sh @@ -35,7 +35,8 @@ # # and here's where it's hung: # ---8<--- -# xxxxx@xxxxx $ pstack 204600 +# Edward Pilatowicz <edward.pilatowicz@sun.com> +# $ pstack 204600 # 204600: /bin/ksh /opt/onbld/bin/Install -o debug -k i86xpv -T domu-219:/tmp # fffffd7fff2e3d1a write (1, 4154c0, 64) # fffffd7ffefdafc8 sfwr () + 2d0 @@ -70,68 +71,142 @@ # # as it turns out, i can easily reproduce this problem as follows: # ---8<--- -# xxxxx@xxxxx $ ksh93 -# xxxxx@xxxxx $ set -- `cat /etc/termcap | sort | uniq` +# $ ksh93 +# $ set -- `cat /etc/termcap | sort | uniq` # <hang> # ---8<--- # ---- snip ---- +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' +set -o nounset +Command=${0##*/} integer Errors=0 -integer i j d +# common functions/variables +function isvalidpid +{ + kill -0 ${1} 2>/dev/null && return 0 + return 1 +} +integer testfilesize i maxwait typeset tmpfile +integer testid + # test 1: run loop and check various temp filesizes tmpfile="$(mktemp "/tmp/sun_solaris_cr_6800929_large_command_substitution_hang.${PPID}.$$.XXXXXX")" || err_exit "Cannot create temporary file." -for (( i=1*1024 ; i <= 512*1024 ; i*=2 )) ; do +compound -a testcases=( + # test 1a: Run test child for $(...) + # (note the pipe chain has to end in a builtin command, an external command may not trigger the bug) + ( name="test1a" cmd="builtin cat ; print -- \"\$(cat \"${tmpfile}\" | cat)\" ; true" ) + # test 1b: Same as test1a but uses ${... ; } instead if $(...) + ( name="test1b" cmd="builtin cat ; print -- \"\${ cat \"${tmpfile}\" | cat ; }\" ; true" ) + # test 1c: Same as test1a but does not use a pipe + ( name="test1c" cmd="builtin cat ; print -- \"\$(cat \"${tmpfile}\" ; true)\" ; true" ) + # test 1d: Same as test1a but does not use a pipe + ( name="test1d" cmd="builtin cat ; print -- \"\${ cat \"${tmpfile}\" ; true ; }\" ; true" ) + + # test 1e: Same as test1a but uses an external "cat" command + ( name="test1e" cmd="builtin -d cat /bin/cat ; print -- \"\$(cat \"${tmpfile}\" | cat)\" ; true" ) + # test 1f: Same as test1a but uses an external "cat" command + ( name="test1f" cmd="builtin -d cat /bin/cat ; print -- \"\${ cat \"${tmpfile}\" | cat ; }\" ; true" ) + # test 1g: Same as test1a but uses an external "cat" command + ( name="test1g" cmd="builtin -d cat /bin/cat ; print -- \"\$(cat \"${tmpfile}\" ; true)\" ; true" ) + # test 1h: Same as test1a but uses an external "cat" command + ( name="test1h" cmd="builtin -d cat /bin/cat ; print -- \"\${ cat \"${tmpfile}\" ; true ; }\" ; true" ) +) + +for (( testfilesize=1*1024 ; testfilesize <= 1024*1024 ; testfilesize*=2 )) ; do # Create temp file { - for ((j=0 ; j < i ; j+=16 )) ; do - print "0123456789abcde" + for (( i=0 ; i < testfilesize ; i+=64 )) ; do + print "0123456789abcdef01234567890ABCDEF0123456789abcdef01234567890ABCDE" done } >"${tmpfile}" - - # Run test child - ${SHELL} -c "builtin cat ; print -- \"\$(cat \"${tmpfile}\" | cat)\" ; true" >/dev/null & - (( childpid=$! )) # wait up to log2(i) seconds for the child to terminate # (this is 10 seconds for 1KB and 19 seconds for 512KB) - (( d=log2(i) )) - for (( j=0 ; j < d ; j++ )) ; do - kill -0 ${childpid} 2>/dev/null || break - sleep 0.5 + (( maxwait=log2(testfilesize) )) + + for testid in "${!testcases[@]}" ; do + nameref currtst=testcases[testid] + ${SHELL} -o errexit -c "${currtst.cmd}" >"${tmpfile}.out" & + (( childpid=$! )) + + for (( i=0 ; i < maxwait ; i++ )) ; do + isvalidpid ${childpid} || break + sleep 0.25 + done + + if isvalidpid ${childpid} ; then + err_exit "${currtst.name}: child (pid=${childpid}) still busy, filesize=${testfilesize}." + kill -KILL ${childpid} 2>/dev/null + fi + wait || err_exit "${currtst.name}: Child returned non-zero exit code." # wait for child (and/or avoid zombies/slime) + + # compare input/output + cmp -s "${tmpfile}" "${tmpfile}.out" || err_exit "${currtst.name}: ${tmpfile} and ${tmpfile}.out differ, filesize=${testfilesize}." + rm "${tmpfile}.out" done - if kill -0 ${childpid} 2>/dev/null ; then - err_exit "test1: child (pid=${childpid}) still busy, filesize=${i}." - kill -KILL ${childpid} 2>/dev/null - fi - wait # wait for child (and/or avoid zombies/slime) + # Cleanup rm "${tmpfile}" done -# test 2: Edward's Solaris-specific testcase -${SHELL} -c 'builtin uniq ; set -- `cat /etc/termcap | sort | uniq` ; true' >/dev/null & +# test 2a: Edward Pilatowicz <edward.pilatowicz@sun.com>'s Solaris-specific testcase +${SHELL} -o errexit -c 'builtin uniq ; set -- `cat /etc/termcap | sort | uniq` ; true' >/dev/null & (( childpid=$! )) sleep 5 -if kill -0 ${childpid} 2>/dev/null ; then - err_exit "test2: child (pid=${childpid}) still busy." +if isvalidpid ${childpid} ; then + err_exit "test2a: child (pid=${childpid}) still busy." kill -KILL ${childpid} 2>/dev/null fi -wait # wait for child (and/or avoid zombies/slime) +wait || err_exit "test2a: Child returned non-zero exit code." # wait for child (and/or avoid zombies/slime) + + +# test 2b: Same as test 2a but uses ${... ; } instead of $(...) +${SHELL} -o errexit -c 'builtin uniq ; set -- ${ cat /etc/termcap | sort | uniq ; } ; true' >/dev/null & +(( childpid=$! )) +sleep 5 +if isvalidpid ${childpid} ; then + err_exit "test2b: child (pid=${childpid}) still busy." + kill -KILL ${childpid} 2>/dev/null +fi +wait || err_exit "test2b: Child returned non-zero exit code." # wait for child (and/or avoid zombies/slime) + + +# test 2c: Same as test 2a but makes sure that "uniq" is not a builtin +${SHELL} -o errexit -c 'builtin -d uniq /bin/uniq ; set -- `cat /etc/termcap | sort | uniq` ; true' >/dev/null & +(( childpid=$! )) +sleep 5 +if isvalidpid ${childpid} ; then + err_exit "test2c: child (pid=${childpid}) still busy." + kill -KILL ${childpid} 2>/dev/null +fi +wait || err_exit "test2c: Child returned non-zero exit code." # wait for child (and/or avoid zombies/slime) + + +# test 2d: Same as test 2c but uses ${... ; } instead of $(...) +${SHELL} -o errexit -c 'builtin -d uniq /bin/uniq ; set -- ${ cat /etc/termcap | sort | uniq ; } ; true' >/dev/null & +(( childpid=$! )) +sleep 5 +if isvalidpid ${childpid} ; then + err_exit "test2d: child (pid=${childpid}) still busy." + kill -KILL ${childpid} 2>/dev/null +fi +wait || err_exit "test2d: Child returned non-zero exit code." # wait for child (and/or avoid zombies/slime) + # tests done exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6805792_varmovetest1.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6805792_varmovetest1.sh new file mode 100644 index 0000000000..4f774b2f8b --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6805792_varmovetest1.sh @@ -0,0 +1,152 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether "typeset -m" correctly moves local variables +# into a global variable tree. +# +# This was reported as CR #6805792 ("XXXX"): +# -------- snip -------- +# The following attempt to move a local node into an associative array +# fails like this: +# -- snip -- +# typeset -C tree +# function f1 +# { +# nameref tr=$1 +# +# typeset -A tr.subtree +# +# typeset -C node +# +# node.one="hello" +# node.two="world" +# +# # move local note into the array +# typeset -m tr.subtree["a_node"]=node +# +# return 0 +# } +# f1 tree +# printf "%B\n" tree +# print "ok" +# exit 0 +# -- snip -- +# The output looks like this: +# -- snip -- +# $ ksh93 +# varmovetest1.sh +# ( +# ( +# ) +# ok +# -- snip -- +# ... but AFAIK it should print: +# -- snip -- +# ( +# typeset -A subtree=( +# [a_node]=( +# one=hello +# two=world +# ) +# ) +# ) +# ok +# -- snip -- +# -------- snip -------- +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + + +## test start +compound tree1 tree2 + +# add node to tree which uses "typeset -m" to move a local variable +# into tree1.subtree["a_node"] +function f1 +{ + nameref tr=$1 + + typeset -A tr.subtree + + compound node + + node.one="dummy1" + node.two="dummy2" + + # We use the nameref's here since ast-ksh,2008-12-12 crashes + # when this function returns because "nodeone" and "nodetwo" + # still reference "node" which was renamed. + # (note that "f1" must be first function and the first being + # called, otherwise the crash will not occur) + nameref nodeone=node.one + nameref nodetwo=node.two + nodeone="hello" + nodetwo="world" + + # move local note into the array + typeset -m tr.subtree["a_node"]=node + + return 0 +} + +# Alternative version which uses "nameref" instead of "typeset -m" +function f2 +{ + nameref tr=$1 + + typeset -A tr.subtree + + nameref node=tr.subtree["a_node"] + + node.one="hello" + node.two="world" + + return 0 +} + +f1 tree1 +f2 tree2 + +[[ "${tree1.subtree["a_node"].one}" == "hello" ]] || err_exit "Expected tree1.subtree[\"a_node\"].one == 'hello', got ${tree1.subtree["a_node"].one}" +[[ "${tree1.subtree["a_node"].two}" == "world" ]] || err_exit "Expected tree1.subtree[\"a_node\"].two == 'world', got ${tree1.subtree["a_node"].two}" +[[ "${tree1}" == "${tree2}" ]] || err_exit "tree1 and tree2 differ:"$'\n'"$(diff -u <( printf '%B\n' tree1 ) <( printf '%B\n' tree2 ) )" + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6805794_character_to_wchar_not_working.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6805794_character_to_wchar_not_working.sh new file mode 100644 index 0000000000..bbcb9b168d --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6805794_character_to_wchar_not_working.sh @@ -0,0 +1,106 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether arithmetric operator '<character> +# is working +# +# This was reported as CR #6805794 ('[ku1] printf returns "invalid character constant" for $ printf "%d\n" "'<euro>"'): +# ------------ snip ------------ +# There seems be a bug in how ast-ksh.2008-11-04's "printf" builtin +# handles multibyte characters. For example if I try this in the +# en_US.UTF-8 locale ("<euro>" needs to be replace with the EURO symbol): +# -- snip -- +# $ printf "%d\n" "'<euro>" +# -ksh93: printf: warning: ': invalid character constant +# 226 +# -- snip -- +# AFAIK the correct behaviour was to return the numeric value of the +# <euro> symbol in this case (hexadecimal "20ac", decimal 8364), e.g. +# -- snip -- +# $ printf "%d\n" +# "'<euro>" +# 8364 +# -- snip -- +# Frequency +# Always +# Regression +# No +# Steps to Reproduce +# Enter this in an interractive shell: +# $ printf "%d\n" "'<euro>" +# Expected Result +# -- snip -- +# $ printf "%d\n" +# "'<euro>" +# 8364 +# -- snip -- +# Actual Result +# -- snip -- +# $ printf "%d\n" "'<euro>" +# -ksh93: printf: warning: ': invalid character constant +# 226 +# -- snip -- +# Error Message(s) +# printf: warning: ': invalid character constant +# Test Case +# printf "%d\n" "'<euro>" +# Workaround +# None. +# ------------ snip ------------ +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + + +# declare variables +typeset str + +# test whether the locale uses an UTF-8 (-like) encoding and override it on demand +[[ "$(printf "\u[20ac]")" == $'\342\202\254' ]] || LC_ALL=en_US.UTF-8 +if [[ "$(printf "\u[20ac]")" != $'\342\202\254' ]] ; then + err_exit "Local overrride failed." + exit $((Errors)) +fi + +# run test +str=$(print $'printf "%d\\\\n" "\'\342\202\254"' | source /dev/stdin) +[[ "${str}" == "8364" ]] || err_exit "expected 8364, got ${str}" + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6805795_negative_zero.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6805795_negative_zero.sh new file mode 100644 index 0000000000..1dccc97505 --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6805795_negative_zero.sh @@ -0,0 +1,170 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether arithmetric math correctly supports +# negative zero values +# +# This was reported as CR #6805795 ("[ku1] ksh93 does not differ between -0 and +0"): +# ------------ snip ------------ +# Original bug report was: +# ------ snip ------ +# Is there a reason why ksh93 does not display the negative sign for the +# value zero ? For example if I have use the C99 function "copysign" +# (copies absolute value of operant a and sign of operant b) I get this +# for { a=5, b=-0 }: +# -- snip -- +# $ ksh93 -c 'float x; (( x=copysign(5, -0) )) ; printf "%f\n" +# x' +# -5.000000 +# -- snip -- +# Now if I swap operands a and b I get this result: +# -- snip -- +# $ ksh93 -c 'float x; (( x=copysign(0, -5) )) ; printf "%f\n" x' +# 0.000000 +# -- snip -- +# AFAIK this result should be "-0.000000" ... or not ? +# BTW: Parsing of "-0" doesn't seem to work either, e.g. +# -- snip -- +# $ ksh93 -c 'float x a=-1 b=-0; (( x=copysign(a, b) )) ; printf "%f\n" +# x' +# 1.000000 +# -- snip -- +# ... while AFAIK it should be "-1.000000" since the 2nd operand of +# "copysign" defines the sign of the result. +# ------ snip ------ +# ------------ snip ------------ +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + +typeset str + +# test 1: test "copysign()" using constant values +str=$( + set -o errexit + + print -- $(( copysign(0, -5) )) + ) || err_exit "test failed." +[[ "${str}" == "-0" ]] || err_exit "Expected copysign(0, -5) == -0, got ${str}" + + +# test 2: Same as test 1 but using variables for the values +str=$( + set -o errexit + + float a + float b + float c + + a=0. + b=-5. + + (( c=copysign(a, b) )) + + print -- "$c" + ) || err_exit "test failed." +[[ "${str}" == "-0" ]] || err_exit "Expected c == -0, got ${str}" + + +# test 3: test "signbit()" +str=$( + set -o errexit + + float a + + a=-0. + + print -- $(( signbit(a) )) + ) || err_exit "test failed." +[[ "${str}" == "1" ]] || err_exit "Expected signbit(a, b) == 1, got ${str}" + + +# test 4: test "signbit()" +str=$( + set -o errexit + + float a + float c + + a=-0. + + (( c=signbit(a) )) + + print -- "$c" + ) || err_exit "test failed." +[[ "${str}" == "1" ]] || err_exit "Expected c == 1, got ${str}" + + +# test 5: test whether "typeset -X" (C99 "hexfloat") correctly recognizes +# negative zero assigned from a "float" +str=$( + set -o errexit + + float a # float + typeset -X c # hexfloat + + a=-0. + + # copy value from "float" to "hexfloat" + (( c=a )) + + print -- "$c" + ) || err_exit "test failed." +[[ "${str}" == -0x* ]] || err_exit "Expected c == -0x*, got ${str}" + + +# test 6: Reverse of test 5: Test whether "float" correctly recognizes +# a C99 "hexfloat" value +str=$( + set -o errexit + + typeset -X a # hexfloat + float c # float + + a=-0x0.0000000000000000000000000000p+00 + + # copy value from "hexfloat" to "float" + (( c=a )) + + print -- "$c" + ) || err_exit "test failed." +[[ "${str}" == "-0" ]] || err_exit "Expected c == -0, got ${str}" + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6835835_builtin_cat_n_broken.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6835835_builtin_cat_n_broken.sh new file mode 100644 index 0000000000..dc91bbeb82 --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6835835_builtin_cat_n_broken.sh @@ -0,0 +1,139 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether ksh93's builtin "cat" command properly +# supports the "-n" option. +# +# This was reported as CR #6835835 ('ksh93 "cat" builtin does not handle "-n" correctly'): +# ------------ snip ------------ +# [Originally reported in +# http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/007050.html +# by Casper Dik] +# -- snip -- +# I just noticed this in ksh93: +# ksh93 -c 'yes "" | head -5|cat -n' +# 1 +# 2 +# 3 +# 4 +# (I used this for older shells when I want to a list of all integers from 1 +# to a particular number) +# -- snip -- +# Frequency +# Always +# Regression +# No +# Steps to Reproduce +# Execute $ ksh93 -c 'yes "" | head -5|cat -n' # +# Expected Result +# 1 +# 2 +# 3 +# 4 +# 5 +# Actual Result +# +# +# 1 +# 2 +# +# 3 +# +# 4 +# Error Message(s) +# None. +# Test Case +# See description. +# Workaround +# Disable ksh93's builtin "cat" command either via using an absolute path +# to the "cat" command (POSIX-style workaround) or using ksh93's +# "builtin" command to remove "cat" from the list of builtin +# commands (e.g. $ builtin -d /bin/cat /usr/bin/cat #). +# ------------ snip ------------ +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + +# +# test 1: Compare output of various "cat -n" combinations +# +integer i +typeset expected_output +typeset out + +expected_output=$( ${SHELL} -c 'for ((i=1 ; i <= 12 ; i++ )) ; do printf "%6d\t\n" i ; done' ) + +compound -a testcases=( + # note: we have to add an extra /usr/bin/cat at the end of the pipe to make + # sure the "cat" builtin uses the correct buffering mode to trigger + # the error and a "true" to make sure the "cat" command isn't the last command + # of the shell + ( name="test1a" cmd='integer i ; builtin cat ; for ((i=1 ; i <= 12 ; i++ )) ; do print ; done | cat -n | /usr/bin/cat ; true' ) + # same as "test1a" but uses external "cat" command + ( name="test1b" cmd='integer i ; for ((i=1 ; i <= 12 ; i++ )) ; do print ; done | /usr/bin/cat -n | /usr/bin/cat ; true' ) + + # same as "test1a" but without the last /usr/bin/cat in the pipe + ( name="test1c" cmd='integer i ; builtin cat ; for ((i=1 ; i <= 12 ; i++ )) ; do print ; done | cat -n ; true' ) + # same as "test1b" but without the last /usr/bin/cat in the pipe + ( name="test1d" cmd='integer i ; for ((i=1 ; i <= 12 ; i++ )) ; do print ; done | /usr/bin/cat -n ; true' ) +) + +for testid in "${!testcases[@]}" ; do + nameref tc=testcases[${testid}] + + out="$( ${SHELL} -o errexit -c "${tc.cmd}" )" || err_exit "${tc.name}: Shell failed" + [[ "${expected_output}" == "${out}" ]] || err_exit "${tc.name}: Builtin output does not match expected output" + + out="$( ${SHELL} +o errexit -c "${tc.cmd}" )" || err_exit "${tc.name}: Shell failed" + [[ "${expected_output}" == "${out}" ]] || err_exit "${tc.name}: Builtin output does not match expected output" +done + + +# +# test 2: Casper Dik's original testcase +# from http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/007050.html +# + +cmp -s \ + <( ${SHELL} -c 'yes "" | head -5 | cat -n' ) \ + <( for ((i=1 ; i <= 5 ; i++ )) ; do printf "%6d\t\n" i ; done ) \ + || err_exit 'yes "" | head -5 | cat -n does not match expected output.' + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6848486_echo_test_with_test_undefined_executes_test_builtin.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6848486_echo_test_with_test_undefined_executes_test_builtin.sh new file mode 100644 index 0000000000..396816960a --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6848486_echo_test_with_test_undefined_executes_test_builtin.sh @@ -0,0 +1,94 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether ksh93 does not execute builtin command +# "foo" when referencing variable "foo" when the variable is not +# set (this applies to all builtin commands not bound to a +# specific PATH element, e.g. "test", "sleep", "print" etc.). +# +# This was reported as CR #6848486 ('"echo ${test}" with test +# undefined crashes the shell') +# ------------ snip ------------ +# This is an odd one: +# +# $ ksh93 --version +# version sh (AT&T Research) 93t 2008-11-04 +# $ ksh93 +# jl138328@gir:~$ echo $test +# +# jl138328@gir:~$ echo ${test} +# Segmentation Fault (core dumped) +# ------------ snip ------------ +# +# The bug originates from the ksh93 "type system" which allows +# an application to define it's own types in ksh93. In such cases +# the output of function "mytype.len" is used when type "mytype" +# has no member variable "len" (note it requires the use of +# ${foo} since the use of $foo does not allow "foo" to contain +# a dot in the variable name). +# The implementation in ast-ksh.2009-11-04 however does this +# for _all_ types of variables and not only for those which +# are a member of an application-defined type, therefore +# causing this bug. +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + + +# Test 1: Test whether the shell crashes when looking for an empty +# "shell" variable. +# (note: return code 78 was just picked randomly) +$SHELL -c 'unset test ; print ${test} ; exit 78' >/dev/null 2>&1 +(( $? == 78 )) || err_exit "expected return code is 78, got $?" + + +# Test 2: Test whether the shell can reach a point (which prints +# "#mark") after the use of ${test} in the script. +out=$($SHELL -o errexit -c 'unset test ; print ${test} ; print "#mark"' 2>&1 ) || err_exit "Shell returned error code $?, expected 0." +[[ "$out" == $'\n#mark' ]] || err_exit "Expected output \$'\n#mark', got '${out}'" + + +# Test 3: Check whether the use of ${sleep} returns nothing +# (ast-ksh.2008-11-04 will return the usage string of the sleep +# builtin) +out=$($SHELL -o errexit -c 'print ${sleep} ; print "#mark"' 2>&1 ) || err_exit "Shell returned error code $?, expected 0." +[[ "$out" == $'\n#mark' ]] || err_exit "Expected output \$'\n#mark', got '${out}'" + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6855875_typeset_hexfloat_has_too_few_digits.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6855875_typeset_hexfloat_has_too_few_digits.sh new file mode 100644 index 0000000000..22de05b56c --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6855875_typeset_hexfloat_has_too_few_digits.sh @@ -0,0 +1,145 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether arithmetric math correctly +# converts a IEEE 754-2008 floating-point value to the C99 hexfloat format +# and back _without_ using digits. +# +# This was reported as CR #6855875 ("typeset -X x ; print $x # does not +# print sufficient digits to restore value"): +# ------------ snip ------------ +# $ typeset -X varname # was added to ksh93 to get a reliable way +# (using the C99 "hexfloat" format (see printf(3c)'s "%a" format)) to +# serialise a IEEE754-2008 floating-point value to a string and later feed +# it back into a application _without_ loosing any precision (normal +# base10 floating-point values (e.g. used by $ typeset -E/-F-G #) cause +# rounding errors since IEEE754-2008 |long double| uses base2). +# However $ typeset -l -X x ; ... ; print $x # currently does not print +# sufficient number of digits to restore the full |long double| value as +# expected, instead some digits are missing, resulting in an unwanted +# rounding. +# Example: +# -- snip -- +# $ ksh93 -c 'typeset -l -X y y_ascii; (( y=sin(90) )) ; y_ascii=$y ; (( y +# == y_ascii )) || print "no match,\n\t$(printf "%a\n" y)\n!=\n\t$(printf +# "%a\n" y_ascii)"' +# no match, +# 0x1.c9b9ee41cb8665c7890a136ace6bp-01 +# != +# 0x1.c9b9ee41cc000000000000000000p-01 +# -- snip -- +# Frequency +# Always +# Regression +# No +# Steps to Reproduce +# [See description] +# Expected Result +# [See description] +# Actual Result +# [See description] +# Error Message(s) +# - +# Test Case +# typeset -l -X y y_ascii +# (( y=sin(90) )) +# y_ascii=$y # convert y to string and store it in "y_ascii" +# if (( y == y_ascii )) ; then +# print "no match,\n\t$(printf "%a\n" y)\n!=\n\t$(printf "%a\n" +# y_ascii)" +# fi +# Workaround +# 1. Manually increase the number of digits via typeset +# -X<numdigits> +# OR +# 2. Use $ printf "%a" varname # +# ------------ snip ------------ +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + + +# declare variables +typeset str +integer i +float x +float -a test_values + +typeset -l -X y # hexfloat +typeset -l -E y_restored1 +typeset -l -F y_restored2 +typeset -l -X y_restored3 + + +# create array of test values +for (( x=-181. ; x < 361. ; x+=.1 )) ; do + test_values+=( x ) +done +test_values+=( 0 -0 +0 ) # (nan -nan inf -inf) are excluded since nan!=nan is always "true" + + +# run the tests +for (( i=0 ; i < ${#test_values[@]} ; i++ )) ; do + (( y=sin(test_values[i]) )) + + # convert floating-point value to string (using the hexfloat format) and store it in "str" + str="${y}" + + # convert it back (via string assignment) + y_restored1="${str}" + y_restored2="${str}" + y_restored3="${str}" + (( y == y_restored1 )) || err_exit "no match,"$'\n\t'"$(printf "%a\n" y)"$'\n'"!="$'\n\t'"$(printf "%a\n" y_restored1)" + (( y == y_restored2 )) || err_exit "no match,"$'\n\t'"$(printf "%a\n" y)"$'\n'"!="$'\n\t'"$(printf "%a\n" y_restored2)" + (( y == y_restored3 )) || err_exit "no match,"$'\n\t'"$(printf "%a\n" y)"$'\n'"!="$'\n\t'"$(printf "%a\n" y_restored3)" + + # convert it back (using arithmetric expression) + (( y_restored1=str )) + (( y_restored2=str )) + (( y_restored3=str )) + (( y == y_restored1 )) || err_exit "no match,"$'\n\t'"$(printf "%a\n" y)"$'\n'"!="$'\n\t'"$(printf "%a\n" y_restored1)" + (( y == y_restored2 )) || err_exit "no match,"$'\n\t'"$(printf "%a\n" y)"$'\n'"!="$'\n\t'"$(printf "%a\n" y_restored2)" + (( y == y_restored3 )) || err_exit "no match,"$'\n\t'"$(printf "%a\n" y)"$'\n'"!="$'\n\t'"$(printf "%a\n" y_restored3)" + + # we exit if we get more than 8 errors (126 would be the maximum) + (( Errors > 8 )) && exit $((Errors)) +done + + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.sh new file mode 100644 index 0000000000..568b43f35d --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.sh @@ -0,0 +1,111 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether the Solaris kernel can directly execute compiled +# shell code. +# +# This was reported as CR #6862121 ("shbinexec kernel module defunct"): +# ------------ snip ------------ +# [Originally reported by Sun Japan] +# The new shbinexec kernel module added in B106 is defunct, originally +# caused by my mismerge of the original development tree and later +# because the matching test module didn't test it correctly (April +# quickly discovered the problem but the issue drowned in the cleanup +# putbacks ). +# Frequency +# Always +# Regression +# No +# Steps to Reproduce +# $ cat test1.sh +# print hello +# printf "args=%s\n" "$@" +# $ shcomp test1.sh test1 +# # note: this MUST be bash since ksh93 has special support for compiled shell +# # scripts which causes the kernel module to be bypassed (that's why the tes +# # never worked) +# $ bash -c './test1 "a b" "c" "d"' +# Expected Result +# hello +# args=a a1 +# args=b +# args=c +# Actual Result +# ./test1: line 1: a: not found +# Error Message(s) +# ./test1: line 1: a: not found +# Test Case +# See above. +# ------------ snip ------------ +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + +typeset ocwd +typeset tmpdir +typeset out + +# create temporary test directory +ocwd="$PWD" +tmpdir="$(mktemp -d "test_sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.XXXXXXXX")" || err_exit "Cannot create temporary directory" + +cd "${tmpdir}" || err_exit "cd ${tmpdir} failed." + + +# run tests +{ +cat <<EOF + print hello + printf "args=%s\n" "\$@" +EOF +} >script1.sh + +# Compile script (note we use the platform's /usr/bin/shcomp, _not_ ${SHCOMP}) +/usr/bin/shcomp "script1.sh" "script1" || err_exit "shcomp failed with error=$?" + +[[ -x "./script1" ]] || err_exit "Script script1 not executable" +out="$(/usr/bin/bash -c './script1 a b "c d"' 2>&1 )" || err_exit "Compiled script failed to execute, error=$?" +[[ "${out}" == $'hello\nargs=a\nargs=b\nargs=c d' ]] || err_exit "Expected xxx, got $(printf "%q\n" "$out")" + +# cleanup +rm "script1" "script1.sh" +cd "${ocwd}" +rmdir "${tmpdir}" || err_exit "Cannot remove temporary directory ${tmpdir}". + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_cr_6881017_background_process_in_subshell_hangs_caller.sh b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6881017_background_process_in_subshell_hangs_caller.sh new file mode 100644 index 0000000000..a5aae41ce5 --- /dev/null +++ b/usr/src/lib/libshell/common/tests/sun_solaris_cr_6881017_background_process_in_subshell_hangs_caller.sh @@ -0,0 +1,82 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether a background process called in a subshell can +# cause it to wait for the child process instead of exiting. +# +# This was reported as CR #6881017 ("Subshell doesn't exit, holds pipe +# open preventing callers from exiting"): +# ------------ snip ------------ +# The following scenario hangs with snv_122, 100% reproducible: +# +# Create a script hangit: +# ----- +# #!/bin/ksh +# ( sleep 100000 </dev/null >/dev/null 2>&1 & ) +# exit 0 +# ----- +# +# Run the following command: +# hangit | tee -a /tmp/log +# +# The hang can be eliminated either by removing the "exit 0" line (?!?), or by +# redirecting the subshell output to /dev/null. +# +# This is pretty nasty. I've whittled it down to this simple case but am seeing +# it in a much more subtle and complex environment where there are several +# intermediate calling scripts which have exited and eventually the parent pipes +# the output and hangs on the open pipe. It was hard to track down. +# ------------ snip ------------ +# + +# test setup +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit $LINENO' + +set -o nounset +Command=${0##*/} +integer Errors=0 + +float tstart tstop tdiff + +# run test with 10 second timeout +(( tstart=SECONDS )) +$SHELL -c '( sleep 10 </dev/null >/dev/null 2>&1 & ) ; exit 0' | cat >/dev/null +(( tstop=SECONDS )) + +# we remove two seconds below to make sure we don't run into issues +# with smaller xntpd adjustments +(( tdiff=tstop-tstart )) +(( tdiff < (10.-2.) )) || err_exit "test run needed ${tdiff} seconds to complete (instead of < 8.)" + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_getconf.sh b/usr/src/lib/libshell/common/tests/sun_solaris_getconf.sh index 2089ad184c..8e1e2ab937 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_getconf.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_getconf.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -38,6 +38,7 @@ function err_exit } alias err_exit='err_exit $LINENO' +set -o nounset Command=${0##*/} integer Errors=0 @@ -56,6 +57,15 @@ export PATH=/usr/bin:/bin # work in compiled shell scripts) typeset -r getconf_test_functions="$( cat <<EOF +function err_exit +{ + print -u2 -n "\t" + print -u2 -r \${Command}[\$1]: "\${@:2}" + (( Errors++ )) +} +alias err_exit='err_exit \$LINENO' +Command=\${0##*/} +integer Errors=0 # compare builtin getconf output with /usr/bin/getconf function compare_normal { @@ -63,13 +73,13 @@ function compare_normal /usr/bin/getconf -a | while read i ; do (( getconf_keys++ )) - t="${i%:*}" + t="\${i%:*}" - a="$(getconf "$t" 2>/dev/null)" - b="$(/usr/bin/getconf "$t" 2>/dev/null)" + a="\$(getconf "\$t" 2>/dev/null)" + b="\$(/usr/bin/getconf "\$t" 2>/dev/null)" - if [[ "$a" != "$b" ]] ; then - print -u2 "getconf/normal built mismatch: |$t|:|$a| != |$b|" + if [[ "\$a" != "\$b" ]] ; then + print -u2 "getconf/normal built mismatch: |\$t|:|\$a| != |\$b|" (( mismatch++ )) fi done @@ -82,13 +92,13 @@ function compare_path /usr/bin/getconf -a | while read i ; do (( getconf_keys++ )) - t="${i%:*}" + t="\${i%:*}" - a="$(getconf "$t" "/tmp" 2>/dev/null)" - b="$(/usr/bin/getconf "$t" "/tmp" 2>/dev/null)" + a="\$(getconf "\$t" "/tmp" 2>/dev/null)" + b="\$(/usr/bin/getconf "\$t" "/tmp" 2>/dev/null)" - if [[ "$a" != "$b" ]] ; then - print -u2 "getconf/path built mismatch: |$t|:|$a| != |$b|" + if [[ "\$a" != "\$b" ]] ; then + print -u2 "getconf/path built mismatch: |\$t|:|\$a| != |\$b|" (( mismatch++ )) fi done @@ -108,7 +118,7 @@ do export PATH="${i}" ## test whether the getconf builtin is available - if [[ "$(builtin | fgrep "/bin/getconf")" = "" ]] ; then + if [[ "$(builtin | fgrep "/bin/getconf")" == "" ]] ; then err_exit '/bin/getconf not found in the list of builtins.' fi @@ -161,5 +171,6 @@ do (( Errors+=$? )) done + # tests done exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_local_compound_nameref001.sh b/usr/src/lib/libshell/common/tests/sun_solaris_local_compound_nameref001.sh index 30a2deb314..e95a502daf 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_local_compound_nameref001.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_local_compound_nameref001.sh @@ -28,17 +28,20 @@ # name reference test #001 # +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' +set -o nounset +Command=${0##*/} integer Errors=0 + function function2 { nameref v=$1 @@ -60,5 +63,6 @@ x="$(function1)" [[ "$x" != 'x=19, y=20' ]] && err_exit "expected 'x=19, y=20', got '${x}'" + # tests done exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_staticvariables.sh b/usr/src/lib/libshell/common/tests/sun_solaris_staticvariables.sh index 9230c9925f..9f430d7c1c 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_staticvariables.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_staticvariables.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -45,8 +45,11 @@ function testfunc alias testfunc='testfunc $LINENO' alias err_exit='err_exit2 $LINENO' +set -o nounset +Command=${0##*/} integer Errors=0 + # string testfunc '(function l { typeset -S x ; x+="#" ; $1 && print "$x" ; } ; l false ; l false ; l true)' "###" testfunc 'function l { typeset -S x=">" ; x+="#" ; $1 && print "$x" ; } ; l false ; l false ; l true' ">###" diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_vartree001.sh b/usr/src/lib/libshell/common/tests/sun_solaris_vartree001.sh index 74783e6ff7..bf5257a78a 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_vartree001.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_vartree001.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -50,15 +50,17 @@ # [14] main(argc = 2, argv = 0xffffffff7ffffa08), line 46 in "pmain.c" # +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' +# the test cannot use "nounset" +Command=${0##*/} integer Errors=0 diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_vartree002.sh b/usr/src/lib/libshell/common/tests/sun_solaris_vartree002.sh index e233f596e3..c2ca8f5e5e 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_vartree002.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_vartree002.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -31,22 +31,24 @@ # and "unset" handling. # +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' +# the test cannot use "nounset" +Command=${0##*/} integer Errors=0 # "built_tree1" and "built_tree2" are identical except the way how they test # whether a variable exists: # - "built_tree1" uses "${varname}" != "", e.g. looking whether the variable # as non-zero length content -# - "built_tree2" uses "! (unset varname)", e.g. "unset" in a subshell +# - "built_tree2" uses "! ([[ -v varname ]] ; res=$? ; unset varname ; exit $res)", e.g. "unset" in a subshell. function build_tree1 { #set -o errexit -o xtrace @@ -113,7 +115,7 @@ function build_tree1 # whether a variable exists: # - "built_tree1" uses "${varname}" != "", e.g. looking whether the variable # as non-zero length content -# - "built_tree2" uses "! (unset varname)", e.g. "unset" in a subshell +# - "built_tree2" uses "! ([[ -v varname ]] ; res=$? ; unset varname ; exit $res)", e.g. "unset" in a subshell. function build_tree2 { #set -o errexit -o xtrace @@ -144,12 +146,12 @@ function build_tree2 [[ "$c" == "" ]] && c='-' #if [[ "${dest_tree.l1["$a"]}" == "" ]] ; then - if ! (unset dest_tree.l1["$a"]) ; then + if ! ([[ -v dest_tree.l1["$a"] ]] ; res=$? ; unset dest_tree.l1["$a"] ; exit $res) ; then typeset -A dest_tree.l1["$a"].l2 fi #if [[ "${dest_tree.l1["$a"].l2["$b"]}" == "" ]] ; then - if ! (unset dest_tree.l1["$a"].l2["$b"]) ; then + if ! ([[ -v dest_tree.l1["$a"].l2["$b"] ]] ; res=$? ; unset dest_tree.l1["$a"].l2["$b"] ; exit $res) ; then typeset -A dest_tree.l1["$a"].l2["$b"].l3 fi @@ -301,43 +303,47 @@ function main #### test "unset" in a subshell - ( unset 'mytree_global1.l1[urw].l2[itc zapfdingbats]' ) || \ + ( [[ -v 'mytree_global1.l1[urw].l2[itc zapfdingbats]' ]] ; res=$? ; unset 'mytree_global1.l1[urw].l2[itc zapfdingbats]' ; exit $res ) || \ err_exit "Try 1: Variable 'mytree_global1.l1[urw].l2[itc zapfdingbats]' not found." - ( unset 'mytree_global1.l1[urw].l2[itc zapfdingbats]' ) || \ + ( [[ -v 'mytree_global1.l1[urw].l2[itc zapfdingbats]' ]] ; res=$? ; unset 'mytree_global1.l1[urw].l2[itc zapfdingbats]' ; exit $res ) || \ err_exit "Try 2: Variable 'mytree_global1.l1[urw].l2[itc zapfdingbats]' not found." # remove parent node (array element) and then check whether the child is gone, too: ( set -o errexit unset 'mytree_global1.l1[urw].l2[itc zapfdingbats]' - ! unset 'mytree_global1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' + ! [[ -v 'mytree_global1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' ]] ) || err_exit "Global: Parent node removed (array element), child still exists" ( set -o errexit unset 'mytree_local1.l1[urw].l2[itc zapfdingbats]' - ! unset 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' + ! [[ -v 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' ]] ) || err_exit "Local: Parent node removed (array element), child still exists" # remove parent node (array variable) and then check whether the child is gone, too: ( set -o errexit unset 'mytree_local1.l1[urw].l2' - ! unset 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' + ! [[ -v 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' ]] ) || err_exit "Global: Parent node removed (array variable), child still exists" ( set -o errexit unset 'mytree_local1.l1[urw].l2' - ! unset 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' + ! [[ -v 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' ]] ) || err_exit "Local: Parent node removed (array variable), child still exists" #### test "unset" and compare trees - unset 'mytree_global1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' || + [[ -v 'mytree_global1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' ]] ; res=$? + unset 'mytree_global1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' + (( res == 0 )) || err_exit "Variable 'mytree_global1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' not found." [[ "${mytree_global1}" != "${mytree_local1}" ]] || err_exit "mytree_global1 and mytree_local1 should differ" - unset 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' || + [[ -v 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' ]] ; res=$? + unset 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' + (( res == 0 )) || err_exit "Variable 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' not found." # Compare trees (after "unset") diff --git a/usr/src/lib/libshell/common/tests/sun_solaris_vartree003.sh b/usr/src/lib/libshell/common/tests/sun_solaris_vartree003.sh index 89bc9e7541..1bab7006c3 100644 --- a/usr/src/lib/libshell/common/tests/sun_solaris_vartree003.sh +++ b/usr/src/lib/libshell/common/tests/sun_solaris_vartree003.sh @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -31,15 +31,17 @@ # and "unset" handling. # +# test setup function err_exit { print -u2 -n "\t" print -u2 -r ${Command}[$1]: "${@:2}" - (( Errors+=1 )) + (( Errors++ )) } - alias err_exit='err_exit $LINENO' +# the test cannot use "nounset" +Command=${0##*/} integer Errors=0 function example_tree diff --git a/usr/src/lib/libshell/common/tests/tilde.sh b/usr/src/lib/libshell/common/tests/tilde.sh index 60a2de0aa8..e22626f6df 100644 --- a/usr/src/lib/libshell/common/tests/tilde.sh +++ b/usr/src/lib/libshell/common/tests/tilde.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -25,6 +25,12 @@ function err_exit } alias err_exit='err_exit $LINENO' +Command=${0##*/} +integer Errors=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + function home # id { typeset IFS=: pwd=/etc/passwd @@ -36,8 +42,6 @@ function home # id fi } -Command=${0##*/} -integer Errors=0 OLDPWD=/bin if [[ ~ != $HOME ]] then err_exit '~' not $HOME @@ -69,24 +73,23 @@ do h=$(home $u) if [[ $h != . ]] then [[ ~$u -ef $h ]] || err_exit "~$u not $h" x=~$u - [[ $x -ef $h ]] || "x=~$u not $h" + [[ $x -ef $h ]] || x="~$u not $h" break fi done -x=~%% -if [[ $x != '~%%' ]] -then err_exit 'x='~%%' not '~%% +x=~g.r.emlin +if [[ $x != '~g.r.emlin' ]] +then err_exit "x=~g.r.emlin failed -- expected '~g.r.emlin', got '$x'" fi x=~:~ if [[ $x != "$HOME:$HOME" ]] -then err_exit x=~:~ not $HOME:$HOME +then err_exit "x=~:~ failed, expected '$HOME:$HOME', got '$x'" fi HOME=/ [[ ~ == / ]] || err_exit '~ should be /' -trap 'rm -rf /tmp/kshtilde$$' EXIT [[ ~/foo == /foo ]] || err_exit '~/foo should be /foo when ~==/' -print $'print ~+\n[[ $1 ]] && $0' > /tmp/kshtilde$$ -chmod +x /tmp/kshtilde$$ +print $'print ~+\n[[ $1 ]] && $0' > $tmp/tilde +chmod +x $tmp/tilde nl=$'\n' -[[ $(/tmp/kshtilde$$ foo) == "$PWD$nl$PWD" ]] 2> /dev/null || err_exit 'tilde fails inside a script run by name' +[[ $($tmp/tilde foo) == "$PWD$nl$PWD" ]] 2> /dev/null || err_exit 'tilde fails inside a script run by name' exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/timetype.sh b/usr/src/lib/libshell/common/tests/timetype.sh index c2046d5272..94b27843f1 100644 --- a/usr/src/lib/libshell/common/tests/timetype.sh +++ b/usr/src/lib/libshell/common/tests/timetype.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # diff --git a/usr/src/lib/libshell/common/tests/treemove.sh b/usr/src/lib/libshell/common/tests/treemove.sh new file mode 100644 index 0000000000..9e83e35e50 --- /dev/null +++ b/usr/src/lib/libshell/common/tests/treemove.sh @@ -0,0 +1,85 @@ +# +# 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 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This test checks whether "typeset -m" correctly moves local variables +# into a global variable tree. +# +# This was reported as CR #XXXXXXXX ("XXXX"): +# -- snip -- +#XXXX +# -- snip -- +# + +function err_exit +{ + print -u2 -n "\t" + print -u2 -r ${Command}[$1]: "${@:2}" + (( Errors+=1 )) +} + +alias err_exit='err_exit $LINENO' + +integer Errors=0 + +## test start +typeset -C tree1 tree2 + +# add node to tree which uses "typeset -m" to move a local variable +# into tree1.subtree["a_node"] +function f1 +{ + nameref tr=$1 + typeset -A tr.subtree + typeset -C node + node.one="hello" + node.two="world" + # move local note into the array +false + typeset -m tr.subtree["a_node"]=node + return 0 +} + +# Alternative version which uses "nameref" instead of "typeset -m" +function f2 +{ + nameref tr=$1 + typeset -A tr.subtree + nameref node=tr.subtree["a_node"] + node.one="hello" + node.two="world" + return 0 +} + +f1 tree1 +f2 tree2 + +[[ "${tree1.subtree["a_node"].one}" == "hello" ]] || err_exit "expected tree1.subtree[\"a_node\"].one == 'hello', got ${tree1.subtree["a_node"].one}" +[[ "${tree1.subtree["a_node"].two}" == "world" ]] || err_exit "expected tree1.subtree[\"a_node\"].two == 'world', got ${tree1.subtree["a_node"].two}" +[[ "${tree1}" == "${tree2}" ]] || err_exit "tree1 and tree2 differ:$'\n'" + +# tests done +exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/types.sh b/usr/src/lib/libshell/common/tests/types.sh index 24be9e9863..5904640e07 100644 --- a/usr/src/lib/libshell/common/tests/types.sh +++ b/usr/src/lib/libshell/common/tests/types.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -27,6 +27,10 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 + +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + integer n=2 typeset -T Type_t=( @@ -109,14 +113,13 @@ x=(a b c) typeset -m x[1]=x[2] [[ ${x[1]} == c ]] || err_exit 'move an indexed array element fails' [[ ${x[2]} ]] && err_exit 'x[2] should be unset after move' -trap 'rm -f /tmp/kshtype$$' EXIT -cat > /tmp/kshtype$$ <<- \+++ +cat > $tmp/types <<- \+++ typeset -T Pt_t=(float x=1. y=0.) Pt_t p=(y=2) print -r -- ${p.y} +++ expected=2 -got=$(. /tmp/kshtype$$) 2>/dev/null +got=$(. $tmp/types) 2>/dev/null [[ "$got" == "$expected" ]] || err_exit "typedefs in dot script failed -- expected '$expected', got '$got'" typeset -T X_t=( typeset x=foo y=bar @@ -263,6 +266,114 @@ $SHELL > /dev/null <<- '+++++' || err_exit 'passing _ as nameref arg not workin function f { f1 _ ;} ) A_t a - [[ ${ a.f ./t1;} == "$a" ]] + [[ ${ a.f ./t1;} == "$a" ]] +++++ +expected='A_t b.a=(name=one;)' +[[ $( $SHELL << \+++ + typeset -T A_t=( + typeset name=aha + ) + typeset -T B_t=( + typeset arr + A_t a + f() + { + _.a=(name=one) + typeset -p _.a + } + ) + B_t b + b.f ++++ +) == "$expected" ]] 2> /dev/null || err_exit '_.a=(name=one) not expanding correctly' +expected='A_t x=(name=xxx;)' +[[ $( $SHELL << \+++ + typeset -T A_t=( + typeset name + ) + A_t x=(name="xxx") + typeset -p x ++++ +) == "$expected" ]] || err_exit 'empty field in definition does not expand correctly' + +typeset -T Foo_t=( + integer x=3 + integer y=4 + len() { print -r -- $(( sqrt(_.x**2 + _.y**2))) ;} +) +Foo_t foo +[[ ${foo.len} == 5 ]] || err_exit "discipline function len not working" + +typeset -T benchmark_t=( + integer num_iterations +) +function do_benchmarks +{ + nameref tst=b + integer num_iterations + (( num_iterations= int(tst.num_iterations * 1.0) )) + printf "%d\n" num_iterations +} +benchmark_t b=(num_iterations=5) +[[ $(do_benchmarks) == 5 ]] || err_exit 'scoping of nameref of type variables in arithmetic expressions not working' + +function cat_content +{ + cat <<- EOF + ( + foo_t -a foolist=( + ( val=3 ) + ( val=4 ) + ( val=5 ) + ) + ) + EOF + return 0 +} +typeset -T foo_t=( + integer val=-1 + function print + { + print -- ${_.val} + } +) +function do_something +{ + nameref li=$1 # "li" may be an index or associative array + li[2].print +} +cat_content | read -C x +[[ $(do_something x.foolist) == 5 ]] || err_exit 'subscripts not honored for arrays of type with disciplines' + +typeset -T benchcmd_t=( + float x=1 + float y=2 +) +unset x +compound x=( + float o + benchcmd_t -a m + integer h +) +expected=$'(\n\ttypeset -l -i h=0\n\tbenchcmd_t -a m\n\ttypeset -l -E o=0\n)' +[[ $x == "$expected" ]] || err_exit 'compound variable with array of types with no elements not working' + +expected=$'Std_file_t db.file[/etc/profile]=(action=preserve;typeset -A sum=([8242e663d6f7bb4c5427a0e58e2925f3]=1);)' +{ + got=$($SHELL <<- \EOF + MAGIC='stdinstall (at&t research) 2009-08-25' + typeset -T Std_file_t=( + typeset action + typeset -A sum + ) + typeset -T Std_t=( + typeset magic=$MAGIC + Std_file_t -A file + ) + Std_t db=(magic='stdinstall (at&t research) 2009-08-25';Std_file_t -A file=( [/./home/gsf/.env.sh]=(action=preserve;typeset -A sum=([9b67ab407d01a52b3e73e3945b9a3ee0]=1);)[/etc/profile]=(action=preserve;typeset -A sum=([8242e663d6f7bb4c5427a0e58e2925f3]=1);)[/home/gsf/.profile]=(action=preserve;typeset -A sum=([3ce23137335219672bf2865d003a098e]=1);));) + typeset -p db.file[/etc/profile] + EOF) +} 2> /dev/null +[[ $got == "$expected" ]] || err_exit 'types with arrays of types as members fails' + exit $Errors diff --git a/usr/src/lib/libshell/common/tests/variables.sh b/usr/src/lib/libshell/common/tests/variables.sh index 1808d2fbcf..f174a9a2bf 100644 --- a/usr/src/lib/libshell/common/tests/variables.sh +++ b/usr/src/lib/libshell/common/tests/variables.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -28,11 +28,14 @@ alias err_exit='err_exit $LINENO' Command=${0##*/} integer Errors=0 +tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } +trap "cd /; rm -rf $tmp" EXIT + [[ ${.sh.version} == "$KSH_VERSION" ]] || err_exit '.sh.version != KSH_VERSION' unset ss -[[ ${@ss} ]] && err_exit '${@ss} should be empty string when ss is unset' -[[ ${!ss} == ss ]] || err_exit '${!ss} should be ss when ss is unset' -[[ ${#ss} == 0 ]] || err_exit '${#ss} should be 0 when ss is unset' +[[ ${@ss} ]] && err_exit '${@ss} should be empty string when ss is unset' +[[ ${!ss} == ss ]] || err_exit '${!ss} should be ss when ss is unset' +[[ ${#ss} == 0 ]] || err_exit '${#ss} should be 0 when ss is unset' # RANDOM if (( RANDOM==RANDOM || $RANDOM==$RANDOM )) then err_exit RANDOM variable not working @@ -57,17 +60,19 @@ fi #fi # PWD if [[ ! $PWD -ef . ]] -then err_exit PWD variable not working +then err_exit PWD variable failed, not equivalent to . fi # PPID -if [[ $($SHELL -c 'print $PPID') != $$ ]] -then err_exit PPID variable not working +exp=$$ +got=${ $SHELL -c 'print $PPID'; } +if [[ ${ $SHELL -c 'print $PPID'; } != $$ ]] +then err_exit "PPID variable failed -- expected '$exp', got '$got'" fi # OLDPWD old=$PWD cd / if [[ $OLDPWD != $old ]] -then err_exit OLDPWD variable not working +then err_exit "OLDPWD variable failed -- expected '$old', got '$OLDPWD'" fi cd $old || err_exit cd failed # REPLY @@ -90,7 +95,7 @@ LINENO=save+10 IFS=: x=a::b::c if [[ $x != a::b::c ]] -then err_exit "Word splitting on constants" +then err_exit "word splitting on constants" fi set -- $x if [[ $# != 5 ]] @@ -171,7 +176,7 @@ unset -n foo foo=junk function foo.get { - .sh.value=stuff + .sh.value=stuff unset -f foo.get } if [[ $foo != stuff ]] @@ -209,22 +214,19 @@ done kill $! unset x CDPATH=/ -x=$(cd tmp) -if [[ $x != /tmp ]] +x=$(cd ${tmp#/}) +if [[ $x != $tmp ]] then err_exit 'CDPATH does not display new directory' fi -mkdir /tmp/ksh$$ CDPATH=/: -x=$(cd /tmp;cd ksh$$) +x=$(cd ${tmp%/*}; cd ${tmp##*/}) if [[ $x ]] then err_exit 'CDPATH displays new directory when not used' fi -x=$(cd tmp/ksh$$) -if [[ $x != /tmp/ksh$$ ]] -then err_exit "CDPATH tmp/ksh$$ does not display new directory" +x=$(cd ${tmp#/}) +if [[ $x != $tmp ]] +then err_exit "CDPATH ${tmp#/} does not display new directory" fi -cd / -rm -rf /tmp/ksh$$ TMOUT=100 (TMOUT=20) if (( TMOUT !=100 )) @@ -411,15 +413,15 @@ done unset IFS if [[ $( (print ${12345:?}) 2>&1) != *12345* ]] -then err_exit 'Incorrect error message with ${12345?}' +then err_exit 'incorrect error message with ${12345?}' fi unset foobar if [[ $( (print ${foobar:?}) 2>&1) != *foobar* ]] -then err_exit 'Incorrect error message with ${foobar?}' +then err_exit 'incorrect error message with ${foobar?}' fi unset bar if [[ $( (print ${bar:?bam}) 2>&1) != *bar*bam* ]] -then err_exit 'Incorrect error message with ${foobar?}' +then err_exit 'incorrect error message with ${foobar?}' fi { $SHELL -c ' function foo @@ -427,14 +429,13 @@ function foo typeset SECONDS=0 sleep 1.5 print $SECONDS - + } x=$(foo) -(( x >1 && x < 2 )) +(( x >1 && x < 2 )) ' } 2> /dev/null || err_exit 'SECONDS not working in function' -trap 'rm -f /tmp/script$$ /tmp/out$$' EXIT -cat > /tmp/script$$ <<-\! +cat > $tmp/script <<-\! posixfun() { unset x @@ -451,12 +452,12 @@ cat > /tmp/script$$ <<-\! else print -r -- "${.sh.file}" fi ! -chmod +x /tmp/script$$ -. /tmp/script$$ 1 -[[ $file == /tmp/script$$ ]] || err_exit ".sh.file not working for dot scripts" -[[ $($SHELL /tmp/script$$) == /tmp/script$$ ]] || err_exit ".sh.file not working for scripts" -[[ $(posixfun .sh.file) == /tmp/script$$ ]] || err_exit ".sh.file not working for posix functions" -[[ $(fun .sh.file) == /tmp/script$$ ]] || err_exit ".sh.file not working for functions" +chmod +x $tmp/script +. $tmp/script 1 +[[ $file == $tmp/script ]] || err_exit ".sh.file not working for dot scripts" +[[ $($SHELL $tmp/script) == $tmp/script ]] || err_exit ".sh.file not working for scripts" +[[ $(posixfun .sh.file) == $tmp/script ]] || err_exit ".sh.file not working for posix functions" +[[ $(fun .sh.file) == $tmp/script ]] || err_exit ".sh.file not working for functions" [[ $(posixfun .sh.fun) == posixfun ]] || err_exit ".sh.fun not working for posix functions" [[ $(fun .sh.fun) == fun ]] || err_exit ".sh.fun not working for functions" [[ $(posixfun .sh.subshell) == 1 ]] || err_exit ".sh.subshell not working for posix functions" @@ -483,22 +484,22 @@ function dave.unset unset dave [[ $(typeset +f) == *dave.* ]] && err_exit 'unset discipline not removed' -print 'print ${VAR}' > /tmp/script$$ +print 'print ${VAR}' > $tmp/script unset VAR -VAR=new /tmp/script$$ > /tmp/out$$ -got=$(</tmp/out$$) +VAR=new $tmp/script > $tmp/out +got=$(<$tmp/out) [[ $got == new ]] || err_exit "previously unset environment variable not passed to script, expected 'new', got '$got'" [[ ! $VAR ]] || err_exit "previously unset environment variable set after script, expected '', got '$VAR'" unset VAR VAR=old -VAR=new /tmp/script$$ > /tmp/out$$ -got=$(</tmp/out$$) +VAR=new $tmp/script > $tmp/out +got=$(<$tmp/out) [[ $got == new ]] || err_exit "environment variable covering local variable not passed to script, expected 'new', got '$got'" [[ $VAR == old ]] || err_exit "previously set local variable changed after script, expected 'old', got '$VAR'" unset VAR export VAR=old -VAR=new /tmp/script$$ > /tmp/out$$ -got=$(</tmp/out$$) +VAR=new $tmp/script > $tmp/out +got=$(<$tmp/out) [[ $got == new ]] || err_exit "environment variable covering environment variable not passed to script, expected 'new', got '$got'" [[ $VAR == old ]] || err_exit "previously set environment variable changed after script, expected 'old', got '$VAR'" @@ -511,7 +512,7 @@ got=$(</tmp/out$$) } dave=foo; dave+=bar [[ $dave == barfoo ]] || exit 2 -) 2> /dev/null +) 2> /dev/null case $? in 0) ;; 1) err_exit 'append discipline not implemented';; @@ -522,8 +523,8 @@ esac function .sh.foobar.get { .sh.value=world - } -} 2> /dev/null || err_exit "Can't add get discipline to .sh.foobar" + } +} 2> /dev/null || err_exit "cannot add get discipline to .sh.foobar" [[ ${.sh.foobar} == world ]] || err_exit 'get discipline for .sh.foobar not working' x='a|b' IFS='|' @@ -557,12 +558,12 @@ function foo.set ;; esac } -foo[barrier_hit]=no +foo[barrier_hit]=no foo[bar]=1 (( foo[bar] == 1 )) || err_exit 'foo[bar] should be 1' [[ ${foo[barrier_hit]} == no ]] || err_exit 'foo[barrier_hit] should be no' [[ ${foo[barrier_not_hit]} == yes ]] || err_exit 'foo[barrier_not_hit] should be yes' -foo[barrier_hit]=no +foo[barrier_hit]=no foo[bar]=2 (( foo[bar] == 5 )) || err_exit 'foo[bar] should be 5' [[ ${foo[barrier_hit]} == yes ]] || err_exit 'foo[barrier_hit] should be yes' @@ -576,8 +577,10 @@ function x.set } x[0]=0 x[1]=1 x[2]=2 x[3]=3 [[ ${x[@]} == '12 8 5 3' ]] || err_exit 'set discipline for indexed array not working correctly' +float seconds ((SECONDS=3*4)) -(( SECONDS < 12 || SECONDS > 12.1 )) && err_exit "SECONDS is $SECONDS and should be close to 12" +seconds=SECONDS +(( seconds < 12 || seconds > 12.1 )) && err_exit "SECONDS is $seconds and should be close to 12" unset a function a.set { @@ -611,15 +614,37 @@ do nameref r=$v else err_exit "unset $v; : \$$v failed" fi done + +x=x for v in LC_ALL LC_CTYPE LC_MESSAGES LC_COLLATE LC_NUMERIC do nameref r=$v unset $v [[ $r ]] && err_exit "unset $v failed -- expected '', got '$r'" d=$($SHELL -c "$v=$x" 2>&1) [[ $d ]] || err_exit "$v=$x failed -- expected locale diagnostic" - ( r=$x; [[ ! $r ]] ) 2>/dev/null || err_exit "$v=$x failed -- expected ''" - ( r=C; r=$x; [[ $r == C ]] ) 2>/dev/null || err_exit "$v=C; $v=$x failed -- expected 'C'" + { g=$( r=$x; print -- $r ); } 2>/dev/null + [[ $g == '' ]] || err_exit "$v=$x failed -- expected '', got '$g'" + { g=$( r=C; r=$x; print -- $r ); } 2>/dev/null + [[ $g == 'C' ]] || err_exit "$v=C; $v=$x failed -- expected 'C', got '$g'" done PATH=$path +cd $tmp + +print print -n zzz > zzz +chmod +x zzz +exp='aaazzz' +got=$($SHELL -c 'unset SHLVL; print -n aaa; ./zzz' 2>&1) >/dev/null 2>&1 +[[ $got == "$exp" ]] || err_exit "unset SHLVL causes script failure -- expected '$exp', got '$got'" + +mkdir glean +for cmd in date ok +do exp="$cmd ok" + rm -f $cmd + print print $exp > glean/$cmd + chmod +x glean/$cmd + got=$(CDPATH=:.. $SHELL -c "PATH=:/bin:/usr/bin; date > /dev/null; cd glean && ./$cmd" 2>&1) + [[ $got == "$exp" ]] || err_exit "cd with CDPATH after PATH change failed -- expected '$exp', got '$got'" +done + exit $((Errors)) diff --git a/usr/src/lib/libshell/common/tests/vartree1.sh b/usr/src/lib/libshell/common/tests/vartree1.sh index 88116a24c3..67134086af 100644 --- a/usr/src/lib/libshell/common/tests/vartree1.sh +++ b/usr/src/lib/libshell/common/tests/vartree1.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -41,7 +41,7 @@ function build_tree typeset i typeset dummy typeset a b c d e f - + nameref dest_tree="$1" # destination tree nameref srcdata="$2" # source data typeset tree_mode="$3" # mode to define the type of leads @@ -53,15 +53,15 @@ function build_tree for i in "${node.xlfd[@]}" ; do IFS='-' read dummy a b c d e f <<<"$i" - + if [[ "$a" == "" ]] ; then a="$dummy" fi - + [[ "$a" == "" ]] && a='-' [[ "$b" == "" ]] && b='-' [[ "$c" == "" ]] && c='-' - + if [[ "${dest_tree.l1["$a"]}" == "" ]] ; then #if ! (unset dest_tree.l1["$a"]) ; then typeset -A dest_tree.l1["$a"].l2 @@ -75,7 +75,7 @@ function build_tree if [[ "${!dest_tree.l1["$a"].l2["$b"].l3["$c"].entries[*]}" == "" ]] ; then typeset -A dest_tree.l1["$a"].l2["$b"].l3["$c"].entries fi - + #dest_tree.l1["$a"].l2["$b"].l3["$c"].entries+=( "$index" ) typeset new_index if [[ "${tree_mode}" == "leaf_name" ]] ; then @@ -88,12 +88,12 @@ function build_tree continue fi fi - + add_tree_leaf dest_tree.l1["$a"].l2["$b"].l3["$c"].entries[${new_index}] "${index}" "${tree_mode}" done done - - return 0 + + return 0 } function add_tree_leaf @@ -101,7 +101,7 @@ function add_tree_leaf nameref tree_leafnode="$1" nameref data_node=srcdata.hashnodes["$2"] typeset add_mode="$3" - + case "${add_mode}" in "leaf_name") tree_leafnode="${data_node.name}" @@ -121,7 +121,7 @@ function add_tree_leaf return 1 ;; esac - + # not reached return 1 } @@ -151,7 +151,7 @@ typeset mysrcdata_global=( ) mytree_global=() - + function main { # "mysrcdata_local" and "mysrcdata_global" must be identical @@ -182,32 +182,32 @@ function main build_tree mytree_global mysrcdata_global leaf_compound || \ err_exit 'build_tree mytree_global mysrcdata_global leaf_compound returned an error' - (( $(print -r -- "${mytree_global}" | wc -l) > 10 )) || err_exit "Compound tree 'mytree_global' too small." + (( $(print -r -- "${mytree_global}" | wc -l) > 10 )) || err_exit "compound tree 'mytree_global' too small" # build tree using local tree variables mytree_local=() build_tree mytree_local mysrcdata_local leaf_compound || \ err_exit 'build_tree mytree_local mysrcdata_local leaf_compound returned an error' - (( $(print -r -- "${mytree_local}" | wc -l) > 10 )) || err_exit "Compound tree 'mytree_local' too small." - + (( $(print -r -- "${mytree_local}" | wc -l) > 10 )) || err_exit "compound tree 'mytree_local' too small" + # Compare trees if [[ "${mytree_global}" != "${mytree_local}" ]] ; then - err_exit "Compound trees 'mytree_local' and 'mytree_global' not identical" + err_exit "compound trees 'mytree_local' and 'mytree_global' not identical" fi - + unset 'mytree_global.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' || - err_exit "Variable 'mytree_global.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' not found." - + err_exit "variable 'mytree_global.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' not found" + [[ "${mytree_global}" != "${mytree_local}" ]] || err_exit "mytree_global and mytree_local should differ" unset 'mytree_local.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' || - err_exit "Variable 'mytree_local.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' not found." - + err_exit "variable 'mytree_local.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' not found" + # Compare trees (after "unset") if [[ "${mytree_global}" != "${mytree_local}" ]] ; then - err_exit "Compound trees 'mytree_local' and 'mytree_global' not identical after unset" - fi + err_exit "compound trees 'mytree_local' and 'mytree_global' not identical after unset" + fi } main diff --git a/usr/src/lib/libshell/common/tests/vartree2.sh b/usr/src/lib/libshell/common/tests/vartree2.sh index 38512d5a42..9f478ae140 100644 --- a/usr/src/lib/libshell/common/tests/vartree2.sh +++ b/usr/src/lib/libshell/common/tests/vartree2.sh @@ -1,7 +1,7 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1982-2008 AT&T Intellectual Property # +# Copyright (c) 1982-2009 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -34,7 +34,7 @@ function err_exit alias err_exit='err_exit $LINENO' # "built_tree1" and "built_tree2" are identical except the way how they test -# whether a variable exists: +# whether a variable exists: # - "built_tree1" uses "${varname}" != "", e.g. looking whether the variable # as non-zero length content # - "built_tree2" uses "! (unset varname)", e.g. "unset" in a subshell @@ -46,7 +46,7 @@ function build_tree1 typeset i typeset dummy typeset a b c d e f - + nameref dest_tree="$1" # destination tree nameref srcdata="$2" # source data typeset tree_mode="$3" # mode to define the type of leads @@ -58,15 +58,15 @@ function build_tree1 for i in "${node.xlfd[@]}" ; do IFS='-' read dummy a b c d e f <<<"$i" - + if [[ "$a" == "" ]] ; then a="$dummy" fi - + [[ "$a" == "" ]] && a='-' [[ "$b" == "" ]] && b='-' [[ "$c" == "" ]] && c='-' - + if [[ "${dest_tree.l1["$a"]}" == "" ]] ; then #if ! (unset dest_tree.l1["$a"]) ; then typeset -A dest_tree.l1["$a"].l2 @@ -80,7 +80,7 @@ function build_tree1 if [[ "${!dest_tree.l1["$a"].l2["$b"].l3["$c"].entries[*]}" == "" ]] ; then typeset -A dest_tree.l1["$a"].l2["$b"].l3["$c"].entries fi - + typeset new_index if [[ "${tree_mode}" == "leaf_name" ]] ; then new_index=$(( ${#dest_tree.l1["$a"].l2["$b"].l3["$c"].entries[@]}+1 )) @@ -92,16 +92,16 @@ function build_tree1 continue fi fi - + add_tree_leaf dest_tree.l1["$a"].l2["$b"].l3["$c"].entries[${new_index}] "${index}" "${tree_mode}" done done - - return 0 + + return 0 } # "built_tree1" and "built_tree2" are identical except the way how they test -# whether a variable exists: +# whether a variable exists: # - "built_tree1" uses "${varname}" != "", e.g. looking whether the variable # as non-zero length content # - "built_tree2" uses "! (unset varname)", e.g. "unset" in a subshell @@ -113,7 +113,7 @@ function build_tree2 typeset i typeset dummy typeset a b c d e f - + nameref dest_tree="$1" # destination tree nameref srcdata="$2" # source data typeset tree_mode="$3" # mode to define the type of leads @@ -125,15 +125,15 @@ function build_tree2 for i in "${node.xlfd[@]}" ; do IFS='-' read dummy a b c d e f <<<"$i" - + if [[ "$a" == "" ]] ; then a="$dummy" fi - + [[ "$a" == "" ]] && a='-' [[ "$b" == "" ]] && b='-' [[ "$c" == "" ]] && c='-' - + #if [[ "${dest_tree.l1["$a"]}" == "" ]] ; then if ! (unset dest_tree.l1["$a"]) ; then typeset -A dest_tree.l1["$a"].l2 @@ -147,7 +147,7 @@ function build_tree2 if [[ "${!dest_tree.l1["$a"].l2["$b"].l3["$c"].entries[*]}" == "" ]] ; then typeset -A dest_tree.l1["$a"].l2["$b"].l3["$c"].entries fi - + typeset new_index if [[ "${tree_mode}" == "leaf_name" ]] ; then new_index=$(( ${#dest_tree.l1["$a"].l2["$b"].l3["$c"].entries[@]}+1 )) @@ -159,12 +159,12 @@ function build_tree2 continue fi fi - + add_tree_leaf dest_tree.l1["$a"].l2["$b"].l3["$c"].entries[${new_index}] "${index}" "${tree_mode}" done done - - return 0 + + return 0 } @@ -173,7 +173,7 @@ function add_tree_leaf nameref tree_leafnode="$1" nameref data_node=srcdata.hashnodes["$2"] typeset add_mode="$3" - + case "${add_mode}" in "leaf_name") tree_leafnode="${data_node.name}" @@ -193,7 +193,7 @@ function add_tree_leaf return 1 ;; esac - + # not reached return 1 } @@ -224,7 +224,7 @@ typeset mysrcdata_global=( mytree_global1=() mytree_global2=() - + function main { # "mysrcdata_local" and "mysrcdata_global" must be identical @@ -254,11 +254,11 @@ function main #### Build tree using global tree variables build_tree1 mytree_global1 mysrcdata_global leaf_compound || \ err_exit 'build_tree1 mytree_global1 mysrcdata_global leaf_compound returned an error' - (( $(print -r -- "${mytree_global1}" | wc -l) > 10 )) || err_exit "Compound tree 'mytree_global1' too small." + (( $(print -r -- "${mytree_global1}" | wc -l) > 10 )) || err_exit "compound tree 'mytree_global1' too small" build_tree2 mytree_global2 mysrcdata_global leaf_compound || \ err_exit 'build_tree2 mytree_global2 mysrcdata_global leaf_compound returned an error' - (( $(print -r -- "${mytree_global2}" | wc -l) > 10 )) || err_exit "Compound tree 'mytree_global2' too small." + (( $(print -r -- "${mytree_global2}" | wc -l) > 10 )) || err_exit "compound tree 'mytree_global2' too small" #### build tree using local tree variables @@ -267,67 +267,67 @@ function main build_tree1 mytree_local1 mysrcdata_local leaf_compound || \ err_exit 'build_tree1 mytree_local1 mysrcdata_local leaf_compound returned an error' - (( $(print -r -- "${mytree_local1}" | wc -l) > 10 )) || err_exit "Compound tree 'mytree_local1' too small." + (( $(print -r -- "${mytree_local1}" | wc -l) > 10 )) || err_exit "compound tree 'mytree_local1' too small" build_tree2 mytree_local2 mysrcdata_local leaf_compound || \ err_exit 'build_tree2 mytree_local2 mysrcdata_local leaf_compound returned an error' - (( $(print -r -- "${mytree_local2}" | wc -l) > 10 )) || err_exit "Compound tree 'mytree_local2' too small." + (( $(print -r -- "${mytree_local2}" | wc -l) > 10 )) || err_exit "compound tree 'mytree_local2' too small" + - #### Compare treess if [[ "${mytree_global1}" != "${mytree_local1}" ]] ; then - err_exit "Compound trees 'mytree_global1' and 'mytree_local1' not identical" + err_exit "compound trees 'mytree_global1' and 'mytree_local1' not identical" fi if [[ "${mytree_global1}" != "${mytree_global2}" ]] ; then - err_exit "Compound trees 'mytree_global1' and 'mytree_global2' not identical" + err_exit "compound trees 'mytree_global1' and 'mytree_global2' not identical" fi if [[ "${mytree_local1}" != "${mytree_local2}" ]] ; then - err_exit "Compound trees 'mytree_local1' and 'mytree_local2' not identical" + err_exit "compound trees 'mytree_local1' and 'mytree_local2' not identical" fi #### test "unset" in a subshell ( unset 'mytree_global1.l1[urw].l2[itc zapfdingbats]' ) || \ - err_exit "Try 1: Variable 'mytree_global1.l1[urw].l2[itc zapfdingbats]' not found." + err_exit "try 1: variable 'mytree_global1.l1[urw].l2[itc zapfdingbats]' not found" ( unset 'mytree_global1.l1[urw].l2[itc zapfdingbats]' ) || \ - err_exit "Try 2: Variable 'mytree_global1.l1[urw].l2[itc zapfdingbats]' not found." + err_exit "try 2: variable 'mytree_global1.l1[urw].l2[itc zapfdingbats]' not found" # remove parent node (array element) and then check whether the child is gone, too: ( unset 'mytree_global1.l1[urw].l2[itc zapfdingbats]' - unset 'mytree_global1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' - ) && err_exit "Global: Parent node removed (array element), child still exists" + [[ -v 'mytree_global1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]'} ]] + ) && err_exit "global: parent node removed (array element), child still exists" ( unset 'mytree_local1.l1[urw].l2[itc zapfdingbats]' - unset 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' - ) && err_exit "Local: Parent node removed (array element), child still exists" - + [[ -v 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' ]] + ) && err_exit "local: parent node removed (array element), child still exists" + # remove parent node (array variable) and then check whether the child is gone, too: ( unset 'mytree_local1.l1[urw].l2' - unset 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' - ) && err_exit "Global: Parent node removed (array variable), child still exists" + [[ -v 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' ]] + ) && err_exit "global: parent node removed (array variable), child still exists" ( unset 'mytree_local1.l1[urw].l2' - unset 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' - ) && err_exit "Local: Parent node removed (array variable), child still exists" + [[ -v 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' ]] + ) && err_exit "local: parent node removed (array variable), child still exists" #### test "unset" and compare trees unset 'mytree_global1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' || - err_exit "Variable 'mytree_global1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' not found." - + err_exit "variable 'mytree_global1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' not found" + [[ "${mytree_global1}" != "${mytree_local1}" ]] || err_exit "mytree_global1 and mytree_local1 should differ" unset 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' || - err_exit "Variable 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' not found." - + err_exit "variable 'mytree_local1.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' not found" + # Compare trees (after "unset") if [[ "${mytree_global1}" != "${mytree_local1}" ]] ; then - err_exit "Compound trees 'mytree_local1' and 'mytree_global1' not identical after unset" - fi + err_exit "compound trees 'mytree_local1' and 'mytree_global1' not identical after unset" + fi } main diff --git a/usr/src/lib/libshell/i386/include/ast/history.h b/usr/src/lib/libshell/i386/include/ast/history.h index bfac5d3b35..0159773f4d 100644 --- a/usr/src/lib/libshell/i386/include/ast/history.h +++ b/usr/src/lib/libshell/i386/include/ast/history.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/i386/include/ast/nval.h b/usr/src/lib/libshell/i386/include/ast/nval.h index c11fd66143..a81d34b84a 100644 --- a/usr/src/lib/libshell/i386/include/ast/nval.h +++ b/usr/src/lib/libshell/i386/include/ast/nval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -276,6 +276,7 @@ extern __MANGLE__ Namfun_t *nv_isvtree __PROTO__((Namval_t*)); extern __MANGLE__ Namval_t *nv_lastdict __PROTO__((void)); extern __MANGLE__ Namval_t *nv_mkinttype __PROTO__((char*, size_t, int, const char*, Namdisc_t*)); extern __MANGLE__ void nv_newattr __PROTO__((Namval_t*,unsigned,int)); +extern __MANGLE__ void nv_newtype __PROTO__((Namval_t*)); extern __MANGLE__ Namval_t *nv_open __PROTO__((const char*,Dt_t*,int)); extern __MANGLE__ void nv_putval __PROTO__((Namval_t*,const char*,int)); extern __MANGLE__ void nv_putv __PROTO__((Namval_t*,const char*,int,Namfun_t*)); diff --git a/usr/src/lib/libshell/i386/include/ast/shell.h b/usr/src/lib/libshell/i386/include/ast/shell.h index adcefac221..b5d87afc94 100644 --- a/usr/src/lib/libshell/i386/include/ast/shell.h +++ b/usr/src/lib/libshell/i386/include/ast/shell.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -146,8 +146,8 @@ struct Shell_s int inlineno; /* line number of current input file */ int exitval; /* most recent exit value */ unsigned char trapnote; /* set when trap/signal is pending */ - char subshell; /* set for virtual subshell */ char shcomp; /* set when runing shcomp */ + short subshell; /* set for virtual subshell */ #ifdef _SH_PRIVATE _SH_PRIVATE #endif /* _SH_PRIVATE */ diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/acct b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/acct index 669b1a6ff4..244572d4c5 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/acct +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/acct @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_acct_ksh93 #define _def_acct_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_acct 1 /* acct() in default lib(s) */ diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/cmds b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/cmds index fed6a62efa..49759dec7a 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/cmds +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/cmds @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/cmds by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/cmds by iffe version 2009-10-06 : : */ #ifndef _def_cmds_ksh93 #define _def_cmds_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _cmd_newgrp 1 /* newgrp in ?(/usr)/(bin|etc|ucb) */ diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/dynamic b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/dynamic index c9391e8add..1b4e91ae24 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/dynamic +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/dynamic @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/dynamic by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/dynamic by iffe version 2009-10-06 : : */ #ifndef _def_dynamic_ksh93 #define _def_dynamic_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #if SHOPT_DYNAMIC diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/execargs b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/execargs index a6b30d067b..e7f2528287 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/execargs +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/execargs @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_execargs_ksh93 #define _def_execargs_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #endif diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/externs b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/externs index 9b0d8ab634..22eb25b028 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/externs +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/externs @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/externs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/externs by iffe version 2009-10-06 : : */ #ifndef _def_externs_ksh93 #if !defined(__PROTO__) @@ -63,10 +63,10 @@ #define _def_externs_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_exec_attr 1 /* #include <exec_attr.h> ok */ diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/locale b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/locale index 9cb639e493..77018234ee 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/locale +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/locale @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/locale by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/locale by iffe version 2009-10-06 : : */ #ifndef _def_locale_ksh93 #define _def_locale_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_locale 1 /* #include <locale.h> ok */ diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/math b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/math index f2c3e045fe..5b8088f5fa 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/math +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/math @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/math.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/math.sh by iffe version 2009-10-06 : : */ #ifndef _def_math_ksh93 #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -62,15 +62,15 @@ #define _def_math_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ -/* : : generated by iffe from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/data/math.tab : : */ +/* : : generated by iffe from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/data/math.tab : : */ typedef Sfdouble_t (*Math_f) __PROTO__((Sfdouble_t,...)); @@ -88,7 +88,13 @@ static int local_isless __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTO static int local_islessequal __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return islessequal(a1,a2);} static int local_islessgreater __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return islessgreater(a1,a2);} static int local_isnormal __PARAM__((Sfdouble_t a1), (a1)) __OTORP__(Sfdouble_t a1;){return isnormal(a1);} +#ifdef FP_SUBNORMAL +static int local_issubnormal __PARAM__((Sfdouble_t x), (x)) __OTORP__(Sfdouble_t x;){ return fpclassify(x) == FP_SUBNORMAL; } +#endif static int local_isunordered __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return isunordered(a1,a2);} +#ifdef FP_ZERO +static int local_iszero __PARAM__((Sfdouble_t x), (x)) __OTORP__(Sfdouble_t x;){ return fpclassify(x) == FP_ZERO; } +#endif static int local_signbit __PARAM__((Sfdouble_t a1), (a1)) __OTORP__(Sfdouble_t a1;){return signbit(a1);} /* @@ -136,9 +142,19 @@ const struct mathtab shtab_math[] = "\012islessgreater", (Math_f)local_islessgreater, "\011isnan", (Math_f)isnanl, "\011isnormal", (Math_f)local_isnormal, +#ifdef FP_SUBNORMAL + "\011issubnormal", (Math_f)local_issubnormal, +#endif "\012isunordered", (Math_f)local_isunordered, +#ifdef FP_ZERO + "\011iszero", (Math_f)local_iszero, +#endif + "\001j0", (Math_f)j0l, + "\001j1", (Math_f)j1l, + "\002jn", (Math_f)jnl, "\001lgamma", (Math_f)lgammal, "\001log", (Math_f)logl, + "\001log10", (Math_f)log10l, "\001log1p", (Math_f)log1pl, "\001log2", (Math_f)log2l, "\001logb", (Math_f)logbl, @@ -159,6 +175,9 @@ const struct mathtab shtab_math[] = "\001tanh", (Math_f)tanhl, "\001tgamma", (Math_f)tgammal, "\001trunc", (Math_f)truncl, + "\001y0", (Math_f)y0l, + "\001y1", (Math_f)y1l, + "\002yn", (Math_f)ynl, "", (Math_f)0 }; #endif diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/options b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/options index b2a1e6c5bf..6dcb17ce26 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/options +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/options @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/options by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/options by iffe version 2009-10-06 : : */ #ifndef _def_options_ksh93 #define _def_options_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define SHELLMAGIC 1 diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/poll b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/poll index 82aebe8515..d4e3c2db6f 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/poll +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/poll @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/poll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/poll by iffe version 2009-10-06 : : */ #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 <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_poll 1 /* #include <poll.h> ok */ diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/pstat b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/pstat index 928d40dee8..b6be9afb88 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/pstat +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/pstat @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_pstat_ksh93 #define _def_pstat_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #endif diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/rlimits b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/rlimits index 6d4eb8151d..a61321f297 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/rlimits +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/rlimits @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/rlimits by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/rlimits by iffe version 2009-10-06 : : */ #ifndef _def_rlimits_ksh93 #define _def_rlimits_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/setjmp b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/setjmp index cca67f87c3..2323618ae6 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/setjmp +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/setjmp @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/setjmp by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/setjmp by iffe version 2009-10-06 : : */ #ifndef _def_setjmp_ksh93 #define _def_setjmp_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_sigsetjmp 1 /* sigsetjmp() in default lib(s) */ diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/sigfeatures b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/sigfeatures index 2f57c095e7..b40e774dbc 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/sigfeatures +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/sigfeatures @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/sigfeatures by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/sigfeatures by iffe version 2009-10-06 : : */ #ifndef _def_sigfeatures_ksh93 #define _def_sigfeatures_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_sigrelse 1 /* sigrelse() in default lib(s) */ diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/time b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/time index 7ef065b723..524df0ed96 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/time +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/time @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ksh93 #define _def_time_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_utime 1 /* #include <utime.h> ok */ diff --git a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/ttys b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/ttys index f1aeeb5023..c7a345a56c 100644 --- a/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/ttys +++ b/usr/src/lib/libshell/i386/src/cmd/ksh93/FEATURE/ttys @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/cmd/ksh93/features/ttys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/cmd/ksh93/features/ttys by iffe version 2009-10-06 : : */ #ifndef _def_ttys_ksh93 #define _def_ttys_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ -#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_termios 1 /* #include <termios.h> ok */ diff --git a/usr/src/lib/libshell/misc/ERRATA.txt b/usr/src/lib/libshell/misc/ERRATA.txt index 23a8ef17c9..dc860d14fb 100644 --- a/usr/src/lib/libshell/misc/ERRATA.txt +++ b/usr/src/lib/libshell/misc/ERRATA.txt @@ -33,7 +33,7 @@ ######## Errata #001: ######## The usage of |posix_spawn()| has been manually disabled because there seems to be a race condition which cases sporadic failures like this: --- snip --. +-- snip -- $ builtin | fgrep sum | fgrep sum /usr/ast/bin/sum /usr/bin/sum @@ -44,8 +44,8 @@ The following files have been changed: -- snip -- Index: src/lib/libast/sparcv9/include/ast/ast_lib.h =================================================================== ---- src/lib/libast/sparcv9/include/ast/ast_lib.h (revision 888) -+++ src/lib/libast/sparcv9/include/ast/ast_lib.h (working copy) +--- usr/src/lib/libast/sparcv9/include/ast/ast_lib.h (revision 888) ++++ usr/src/lib/libast/sparcv9/include/ast/ast_lib.h (working copy) @@ -160,7 +160,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -57,8 +57,8 @@ Index: src/lib/libast/sparcv9/include/ast/ast_lib.h #define _hdr_string 1 /* #include <string.h> ok */ Index: src/lib/libast/sparcv9/src/lib/libast/ast_lib.h =================================================================== ---- src/lib/libast/sparcv9/src/lib/libast/ast_lib.h (revision 888) -+++ src/lib/libast/sparcv9/src/lib/libast/ast_lib.h (working copy) +--- usr/src/lib/libast/sparcv9/src/lib/libast/ast_lib.h (revision 888) ++++ usr/src/lib/libast/sparcv9/src/lib/libast/ast_lib.h (working copy) @@ -139,7 +139,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -70,8 +70,8 @@ Index: src/lib/libast/sparcv9/src/lib/libast/ast_lib.h #define _hdr_string 1 /* #include <string.h> ok */ Index: src/lib/libast/sparcv9/src/lib/libast/FEATURE/lib =================================================================== ---- src/lib/libast/sparcv9/src/lib/libast/FEATURE/lib (revision 888) -+++ src/lib/libast/sparcv9/src/lib/libast/FEATURE/lib (working copy) +--- usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/lib (revision 888) ++++ usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/lib (working copy) @@ -139,7 +139,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -83,8 +83,8 @@ Index: src/lib/libast/sparcv9/src/lib/libast/FEATURE/lib #define _hdr_string 1 /* #include <string.h> ok */ Index: src/lib/libast/sparc/include/ast/ast_lib.h =================================================================== ---- src/lib/libast/sparc/include/ast/ast_lib.h (revision 888) -+++ src/lib/libast/sparc/include/ast/ast_lib.h (working copy) +--- usr/src/lib/libast/sparc/include/ast/ast_lib.h (revision 888) ++++ usr/src/lib/libast/sparc/include/ast/ast_lib.h (working copy) @@ -171,7 +171,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -96,8 +96,8 @@ Index: src/lib/libast/sparc/include/ast/ast_lib.h #define _hdr_string 1 /* #include <string.h> ok */ Index: src/lib/libast/sparc/src/lib/libast/ast_lib.h =================================================================== ---- src/lib/libast/sparc/src/lib/libast/ast_lib.h (revision 888) -+++ src/lib/libast/sparc/src/lib/libast/ast_lib.h (working copy) +--- usr/src/lib/libast/sparc/src/lib/libast/ast_lib.h (revision 888) ++++ usr/src/lib/libast/sparc/src/lib/libast/ast_lib.h (working copy) @@ -150,7 +150,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -109,8 +109,8 @@ Index: src/lib/libast/sparc/src/lib/libast/ast_lib.h #define _hdr_string 1 /* #include <string.h> ok */ Index: src/lib/libast/sparc/src/lib/libast/FEATURE/lib =================================================================== ---- src/lib/libast/sparc/src/lib/libast/FEATURE/lib (revision 888) -+++ src/lib/libast/sparc/src/lib/libast/FEATURE/lib (working copy) +--- usr/src/lib/libast/sparc/src/lib/libast/FEATURE/lib (revision 888) ++++ usr/src/lib/libast/sparc/src/lib/libast/FEATURE/lib (working copy) @@ -150,7 +150,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -122,8 +122,8 @@ Index: src/lib/libast/sparc/src/lib/libast/FEATURE/lib #define _hdr_string 1 /* #include <string.h> ok */ Index: src/lib/libast/i386/include/ast/ast_lib.h =================================================================== ---- src/lib/libast/i386/include/ast/ast_lib.h (revision 888) -+++ src/lib/libast/i386/include/ast/ast_lib.h (working copy) +--- usr/src/lib/libast/i386/include/ast/ast_lib.h (revision 888) ++++ usr/src/lib/libast/i386/include/ast/ast_lib.h (working copy) @@ -171,7 +171,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -135,8 +135,8 @@ Index: src/lib/libast/i386/include/ast/ast_lib.h #define _hdr_string 1 /* #include <string.h> ok */ Index: src/lib/libast/i386/src/lib/libast/ast_lib.h =================================================================== ---- src/lib/libast/i386/src/lib/libast/ast_lib.h (revision 888) -+++ src/lib/libast/i386/src/lib/libast/ast_lib.h (working copy) +--- usr/src/lib/libast/i386/src/lib/libast/ast_lib.h (revision 888) ++++ usr/src/lib/libast/i386/src/lib/libast/ast_lib.h (working copy) @@ -150,7 +150,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -148,8 +148,8 @@ Index: src/lib/libast/i386/src/lib/libast/ast_lib.h #define _hdr_string 1 /* #include <string.h> ok */ Index: src/lib/libast/i386/src/lib/libast/FEATURE/lib =================================================================== ---- src/lib/libast/i386/src/lib/libast/FEATURE/lib (revision 888) -+++ src/lib/libast/i386/src/lib/libast/FEATURE/lib (working copy) +--- usr/src/lib/libast/i386/src/lib/libast/FEATURE/lib (revision 888) ++++ usr/src/lib/libast/i386/src/lib/libast/FEATURE/lib (working copy) @@ -150,7 +150,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -161,8 +161,8 @@ Index: src/lib/libast/i386/src/lib/libast/FEATURE/lib #define _hdr_string 1 /* #include <string.h> ok */ Index: src/lib/libast/amd64/include/ast/ast_lib.h =================================================================== ---- src/lib/libast/amd64/include/ast/ast_lib.h (revision 888) -+++ src/lib/libast/amd64/include/ast/ast_lib.h (working copy) +--- usr/src/lib/libast/amd64/include/ast/ast_lib.h (revision 888) ++++ usr/src/lib/libast/amd64/include/ast/ast_lib.h (working copy) @@ -160,7 +160,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -174,8 +174,8 @@ Index: src/lib/libast/amd64/include/ast/ast_lib.h #define _hdr_string 1 /* #include <string.h> ok */ Index: src/lib/libast/amd64/src/lib/libast/ast_lib.h =================================================================== ---- src/lib/libast/amd64/src/lib/libast/ast_lib.h (revision 888) -+++ src/lib/libast/amd64/src/lib/libast/ast_lib.h (working copy) +--- usr/src/lib/libast/amd64/src/lib/libast/ast_lib.h (revision 888) ++++ usr/src/lib/libast/amd64/src/lib/libast/ast_lib.h (working copy) @@ -139,7 +139,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -187,8 +187,8 @@ Index: src/lib/libast/amd64/src/lib/libast/ast_lib.h #define _hdr_string 1 /* #include <string.h> ok */ Index: src/lib/libast/amd64/src/lib/libast/FEATURE/lib =================================================================== ---- src/lib/libast/amd64/src/lib/libast/FEATURE/lib (revision 888) -+++ src/lib/libast/amd64/src/lib/libast/FEATURE/lib (working copy) +--- usr/src/lib/libast/amd64/src/lib/libast/FEATURE/lib (revision 888) ++++ usr/src/lib/libast/amd64/src/lib/libast/FEATURE/lib (working copy) @@ -139,7 +139,7 @@ #define _hdr_unistd 1 /* #include <unistd.h> ok */ #define _lib_vfork 1 /* vfork exists and it works */ @@ -202,6 +202,160 @@ Index: src/lib/libast/amd64/src/lib/libast/FEATURE/lib ######## Errata #002: ######## +The usage of |mmap()| has been manually enabled to improve I/O performance. +The following files have been changed: +-- snip -- +Index: usr/src/lib/libast/sparcv9/include/ast/ast_mmap.h +=================================================================== +--- usr/src/lib/libast/sparcv9/include/ast/ast_mmap.h (revision 1701) ++++ usr/src/lib/libast/sparcv9/include/ast/ast_mmap.h (working copy) +@@ -28,6 +28,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +Index: usr/src/lib/libast/sparcv9/src/lib/libast/ast_mmap.h +=================================================================== +--- usr/src/lib/libast/sparcv9/src/lib/libast/ast_mmap.h (revision 1701) ++++ usr/src/lib/libast/sparcv9/src/lib/libast/ast_mmap.h (working copy) +@@ -7,6 +7,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +Index: usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/mmap +=================================================================== +--- usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/mmap (revision 1701) ++++ usr/src/lib/libast/sparcv9/src/lib/libast/FEATURE/mmap (working copy) +@@ -7,6 +7,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +Index: usr/src/lib/libast/sparc/include/ast/ast_mmap.h +=================================================================== +--- usr/src/lib/libast/sparc/include/ast/ast_mmap.h (revision 1701) ++++ usr/src/lib/libast/sparc/include/ast/ast_mmap.h (working copy) +@@ -28,7 +28,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +-#define _mmap_worthy 1 /* mmap is good */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +Index: usr/src/lib/libast/sparc/src/lib/libast/ast_mmap.h +=================================================================== +--- usr/src/lib/libast/sparc/src/lib/libast/ast_mmap.h (revision 1701) ++++ usr/src/lib/libast/sparc/src/lib/libast/ast_mmap.h (working copy) +@@ -7,7 +7,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +-#define _mmap_worthy 1 /* mmap is good */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +Index: usr/src/lib/libast/sparc/src/lib/libast/FEATURE/mmap +=================================================================== +--- usr/src/lib/libast/sparc/src/lib/libast/FEATURE/mmap (revision 1701) ++++ usr/src/lib/libast/sparc/src/lib/libast/FEATURE/mmap (working copy) +@@ -7,7 +7,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ +-#define _mmap_worthy 1 /* mmap is good */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +Index: usr/src/lib/libast/i386/include/ast/ast_mmap.h +=================================================================== +--- usr/src/lib/libast/i386/include/ast/ast_mmap.h (revision 1701) ++++ usr/src/lib/libast/i386/include/ast/ast_mmap.h (working copy) +@@ -28,6 +28,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +Index: usr/src/lib/libast/i386/src/lib/libast/ast_mmap.h +=================================================================== +--- usr/src/lib/libast/i386/src/lib/libast/ast_mmap.h (revision 1701) ++++ usr/src/lib/libast/i386/src/lib/libast/ast_mmap.h (working copy) +@@ -7,6 +7,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +Index: usr/src/lib/libast/i386/src/lib/libast/FEATURE/mmap +=================================================================== +--- usr/src/lib/libast/i386/src/lib/libast/FEATURE/mmap (revision 1701) ++++ usr/src/lib/libast/i386/src/lib/libast/FEATURE/mmap (working copy) +@@ -7,6 +7,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +Index: usr/src/lib/libast/amd64/include/ast/ast_mmap.h +=================================================================== +--- usr/src/lib/libast/amd64/include/ast/ast_mmap.h (revision 1701) ++++ usr/src/lib/libast/amd64/include/ast/ast_mmap.h (working copy) +@@ -28,6 +28,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +Index: usr/src/lib/libast/amd64/src/lib/libast/ast_mmap.h +=================================================================== +--- usr/src/lib/libast/amd64/src/lib/libast/ast_mmap.h (revision 1701) ++++ usr/src/lib/libast/amd64/src/lib/libast/ast_mmap.h (working copy) +@@ -7,6 +7,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +Index: usr/src/lib/libast/amd64/src/lib/libast/FEATURE/mmap +=================================================================== +--- usr/src/lib/libast/amd64/src/lib/libast/FEATURE/mmap (revision 1701) ++++ usr/src/lib/libast/amd64/src/lib/libast/FEATURE/mmap (working copy) +@@ -7,6 +7,7 @@ + #define _lib_mmap64 1 /* mmap64 interface and implementation work */ + #define _mmap_anon 1 /* use mmap MAP_ANON to get raw memory */ + #define _mmap_devzero 1 /* use mmap on /dev/zero to get raw memory */ ++#define _mmap_worthy 2 /* mmap is good */ + + /* some systems get it wrong but escape concise detection */ + #ifndef _NO_MMAP +-- snip -- + + +######## Errata #003: ######## A workaround was added for a problem with the "multiline" editor mode which occurs when the edit line becomes longer than the terminal's width and the terminal cursor is not at position 0 when PS1 is send to the terminal. @@ -217,118 +371,415 @@ PS1 set by /etc/ksh.kshrc, this causes the shell to move to the beginning of the next line if the terminal cursor is not at position 0. -######## Errata #003: ######## -A fix was backported to cure sporadic VSC test suite failures. The failures are -generated when command substitutions+functions are executed in a nested manner -- sometimes the return code is non-zero even if the called function explicitly -contains a "return 0"-statement. +######## Errata #004: ######## +A workaround has been added for a probem with the AST "tail" builtin which +causes "tail" to sleep too long when polling for data in "follow" mode. The following files have been changed: -- snip -- -Index: src/lib/libshell/common/sh/jobs.c +Index: src/lib/libcmd/common/tail.c =================================================================== ---- src/lib/libshell/common/sh/jobs.c (revision 1284) -+++ src/lib/libshell/common/sh/jobs.c (working copy) -@@ -1224,6 +1224,8 @@ - job_lock(); - if(pid > 1) - { -+ if(pid==sh.spid) -+ sh.spid = 0; - if(!(pw=job_bypid(pid))) +--- usr/src/lib/libcmd/common/tail.c (revision 1701) ++++ usr/src/lib/libcmd/common/tail.c (working copy) +@@ -636,7 +636,14 @@ { - /* check to see whether job status has been saved */ + if (sfsync(sfstdout)) + error(ERROR_system(1), "write error"); ++#if 0 + sleep(1); ++#else ++ { ++ struct timespec rqt = { 0L, 1000000000L/4L }; ++ (void)nanosleep(&rqt, NULL); ++ } ++#endif + n = 0; + pp = 0; + while (fp) -- snip -- -######## Errata #004: ######## -A fix was backported to cure a hang in a command substitution when the -amount of data exceeds a certain amount of data (this was causing -the hang in CR #6800929 ("snv_106 ksh93 update breaks Install(1M)")). +######## Errata #005: ######## +The POSIX "cksum"/CRC and AT&T "sum" codepaths in libsum have been reworked +and then backpoprted to address a performance regression on some +machine/architecture combinations. The following files have been changed: -- snip -- -Index: src/lib/libshell/common/include/defs.h +Index: usr/src/lib/libsum/common/sum-crc.c =================================================================== ---- src/lib/libshell/common/include/defs.h (revision 1391) -+++ src/lib/libshell/common/include/defs.h (working copy) -@@ -166,6 +166,7 @@ - char winch; \ - char indebug; /* set when in debug trap */ \ - unsigned char lastsig; /* last signal received */ \ -+ char subshare; /* set when in ${..} comsub */ \ - char *readscript; /* set before reading a script */ \ - int *inpipe; /* input pipe pointer */ \ - int *outpipe; /* output pipe pointer */ \ -Index: src/lib/libshell/common/sh/subshell.c -=================================================================== ---- src/lib/libshell/common/sh/subshell.c (revision 1391) -+++ src/lib/libshell/common/sh/subshell.c (working copy) -@@ -89,6 +89,7 @@ - int coutpipe; - int cpipe; - int nofork; -+ char subshare; - } *subshell_data; +--- usr/src/lib/libsum/common/sum-crc.c (revision 1724) ++++ usr/src/lib/libsum/common/sum-crc.c (working copy) +@@ -48,7 +48,8 @@ + Crcnum_t init; + Crcnum_t done; + Crcnum_t xorsize; +- Crcnum_t tab[256]; ++ const Crcnum_t *tab; /* use |const| to give the compiler a hint that the data won't change */ ++ Crcnum_t tabdata[256]; + unsigned int addsize; + unsigned int rotate; + } Crc_t; +@@ -56,6 +57,62 @@ + #define CRC(p,s,c) (s = (s >> 8) ^ (p)->tab[(s ^ (c)) & 0xff]) + #define CRCROTATE(p,s,c) (s = (s << 8) ^ (p)->tab[((s >> 24) ^ (c)) & 0xff]) - static int subenv; -@@ -477,7 +478,9 @@ - sp->bckpid = shp->bckpid; - if(comsub) - sh_stats(STAT_COMSUB); -- if(!comsub || (comsub==1 && !sh_isoption(SH_SUBSHARE))) -+ sp->subshare = shp->subshare; -+ shp->subshare = comsub==2 || (comsub==1 && sh_isoption(SH_SUBSHARE)); -+ if(!comsub || !shp->subshare) ++static const ++Crcnum_t posix_cksum_tab[256] = { ++ 0x00000000U, ++ 0x04c11db7U, 0x09823b6eU, 0x0d4326d9U, 0x130476dcU, 0x17c56b6bU, ++ 0x1a864db2U, 0x1e475005U, 0x2608edb8U, 0x22c9f00fU, 0x2f8ad6d6U, ++ 0x2b4bcb61U, 0x350c9b64U, 0x31cd86d3U, 0x3c8ea00aU, 0x384fbdbdU, ++ 0x4c11db70U, 0x48d0c6c7U, 0x4593e01eU, 0x4152fda9U, 0x5f15adacU, ++ 0x5bd4b01bU, 0x569796c2U, 0x52568b75U, 0x6a1936c8U, 0x6ed82b7fU, ++ 0x639b0da6U, 0x675a1011U, 0x791d4014U, 0x7ddc5da3U, 0x709f7b7aU, ++ 0x745e66cdU, 0x9823b6e0U, 0x9ce2ab57U, 0x91a18d8eU, 0x95609039U, ++ 0x8b27c03cU, 0x8fe6dd8bU, 0x82a5fb52U, 0x8664e6e5U, 0xbe2b5b58U, ++ 0xbaea46efU, 0xb7a96036U, 0xb3687d81U, 0xad2f2d84U, 0xa9ee3033U, ++ 0xa4ad16eaU, 0xa06c0b5dU, 0xd4326d90U, 0xd0f37027U, 0xddb056feU, ++ 0xd9714b49U, 0xc7361b4cU, 0xc3f706fbU, 0xceb42022U, 0xca753d95U, ++ 0xf23a8028U, 0xf6fb9d9fU, 0xfbb8bb46U, 0xff79a6f1U, 0xe13ef6f4U, ++ 0xe5ffeb43U, 0xe8bccd9aU, 0xec7dd02dU, 0x34867077U, 0x30476dc0U, ++ 0x3d044b19U, 0x39c556aeU, 0x278206abU, 0x23431b1cU, 0x2e003dc5U, ++ 0x2ac12072U, 0x128e9dcfU, 0x164f8078U, 0x1b0ca6a1U, 0x1fcdbb16U, ++ 0x018aeb13U, 0x054bf6a4U, 0x0808d07dU, 0x0cc9cdcaU, 0x7897ab07U, ++ 0x7c56b6b0U, 0x71159069U, 0x75d48ddeU, 0x6b93dddbU, 0x6f52c06cU, ++ 0x6211e6b5U, 0x66d0fb02U, 0x5e9f46bfU, 0x5a5e5b08U, 0x571d7dd1U, ++ 0x53dc6066U, 0x4d9b3063U, 0x495a2dd4U, 0x44190b0dU, 0x40d816baU, ++ 0xaca5c697U, 0xa864db20U, 0xa527fdf9U, 0xa1e6e04eU, 0xbfa1b04bU, ++ 0xbb60adfcU, 0xb6238b25U, 0xb2e29692U, 0x8aad2b2fU, 0x8e6c3698U, ++ 0x832f1041U, 0x87ee0df6U, 0x99a95df3U, 0x9d684044U, 0x902b669dU, ++ 0x94ea7b2aU, 0xe0b41de7U, 0xe4750050U, 0xe9362689U, 0xedf73b3eU, ++ 0xf3b06b3bU, 0xf771768cU, 0xfa325055U, 0xfef34de2U, 0xc6bcf05fU, ++ 0xc27dede8U, 0xcf3ecb31U, 0xcbffd686U, 0xd5b88683U, 0xd1799b34U, ++ 0xdc3abdedU, 0xd8fba05aU, 0x690ce0eeU, 0x6dcdfd59U, 0x608edb80U, ++ 0x644fc637U, 0x7a089632U, 0x7ec98b85U, 0x738aad5cU, 0x774bb0ebU, ++ 0x4f040d56U, 0x4bc510e1U, 0x46863638U, 0x42472b8fU, 0x5c007b8aU, ++ 0x58c1663dU, 0x558240e4U, 0x51435d53U, 0x251d3b9eU, 0x21dc2629U, ++ 0x2c9f00f0U, 0x285e1d47U, 0x36194d42U, 0x32d850f5U, 0x3f9b762cU, ++ 0x3b5a6b9bU, 0x0315d626U, 0x07d4cb91U, 0x0a97ed48U, 0x0e56f0ffU, ++ 0x1011a0faU, 0x14d0bd4dU, 0x19939b94U, 0x1d528623U, 0xf12f560eU, ++ 0xf5ee4bb9U, 0xf8ad6d60U, 0xfc6c70d7U, 0xe22b20d2U, 0xe6ea3d65U, ++ 0xeba91bbcU, 0xef68060bU, 0xd727bbb6U, 0xd3e6a601U, 0xdea580d8U, ++ 0xda649d6fU, 0xc423cd6aU, 0xc0e2d0ddU, 0xcda1f604U, 0xc960ebb3U, ++ 0xbd3e8d7eU, 0xb9ff90c9U, 0xb4bcb610U, 0xb07daba7U, 0xae3afba2U, ++ 0xaafbe615U, 0xa7b8c0ccU, 0xa379dd7bU, 0x9b3660c6U, 0x9ff77d71U, ++ 0x92b45ba8U, 0x9675461fU, 0x8832161aU, 0x8cf30badU, 0x81b02d74U, ++ 0x857130c3U, 0x5d8a9099U, 0x594b8d2eU, 0x5408abf7U, 0x50c9b640U, ++ 0x4e8ee645U, 0x4a4ffbf2U, 0x470cdd2bU, 0x43cdc09cU, 0x7b827d21U, ++ 0x7f436096U, 0x7200464fU, 0x76c15bf8U, 0x68860bfdU, 0x6c47164aU, ++ 0x61043093U, 0x65c52d24U, 0x119b4be9U, 0x155a565eU, 0x18197087U, ++ 0x1cd86d30U, 0x029f3d35U, 0x065e2082U, 0x0b1d065bU, 0x0fdc1becU, ++ 0x3793a651U, 0x3352bbe6U, 0x3e119d3fU, 0x3ad08088U, 0x2497d08dU, ++ 0x2056cd3aU, 0x2d15ebe3U, 0x29d4f654U, 0xc5a92679U, 0xc1683bceU, ++ 0xcc2b1d17U, 0xc8ea00a0U, 0xd6ad50a5U, 0xd26c4d12U, 0xdf2f6bcbU, ++ 0xdbee767cU, 0xe3a1cbc1U, 0xe760d676U, 0xea23f0afU, 0xeee2ed18U, ++ 0xf0a5bd1dU, 0xf464a0aaU, 0xf9278673U, 0xfde69bc4U, 0x89b8fd09U, ++ 0x8d79e0beU, 0x803ac667U, 0x84fbdbd0U, 0x9abc8bd5U, 0x9e7d9662U, ++ 0x933eb0bbU, 0x97ffad0cU, 0xafb010b1U, 0xab710d06U, 0xa6322bdfU, ++ 0xa2f33668U, 0xbcb4666dU, 0xb8757bdaU, 0xb5365d03U, 0xb1f740b4U ++}; ++ + static Sum_t* + crc_open(const Method_t* method, const char* name) + { +@@ -73,62 +130,80 @@ + sum->method = (Method_t*)method; + sum->name = name; + } +- polynomial = 0xedb88320; +- s = name; +- while (*(t = s)) ++ ++ if(!strcmp(name, "crc-0x04c11db7-rotate-done-size")) { - sp->shpwd = shp->pwd; - sp->pwd = (shp->pwd?strdup(shp->pwd):0); -@@ -677,6 +680,7 @@ - shp->cpipe[1] = sp->cpipe; - shp->coutpipe = sp->coutpipe; +- for (t = s, v = 0; *s && *s != '-'; s++) +- if (*s == '=' && !v) +- v = s; +- i = (v ? v : s) - t; +- if (isdigit(*t) || v && i >= 4 && strneq(t, "poly", 4) && (t = v + 1)) +- polynomial = strtoul(t, NiL, 0); +- else if (strneq(t, "done", i)) +- sum->done = v ? strtoul(v + 1, NiL, 0) : ~sum->done; +- else if (strneq(t, "init", i)) +- sum->init = v ? strtoul(v + 1, NiL, 0) : ~sum->init; +- else if (strneq(t, "rotate", i)) +- sum->rotate = 1; +- else if (strneq(t, "size", i)) +- { +- sum->addsize = 1; +- if (v) +- sum->xorsize = strtoul(v + 1, NiL, 0); +- } +- if (*s == '-') +- s++; ++ sum->init=0; ++ sum->done=0xffffffff; ++ sum->xorsize=0x0; ++ sum->addsize=0x1; ++ sum->rotate=1; ++ ++ /* Optimized codepath for POSIX cksum to save startup time */ ++ sum->tab=posix_cksum_tab; } -+ shp->subshare = sp->subshare; - if(shp->subshell) - SH_SUBSHELLNOD->nvalue.s = --shp->subshell; - if(sp->sig) -Index: src/lib/libshell/common/sh/xec.c -=================================================================== ---- src/lib/libshell/common/sh/xec.c (revision 1391) -+++ src/lib/libshell/common/sh/xec.c (working copy) -@@ -1406,7 +1406,12 @@ - pid_t savepgid = job.curpgid; - job.curpgid = 0; - if(shp->subshell) -- sh_subtmpfile(1); +- if (sum->rotate) ++ else + { +- Crcnum_t t; +- Crcnum_t p[8]; +- +- p[0] = polynomial; +- for (i = 1; i < 8; i++) +- p[i] = (p[i-1] << 1) ^ ((p[i-1] & 0x80000000) ? polynomial : 0); +- for (i = 0; i < elementsof(sum->tab); i++) ++ polynomial = 0xedb88320; ++ s = name; ++ while (*(t = s)) + { +- t = 0; +- x = i; +- for (j = 0; j < 8; j++) ++ for (t = s, v = 0; *s && *s != '-'; s++) ++ if (*s == '=' && !v) ++ v = s; ++ i = (v ? v : s) - t; ++ if (isdigit(*t) || v && i >= 4 && strneq(t, "poly", 4) && (t = v + 1)) ++ polynomial = strtoul(t, NiL, 0); ++ else if (strneq(t, "done", i)) ++ sum->done = v ? strtoul(v + 1, NiL, 0) : ~sum->done; ++ else if (strneq(t, "init", i)) ++ sum->init = v ? strtoul(v + 1, NiL, 0) : ~sum->init; ++ else if (strneq(t, "rotate", i)) ++ sum->rotate = 1; ++ else if (strneq(t, "size", i)) + { +- if (x & 1) +- t ^= p[j]; +- x >>= 1; ++ sum->addsize = 1; ++ if (v) ++ sum->xorsize = strtoul(v + 1, NiL, 0); + } +- sum->tab[i] = t; ++ if (*s == '-') ++ s++; + } +- } +- else +- { +- for (i = 0; i < elementsof(sum->tab); i++) ++ if (sum->rotate) + { +- x = i; +- for (j = 0; j < 8; j++) +- x = (x>>1) ^ ((x & 1) ? polynomial : 0); +- sum->tab[i] = x; ++ Crcnum_t t; ++ Crcnum_t p[8]; ++ ++ p[0] = polynomial; ++ for (i = 1; i < 8; i++) ++ p[i] = (p[i-1] << 1) ^ ((p[i-1] & 0x80000000) ? polynomial : 0); ++ for (i = 0; i < elementsof(sum->tabdata); i++) + { -+ if(shp->subshare) -+ sh_subtmpfile(0); -+ else -+ sh_subfork(); ++ t = 0; ++ x = i; ++ for (j = 0; j < 8; j++) ++ { ++ if (x & 1) ++ t ^= p[j]; ++ x >>= 1; ++ } ++ sum->tabdata[i] = t; + } - shp->inpipe = pvo; - shp->outpipe = pvn; - pvo[1] = -1; --- snip -- - - -######## Errata #005: ######## -A fix was backported for CR #6807179 to cure an unneccesary -|libc::getpwnam()| lookup when the shell encountered a -"~(modifer)pattern"-shell pattern (the leading '~' triggered a -(unneccesary) tilde expansion). -The following files have been changed: --- snip -- ---- src/lib/libshell/common/sh/macro.c Wed Feb 18 11:53:56 2009 +0800 -+++ src/lib/libshell/common/sh/macro.c Wed Feb 18 21:45:00 2009 +0100 -@@ -439,7 +439,7 @@ - mp->sp = NIL(Sfio_t*); - mp->quote = newquote; - first = cp = fcseek(0); -- if(!mp->quote && *cp=='~') -+ if(!mp->quote && *cp=='~' && cp[1]!=LPAREN) - tilde = stktell(stkp); - /* handle // operator specially */ - if(mp->pattern==2 && *cp=='/') - + } ++ else ++ { ++ for (i = 0; i < elementsof(sum->tabdata); i++) ++ { ++ x = i; ++ for (j = 0; j < 8; j++) ++ x = (x>>1) ^ ((x & 1) ? polynomial : 0); ++ sum->tabdata[i] = x; ++ } ++ } ++ ++ sum->tab=sum->tabdata; + } ++ + return (Sum_t*)sum; + } + +@@ -141,11 +216,77 @@ + return 0; + } + ++#if defined(__SUNPRO_C) || defined(__GNUC__) ++ ++#if defined(__SUNPRO_C) ++# include <sun_prefetch.h> ++# define sum_prefetch(addr) sun_prefetch_read_many((void *)(addr)) ++#elif defined(__GNUC__) ++# define sum_prefetch(addr) __builtin_prefetch((addr), 0, 3) ++#else ++# error Unknown compiler ++#endif ++ ++#define CBLOCK_SIZE (64) ++#pragma unroll(16) ++ + static int + crc_block(Sum_t* p, const void* s, size_t n) + { + Crc_t* sum = (Crc_t*)p; + register Crcnum_t c = sum->sum; ++ register const unsigned char* b = (const unsigned char*)s; ++ register const unsigned char* e = b + n; ++ unsigned short i; ++ ++ sum_prefetch(b); ++ ++ if (sum->rotate) ++ { ++ while (n > CBLOCK_SIZE) ++ { ++ sum_prefetch(b+CBLOCK_SIZE); ++ for(i=0 ; i < CBLOCK_SIZE ; i++) ++ { ++ CRCROTATE(sum, c, *b++); ++ } ++ ++ n-=CBLOCK_SIZE; ++ } ++ ++ while (b < e) ++ { ++ CRCROTATE(sum, c, *b++); ++ } ++ } ++ else ++ { ++ while (n > CBLOCK_SIZE) ++ { ++ sum_prefetch(b+CBLOCK_SIZE); ++ for(i=0 ; i < CBLOCK_SIZE ; i++) ++ { ++ CRC(sum, c, *b++); ++ } ++ ++ n-=CBLOCK_SIZE; ++ } ++ ++ while (b < e) ++ { ++ CRC(sum, c, *b++); ++ } ++ } ++ ++ sum->sum = c; ++ return 0; ++} ++#else ++static int ++crc_block(Sum_t* p, const void* s, size_t n) ++{ ++ Crc_t* sum = (Crc_t*)p; ++ register Crcnum_t c = sum->sum; + register unsigned char* b = (unsigned char*)s; + register unsigned char* e = b + n; + +@@ -158,6 +299,7 @@ + sum->sum = c; + return 0; + } ++#endif /* defined(__SUNPRO_C) || defined(__GNUC__) */ + + static int + crc_done(Sum_t* p) +Index: usr/src/lib/libsum/common/sum-att.c +=================================================================== +--- usr/src/lib/libsum/common/sum-att.c (revision 1724) ++++ usr/src/lib/libsum/common/sum-att.c (working copy) +@@ -35,10 +35,73 @@ + #define att_data long_data + #define att_scale 512 + ++#if defined(__SUNPRO_C) || defined(__GNUC__) ++ ++#if defined(__SUNPRO_C) ++# include <sun_prefetch.h> ++# define sum_prefetch(addr) sun_prefetch_read_many((void *)(addr)) ++#elif defined(__GNUC__) ++# define sum_prefetch(addr) __builtin_prefetch((addr), 0, 3) ++#else ++# error Unknown compiler ++#endif ++ ++#define CBLOCK_SIZE (64) ++#pragma unroll(16) ++ ++/* Inmos transputer would love this algorithm */ + static int + att_block(register Sum_t* p, const void* s, size_t n) + { + register uint32_t c = ((Integral_t*)p)->sum; ++ register const unsigned char* b = (const unsigned char*)s; ++ register const unsigned char* e = b + n; ++ register uint32_t s0, s1, s2, s3, s4, s5, s6, s7; ++ register unsigned int i; ++ ++ s0=s1=s2=s3=s4=s5=s6=s7=0U; ++ ++ sum_prefetch((void *)b); ++ ++ while (n > CBLOCK_SIZE) ++ { ++ sum_prefetch((b+CBLOCK_SIZE)); ++ ++ /* Compiler will unroll for() loops per #pragma unroll */ ++ for (i=0 ; i < (CBLOCK_SIZE/8) ; i++) ++ { ++ /* ++ * use s0-s7 to decouple calculations (this improves pipelining) ++ * because each operation is completely independent from it's ++ * siblings ++ */ ++ s0+=b[0]; ++ s1+=b[1]; ++ s2+=b[2]; ++ s3+=b[3]; ++ s4+=b[4]; ++ s5+=b[5]; ++ s6+=b[6]; ++ s7+=b[7]; ++ ++ b+=8; ++ n-=8; ++ } ++ } ++ ++ c+=s0+s1+s2+s3+s4+s5+s6+s7; ++ ++ while (b < e) ++ c += *b++; ++ ((Integral_t*)p)->sum = c; ++ return 0; ++} ++ ++#else ++static int ++att_block(register Sum_t* p, const void* s, size_t n) ++{ ++ register uint32_t c = ((Integral_t*)p)->sum; + register unsigned char* b = (unsigned char*)s; + register unsigned char* e = b + n; + +@@ -47,6 +110,7 @@ + ((Integral_t*)p)->sum = c; + return 0; + } ++#endif /* defined(__SUNPRO_C) || defined(__GNUC__) */ + + static int + att_done(Sum_t* p) -- snip -- -#EOF. +# EOF. diff --git a/usr/src/lib/libshell/misc/buildksh93.readme b/usr/src/lib/libshell/misc/buildksh93.readme index 861292b649..6edf060f5c 100644 --- a/usr/src/lib/libshell/misc/buildksh93.readme +++ b/usr/src/lib/libshell/misc/buildksh93.readme @@ -19,7 +19,7 @@ # CDDL HEADER END # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -31,8 +31,10 @@ "buildksh93.sh" is a small build script used to build the AT&T "ast-ksh" and "ast-open" packages using its native (nmake-based) build system which is needed to build the iffe-generated (header) files (each time -for { 32bit SPARC, 64bit SPARC, 32bit i386, 64bit AMD64 }) which are -moved later to their matching OS/Net build directories. +for { 32bit SPARC, 64bit SPARC, 32bit i386, 64bit AMD64, 32bit S390, +64bit S390x }) which are moved later to their matching OS/Net build +directories. + THIS SCRIPT IS NOT INTENDED FOR NORMAL USAGE. @@ -47,14 +49,14 @@ properly found. * Example usage of the script (more information can be found in the script itself): ## Download AT&T ksh93 sources -$ wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/~gsf/download/tgz/INIT.2008-11-04.tgz' -$ wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/~gsf/download/tgz/ast-ksh.2008-11-04.tgz' +$ wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/sw/download/beta/INIT.2009-10-14.tgz' +$ wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/sw/download/beta/ast-ksh.2009-10-14.tgz' ## Unpack the sources (32bit SPARC): $ mkdir build_sparc_32bit $ cd build_sparc_32bit -$ gunzip -c <../INIT.2008-11-04.tgz | tar -xf - -$ gunzip -c <../ast-ksh.2008-11-04.tgz | tar -xf - +$ gunzip -c <../INIT.2009-10-14.tgz | tar -xf - +$ gunzip -c <../ast-ksh.2009-10-14.tgz | tar -xf - ## Build ast-ksh for 32bit SPARC # (build other build flags are: diff --git a/usr/src/lib/libshell/misc/buildksh93.sh b/usr/src/lib/libshell/misc/buildksh93.sh index bc9c3c79a2..c590047edb 100644 --- a/usr/src/lib/libshell/misc/buildksh93.sh +++ b/usr/src/lib/libshell/misc/buildksh93.sh @@ -23,18 +23,18 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # -# buildksh93.ksh - ast-ksh standalone build script for the +# buildksh93.sh - ast-ksh standalone build script for the # OpenSolaris ksh93-integration project # # ksh93t sources can be downloaded like this from the AT&T site: -# wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/~gsf/download/tgz/INIT.2008-11-04.tgz' -# wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/~gsf/download/tgz/ast-ksh.2008-11-04.tgz' +# wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/sw/download/beta/INIT.2009-10-14.tgz' +# wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/sw/download/beta/ast-ksh.2009-10-14.tgz' function fatal_error { @@ -93,7 +93,7 @@ cat <<ENDOFTEXT */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -143,6 +143,7 @@ extern "C" { /* undo ast_map.h #defines to avoid collision */ #undef basename #undef dirname +#undef mktemp /* Generated data, do not edit. */ XPG4CMDLIST(basename) @@ -159,6 +160,7 @@ BINCMDLIST(cksum) ASTCMDLIST(cksum) BINCMDLIST(cmp) ASTCMDLIST(cmp) +BINCMDLIST(comm) ASTCMDLIST(comm) XPG4CMDLIST(cp) ASTCMDLIST(cp) @@ -171,11 +173,13 @@ XPG4CMDLIST(expr) ASTCMDLIST(expr) ASTCMDLIST(fds) ASTCMDLIST(fmt) +BINCMDLIST(fold) ASTCMDLIST(fold) BINCMDLIST(head) ASTCMDLIST(head) XPG4CMDLIST(id) ASTCMDLIST(id) +BINCMDLIST(join) ASTCMDLIST(join) XPG4CMDLIST(ln) ASTCMDLIST(ln) @@ -185,10 +189,13 @@ BINCMDLIST(mkdir) ASTCMDLIST(mkdir) BINCMDLIST(mkfifo) ASTCMDLIST(mkfifo) +BINCMDLIST(mktemp) +ASTCMDLIST(mktemp) XPG4CMDLIST(mv) ASTCMDLIST(mv) BINCMDLIST(paste) ASTCMDLIST(paste) +BINCMDLIST(pathchk) ASTCMDLIST(pathchk) BINCMDLIST(rev) ASTCMDLIST(rev) @@ -204,6 +211,7 @@ SUSRBINCMDLIST(sync) SBINCMDLIST(sync) BINCMDLIST(sync) ASTCMDLIST(sync) +BINCMDLIST(tail) XPG4CMDLIST(tail) ASTCMDLIST(tail) BINCMDLIST(tee) @@ -305,14 +313,15 @@ function build_shell # gcc flags bgcc99="/usr/sfw/bin/gcc -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1" - bgcc_ccflags="${bon_flags} ${bast_flags} -D_lib_socket=1 -lsocket -lnsl" + bgcc_warnflags="-Wall -Wextra -Wno-unknown-pragmas -Wno-missing-braces -Wno-sign-compare -Wno-parentheses -Wno-uninitialized -Wno-implicit-function-declaration -Wno-unused -Wno-trigraphs -Wno-char-subscripts -Wno-switch" + bgcc_ccflags="${bon_flags} ${bgcc_warnflags} ${bast_flags} -D_lib_socket=1 -lsocket -lnsl" - case "${buildmode}" in - *.i386.32bit.suncc*) HOSTTYPE="sol11.i386" CC="${bsunc99}" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" ;; - *.i386.64bit.suncc*) HOSTTYPE="sol11.i386" CC="${bsunc99} -xarch=amd64 -KPIC" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" ;; - *.sparc.32bit.suncc*) HOSTTYPE="sol11.sun4" CC="${bsunc99}" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" bsuncc_app_ccflags="${bsuncc_app_ccflags_sparc}" ;; - *.sparc.64bit.suncc*) HOSTTYPE="sol11.sun4" CC="${bsunc99} -xarch=v9 -dalign -KPIC" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" bsuncc_app_ccflags="${bsuncc_app_ccflags_sparc}" ;; + # for -m32/-m64 flags see usr/src/Makefile.master, makefile symbols *_XARCH/co. + *.i386.32bit.suncc*) HOSTTYPE="sol11.i386" CC="${bsunc99} -m32" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" ;; + *.i386.64bit.suncc*) HOSTTYPE="sol11.i386" CC="${bsunc99} -m64 -KPIC" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" ;; + *.sparc.32bit.suncc*) HOSTTYPE="sol11.sun4" CC="${bsunc99} -m32" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" bsuncc_app_ccflags="${bsuncc_app_ccflags_sparc}" ;; + *.sparc.64bit.suncc*) HOSTTYPE="sol11.sun4" CC="${bsunc99} -m64 -dalign -KPIC" cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" bsuncc_app_ccflags="${bsuncc_app_ccflags_sparc}" ;; *.i386.32bit.gcc*) HOSTTYPE="sol11.i386" CC="${bgcc99} -fPIC" cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}" ;; *.i386.64bit.gcc*) HOSTTYPE="sol11.i386" CC="${bgcc99} -m64 -mtune=opteron -Ui386 -U__i386 -fPIC" cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}" ;; @@ -349,17 +358,22 @@ function build_shell [[ -s $log ]] || fatal_error "build_shell: no make.out log found." + if [[ -f ${root}/lib/libast-g.a ]] then link_libast="ast-g" ; else link_libast="ast" ; fi + if [[ -f ${root}/lib/libdll-g.a ]] then link_libdll="dll-g" ; else link_libdll="dll" ; fi + if [[ -f ${root}/lib/libsum-g.a ]] then link_libsum="sum-g" ; else link_libsum="sum" ; fi + if [[ -f ${root}/lib/libcmd-g.a ]] then link_libcmd="cmd-g" ; else link_libcmd="cmd" ; fi + if [[ -f ${root}/lib/libshell-g.a ]] then link_libshell="shell-g" ; else link_libshell="shell" ; fi + if [[ "${buildmode}" != *.staticshell* ]] ; then # libcmd causes some trouble since there is a squatter in solaris # This has been fixed in Solaris 11/B48 but may require adjustments # for older Solaris releases for lib in libast libdll libsum libcmd libshell ; do - (( $? == 0 )) || exit 1 case "$lib" in libshell) - base="lib/" + base="src/cmd/ksh93/" vers=1 - link="-L${root}/lib/ -lcmd -lsum -ldll -last -lm" + link="-L${root}/lib/ -l${link_libcmd} -l${link_libsum} -l${link_libdll} -l${link_libast} -lm" ;; libdll) base="src/lib/${lib}" @@ -374,20 +388,23 @@ function build_shell *) base="src/lib/${lib}" vers=1 - link="-L${root}/lib/ -last -lm" + link="-L${root}/lib/ -l${link_libast} -lm" ;; esac ( cd "${root}/${base}" + + if [[ -f ${lib}-g.a ]] ; then lib_a="${lib}-g.a" ; else lib_a="${lib}.a" ; fi + if [[ "${buildmode}" == *solaris* ]] ; then - ${CC} ${cc_sharedlib} ${CCFLAGS} -Bdirect -Wl,-zallextract -Wl,-zmuldefs -o "${root}/lib/${lib}.so.${vers}" "${lib}.a" $link + ${CC} ${cc_sharedlib} ${CCFLAGS} -Bdirect -Wl,-zallextract -Wl,-zmuldefs -o "${root}/lib/${lib}.so.${vers}" "${lib_a}" $link else - ${CC} ${cc_sharedlib} ${CCFLAGS} -Wl,--whole-archive -Wl,-zmuldefs "${lib}.a" -Wl,--no-whole-archive -o "${root}/lib/${lib}.so.${vers}" $link + ${CC} ${cc_sharedlib} ${CCFLAGS} -Wl,--whole-archive -Wl,-zmuldefs "${lib_a}" -Wl,--no-whole-archive -o "${root}/lib/${lib}.so.${vers}" $link fi #rm ${lib}.a - mv "${lib}.a" "disabled_${lib}.a_" + mv "${lib_a}" "disabled_${lib_a}_" cd "${root}/lib" ln -sf "${lib}.so.${vers}" "${lib}.so" @@ -398,13 +415,13 @@ function build_shell base=src/cmd/ksh93 cd "${root}/${base}" rm -f \ - "${root}/lib/libshell.a" \ - "${root}/lib/libsum.a" \ - "${root}/lib/libdll.a" \ - "${root}/lib/libast.a" + "${root}/lib/libshell.a" "${root}/lib/libshell-g.a" \ + "${root}/lib/libsum.a" "${root}/lib/libsum-g.a" \ + "${root}/lib/libdll.a" "${root}/lib/libdll-g.a" \ + "${root}/lib/libast.a""${root}/lib/libast-g.a" if [[ "${buildmode}" == *solaris* ]] ; then - ${CC} ${CCFLAGS} ${bsuncc_app_ccflags} -L${root}/lib/ -Bdirect -o ksh pmain.o -lshell -Bstatic -lcmd -Bdynamic -lsum -ldll -last -lm -lmd -lsecdb + ${CC} ${CCFLAGS} ${bsuncc_app_ccflags} -L${root}/lib/ -Bdirect -o ksh pmain.o -lshell -Bstatic -l${link_libcmd} -Bdynamic -lsum -ldll -last -lm -lmd -lsecdb else ${CC} ${CCFLAGS} ${bsuncc_app_ccflags} -L${root}/lib/ -o ksh pmain.o -lshell -lcmd -lsum -ldll -last -lm fi @@ -445,6 +462,8 @@ function test_shell { set -o errexit set -o xtrace + + ulimit -s 65536 # need larger stack on 64bit SPARC to pass all tests export SHELL="$(ls -1 $PWD/arch/*/src/cmd/ksh93/ksh)" export LD_LIBRARY_PATH="$(ls -1ad $PWD/arch/*/lib):${LD_LIBRARY_PATH}" @@ -456,7 +475,7 @@ function test_shell [[ ! -f "${SHELL}" ]] && fatal_error "test_shell: |${SHELL}| is not a file." [[ ! -x "${SHELL}" ]] && fatal_error "test_shell: |${SHELL}| is not executable." - [[ "${TEST_LANG}" == "" ]] && TEST_LANG="C" + [[ "${TEST_LANG}" == "" ]] && TEST_LANG="C ja_JP.UTF-8" case "${buildmode}" in testshell.bcheck*) diff --git a/usr/src/lib/libshell/misc/images/callouts/1.png b/usr/src/lib/libshell/misc/images/callouts/1.png Binary files differnew file mode 100644 index 0000000000..608fad3596 --- /dev/null +++ b/usr/src/lib/libshell/misc/images/callouts/1.png diff --git a/usr/src/lib/libshell/misc/images/callouts/10.png b/usr/src/lib/libshell/misc/images/callouts/10.png Binary files differnew file mode 100644 index 0000000000..39e55197cf --- /dev/null +++ b/usr/src/lib/libshell/misc/images/callouts/10.png diff --git a/usr/src/lib/libshell/misc/images/callouts/2.png b/usr/src/lib/libshell/misc/images/callouts/2.png Binary files differnew file mode 100644 index 0000000000..5444738841 --- /dev/null +++ b/usr/src/lib/libshell/misc/images/callouts/2.png diff --git a/usr/src/lib/libshell/misc/images/callouts/3.png b/usr/src/lib/libshell/misc/images/callouts/3.png Binary files differnew file mode 100644 index 0000000000..64b87c7151 --- /dev/null +++ b/usr/src/lib/libshell/misc/images/callouts/3.png diff --git a/usr/src/lib/libshell/misc/images/callouts/4.png b/usr/src/lib/libshell/misc/images/callouts/4.png Binary files differnew file mode 100644 index 0000000000..c308193ac4 --- /dev/null +++ b/usr/src/lib/libshell/misc/images/callouts/4.png diff --git a/usr/src/lib/libshell/misc/images/callouts/5.png b/usr/src/lib/libshell/misc/images/callouts/5.png Binary files differnew file mode 100644 index 0000000000..24799f0a43 --- /dev/null +++ b/usr/src/lib/libshell/misc/images/callouts/5.png diff --git a/usr/src/lib/libshell/misc/images/callouts/6.png b/usr/src/lib/libshell/misc/images/callouts/6.png Binary files differnew file mode 100644 index 0000000000..8919a670cd --- /dev/null +++ b/usr/src/lib/libshell/misc/images/callouts/6.png diff --git a/usr/src/lib/libshell/misc/images/callouts/7.png b/usr/src/lib/libshell/misc/images/callouts/7.png Binary files differnew file mode 100644 index 0000000000..e30e8a70cb --- /dev/null +++ b/usr/src/lib/libshell/misc/images/callouts/7.png diff --git a/usr/src/lib/libshell/misc/images/callouts/8.png b/usr/src/lib/libshell/misc/images/callouts/8.png Binary files differnew file mode 100644 index 0000000000..3e35c8827c --- /dev/null +++ b/usr/src/lib/libshell/misc/images/callouts/8.png diff --git a/usr/src/lib/libshell/misc/images/callouts/9.png b/usr/src/lib/libshell/misc/images/callouts/9.png Binary files differnew file mode 100644 index 0000000000..ed2f14b4eb --- /dev/null +++ b/usr/src/lib/libshell/misc/images/callouts/9.png diff --git a/usr/src/lib/libshell/misc/images/tag_bourne.png b/usr/src/lib/libshell/misc/images/tag_bourne.png Binary files differnew file mode 100644 index 0000000000..f1f78e3a25 --- /dev/null +++ b/usr/src/lib/libshell/misc/images/tag_bourne.png diff --git a/usr/src/lib/libshell/misc/images/tag_i18n.png b/usr/src/lib/libshell/misc/images/tag_i18n.png Binary files differnew file mode 100644 index 0000000000..559929df2a --- /dev/null +++ b/usr/src/lib/libshell/misc/images/tag_i18n.png diff --git a/usr/src/lib/libshell/misc/images/tag_ksh.png b/usr/src/lib/libshell/misc/images/tag_ksh.png Binary files differnew file mode 100644 index 0000000000..b33d5a7aa1 --- /dev/null +++ b/usr/src/lib/libshell/misc/images/tag_ksh.png diff --git a/usr/src/lib/libshell/misc/images/tag_ksh88.png b/usr/src/lib/libshell/misc/images/tag_ksh88.png Binary files differnew file mode 100644 index 0000000000..d36dc0f5f5 --- /dev/null +++ b/usr/src/lib/libshell/misc/images/tag_ksh88.png diff --git a/usr/src/lib/libshell/misc/images/tag_ksh93.png b/usr/src/lib/libshell/misc/images/tag_ksh93.png Binary files differnew file mode 100644 index 0000000000..357ee3c50a --- /dev/null +++ b/usr/src/lib/libshell/misc/images/tag_ksh93.png diff --git a/usr/src/lib/libshell/misc/images/tag_l10n.png b/usr/src/lib/libshell/misc/images/tag_l10n.png Binary files differnew file mode 100644 index 0000000000..be89f7a163 --- /dev/null +++ b/usr/src/lib/libshell/misc/images/tag_l10n.png diff --git a/usr/src/lib/libshell/misc/images/tag_perf.png b/usr/src/lib/libshell/misc/images/tag_perf.png Binary files differnew file mode 100644 index 0000000000..fcb2960852 --- /dev/null +++ b/usr/src/lib/libshell/misc/images/tag_perf.png diff --git a/usr/src/lib/libshell/misc/shell_styleguide.docbook b/usr/src/lib/libshell/misc/shell_styleguide.docbook new file mode 100644 index 0000000000..0376912d1f --- /dev/null +++ b/usr/src/lib/libshell/misc/shell_styleguide.docbook @@ -0,0 +1,1464 @@ +<?xml version="1.0"?> +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN" "http://www.oasis-open.org/docbook/xml/5.0b5/dtd/docbook.dtd" [ + <!ENTITY tag_bourneonly '<inlinemediaobject><imageobject><imagedata fileref="images/tag_bourne.png"></imagedata></imageobject><textobject><phrase>[Bourne]</phrase></textobject></inlinemediaobject> '> + <!ENTITY tag_kshonly '<inlinemediaobject><imageobject><imagedata fileref="images/tag_ksh.png"></imagedata></imageobject><textobject><phrase>[ksh]</phrase></textobject></inlinemediaobject> '> + <!ENTITY tag_ksh88only '<inlinemediaobject><imageobject><imagedata fileref="images/tag_ksh88.png"></imagedata></imageobject><textobject><phrase>[ksh88]</phrase></textobject></inlinemediaobject> '> + <!ENTITY tag_ksh93only '<inlinemediaobject><imageobject><imagedata fileref="images/tag_ksh93.png"></imagedata></imageobject><textobject><phrase>[ksh93]</phrase></textobject></inlinemediaobject> '> + <!ENTITY tag_performance '<inlinemediaobject><imageobject><imagedata fileref="images/tag_perf.png"></imagedata></imageobject><textobject><phrase>[perf]</phrase></textobject></inlinemediaobject> '> + <!ENTITY tag_i18n '<inlinemediaobject><imageobject><imagedata fileref="images/tag_i18n.png"></imagedata></imageobject><textobject><phrase>[i18n]</phrase></textobject></inlinemediaobject> '> + <!ENTITY tag_l10n '<inlinemediaobject><imageobject><imagedata fileref="images/tag_l10n.png"></imagedata></imageobject><textobject><phrase>[l10n]</phrase></textobject></inlinemediaobject> '> +]> +<!-- + + 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 2009 Sun Microsystems, Inc. All rights reserved. + Use is subject to license terms. + +--> + +<!-- tag images were created like this: +$ (text="perf" ; + pbmtext -nomargins -lspace 0 -builtin fixed "${text}" | + pbmtopgm 1 1 | + pgmtoppm 1.0,1.0,1.0-0,0,0 /dev/stdin | + ppmtogif | + giftopnm | + pnmtopng >"tag_${text}.png") +--> + +<!-- compile with: +xsltproc −−stringparam generate.section.toc.level 0 \ + −−stringparam toc.max.depth 3 \ + −−stringparam toc.section.depth 12 \ + −−xinclude -o opensolaris_shell_styleguide.html /usr/share/sgml/docbook/docbook-xsl-stylesheets-1.69.1/html/docbook.xsl opensolaris_shell_styleguide.docbook +--> + +<article + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="http://docbook.org/ns/docbook" + xml:lang="en"> + <!-- xmlns:xi="http://www.w3.org/2001/XInclude" --> + + <info> + <title><emphasis>[DRAFT]</emphasis> Bourne/Korn Shell Coding Conventions</title> + + <!-- subtitle abuse --> + <subtitle> + This page is currently work-in-progress until it is approved by the OS/Net community. Please send any comments to + <email>shell-discuss@opensolaris.org</email>. + </subtitle> + + + <authorgroup> +<!-- + <author><personname>David G. Korn</personname><email>dgk@research.att.com</email></author> + <author><personname>Roland Mainz</personname><email>roland.mainz@nrubsig.org</email></author> + <author><personname>Mike Shapiro</personname><email>mike.shapiro@sun.com</email></author> +--> + <author><orgname>OpenSolaris.org</orgname></author> + </authorgroup> + </info> + +<section xml:id="intro"> + <title>Intro</title> + <para>This document describes the shell coding style used for all the SMF script changes integrated into (Open)Solaris.</para> + <para>All new SMF shell code should conform to this coding standard, which is intended to match our existing C coding standard.</para> + <para>When in doubt, think "what would be the C-Style equivalent ?" and "What does the POSIX (shell) standard say ?"</para> +</section><!-- end of intro --> + + +<section xml:id="rules"> + <title>Rules</title> + + + + <section xml:id="general"> + <title>General</title> + + <section xml:id="basic_format"> + <title>Basic Format</title> + <para>Similar to <literal>cstyle</literal>, the basic format is that all + lines are indented by TABs or eight spaces, and continuation lines (which + in the shell end with "\") are indented by an equivalent number of TABs + and then an additional four spaces, e.g. +<programlisting> +cp foo bar +cp some_realllllllllllllllly_realllllllllllllly_long_path \ + to_another_really_long_path +</programlisting> + </para> + <para>The encoding used for the shell scripts is either <literal>ASCII</literal> + or <literal>UTF-8</literal>, alternative encodings are only allowed when the + application requires this.</para> + </section> + + + <section xml:id="commenting"> + <title>Commenting</title> + <para>Shell comments are preceded by the '<literal>#</literal>' character. Place + single-line comments in the right-hand margin. Use an extra '<literal>#</literal>' + above and below the comment in the case of multi-line comments: +<programlisting> +cp foo bar # Copy foo to bar + +# +# Modify the permissions on bar. We need to set them to root/sys +# in order to match the package prototype. +# +chown root bar +chgrp sys bar +</programlisting> + </para> + </section> + + + <section xml:id="interpreter_magic"> + <title>Interpreter magic</title> + <para>The proper interpreter magic for your shell script should be one of these: +<programlisting> +#!/bin/sh Standard Bourne shell script +#!/bin/ksh -p Standard Korn shell 88 script. You should always write ksh + scripts with -p so that ${ENV} (if set by the user) is not + sourced into your script by the shell. +#!/bin/ksh93 Standard Korn shell 93 script (-p is not needed since ${ENV} is + only used for interactive shell sessions). +</programlisting> + </para> + </section> + + + <section xml:id="harden_your_script_against_unexpected_input"> + <title>Harden the script against unexpected (user) input</title> + <para>Harden your script against unexpected (user) input, including + command line options, filenames with blanks (or other special + characters) in the name, or file input</para> + </section> + + + <section xml:id="use_builtin_commands"> + <title>&tag_kshonly;&tag_performance;Use builtin commands if the shell provides them</title> + <para> + Use builtin commands if the shell provides them. For example ksh93s+ + (ksh93, version 's+') delivered with Solaris (as defined by PSARC 2006/550) + supports the following builtins: + <simplelist type="inline"> + <member>basename</member> + <member>cat</member> + <member>chgrp</member> + <member>chmod</member> + <member>chown</member> + <member>cmp</member> + <member>comm</member> + <member>cp</member> + <member>cut</member> + <member>date</member> + <member>dirname</member> + <member>expr</member> + <member>fds</member> + <member>fmt</member> + <member>fold</member> + <member>getconf</member> + <member>head</member> + <member>id</member> + <member>join</member> + <member>ln</member> + <member>logname</member> + <member>mkdir</member> + <member>mkfifo</member> + <member>mv</member> + <member>paste</member> + <member>pathchk</member> + <member>rev</member> + <member>rm</member> + <member>rmdir</member> + <member>stty</member> + <member>tail</member> + <member>tee</member> + <member>tty</member> + <member>uname</member> + <member>uniq</member> + <member>wc</member> + <member>sync</member> + </simplelist> + Those builtins can be enabled via <literal>$ builtin name_of_builtin #</literal> in shell + scripts (note that ksh93 builtins implement exact POSIX behaviour - some + commands in Solaris <filename>/usr/bin/</filename> directory implement pre-POSIX behaviour. + Add <literal>/usr/xpg6/bin/:/usr/xpg4/bin</literal> before + <filename>/usr/bin/</filename> in <envar>${PATH}</envar> to test whether your script works with + the XPG6/POSIX versions) + </para> + </section> + + + <section xml:id="use_blocks_not_subshells"> + <title>&tag_performance;Use blocks and not subshells if possible</title> + <para>Use blocks and not subshells if possible, e.g. use + <literal>$ { print "foo" ; print "bar" ; }</literal> instead of + <literal>$ (print "foo" ; print "bar") #</literal> - blocks are + faster since they do not require to save the subshell context (ksh93) or + trigger a shell child process (Bourne shell, bash, ksh88 etc.) + </para> + </section> + + + <section xml:id="use_long_options_for_set_builtin"> + <title>&tag_kshonly; use long options for "<literal>set</literal>"</title> + <para>use long options for "<literal>set</literal>", for example instead of <literal>$ set -x #</literal> + use <literal>$ set -o xtrace #</literal> to make the code more readable.</para> + </section> + + + <section xml:id="use_posix_command_substitutions_syntax"> + <title>&tag_kshonly; Use <literal>$(...)</literal> instead of <literal>`...`</literal> command substitutions</title> + <para>Use <literal>$(...)</literal> instead of <literal>`...`</literal> - <literal>`...`</literal> + is an obsolete construct in ksh+POSIX sh scripts and <literal>$(...)</literal>.is a cleaner design, + requires no escaping rules, allows easy nesting etc.</para> + + <note><title>&tag_ksh93only; <literal>${ ...;}</literal>-style command substitutions</title> + <para>ksh93 has support for an alternative version of command substitutions with the + syntax <literal>${ ...;}</literal> which do not run in a subshell. + </para></note> + </section> + + + <section xml:id="put_command_substitution_result_in_quotes"> + <title>&tag_kshonly; Always put the result of a <literal>$(...)</literal> or + <literal>$( ...;)</literal> command substitution in quotes</title> + <para>Always put the result of <literal>$( ... )</literal> or <literal>$( ...;)</literal> in + quotes (e.g. <literal>foo="$( ... )"</literal> or <literal>foo="$( ...;)"</literal>) unless + there is a very good reason for not doing it</para> + </section> + + + <section xml:id="always_set_path"> + <title>Scripts should always set their <envar>PATH</envar></title> + <para>Scripts should always set their <envar>PATH</envar> to make sure they do not use + alternative commands by accident (unless the value of <envar>PATH</envar> is well-known + and guaranteed to be set by the caller)</para> + </section> + + + <section xml:id="make_sure_commands_are_available"> + <title>Make sure that commands from other packages/applications are really installed on the machine</title> + <para>Scripts should make sure that commands in optional packages are really + there, e.g. add a "precheck" block in scipts to avoid later failure when + doing the main job</para> + </section> + + + <section xml:id="check_usage_of_boolean_variables"> + <title>Check how boolean values are used/implemented in your application</title> + <para>Check how boolean values are used in your application.</para> + <para>For example: +<programlisting> +mybool=0 +# do something +if [ $mybool -eq 1 ] ; then do_something_1 ; fi +</programlisting> +could be rewritten like this: +<programlisting> +mybool=false # (valid values are "true" or "false", pointing +# to the builtin equivalents of /bin/true or /bin/false) +# do something +if ${mybool} ; then do_something_1 ; fi +</programlisting> +or +<programlisting> +integer mybool=0 # values are 0 or 1 +# do something +if (( mybool==1 )) ; then do_something_1 ; fi +</programlisting> + </para> + </section> + + <section xml:id="shell_uses_characters_not_bytes"> + <title>&tag_i18n;The shell always operates on <emphasis>characters</emphasis> not bytes</title> + <para>Shell scripts operate on characters and <emphasis>not</emphasis> bytes. + Some locales use multiple bytes (called "multibyte locales") to represent one character</para> + + <note><para>ksh93 has support for binary variables which explicitly + operate on bytes, not characters. This is the <emphasis>only</emphasis> allowed + exception.</para></note> + </section> + + + <section xml:id="multibyte_locale_input"> + <title>&tag_i18n;Multibyte locales and input</title> + <para>Think about whether your application has to handle file names or + variables in multibyte locales and make sure all commands used in your + script can handle such characters (e.g. lots of commands in Solaris's + <filename>/usr/bin/</filename> are <emphasis>not</emphasis> able to handle such values - either use ksh93 + builtin constructs (which are guaranteed to be multibyte-aware) or + commands from <filename>/usr/xpg4/bin/</filename> and/or <filename>/usr/xpg6/bin</filename>) + </para> + </section> + + + <section xml:id="use_external_filters_only_for_large_datasets"> + <title>&tag_performance;Only use external filters like <literal>grep</literal>/<literal>sed</literal>/<literal>awk</literal>/etc. + if you want to process lots of data with them</title> + <para>Only use external filters like <literal>grep</literal>/<literal>sed</literal>/<literal>awk</literal>/etc. + if a significant amount of data is processed by the filter or if + benchmarking shows that the use of builtin commands is significantly slower + (otherwise the time and resources needed to start the filter are + far greater then the amount of data being processed, + creating a performance problem).</para> + <para>For example: +<programlisting> +if [ "$(echo "$x" | egrep '.*foo.*')" != "" ] ; then + do_something ; +done +</programlisting> +can be re-written using ksh93 builtin constructs, saving several +<literal>|fork()|+|exec()|</literal>'s: +<programlisting> +if [[ "${x}" == ~(E).*foo.* ]] ; then + do_something ; +done +</programlisting> + </para> + </section> + + + <section xml:id="use_dashdash_if_first_arg_is_variable"> + <title>If the first operand of a command is a variable, use <literal>--</literal></title> + <para>If the first operand of a command is a variable, use <literal>--</literal> + for any command that accepts this as end of argument to + avoid problems if the variable expands to a value starting with <literal>-</literal>. + </para> + <note><para> + At least + <simplelist type="inline"> + <member>print</member> + <member>/usr/bin/fgrep</member><member>/usr/xpg4/bin/fgrep</member> + <member>/usr/bin/grep</member> <member>/usr/xpg4/bin/grep</member> + <member>/usr/bin/egrep</member><member>/usr/xpg4/bin/egrep</member> + </simplelist> + support <literal>--</literal> as "end of arguments"-terminator. + </para></note> + </section> + + <section xml:id="use_export"> + <title>&tag_kshonly;&tag_performance;Use <literal>$ export FOOBAR=val #</literal> instead of + <literal>$ FOOBAR=val ; export FOOBAR #</literal></title> + <para>Use <literal>$ export FOOBAR=val # instead of $ FOOBAR=val ; export FOOBAR #</literal> - + this is much faster.</para> + </section> + + + <section xml:id="use_subshell_around_set_dashdash_usage"> + <title>Use a subshell (e.g. <literal>$ ( mycmd ) #</literal>) around places which use + <literal>set -- $(mycmd)</literal> and/or <literal>shift</literal></title> + <para>Use a subshell (e.g. <literal>$ ( mycmd ) #</literal>) around places which use + <literal>set -- $(mycmd)</literal> and/or <literal>shift</literal> unless the variable + affected is either a local one or if it's guaranteed that this variable will no longer be used + (be careful for loadable functions, e.g. ksh/ksh93's <literal>autoload</literal> !!!!) + </para> + </section> + + + <section xml:id="be_careful_with_tabs_in_script_code"> + <title>Be careful with using TABS in script code, they are not portable + between editors or platforms</title> + <para>Be careful with using TABS in script code, they are not portable + between editors or platforms.</para> + <para>If you use ksh93 use <literal>$'\t'</literal> to include TABs in sources, not the TAB character itself.</para> + </section> + + + <section xml:id="centralise_error_exit"> + <title>If you have multiple points where your application exits with an error + message create a central function for this purpose</title> + <para>If you have multiple points where your application exits with an error + message create a central function for this, e.g. +<programlisting> +if [ -z "$tmpdir" ] ; then + print -u2 "mktemp failed to produce output; aborting." + exit 1 +fi +if [ ! -d $tmpdir ] ; then + print -u2 "mktemp failed to create a directory; aborting." + exit 1 +fi +</programlisting> +should be replaced with +<programlisting> +function fatal_error +{ + print -u2 "${progname}: $*" + exit 1 +} +# do something (and save ARGV[0] to variable "progname") +if [ -z "$tmpdir" ] ; then + fatal_error "mktemp failed to produce output; aborting." +fi +if [ ! -d "$tmpdir" ] ; then + fatal_error "mktemp failed to create a directory; aborting." +fi +</programlisting> + </para> + </section> + + + <section xml:id="use_set_o_nounset"> + <title>&tag_kshonly; Think about using <literal>$ set -o nounset #</literal> by default</title> + <para>Think about using <literal>$ set -o nounset #</literal> by default (or at least during the + script's development phase) to catch errors where variables are used + when they are not set (yet), e.g. +<screen> +$ <userinput>(set -o nounset ; print ${foonotset})</userinput> +<computeroutput>/bin/ksh93: foonotset: parameter not set</computeroutput> +</screen> + </para> + </section> + + + <section xml:id="avoid_eval_builtin"> + <title>Avoid using <literal>eval</literal> unless absolutely necessary</title> + <para>Avoid using <literal>eval</literal> unless absolutely necessary. Subtle things + can happen when a string is passed back through the shell + parser. You can use name references to avoid uses such as + <literal>eval $name="$value"</literal>. + </para> + </section> + + + <section xml:id="use_concatenation_operator"> + <title>&tag_ksh93only;Use the string/array concatenation operator <literal>+=</literal></title> + <para>Use <literal>+=</literal> instead of manually adding strings/array elements, e.g. +<programlisting> +foo="" +foo="${foo}a" +foo="${foo}b" +foo="${foo}c" +</programlisting> +should be replaced with +<programlisting> +foo="" +foo+="a" +foo+="b" +foo+="c" +</programlisting> + </para> + </section> + + <section xml:id="use_source_not_dot"> + <title>&tag_ksh93only;Use <literal>source</literal> instead of '<literal>.</literal> '(dot) + to include other shell script fragments</title> + <para>Use <literal>source</literal> instead of '<literal>.</literal>' + (dot) to include other shell script fragments - the new form is much + more readable than the tiny dot and a failure can be caught within the script.</para> + </section> + + + <section xml:id="use_builtin_localisation_support"> + <title>&tag_ksh93only;&tag_performance;&tag_l10n;Use <literal>$"..."</literal> instead of + <literal>gettext ... "..."</literal> for strings that need to be localized for different locales</title> + <para>Use $"..." instead of <literal>gettext ... "..."</literal> for strings that need to be + localized for different locales. <literal>gettext</literal> will require a + <literal>fork()+exec()</literal> and + reads the whole catalog each time it's called, creating a huge overhead for localisation + (and the <literal>$"..."</literal> is easier to use, e.g. you only have to put a + <literal>$</literal> in front of the catalog and the string will be localised). + </para> + </section> + + + <section xml:id="use_set_o_noglob"> + <title>&tag_kshonly;&tag_performance;Use <literal>set -o noglob</literal> if you do not need to expand files</title> + <para>If you don't expect to expand files, you can do set <literal>-f</literal> + (<literal>set -o noglob</literal>) as well. This way the need to use <literal>""</literal> is + greatly reduced.</para> + </section> + + + <section xml:id="use_empty_ifs_to_handle_spaces"> + <title>&tag_ksh93only;Use <literal>IFS=</literal> to avoid problems with spaces in filenames</title> + <para>Unless you want to do word splitting, put <literal>IFS=</literal> + at the beginning of a command. This way spaces in + file names won't be a problem. You can do + <literal>IFS='delims' read -r</literal> line + to override <envar>IFS</envar> just for the <literal>read</literal> command. However, + you can't do this for the <literal>set</literal> builtin.</para> + </section> + + + <section xml:id="set_locale_when_comparing_against_localised_output"> + <title>Set the message locale if you process output of tools which may be localised</title> + <para>Set the message locale (<envar>LC_MESSAGES</envar>) if you process output of tools which may be localised</para> + <example><title>Set <envar>LC_MESSAGES</envar> when testing for specific outout of the <filename>/usr/bin/file</filename> utility:</title> +<programlisting> +# set french as default message locale +export LC_MESSAGES=fr_FR.UTF-8 + +... + +# test whether the file "/tmp" has the filetype "directory" or not +# we set LC_MESSAGES to "C" to ensure the returned message is in english +if [[ "$(LC_MESSAGES=C file /tmp)" = *directory ]] ; then + print "is a directory" +fi +</programlisting> + <note><para>The environment variable <envar>LC_ALL</envar> always + overrides any other <envar>LC_*</envar> environment variables + (and <envar>LANG</envar>, too), + including <envar>LC_MESSAGES</envar>. + if there is the chance that <envar>LC_ALL</envar> may be set + replace <envar>LC_MESSAGES</envar> with <envar>LC_ALL</envar> + in the example above.</para></note> + </example> + </section> + + <section xml:id="cleanup_after_yourself"> + <title>Cleanup after yourself.</title> + <para>Cleanup after yourself. For example ksh/ksh93 have an <literal>EXIT</literal> trap which + is very useful for this. + </para> + <note><para> + Note that the <literal>EXIT</literal> trap is executed for a subshell and each subshell + level can run it's own <literal>EXIT</literal> trap, for example +<screen> +$ <userinput>(trap "print bam" EXIT ; (trap "print snap" EXIT ; print "foo"))</userinput> +<computeroutput>foo +snap +bam</computeroutput> +</screen> + </para></note> + </section> + + <section xml:id="use_proper_exit_code"> + <title>Use a proper <literal>exit</literal> code</title> + <para>Explicitly set the exit code of a script, otherwise the exit code + from the last command executed will be used which may trigger problems + if the value is unexpected.</para> + </section> + + + <section xml:id="shell_lint"> + <title>&tag_ksh93only;Use <literal>shcomp -n scriptname.sh /dev/null</literal> to check for common errors</title> + <para>Use <literal>shcomp -n scriptname.sh /dev/null</literal> to + check for common problems (such as insecure, depreciated or ambiguous constructs) in shell scripts.</para> + </section> + </section><!-- end of general --> + + + + + + <section xml:id="functions"> + <title>Functions</title> + + <section xml:id="use_functions"> + <title>Use functions to break up your code</title> + <para>Use functions to break up your code into smaller, logical blocks.</para> + </section> + + <section xml:id="do_not_reserved_keywords_for_function_names"> + <title>Do not use function names which are reserved keywords in C/C++/JAVA or the POSIX shell standard</title> + <para>Do not use function names which are reserved keywords (or function names) in C/C++/JAVA or the POSIX shell standard + (to avoid confusion and/or future changes/updates to the shell language). + </para> + </section> + + <section xml:id="use_ksh_style_function_syntax"> + <title>&tag_kshonly;&tag_performance;Use ksh-style <literal>function</literal></title> + <para>It is <emphasis>highly</emphasis> recommended to use ksh style functions + (<literal>function foo { ... }</literal>) instead + of Bourne-style functions (<literal>foo() { ... }</literal>) if possible + (and local variables instead of spamming the global namespace).</para> + + <warning><para> + The difference between old-style Bourne functions and ksh functions is one of the major differences + between ksh88 and ksh93 - ksh88 allowed variables to be local for Bourne-style functions while ksh93 + conforms to the POSIX standard and will use a function-local scope for variables declared in + Bourne-style functions.</para> + <para>Example (note that "<literal>integer</literal>" is an alias for "<literal>typeset -li</literal>"): +<programlisting> +# new style function with local variable +$ ksh93 -c 'integer x=2 ; function foo { integer x=5 ; } ; print "x=$x" +; foo ; print "x=$x" ;' +x=2 +x=2 +# old style function with an attempt to create a local variable +$ ksh93 -c 'integer x=2 ; foo() { integer x=5 ; } ; print "x=$x" ; foo ; +print "x=$x" ;' +x=2 +x=5 +</programlisting> + + <uri xlink:href="http://www.opensolaris.org/os/project/ksh93-integration/docs/ksh93r/general/compatibility/">usr/src/lib/libshell/common/COMPATIBILITY</uri> + says about this issue: +<blockquote><para> +Functions, defined with name() with ksh-93 are compatible with +the POSIX standard, not with ksh-88. No local variables are +permitted, and there is no separate scope. Functions defined +with the function name syntax, maintain compatibility. +This also affects function traces. +</para></blockquote> +(this issue also affects <filename>/usr/xpg4/bin/sh</filename> in Solaris 10 because it is based on ksh88. This is a bug.). + </para></warning> + + </section> + + + <section xml:id="use_proper_return_code"> + <title>Use a proper <literal>return</literal> code</title> + <para>Explicitly set the return code of a function - otherwise the exit code + from the last command executed will be used which may trigger problems + if the value is unexpected.</para> + <para>The only allowed exception is if a function uses the shell's <literal>errexit</literal> mode to leave + a function, subshell or the script if a command returns a non-zero exit code. + </para> + </section> + + <section xml:id="use_fpath_to_load_common_code"> + <title>&tag_kshonly;Use <envar>FPATH</envar> to load common functions, not <literal>source</literal></title> + <para> + Use the ksh <envar>FPATH</envar> (function path) feature to load functions which are shared between scripts + and not <literal>source</literal> - this allows to load such a function on demand and not all at once.</para> + </section> + + </section><!-- end of functions --> + + + + + <section xml:id="if_for_while"> + <title><literal>if</literal>, <literal>for</literal> and <literal>while</literal></title> + + <section xml:id="if_for_while_format"> + <title>Format</title> + <para>To match <literal>cstyle</literal>, the shell token equivalent to the <literal>C</literal> + "<literal>{</literal>" should appear on the same line, separated by a + "<literal>;</literal>", as in: +<programlisting> +if [ "$x" = "hello" ] ; then + echo $x +fi + +if [[ "$x" = "hello" ]] ; then + print $x +fi + +for i in 1 2 3; do + echo $i +done + +for ((i=0 ; i < 3 ; i++)); do + print $i +done + +while [ $# -gt 0 ]; do + echo $1 + shift +done + +while (( $# > 0 )); do + print $1 + shift +done +</programlisting> + </para> + </section> + + + <section xml:id="test_builtin"> + <title><literal>test</literal> Builtin</title> + <para>DO NOT use the test builtin. Sorry, executive decision.</para> + <para>In our Bourne shell, the <literal>test</literal> built-in is the same as the "[" + builtin (if you don't believe me, try "type test" or refer to <filename>usr/src/cmd/sh/msg.c</filename>).</para> + <para> + So please do not write: +<programlisting> +if test $# -gt 0 ; then +</programlisting> +instead use: +<programlisting> +if [ $# -gt 0 ] ; then +</programlisting> + </para> + </section> + + + <section xml:id="use_ksh_test_syntax"> + <title>&tag_kshonly;&tag_performance;Use "<literal>[[ expr ]]</literal>" instead of "<literal>[ expr ]</literal>"</title> + <para>Use "<literal>[[ expr ]]</literal>" instead of "<literal>[ expr ]</literal>" if possible + since it avoids going through the whole pattern expansion/etc. machinery and + adds additional operators not available in the Bourne shell, such as short-circuit + <literal>&&</literal> and <literal>||</literal>. + </para> + </section> + + + <section xml:id="use_posix_arithmetic_expressions"> + <title>&tag_kshonly; Use "<literal>(( ... ))</literal>" for arithmetic expressions</title> + <para>Use "<literal>(( ... ))</literal>" instead of "<literal>[ expr ]</literal>" + or "<literal>[[ expr ]]</literal>" expressions. + </para> + <para> + Example: Replace +<programlisting> +i=5 +# do something +if [ $i -gt 5 ] ; then +</programlisting> +with +<programlisting> +i=5 +# do something +if (( i > 5 )) ; then +</programlisting> + </para> + </section> + + + <section xml:id="compare_exit_code_using_math"> + <title>&tag_kshonly;&tag_performance;Compare exit code using arithmetic expressions expressions</title> + <para>Use POSIX arithmetic expressions to test for exit/return codes of commands and functions. + For example turn +<programlisting> +if [ $? -gt 0 ] ; then +</programlisting> +into +<programlisting> +if (( $? > 0 )) ; then +</programlisting> + </para> + </section> + + + <section xml:id="use_builtin_commands_in_loops"> + <title>&tag_bourneonly; Use builtin commands in conditions for <literal>while</literal> endless loops</title> + <para>Make sure that your shell has a "<literal>true</literal>" builtin (like ksh93) when + executing endless loops like <literal>$ while true ; do do_something ; done #</literal> - + otherwise each loop cycle runs a <literal>|fork()|+|exec()|</literal>-cycle to run + <filename>/bin/true</filename> + </para> + </section> + + + <section xml:id="single_line_if_statements"> + <title>Single-line if-statements</title> + <para>It is permissible to use <literal>&&</literal> and <literal>||</literal> to construct + shorthand for an "<literal>if</literal>" statement in the case where the if statement has a + single consequent line: +<programlisting> +[ $# -eq 0 ] && exit 0 +</programlisting> +instead of the longer: +<programlisting> +if [ $# -eq 0 ]; then + exit 0 +fi +</programlisting> + </para> + </section> + + + <section xml:id="exit_status_and_if_for_while"> + <title>Exit Status and <literal>if</literal>/<literal>while</literal> statements</title> + <para>Recall that "<literal>if</literal>" and "<literal>while</literal>" + operate on the exit status of the statement + to be executed. In the shell, zero (0) means true and non-zero means false. + The exit status of the last command which was executed is available in the $? + variable. When using "<literal>if</literal>" and "<literal>while</literal>", + it is typically not necessary to use + <literal>$?</literal> explicitly, as in: +<programlisting> +grep foo /etc/passwd >/dev/null 2>&1 +if [ $? -eq 0 ]; then + echo "found" +fi +</programlisting> +Instead, you can more concisely write: +<programlisting> +if grep foo /etc/passwd >/dev/null 2>&1; then + echo "found" +fi +</programlisting> +Or, when appropriate: +<programlisting> +grep foo /etc/passwd >/dev/null 2>&1 && echo "found" +</programlisting> + </para> + </section> + + </section><!-- end of if/for/while --> + + + + + + + <section xml:id="variables"> + <title>Variable types, naming and usage</title> + + <section xml:id="names_should_be_lowercase"> + <title>Names of local, non-environment, non-constant variables should be lowercase</title> + <para>Names of variables local to the current script which are not exported to the environment + should be lowercase while variable names which are exported to the + environment should be uppercase.</para> + <para>The only exception are global constants (=global readonly variables, + e.g. <literal>$ float -r M_PI=3.14159265358979323846 #</literal> (taken from <math.h>)) + which may be allowed to use uppercase names, too. + </para> + + <warning><para> + Uppercase variable names should be avoided because there is a good chance + of naming collisions with either special variable names used by the shell + (e.g. <literal>PWD</literal>, <literal>SECONDS</literal> etc.). + </para></warning> + </section> + + <section xml:id="do_not_reserved_keywords_for_variable_names"> + <title>Do not use variable names which are reserved keywords/variable names in C/C++/JAVA or the POSIX shell standard</title> + <para>Do not use variable names which are reserved keywords in C/C++/JAVA or the POSIX shell standard + (to avoid confusion and/or future changes/updates to the shell language). + </para> + <note> + <para>The Korn Shell and the POSIX shell standard have many more + reserved variable names than the original Bourne shell. All + these reserved variable names are spelled uppercase. + </para> + </note> + </section> + + <section xml:id="use_brackets_around_long_names"> + <title>Always use <literal>'{'</literal>+<literal>'}'</literal> when using variable + names longer than one character</title> + <para>Always use <literal>'{'</literal>+<literal>'}'</literal> when using + variable names longer than one character unless a simple variable name is + followed by a blank, <literal>/</literal>, <literal>;</literal>, or <literal>$</literal> + character (to avoid problems with array, + compound variables or accidental misinterpretation by users/shell) +<programlisting> +print "$foo=info" +</programlisting> +should be rewritten to +<programlisting> +print "${foo}=info" +</programlisting> + </para> + </section> + + + <section xml:id="quote_variables_containing_filenames_or_userinput"> + <title><emphasis>Always</emphasis> put variables into quotes when handling filenames or user input</title> + <para><emphasis>Always</emphasis> put variables into quotes when handling filenames or user input, even if + the values are hardcoded or the values appear to be fixed. Otherwise at + least two things may go wrong: + <itemizedlist> + <listitem><para>a malicious user may be able to exploit a script's inner working to + infect his/her own code</para></listitem> + <listitem><para>a script may (fatally) misbehave for unexpected input (e.g. file names + with blanks and/or special symbols which are interpreted by the shell)</para></listitem> + </itemizedlist> + </para> + + <note><para> + As alternative a script may set <literal>IFS='' ; set -o noglob</literal> to turn off the + interpretation of any field seperators and the pattern globbing. + </para></note> + </section> + + + + <section xml:id="use_typed_variables"> + <title>&tag_kshonly;&tag_performance;Use typed variables if possible.</title> + <para>For example the following is very + inefficient since it transforms the integer values to strings and back + several times: +<programlisting> +a=0 +b=1 +c=2 +# more code +if [ $a -lt 5 -o $b -gt c ] ; then do_something ; fi +</programlisting> +This could be rewritten using ksh constructs: +<programlisting> +integer a=0 +integer b=1 +integer c=2 +# more code +if (( a < 5 || b > c )) ; then do_something ; fi +</programlisting> + </para> + </section> + + + <section xml:id="store_lists_in_arrays"> + <title>&tag_ksh93only; Store lists in arrays or associative arrays</title> + <para>Store lists in arrays or associative arrays - this is usually easier + to manage.</para> + <para> + For example: +<programlisting> +x=" +/etc/foo +/etc/bar +/etc/baz +" +echo $x +</programlisting> +can be replaced with +<programlisting> +typeset -a mylist +mylist[0]="/etc/foo" +mylist[1]="/etc/bar" +mylist[2]="/etc/baz" +print "${mylist[@]}" +</programlisting> +or (ksh93-style append entries to a normal (non-associative) array) +<programlisting> +typeset -a mylist +mylist+=( "/etc/foo" ) +mylist+=( "/etc/bar" ) +mylist+=( "/etc/baz" ) +print "${mylist[@]}" +</programlisting> + </para> + <note> + <title>Difference between expanding arrays with mylist[@] and mylist[*] subscript operators</title> + <para> + Arrays may be expanded using two similar subscript operators, @ and *. These subscripts + differ only when the variable expansion appears within double quotes. If the variable expansion + is between double-quotes, "${mylist[*]}" expands to a single string with the value of each array + member separated by the first character of the <envar>IFS</envar> variable, and "${mylist[@]}" + expands each element of name to a separate string. + </para> + <example><title>Difference between [@] and [*] when expanding arrays</title> +<programlisting> +typeset -a mylist +mylist+=( "/etc/foo" ) +mylist+=( "/etc/bar" ) +mylist+=( "/etc/baz" ) +IFS="," +printf "mylist[*]={ 0=|%s| 1=|%s| 2=|%s| 3=|%s| }\n" "${mylist[*]}" +printf "mylist[@]={ 0=|%s| 1=|%s| 2=|%s| 3=|%s| }\n" "${mylist[@]}" +</programlisting> +<para>will print:</para> +<screen> +<computeroutput>mylist[*]={ 0=|/etc/foo,/etc/bar,/etc/baz| 1=|| 2=|| 3=|| } +mylist[@]={ 0=|/etc/foo| 1=|/etc/bar| 2=|/etc/baz| 3=|| } +</computeroutput> +</screen> + </example> + </note> + </section> + + + <section xml:id="use_compound_variables_or_lists_for_grouping"> + <title>&tag_ksh93only; Use compound variables or associative arrays to group similar variables together</title> + <para>Use compound variables or associative arrays to group similar variables together.</para> + <para> + For example: +<programlisting> +box_width=56 +box_height=10 +box_depth=19 +echo "${box_width} ${box_height} ${box_depth}" +</programlisting> +could be rewritten to ("associative array"-style) +<programlisting> +typeset -A -E box=( [width]=56 [height]=10 [depth]=19 ) +print -- "${box[width]} ${box[height]} ${box[depth]}" +</programlisting> +or ("compound variable"-style +<programlisting> +box=( + float width=56 + float height=10 + float depth=19 + ) +print -- "${box.width} ${box.height} ${box.depth}" +</programlisting> + </para> + </section> + </section><!-- end of variables --> + + + + + + + + <section xml:id="io"> + <title>I/O</title> + + <section xml:id="avoid_echo"> + <title>Avoid using the "<literal>echo</literal>" command for output</title> + <para>The behaviour of "<literal>echo</literal>" is not portable + (e.g. System V, BSD, UCB and ksh93/bash shell builtin versions all + slightly differ in functionality) and should be avoided if possible. + POSIX defines the "<literal>printf</literal>" command as replacement + which provides more flexible and portable behaviour.</para> + + <note> + <title>&tag_kshonly;Use "<literal>print</literal>" and not "<literal>echo</literal>" in Korn Shell scripts</title> + <para>Korn shell scripts should prefer the "<literal>print</literal>" + builtin which was introduced as replacement for "<literal>echo</literal>".</para> + <caution> + <para>Use <literal>$ print -- ${varname}" #</literal> when there is the slightest chance that the + variable "<literal>varname</literal>" may contain symbols like "-". Or better use "<literal>printf</literal>" + instead, for example +<programlisting> +integer fx +# do something +print $fx +</programlisting> +may fail if "f" contains a negative value. A better way may be to use +<programlisting> +integer fx +# do something +printf "%d\n" fx +</programlisting> + </para> + </caution> + </note> + </section> + + <section xml:id="use_redirect_not_exec_to_open_files"> + <title>&tag_ksh93only;Use <literal>redirect</literal> and not <literal>exec</literal> to open files</title> + <para>Use <literal>redirect</literal> and not <literal>exec</literal> to open files - <literal>exec</literal> + will terminate the current function or script if an error occurs while <literal>redirect</literal> + just returns a non-zero exit code which can be caught.</para> +<para>Example: +<programlisting> +if redirect 5</etc/profile ; then + print "file open ok" + head <&5 +else + print "could not open file" +fi +</programlisting> + </para> + </section> + + <section xml:id="group_identical_redirections_together"> + <title>&tag_performance;Avoid redirections per command when the output goes into the same file, + e.g. <literal>$ echo "foo" >xxx ; echo "bar" >>xxx ; echo "baz" >>xxx #</literal></title> + <para>Each of the redirections above trigger an + <literal>|open()|,|write()|,|close()|</literal>-sequence. It is much + more efficient (and faster) to group the rediction into a block, + e.g. <literal>{ echo "foo" ; echo "bar" ; echo "baz" } >xxx #</literal></para> + </section> + + + <section xml:id="avoid_using_temporary_files"> + <title>&tag_performance;Avoid the creation of temporary files and store the values in variables instead</title> + <para>Avoid the creation of temporary files and store the values in variables instead if possible</para> + <para> + Example: +<programlisting> +ls -1 >xxx +for i in $(cat xxx) ; do + do_something ; +done +</programlisting> +can be replaced with +<programlisting> +x="$(ls -1)" +for i in ${x} ; do + do_something ; +done +</programlisting> + </para> + <note><para>ksh93 supports binary variables (e.g. <literal>typeset -b varname</literal>) which can hold any value.</para></note> + </section> + + + <section xml:id="create_subdirs_for_multiple_temporary_files"> + <title>If you create more than one temporary file create an unique subdir</title> + <para>If you create more than one temporary file create an unique subdir for + these files and make sure the dir is writable. Make sure you cleanup + after yourself (unless you are debugging). + </para> + </section> + + + <section xml:id="use_dynamic_file_descriptors"> + <title>&tag_ksh93only;Use {n}<file instead of fixed file descriptor numbers</title> + <para>When opening a file use {n}<file, where <envar>n</envar> is an + integer variable rather than specifying a fixed descriptor number.</para> + <para>This is highly recommended in functions to avoid that fixed file + descriptor numbers interfere with the calling script.</para> +<example><title>Open a network connection and store the file descriptor number in a variable</title> +<programlisting> +function cat_http +{ + integer netfd + +... + + # open TCP channel + redirect {netfd}<>"/dev/tcp/${host}/${port}" + + # send HTTP request + request="GET /${path} HTTP/1.1\n" + request+="Host: ${host}\n" + request+="User-Agent: demo code/ksh93 (2007-08-30; $(uname -s -r -p))\n" + request+="Connection: close\n" + print "${request}\n" >&${netfd} + + # collect response and send it to stdout + cat <&${netfd} + + # close connection + exec {netfd}<&- + +... + +} +</programlisting> +</example> + </section> + + + <section xml:id="use_inline_here_documents"> + <title>&tag_ksh93only;&tag_performance;Use inline here documents + instead of <literal>echo "$x" | command</literal></title> + <para>Use inline here documents, for example +<programlisting> +command <<< $x +</programlisting> + rather than +<programlisting> +print -r -- "$x" | command +</programlisting> + </para> + </section> + + + <section xml:id="use_read_r"> + <title>&tag_ksh93only;Use the <literal>-r</literal> option of <literal>read</literal> to read a line</title> + <para>Use the <literal>-r</literal> option of <literal>read</literal> to read a line. + You never know when a line will end in <literal>\</literal> and without a + <literal>-r</literal> multiple + lines can be read.</para> + </section> + + + <section xml:id="print_compound_variables_using_print_C"> + <title>&tag_ksh93only;Print compound variables using <literal>print -C varname</literal> or <literal>print -v varname</literal></title> + <para>Print compound variables using <literal>print -C varname</literal> or + <literal>print -v varname</literal> to make sure that non-printable characters + are correctly encoded.</para> +<example><title>Print compound variable with non-printable characters</title> +<programlisting> +compound x=( + a=5 + b="hello" + c=( + d=9 + e="$(printf "1\v3")" <co xml:id="co.vertical_tab1" /> + ) +) +print -v x +</programlisting> +<para>will print:</para> +<screen> +<computeroutput>( + a=5 + b=hello + c=( + d=9 + e=$'1\0133' <co xml:id="co.vertical_tab2" /> + ) +)</computeroutput> +</screen> +<calloutlist> + <callout arearefs="co.vertical_tab1 co.vertical_tab2"> + <para>vertical tab, <literal>\v</literal>, octal=<literal>\013</literal>.</para> + </callout> +</calloutlist> +</example> + </section> + + <section xml:id="command_name_before_redirections"> + <title>Put the command name and arguments before redirections</title> + <para>Put the command name and arguments before redirections. + You can legally do <literal>$ > file date</literal> instead of <literal>date > file</literal> + but don't do it.</para> + </section> + + <section xml:id="enable_gmacs_editor_mode_for_user_prompts"> + <title>&tag_ksh93only;Enable the <literal>gmacs</literal> editor + mode when reading user input using the <literal>read</literal> builtin</title> + <para>Enable the <literal>gmacs</literal>editor mode before reading user + input using the <literal>read</literal> builtin to enable the use of + cursor+backspace+delete keys in the edit line</para> +<example><title>Prompt user for a string with gmacs editor mode enabled</title> +<programlisting> +set -o gmacs <co xml:id="co.enable_gmacs" /> +typeset inputstring="default value" +... +read -v<co xml:id="co.read_v" /> inputstring<co xml:id="co.readvar" />?"Please enter a string: "<co xml:id="co.prompt" /> +... +printf "The user entered the following string: '%s'\n" "${inputstring}" + +... +</programlisting> +<calloutlist> + <callout arearefs="co.enable_gmacs"> + <para>Enable gmacs editor mode.</para> + </callout> + <callout arearefs="co.read_v"> + <para>The value of the variable is displayed and used as a default value.</para> + </callout> + <callout arearefs="co.readvar"> + <para>Variable used to store the result.</para> + </callout> + <callout arearefs="co.prompt"> + <para>Prompt string which is displayed in stderr.</para> + </callout> +</calloutlist> +</example> + </section> + </section><!-- end of I/O --> + + + + + + + <section xml:id="math"> + <title>Math</title> + + <section xml:id="use_builtin_arithmetic_expressions"> + <title>&tag_kshonly;&tag_performance;Use builtin arithmetic expressions instead of external applications</title> + <para>Use builtin (POSIX shell) arithmetic expressions instead of + <filename>expr</filename>, + <filename>bc</filename>, + <filename>dc</filename>, + <filename>awk</filename>, + <filename>nawk</filename> or + <filename>perl</filename>. + </para> + <note> + <para>ksh93 supports C99-like floating-point arithmetic including special values + such as + <simplelist type="inline"> + <member>+Inf</member> + <member>-Inf</member> + <member>+NaN</member> + <member>-NaN</member> + </simplelist>. + </para> + </note> + </section> + + + <section xml:id="use_floating_point_arithmetic_expressions"> + <title>&tag_ksh93only; Use floating-point arithmetic expressions if + calculations may trigger a division by zero or other exceptions</title> + <para>Use floating-point arithmetic expressions if calculations may + trigger a division by zero or other exceptions - floating point arithmetic expressions in + ksh93 support special values such as <literal>+Inf</literal>/<literal>-Inf</literal> and + <literal>+NaN</literal>/<literal>-NaN</literal> which can greatly simplify testing for + error conditions, e.g. instead of a <literal>trap</literal> or explicit + <literal>if ... then... else</literal> checks for every sub-expression + you can check the results for such special values. + </para> + <para>Example: +<screen> +$ <userinput>ksh93 -c 'integer i=0 j=5 ; print -- "x=$((j/i)) "'</userinput> +<computeroutput>ksh93: line 1: j/i: divide by zero</computeroutput> +$ <userinput>ksh93 -c 'float i=0 j=-5 ; print -- "x=$((j/i)) "'</userinput> +<computeroutput>x=-Inf</computeroutput> +</screen> + </para> + </section> + + + <section xml:id="use_printf_a_for_passing_float_values"> + <title>&tag_ksh93only; Use <literal>printf "%a"</literal> when passing floating-point values</title> + <para>Use <literal>printf "%a"</literal> when passing floating-point values between scripts or + as output of a function to avoid rounding errors when converting between + bases.</para> + <para> + Example: +<programlisting> +function xxx +{ + float val + + (( val=sin(5.) )) + printf "%a\n" val +} +float out +(( out=$(xxx) )) +xxx +print -- $out +</programlisting> +This will print: +<programlisting> +-0.9589242747 +-0x1.eaf81f5e09933226af13e5563bc6p-01 +</programlisting> + </para> + </section> + + + <section xml:id="put_constants_into_readonly_variables"> + <title>&tag_kshonly;&tag_performance;Put constant values into readonly variables</title> + <para>Put constant values into readonly variables</para> + <para>For example: +<programlisting> +float -r M_PI=3.14159265358979323846 +</programlisting> +or +<programlisting> +float M_PI=3.14159265358979323846 +readonly M_PI +</programlisting> + </para> + </section> + + + <section xml:id="avoid_unnecessary_string_number_conversions"> + <title>&tag_kshonly;&tag_performance;Avoid string to number + (and/or number to string) conversions in arithmetic expressions + expressions</title> + <para>Avoid string to number and/or number to string conversions in + arithmetic expressions expressions to avoid performance degradation + and rounding errors.</para> + <example><title>(( x=$x*2 )) vs. (( x=x*2 ))</title> +<programlisting> +float x +... +(( x=$x*2 )) +</programlisting> +<para> +will convert the variable "x" (stored in the machine's native +<literal>|long double|</literal> datatype) to a string value in base10 format, +apply pattern expansion (globbing), then insert this string into the +arithmetic expressions and parse the value which converts it into the internal |long double| datatype format again. +This is both slow and generates rounding errors when converting the floating-point value between +the internal base2 and the base10 representation of the string. +</para> +<para> +The correct usage would be: +</para> +<programlisting> +float x +... +(( x=x*2 )) +</programlisting> +<para> +e.g. omit the '$' because it's (at least) redundant within arithmetic expressions. +</para> + </example> + + + <example><title>x=$(( y+5.5 )) vs. (( x=y+5.5 ))</title> +<programlisting> +float x +float y=7.1 +... +x=$(( y+5.5 )) +</programlisting> +<para> +will calculate the value of <literal>y+5.5</literal>, convert it to a +base-10 string value amd assign the value to the floating-point variable +<literal>x</literal> again which will convert the string value back to the +internal |long double| datatype format again. +</para> +<para> +The correct usage would be: +</para> +<programlisting> +float x +float y=7.1 +... +(( x=y+5.5 )) +</programlisting> +<para> +i.e. this will save the string conversions and avoid any base2-->base10-->base2-conversions. +</para> + </example> + </section> + + + <section xml:id="set_lc_numeric_when_using_floating_point"> + <title>&tag_ksh93only;Set <envar>LC_NUMERIC</envar> when using floating-point constants</title> + <para>Set <envar>LC_NUMERIC</envar> when using floating-point constants to avoid problems with radix-point + representations which differ from the representation used in the script, for example the <literal>de_DE.*</literal> locale + use ',' instead of '.' as default radix point symbol.</para> + <para>For example: +<programlisting> +# 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 +... +float -r M_PI=3.14159265358979323846 +</programlisting> + </para> + + <note><para>The environment variable <envar>LC_ALL</envar> always overrides all other <envar>LC_*</envar> variables, + including <envar>LC_NUMERIC</envar>. The script should always protect itself against custom <envar>LC_NUMERIC</envar> and + <envar>LC_ALL</envar> values as shown in the example above. + </para></note> + </section> + + + + </section><!-- end of math --> + + + + + + + <section xml:id="misc"> + <title>Misc</title> + + <section xml:id="debug_use_lineno_in_ps4"> + <title>Put <literal>[${LINENO}]</literal> in your <envar>PS4</envar></title> + <para>Put <literal>[${LINENO}]</literal> in your <envar>PS4</envar> prompt so that you will get line + numbers with you run with <literal>-x</literal>. If you are looking at performance + issues put <literal>$SECONDS</literal> in the <envar>PS4</envar> prompt as well.</para> + </section> + + </section><!-- end of misc --> + + + + +</section><!-- end of RULES --> + + + + +</article> diff --git a/usr/src/lib/libshell/sparc/include/ast/history.h b/usr/src/lib/libshell/sparc/include/ast/history.h index bfac5d3b35..0159773f4d 100644 --- a/usr/src/lib/libshell/sparc/include/ast/history.h +++ b/usr/src/lib/libshell/sparc/include/ast/history.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/sparc/include/ast/nval.h b/usr/src/lib/libshell/sparc/include/ast/nval.h index c11fd66143..a81d34b84a 100644 --- a/usr/src/lib/libshell/sparc/include/ast/nval.h +++ b/usr/src/lib/libshell/sparc/include/ast/nval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -276,6 +276,7 @@ extern __MANGLE__ Namfun_t *nv_isvtree __PROTO__((Namval_t*)); extern __MANGLE__ Namval_t *nv_lastdict __PROTO__((void)); extern __MANGLE__ Namval_t *nv_mkinttype __PROTO__((char*, size_t, int, const char*, Namdisc_t*)); extern __MANGLE__ void nv_newattr __PROTO__((Namval_t*,unsigned,int)); +extern __MANGLE__ void nv_newtype __PROTO__((Namval_t*)); extern __MANGLE__ Namval_t *nv_open __PROTO__((const char*,Dt_t*,int)); extern __MANGLE__ void nv_putval __PROTO__((Namval_t*,const char*,int)); extern __MANGLE__ void nv_putv __PROTO__((Namval_t*,const char*,int,Namfun_t*)); diff --git a/usr/src/lib/libshell/sparc/include/ast/shell.h b/usr/src/lib/libshell/sparc/include/ast/shell.h index adcefac221..b5d87afc94 100644 --- a/usr/src/lib/libshell/sparc/include/ast/shell.h +++ b/usr/src/lib/libshell/sparc/include/ast/shell.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -146,8 +146,8 @@ struct Shell_s int inlineno; /* line number of current input file */ int exitval; /* most recent exit value */ unsigned char trapnote; /* set when trap/signal is pending */ - char subshell; /* set for virtual subshell */ char shcomp; /* set when runing shcomp */ + short subshell; /* set for virtual subshell */ #ifdef _SH_PRIVATE _SH_PRIVATE #endif /* _SH_PRIVATE */ diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/acct b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/acct index db7a5ef4e3..65af6a1891 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/acct +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/acct @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_acct_ksh93 #define _def_acct_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_acct 1 /* acct() in default lib(s) */ diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/cmds b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/cmds index 58913335d0..ffa3d489d6 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/cmds +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/cmds @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/cmds by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/cmds by iffe version 2009-10-06 : : */ #ifndef _def_cmds_ksh93 #define _def_cmds_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _cmd_newgrp 1 /* newgrp in ?(/usr)/(bin|etc|ucb) */ diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/dynamic b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/dynamic index ffded1c777..9526abebf8 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/dynamic +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/dynamic @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/dynamic by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/dynamic by iffe version 2009-10-06 : : */ #ifndef _def_dynamic_ksh93 #define _def_dynamic_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #if SHOPT_DYNAMIC diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/execargs b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/execargs index c77d192bc7..65fceba92f 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/execargs +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/execargs @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_execargs_ksh93 #define _def_execargs_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #endif diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/externs b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/externs index 0997552edf..e6624877ca 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/externs +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/externs @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/externs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/externs by iffe version 2009-10-06 : : */ #ifndef _def_externs_ksh93 #if !defined(__PROTO__) @@ -63,10 +63,10 @@ #define _def_externs_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_exec_attr 1 /* #include <exec_attr.h> ok */ diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/locale b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/locale index 6091864d6f..4923ce9038 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/locale +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/locale @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/locale by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/locale by iffe version 2009-10-06 : : */ #ifndef _def_locale_ksh93 #define _def_locale_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_locale 1 /* #include <locale.h> ok */ diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/math b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/math index 0816686537..535a82b7ed 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/math +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/math @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/math.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/math.sh by iffe version 2009-10-06 : : */ #ifndef _def_math_ksh93 #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -62,15 +62,15 @@ #define _def_math_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ -/* : : generated by iffe from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/data/math.tab : : */ +/* : : generated by iffe from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/data/math.tab : : */ typedef Sfdouble_t (*Math_f) __PROTO__((Sfdouble_t,...)); @@ -88,7 +88,13 @@ static int local_isless __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTO static int local_islessequal __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return islessequal(a1,a2);} static int local_islessgreater __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return islessgreater(a1,a2);} static int local_isnormal __PARAM__((Sfdouble_t a1), (a1)) __OTORP__(Sfdouble_t a1;){return isnormal(a1);} +#ifdef FP_SUBNORMAL +static int local_issubnormal __PARAM__((Sfdouble_t x), (x)) __OTORP__(Sfdouble_t x;){ return fpclassify(x) == FP_SUBNORMAL; } +#endif static int local_isunordered __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return isunordered(a1,a2);} +#ifdef FP_ZERO +static int local_iszero __PARAM__((Sfdouble_t x), (x)) __OTORP__(Sfdouble_t x;){ return fpclassify(x) == FP_ZERO; } +#endif static int local_signbit __PARAM__((Sfdouble_t a1), (a1)) __OTORP__(Sfdouble_t a1;){return signbit(a1);} /* @@ -136,9 +142,19 @@ const struct mathtab shtab_math[] = "\012islessgreater", (Math_f)local_islessgreater, "\011isnan", (Math_f)isnanl, "\011isnormal", (Math_f)local_isnormal, +#ifdef FP_SUBNORMAL + "\011issubnormal", (Math_f)local_issubnormal, +#endif "\012isunordered", (Math_f)local_isunordered, +#ifdef FP_ZERO + "\011iszero", (Math_f)local_iszero, +#endif + "\001j0", (Math_f)j0l, + "\001j1", (Math_f)j1l, + "\002jn", (Math_f)jnl, "\001lgamma", (Math_f)lgammal, "\001log", (Math_f)logl, + "\001log10", (Math_f)log10l, "\001log1p", (Math_f)log1pl, "\001log2", (Math_f)log2l, "\001logb", (Math_f)logbl, @@ -159,6 +175,9 @@ const struct mathtab shtab_math[] = "\001tanh", (Math_f)tanhl, "\001tgamma", (Math_f)tgammal, "\001trunc", (Math_f)truncl, + "\001y0", (Math_f)y0l, + "\001y1", (Math_f)y1l, + "\002yn", (Math_f)ynl, "", (Math_f)0 }; #endif diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/options b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/options index 19ee01050f..c2003e67fe 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/options +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/options @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/options by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/options by iffe version 2009-10-06 : : */ #ifndef _def_options_ksh93 #define _def_options_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define SHELLMAGIC 1 diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/poll b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/poll index ef49345725..6236914ca7 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/poll +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/poll @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/poll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/poll by iffe version 2009-10-06 : : */ #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 <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_poll 1 /* #include <poll.h> ok */ diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/pstat b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/pstat index b04c6ac21f..404f4fe7e8 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/pstat +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/pstat @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_pstat_ksh93 #define _def_pstat_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #endif diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/rlimits b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/rlimits index db357e7d9f..831b927c6a 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/rlimits +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/rlimits @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/rlimits by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/rlimits by iffe version 2009-10-06 : : */ #ifndef _def_rlimits_ksh93 #define _def_rlimits_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/setjmp b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/setjmp index 75e0552ad8..dfd9d97f4b 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/setjmp +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/setjmp @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/setjmp by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/setjmp by iffe version 2009-10-06 : : */ #ifndef _def_setjmp_ksh93 #define _def_setjmp_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_sigsetjmp 1 /* sigsetjmp() in default lib(s) */ diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/sigfeatures b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/sigfeatures index 367e2b702d..92f6c62e10 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/sigfeatures +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/sigfeatures @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/sigfeatures by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/sigfeatures by iffe version 2009-10-06 : : */ #ifndef _def_sigfeatures_ksh93 #define _def_sigfeatures_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_sigrelse 1 /* sigrelse() in default lib(s) */ diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/time b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/time index d1b9f741f9..d4710ad9c9 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/time +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/time @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ksh93 #define _def_time_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_utime 1 /* #include <utime.h> ok */ diff --git a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/ttys b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/ttys index 008f07c346..8be01d4df6 100644 --- a/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/ttys +++ b/usr/src/lib/libshell/sparc/src/cmd/ksh93/FEATURE/ttys @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/cmd/ksh93/features/ttys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/cmd/ksh93/features/ttys by iffe version 2009-10-06 : : */ #ifndef _def_ttys_ksh93 #define _def_ttys_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/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_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_termios 1 /* #include <termios.h> ok */ diff --git a/usr/src/lib/libshell/sparcv9/include/ast/history.h b/usr/src/lib/libshell/sparcv9/include/ast/history.h index bfac5d3b35..0159773f4d 100644 --- a/usr/src/lib/libshell/sparcv9/include/ast/history.h +++ b/usr/src/lib/libshell/sparcv9/include/ast/history.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libshell/sparcv9/include/ast/nval.h b/usr/src/lib/libshell/sparcv9/include/ast/nval.h index c11fd66143..a81d34b84a 100644 --- a/usr/src/lib/libshell/sparcv9/include/ast/nval.h +++ b/usr/src/lib/libshell/sparcv9/include/ast/nval.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -276,6 +276,7 @@ extern __MANGLE__ Namfun_t *nv_isvtree __PROTO__((Namval_t*)); extern __MANGLE__ Namval_t *nv_lastdict __PROTO__((void)); extern __MANGLE__ Namval_t *nv_mkinttype __PROTO__((char*, size_t, int, const char*, Namdisc_t*)); extern __MANGLE__ void nv_newattr __PROTO__((Namval_t*,unsigned,int)); +extern __MANGLE__ void nv_newtype __PROTO__((Namval_t*)); extern __MANGLE__ Namval_t *nv_open __PROTO__((const char*,Dt_t*,int)); extern __MANGLE__ void nv_putval __PROTO__((Namval_t*,const char*,int)); extern __MANGLE__ void nv_putv __PROTO__((Namval_t*,const char*,int,Namfun_t*)); diff --git a/usr/src/lib/libshell/sparcv9/include/ast/shell.h b/usr/src/lib/libshell/sparcv9/include/ast/shell.h index adcefac221..b5d87afc94 100644 --- a/usr/src/lib/libshell/sparcv9/include/ast/shell.h +++ b/usr/src/lib/libshell/sparcv9/include/ast/shell.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2008 AT&T Intellectual Property * +* Copyright (c) 1982-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -146,8 +146,8 @@ struct Shell_s int inlineno; /* line number of current input file */ int exitval; /* most recent exit value */ unsigned char trapnote; /* set when trap/signal is pending */ - char subshell; /* set for virtual subshell */ char shcomp; /* set when runing shcomp */ + short subshell; /* set for virtual subshell */ #ifdef _SH_PRIVATE _SH_PRIVATE #endif /* _SH_PRIVATE */ diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/acct b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/acct index 26be28c619..ce3ad037f2 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/acct +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/acct @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_acct_ksh93 #define _def_acct_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_acct 1 /* acct() in default lib(s) */ diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/cmds b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/cmds index ec93f3beb3..2647861d28 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/cmds +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/cmds @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/cmds by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/cmds by iffe version 2009-10-06 : : */ #ifndef _def_cmds_ksh93 #define _def_cmds_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _cmd_newgrp 1 /* newgrp in ?(/usr)/(bin|etc|ucb) */ diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/dynamic b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/dynamic index 78de14485c..91d80eb432 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/dynamic +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/dynamic @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/dynamic by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/dynamic by iffe version 2009-10-06 : : */ #ifndef _def_dynamic_ksh93 #define _def_dynamic_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #if SHOPT_DYNAMIC diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/execargs b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/execargs index fd6d18258b..a39c9dd160 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/execargs +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/execargs @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_execargs_ksh93 #define _def_execargs_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #endif diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/externs b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/externs index 355b5bc61e..488cbd07d5 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/externs +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/externs @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/externs by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/externs by iffe version 2009-10-06 : : */ #ifndef _def_externs_ksh93 #if !defined(__PROTO__) @@ -63,10 +63,10 @@ #define _def_externs_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_exec_attr 1 /* #include <exec_attr.h> ok */ diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/locale b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/locale index 038eb19ad1..e1f9d582b7 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/locale +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/locale @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/locale by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/locale by iffe version 2009-10-06 : : */ #ifndef _def_locale_ksh93 #define _def_locale_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_locale 1 /* #include <locale.h> ok */ diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/math b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/math index d2e608d39b..63e5c2c6cd 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/math +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/math @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/math.sh by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/math.sh by iffe version 2009-10-06 : : */ #ifndef _def_math_ksh93 #if !defined(__PROTO__) # if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus) @@ -62,15 +62,15 @@ #define _def_math_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ -/* : : generated by iffe from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/data/math.tab : : */ +/* : : generated by iffe from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/data/math.tab : : */ typedef Sfdouble_t (*Math_f) __PROTO__((Sfdouble_t,...)); @@ -88,7 +88,13 @@ static int local_isless __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTO static int local_islessequal __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return islessequal(a1,a2);} static int local_islessgreater __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return islessgreater(a1,a2);} static int local_isnormal __PARAM__((Sfdouble_t a1), (a1)) __OTORP__(Sfdouble_t a1;){return isnormal(a1);} +#ifdef FP_SUBNORMAL +static int local_issubnormal __PARAM__((Sfdouble_t x), (x)) __OTORP__(Sfdouble_t x;){ return fpclassify(x) == FP_SUBNORMAL; } +#endif static int local_isunordered __PARAM__((Sfdouble_t a1,Sfdouble_t a2), (a1, a2)) __OTORP__(Sfdouble_t a1;Sfdouble_t a2;){return isunordered(a1,a2);} +#ifdef FP_ZERO +static int local_iszero __PARAM__((Sfdouble_t x), (x)) __OTORP__(Sfdouble_t x;){ return fpclassify(x) == FP_ZERO; } +#endif static int local_signbit __PARAM__((Sfdouble_t a1), (a1)) __OTORP__(Sfdouble_t a1;){return signbit(a1);} /* @@ -136,9 +142,19 @@ const struct mathtab shtab_math[] = "\012islessgreater", (Math_f)local_islessgreater, "\011isnan", (Math_f)isnanl, "\011isnormal", (Math_f)local_isnormal, +#ifdef FP_SUBNORMAL + "\011issubnormal", (Math_f)local_issubnormal, +#endif "\012isunordered", (Math_f)local_isunordered, +#ifdef FP_ZERO + "\011iszero", (Math_f)local_iszero, +#endif + "\001j0", (Math_f)j0l, + "\001j1", (Math_f)j1l, + "\002jn", (Math_f)jnl, "\001lgamma", (Math_f)lgammal, "\001log", (Math_f)logl, + "\001log10", (Math_f)log10l, "\001log1p", (Math_f)log1pl, "\001log2", (Math_f)log2l, "\001logb", (Math_f)logbl, @@ -159,6 +175,9 @@ const struct mathtab shtab_math[] = "\001tanh", (Math_f)tanhl, "\001tgamma", (Math_f)tgammal, "\001trunc", (Math_f)truncl, + "\001y0", (Math_f)y0l, + "\001y1", (Math_f)y1l, + "\002yn", (Math_f)ynl, "", (Math_f)0 }; #endif diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/options b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/options index 678224e395..42ecfb7698 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/options +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/options @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/options by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/options by iffe version 2009-10-06 : : */ #ifndef _def_options_ksh93 #define _def_options_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define SHELLMAGIC 1 diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/poll b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/poll index 237841c166..da2b1e278c 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/poll +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/poll @@ -1,6 +1,6 @@ /* : : generated by proto : : */ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/poll by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/poll by iffe version 2009-10-06 : : */ #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 <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_poll 1 /* #include <poll.h> ok */ diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/pstat b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/pstat index 6085602c35..fef0d8f8e0 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/pstat +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/pstat @@ -1,11 +1,11 @@ -/* : : generated by iffe version 2008-01-31 : : */ +/* : : generated by iffe version 2009-10-06 : : */ #ifndef _def_pstat_ksh93 #define _def_pstat_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #endif diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/rlimits b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/rlimits index 605656a721..1eeed91657 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/rlimits +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/rlimits @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/rlimits by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/rlimits by iffe version 2009-10-06 : : */ #ifndef _def_rlimits_ksh93 #define _def_rlimits_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _sys_resource 1 /* #include <sys/resource.h> ok */ diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/setjmp b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/setjmp index 23a2ab49e8..155c6dd853 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/setjmp +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/setjmp @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/setjmp by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/setjmp by iffe version 2009-10-06 : : */ #ifndef _def_setjmp_ksh93 #define _def_setjmp_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_sigsetjmp 1 /* sigsetjmp() in default lib(s) */ diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/sigfeatures b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/sigfeatures index d6ea238d56..414feeccf7 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/sigfeatures +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/sigfeatures @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/sigfeatures by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/sigfeatures by iffe version 2009-10-06 : : */ #ifndef _def_sigfeatures_ksh93 #define _def_sigfeatures_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _lib_sigrelse 1 /* sigrelse() in default lib(s) */ diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/time b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/time index ac12845b45..e70e599608 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/time +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/time @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/time by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/time by iffe version 2009-10-06 : : */ #ifndef _def_time_ksh93 #define _def_time_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_utime 1 /* #include <utime.h> ok */ diff --git a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/ttys b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/ttys index ed431f57a7..22b580c8ac 100644 --- a/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/ttys +++ b/usr/src/lib/libshell/sparcv9/src/cmd/ksh93/FEATURE/ttys @@ -1,11 +1,11 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/cmd/ksh93/features/ttys by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/cmd/ksh93/features/ttys by iffe version 2009-10-06 : : */ #ifndef _def_ttys_ksh93 #define _def_ttys_ksh93 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_dll 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libdll.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/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_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ +#define _LIB_cmd 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libcmd.a is a library */ #define _LIB_md 1 /* -lmd is a library */ #define _LIB_nsl 1 /* -lnsl is a library */ #define _hdr_termios 1 /* #include <termios.h> ok */ diff --git a/usr/src/lib/libsum/Makefile b/usr/src/lib/libsum/Makefile index 33dbb5c65e..9a77d9b20d 100644 --- a/usr/src/lib/libsum/Makefile +++ b/usr/src/lib/libsum/Makefile @@ -56,8 +56,10 @@ install_h: $(ROOTHDRS) # We don't check these header files because they're owned by AT&T/AST check: -$(SUBDIRS): FRC - @cd $@; pwd; $(MAKE) $(TARGET) +$(SPARC_BLD)$(SUBDIRS): FRC +$(SPARC_BLD) @cd $@; pwd; $(MAKE) $(TARGET) +$(INTEL_BLD)$(SUBDIRS): FRC +$(INTEL_BLD) @cd $@; pwd; $(MAKE) $(TARGET) FRC: diff --git a/usr/src/lib/libsum/Makefile.com b/usr/src/lib/libsum/Makefile.com index 75df821f30..244bf290f5 100644 --- a/usr/src/lib/libsum/Makefile.com +++ b/usr/src/lib/libsum/Makefile.com @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -65,6 +65,7 @@ CPPFLAGS = \ $(DTEXTDOM) $(DTS_ERRNO) \ -Isrc/lib/libsum \ -I$(ROOT)/usr/include/ast \ + -I$(ROOT)/usr/include \ -D_PACKAGE_ast \ -D_BLD_DLL @@ -73,6 +74,12 @@ CFLAGS += \ CFLAGS64 += \ $(ASTCFLAGS64) +# This codepath is performance-critical +sparc_COPTFLAG=-xO5 -_cc=-xprefetch=auto,explicit +sparcv9_COPTFLAG=-xO5 -_cc=-xprefetch=auto,explicit +i386_COPTFLAG=-_cc=-xO5 -_cc=-xprefetch=auto,explicit +amd64_COPTFLAG=-_cc=-xO5 -_cc=-xprefetch=auto,explicit + # Suppress this one warning as the fix would break old gcc, which upstream # still supports. This needs a better fix (later). pics/sumlib.o := CERRWARN += -erroff=E_CONST_PROMOTED_UNSIGNED_LONG diff --git a/usr/src/lib/libsum/amd64/include/ast/sum.h b/usr/src/lib/libsum/amd64/include/ast/sum.h index fa8157ab1e..f01e359848 100644 --- a/usr/src/lib/libsum/amd64/include/ast/sum.h +++ b/usr/src/lib/libsum/amd64/include/ast/sum.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/amd64/src/lib/libsum/FEATURE/sum b/usr/src/lib/libsum/amd64/src/lib/libsum/FEATURE/sum index ce251b69f7..9943b0a216 100644 --- a/usr/src/lib/libsum/amd64/src/lib/libsum/FEATURE/sum +++ b/usr/src/lib/libsum/amd64/src/lib/libsum/FEATURE/sum @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libsum/features/sum by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/src/lib/libsum/features/sum by iffe version 2009-10-06 : : */ #ifndef _def_sum_sum #define _def_sum_sum 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_64bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_md4 1 /* #include <md4.h> ok */ #define _LIB_md 1 /* -lmd is a library */ diff --git a/usr/src/lib/libsum/common/RELEASE b/usr/src/lib/libsum/common/RELEASE index 37de9bd7e8..d662f77c03 100644 --- a/usr/src/lib/libsum/common/RELEASE +++ b/usr/src/lib/libsum/common/RELEASE @@ -1,3 +1,4 @@ +09-09-28 sumlib.c: use simple (faster) method name match function 08-06-05 sum-lmd.c: align context to largest int 08-05-01 sumlib.c: add some -lmd verification checks 08-02-11 sum-lmd.c,features/sum: add wrapper for solaris -lmd diff --git a/usr/src/lib/libsum/common/sum-ast4.c b/usr/src/lib/libsum/common/sum-ast4.c index 59697893f8..da33b92dbe 100644 --- a/usr/src/lib/libsum/common/sum-ast4.c +++ b/usr/src/lib/libsum/common/sum-ast4.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/common/sum-att.c b/usr/src/lib/libsum/common/sum-att.c index ef09d0c2e9..27b66c7aa3 100644 --- a/usr/src/lib/libsum/common/sum-att.c +++ b/usr/src/lib/libsum/common/sum-att.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -35,6 +35,69 @@ #define att_data long_data #define att_scale 512 +#if defined(__SUNPRO_C) || defined(__GNUC__) + +#if defined(__SUNPRO_C) +# include <sun_prefetch.h> +# define sum_prefetch(addr) sun_prefetch_read_many((void *)(addr)) +#elif defined(__GNUC__) +# define sum_prefetch(addr) __builtin_prefetch((addr), 0, 3) +#else +# error Unknown compiler +#endif + +#define CBLOCK_SIZE (64) +#pragma unroll(16) + +/* Inmos transputer would love this algorithm */ +static int +att_block(register Sum_t* p, const void* s, size_t n) +{ + register uint32_t c = ((Integral_t*)p)->sum; + register const unsigned char* b = (const unsigned char*)s; + register const unsigned char* e = b + n; + register uint32_t s0, s1, s2, s3, s4, s5, s6, s7; + register unsigned int i; + + s0=s1=s2=s3=s4=s5=s6=s7=0U; + + sum_prefetch((void *)b); + + while (n > CBLOCK_SIZE) + { + sum_prefetch((b+CBLOCK_SIZE)); + + /* Compiler will unroll for() loops per #pragma unroll */ + for (i=0 ; i < (CBLOCK_SIZE/8) ; i++) + { + /* + * use s0-s7 to decouple calculations (this improves pipelining) + * because each operation is completely independent from it's + * siblings + */ + s0+=b[0]; + s1+=b[1]; + s2+=b[2]; + s3+=b[3]; + s4+=b[4]; + s5+=b[5]; + s6+=b[6]; + s7+=b[7]; + + b+=8; + n-=8; + } + } + + c+=s0+s1+s2+s3+s4+s5+s6+s7; + + while (b < e) + c += *b++; + ((Integral_t*)p)->sum = c; + return 0; +} + +#else static int att_block(register Sum_t* p, const void* s, size_t n) { @@ -47,6 +110,7 @@ att_block(register Sum_t* p, const void* s, size_t n) ((Integral_t*)p)->sum = c; return 0; } +#endif /* defined(__SUNPRO_C) || defined(__GNUC__) */ static int att_done(Sum_t* p) diff --git a/usr/src/lib/libsum/common/sum-bsd.c b/usr/src/lib/libsum/common/sum-bsd.c index dcf1e6f135..30c2580c9d 100644 --- a/usr/src/lib/libsum/common/sum-bsd.c +++ b/usr/src/lib/libsum/common/sum-bsd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/common/sum-crc.c b/usr/src/lib/libsum/common/sum-crc.c index eca34df603..7c3e170362 100644 --- a/usr/src/lib/libsum/common/sum-crc.c +++ b/usr/src/lib/libsum/common/sum-crc.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -48,7 +48,8 @@ typedef struct Crc_s Crcnum_t init; Crcnum_t done; Crcnum_t xorsize; - Crcnum_t tab[256]; + const Crcnum_t *tab; /* use |const| to give the compiler a hint that the data won't change */ + Crcnum_t tabdata[256]; unsigned int addsize; unsigned int rotate; } Crc_t; @@ -56,6 +57,62 @@ typedef struct Crc_s #define CRC(p,s,c) (s = (s >> 8) ^ (p)->tab[(s ^ (c)) & 0xff]) #define CRCROTATE(p,s,c) (s = (s << 8) ^ (p)->tab[((s >> 24) ^ (c)) & 0xff]) +static const +Crcnum_t posix_cksum_tab[256] = { + 0x00000000U, + 0x04c11db7U, 0x09823b6eU, 0x0d4326d9U, 0x130476dcU, 0x17c56b6bU, + 0x1a864db2U, 0x1e475005U, 0x2608edb8U, 0x22c9f00fU, 0x2f8ad6d6U, + 0x2b4bcb61U, 0x350c9b64U, 0x31cd86d3U, 0x3c8ea00aU, 0x384fbdbdU, + 0x4c11db70U, 0x48d0c6c7U, 0x4593e01eU, 0x4152fda9U, 0x5f15adacU, + 0x5bd4b01bU, 0x569796c2U, 0x52568b75U, 0x6a1936c8U, 0x6ed82b7fU, + 0x639b0da6U, 0x675a1011U, 0x791d4014U, 0x7ddc5da3U, 0x709f7b7aU, + 0x745e66cdU, 0x9823b6e0U, 0x9ce2ab57U, 0x91a18d8eU, 0x95609039U, + 0x8b27c03cU, 0x8fe6dd8bU, 0x82a5fb52U, 0x8664e6e5U, 0xbe2b5b58U, + 0xbaea46efU, 0xb7a96036U, 0xb3687d81U, 0xad2f2d84U, 0xa9ee3033U, + 0xa4ad16eaU, 0xa06c0b5dU, 0xd4326d90U, 0xd0f37027U, 0xddb056feU, + 0xd9714b49U, 0xc7361b4cU, 0xc3f706fbU, 0xceb42022U, 0xca753d95U, + 0xf23a8028U, 0xf6fb9d9fU, 0xfbb8bb46U, 0xff79a6f1U, 0xe13ef6f4U, + 0xe5ffeb43U, 0xe8bccd9aU, 0xec7dd02dU, 0x34867077U, 0x30476dc0U, + 0x3d044b19U, 0x39c556aeU, 0x278206abU, 0x23431b1cU, 0x2e003dc5U, + 0x2ac12072U, 0x128e9dcfU, 0x164f8078U, 0x1b0ca6a1U, 0x1fcdbb16U, + 0x018aeb13U, 0x054bf6a4U, 0x0808d07dU, 0x0cc9cdcaU, 0x7897ab07U, + 0x7c56b6b0U, 0x71159069U, 0x75d48ddeU, 0x6b93dddbU, 0x6f52c06cU, + 0x6211e6b5U, 0x66d0fb02U, 0x5e9f46bfU, 0x5a5e5b08U, 0x571d7dd1U, + 0x53dc6066U, 0x4d9b3063U, 0x495a2dd4U, 0x44190b0dU, 0x40d816baU, + 0xaca5c697U, 0xa864db20U, 0xa527fdf9U, 0xa1e6e04eU, 0xbfa1b04bU, + 0xbb60adfcU, 0xb6238b25U, 0xb2e29692U, 0x8aad2b2fU, 0x8e6c3698U, + 0x832f1041U, 0x87ee0df6U, 0x99a95df3U, 0x9d684044U, 0x902b669dU, + 0x94ea7b2aU, 0xe0b41de7U, 0xe4750050U, 0xe9362689U, 0xedf73b3eU, + 0xf3b06b3bU, 0xf771768cU, 0xfa325055U, 0xfef34de2U, 0xc6bcf05fU, + 0xc27dede8U, 0xcf3ecb31U, 0xcbffd686U, 0xd5b88683U, 0xd1799b34U, + 0xdc3abdedU, 0xd8fba05aU, 0x690ce0eeU, 0x6dcdfd59U, 0x608edb80U, + 0x644fc637U, 0x7a089632U, 0x7ec98b85U, 0x738aad5cU, 0x774bb0ebU, + 0x4f040d56U, 0x4bc510e1U, 0x46863638U, 0x42472b8fU, 0x5c007b8aU, + 0x58c1663dU, 0x558240e4U, 0x51435d53U, 0x251d3b9eU, 0x21dc2629U, + 0x2c9f00f0U, 0x285e1d47U, 0x36194d42U, 0x32d850f5U, 0x3f9b762cU, + 0x3b5a6b9bU, 0x0315d626U, 0x07d4cb91U, 0x0a97ed48U, 0x0e56f0ffU, + 0x1011a0faU, 0x14d0bd4dU, 0x19939b94U, 0x1d528623U, 0xf12f560eU, + 0xf5ee4bb9U, 0xf8ad6d60U, 0xfc6c70d7U, 0xe22b20d2U, 0xe6ea3d65U, + 0xeba91bbcU, 0xef68060bU, 0xd727bbb6U, 0xd3e6a601U, 0xdea580d8U, + 0xda649d6fU, 0xc423cd6aU, 0xc0e2d0ddU, 0xcda1f604U, 0xc960ebb3U, + 0xbd3e8d7eU, 0xb9ff90c9U, 0xb4bcb610U, 0xb07daba7U, 0xae3afba2U, + 0xaafbe615U, 0xa7b8c0ccU, 0xa379dd7bU, 0x9b3660c6U, 0x9ff77d71U, + 0x92b45ba8U, 0x9675461fU, 0x8832161aU, 0x8cf30badU, 0x81b02d74U, + 0x857130c3U, 0x5d8a9099U, 0x594b8d2eU, 0x5408abf7U, 0x50c9b640U, + 0x4e8ee645U, 0x4a4ffbf2U, 0x470cdd2bU, 0x43cdc09cU, 0x7b827d21U, + 0x7f436096U, 0x7200464fU, 0x76c15bf8U, 0x68860bfdU, 0x6c47164aU, + 0x61043093U, 0x65c52d24U, 0x119b4be9U, 0x155a565eU, 0x18197087U, + 0x1cd86d30U, 0x029f3d35U, 0x065e2082U, 0x0b1d065bU, 0x0fdc1becU, + 0x3793a651U, 0x3352bbe6U, 0x3e119d3fU, 0x3ad08088U, 0x2497d08dU, + 0x2056cd3aU, 0x2d15ebe3U, 0x29d4f654U, 0xc5a92679U, 0xc1683bceU, + 0xcc2b1d17U, 0xc8ea00a0U, 0xd6ad50a5U, 0xd26c4d12U, 0xdf2f6bcbU, + 0xdbee767cU, 0xe3a1cbc1U, 0xe760d676U, 0xea23f0afU, 0xeee2ed18U, + 0xf0a5bd1dU, 0xf464a0aaU, 0xf9278673U, 0xfde69bc4U, 0x89b8fd09U, + 0x8d79e0beU, 0x803ac667U, 0x84fbdbd0U, 0x9abc8bd5U, 0x9e7d9662U, + 0x933eb0bbU, 0x97ffad0cU, 0xafb010b1U, 0xab710d06U, 0xa6322bdfU, + 0xa2f33668U, 0xbcb4666dU, 0xb8757bdaU, 0xb5365d03U, 0xb1f740b4U +}; + static Sum_t* crc_open(const Method_t* method, const char* name) { @@ -73,62 +130,80 @@ crc_open(const Method_t* method, const char* name) sum->method = (Method_t*)method; sum->name = name; } - polynomial = 0xedb88320; - s = name; - while (*(t = s)) + + if(!strcmp(name, "crc-0x04c11db7-rotate-done-size")) { - for (t = s, v = 0; *s && *s != '-'; s++) - if (*s == '=' && !v) - v = s; - i = (v ? v : s) - t; - if (isdigit(*t) || v && i >= 4 && strneq(t, "poly", 4) && (t = v + 1)) - polynomial = strtoul(t, NiL, 0); - else if (strneq(t, "done", i)) - sum->done = v ? strtoul(v + 1, NiL, 0) : ~sum->done; - else if (strneq(t, "init", i)) - sum->init = v ? strtoul(v + 1, NiL, 0) : ~sum->init; - else if (strneq(t, "rotate", i)) - sum->rotate = 1; - else if (strneq(t, "size", i)) - { - sum->addsize = 1; - if (v) - sum->xorsize = strtoul(v + 1, NiL, 0); - } - if (*s == '-') - s++; + sum->init=0; + sum->done=0xffffffff; + sum->xorsize=0x0; + sum->addsize=0x1; + sum->rotate=1; + + /* Optimized codepath for POSIX cksum to save startup time */ + sum->tab=posix_cksum_tab; } - if (sum->rotate) + else { - Crcnum_t t; - Crcnum_t p[8]; - - p[0] = polynomial; - for (i = 1; i < 8; i++) - p[i] = (p[i-1] << 1) ^ ((p[i-1] & 0x80000000) ? polynomial : 0); - for (i = 0; i < elementsof(sum->tab); i++) + polynomial = 0xedb88320; + s = name; + while (*(t = s)) { - t = 0; - x = i; - for (j = 0; j < 8; j++) + for (t = s, v = 0; *s && *s != '-'; s++) + if (*s == '=' && !v) + v = s; + i = (v ? v : s) - t; + if (isdigit(*t) || v && i >= 4 && strneq(t, "poly", 4) && (t = v + 1)) + polynomial = strtoul(t, NiL, 0); + else if (strneq(t, "done", i)) + sum->done = v ? strtoul(v + 1, NiL, 0) : ~sum->done; + else if (strneq(t, "init", i)) + sum->init = v ? strtoul(v + 1, NiL, 0) : ~sum->init; + else if (strneq(t, "rotate", i)) + sum->rotate = 1; + else if (strneq(t, "size", i)) { - if (x & 1) - t ^= p[j]; - x >>= 1; + sum->addsize = 1; + if (v) + sum->xorsize = strtoul(v + 1, NiL, 0); } - sum->tab[i] = t; + if (*s == '-') + s++; } - } - else - { - for (i = 0; i < elementsof(sum->tab); i++) + if (sum->rotate) + { + Crcnum_t t; + Crcnum_t p[8]; + + p[0] = polynomial; + for (i = 1; i < 8; i++) + p[i] = (p[i-1] << 1) ^ ((p[i-1] & 0x80000000) ? polynomial : 0); + for (i = 0; i < elementsof(sum->tabdata); i++) + { + t = 0; + x = i; + for (j = 0; j < 8; j++) + { + if (x & 1) + t ^= p[j]; + x >>= 1; + } + sum->tabdata[i] = t; + } + } + else { - x = i; - for (j = 0; j < 8; j++) - x = (x>>1) ^ ((x & 1) ? polynomial : 0); - sum->tab[i] = x; + for (i = 0; i < elementsof(sum->tabdata); i++) + { + x = i; + for (j = 0; j < 8; j++) + x = (x>>1) ^ ((x & 1) ? polynomial : 0); + sum->tabdata[i] = x; + } } + + sum->tab=sum->tabdata; } + return (Sum_t*)sum; } @@ -141,6 +216,72 @@ crc_init(Sum_t* p) return 0; } +#if defined(__SUNPRO_C) || defined(__GNUC__) + +#if defined(__SUNPRO_C) +# include <sun_prefetch.h> +# define sum_prefetch(addr) sun_prefetch_read_many((void *)(addr)) +#elif defined(__GNUC__) +# define sum_prefetch(addr) __builtin_prefetch((addr), 0, 3) +#else +# error Unknown compiler +#endif + +#define CBLOCK_SIZE (64) +#pragma unroll(16) + +static int +crc_block(Sum_t* p, const void* s, size_t n) +{ + Crc_t* sum = (Crc_t*)p; + register Crcnum_t c = sum->sum; + register const unsigned char* b = (const unsigned char*)s; + register const unsigned char* e = b + n; + unsigned short i; + + sum_prefetch(b); + + if (sum->rotate) + { + while (n > CBLOCK_SIZE) + { + sum_prefetch(b+CBLOCK_SIZE); + for(i=0 ; i < CBLOCK_SIZE ; i++) + { + CRCROTATE(sum, c, *b++); + } + + n-=CBLOCK_SIZE; + } + + while (b < e) + { + CRCROTATE(sum, c, *b++); + } + } + else + { + while (n > CBLOCK_SIZE) + { + sum_prefetch(b+CBLOCK_SIZE); + for(i=0 ; i < CBLOCK_SIZE ; i++) + { + CRC(sum, c, *b++); + } + + n-=CBLOCK_SIZE; + } + + while (b < e) + { + CRC(sum, c, *b++); + } + } + + sum->sum = c; + return 0; +} +#else static int crc_block(Sum_t* p, const void* s, size_t n) { @@ -158,6 +299,7 @@ crc_block(Sum_t* p, const void* s, size_t n) sum->sum = c; return 0; } +#endif /* defined(__SUNPRO_C) || defined(__GNUC__) */ static int crc_done(Sum_t* p) diff --git a/usr/src/lib/libsum/common/sum-lmd.c b/usr/src/lib/libsum/common/sum-lmd.c index 1e011685cd..220d8f6260 100644 --- a/usr/src/lib/libsum/common/sum-lmd.c +++ b/usr/src/lib/libsum/common/sum-lmd.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/common/sum-md5.c b/usr/src/lib/libsum/common/sum-md5.c index 895ad8294b..2852363ba9 100644 --- a/usr/src/lib/libsum/common/sum-md5.c +++ b/usr/src/lib/libsum/common/sum-md5.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/common/sum-prng.c b/usr/src/lib/libsum/common/sum-prng.c index caccda1ffc..17077278fb 100644 --- a/usr/src/lib/libsum/common/sum-prng.c +++ b/usr/src/lib/libsum/common/sum-prng.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/common/sum-sha1.c b/usr/src/lib/libsum/common/sum-sha1.c index 9c9a48bb07..5d53513f0a 100644 --- a/usr/src/lib/libsum/common/sum-sha1.c +++ b/usr/src/lib/libsum/common/sum-sha1.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/common/sum-sha2.c b/usr/src/lib/libsum/common/sum-sha2.c index bfcd31f6ee..f87131433a 100644 --- a/usr/src/lib/libsum/common/sum-sha2.c +++ b/usr/src/lib/libsum/common/sum-sha2.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/common/sum.h b/usr/src/lib/libsum/common/sum.h index 443a4f2d7f..7f66cfb46c 100644 --- a/usr/src/lib/libsum/common/sum.h +++ b/usr/src/lib/libsum/common/sum.h @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/common/sumlib.c b/usr/src/lib/libsum/common/sumlib.c index 3005e1fe5a..713ec33566 100644 --- a/usr/src/lib/libsum/common/sumlib.c +++ b/usr/src/lib/libsum/common/sumlib.c @@ -1,7 +1,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -25,7 +25,7 @@ * man this is sum library */ -static const char id[] = "\n@(#)$Id: sumlib (AT&T Research) 2008-05-01 $\0\n"; +static const char id[] = "\n@(#)$Id: sumlib (AT&T Research) 2009-09-28 $\0\n"; #define _SUM_PRIVATE_ \ struct Method_s* method; \ @@ -233,6 +233,40 @@ static const Map_t maps[] = }; /* + * simple alternation prefix match + */ + +static int +match(register const char* s, register const char* p) +{ + register const char* b = s; + + for (;;) + { + do + { + if (*p == '|' || *p == 0) + return 1; + } while (*s++ == *p++); + for (;;) + { + switch (*p++) + { + case 0: + return 0; + case '|': + break; + default: + continue; + } + break; + } + s = b; + } + return 0; +} + +/* * open sum method name */ @@ -245,20 +279,14 @@ sumopen(register const char* name) if (!name || !name[0] || name[0] == '-' && !name[1]) name = "default"; for (n = 0; n < elementsof(maps); n++) - { - sfsprintf(pat, sizeof(pat), "*@(%s)*", maps[n].match); - if (strmatch(name, pat)) + if (match(name, maps[n].match)) { name = maps[n].map; break; } - } for (n = 0; n < elementsof(methods); n++) - { - sfsprintf(pat, sizeof(pat), "*@(%s)*", methods[n].match); - if (strmatch(name, pat)) + if (match(name, methods[n].match)) return (*methods[n].open)(&methods[n], name); - } return 0; } diff --git a/usr/src/lib/libsum/i386/include/ast/sum.h b/usr/src/lib/libsum/i386/include/ast/sum.h index fa8157ab1e..f01e359848 100644 --- a/usr/src/lib/libsum/i386/include/ast/sum.h +++ b/usr/src/lib/libsum/i386/include/ast/sum.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/i386/src/lib/libsum/FEATURE/sum b/usr/src/lib/libsum/i386/src/lib/libsum/FEATURE/sum index 6bb0ab44bd..1891207505 100644 --- a/usr/src/lib/libsum/i386/src/lib/libsum/FEATURE/sum +++ b/usr/src/lib/libsum/i386/src/lib/libsum/FEATURE/sum @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libsum/features/sum by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/src/lib/libsum/features/sum by iffe version 2009-10-06 : : */ #ifndef _def_sum_sum #define _def_sum_sum 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_i386_32bit/arch/sol11.i386/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_md4 1 /* #include <md4.h> ok */ #define _LIB_md 1 /* -lmd is a library */ diff --git a/usr/src/lib/libsum/sparc/include/ast/sum.h b/usr/src/lib/libsum/sparc/include/ast/sum.h index fa8157ab1e..f01e359848 100644 --- a/usr/src/lib/libsum/sparc/include/ast/sum.h +++ b/usr/src/lib/libsum/sparc/include/ast/sum.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/sparc/src/lib/libsum/FEATURE/sum b/usr/src/lib/libsum/sparc/src/lib/libsum/FEATURE/sum index 86dabedd89..ce5643c7c3 100644 --- a/usr/src/lib/libsum/sparc/src/lib/libsum/FEATURE/sum +++ b/usr/src/lib/libsum/sparc/src/lib/libsum/FEATURE/sum @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libsum/features/sum by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/src/lib/libsum/features/sum by iffe version 2009-10-06 : : */ #ifndef _def_sum_sum #define _def_sum_sum 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_32bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_md4 1 /* #include <md4.h> ok */ #define _LIB_md 1 /* -lmd is a library */ diff --git a/usr/src/lib/libsum/sparcv9/include/ast/sum.h b/usr/src/lib/libsum/sparcv9/include/ast/sum.h index fa8157ab1e..f01e359848 100644 --- a/usr/src/lib/libsum/sparcv9/include/ast/sum.h +++ b/usr/src/lib/libsum/sparcv9/include/ast/sum.h @@ -3,7 +3,7 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1996-2008 AT&T Intellectual Property * +* Copyright (c) 1996-2009 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * * by AT&T Intellectual Property * diff --git a/usr/src/lib/libsum/sparcv9/src/lib/libsum/FEATURE/sum b/usr/src/lib/libsum/sparcv9/src/lib/libsum/FEATURE/sum index 1fc37114db..35620c8993 100644 --- a/usr/src/lib/libsum/sparcv9/src/lib/libsum/FEATURE/sum +++ b/usr/src/lib/libsum/sparcv9/src/lib/libsum/FEATURE/sum @@ -1,8 +1,8 @@ -/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libsum/features/sum by iffe version 2008-01-31 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/src/lib/libsum/features/sum by iffe version 2009-10-06 : : */ #ifndef _def_sum_sum #define _def_sum_sum 1 #define _sys_types 1 /* #include <sys/types.h> ok */ -#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ +#define _LIB_ast 1 /* /home/gisburn/ksh93/ast_ksh_20091014/build_sparc_64bit/arch/sol11.sun4/lib/libast.a is a library */ #define _LIB_m 1 /* -lm is a library */ #define _hdr_md4 1 /* #include <md4.h> ok */ #define _LIB_md 1 /* -lmd is a library */ diff --git a/usr/src/pkgdefs/SUNWcsu/prototype_com b/usr/src/pkgdefs/SUNWcsu/prototype_com index 4bf58d60f4..6d7b3919c7 100644 --- a/usr/src/pkgdefs/SUNWcsu/prototype_com +++ b/usr/src/pkgdefs/SUNWcsu/prototype_com @@ -70,12 +70,13 @@ f none usr/bin/ckkeywd 555 root bin f none usr/bin/ckpath 555 root bin f none usr/bin/ckrange 555 root bin f none usr/bin/ckstr 555 root bin -f none usr/bin/cksum 555 root bin +l none usr/bin/cksum=../../usr/bin/alias f none usr/bin/cktime 555 root bin f none usr/bin/ckuid 555 root bin f none usr/bin/ckyorn 555 root bin f none usr/bin/clear 555 root bin -f none usr/bin/cmp 555 root bin +l none usr/bin/cmp=../../usr/bin/alias +l none usr/bin/comm=../../usr/bin/alias l none usr/bin/command=../../usr/bin/alias f none usr/bin/coreadm 555 root bin f none usr/bin/cp 555 root bin @@ -87,7 +88,7 @@ f none usr/bin/csh 555 root bin f none usr/bin/ctrun 555 root bin f none usr/bin/ctstat 555 root bin f none usr/bin/ctwatch 555 root bin -f none usr/bin/cut 555 root bin +l none usr/bin/cut=../../usr/bin/alias f none usr/bin/date 555 root bin f none usr/bin/dd 555 root bin l none usr/bin/decrypt=../../usr/lib/isaexec @@ -155,7 +156,7 @@ f none usr/bin/isainfo 555 root bin f none usr/bin/isalist 555 root bin f none usr/bin/itu 555 root bin l none usr/bin/jobs=../../usr/bin/alias -f none usr/bin/join 555 root bin +l none usr/bin/join=../../usr/bin/alias s none usr/bin/jsh=../../sbin/sh f none usr/bin/kbd 555 root bin f none usr/bin/keylogin 555 root bin @@ -173,6 +174,7 @@ f none usr/bin/localedef 555 root bin f none usr/bin/logger 555 root bin f none usr/bin/login 4555 root bin f none usr/bin/logins 750 root bin +l none usr/bin/logname=../../usr/bin/alias f none usr/bin/ls 555 root bin l none usr/bin/m68k=../../usr/bin/i286 l none usr/bin/mac=../../usr/lib/isaexec @@ -205,6 +207,7 @@ l none usr/bin/page=../../usr/bin/more f none usr/bin/pagesize 555 root bin s none usr/bin/passmgmt=../sbin/passmgmt f none usr/bin/passwd 6555 root sys +l none usr/bin/paste=../../usr/bin/alias f none usr/bin/patch 555 root bin f none usr/bin/pathchk 555 root bin f none usr/bin/pax 555 root bin @@ -220,6 +223,7 @@ l none usr/bin/pkill=../../usr/bin/pgrep 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/print=../../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 @@ -274,7 +278,7 @@ s none usr/bin/sync=../../sbin/sync f none usr/bin/tabs 555 root bin f none usr/bin/tail 555 root bin s none usr/bin/tar=../sbin/tar -f none usr/bin/tee 555 root bin +l none usr/bin/tee=../../usr/bin/alias l none usr/bin/test=../../usr/bin/alias f none usr/bin/tic 555 root bin f none usr/bin/time 555 root bin @@ -297,6 +301,7 @@ l none usr/bin/ulimit=../../usr/bin/alias l none usr/bin/umask=../../usr/bin/alias l none usr/bin/unalias=../../usr/bin/alias s none usr/bin/uname=../../sbin/uname +l none usr/bin/uniq=../../usr/bin/alias f none usr/bin/updatemedia 555 root bin l none usr/bin/uptime=../../usr/lib/isaexec l none usr/bin/vax=../../usr/bin/i286 @@ -306,7 +311,7 @@ l none usr/bin/view=../../usr/bin/edit f none usr/bin/vmstat 555 root bin l none usr/bin/w=../../usr/lib/isaexec l none usr/bin/wait=../../usr/bin/alias -f none usr/bin/wc 555 root bin +l none usr/bin/wc=../../usr/bin/alias f none usr/bin/which 555 root bin f none usr/bin/who 555 root bin f none usr/bin/wracct 555 root bin @@ -984,6 +989,35 @@ s none usr/sbin/wusbadm=../../sbin/wusbadm f none usr/sbin/zdump 555 root bin f none usr/sbin/zic 555 root bin d none usr/share 755 root sys +d none usr/share/doc 755 root other +d none usr/share/doc/ksh 755 root bin +f none usr/share/doc/ksh/RELEASE 644 root bin +f none usr/share/doc/ksh/README 644 root bin +f none usr/share/doc/ksh/TYPES 644 root bin +f none usr/share/doc/ksh/DESIGN 644 root bin +f none usr/share/doc/ksh/COMPATIBILITY 644 root bin +f none usr/share/doc/ksh/OBSOLETE 644 root bin +d none usr/share/doc/ksh/images 755 root bin +d none usr/share/doc/ksh/images/callouts 755 root bin +f none usr/share/doc/ksh/images/callouts/1.png 644 root bin +f none usr/share/doc/ksh/images/callouts/2.png 644 root bin +f none usr/share/doc/ksh/images/callouts/3.png 644 root bin +f none usr/share/doc/ksh/images/callouts/4.png 644 root bin +f none usr/share/doc/ksh/images/callouts/5.png 644 root bin +f none usr/share/doc/ksh/images/callouts/6.png 644 root bin +f none usr/share/doc/ksh/images/callouts/7.png 644 root bin +f none usr/share/doc/ksh/images/callouts/8.png 644 root bin +f none usr/share/doc/ksh/images/callouts/9.png 644 root bin +f none usr/share/doc/ksh/images/callouts/10.png 644 root bin +f none usr/share/doc/ksh/images/tag_bourne.png 644 root bin +f none usr/share/doc/ksh/images/tag_i18n.png 644 root bin +f none usr/share/doc/ksh/images/tag_ksh88.png 644 root bin +f none usr/share/doc/ksh/images/tag_ksh93.png 644 root bin +f none usr/share/doc/ksh/images/tag_ksh.png 644 root bin +f none usr/share/doc/ksh/images/tag_l10n.png 644 root bin +f none usr/share/doc/ksh/images/tag_perf.png 644 root bin +f none usr/share/doc/ksh/shell_styleguide.docbook 644 root bin +f none usr/share/doc/ksh/shell_styleguide.html 644 root bin d none usr/share/lib 755 root sys d none usr/share/lib/mailx 755 root bin f none usr/share/lib/mailx/mailx.help 644 root bin diff --git a/usr/src/pkgdefs/SUNWesu/prototype_com b/usr/src/pkgdefs/SUNWesu/prototype_com index 077aae5fbd..a318c47d23 100644 --- a/usr/src/pkgdefs/SUNWesu/prototype_com +++ b/usr/src/pkgdefs/SUNWesu/prototype_com @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # This required package information file contains a list of package contents. @@ -53,7 +53,6 @@ f none usr/bin/bfs 555 root bin f none usr/bin/cal 555 root bin f none usr/bin/calendar 555 root bin f none usr/bin/col 555 root bin -f none usr/bin/comm 555 root bin f none usr/bin/compress 555 root bin f none usr/bin/csplit 555 root bin f none usr/bin/dc 555 root bin @@ -68,7 +67,6 @@ f none usr/bin/graph 555 root bin f none usr/bin/kstat 555 root bin f none usr/bin/last 555 root bin f none usr/bin/lastcomm 555 root bin -f none usr/bin/logname 555 root bin f none usr/bin/look 755 root bin f none usr/bin/lgrpinfo 555 root bin f none usr/bin/mkfifo 555 root bin @@ -79,7 +77,6 @@ f none usr/bin/nl 555 root bin l none usr/bin/oawk=../../usr/bin/awk f none usr/bin/pack 555 root bin l none usr/bin/pargs=../../usr/lib/isaexec -f none usr/bin/paste 555 root bin s none usr/bin/pcat=./unpack l none usr/bin/pcred=../../usr/lib/isaexec l none usr/bin/pfiles=../../usr/lib/isaexec @@ -108,7 +105,6 @@ s none usr/bin/strace=../sbin/strace f none usr/bin/tcopy 555 root bin l none usr/bin/uncompress=../../usr/bin/compress f none usr/bin/unexpand 555 root bin -f none usr/bin/uniq 555 root bin f none usr/bin/units 555 root bin f none usr/bin/unix2dos 555 root bin f none usr/bin/unpack 555 root bin diff --git a/usr/src/pkgdefs/SUNWosdem/Makefile b/usr/src/pkgdefs/SUNWosdem/Makefile index 0443d2d1e7..62cf9a56b4 100644 --- a/usr/src/pkgdefs/SUNWosdem/Makefile +++ b/usr/src/pkgdefs/SUNWosdem/Makefile @@ -18,21 +18,20 @@ # # CDDL HEADER END # + # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # include ../Makefile.com -DATAFILES += depend - LICENSEFILES += \ ../../lib/libshell/THIRDPARTYLICENSE .KEEP_STATE: -all: $(FILES) +all: $(FILES) depend install: all pkg diff --git a/usr/src/pkgdefs/SUNWosdem/depend b/usr/src/pkgdefs/SUNWosdem/depend new file mode 100644 index 0000000000..d3c47e57e2 --- /dev/null +++ b/usr/src/pkgdefs/SUNWosdem/depend @@ -0,0 +1,58 @@ +# +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# This package information file defines software dependencies associated +# with the pkg. You can define three types of pkg dependencies with this file: +# P indicates a prerequisite for installation +# I indicates an incompatible package +# R indicates a reverse dependency +# <pkg.abbr> see pkginfo(4), PKG parameter +# <name> see pkginfo(4), NAME parameter +# <version> see pkginfo(4), VERSION parameter +# <arch> see pkginfo(4), ARCH parameter +# <type> <pkg.abbr> <name> +# (<arch>)<version> +# (<arch>)<version> +# ... +# <type> <pkg.abbr> <name> +# ... +# + +P SUNWcakr Core Solaris Kernel Architecture (Root) +P SUNWcar Core Architecture, (Root) +P SUNWckr Core Solaris Kernel (Root) +P SUNWcnetr Core Solaris Network Infrastructure (Root) +P SUNWcsd Core Solaris Devices +P SUNWcsl Core Solaris Libraries +P SUNWcsr Core Solaris, (Root) +P SUNWcsu Core Solaris, (Usr) +P SUNWesu Extended System Utilities +P SUNWkvm Core Architecture, (Kvm) +P SUNWopenssl-commands OpenSSL Commands (Usr) +P SUNWwgetu wget - GNU wget +P SUNWxcu4 XCU4 Utilities +P SUNWxcu6 XCU6 Utilities diff --git a/usr/src/pkgdefs/SUNWosdem/prototype_com b/usr/src/pkgdefs/SUNWosdem/prototype_com index e6377962d2..bb225ee3bb 100644 --- a/usr/src/pkgdefs/SUNWosdem/prototype_com +++ b/usr/src/pkgdefs/SUNWosdem/prototype_com @@ -53,12 +53,14 @@ f none usr/demo/ELF/dcom.c 644 root bin f none usr/demo/ELF/tpcom.c 644 root bin d none usr/demo/ksh 755 root bin d none usr/demo/ksh/bin 755 root bin +f none usr/demo/ksh/bin/cpvprint 755 root bin f none usr/demo/ksh/bin/crawlsrccomments 755 root bin f none usr/demo/ksh/bin/filemutexdemo1 755 root bin f none usr/demo/ksh/bin/filetree1 755 root bin f none usr/demo/ksh/bin/gnaw 755 root bin f none usr/demo/ksh/bin/mandelbrotset1 755 root bin f none usr/demo/ksh/bin/multifollow 755 root bin +f none usr/demo/ksh/bin/numtree1 755 root bin f none usr/demo/ksh/bin/primenumbers1 755 root bin f none usr/demo/ksh/bin/rssread 755 root bin f none usr/demo/ksh/bin/shcalc 755 root bin @@ -69,23 +71,44 @@ f none usr/demo/ksh/bin/shnote 755 root bin f none usr/demo/ksh/bin/shpiano 755 root bin f none usr/demo/ksh/bin/shtinyurl 755 root bin f none usr/demo/ksh/bin/shtwitter 755 root bin +f none usr/demo/ksh/bin/simplefileattributetree1 755 root bin +f none usr/demo/ksh/bin/simplefiletree1 755 root bin f none usr/demo/ksh/bin/svcproptree1 755 root bin f none usr/demo/ksh/bin/termclock 755 root bin f none usr/demo/ksh/bin/test_net_sctp 755 root bin f none usr/demo/ksh/bin/xmldocumenttree1 755 root bin -d none usr/demo/ksh/doc 755 root bin -f none usr/demo/ksh/doc/COMPATIBILITY 644 root bin -f none usr/demo/ksh/doc/DESIGN 644 root bin -f none usr/demo/ksh/doc/OBSOLETE 644 root bin -f none usr/demo/ksh/doc/README 644 root bin -f none usr/demo/ksh/doc/RELEASE 644 root bin -f none usr/demo/ksh/doc/TYPES 644 root bin d none usr/demo/ksh/fun 755 root bin f none usr/demo/ksh/fun/dirs 755 root bin f none usr/demo/ksh/fun/popd 755 root bin f none usr/demo/ksh/fun/pushd 755 root bin f none usr/demo/ksh/fun/title 755 root bin +d none usr/demo/ksh/src 755 root bin +f none usr/demo/ksh/src/cpvprint.sh 644 root bin +f none usr/demo/ksh/src/crawlsrccomments.sh 644 root bin +f none usr/demo/ksh/src/filemutexdemo1.sh 644 root bin +f none usr/demo/ksh/src/filetree1.sh 644 root bin +f none usr/demo/ksh/src/gnaw.sh 644 root bin +f none usr/demo/ksh/src/mandelbrotset1.sh 644 root bin +f none usr/demo/ksh/src/multifollow.sh 644 root bin +f none usr/demo/ksh/src/numtree1.sh 644 root bin +f none usr/demo/ksh/src/primenumbers1.sh 644 root bin +f none usr/demo/ksh/src/rssread.sh 644 root bin +f none usr/demo/ksh/src/shcalc.sh 644 root bin +f none usr/demo/ksh/src/shircbot.sh 644 root bin +f none usr/demo/ksh/src/shlint.sh 644 root bin +f none usr/demo/ksh/src/shman.sh 644 root bin +f none usr/demo/ksh/src/shnote.sh 644 root bin +f none usr/demo/ksh/src/shpiano.sh 644 root bin +f none usr/demo/ksh/src/shtinyurl.sh 644 root bin +f none usr/demo/ksh/src/shtwitter.sh 644 root bin +f none usr/demo/ksh/src/simplefileattributetree1.sh 644 root bin +f none usr/demo/ksh/src/simplefiletree1.sh 644 root bin +f none usr/demo/ksh/src/svcproptree1.sh 644 root bin +f none usr/demo/ksh/src/termclock.sh 644 root bin +f none usr/demo/ksh/src/test_net_sctp.sh 644 root bin +f none usr/demo/ksh/src/xmldocumenttree1.sh 644 root bin d none usr/demo/ksh/tests 755 root bin +f none usr/demo/ksh/tests/README.tests 644 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 @@ -107,7 +130,6 @@ f none usr/demo/ksh/tests/glob.sh 644 root bin f none usr/demo/ksh/tests/grep.sh 644 root bin f none usr/demo/ksh/tests/heredoc.sh 644 root bin f none usr/demo/ksh/tests/io.sh 644 root bin -f none usr/demo/ksh/tests/locale.sh 644 root bin f none usr/demo/ksh/tests/nameref.sh 644 root bin f none usr/demo/ksh/tests/options.sh 644 root bin f none usr/demo/ksh/tests/path.sh 644 root bin @@ -122,19 +144,36 @@ f none usr/demo/ksh/tests/shtests 755 root bin f none usr/demo/ksh/tests/sigchld.sh 644 root bin f none usr/demo/ksh/tests/signal.sh 644 root bin f none usr/demo/ksh/tests/statics.sh 644 root bin -f none usr/demo/ksh/tests/substring.sh 644 root bin f none usr/demo/ksh/tests/subshell.sh 644 root bin +f none usr/demo/ksh/tests/substring.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_array_default_datatype.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_builtin_poll.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_builtin_sum.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_builtin_tail.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_command_substitution.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_compound_nameref.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_compoundvario.sh 644 root bin -f none usr/demo/ksh/tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6687139_command_substitution_exec_redirection_allocation_loop.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_cr_6722134_background_CHLD_trap.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_cr_6753538_subshell_leaks_umask.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_cr_6754020_weird_square_bracket_expansion.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_cr_6763594_command_failure_execs_twice.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_cr_6766246_pattern_matching_bug.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6769332_substitutions_terminate_shell_after_257_iterations.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6777491_lacks_arithmetric_function_iszero.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6778077_sigthaw_trap.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6789247_printf_hexfloat_rounding.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_cr_6800929_large_command_substitution_hang.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6805792_varmovetest1.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6805794_character_to_wchar_not_working.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6805795_negative_zero.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_cr_6807179_shellpattern_uses_getpwnam.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6835835_builtin_cat_n_broken.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6848486_echo_test_with_test_undefined_executes_test_builtin.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6855875_typeset_hexfloat_has_too_few_digits.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.sh 644 root bin +f none usr/demo/ksh/tests/sun_solaris_cr_6881017_background_process_in_subshell_hangs_caller.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_getconf.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_local_compound_nameref001.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_staticvariables.sh 644 root bin @@ -143,6 +182,7 @@ f none usr/demo/ksh/tests/sun_solaris_vartree002.sh 644 root bin f none usr/demo/ksh/tests/sun_solaris_vartree003.sh 644 root bin f none usr/demo/ksh/tests/tilde.sh 644 root bin f none usr/demo/ksh/tests/timetype.sh 644 root bin +f none usr/demo/ksh/tests/treemove.sh 644 root bin f none usr/demo/ksh/tests/types.sh 644 root bin f none usr/demo/ksh/tests/variables.sh 644 root bin f none usr/demo/ksh/tests/vartree1.sh 644 root bin diff --git a/usr/src/tools/findunref/exception_list.open b/usr/src/tools/findunref/exception_list.open index 8be6623efe..cde763d1a4 100644 --- a/usr/src/tools/findunref/exception_list.open +++ b/usr/src/tools/findunref/exception_list.open @@ -55,6 +55,7 @@ # configuration with upstream. # ./usr/src/lib/libast/*/src/lib/libast/FEATURE +./usr/src/lib/libast/*/src/lib/libast/ast_namval.h ./usr/src/lib/libast/common/comp/conf.* ./usr/src/lib/libast/common/features ./usr/src/lib/libast/common/include/ast_windows.h diff --git a/usr/src/cmd/join/join.xcl b/usr/src/tools/findunref/exception_list.subversion index 88053f2ce7..64efb233b8 100644 --- a/usr/src/cmd/join/join.xcl +++ b/usr/src/tools/findunref/exception_list.subversion @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# 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. @@ -19,8 +18,14 @@ # # CDDL HEADER END # -msgid "" -msgid "%wc" -msgid "\n" -msgid "join: " -msgid "r" + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Subversion-specific exception list +# +# See README.exception_lists for details +# diff --git a/usr/src/tools/scripts/bfu.sh b/usr/src/tools/scripts/bfu.sh index a729785381..53045ea126 100644 --- a/usr/src/tools/scripts/bfu.sh +++ b/usr/src/tools/scripts/bfu.sh @@ -3069,9 +3069,37 @@ bfuscr=" # bfuchameleons=" /usr/bin/basename + /usr/bin/bg + /usr/bin/cd + /usr/bin/cksum + /usr/bin/cmp + /usr/bin/comm + /usr/bin/command /usr/bin/dirname + /usr/bin/cut + /usr/bin/fc + /usr/bin/fg + /usr/bin/getopts + /usr/bin/hash + /usr/bin/jobs + /usr/bin/join + /usr/bin/kill + /usr/bin/logname + /usr/bin/paste + /usr/bin/print + /usr/bin/read + /usr/bin/rev /usr/bin/sleep /usr/bin/sum + /usr/bin/tee + /usr/bin/test + /usr/bin/type + /usr/bin/ulimit + /usr/bin/umask + /usr/bin/unalias + /usr/bin/uniq + /usr/bin/wait + /usr/bin/wc " for chameleon in ${bfuchameleons} ; do |