diff options
author | April Chin <April.Chin@Sun.COM> | 2008-12-27 14:59:38 -0800 |
---|---|---|
committer | April Chin <April.Chin@Sun.COM> | 2008-12-27 14:59:38 -0800 |
commit | 7c2fbfb345896881c631598ee3852ce9ce33fb07 (patch) | |
tree | 4b173b5657508562dfc0aa05f7d056d1e9add505 /usr/src/lib/libcmd | |
parent | 6071ac1de68fed78e1e10052045bbb5f1732a263 (diff) | |
download | illumos-gate-7c2fbfb345896881c631598ee3852ce9ce33fb07.tar.gz |
PSARC/2008/094 ksh93 Update 1
PSARC/2008/344 ksh93 Integration Update 1 Amendments 1
PSARC/2008/589 Remove /usr/bin/printf from PSARC case 2008 094
6619428 *ksh93* RFE: Update ksh93 in Solaris to ast-ksh.2008-11-04
6788659 RFE: Update libpp in Solaris to ast-open.2008-07-25
6561901 RFE: Add "shcomp" (shell script compiler) + kernel module to exec binary sh code
6599668 RFE: Move consumers of alias.sh over to ksh93
6595183 *ksh93* RFE: Update ksh93-integration demo code
6775901 *ksh93* no C message catalogs are generated for ksh93
6451262 *sleep* RFE: /usr/bin/sleep should support floating-point values
6687139 *ksh93* command substitution, exec, and stdout redirection cause allocation loop
6703761 *ksh93* crashes in script containing uncommon output redirections
6715496 *ksh93* SEGVs on array reinitialization
6713682 *ksh93* Creating a compound variable in a subshell "bleeds through" to the calling subshell
6672350 *ksh93* causes parent shell to die when child shell is suspended
6745015 *ksh93* VARIABLE=`command substitution` assignment is not reliable on OpenSolaris
6710205 *ksh93* problem with command substitution (within back quotes) containing \$'
6737600 *ksh93* exits debugger when user presses ctrl-c
6748645 *ksh93* fc -l -e - is mis-parsed, outputs wrong error message "-e - requires single argument"
6754020 *ksh93* does weird '[' expansion
6753538 *ksh93* umask modification leaks out of a ksh93 subshell
6766246 *ksh93* bug in pattern matching
6763594 *ksh93* executes command after "command" builtin twice on failure
6762665 *ksh93* Difficult-to-reproduce SIGSEGV in ksh93
Diffstat (limited to 'usr/src/lib/libcmd')
78 files changed, 1233 insertions, 682 deletions
diff --git a/usr/src/lib/libcmd/Makefile b/usr/src/lib/libcmd/Makefile index 022938b848..45c808effe 100644 --- a/usr/src/lib/libcmd/Makefile +++ b/usr/src/lib/libcmd/Makefile @@ -18,14 +18,14 @@ # # CDDL HEADER END # + # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -SHELL=/usr/bin/ksh + +SHELL=/usr/bin/ksh93 include ../Makefile.lib diff --git a/usr/src/lib/libcmd/Makefile.com b/usr/src/lib/libcmd/Makefile.com index 388e72a927..2b9873103c 100644 --- a/usr/src/lib/libcmd/Makefile.com +++ b/usr/src/lib/libcmd/Makefile.com @@ -18,14 +18,14 @@ # # CDDL HEADER END # + # # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -SHELL=/usr/bin/ksh + +SHELL=/usr/bin/ksh93 LIBRARY = libcmd.a VERS = .1 @@ -33,6 +33,7 @@ OBJECTS = \ basename.o \ cat.o \ chgrp.o \ + cksum.o \ chmod.o \ chown.o \ cmdinit.o \ @@ -52,16 +53,20 @@ OBJECTS = \ join.o \ ln.o \ logname.o \ + md5sum.o \ mkdir.o \ mkfifo.o \ mv.o \ paste.o \ pathchk.o \ + pids.o \ + readlink.o \ rev.o \ revlib.o \ rm.o \ rmdir.o \ stty.o \ + sum.o \ sync.o \ tail.o \ tee.o \ @@ -79,13 +84,19 @@ include ../../Makefile.lib # automated code updates easier. MAPFILES= ../mapfile-vers -# Set common AST build flags (e.g., needed to support the math stuff). +# Set common AST build flags (e.g. C99/XPG6, needed to support the math stuff) include ../../../Makefile.ast LIBS = $(DYNLIB) $(LINTLIB) $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC) -LDLIBS += -last -lsocket -lnsl -lc + +LDLIBS += \ + -lsum \ + -last \ + -lsocket \ + -lnsl \ + -lc SRCDIR = ../common @@ -108,16 +119,14 @@ CPPFLAGS = \ '-DUSAGE_LICENSE=\ "[-author?Glenn Fowler <gsf@research.att.com>]"\ "[-author?David Korn <dgk@research.att.com>]"\ - "[-copyright?Copyright (c) 1992-2007 AT&T Knowledge Ventures]"\ + "[-copyright?Copyright (c) 1992-2008 AT&T Intellectual Property]"\ "[-license?http://www.opensource.org/licenses/cpl1.0.txt]"\ "[--catalog?libcmd]"' CFLAGS += \ - $(CCVERBOSE) \ - -xstrconst + $(ASTCFLAGS) CFLAGS64 += \ - $(CCVERBOSE) \ - -xstrconst + $(ASTCFLAGS64) pics/sync.o := CERRWARN += -erroff=E_END_OF_LOOP_CODE_NOT_REACHED @@ -132,6 +141,5 @@ all: $(LIBS) # lint: @ print "usr/src/lib/libcmd is not lint-clean: skipping" - @ $(TRUE) include ../../Makefile.targ diff --git a/usr/src/lib/libcmd/amd64/include/ast/cmd.h b/usr/src/lib/libcmd/amd64/include/ast/cmd.h index 2484c17c5a..9ac1c90993 100644 --- a/usr/src/lib/libcmd/amd64/include/ast/cmd.h +++ b/usr/src/lib/libcmd/amd64/include/ast/cmd.h @@ -3,10 +3,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -40,9 +40,9 @@ #include <ast.h> #include <error.h> #include <stak.h> +#include <shcmd.h> #define cmdinit _cmd_init -#define cmdquit() 0 #if _BLD_cmd && defined(__EXPORT__) #undef __MANGLE__ @@ -60,11 +60,13 @@ #ifdef CMD_STANDALONE +#define CMD_CONTEXT(c) ((Shbltin_t*)0) + #if CMD_DYNAMIC #include <dlldefs.h> -typedef int (*Builtin_f) __PROTO__((int, char**, __V_*)); +typedef int (*Shbltin_f) __PROTO__((int, char**, __V_*)); #else @@ -106,7 +108,7 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** register char* s; register char* t; __V_* dll; - Builtin_f fun; + Shbltin_f fun; char buf[64]; if (s = strrchr(argv[0], '/')) @@ -126,16 +128,16 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** { if (dll = dlopen(NiL, RTLD_LAZY)) { - if (fun = (Builtin_f)dlsym(dll, buf + 1)) + if (fun = (Shbltin_f)dlsym(dll, buf + 1)) break; - if (fun = (Builtin_f)dlsym(dll, buf)) + if (fun = (Shbltin_f)dlsym(dll, buf)) break; } if (dll = dllfind("cmd", NiL, RTLD_LAZY)) { - if (fun = (Builtin_f)dlsym(dll, buf + 1)) + if (fun = (Shbltin_f)dlsym(dll, buf + 1)) break; - if (fun = (Builtin_f)dlsym(dll, buf)) + if (fun = (Shbltin_f)dlsym(dll, buf)) break; } return 127; @@ -149,27 +151,12 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** #else #undef cmdinit +#ifdef _MSC_VER +#define CMD_CONTEXT(p) ((Shbltin_t*)(p)) #define cmdinit(a,b,c,d,e) do{if(_cmd_init(a,b,c,d,e))return -1;}while(0) - -#ifndef CMD_BUILTIN - -#undef cmdquit -#define cmdquit() (_cmd_quit) - -#if _BLD_cmd && defined(__EXPORT__) -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ __EXPORT__ -#endif -#if !_BLD_cmd && defined(__IMPORT__) -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ __IMPORT__ -#endif - -extern __MANGLE__ int _cmd_quit; - -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ - +#else +#define CMD_CONTEXT(p) (((p)&&((Shbltin_t*)(p))->version>=20071012&&((Shbltin_t*)(p))->version<20350101)?((Shbltin_t*)(p)):0) +#define cmdinit(a,b,c,d,e) do{if((c)&&!CMD_CONTEXT(c))c=0;if(_cmd_init(a,b,c,d,e))return -1;}while(0) #endif #if _BLD_cmd && defined(__EXPORT__) diff --git a/usr/src/lib/libcmd/amd64/include/ast/cmdext.h b/usr/src/lib/libcmd/amd64/include/ast/cmdext.h index b5c58b5d04..602f8d7a7d 100644 --- a/usr/src/lib/libcmd/amd64/include/ast/cmdext.h +++ b/usr/src/lib/libcmd/amd64/include/ast/cmdext.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -55,6 +55,7 @@ extern __MANGLE__ int b_mkfifo __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_rm __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rmdir __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 397e8afccb..4edd14f3cf 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_20070418/build_i386_64bit/src/lib/libcmd/features/ids by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libcmd/features/ids by iffe version 2008-01-31 : : */ #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_20070418/build_i386_64bit/arch/sol11.i386/lib/libast.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_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 b40d706945..90b55e7c99 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_20070418/build_i386_64bit/src/lib/libcmd/features/sockets by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libcmd/features/sockets by iffe version 2008-01-31 : : */ #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_20070418/build_i386_64bit/arch/sol11.i386/lib/libast.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_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 4975396e7b..43ae73a5c4 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_20070418/build_i386_64bit/src/lib/libcmd/features/symlink by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libcmd/features/symlink by iffe version 2008-01-31 : : */ #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_20070418/build_i386_64bit/arch/sol11.i386/lib/libast.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_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 34d932c637..b6cb394d64 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_20070418/build_i386_64bit/src/lib/libcmd/features/utsname by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_64bit/src/lib/libcmd/features/utsname by iffe version 2008-01-31 : : */ #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_20070418/build_i386_64bit/arch/sol11.i386/lib/libast.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_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 7e343a5607..6300890d12 100644 --- a/usr/src/lib/libcmd/common/RELEASE +++ b/usr/src/lib/libcmd/common/RELEASE @@ -1,4 +1,38 @@ -07-03-28 date.c: add --unelepsed=scale, -U: fmtelapsed() => strelapsed() +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 +08-04-24 uniq.c: add optget() 'n' option for -1 => -f1 +08-04-24 getconf.c: clarify diffs between "name - value" and "name = value" +08-04-01 cut.c: add write error check +08-04-01 paste.c: fix --noserial stream vector access bug +08-04-01 pids.c: add ls/ps style --format=format +08-04-01 stty.c: fix off2 unitialized reference +08-03-28 chgrp.c: add --before=file +08-03-14 pids.c: add +08-03-11 chgrp.c: fix -m to use uid:gid as lookup key +08-02-11 Makefile: add -lmd possibly required by sumlib.o -- hack alert +08-01-30 expr.c: fix <=0 type that broke substr * 1 * -- wow +07-12-13 cp.c: fix builtin state reinitialization +07-11-29 rev.c: honor multibyte locales +07-11-27 cp.c: open non-existent destination with O_EXCL +07-11-27 stty.c: add -t,--terminal-group to list tty pgrp +07-11-27 cksum.c: --silent -s => -S, -s == -x sys5 for gnu compatibility +07-11-11 tee.c: drop ancient bsd compatibility "-" operand => SIGINT +07-10-29 cksum.c: add SUM_LEGACY for -r +07-10-12 cp.c: plug usage string memory leak by using per-builtin state +07-09-21 cksum.c: add sumprint() default scale arg, --scale, --bsd for solaris +07-09-10 chmod.c: add --show,-n +07-07-27 wclib.c: bias <wchar.h> checks for modern unix +07-07-17 cat.c: fix --squeeze-blank to reduce multiple blank lines to *one* +07-05-20 cmd.h: handle msvc's balk at if(0)0=0; +07-05-20 cksum.c: #include <modex.h> +07-05-11 cmd.h: add _CMD_CONTEXT_OK() to verify >= 20070511 context +07-05-09 fds.c: handle ipv6 sockets +07-05-09 cmd.h: <shbltin.h> : cmdquit() => sh_checksig(context) +07-04-25 mkdir.c: force (S_ISVTX|S_ISUID|S_ISGID) after mkdir(2) +07-04-24 procrun.c: add -last intercept => sh_run() and whence -q +07-04-19 uname.c: name operands first checked for CS_NAME, then NAME +07-03-28 date.c: add --unelapsed=scale, -U: fmtelapsed() => strelapsed() 07-03-25 wclib.h: iswspace() requires <wctype.h>! 07-03-11 tty.c: add sysV --line-number, -l 07-02-26 Makefile: sumlib.o: direct extract from +lsum (vcodex someday) diff --git a/usr/src/lib/libcmd/common/basename.c b/usr/src/lib/libcmd/common/basename.c index f715091c32..c5c86aa154 100644 --- a/usr/src/lib/libcmd/common/basename.c +++ b/usr/src/lib/libcmd/common/basename.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/cat.c b/usr/src/lib/libcmd/common/cat.c index 884726e572..76af2f2765 100644 --- a/usr/src/lib/libcmd/common/cat.c +++ b/usr/src/lib/libcmd/common/cat.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -31,7 +31,7 @@ #include <fcntl.h> static const char usage[] = -"[-?\n@(#)$Id: cat (AT&T Research) 2006-05-17 $\n]" +"[-?\n@(#)$Id: cat (AT&T Research) 2007-07-17 $\n]" USAGE_LICENSE "[+NAME?cat - concatenate files]" "[+DESCRIPTION?\bcat\b copies each \afile\a in sequence to the standard" @@ -111,6 +111,7 @@ vcat(register char* states, Sfio_t *fdin, Sfio_t *fdout, int flags) unsigned char* inbuff; int printdefer = (flags&(B_FLAG|N_FLAG)); int lastchar; + int lastline; unsigned char meta[4]; @@ -197,6 +198,7 @@ vcat(register char* states, Sfio_t *fdin, Sfio_t *fdout, int flags) while ((n=states[*cp])==T_CONTROL); break; case T_NEWLINE: + lastline = line; if (flags&S_FLAG) { while (states[*++cp]==T_NEWLINE) @@ -209,6 +211,12 @@ vcat(register char* states, Sfio_t *fdin, Sfio_t *fdout, int flags) 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++; @@ -327,7 +335,7 @@ b_cat(int argc, char** argv, void* context) if (!(flags&T_FLAG)) states['\t'] = 0; } - if (flags&(V_FLAG|T_FLAG|N_FLAG|E_FLAG|B_FLAG)) + if (flags&(V_FLAG|T_FLAG|N_FLAG|E_FLAG|B_FLAG|S_FLAG)) { states['\n'] = T_NEWLINE; dovcat = 1; diff --git a/usr/src/lib/libcmd/common/chgrp.c b/usr/src/lib/libcmd/common/chgrp.c index 5538f5e310..5525157070 100644 --- a/usr/src/lib/libcmd/common/chgrp.c +++ b/usr/src/lib/libcmd/common/chgrp.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -28,7 +28,7 @@ */ static const char usage_1[] = -"[-?@(#)$Id: chgrp (AT&T Research) 2006-10-11 $\n]" +"[-?@(#)$Id: chgrp (AT&T Research) 2008-03-28 $\n]" USAGE_LICENSE ; @@ -49,24 +49,34 @@ static const char usage_own_1[] = ; static const char usage_2[] = +"[b:before?Only change files with \bctime\b before (less than) the " + "\bmtime\b of \afile\a.]:[file]" "[c:changes?Describe only files whose ownership actually changes.]" "[f:quiet|silent?Do not report files whose ownership fails to change.]" -"[l|h:symlink?Change the ownership of the symbolic links on systems that" -" support this.]" -"[m:map?The first operand is interpreted as a file that contains a map" -" of \afrom_uid:from_gid to_uid:to_gid\a pairs. Ownership of files" -" matching the \afrom\a part of any pair is changed to the corresponding" -" \ato\a part of the pair. The process stops at the first match for" -" each file. Unmatched files are silently ignored.]" +"[l|h:symlink?Change the ownership of the symbolic links on systems that " + "support this.]" +"[m:map?The first operand is interpreted as a file that contains a map " + "of space separated \afrom_uid:from_gid to_uid:to_gid\a pairs. The " + "\auid\a or \agid\a part of each pair may be omitted to mean any \auid\a " + "or \agid\a. Ownership of files matching the \afrom\a part of any pair " + "is changed to the corresponding \ato\a part of the pair. The matching " + "for each file operand is in the order \auid\a:\agid\a, \auid\a:, " + ":\agid\a. For a given file, once a \auid\a or \agid\a mapping is " + "determined it is not overridden by any subsequent match. Unmatched " + "files are silently ignored.]" "[n:show?Show actions but don't execute.]" -"[r:reference?Omit the explicit ownership operand and use the ownership of" -" \afile\a instead.]:[file]" +"[r:reference?Omit the explicit ownership operand and use the ownership " + "of \afile\a instead.]:[file]" +"[u:unmapped?Print a diagnostic for each file for which either the " + "\auid\a or \agid\a or both were not mapped.]" "[v:verbose?Describe changed permissions of all files.]" -"[H:metaphysical?Follow symbolic links for command arguments; otherwise don't" -" follow symbolic links when traversing directories.]" +"[H:metaphysical?Follow symbolic links for command arguments; otherwise " + "don't follow symbolic links when traversing directories.]" "[L:logical|follow?Follow symbolic links when traversing directories.]" -"[P:physical|nofollow?Don't follow symbolic links when traversing directories.]" -"[R:recursive?Recursively change ownership of directories and their contents.]" +"[P:physical|nofollow?Don't follow symbolic links when traversing " + "directories.]" +"[R:recursive?Recursively change ownership of directories and their " + "contents.]" "[X:test?Canonicalize output for testing.]" "\n" @@ -103,12 +113,17 @@ __STDPP__directive pragma pp:nohide lchown #undef lchown #endif -typedef struct /* uid/gid map */ +typedef struct Key_s /* uid/gid key */ +{ + int uid; /* uid */ + int gid; /* gid */ +} Key_t; + +typedef struct Map_s /* uid/gid map */ { Dtlink_t link; /* dictionary link */ - int id; /* id */ - int uid; /* id maps to this uid */ - int gid; /* id maps to this gid */ + Key_t key; /* key */ + Key_t to; /* map to these */ } Map_t; #define NOID (-1) @@ -120,7 +135,8 @@ typedef struct /* uid/gid map */ #define OPT_SHOW (1<<4) /* show but don't do */ #define OPT_TEST (1<<5) /* canonicalize output */ #define OPT_UID (1<<6) /* have uid */ -#define OPT_VERBOSE (1<<7) /* have uid */ +#define OPT_UNMAPPED (1<<7) /* unmapped file diagnostic */ +#define OPT_VERBOSE (1<<8) /* have uid */ extern int lchown(const char*, uid_t, gid_t); @@ -143,14 +159,14 @@ lchown(const char* path, uid_t uid, gid_t gid) */ static void -getids(register char* s, char** e, int* uid, int* gid, int options) +getids(register char* s, char** e, Key_t* key, int options) { register char* t; register int n; char* z; char buf[64]; - *uid = *gid = NOID; + key->uid = key->gid = NOID; while (isspace(*s)) s++; for (t = s; (n = *t) && n != ':' && n != '.' && !isspace(n); t++); @@ -160,8 +176,6 @@ getids(register char* s, char** e, int* uid, int* gid, int options) if ((n = t++ - s) >= sizeof(buf)) n = sizeof(buf) - 1; *((s = (char*)memcpy(buf, s, n)) + n) = 0; - while (isspace(*t)) - t++; } if (options & OPT_CHOWN) { @@ -173,7 +187,7 @@ getids(register char* s, char** e, int* uid, int* gid, int options) if (*z) error(ERROR_exit(1), "%s: unknown user", s); } - *uid = n; + key->uid = n; } for (s = t; (n = *t) && !isspace(n); t++); if (n) @@ -191,7 +205,7 @@ getids(register char* s, char** e, int* uid, int* gid, int options) if (*z) error(ERROR_exit(1), "%s: unknown group", s); } - *gid = n; + key->gid = n; } if (e) *e = t; @@ -205,19 +219,25 @@ b_chgrp(int argc, char** argv, void* context) register Map_t* m; register FTS* fts; register FTSENT*ent; + register int i; Dt_t* map = 0; int flags; int uid; int gid; char* op; char* usage; + char* t; Sfio_t* sp; + unsigned long before; Dtdisc_t mapdisc; + Key_t keys[3]; + Key_t key; struct stat st; int (*chownf)(const char*, uid_t, gid_t); cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_NOTIFY); flags = fts_flags() | FTS_TOP | FTS_NOPOSTORDER | FTS_NOSEEDOTDIR; + before = ~0; if (!(sp = sfstropen())) error(ERROR_SYSTEM|3, "out of space"); sfputr(sp, usage_1, -1); @@ -240,6 +260,11 @@ b_chgrp(int argc, char** argv, void* context) { switch (optget(argv, usage)) { + case 'b': + if (stat(opt_info.arg, &st)) + error(ERROR_exit(1), "%s: cannot stat", opt_info.arg); + before = st.st_mtime; + continue; case 'c': case 'v': options |= OPT_VERBOSE; @@ -252,8 +277,8 @@ b_chgrp(int argc, char** argv, void* context) continue; case 'm': memset(&mapdisc, 0, sizeof(mapdisc)); - mapdisc.key = offsetof(Map_t, id); - mapdisc.size = sizeof(int); + mapdisc.key = offsetof(Map_t, key); + mapdisc.size = sizeof(Key_t); if (!(map = dtopen(&mapdisc, Dthash))) error(ERROR_exit(1), "out of space [id map]"); continue; @@ -267,6 +292,9 @@ b_chgrp(int argc, char** argv, void* context) gid = st.st_gid; options |= OPT_UID|OPT_GID; continue; + case 'u': + options |= OPT_UNMAPPED; + continue; case 'H': flags |= FTS_META|FTS_PHYSICAL; continue; @@ -299,60 +327,33 @@ b_chgrp(int argc, char** argv, void* context) s = *argv; if (map) { - char* t; - int nuid; - int ngid; - if (streq(s, "-")) sp = sfstdin; else if (!(sp = sfopen(NiL, s, "r"))) error(ERROR_exit(1), "%s: cannot read", s); while (s = sfgetr(sp, '\n', 1)) { - getids(s, &t, &uid, &gid, options); - getids(t, NiL, &nuid, &ngid, options); - if (uid != NOID) - { - if (m = (Map_t*)dtmatch(map, &uid)) - { - m->uid = nuid; - if (m->gid == NOID) - m->gid = ngid; - } - else if (m = (Map_t*)stakalloc(sizeof(Map_t))) - { - m->id = uid; - m->uid = nuid; - m->gid = ngid; - dtinsert(map, m); - } - else - error(ERROR_exit(1), "out of space [id dictionary]"); - } - if (gid != NOID) + getids(s, &t, &key, options); + if (!(m = (Map_t*)dtmatch(map, &key))) { - if (gid == uid || (m = (Map_t*)dtmatch(map, &gid))) - m->gid = ngid; - else if (m = (Map_t*)stakalloc(sizeof(Map_t))) - { - m->id = gid; - m->uid = NOID; - m->gid = ngid; - dtinsert(map, m); - } - else + if (!(m = (Map_t*)stakalloc(sizeof(Map_t)))) error(ERROR_exit(1), "out of space [id dictionary]"); + m->key = key; + m->to.uid = m->to.gid = NOID; + dtinsert(map, m); } + getids(t, NiL, &m->to, options); } if (sp != sfstdin) sfclose(sp); + keys[1].gid = keys[2].uid = NOID; } else if (!(options & (OPT_UID|OPT_GID))) { - getids(s, NiL, &uid, &gid, options); - if (uid != NOID) + getids(s, NiL, &key, options); + if ((uid = key.uid) != NOID) options |= OPT_UID; - if (gid != NOID) + if ((gid = key.gid) != NOID) options |= OPT_GID; } switch (options & (OPT_UID|OPT_GID)) @@ -372,7 +373,7 @@ b_chgrp(int argc, char** argv, void* context) } if (!(fts = fts_open(argv + 1, flags, NiL))) error(ERROR_system(1), "%s: not found", argv[1]); - while (!cmdquit() && (ent = fts_read(fts))) + while (!sh_checksig(context) && (ent = fts_read(fts))) switch (ent->fts_info) { case FTS_F: @@ -380,23 +381,31 @@ b_chgrp(int argc, char** argv, void* context) case FTS_SL: case FTS_SLNONE: anyway: + if ((unsigned long)ent->fts_statp->st_ctime >= before) + break; if (map) { options &= ~(OPT_UID|OPT_GID); - uid = ent->fts_statp->st_uid; - gid = ent->fts_statp->st_gid; - if ((m = (Map_t*)dtmatch(map, &uid)) && m->uid != NOID) - { - uid = m->uid; - options |= OPT_UID; - } - if (gid != uid) - m = (Map_t*)dtmatch(map, &gid); - if (m && m->gid != NOID) + uid = gid = NOID; + keys[0].uid = keys[1].uid = ent->fts_statp->st_uid; + keys[0].gid = keys[2].gid = ent->fts_statp->st_gid; + i = 0; + do { - gid = m->gid; - options |= OPT_GID; - } + if (m = (Map_t*)dtmatch(map, &keys[i])) + { + if (uid == NOID && m->to.uid != NOID) + { + uid = m->to.uid; + options |= OPT_UID; + } + if (gid == NOID && m->to.gid != NOID) + { + gid = m->to.gid; + options |= OPT_GID; + } + } + } while (++i < elementsof(keys) && (uid == NOID || gid == NOID)); } else { @@ -405,7 +414,16 @@ b_chgrp(int argc, char** argv, void* context) if (!(options & OPT_GID)) gid = ent->fts_statp->st_gid; } - if (uid != ent->fts_statp->st_uid || gid != ent->fts_statp->st_gid) + if ((options & OPT_UNMAPPED) && (uid == NOID || gid == NOID)) + { + if (uid == NOID && gid == NOID) + error(ERROR_warn(0), "%s: uid and gid not mapped", ent->fts_path); + else if (uid == NOID) + error(ERROR_warn(0), "%s: uid not mapped", ent->fts_path); + else + error(ERROR_warn(0), "%s: gid not mapped", ent->fts_path); + } + if (uid != ent->fts_statp->st_uid && uid != NOID || gid != ent->fts_statp->st_gid && gid != NOID) { if ((ent->fts_info & FTS_SL) && (flags & FTS_PHYSICAL) && (options & OPT_LCHOWN)) { @@ -424,7 +442,7 @@ b_chgrp(int argc, char** argv, void* context) ent->fts_statp->st_uid = 0; ent->fts_statp->st_gid = 0; } - sfprintf(sfstdout, "%s uid:%05d->%05d gid:%05d->%05d %s\n", op, ent->fts_statp->st_uid, uid, ent->fts_statp->st_gid, gid, ent->fts_accpath); + sfprintf(sfstdout, "%s uid:%05d->%05d gid:%05d->%05d %s\n", op, ent->fts_statp->st_uid, uid, ent->fts_statp->st_gid, gid, ent->fts_path); } if (!(options & OPT_SHOW) && (*chownf)(ent->fts_accpath, uid, gid) && !(options & OPT_FORCE)) error(ERROR_system(0), "%s: cannot change%s", ent->fts_accpath, s); diff --git a/usr/src/lib/libcmd/common/chmod.c b/usr/src/lib/libcmd/common/chmod.c index b1745585a0..f8fc03226a 100644 --- a/usr/src/lib/libcmd/common/chmod.c +++ b/usr/src/lib/libcmd/common/chmod.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -28,7 +28,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: chmod (AT&T Research) 2007-07-26 $\n]" +"[-?\n@(#)$Id: chmod (AT&T Research) 2007-09-10 $\n]" USAGE_LICENSE "[+NAME?chmod - change the access permissions of files]" "[+DESCRIPTION?\bchmod\b changes the permission of each file " @@ -92,7 +92,7 @@ USAGE_LICENSE "[+?When the \b-c\b or \b-v\b options are specified, change notifications " "are written to standard output using the format, " - "\bmode of %s changed to %0.4o (%s)\b, with arguments of the " + "\b%s: mode changed to %0.4o (%s)\b, with arguments of the " "pathname, the numeric mode, and the resulting permission bits as " "would be displayed by the \bls\b command.]" @@ -111,6 +111,7 @@ USAGE_LICENSE "support this.]" "[i:ignore-umask?Ignore the \bumask\b(2) value in symbolic mode " "expressions. This is probably how you expect \bchmod\b to work.]" +"[n:show?Show actions but do not change any file modes.]" "[F:reference?Omit the \amode\a operand and use the mode of \afile\a " "instead.]:[file]" "[v:verbose?Describe changed permissions of all files.]" @@ -159,6 +160,7 @@ b_chmod(int argc, char** argv, void* context) int (*chmodf)(const char*, mode_t); int notify = 0; int ignore = 0; + int show = 0; #if _lib_lchmod int chlink = 0; #endif @@ -190,6 +192,9 @@ b_chmod(int argc, char** argv, void* context) case 'i': ignore = 1; continue; + case 'n': + show = 1; + continue; case 'v': notify = 2; continue; @@ -247,7 +252,7 @@ b_chmod(int argc, char** argv, void* context) umask(ignore); error(ERROR_system(1), "%s: not found", *argv); } - while (!cmdquit() && (ent = fts_read(fts))) + while (!sh_checksig(context) && (ent = fts_read(fts))) switch (ent->fts_info) { case FTS_SL: @@ -264,7 +269,7 @@ b_chmod(int argc, char** argv, void* context) anyway: if (amode) mode = strperm(amode, &last, ent->fts_statp->st_mode); - if ((*chmodf)(ent->fts_accpath, mode) >= 0) + if (show || (*chmodf)(ent->fts_accpath, mode) >= 0) { if (notify == 2 || notify == 1 && (mode&S_IPERM) != (ent->fts_statp->st_mode&S_IPERM)) sfprintf(sfstdout, "%s: mode changed to %0.4o (%s)\n", ent->fts_path, mode, fmtmode(mode, 1)+1); diff --git a/usr/src/lib/libcmd/common/chown.c b/usr/src/lib/libcmd/common/chown.c index f31421df18..83340c346a 100644 --- a/usr/src/lib/libcmd/common/chown.c +++ b/usr/src/lib/libcmd/common/chown.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/cksum.c b/usr/src/lib/libcmd/common/cksum.c index 25d9ee0c0f..56a80131a6 100644 --- a/usr/src/lib/libcmd/common/cksum.c +++ b/usr/src/lib/libcmd/common/cksum.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: sum (AT&T Research) 2007-02-07 $\n]" +"[-?\n@(#)$Id: sum (AT&T Research) 2007-11-27 $\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" @@ -50,6 +50,8 @@ USAGE_LICENSE "[a:all?List the checksum for all files. Use with \b--total\b to list both" " individual and total checksums and block counts.]" "[b:binary?Read files in binary mode. This is the default.]" +"[B:scale?Block count scale (bytes per block) override for methods that" +" include size in the output. The default is method specific.]#[scale]" "[c:check?Each \afile\a is interpreted as the output from a previous \bsum\b." " If \b--header\b or \b--permissions\b was specified in the previous" " \bsum\b then the checksum method is automatically determined," @@ -74,8 +76,8 @@ USAGE_LICENSE " specified then the mode, user and group for each path in \afile\a" " are updated if necessary to match those in \afile\a. A warning is" " printed on the standard error for each changed file.]" -"[r:recursive?Recursively checksum the contents of directories.]" -"[s:silent|status?No output for \b--check\b; 0 exit status means all sums" +"[R:recursive?Recursively checksum the contents of directories.]" +"[S:silent|status?No output for \b--check\b; 0 exit status means all sums" " matched, non-0 means at least one sum failed to match. Ignored for" " \b--permissions\b.]" "[t:total?List only the total checksum and block count of all files." @@ -95,6 +97,10 @@ USAGE_LICENSE " determined by \bgetconf PATH_RESOLVE\b.]" "[P:physical?Don't follow symbolic links when traversing directories. The" " default is determined by \bgetconf PATH_RESOLVE\b.]" +"[r:bsd?Equivalent to \b--method=bsd --scale=512\b for compatibility with" +" other \bsum\b(1) implementations.]" +"[s:sysv?Equivalent to \b--method=sys5\b for compatibility with other" +" \bsum\b(1) implementations.]" "\n" "\n[ file ... ]\n" @@ -106,6 +112,7 @@ USAGE_LICENSE #include <cmd.h> #include <sum.h> #include <ls.h> +#include <modex.h> #include <fts.h> #include <error.h> @@ -113,6 +120,7 @@ typedef struct State_s /* program state */ { int all; /* list all items */ Sfio_t* check; /* check previous output */ + int flags; /* sumprint() SUM_* flags */ gid_t gid; /* caller gid */ int header; /* list method on output */ int list; /* list file name too */ @@ -120,6 +128,7 @@ typedef struct State_s /* program state */ int permissions; /* include mode,uer,group */ int haveperm; /* permissions in the input */ int recursive; /* recursively descend dirs */ + size_t scale; /* scale override */ unsigned long size; /* combined size of all files */ int silent; /* silent check, 0 exit if ok */ int (*sort)(FTSENT* const*, FTSENT* const*); @@ -221,7 +230,7 @@ pr(State_t* state, Sfio_t* op, Sfio_t* ip, char* file, int perm, struct stat* st sumdone(state->sum); if (!state->total || state->all) { - sumprint(state->sum, op, SUM_SIZE|SUM_SCALE); + sumprint(state->sum, op, state->flags|SUM_SCALE, state->scale); if (perm >= 0) { if (perm) @@ -433,8 +442,8 @@ int b_cksum(int argc, register char** argv, void* context) { register int flags; - register char* s; char* file; + char* method; Sfio_t* sp; FTS* fts; FTSENT* ent; @@ -445,7 +454,9 @@ b_cksum(int argc, register char** argv, void* context) memset(&state, 0, sizeof(state)); setlocale(LC_ALL, ""); flags = fts_flags() | FTS_TOP | FTS_NOPOSTORDER | FTS_NOSEEDOTDIR; + state.flags = SUM_SIZE; state.warn = 1; + method = 0; optinit(&optdisc, optinfo); for (;;) { @@ -457,6 +468,9 @@ b_cksum(int argc, register char** argv, void* context) case 'b': state.text = 0; continue; + case 'B': + state.scale = opt_info.num; + continue; case 'c': if (!(state.check = sfstropen())) error(3, "out of space [check]"); @@ -471,11 +485,19 @@ b_cksum(int argc, register char** argv, void* context) state.permissions = 1; continue; case 'r': + method = "bsd"; + state.scale = 512; + state.flags |= SUM_LEGACY; + continue; + case 'R': flags &= ~FTS_TOP; state.recursive = 1; state.sort = order; continue; case 's': + method = "sys5"; + continue; + case 'S': state.silent = opt_info.num; continue; case 't': @@ -485,8 +507,7 @@ b_cksum(int argc, register char** argv, void* context) state.warn = opt_info.num; continue; case 'x': - if (!(state.sum = sumopen(opt_info.arg))) - error(3, "%s: unknown checksum method", opt_info.arg); + method = opt_info.arg; continue; case 'H': flags |= FTS_META|FTS_PHYSICAL; @@ -518,6 +539,8 @@ b_cksum(int argc, register char** argv, void* context) * check the method */ + if (method && !(state.sum = sumopen(method))) + error(3, "%s: unknown checksum method", method); if (!state.sum && !(state.sum = sumopen(error_info.id)) && !(state.sum = sumopen(astconf("UNIVERSE", NiL, NiL)))) state.sum = sumopen(NiL); @@ -560,7 +583,7 @@ b_cksum(int argc, register char** argv, void* context) error(ERROR_system(1), "%s: not found", *argv); else { - while (!cmdquit() && (ent = fts_read(fts))) + while (!sh_checksig(context) && (ent = fts_read(fts))) switch (ent->fts_info) { case FTS_SL: @@ -591,7 +614,7 @@ b_cksum(int argc, register char** argv, void* context) } if (state.total) { - sumprint(state.sum, sfstdout, SUM_TOTAL|SUM_SIZE|SUM_SCALE); + sumprint(state.sum, sfstdout, state.flags|SUM_TOTAL|SUM_SCALE, state.scale); sfputc(sfstdout, '\n'); } sumclose(state.sum); diff --git a/usr/src/lib/libcmd/common/cmd.h b/usr/src/lib/libcmd/common/cmd.h index 50092c2018..8fe4094d78 100644 --- a/usr/src/lib/libcmd/common/cmd.h +++ b/usr/src/lib/libcmd/common/cmd.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -31,9 +31,9 @@ #include <ast.h> #include <error.h> #include <stak.h> +#include <shcmd.h> #define cmdinit _cmd_init -#define cmdquit() 0 #if _BLD_cmd && defined(__EXPORT__) #define extern __EXPORT__ @@ -49,11 +49,13 @@ #ifdef CMD_STANDALONE +#define CMD_CONTEXT(c) ((Shbltin_t*)0) + #if CMD_DYNAMIC #include <dlldefs.h> -typedef int (*Builtin_f)(int, char**, void*); +typedef int (*Shbltin_f)(int, char**, void*); #else @@ -97,7 +99,7 @@ main(int argc, char** argv) register char* s; register char* t; void* dll; - Builtin_f fun; + Shbltin_f fun; char buf[64]; if (s = strrchr(argv[0], '/')) @@ -117,16 +119,16 @@ main(int argc, char** argv) { if (dll = dlopen(NiL, RTLD_LAZY)) { - if (fun = (Builtin_f)dlsym(dll, buf + 1)) + if (fun = (Shbltin_f)dlsym(dll, buf + 1)) break; - if (fun = (Builtin_f)dlsym(dll, buf)) + if (fun = (Shbltin_f)dlsym(dll, buf)) break; } if (dll = dllfind("cmd", NiL, RTLD_LAZY)) { - if (fun = (Builtin_f)dlsym(dll, buf + 1)) + if (fun = (Shbltin_f)dlsym(dll, buf + 1)) break; - if (fun = (Builtin_f)dlsym(dll, buf)) + if (fun = (Shbltin_f)dlsym(dll, buf)) break; } return 127; @@ -140,24 +142,12 @@ main(int argc, char** argv) #else #undef cmdinit +#ifdef _MSC_VER +#define CMD_CONTEXT(p) ((Shbltin_t*)(p)) #define cmdinit(a,b,c,d,e) do{if(_cmd_init(a,b,c,d,e))return -1;}while(0) - -#ifndef CMD_BUILTIN - -#undef cmdquit -#define cmdquit() (_cmd_quit) - -#if _BLD_cmd && defined(__EXPORT__) -#define extern extern __EXPORT__ -#endif -#if !_BLD_cmd && defined(__IMPORT__) -#define extern extern __IMPORT__ -#endif - -extern int _cmd_quit; - -#undef extern - +#else +#define CMD_CONTEXT(p) (((p)&&((Shbltin_t*)(p))->version>=20071012&&((Shbltin_t*)(p))->version<20350101)?((Shbltin_t*)(p)):0) +#define cmdinit(a,b,c,d,e) do{if((c)&&!CMD_CONTEXT(c))c=0;if(_cmd_init(a,b,c,d,e))return -1;}while(0) #endif #if _BLD_cmd && defined(__EXPORT__) diff --git a/usr/src/lib/libcmd/common/cmdinit.c b/usr/src/lib/libcmd/common/cmdinit.c index 0a8f4359c8..bd450ebf47 100644 --- a/usr/src/lib/libcmd/common/cmdinit.c +++ b/usr/src/lib/libcmd/common/cmdinit.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -25,19 +25,13 @@ #include <cmd.h> -int _cmd_quit = 0; - int _cmd_init(int argc, char** argv, void* context, const char* catalog, int flags) { register char* cp; if (argc < 0) - { - _cmd_quit = 1; return -1; - } - _cmd_quit = 0; if (cp = strrchr(argv[0], '/')) cp++; else diff --git a/usr/src/lib/libcmd/common/cmp.c b/usr/src/lib/libcmd/common/cmp.c index 3baebdd8da..06223f5695 100644 --- a/usr/src/lib/libcmd/common/cmp.c +++ b/usr/src/lib/libcmd/common/cmp.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/comm.c b/usr/src/lib/libcmd/common/comm.c index 3e28867e7e..347867d656 100644 --- a/usr/src/lib/libcmd/common/comm.c +++ b/usr/src/lib/libcmd/common/comm.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/cp.c b/usr/src/lib/libcmd/common/cp.c index 3aa6b75273..c3484b0cb0 100644 --- a/usr/src/lib/libcmd/common/cp.c +++ b/usr/src/lib/libcmd/common/cp.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -27,7 +27,7 @@ */ static const char usage_head[] = -"[-?@(#)$Id: cp (AT&T Research) 2006-11-21 $\n]" +"[-?@(#)$Id: cp (AT&T Research) 2007-12-13 $\n]" USAGE_LICENSE ; @@ -152,7 +152,6 @@ typedef struct State_s /* program state */ int missmode; /* default missing dir mode */ int official; /* move to next view */ int op; /* {CP,LN,MV} */ - int pathsiz; /* state.path buffer size */ int perm; /* permissions to preserve */ int postsiz; /* state.path post index */ int presiz; /* state.path pre index */ @@ -163,10 +162,15 @@ typedef struct State_s /* program state */ int uid; /* caller uid */ int update; /* replace only if newer */ int verbose; /* list each file before op */ + int wflags; /* open() for write flags */ int (*link)(const char*, const char*); /* link */ int (*stat)(const char*, struct stat*); /* stat */ +#define INITSTATE pathsiz /* (re)init state before this */ + int pathsiz; /* state.path buffer size */ + + char* path; /* to pathname buffer */ char* opname; /* state.op message string */ char* suffix; /* backup suffix */ @@ -229,8 +233,6 @@ visit(State_t* state, register FTSENT* ent) FTSENT* sub; struct stat st; - if (cmdquit()) - return -1; if (ent->fts_info == FTS_DC) { error(2, "%s: directory causes cycle", ent->fts_path); @@ -569,7 +571,7 @@ visit(State_t* state, register FTSENT* ent) error(ERROR_SYSTEM|2, "%s: cannot read", ent->fts_path); return 0; } - else if ((wfd = open(state->path, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, ent->fts_statp->st_mode & state->perm)) < 0) + else if ((wfd = open(state->path, st.st_mode ? (state->wflags & ~O_EXCL) : state->wflags, ent->fts_statp->st_mode & state->perm)) < 0) { error(ERROR_SYSTEM|2, "%s: cannot write", state->path); if (ent->fts_statp->st_size > 0) @@ -662,134 +664,144 @@ b_cp(int argc, register char** argv, void* context) int path_resolve; int standard; struct stat st; - State_t state; + State_t* state; + Shbltin_t* sh; cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_NOTIFY); - memset(&state, 0, sizeof(state)); - state.presiz = -1; + if (!(sh = CMD_CONTEXT(context)) || !(state = (State_t*)sh->ptr)) + { + if (!(state = newof(0, State_t, 1, 0))) + error(ERROR_SYSTEM|3, "out of space"); + if (sh) + sh->ptr = state; + } + else + memset(state, 0, offsetof(State_t, INITSTATE)); + state->presiz = -1; backup_type = 0; - state.flags = FTS_NOCHDIR|FTS_NOSEEDOTDIR; - state.uid = geteuid(); - if (!(state.tmp = sfstropen())) + state->flags = FTS_NOCHDIR|FTS_NOSEEDOTDIR; + state->uid = geteuid(); + state->wflags = O_WRONLY|O_CREAT|O_TRUNC|O_BINARY; + if (!state->tmp && !(state->tmp = sfstropen())) error(ERROR_SYSTEM|3, "out of space [tmp string]"); - sfputr(state.tmp, usage_head, -1); + sfputr(state->tmp, usage_head, -1); standard = !strcmp(astconf("CONFORMANCE", NiL, NiL), "standard"); switch (error_info.id[0]) { case 'c': case 'C': - sfputr(state.tmp, usage_cp, -1); - state.op = CP; - state.stat = stat; + sfputr(state->tmp, usage_cp, -1); + state->op = CP; + state->stat = stat; path_resolve = -1; break; case 'l': case 'L': - sfputr(state.tmp, usage_ln, -1); - state.op = LN; - state.flags |= FTS_PHYSICAL; - state.link = link; - state.stat = lstat; + sfputr(state->tmp, usage_ln, -1); + state->op = LN; + state->flags |= FTS_PHYSICAL; + state->link = link; + state->stat = lstat; path_resolve = 1; break; case 'm': case 'M': - sfputr(state.tmp, usage_mv, -1); - state.op = MV; - state.flags |= FTS_PHYSICAL; - state.preserve = 1; - state.stat = lstat; + sfputr(state->tmp, usage_mv, -1); + state->op = MV; + state->flags |= FTS_PHYSICAL; + state->preserve = 1; + state->stat = lstat; path_resolve = 1; break; default: error(3, "not implemented"); break; } - sfputr(state.tmp, usage_tail, -1); - if (!(usage = sfstruse(state.tmp))) - error(ERROR_SYSTEM|3, "%s: out of space", state.path); - state.opname = state.op == CP ? ERROR_translate(0, 0, 0, "overwrite") : ERROR_translate(0, 0, 0, "replace"); + sfputr(state->tmp, usage_tail, -1); + if (!(usage = sfstruse(state->tmp))) + error(ERROR_SYSTEM|3, "%s: out of space", state->path); + state->opname = state->op == CP ? ERROR_translate(0, 0, 0, "overwrite") : ERROR_translate(0, 0, 0, "replace"); for (;;) { switch (optget(argv, usage)) { case 'a': - state.flags |= FTS_PHYSICAL; - state.preserve = 1; - state.recursive = 1; + state->flags |= FTS_PHYSICAL; + state->preserve = 1; + state->recursive = 1; path_resolve = 1; continue; case 'b': - state.backup = 1; + state->backup = 1; continue; case 'f': - state.force = 1; - if (state.op != CP || !standard) - state.interactive = 0; + state->force = 1; + if (state->op != CP || !standard) + state->interactive = 0; continue; case 'h': - state.hierarchy = 1; + state->hierarchy = 1; continue; case 'i': - state.interactive = 1; - if (state.op != CP || !standard) - state.force = 0; + state->interactive = 1; + if (state->op != CP || !standard) + state->force = 0; continue; case 'l': - state.op = LN; - state.link = link; - state.stat = lstat; + state->op = LN; + state->link = link; + state->stat = lstat; continue; case 'p': - state.preserve = 1; + state->preserve = 1; continue; case 'r': - state.recursive = 1; + state->recursive = 1; if (path_resolve < 0) path_resolve = 0; continue; case 's': - state.op = LN; - state.link = pathsetlink; - state.stat = lstat; + state->op = LN; + state->link = pathsetlink; + state->stat = lstat; continue; case 'u': - state.update = 1; + state->update = 1; continue; case 'v': - state.verbose = 1; + state->verbose = 1; continue; case 'x': - state.flags |= FTS_XDEV; + state->flags |= FTS_XDEV; continue; case 'F': #if _lib_fsync - state.sync = 1; + state->sync = 1; #else error(1, "%s not implemented on this system", opt_info.name); #endif continue; case 'H': - state.flags |= FTS_META|FTS_PHYSICAL; + state->flags |= FTS_META|FTS_PHYSICAL; path_resolve = 1; continue; case 'L': - state.flags &= ~FTS_PHYSICAL; + state->flags &= ~FTS_PHYSICAL; path_resolve = 1; continue; case 'P': - state.flags &= ~FTS_META; - state.flags |= FTS_PHYSICAL; + state->flags &= ~FTS_META; + state->flags |= FTS_PHYSICAL; path_resolve = 1; continue; case 'R': - state.recursive = 1; - state.flags &= ~FTS_META; - state.flags |= FTS_PHYSICAL; + state->recursive = 1; + state->flags &= ~FTS_META; + state->flags |= FTS_PHYSICAL; path_resolve = 1; continue; case 'S': - state.suffix = opt_info.arg; + state->suffix = opt_info.arg; continue; case 'V': backup_type = opt_info.arg; @@ -814,15 +826,19 @@ b_cp(int argc, register char** argv, void* context) error(3, "out of space"); memcpy(v, argv, (argc + 1) * sizeof(char*)); argv = v; - if (!argc && !standard) + if (!standard) { - argc++; - argv[1] = (char*)dot; + state->wflags |= O_EXCL; + if (!argc) + { + argc++; + argv[1] = (char*)dot; + } } - if (state.backup) + if (state->backup) { if (!(file = backup_type) && !(backup_type = getenv("VERSION_CONTROL"))) - state.backup = BAK_existing; + state->backup = BAK_existing; else switch (strkey(backup_type)) { @@ -834,7 +850,7 @@ b_cp(int argc, register char** argv, void* context) case HASHKEY1('e'): case HASHKEY3('n','i','l'): case HASHKEY2('n','i'): - state.backup = BAK_existing; + state->backup = BAK_existing; break; case HASHKEY5('n','e','v','e','r'): case HASHKEY4('n','e','v','e'): @@ -846,7 +862,7 @@ b_cp(int argc, register char** argv, void* context) case HASHKEY3('s','i','m'): case HASHKEY2('s','i'): case HASHKEY1('s'): - state.backup = BAK_simple; + state->backup = BAK_simple; break; case HASHKEY6('n','u','m','b','e','r'): case HASHKEY5('n','u','m','b','e'): @@ -854,21 +870,21 @@ b_cp(int argc, register char** argv, void* context) case HASHKEY3('n','u','m'): case HASHKEY2('n','u'): case HASHKEY1('t'): - state.backup = BAK_number; + state->backup = BAK_number; break; default: if (file) error(2, "%s: unknown backup type", backup_type); break; } - if (!state.suffix && !(state.suffix = getenv("SIMPLE_BACKUP_SUFFIX"))) - state.suffix = "~"; - state.suflen = strlen(state.suffix); + if (!state->suffix && !(state->suffix = getenv("SIMPLE_BACKUP_SUFFIX"))) + state->suffix = "~"; + state->suflen = strlen(state->suffix); } if (argc <= 0 || error_info.errors) error(ERROR_USAGE|4, "%s", optusage(NiL)); if (!path_resolve) - state.flags |= fts_flags(); + state->flags |= fts_flags(); file = argv[argc]; argv[argc] = 0; if (s = strrchr(file, '/')) @@ -880,35 +896,34 @@ b_cp(int argc, register char** argv, void* context) } if (file != (char*)dot) pathcanon(file, 0); - if (!(state.directory = !stat(file, &st) && S_ISDIR(st.st_mode)) && argc > 1) + if (!(state->directory = !stat(file, &st) && S_ISDIR(st.st_mode)) && argc > 1) error(ERROR_USAGE|4, "%s", optusage(NiL)); - if (s && !state.directory) + if (s && !state->directory) error(3, "%s: not a directory", file); - if ((state.fs3d = fs3d(FS3D_TEST)) && strmatch(file, "...|*/...|.../*")) - state.official = 1; - state.postsiz = strlen(file); - state.pathsiz = roundof(state.postsiz + 2, PATH_CHUNK); - if (!(state.path = newof(0, char, state.pathsiz, 0))) + if ((state->fs3d = fs3d(FS3D_TEST)) && strmatch(file, "...|*/...|.../*")) + state->official = 1; + state->postsiz = strlen(file); + if (state->pathsiz < roundof(state->postsiz + 2, PATH_CHUNK) && !(state->path = newof(state->path, char, state->pathsiz = roundof(state->postsiz + 2, PATH_CHUNK), 0))) error(3, "out of space"); - memcpy(state.path, file, state.postsiz + 1); - if (state.directory && state.path[state.postsiz - 1] != '/') - state.path[state.postsiz++] = '/'; - if (state.hierarchy) + memcpy(state->path, file, state->postsiz + 1); + if (state->directory && state->path[state->postsiz - 1] != '/') + state->path[state->postsiz++] = '/'; + if (state->hierarchy) { - if (!state.directory) + if (!state->directory) error(3, "%s: last argument must be a directory", file); - state.missmode = st.st_mode; + state->missmode = st.st_mode; } - state.perm = state.uid ? S_IPERM : (S_IPERM & ~S_ISVTX); - if (!state.recursive) - state.flags |= FTS_TOP; - if (fts = fts_open(argv, state.flags, NiL)) + state->perm = state->uid ? S_IPERM : (S_IPERM & ~S_ISVTX); + if (!state->recursive) + state->flags |= FTS_TOP; + if (fts = fts_open(argv, state->flags, NiL)) { - while ((ent = fts_read(fts)) && !visit(&state, ent)); + while (!sh_checksig(context) && (ent = fts_read(fts)) && !visit(state, ent)); fts_close(fts); } - else if (state.link != pathsetlink) - switch (state.op) + else if (state->link != pathsetlink) + switch (state->op) { case CP: error(ERROR_SYSTEM|2, "%s: cannot copy", argv[0]); @@ -920,8 +935,7 @@ b_cp(int argc, register char** argv, void* context) error(ERROR_SYSTEM|2, "%s: cannot move", argv[0]); break; } - else if ((*state.link)(*argv, state.path)) - error(ERROR_SYSTEM|2, "%s: cannot link to %s", *argv, state.path); - free(state.path); + else if ((*state->link)(*argv, state->path)) + error(ERROR_SYSTEM|2, "%s: cannot link to %s", *argv, state->path); return error_info.errors != 0; } diff --git a/usr/src/lib/libcmd/common/cut.c b/usr/src/lib/libcmd/common/cut.c index 732d1784da..305ebdaf9d 100644 --- a/usr/src/lib/libcmd/common/cut.c +++ b/usr/src/lib/libcmd/common/cut.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -29,7 +29,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: cut (AT&T Research) 2007-01-23 $\n]" +"[-?\n@(#)$Id: cut (AT&T Research) 2008-04-01 $\n]" USAGE_LICENSE "[+NAME?cut - cut out selected columns or fields of each line of a file]" "[+DESCRIPTION?\bcut\b bytes, characters, or character-delimited fields " @@ -249,7 +249,7 @@ static int advance(const char *str, register int n, register int inlen) * cut each line of file <fdin> and put results to <fdout> using list <list> */ -static int cutcols(Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout) +static void cutcols(Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout) { register int c, ncol=0,len; register const int *lp = cuthdr->list; @@ -274,7 +274,7 @@ static int cutcols(Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout) ncol++; ncol -= c; if(!skip && sfwrite(fdout,(char*)inp,c)<0) - return(-1); + return; inp += c; if(ncol) break; @@ -285,7 +285,6 @@ static int cutcols(Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout) if(!cuthdr->nlflag && (skip || cuthdr->reclen)) sfputc(fdout,cuthdr->ldelim); } - return(c); } /* @@ -295,7 +294,7 @@ static int cutcols(Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout) #define endline(c) (((signed char)-1)<0?(c)<0:(c)==((char)-1)) -static int cutfields(Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout) +static void cutfields(Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout) { register unsigned char *cp; register int c, nfields; @@ -397,7 +396,7 @@ static int cutfields(Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout) goto failed; } /* see whether to save in tmp file */ - if(nodelim && inword && !cuthdr->sflag && (c=cp-first)>0) + if(inword && nodelim && !cuthdr->sflag && (c=cp-first)>0) { /* copy line to tmpfile in case no fields */ if(!fdtmp) @@ -409,7 +408,6 @@ static int cutfields(Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout) failed: if(fdtmp) sfclose(fdtmp); - return(0); } int @@ -506,7 +504,8 @@ b_cut(int argc,char *argv[], void* context) cutcols(cuthdr,fp,sfstdout); if(fp!=sfstdin) sfclose(fp); - } - while(cp= *argv++); + } while(cp = *argv++); + if (sfsync(sfstdout)) + error(ERROR_system(0), "write error"); return(error_info.errors?1:0); } diff --git a/usr/src/lib/libcmd/common/date.c b/usr/src/lib/libcmd/common/date.c index b2ea46d146..1984570b2d 100644 --- a/usr/src/lib/libcmd/common/date.c +++ b/usr/src/lib/libcmd/common/date.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: date (AT&T Research) 2007-03-28 $\n]" +"[-?\n@(#)$Id: date (AT&T Research) 2007-05-21 $\n]" USAGE_LICENSE "[+NAME?date - set/list/convert dates]" "[+DESCRIPTION?\bdate\b sets the current date and time (with appropriate" @@ -96,7 +96,7 @@ USAGE_LICENSE " [+e?blank padded day of month number]" " [+E?unpadded day of month number]" " [+f?locale default override date format]" -" [+F?locale default date format]" +" [+F?%ISO 8601:2000 standard date format; equivalent to Y-%m-%d]" " [+g?\bls\b(1) \b-l\b recent date with \ahh:mm\a]" " [+G?\bls\b(1) \b-l\b distant date with \ayyyy\a]" " [+h?abbreviated month name]" @@ -108,6 +108,7 @@ USAGE_LICENSE " [+k?\bdate\b(1) style date]" " [+K?all numeric date; equivalent to \b%Y-%m-%d+%H:%M:%S\b]" " [+l?\bls\b(1) \b-l\b date; equivalent to \b%Q/%g/%G/\b]" +" [+L?locale default date format]" " [+m?month number]" " [+M?minutes]" " [+n?newline character]" @@ -206,7 +207,7 @@ typedef struct Fmt */ static int -settime(const char* cmd, Time_t now, int adjust, int network) +settime(void* context, const char* cmd, Time_t now, int adjust, int network) { char* s; char** argv; @@ -222,13 +223,13 @@ settime(const char* cmd, Time_t now, int adjust, int network) *argv++ = s; if (streq(astconf("UNIVERSE", NiL, NiL), "att")) { - tmxfmt(buf, sizeof(buf), "%m%d%H" "%M" "%Y.%S", now); + tmxfmt(buf, sizeof(buf), "%m%d%H" "%M%Y.%S", now); if (adjust) *argv++ = "-a"; } else { - tmxfmt(buf, sizeof(buf), "%Y" "%m%d%H" "%M.%S", now); + tmxfmt(buf, sizeof(buf), "%Y%m%d%H" "%M.%S", now); if (network) *argv++ = "-n"; if (tm_info.flags & TM_UTC) @@ -236,7 +237,7 @@ settime(const char* cmd, Time_t now, int adjust, int network) } *argv++ = buf; *argv = 0; - if (!procrun(s, args)) + if (!sh_run(context, argv - args, args)) return 0; } return -1; @@ -473,7 +474,7 @@ b_date(int argc, register char** argv, void* context) tmxfmt(buf, sizeof(buf), format, now); sfprintf(sfstdout, "%s\n", buf); } - else if (settime(cmd, now, increment, network)) + else if (settime(context, cmd, now, increment, network)) error(ERROR_SYSTEM|3, "cannot set system time"); } while (fmts != &fmt) diff --git a/usr/src/lib/libcmd/common/dirname.c b/usr/src/lib/libcmd/common/dirname.c index f4a3c820c3..71e69d8594 100644 --- a/usr/src/lib/libcmd/common/dirname.c +++ b/usr/src/lib/libcmd/common/dirname.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/expr.c b/usr/src/lib/libcmd/common/expr.c index 1baee2435e..ff5d45e039 100644 --- a/usr/src/lib/libcmd/common/expr.c +++ b/usr/src/lib/libcmd/common/expr.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: expr (AT&T Research) 2004-05-27 $\n]" +"[-?\n@(#)$Id: expr (AT&T Research) 2008-01-30 $\n]" USAGE_LICENSE "[+NAME?expr - evaluate arguments as an expression]" "[+DESCRIPTION?\bexpr\b evaluates an expression given as arguments and writes " @@ -240,7 +240,7 @@ static int getnode(State_t* state, Node_t *np) if (!(cp = *state->arglist++)) error(ERROR_exit(2), "position argument expected"); i = strtol(cp, &ep, 10); - if (*ep || --i <= 0) + if (*ep || --i < 0) i = -1; if (!(cp = *state->arglist++)) error(ERROR_exit(2), "length argument expected"); diff --git a/usr/src/lib/libcmd/common/fds.c b/usr/src/lib/libcmd/common/fds.c index b7e9fb2e88..bafa2c09f7 100644 --- a/usr/src/lib/libcmd/common/fds.c +++ b/usr/src/lib/libcmd/common/fds.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -21,7 +21,7 @@ #pragma prototyped static const char usage[] = -"[-?\n@(#)$Id: fds (AT&T Research) 2006-10-26 $\n]" +"[-?\n@(#)$Id: fds (AT&T Research) 2008-08-26 $\n]" USAGE_LICENSE "[+NAME?fds - list open file descriptor status]" "[+DESCRIPTION?\bfds\b lists the status for each open file descriptor. " @@ -29,7 +29,7 @@ USAGE_LICENSE "calling shell, otherwise it lists the file descriptors passed across " "\bexec\b(2).]" "[l:long?List file descriptor details.]" -"[+SEE ALSO?\blogname\b(1), \bwho\b(1), \bgetgroups\b(2)]" +"[+SEE ALSO?\blogname\b(1), \bwho\b(1), \bgetgroups\b(2), \bgetsockname\b(2), \bgetsockopts\b(2)]" ; #include <cmd.h> @@ -52,6 +52,108 @@ USAGE_LICENSE #define major(x) (int)(((unsigned int)(x)>>8)&0xff) #endif +#undef getconf +#define getconf(x) strtol(astconf(x,NiL,NiL),NiL,0) + +#ifdef S_IFSOCK + +typedef struct NV_s +{ + const char* name; + int value; +} NV_t; + +static const NV_t family[] = +{ +#ifdef AF_LOCAL + "pipe", AF_LOCAL, +#endif +#ifdef AF_UNIX + "pipe", AF_UNIX, +#endif +#ifdef AF_FILE + "FILE", AF_FILE, +#endif +#ifdef AF_INET + "INET", AF_INET, +#endif +#ifdef AF_AX25 + "AX25", AF_AX25, +#endif +#ifdef AF_IPX + "IPX", AF_IPX, +#endif +#ifdef AF_APPLETALK + "APPLETALK", AF_APPLETALK, +#endif +#ifdef AF_NETROM + "NETROM", AF_NETROM, +#endif +#ifdef AF_BRIDGE + "BRIDGE", AF_BRIDGE, +#endif +#ifdef AF_ATMPVC + "ATMPVC", AF_ATMPVC, +#endif +#ifdef AF_X25 + "X25", AF_X25, +#endif +#ifdef AF_INET6 + "INET6", AF_INET6, +#endif +#ifdef AF_ROSE + "ROSE", AF_ROSE, +#endif +#ifdef AF_DECnet + "DECnet", AF_DECnet, +#endif +#ifdef AF_NETBEUI + "NETBEUI", AF_NETBEUI, +#endif +#ifdef AF_SECURITY + "SECURITY", AF_SECURITY, +#endif +#ifdef AF_KEY + "KEY", AF_KEY, +#endif +#ifdef AF_NETLINK + "NETLINK", AF_NETLINK, +#endif +#ifdef AF_ROUTE + "ROUTE", AF_ROUTE, +#endif +#ifdef AF_PACKET + "PACKET", AF_PACKET, +#endif +#ifdef AF_ASH + "ASH", AF_ASH, +#endif +#ifdef AF_ECONET + "ECONET", AF_ECONET, +#endif +#ifdef AF_ATMSVC + "ATMSVC", AF_ATMSVC, +#endif +#ifdef AF_SNA + "SNA", AF_SNA, +#endif +#ifdef AF_IRDA + "IRDA", AF_IRDA, +#endif +#ifdef AF_PPPOX + "PPPOX", AF_PPPOX, +#endif +#ifdef AF_WANPIPE + "WANPIPE", AF_WANPIPE, +#endif +#ifdef AF_BLUETOOTH + "BLUETOOTH", AF_BLUETOOTH, +#endif + 0 +}; + +#endif + int b_fds(int argc, char** argv, void* context) { @@ -61,13 +163,21 @@ b_fds(int argc, char** argv, void* context) register char* x; int flags; int details; + int open_max; struct stat st; #ifdef S_IFSOCK struct sockaddr_in addr; + char* a; + unsigned char* b; + unsigned char* e; + socklen_t addrlen; socklen_t len; int type; + int port; int prot; - char num[32]; + char nam[256]; + char num[64]; + char fam[64]; #endif cmdinit(argc, argv, context, ERROR_CATALOG, 0); @@ -91,78 +201,142 @@ b_fds(int argc, char** argv, void* context) argv += opt_info.index; if (error_info.errors || *argv) error(ERROR_USAGE|4, "%s", optusage(NiL)); - for (i = 0; i <= OPEN_MAX; i++) + if ((open_max = getconf("OPEN_MAX")) <= 0) + open_max = OPEN_MAX; + for (i = 0; i <= open_max; i++) + { if (fstat(i, &st)) - /* not open */; - else if (details) { - if ((flags = fcntl(i, F_GETFL, (char*)0)) == -1) - m = "--"; - else - switch (flags & (O_RDONLY|O_WRONLY|O_RDWR)) - { - case O_RDONLY: - m = "r-"; - break; - case O_WRONLY: - m = "-w"; - break; - case O_RDWR: - m = "rw"; - break; - default: - m = "??"; - break; - } - 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); + /* not open */ + continue; + } + if (!details) + { + sfprintf(sfstdout, "%d\n", i); + continue; + } + if ((flags = fcntl(i, F_GETFL, (char*)0)) == -1) + m = "--"; + else + switch (flags & (O_RDONLY|O_WRONLY|O_RDWR)) + { + case O_RDONLY: + m = "r-"; + break; + case O_WRONLY: + m = "-w"; + break; + case O_RDWR: + m = "rw"; + break; + default: + m = "??"; + break; + } + 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); + continue; + } #ifdef S_IFSOCK - else if ((len = sizeof(addr)) - && !getsockname(i, (struct sockaddr*)&addr, (void*)&len) - && len == sizeof(addr) - && addr.sin_family == AF_INET + addrlen = sizeof(addr); + memset(&addr, 0, addrlen); + if (!getsockname(i, (struct sockaddr*)&addr, (void*)&addrlen)) + { + type = 0; + prot = 0; #ifdef SO_TYPE - && (len = sizeof(type)) - && !getsockopt(i, SOL_SOCKET, SO_TYPE, (void*)&type, (void*)&len) - && len == sizeof(type) -#else - && !(type = 0) + len = sizeof(type); + if (getsockopt(i, SOL_SOCKET, SO_TYPE, (void*)&type, (void*)&len)) + type = -1; #endif #ifdef SO_PROTOTYPE - && (len = sizeof(prot)) - && (!getsockopt(i, SOL_SOCKET, SO_PROTOTYPE, (void*)&prot, (void*)&len) || !(prot = 0)) -#else - && !(prot = 0) + len = sizeof(prot); + if (getsockopt(i, SOL_SOCKET, SO_PROTOTYPE, (void*)&prot, (void*)&len)) + prot = -1; #endif - ) + if (!st.st_mode) + st.st_mode = S_IFSOCK|S_IRUSR|S_IWUSR; + s = 0; + switch (type) { - if (!st.st_mode) - st.st_mode = S_IFSOCK|S_IRUSR|S_IWUSR; - s = 0; - switch (type) + case SOCK_DGRAM: + switch (addr.sin_family) { - case SOCK_DGRAM: + case AF_INET: +#ifdef AF_INET6 + case AF_INET6: +#endif s = "udp"; break; - case SOCK_STREAM: - if (prot == 0) - s = "tcp"; + } + break; + case SOCK_STREAM: + switch (addr.sin_family) + { + case AF_INET: +#ifdef AF_INET6 + case AF_INET6: +#endif #ifdef IPPROTO_SCTP - else if (prot == IPPROTO_SCTP) + if (prot == IPPROTO_SCTP) s = "sctp"; + else #endif + s = "tcp"; break; } - if (!s) - sfprintf(sfstdout, s = num, "type.%d.prot.%d", type, prot); - sfprintf(sfstdout, "%02d %s%s %s /dev/%s/%s/%d\n", i, m, x, fmtmode(st.st_mode, 0), s, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); + break; +#ifdef SOCK_RAW + case SOCK_RAW: + s = "raw"; + break; +#endif +#ifdef SOCK_RDM + case SOCK_RDM: + s = "rdm"; + break; +#endif +#ifdef SOCK_SEQPACKET + case SOCK_SEQPACKET: + s = "seqpacket"; + break; +#endif } + if (!s) + { + for (type = 0; family[type].name && family[type].value != addr.sin_family; type++); + if (!(s = (char*)family[type].name)) + sfsprintf(s = num, sizeof(num), "family.%d", addr.sin_family); + } + port = 0; +#ifdef INET6_ADDRSTRLEN + if (a = (char*)inet_ntop(addr.sin_family, &addr.sin_addr, nam, sizeof(nam))) + port = ntohs(addr.sin_port); + else #endif + if (addr.sin_family == AF_INET) + { + a = inet_ntoa(addr.sin_addr); + port = ntohs(addr.sin_port); + } + else + { + a = fam; + e = (b = (unsigned char*)&addr) + addrlen; + while (b < e && a < &fam[sizeof(fam)-1]) + a += sfsprintf(a, &fam[sizeof(fam)] - a - 1, ".%d", *b++); + 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); else - 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(sfstdout, "%02d %s%s %s /dev/%s/%s\n", i, m, x, fmtmode(st.st_mode, 0), s, a); + continue; } - else - sfprintf(sfstdout, "%d\n", i); +#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); + } return 0; } diff --git a/usr/src/lib/libcmd/common/fmt.c b/usr/src/lib/libcmd/common/fmt.c index 2cbcc9c8ea..95f5fd4528 100644 --- a/usr/src/lib/libcmd/common/fmt.c +++ b/usr/src/lib/libcmd/common/fmt.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/fold.c b/usr/src/lib/libcmd/common/fold.c index 459ad35850..6541da8035 100644 --- a/usr/src/lib/libcmd/common/fold.c +++ b/usr/src/lib/libcmd/common/fold.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/getconf.c b/usr/src/lib/libcmd/common/getconf.c index d30d002c0b..bceae0e167 100644 --- a/usr/src/lib/libcmd/common/getconf.c +++ b/usr/src/lib/libcmd/common/getconf.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: getconf (AT&T Research) 2007-02-07 $\n]" +"[-?\n@(#)$Id: getconf (AT&T Research) 2008-04-24 $\n]" USAGE_LICENSE "[+NAME?getconf - get configuration values]" "[+DESCRIPTION?\bgetconf\b displays the system configuration value for" @@ -36,6 +36,8 @@ USAGE_LICENSE " directory if \apath\a is omitted. If \avalue\a is specified then" " \bgetconf\b attempts to change the process local value to \avalue\a." " \b-\b may be used in place of \apath\a when it is not relevant." +" If \apath\a is \b=\b then the the \avalue\a is cached and used" +" for subsequent tests in the calling and all child processes." " Only \bwritable\b variables may be set; \breadonly\b variables" " cannot be changed.]" "[+?The current value for \aname\a is written to the standard output. If" @@ -121,7 +123,7 @@ USAGE_LICENSE typedef struct Path_s { - char* path; + const char* path; int len; } Path_t; @@ -131,8 +133,8 @@ b_getconf(int argc, char** argv, void* context) register char* name; register char* path; register char* value; - register char* s; - register char* t; + register const char* s; + register const char* t; char* pattern; char* native; char* cmd; @@ -387,7 +389,8 @@ b_getconf(int argc, char** argv, void* context) * don't blame us for crappy diagnostics */ - if ((n = procrun(cmd, oargv)) >= EXIT_NOEXEC) + oargv[0] = cmd; + if ((n = sh_run(context, argc, oargv)) >= EXIT_NOEXEC) error(ERROR_SYSTEM|2, "%s: exec error [%d]", cmd, n); return n; } diff --git a/usr/src/lib/libcmd/common/head.c b/usr/src/lib/libcmd/common/head.c index 707d0478a8..cee683e81a 100644 --- a/usr/src/lib/libcmd/common/head.c +++ b/usr/src/lib/libcmd/common/head.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: head (AT&T Research) 2006-09-27 $\n]" +"[-n?\n@(#)$Id: head (AT&T Research) 2006-09-27 $\n]" USAGE_LICENSE "[+NAME?head - output beginning portion of one or more files ]" "[+DESCRIPTION?\bhead\b copies one or more input files to standard " diff --git a/usr/src/lib/libcmd/common/id.c b/usr/src/lib/libcmd/common/id.c index b880659ad5..a1820e3bf7 100644 --- a/usr/src/lib/libcmd/common/id.c +++ b/usr/src/lib/libcmd/common/id.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/join.c b/usr/src/lib/libcmd/common/join.c index 1687c898ca..12b40bc31b 100644 --- a/usr/src/lib/libcmd/common/join.c +++ b/usr/src/lib/libcmd/common/join.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -134,6 +134,7 @@ typedef struct int ignorecase; char* same; int samesize; + void* context; File_t file[2]; } Join_t; @@ -269,7 +270,7 @@ getrec(Join_t* jp, int index, int discard) register char* cp; register int n = 0; - if (cmdquit()) + if (sh_checksig(jp->context)) return 0; if (discard && fp->discard) sfraise(fp->iop, SFSK_DISCARD, NiL); @@ -666,6 +667,7 @@ b_join(int argc, char** argv, void* context) #endif if (!(jp = init())) error(ERROR_system(1),"out of space"); + jp->context = context; for (;;) { switch (n = optget(argv, usage)) diff --git a/usr/src/lib/libcmd/common/llib-lcmd b/usr/src/lib/libcmd/common/llib-lcmd index 8908e1c639..f87a732fa8 100644 --- a/usr/src/lib/libcmd/common/llib-lcmd +++ b/usr/src/lib/libcmd/common/llib-lcmd @@ -19,67 +19,15 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * lib/libcmd/common/llib-lcmd * */ -#pragma ident "%Z%%M% %I% %E% SMI" - /*LINTLIBRARY*/ /*PROTOLIB1*/ #include <cmd.h> #include <cmdext.h> - -/* automatically generated data start here */ -extern int STANDALONE(int, char**, void*); -extern int cmdrecurse(int, char**, int, char**); -extern int b_basename(int, char**, void*); -extern int b_cat(int, char**, void*); -extern int b_chgrp(int, char**, void*); -extern int b_chmod(int, char**, void*); -extern int b_chown(int, char**, void*); -extern int b_cmp(int, char**, void*); -extern int b_comm(int, char**, void*); -extern int b_cp(int, char**, void*); -extern int b_cut(int, char**, void*); -extern int b_date(int, char**, void*); -extern int b_dirname(int, char**, void*); -extern int b_expr(int, char**, void*); -extern int b_fds(int, char**, void*); -extern int b_fmt(int, char**, void*); -extern int b_fold(int, char**, void*); -extern int b_getconf(int, char**, void*); -extern int b_head(int, char**, void*); -extern int b_id(int, char**, void*); -extern int b_join(int, char**, void*); -extern int b_ln(int, char**, void*); -extern int b_logname(int, char**, void*); -extern int b_mkdir(int, char**, void*); -extern int b_mkfifo(int, char**, void*); -extern int b_mv(int, char**, void*); -extern int b_paste(int, char**, void*); -extern int b_pathchk(int, char**, void*); -extern int b_rev(int, char**, void*); -extern int b_rm(int, char**, void*); -extern int b_rmdir(int, char**, void*); -extern int b_stty(int, char**, void*); -extern int b_tail(int, char**, void*); -extern int b_tee(int, char**, void*); -extern int b_tty(int, char**, void*); -extern int b_uname(int, char**, void*); -extern int b_uniq(int, char**, void*); -extern int b_wc(int, char**, void*); -/* end of automatically generated data */ - -/* - * The |def*()| functions are the historical contents of Solaris - * libcmd. They have been moved to libc and libcmd contains only - * filter symbols for them, redirecting to libc. - */ -extern int defopen(char *fn); -extern char *defread(char *cp); -extern int defcntl(int cmd, int newflags); diff --git a/usr/src/lib/libcmd/common/ln.c b/usr/src/lib/libcmd/common/ln.c index 9adb32e3fd..90a6190504 100644 --- a/usr/src/lib/libcmd/common/ln.c +++ b/usr/src/lib/libcmd/common/ln.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/logname.c b/usr/src/lib/libcmd/common/logname.c index fe771e95ed..a142653345 100644 --- a/usr/src/lib/libcmd/common/logname.c +++ b/usr/src/lib/libcmd/common/logname.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/md5sum.c b/usr/src/lib/libcmd/common/md5sum.c index 11977d008e..f4f7e6ad9b 100644 --- a/usr/src/lib/libcmd/common/md5sum.c +++ b/usr/src/lib/libcmd/common/md5sum.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/mkdir.c b/usr/src/lib/libcmd/common/mkdir.c index df47adc11c..596ef2b6b8 100644 --- a/usr/src/lib/libcmd/common/mkdir.c +++ b/usr/src/lib/libcmd/common/mkdir.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: mkdir (AT&T Research) 2006-08-27 $\n]" +"[-?\n@(#)$Id: mkdir (AT&T Research) 2007-04-25 $\n]" USAGE_LICENSE "[+NAME?mkdir - make directories]" "[+DESCRIPTION?\bmkdir\b creates one or more directories. By " @@ -70,6 +70,7 @@ b_mkdir(int argc, char** argv, void* context) register int pflag = 0; char* name; mode_t dmode; + struct stat st; cmdinit(argc, argv, context, ERROR_CATALOG, 0); while (n = optget(argv, usage)) switch (n) @@ -142,7 +143,19 @@ b_mkdir(int argc, char** argv, void* context) error(ERROR_system(0), "%s:", name); break; } - *arg = n; + if (!(*arg = n) && (mode & (S_ISVTX|S_ISUID|S_ISGID))) + { + if (stat(name, &st)) + { + error(ERROR_system(0), "%s: cannot stat", name); + break; + } + if ((st.st_mode & (S_ISVTX|S_ISUID|S_ISGID)) != (mode & (S_ISVTX|S_ISUID|S_ISGID)) && chmod(name, mode)) + { + error(ERROR_system(0), "%s: cannot change mode from %s to %s", name, fmtperm(st.st_mode & (S_ISVTX|S_ISUID|S_ISGID)), fmtperm(mode)); + break; + } + } } } } diff --git a/usr/src/lib/libcmd/common/mkfifo.c b/usr/src/lib/libcmd/common/mkfifo.c index cffcab1e81..7bc56747f7 100644 --- a/usr/src/lib/libcmd/common/mkfifo.c +++ b/usr/src/lib/libcmd/common/mkfifo.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/mv.c b/usr/src/lib/libcmd/common/mv.c index cf4e6785dd..ec08bea2e4 100644 --- a/usr/src/lib/libcmd/common/mv.c +++ b/usr/src/lib/libcmd/common/mv.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/paste.c b/usr/src/lib/libcmd/common/paste.c index 5aaeb369ac..ce1dcef087 100644 --- a/usr/src/lib/libcmd/common/paste.c +++ b/usr/src/lib/libcmd/common/paste.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -29,7 +29,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: paste (AT&T Research) 1999-06-22 $\n]" +"[-?\n@(#)$Id: paste (AT&T Research) 2008-04-01 $\n]" USAGE_LICENSE "[+NAME?paste - merge lines of files]" "[+DESCRIPTION?\bpaste\b concatenates the corresponding lines of a " @@ -211,36 +211,24 @@ b_paste(int argc,register char *argv[], void* context) if(!cp || streq(cp,"-")) fp = sfstdin; else if(!(fp = sfopen(NiL,cp,"r"))) - { error(ERROR_system(0),"%s: cannot open",cp); - error_info.errors = 1; - } if(fp && sflag) { if(spaste(fp,sfstdout,delim,dlen) < 0) - { error(ERROR_system(0),"write failed"); - error_info.errors = 1; - } if(fp!=sfstdin) sfclose(fp); } - else + else if(!sflag) streams[n++] = fp; - } - while(cp= *argv++); + } while(cp= *argv++); if(!sflag) { if(error_info.errors==0 && paste(n,streams,sfstdout,delim,dlen) < 0) - { error(ERROR_system(0),"write failed"); - error_info.errors = 1; - } while(--n>=0) - { if((fp=streams[n]) && fp!=sfstdin) sfclose(fp); - } } return(error_info.errors); } diff --git a/usr/src/lib/libcmd/common/pathchk.c b/usr/src/lib/libcmd/common/pathchk.c index fff22f52bf..7b0151d69c 100644 --- a/usr/src/lib/libcmd/common/pathchk.c +++ b/usr/src/lib/libcmd/common/pathchk.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -78,9 +78,9 @@ USAGE_LICENSE */ static long mypathconf(const char *path, int op) { - register long r; + register long r; - static const char* ops[] = { "NAME_MAX", "PATH_MAX" }; + static const char* const ops[] = { "NAME_MAX", "PATH_MAX" }; errno=0; if((r=strtol(astconf(ops[op], path, NiL), NiL, 0))<0 && errno==0) diff --git a/usr/src/lib/libcmd/common/pids.c b/usr/src/lib/libcmd/common/pids.c new file mode 100644 index 0000000000..ca419850c1 --- /dev/null +++ b/usr/src/lib/libcmd/common/pids.c @@ -0,0 +1,120 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1992-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 * +* * +* Glenn Fowler <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +#define FORMAT "PID=%(pid)d PPID=%(ppid)d PGID=%(pgid)d TID=%(tid)d SID=%(sid)d" + +static const char usage[] = +"[-?\n@(#)$Id: pids (AT&T Research) 2008-04-01 $\n]" +USAGE_LICENSE +"[+NAME?pids - list calling shell process ids]" +"[+DESCRIPTION?When invoked as a shell builtin, \bpids\b lists one or " + "more of the calling process ids determined by \bgetpid\b(2), " + "\bgetppid\b(2), \bgetpgrp\b(2), \btcgetpgrp\b(2) and \bgetsid\b(2). " + "Unknown or invalid ids have the value \b-1\b.]" +"[f:format?List the ids specified by \aformat\a. \aformat\a follows " + "\bprintf\b(3) conventions, except that \bsfio\b(3) inline ids are used " + "instead of arguments: " + "%[-+]][\awidth\a[.\aprecis\a[.\abase\a]]]]]](\aid\a)\achar\a. The " + "supported \aid\as are:]:[format:=" FORMAT "]" + "{" + "[+pid?The process id.]" + "[+pgid?The process group id.]" + "[+ppid?The parent process id.]" + "[+tid|tty?The controlling terminal id.]" + "[+sid?The session id.]" + "}" +"[+SEE ALSO?\bgetpid\b(2), \bgetppid\b(2), \bgetpgrp\b(2), " + "\btcgetpgrp\b(2), \bgetsid\b(2)]" +; + +#include <cmd.h> +#include <ast_tty.h> +#include <sfdisc.h> + +/* + * sfkeyprintf() lookup + * handle==0 for heading + */ + +static int +key(void* handle, Sffmt_t* fp, const char* arg, char** ps, Sflong_t* pn) +{ + register char* s; + int fd; + long tid; + + if (!(s = fp->t_str) || streq(s, "pid")) + *pn = getpid(); + else if (streq(s, "pgid")) + *pn = getpgid(0); + else if (streq(s, "ppid")) + *pn = getppid(); + else if (streq(s, "tid") || streq(s, "tty")) + { + for (fd = 0; fd < 3; fd++) + if ((tid = tcgetpgrp(fd)) >= 0) + break; + *pn = tid; + } + else if (streq(s, "sid")) + *pn = getsid(0); + else if (streq(s, "format")) + *ps = (char*)handle; + else + { + error(2, "%s: unknown format identifier", s); + return 0; + } + return 1; +} + +int +b_pids(int argc, char** argv, void* context) +{ + char* format = 0; + + cmdinit(argc, argv, context, ERROR_CATALOG, 0); + for (;;) + { + switch (optget(argv, usage)) + { + case 'f': + format = opt_info.arg; + continue; + case '?': + error(ERROR_USAGE|4, "%s", opt_info.arg); + continue; + case ':': + error(2, "%s", opt_info.arg); + continue; + } + break; + } + argv += opt_info.index; + if (error_info.errors || *argv) + error(ERROR_USAGE|4, "%s", optusage(NiL)); + if (!format) + format = FORMAT; + sfkeyprintf(sfstdout, format, format, key, NiL); + sfprintf(sfstdout, "\n"); + return 0; +} diff --git a/usr/src/lib/libcmd/common/readlink.c b/usr/src/lib/libcmd/common/readlink.c new file mode 100644 index 0000000000..4fc6fcc666 --- /dev/null +++ b/usr/src/lib/libcmd/common/readlink.c @@ -0,0 +1,111 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1982-2007 AT&T Intellectual Property * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Intellectual Property * +* * +* A copy of the License is available at * +* http://www.opensource.org/licenses/cpl1.0.txt * +* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * +* * +* Information and Software Systems Research * +* AT&T Research * +* Florham Park NJ * +* * +* Glenn Fowler <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +static const char usage[] = +"[-?\n@(#)$Id: readlink (AT&T Research) 2008-06-08 $\n]" +USAGE_LICENSE +"[+NAME?readlink - read the contents of a symbolic link]" +"[+DESCRIPTION?\breadlink\b returns the contents of the symbolic " + "link referred to by the path argument. Unless the \b-f\b " + "option is specified an error will be returned when the path " + "is not a symbolic link.]" +"[f:canonicalize?The returned value will be an absolute pathname that names " + "the same file, whose resolution does not involve \".\", \"..\", or " + "symbolic links, otherwise only the exact (relative) value will be returned.]" +"[n:no-newline?Supress newline at the end.]" +"[v:verbose?Verbose - print errors.]" +"[+SEE ALSO?\bbasename\b(1),\bdirname\b(2),\breadlink\b(2),\breadpath\n(2)]" +; + +#include <cmd.h> + +int +b_readlink(int argc, char** argv, void* context) +{ + register char* s; + register int i; + register char* m; + register char* x; + int canonicalize = 0, + nonewline = 0, + verbose = 0; + char buf[PATH_MAX+2]; + int len = 0; + char *filename, + *resolvedname = NULL; + + cmdinit(argc, argv, context, ERROR_CATALOG, 0); + for (;;) + { + switch (optget(argv, usage)) + { + case 'f': + canonicalize = opt_info.num; + continue; + case 'n': + nonewline = opt_info.num; + continue; + case 'v': + verbose = opt_info.num; + continue; + case '?': + error(ERROR_usage(2), "%s", opt_info.arg); + continue; + case ':': + error(2, "%s", opt_info.arg); + continue; + } + break; + } + argv += opt_info.index; + argc -= opt_info.index; + if(error_info.errors || argc != 1) + error(ERROR_usage(2),"%s", optusage(NiL)); + filename = argv[0]; + + if (canonicalize) + { + len = resolvepath(filename, buf, sizeof(buf)-2); + } + else + { + len = readlink(filename, buf, sizeof(buf)-2); + } + + if (len != -1) + resolvedname = buf; + + if (!resolvedname) + { + if (verbose) + error(ERROR_system(1),"%s: readlink failed", filename); + else + return 1; + } + + if (!nonewline) + resolvedname[len++] = '\n'; + + sfwrite(sfstdout, resolvedname, len); + + return 0; +} diff --git a/usr/src/lib/libcmd/common/rev.c b/usr/src/lib/libcmd/common/rev.c index ce3f2ae425..3c63840bdb 100644 --- a/usr/src/lib/libcmd/common/rev.c +++ b/usr/src/lib/libcmd/common/rev.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -31,7 +31,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: rev (AT&T Research) 1999-04-10 $\n]" +"[-?\n@(#)$Id: rev (AT&T Research) 2007-11-29 $\n]" USAGE_LICENSE "[+NAME?rev - reverse the characters or lines of one or more files]" "[+DESCRIPTION?\brev\b copies one or more files to standard output " @@ -61,19 +61,51 @@ static int rev_char(Sfio_t *in, Sfio_t *out) { register int c; register char *ep, *bp, *cp; - register int n; - while(cp = bp = sfgetr(in,'\n',0)) + register wchar_t *wp, *xp; + register size_t n; + register size_t w; + if (mbwide()) { - ep = bp + (n=sfvalue(in)) -1; - while(ep > bp) + wp = 0; + w = 0; + while(cp = bp = sfgetr(in,'\n',0)) { - c = *--ep; - *ep = *bp; - *bp++ = c; + ep = bp + (n=sfvalue(in)) - 1; + if (n > w) + { + w = roundof(n + 1, 1024); + if (!(wp = newof(wp, wchar_t, w, 0))) + { + error(ERROR_SYSTEM|2, "out of space"); + return 0; + } + } + xp = wp; + while (cp < ep) + *xp++ = mbchar(cp); + cp = bp; + while (xp > wp) + cp += mbconv(cp, *--xp); + *cp++ = '\n'; + if (sfwrite(out, bp, cp - bp) < 0) + return -1; } - if(sfwrite(out,cp,n)<0) - return(-1); + if (wp) + free(wp); } + else + while(cp = bp = sfgetr(in,'\n',0)) + { + ep = bp + (n=sfvalue(in)) -1; + while(ep > bp) + { + c = *--ep; + *ep = *bp; + *bp++ = c; + } + if(sfwrite(out,cp,n)<0) + return(-1); + } return(0); } diff --git a/usr/src/lib/libcmd/common/rev.h b/usr/src/lib/libcmd/common/rev.h index 1ea6d55277..c23ffb381e 100644 --- a/usr/src/lib/libcmd/common/rev.h +++ b/usr/src/lib/libcmd/common/rev.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/revlib.c b/usr/src/lib/libcmd/common/revlib.c index 3693d15b2d..d95bbf0c80 100644 --- a/usr/src/lib/libcmd/common/revlib.c +++ b/usr/src/lib/libcmd/common/revlib.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/rm.c b/usr/src/lib/libcmd/common/rm.c index 62cf8a8b2f..d64d209b9d 100644 --- a/usr/src/lib/libcmd/common/rm.c +++ b/usr/src/lib/libcmd/common/rm.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: rm (AT&T Research) 2006-11-21 $\n]" +"[-?\n@(#)$Id: rm (AT&T Research) 2008-10-15 $\n]" USAGE_LICENSE "[+NAME?rm - remove files]" "[+DESCRIPTION?\brm\b removes the named \afile\a arguments. By default it" @@ -108,8 +108,6 @@ rm(State_t* state, register FTSENT* ent) int v; struct stat st; - if (cmdquit()) - return -1; if (ent->fts_info == FTS_NS || ent->fts_info == FTS_ERR || ent->fts_info == FTS_SLNONE) { if (!state->force) @@ -213,6 +211,8 @@ rm(State_t* state, register FTSENT* ent) if ((ent->fts_info == FTS_DC || state->directory) ? remove(path) : rmdir(path)) switch (errno) { + case ENOENT: + break; case EEXIST: #if defined(ENOTEMPTY) && (ENOTEMPTY) != (EEXIST) case ENOTEMPTY: @@ -316,10 +316,17 @@ rm(State_t* state, register FTSENT* ent) if (remove(path)) { nonempty(ent); - if (!state->force || state->interactive) - error(ERROR_SYSTEM|2, "%s: not removed", ent->fts_path); - else - error_info.errors++; + switch (errno) + { + case ENOENT: + break; + default: + if (!state->force || state->interactive) + error(ERROR_SYSTEM|2, "%s: not removed", ent->fts_path); + else + error_info.errors++; + break; + } } break; } @@ -403,7 +410,7 @@ b_rm(int argc, register char** argv, void* context) set3d = 0; if (fts = fts_open(argv, FTS_PHYSICAL, NiL)) { - while ((ent = fts_read(fts)) && !rm(&state, ent)); + while (!sh_checksig(context) && (ent = fts_read(fts)) && !rm(&state, ent)); fts_close(fts); } else if (!state.force) diff --git a/usr/src/lib/libcmd/common/rmdir.c b/usr/src/lib/libcmd/common/rmdir.c index 4edcda4df8..e6c370c436 100644 --- a/usr/src/lib/libcmd/common/rmdir.c +++ b/usr/src/lib/libcmd/common/rmdir.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/shcmd.h b/usr/src/lib/libcmd/common/shcmd.h new file mode 100644 index 0000000000..d355c7fd75 --- /dev/null +++ b/usr/src/lib/libcmd/common/shcmd.h @@ -0,0 +1,80 @@ +/*********************************************************************** +* * +* This software is part of the ast package * +* Copyright (c) 1992-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 * +* * +* Glenn Fowler <gsf@research.att.com> * +* David Korn <dgk@research.att.com> * +* * +***********************************************************************/ +#pragma prototyped + +/* + * ksh builtin command api + */ + +#ifndef _SHCMD_H +#define _SHCMD_H 1 + +#ifndef SH_VERSION +# define Shell_t void +#endif +#ifndef NV_DEFAULT +# define Namval_t void +#endif +#ifndef ERROR_NOTIFY +# define ERROR_NOTIFY 1 +#endif + +typedef int (*Shbltin_f)(int, char**, void*); + +#undef Shbltin_t +typedef struct Shbltin_s +{ + 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 +#endif + +#endif diff --git a/usr/src/lib/libcmd/common/stty.c b/usr/src/lib/libcmd/common/stty.c index ef53c61bf7..6868d3f326 100644 --- a/usr/src/lib/libcmd/common/stty.c +++ b/usr/src/lib/libcmd/common/stty.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -26,7 +26,7 @@ */ static const char usage[] = -"[-?@(#)$Id: stty (AT&T Research) 2006-10-31 $\n]" +"[-?@(#)$Id: stty (AT&T Research) 2008-04-01 $\n]" USAGE_LICENSE "[+NAME?stty - set or get terminal modes]" "[+DESCRIPTION?\bstty\b sets certain terminal I/O modes for the device " @@ -37,6 +37,7 @@ USAGE_LICENSE "[g:save?Writes the current settings to standard output in a form that can " "be used as an argument to another \bstty\b command. The \brows\b " "and \bcolumns\b values are not included.]" +"[t:terminal-group?Print the terminal group id of the device, -1 if unknown.]" "\n" "\n[mode ...]\n" "\n" @@ -57,7 +58,6 @@ USAGE_LICENSE "[+SEE ALSO?\btegetattr\b(2), \btcsetattr\b(2), \bioctl\b(2)]" ; - #include <cmd.h> #include <ccode.h> #include <ctype.h> @@ -83,6 +83,7 @@ USAGE_LICENSE /* command options */ #define A_FLAG 1 #define G_FLAG 2 +#define T_FLAG 4 /* termios fields */ #define C_FLAG 1 @@ -313,9 +314,15 @@ static const Tty_t Ttable[] = #endif #ifdef TABDLY { "tabs", TABS, O_FLAG, IG, TABDLY, TAB3, C("Preserve (expand to spaces) tabs") }, +#ifdef TAB0 { "tab0", BITS, O_FLAG, IG|SS, TABDLY, TAB0 }, +#endif +#ifdef TAB1 { "tab1", BITS, O_FLAG, US, TABDLY, TAB1 }, +#endif +#ifdef TAB2 { "tab2", BITS, O_FLAG, US, TABDLY, TAB2 }, +#endif { "tab3", BITS, O_FLAG, US, TABDLY, TAB3 }, #endif #ifdef BSDLY @@ -483,7 +490,7 @@ static void output(struct termios *sp, int flags) { case BIT: case BITS: - off = 1; + off = off2 = 1; switch(tp->field) { case C_FLAG: @@ -877,6 +884,15 @@ static int infof(Opt_t* op, Sfio_t* sp, const char* s, Optdisc_t* dp) return(1); } +#ifndef _lib_tcgetpgrp +# ifdef TIOCGPGRP + static int _i_; +# define tcgetpgrp(a) (ioctl(a, TIOCGPGRP, &_i_)>=0?_i_:-1) +# else +# define tcgetpgrp(a) (-1) +# endif /* TIOCGPGRP */ +#endif /* _lib_tcgetpgrp */ + int b_stty(int argc, char** argv, void* context) { @@ -897,6 +913,9 @@ b_stty(int argc, char** argv, void* context) { switch (n = optget(argv, usage)) { + case 't': + flags |= T_FLAG; + continue; case 'a': case 'g': if (!opt_info.offset || !argv[opt_info.index][opt_info.offset]) @@ -926,9 +945,11 @@ b_stty(int argc, char** argv, void* context) break; } argv += opt_info.index; - if (error_info.errors || (flags && *argv)) + if (error_info.errors || (flags && *argv) || (flags&(flags-1))) error(ERROR_usage(2), "%s", optusage(NiL)); - if (*argv) + if (flags & T_FLAG) + sfprintf(sfstdout, "%d\n", tcgetpgrp(0)); + else if (*argv) { if (!argv[1] && **argv == ':') gin(*argv, &tty); diff --git a/usr/src/lib/libcmd/common/sum.c b/usr/src/lib/libcmd/common/sum.c index 3fa2e520e2..da6dc6fa2a 100644 --- a/usr/src/lib/libcmd/common/sum.c +++ b/usr/src/lib/libcmd/common/sum.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/sync.c b/usr/src/lib/libcmd/common/sync.c index d977048766..8ddc855783 100644 --- a/usr/src/lib/libcmd/common/sync.c +++ b/usr/src/lib/libcmd/common/sync.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/tail.c b/usr/src/lib/libcmd/common/tail.c index 83de0f7c91..7eb012af7f 100644 --- a/usr/src/lib/libcmd/common/tail.c +++ b/usr/src/lib/libcmd/common/tail.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -395,7 +395,6 @@ b_tail(int argc, char** argv, void* context) } /*FALLTHROUGH*/ case 'n': - case 'N': flags |= COUNT; if (s = opt_info.arg) number = num(s, &s, &flags, n); diff --git a/usr/src/lib/libcmd/common/tee.c b/usr/src/lib/libcmd/common/tee.c index 243d6d0932..c1189bade7 100644 --- a/usr/src/lib/libcmd/common/tee.c +++ b/usr/src/lib/libcmd/common/tee.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: tee (AT&T Research) 2006-10-10 $\n]" +"[-?\n@(#)$Id: tee (AT&T Research) 2007-11-11 $\n]" USAGE_LICENSE "[+NAME?tee - duplicate standard input]" "[+DESCRIPTION?\btee\b copies standard input to standard output " @@ -129,17 +129,14 @@ b_tee(int argc, register char** argv, void* context) error(ERROR_usage(2), "%s", optusage(NiL)); argv += opt_info.index; argc -= opt_info.index; - - /* - * for backward compatibility - */ - +#if _ANCIENT_BSD_COMPATIBILITY if (*argv && streq(*argv, "-")) { signal(SIGINT, SIG_IGN); argv++; argc--; } +#endif if (argc > 0) { if (!(tp = (Tee_t*)stakalloc(sizeof(Tee_t) + argc * sizeof(int)))) diff --git a/usr/src/lib/libcmd/common/tty.c b/usr/src/lib/libcmd/common/tty.c index 22115b2343..4db11b9185 100644 --- a/usr/src/lib/libcmd/common/tty.c +++ b/usr/src/lib/libcmd/common/tty.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: tty (AT&T Research) 2007-03-11 $\n]" +"[-?\n@(#)$Id: tty (AT&T Research) 2008-03-13 $\n]" USAGE_LICENSE "[+NAME?tty - write the name of the terminal to standard output]" "[+DESCRIPTION?\btty\b writes the name of the terminal that is connected " @@ -84,11 +84,14 @@ b_tty(int argc, char *argv[], void* context) } if(!sflag) sfputr(sfstdout,tty,'\n'); + if(lflag) + { #if _mac_STWLINE - if(lflag && (n = ioctl(0, STWLINE, 0)) >= 0) - error(ERROR_OUTPUT, 1, "synchronous line %d", n); - else + if (n = ioctl(0, STWLINE, 0)) >= 0) + error(ERROR_OUTPUT, 1, "synchronous line %d", n); + else #endif - error(ERROR_OUTPUT, 1, "not on an active synchronous line"); + error(ERROR_OUTPUT, 1, "not on an active synchronous line"); + } return(error_info.errors); } diff --git a/usr/src/lib/libcmd/common/uname.c b/usr/src/lib/libcmd/common/uname.c index 97cdf9100f..72605200be 100644 --- a/usr/src/lib/libcmd/common/uname.c +++ b/usr/src/lib/libcmd/common/uname.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -28,7 +28,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: uname (AT&T Research) 2007-01-22 $\n]" +"[-?\n@(#)$Id: uname (AT&T Research) 2007-04-19 $\n]" USAGE_LICENSE "[+NAME?uname - identify the current system ]" "[+DESCRIPTION?By default \buname\b writes the operating system name to" @@ -61,7 +61,9 @@ USAGE_LICENSE "[f:list?List all \bsysinfo\b(2) names and values, one per line.]" "[S:sethost?Set the hostname or nodename to \aname\a. No output is" " written to standard output.]:[name]" - +"\n" +"\n[ name ... ]\n" +"\n" "[+SEE ALSO?\bhostname\b(1), \bgetconf\b(1), \buname\b(2)," " \bsysconf\b(2), \bsysinfo\b(2)]" ; @@ -327,7 +329,7 @@ b_uname(int argc, char** argv, void* context) if (!streq(argv[0], s) && (!eaccess(s, X_OK) || !eaccess(s+=4, X_OK))) { argv[0] = s; - return procrun(s, argv); + return sh_run(context, argc, argv); } error(2, "%s", opt_info.arg); break; @@ -367,7 +369,7 @@ b_uname(int argc, char** argv, void* context) while (t < e && (n = *s++)) *t++ = islower(n) ? toupper(n) : n; *t = 0; - sfprintf(sfstdout, "%s%c", *(t = astconf(buf, NiL, NiL)) ? t : "unknown", *argv ? ' ' : '\n'); + sfprintf(sfstdout, "%s%c", *(t = astconf(buf, NiL, NiL)) ? t : *(t = astconf(buf+3, NiL, NiL)) ? t : "unknown", *argv ? ' ' : '\n'); } } else diff --git a/usr/src/lib/libcmd/common/uniq.c b/usr/src/lib/libcmd/common/uniq.c index e6e0da4667..d49954a710 100644 --- a/usr/src/lib/libcmd/common/uniq.c +++ b/usr/src/lib/libcmd/common/uniq.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -26,7 +26,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: uniq (AT&T Research) 2006-08-28 $\n]" +"[-n?\n@(#)$Id: uniq (AT&T Research) 2008-04-24 $\n]" USAGE_LICENSE "[+NAME?uniq - Report or filter out repeated lines in a file]" "[+DESCRIPTION?\buniq\b reads an input, comparing adjacent lines, and " diff --git a/usr/src/lib/libcmd/common/wc.c b/usr/src/lib/libcmd/common/wc.c index 9d4b2567c7..763090fc02 100644 --- a/usr/src/lib/libcmd/common/wc.c +++ b/usr/src/lib/libcmd/common/wc.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/wc.h b/usr/src/lib/libcmd/common/wc.h index 0296a898f8..2752af36a3 100644 --- a/usr/src/lib/libcmd/common/wc.h +++ b/usr/src/lib/libcmd/common/wc.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libcmd/common/wclib.c b/usr/src/lib/libcmd/common/wclib.c index c16e4efc87..67adb5fe15 100644 --- a/usr/src/lib/libcmd/common/wclib.c +++ b/usr/src/lib/libcmd/common/wclib.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -30,7 +30,7 @@ #include <wc.h> #include <ctype.h> -#if _hdr_wchar && _hdr_wctype +#if _hdr_wchar && _hdr_wctype && _lib_iswctype #include <wchar.h> #include <wctype.h> diff --git a/usr/src/lib/libcmd/i386/include/ast/cmd.h b/usr/src/lib/libcmd/i386/include/ast/cmd.h index 2484c17c5a..9ac1c90993 100644 --- a/usr/src/lib/libcmd/i386/include/ast/cmd.h +++ b/usr/src/lib/libcmd/i386/include/ast/cmd.h @@ -3,10 +3,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -40,9 +40,9 @@ #include <ast.h> #include <error.h> #include <stak.h> +#include <shcmd.h> #define cmdinit _cmd_init -#define cmdquit() 0 #if _BLD_cmd && defined(__EXPORT__) #undef __MANGLE__ @@ -60,11 +60,13 @@ #ifdef CMD_STANDALONE +#define CMD_CONTEXT(c) ((Shbltin_t*)0) + #if CMD_DYNAMIC #include <dlldefs.h> -typedef int (*Builtin_f) __PROTO__((int, char**, __V_*)); +typedef int (*Shbltin_f) __PROTO__((int, char**, __V_*)); #else @@ -106,7 +108,7 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** register char* s; register char* t; __V_* dll; - Builtin_f fun; + Shbltin_f fun; char buf[64]; if (s = strrchr(argv[0], '/')) @@ -126,16 +128,16 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** { if (dll = dlopen(NiL, RTLD_LAZY)) { - if (fun = (Builtin_f)dlsym(dll, buf + 1)) + if (fun = (Shbltin_f)dlsym(dll, buf + 1)) break; - if (fun = (Builtin_f)dlsym(dll, buf)) + if (fun = (Shbltin_f)dlsym(dll, buf)) break; } if (dll = dllfind("cmd", NiL, RTLD_LAZY)) { - if (fun = (Builtin_f)dlsym(dll, buf + 1)) + if (fun = (Shbltin_f)dlsym(dll, buf + 1)) break; - if (fun = (Builtin_f)dlsym(dll, buf)) + if (fun = (Shbltin_f)dlsym(dll, buf)) break; } return 127; @@ -149,27 +151,12 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** #else #undef cmdinit +#ifdef _MSC_VER +#define CMD_CONTEXT(p) ((Shbltin_t*)(p)) #define cmdinit(a,b,c,d,e) do{if(_cmd_init(a,b,c,d,e))return -1;}while(0) - -#ifndef CMD_BUILTIN - -#undef cmdquit -#define cmdquit() (_cmd_quit) - -#if _BLD_cmd && defined(__EXPORT__) -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ __EXPORT__ -#endif -#if !_BLD_cmd && defined(__IMPORT__) -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ __IMPORT__ -#endif - -extern __MANGLE__ int _cmd_quit; - -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ - +#else +#define CMD_CONTEXT(p) (((p)&&((Shbltin_t*)(p))->version>=20071012&&((Shbltin_t*)(p))->version<20350101)?((Shbltin_t*)(p)):0) +#define cmdinit(a,b,c,d,e) do{if((c)&&!CMD_CONTEXT(c))c=0;if(_cmd_init(a,b,c,d,e))return -1;}while(0) #endif #if _BLD_cmd && defined(__EXPORT__) diff --git a/usr/src/lib/libcmd/i386/include/ast/cmdext.h b/usr/src/lib/libcmd/i386/include/ast/cmdext.h index b5c58b5d04..602f8d7a7d 100644 --- a/usr/src/lib/libcmd/i386/include/ast/cmdext.h +++ b/usr/src/lib/libcmd/i386/include/ast/cmdext.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -55,6 +55,7 @@ extern __MANGLE__ int b_mkfifo __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_rm __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rmdir __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 214990e44d..91fb2f255e 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_20070418/build_i386_32bit/src/lib/libcmd/features/ids by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libcmd/features/ids by iffe version 2008-01-31 : : */ #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_20070418/build_i386_32bit/arch/sol11.i386/lib/libast.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_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 f5b9d0855b..1b4d8b6101 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_20070418/build_i386_32bit/src/lib/libcmd/features/sockets by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libcmd/features/sockets by iffe version 2008-01-31 : : */ #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_20070418/build_i386_32bit/arch/sol11.i386/lib/libast.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_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 59beb5bfe8..15284effed 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_20070418/build_i386_32bit/src/lib/libcmd/features/symlink by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libcmd/features/symlink by iffe version 2008-01-31 : : */ #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_20070418/build_i386_32bit/arch/sol11.i386/lib/libast.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_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 e1cf94aa4b..240a52a974 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_20070418/build_i386_32bit/src/lib/libcmd/features/utsname by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_i386_32bit/src/lib/libcmd/features/utsname by iffe version 2008-01-31 : : */ #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_20070418/build_i386_32bit/arch/sol11.i386/lib/libast.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_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 373f2bc8ac..ab98659ec7 100644 --- a/usr/src/lib/libcmd/mapfile-vers +++ b/usr/src/lib/libcmd/mapfile-vers @@ -20,18 +20,19 @@ # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# # functions by AST/ksh93's version of libcmd SUNWprivate_1.1 { global: + _cmd_init; + b_basename; b_cat; b_chgrp; + b_cksum; b_chmod; b_chown; b_cmp; @@ -50,15 +51,19 @@ SUNWprivate_1.1 { b_join; b_ln; b_logname; + b_md5sum; b_mkdir; b_mkfifo; b_mv; b_paste; b_pathchk; + b_pids; + b_readlink; b_rev; b_rm; b_rmdir; b_stty; + b_sum; b_sync; b_tail; b_tee; diff --git a/usr/src/lib/libcmd/sparc/include/ast/cmd.h b/usr/src/lib/libcmd/sparc/include/ast/cmd.h index 2484c17c5a..9ac1c90993 100644 --- a/usr/src/lib/libcmd/sparc/include/ast/cmd.h +++ b/usr/src/lib/libcmd/sparc/include/ast/cmd.h @@ -3,10 +3,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -40,9 +40,9 @@ #include <ast.h> #include <error.h> #include <stak.h> +#include <shcmd.h> #define cmdinit _cmd_init -#define cmdquit() 0 #if _BLD_cmd && defined(__EXPORT__) #undef __MANGLE__ @@ -60,11 +60,13 @@ #ifdef CMD_STANDALONE +#define CMD_CONTEXT(c) ((Shbltin_t*)0) + #if CMD_DYNAMIC #include <dlldefs.h> -typedef int (*Builtin_f) __PROTO__((int, char**, __V_*)); +typedef int (*Shbltin_f) __PROTO__((int, char**, __V_*)); #else @@ -106,7 +108,7 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** register char* s; register char* t; __V_* dll; - Builtin_f fun; + Shbltin_f fun; char buf[64]; if (s = strrchr(argv[0], '/')) @@ -126,16 +128,16 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** { if (dll = dlopen(NiL, RTLD_LAZY)) { - if (fun = (Builtin_f)dlsym(dll, buf + 1)) + if (fun = (Shbltin_f)dlsym(dll, buf + 1)) break; - if (fun = (Builtin_f)dlsym(dll, buf)) + if (fun = (Shbltin_f)dlsym(dll, buf)) break; } if (dll = dllfind("cmd", NiL, RTLD_LAZY)) { - if (fun = (Builtin_f)dlsym(dll, buf + 1)) + if (fun = (Shbltin_f)dlsym(dll, buf + 1)) break; - if (fun = (Builtin_f)dlsym(dll, buf)) + if (fun = (Shbltin_f)dlsym(dll, buf)) break; } return 127; @@ -149,27 +151,12 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** #else #undef cmdinit +#ifdef _MSC_VER +#define CMD_CONTEXT(p) ((Shbltin_t*)(p)) #define cmdinit(a,b,c,d,e) do{if(_cmd_init(a,b,c,d,e))return -1;}while(0) - -#ifndef CMD_BUILTIN - -#undef cmdquit -#define cmdquit() (_cmd_quit) - -#if _BLD_cmd && defined(__EXPORT__) -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ __EXPORT__ -#endif -#if !_BLD_cmd && defined(__IMPORT__) -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ __IMPORT__ -#endif - -extern __MANGLE__ int _cmd_quit; - -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ - +#else +#define CMD_CONTEXT(p) (((p)&&((Shbltin_t*)(p))->version>=20071012&&((Shbltin_t*)(p))->version<20350101)?((Shbltin_t*)(p)):0) +#define cmdinit(a,b,c,d,e) do{if((c)&&!CMD_CONTEXT(c))c=0;if(_cmd_init(a,b,c,d,e))return -1;}while(0) #endif #if _BLD_cmd && defined(__EXPORT__) diff --git a/usr/src/lib/libcmd/sparc/include/ast/cmdext.h b/usr/src/lib/libcmd/sparc/include/ast/cmdext.h index b5c58b5d04..602f8d7a7d 100644 --- a/usr/src/lib/libcmd/sparc/include/ast/cmdext.h +++ b/usr/src/lib/libcmd/sparc/include/ast/cmdext.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -55,6 +55,7 @@ extern __MANGLE__ int b_mkfifo __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_rm __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rmdir __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 ee06a813a2..3ce04f892b 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_20070418/build_sparc_32bit/src/lib/libcmd/features/ids by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libcmd/features/ids by iffe version 2008-01-31 : : */ #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_20070418/build_sparc_32bit/arch/sol11.sun4/lib/libast.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_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 9fbdd78fe1..bcb69bfd42 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_20070418/build_sparc_32bit/src/lib/libcmd/features/sockets by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libcmd/features/sockets by iffe version 2008-01-31 : : */ #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_20070418/build_sparc_32bit/arch/sol11.sun4/lib/libast.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_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 c06b9a3e85..a5426021fe 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_20070418/build_sparc_32bit/src/lib/libcmd/features/symlink by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libcmd/features/symlink by iffe version 2008-01-31 : : */ #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_20070418/build_sparc_32bit/arch/sol11.sun4/lib/libast.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_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 37720b4530..d2bf7024f7 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_20070418/build_sparc_32bit/src/lib/libcmd/features/utsname by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_32bit/src/lib/libcmd/features/utsname by iffe version 2008-01-31 : : */ #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_20070418/build_sparc_32bit/arch/sol11.sun4/lib/libast.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_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 2484c17c5a..9ac1c90993 100644 --- a/usr/src/lib/libcmd/sparcv9/include/ast/cmd.h +++ b/usr/src/lib/libcmd/sparcv9/include/ast/cmd.h @@ -3,10 +3,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -40,9 +40,9 @@ #include <ast.h> #include <error.h> #include <stak.h> +#include <shcmd.h> #define cmdinit _cmd_init -#define cmdquit() 0 #if _BLD_cmd && defined(__EXPORT__) #undef __MANGLE__ @@ -60,11 +60,13 @@ #ifdef CMD_STANDALONE +#define CMD_CONTEXT(c) ((Shbltin_t*)0) + #if CMD_DYNAMIC #include <dlldefs.h> -typedef int (*Builtin_f) __PROTO__((int, char**, __V_*)); +typedef int (*Shbltin_f) __PROTO__((int, char**, __V_*)); #else @@ -106,7 +108,7 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** register char* s; register char* t; __V_* dll; - Builtin_f fun; + Shbltin_f fun; char buf[64]; if (s = strrchr(argv[0], '/')) @@ -126,16 +128,16 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** { if (dll = dlopen(NiL, RTLD_LAZY)) { - if (fun = (Builtin_f)dlsym(dll, buf + 1)) + if (fun = (Shbltin_f)dlsym(dll, buf + 1)) break; - if (fun = (Builtin_f)dlsym(dll, buf)) + if (fun = (Shbltin_f)dlsym(dll, buf)) break; } if (dll = dllfind("cmd", NiL, RTLD_LAZY)) { - if (fun = (Builtin_f)dlsym(dll, buf + 1)) + if (fun = (Shbltin_f)dlsym(dll, buf + 1)) break; - if (fun = (Builtin_f)dlsym(dll, buf)) + if (fun = (Shbltin_f)dlsym(dll, buf)) break; } return 127; @@ -149,27 +151,12 @@ main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** #else #undef cmdinit +#ifdef _MSC_VER +#define CMD_CONTEXT(p) ((Shbltin_t*)(p)) #define cmdinit(a,b,c,d,e) do{if(_cmd_init(a,b,c,d,e))return -1;}while(0) - -#ifndef CMD_BUILTIN - -#undef cmdquit -#define cmdquit() (_cmd_quit) - -#if _BLD_cmd && defined(__EXPORT__) -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ __EXPORT__ -#endif -#if !_BLD_cmd && defined(__IMPORT__) -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ __IMPORT__ -#endif - -extern __MANGLE__ int _cmd_quit; - -#undef __MANGLE__ -#define __MANGLE__ __LINKAGE__ - +#else +#define CMD_CONTEXT(p) (((p)&&((Shbltin_t*)(p))->version>=20071012&&((Shbltin_t*)(p))->version<20350101)?((Shbltin_t*)(p)):0) +#define cmdinit(a,b,c,d,e) do{if((c)&&!CMD_CONTEXT(c))c=0;if(_cmd_init(a,b,c,d,e))return -1;}while(0) #endif #if _BLD_cmd && defined(__EXPORT__) diff --git a/usr/src/lib/libcmd/sparcv9/include/ast/cmdext.h b/usr/src/lib/libcmd/sparcv9/include/ast/cmdext.h index b5c58b5d04..602f8d7a7d 100644 --- a/usr/src/lib/libcmd/sparcv9/include/ast/cmdext.h +++ b/usr/src/lib/libcmd/sparcv9/include/ast/cmdext.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1992-2007 AT&T Knowledge Ventures * +* Copyright (c) 1992-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -55,6 +55,7 @@ extern __MANGLE__ int b_mkfifo __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_rm __PROTO__((int, char**, __V_*)); extern __MANGLE__ int b_rmdir __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 d74a8c699f..8654d20bb5 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_20070418/build_sparc_64bit/src/lib/libcmd/features/ids by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libcmd/features/ids by iffe version 2008-01-31 : : */ #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_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.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_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 00732f6357..75613c1ffb 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_20070418/build_sparc_64bit/src/lib/libcmd/features/sockets by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libcmd/features/sockets by iffe version 2008-01-31 : : */ #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_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.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_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 d62a9cabae..0fddf44f02 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_20070418/build_sparc_64bit/src/lib/libcmd/features/symlink by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libcmd/features/symlink by iffe version 2008-01-31 : : */ #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_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.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_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 51d38ec3c0..cdf393a6f0 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_20070418/build_sparc_64bit/src/lib/libcmd/features/utsname by iffe version 2007-04-04 : : */ +/* : : generated from /home/gisburn/ksh93/ast_ksh_20081104/build_sparc_64bit/src/lib/libcmd/features/utsname by iffe version 2008-01-31 : : */ #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_20070418/build_sparc_64bit/arch/sol11.sun4/lib/libast.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_m 1 /* -lm is a library */ #define _lib_getdomainname 1 /* getdomainname() in default lib(s) */ #define _lib_gethostid 1 /* gethostid() in default lib(s) */ |