dtksh: Upgrade ksh93 to 1.0.0-beta.2 2021-12-28
Patch from current ksh93 maintainer <https://github.com/ksh93/ksh>. cde/programs/dtksh/ksh93/**: - Upgraded. A load of bugs fixed, some minor features added. See NEWS from 2021-02-01 upwards. cde/programs/dtksh/Makefile.am: - Don't cd into ksh93 any more to invoke the package or shtests scripts; they now automatically find their directories. - Pass $(CFLAGS) to build ksh with optimisation. - Remove -D_std_malloc flag as vmalloc is now deprecated and disabled by default. - Add a 'make check' target to Makefile.am that runs the ksh93 regression tests on dtksh to make sure the additions don't interfere with anything. It skips running the tests with shcomp because CDE doesn't use that. The tests all pass here on Slackware 14.2. :-) cde/programs/dtksh/init.patch: - Removed; I've upstreamed it. It was the only one that wasn't upstreamed yet, and more code cleanups are coming, breaking downstream patches. If something needs updating, just email me a diff. cde/programs/dtksh/dtkcmds.h: - Update the ADDBUILTIN macro to remove the __PROTO__ macro use. The proto(1) tool, responsible for all such pre-C89 K&R C compatibility voodoo, has been removed, so that macro is no longer defined. cde/programs/dtksh/setup.sh: - Workaround script removed. I rewrote 'bin/package flat make' in a way that works correctly and changed Makefile.am to use that instead. Hope this helps. Happy new year.
This commit is contained in:
committed by
Jon Trulson
parent
d5e651ecf3
commit
bf00d3b274
@@ -10,50 +10,17 @@ note * http://web.archive.org/web/20041227143022/http://www2.research.att.com/~g
|
||||
note *
|
||||
setv INSTALLROOT ../../..
|
||||
setv PACKAGE_ast_INCLUDE ${INSTALLROOT}/include/ast
|
||||
setv PACKAGE_ast_LIB ${INSTALLROOT}/lib
|
||||
setv PACKAGE_cmd ${INSTALLROOT}
|
||||
setv PACKAGE_cmd_INCLUDE ${PACKAGE_cmd}/include
|
||||
setv PACKAGE_cmd_LIB ${PACKAGE_cmd}/lib
|
||||
setv PACKAGEROOT ../../../../..
|
||||
setv AR ${mam_cc_AR} ${mam_cc_AR_ARFLAGS}
|
||||
setv ARFLAGS rc
|
||||
setv AS as
|
||||
setv ASFLAGS
|
||||
setv CC cc
|
||||
setv mam_cc_FLAGS
|
||||
setv KSH_RELFLAGS
|
||||
setv CCFLAGS ${-debug-symbols?1?${mam_cc_DEBUG} -D_BLD_DEBUG?${mam_cc_OPTIMIZE}?}
|
||||
setv CCLDFLAGS ${-strip-symbols?1?${mam_cc_LD_STRIP}??}
|
||||
setv COTEMP $$
|
||||
setv CPIO cpio
|
||||
setv CPIOFLAGS
|
||||
setv CPP "${CC} -E"
|
||||
setv F77 f77
|
||||
setv HOSTCC ${CC}
|
||||
setv IFFEFLAGS
|
||||
setv IGNORE
|
||||
setv LD ld
|
||||
setv LDFLAGS
|
||||
setv LEX lex
|
||||
setv LEXFLAGS
|
||||
setv LPR lpr
|
||||
setv LPRFLAGS
|
||||
setv M4FLAGS
|
||||
setv NMAKE nmake
|
||||
setv NMAKEFLAGS
|
||||
setv PR pr
|
||||
setv PRFLAGS
|
||||
setv SHELL /bin/sh
|
||||
setv SILENT
|
||||
setv TAR tar
|
||||
setv YACC yacc
|
||||
setv YACCFLAGS -d
|
||||
make ${PACKAGEROOT}/lib/package/ast.lic
|
||||
done ${PACKAGEROOT}/lib/package/ast.lic
|
||||
make .INIT
|
||||
make ${PACKAGE_ast_INCLUDE}/cmdlist.h
|
||||
make ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
|
||||
done ${PACKAGE_ast_INCLUDE}/prototyped.h dontcare
|
||||
done ${PACKAGE_ast_INCLUDE}/cmdlist.h
|
||||
exec - sed -e '/^CMDLIST(.*)$/!d' -e 's/CMDLIST(\(.*\))/\1/' -e '/^getconf$/d' -e '/^ln$/d' -e '/^mv$/d' -e '/^md5sum$/d' -e '/^sum$/d' ${PACKAGE_ast_INCLUDE}/cmdlist.h
|
||||
bind -lcmd
|
||||
@@ -66,7 +33,7 @@ make install
|
||||
meta FEATURE/pty features/%>FEATURE/% features/pty pty
|
||||
make features/pty
|
||||
done features/pty
|
||||
exec - iffe ${IFFEFLAGS} -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} -lm' ref ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} -I${INSTALLROOT}/include ${mam_libast} ${mam_libcmd} : run features/pty
|
||||
exec - iffe ${IFFEFLAGS} -v -c "${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${CCFLAGS} ${LDFLAGS}" ref ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} -I${INSTALLROOT}/include ${mam_libast} ${mam_libcmd} : run features/pty
|
||||
done FEATURE/pty generated
|
||||
make ${PACKAGE_ast_INCLUDE}/ast_time.h implicit
|
||||
done ${PACKAGE_ast_INCLUDE}/ast_time.h
|
||||
@@ -74,19 +41,15 @@ make install
|
||||
prev ${PACKAGE_ast_INCLUDE}/regex.h implicit
|
||||
make ${PACKAGE_ast_INCLUDE}/proc.h implicit
|
||||
prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
|
||||
prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
|
||||
done ${PACKAGE_ast_INCLUDE}/proc.h
|
||||
prev ${PACKAGE_ast_INCLUDE}/error.h implicit
|
||||
prev ${PACKAGE_ast_INCLUDE}/cmd.h implicit
|
||||
done pty.c
|
||||
meta pty.o %.c>%.o pty.c pty
|
||||
prev pty.c
|
||||
setv CMD_STANDALONE -DCMD_STANDALONE="b_pty"
|
||||
setv LICENSE -DLICENSE="since=2001,author=gsf+dgk"
|
||||
exec - ${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DERROR_CATALOG=\""builtin"\" -D_PACKAGE_ast -DCMD_STANDALONE=b_pty -DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf@research.att.com>][-author?David Korn <dgk@research.att.com>][-copyright?Copyright (c) 2001-2012 AT&T Intellectual Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?builtin]"\" -c pty.c
|
||||
exec - ${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} -DERROR_CATALOG=\""builtin"\" -D_PACKAGE_ast -DCMD_STANDALONE=b_pty -c pty.c
|
||||
done pty.o generated
|
||||
bind -lutil dontcare
|
||||
setv CMD_STANDALONE -DCMD_STANDALONE="b_pty"
|
||||
exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${CCFLAGS} ${LDFLAGS} -lm ${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -o pty pty.o ${mam_libutil} ${mam_libast} ${mam_libcmd}
|
||||
done pty generated
|
||||
make ${INSTALLROOT}/bin
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
10-04-01 pty: add --tty='stty-settings'
|
||||
10-03-19 pty: add --dialogue
|
||||
10-03-15 pty: fix select() fd management
|
||||
09-03-31 features/pty,Makefile: add pty.h and -lutil refs for linux -- great, another util library
|
||||
09-03-31 features/pty,Makefile: add pty.h and -lutil refs for Linux -- great, another util library
|
||||
09-01-30 pty.c: add <ast_time.h> (for fd_set!! on mvs.390)
|
||||
06-07-20 pty.c: add
|
||||
|
||||
7
cde/programs/dtksh/ksh93/src/cmd/builtin/features/pty
Executable file → Normal file
7
cde/programs/dtksh/ksh93/src/cmd/builtin/features/pty
Executable file → Normal file
@@ -1,5 +1,3 @@
|
||||
set prototyped
|
||||
|
||||
header sys/types.h
|
||||
header pty.h
|
||||
header libutil.h
|
||||
@@ -13,7 +11,7 @@ lib openpty,_getpty,ptsname -lutil
|
||||
lib grantpt,unlockpt,posix_openpt stdlib.h
|
||||
lib cfmakeraw termios.h
|
||||
|
||||
tst - output{
|
||||
tst - -lm output{
|
||||
#include <fcntl.h>
|
||||
#if _lib_ptsname
|
||||
#include <stdlib.h>
|
||||
@@ -52,7 +50,8 @@ tst - output{
|
||||
return 0;
|
||||
}
|
||||
}end fail{
|
||||
echo '#error The output block in src/cmd/builtin/features/pty failed to compile. Rebuild with IFFEFLAGS=-d1 to debug.'
|
||||
echo "$0: Output block failed to compile. Export IFFEFLAGS=-d1 to debug." >&2
|
||||
exit 1
|
||||
}end
|
||||
|
||||
extern _getpty char* (int*, int, mode_t, int)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/***********************************************************************
|
||||
* *
|
||||
* This software is part of the ast package *
|
||||
* Copyright (c) 1992-2012 AT&T Intellectual Property *
|
||||
* Copyright (c) 1992-2013 AT&T Intellectual Property *
|
||||
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
|
||||
* and is licensed under the *
|
||||
* Eclipse Public License, Version 1.0 *
|
||||
* by AT&T Intellectual Property *
|
||||
@@ -18,11 +19,14 @@
|
||||
* David Korn <dgk@research.att.com> *
|
||||
* *
|
||||
***********************************************************************/
|
||||
#pragma prototyped
|
||||
|
||||
static const char usage[] =
|
||||
"[-?\n@(#)pty (AT&T Research) 2012-06-11\n]"
|
||||
USAGE_LICENSE
|
||||
"[-?\n@(#)pty (AT&T Research) 2013-05-22\n]"
|
||||
"[-author?Glenn Fowler <gsf@research.att.com>]"
|
||||
"[-author?David Korn <dgk@research.att.com>]"
|
||||
"[-copyright?Copyright (c) 2001-2013 AT&T Intellectual Property]"
|
||||
"[-license?http://www.eclipse.org/org/documents/epl-v10.html]"
|
||||
"[--catalog?builtin]"
|
||||
"[+NAME?pty - create pseudo terminal and run command]"
|
||||
"[+DESCRIPTION?\bpty\b creates a pseudo pty and then runs \bcommand\b "
|
||||
"with arguments given by \aarg\a and the standard input, standard "
|
||||
@@ -121,6 +125,12 @@ USAGE_LICENSE
|
||||
#define CMIN 1
|
||||
#endif
|
||||
|
||||
static noreturn void outofmemory(void)
|
||||
{
|
||||
error(ERROR_SYSTEM|ERROR_PANIC, "out of memory");
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
#if !_lib_openpty && !_lib__getpty && !defined(_pty_clone)
|
||||
# if !_lib_grantpt || !_lib_unlock
|
||||
# if !_lib_ptsname
|
||||
@@ -212,7 +222,6 @@ static int
|
||||
mkpty(int* master, int* minion)
|
||||
{
|
||||
struct termios tty;
|
||||
struct termios tst;
|
||||
struct termios* ttyp;
|
||||
#ifdef TIOCGWINSZ
|
||||
struct winsize win;
|
||||
@@ -247,7 +256,12 @@ mkpty(int* master, int* minion)
|
||||
tty.c_lflag |= ECHOKE;
|
||||
#endif
|
||||
tty.c_oflag |= (ONLCR | OPOST);
|
||||
tty.c_oflag &= ~(OCRNL | ONLRET);
|
||||
#ifdef OCRNL
|
||||
tty.c_oflag &= ~OCRNL;
|
||||
#endif
|
||||
#ifdef ONLRET
|
||||
tty.c_oflag &= ~ONLRET;
|
||||
#endif
|
||||
tty.c_iflag |= BRKINT;
|
||||
tty.c_iflag &= ~IGNBRK;
|
||||
tty.c_cc[VTIME] = 0;
|
||||
@@ -307,6 +321,7 @@ mkpty(int* master, int* minion)
|
||||
return -1;
|
||||
#endif
|
||||
#ifdef I_PUSH
|
||||
struct termios tst;
|
||||
if (tcgetattr(*minion, &tst) < 0 && (ioctl(*minion, I_PUSH, "ptem") < 0 || ioctl(*minion, I_PUSH, "ldterm") < 0))
|
||||
{
|
||||
close(*minion);
|
||||
@@ -641,10 +656,7 @@ masterline(Sfio_t* mp, Sfio_t* lp, char* prompt, int must, int timeout, Master_t
|
||||
a = roundof(bp->max - bp->buf + n, SF_BUFSIZE);
|
||||
r = bp->buf;
|
||||
if (!(bp->buf = vmnewof(bp->vm, bp->buf, char, a, 0)))
|
||||
{
|
||||
error(ERROR_SYSTEM|2, "out of space");
|
||||
return 0;
|
||||
}
|
||||
outofmemory();
|
||||
bp->max = bp->buf + a;
|
||||
if (bp->buf != r)
|
||||
{
|
||||
@@ -780,12 +792,7 @@ dialogue(Sfio_t* mp, Sfio_t* lp, int delay, int timeout)
|
||||
!(cond = vmnewof(vm, 0, Cond_t, 1, 0)) ||
|
||||
!(master = vmnewof(vm, 0, Master_t, 1, 0)) ||
|
||||
!(master->buf = vmnewof(vm, 0, char, 2 * SF_BUFSIZE, 0)))
|
||||
{
|
||||
error(ERROR_SYSTEM|2, "out of space");
|
||||
id = 0;
|
||||
line = 0;
|
||||
goto done;
|
||||
}
|
||||
outofmemory();
|
||||
master->vm = vm;
|
||||
master->cur = master->end = master->buf;
|
||||
master->max = master->buf + 2 * SF_BUFSIZE - 1;
|
||||
@@ -836,10 +843,7 @@ dialogue(Sfio_t* mp, Sfio_t* lp, int delay, int timeout)
|
||||
break;
|
||||
case 'i':
|
||||
if (!cond->next && !(cond->next = vmnewof(vm, 0, Cond_t, 1, 0)))
|
||||
{
|
||||
error(ERROR_SYSTEM|2, "out of space");
|
||||
goto done;
|
||||
}
|
||||
outofmemory();
|
||||
cond = cond->next;
|
||||
cond->flags = IF;
|
||||
if ((cond->prev->flags & SKIP) && !(cond->text = 0) || !(cond->text = masterline(mp, lp, 0, 0, timeout, master)))
|
||||
@@ -948,7 +952,7 @@ dialogue(Sfio_t* mp, Sfio_t* lp, int delay, int timeout)
|
||||
}
|
||||
if (*s && !(master->ignore = vmstrdup(vm, s)))
|
||||
{
|
||||
error(ERROR_SYSTEM|2, "out of space");
|
||||
error(ERROR_SYSTEM|2, "out of memory");
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
@@ -960,7 +964,7 @@ dialogue(Sfio_t* mp, Sfio_t* lp, int delay, int timeout)
|
||||
}
|
||||
if (*s && !(error_info.id = vmstrdup(vm, s)))
|
||||
{
|
||||
error(ERROR_SYSTEM|2, "out of space");
|
||||
error(ERROR_SYSTEM|2, "out of memory");
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
@@ -972,7 +976,7 @@ dialogue(Sfio_t* mp, Sfio_t* lp, int delay, int timeout)
|
||||
}
|
||||
if (*s && !(master->prompt = vmstrdup(vm, s)))
|
||||
{
|
||||
error(ERROR_SYSTEM|2, "out of space");
|
||||
error(ERROR_SYSTEM|2, "out of memory");
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
@@ -1039,6 +1043,7 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
||||
continue;
|
||||
case 'l':
|
||||
log = opt_info.arg;
|
||||
/* FALLTHROUGH */
|
||||
case 'm':
|
||||
messages = opt_info.arg;
|
||||
continue;
|
||||
@@ -1058,17 +1063,26 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
||||
break;
|
||||
case '?':
|
||||
error(ERROR_usage(2), "%s", opt_info.arg);
|
||||
break;
|
||||
UNREACHABLE();
|
||||
}
|
||||
break;
|
||||
}
|
||||
argv += opt_info.index;
|
||||
if (!argv[0])
|
||||
{
|
||||
error(ERROR_exit(1), "command must be specified");
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (mkpty(&master, &minion) < 0)
|
||||
{
|
||||
error(ERROR_system(1), "unable to create pty");
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (!(mp = sfnew(NiL, 0, SF_UNBOUND, master, SF_READ|SF_WRITE)))
|
||||
{
|
||||
error(ERROR_system(1), "cannot open master stream");
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (stty)
|
||||
{
|
||||
n = 2;
|
||||
@@ -1076,7 +1090,7 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
||||
if (isspace(*s))
|
||||
n++;
|
||||
if (!(ap = newof(0, Argv_t, 1, (n + 2) * sizeof(char*) + (s - stty + 1))))
|
||||
error(ERROR_system(1), "out of space");
|
||||
outofmemory();
|
||||
ap->argc = n + 1;
|
||||
ap->argv = (char**)(ap + 1);
|
||||
ap->args = (char*)(ap->argv + n + 2);
|
||||
@@ -1096,9 +1110,15 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
||||
if (!log)
|
||||
lp = 0;
|
||||
else if (!(lp = sfopen(NiL, log, "w")))
|
||||
{
|
||||
error(ERROR_system(1), "%s: cannot write", log);
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (!(proc = runcmd(argv, minion, session)))
|
||||
{
|
||||
error(ERROR_system(1), "unable run %s", argv[0]);
|
||||
UNREACHABLE();
|
||||
}
|
||||
close(minion);
|
||||
if (messages)
|
||||
{
|
||||
@@ -1110,7 +1130,10 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
||||
else if ((fd = open(messages, O_CREAT|O_WRONLY, MODE_666)) >= 0)
|
||||
drop = 0;
|
||||
else
|
||||
{
|
||||
error(ERROR_system(1), "%s: cannot redirect messages", messages);
|
||||
UNREACHABLE();
|
||||
}
|
||||
close(2);
|
||||
dup(fd);
|
||||
if (drop)
|
||||
@@ -1119,6 +1142,9 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
||||
minion = (*fun)(mp, lp, delay, timeout);
|
||||
master = procclose(proc);
|
||||
if (lp && sfclose(lp))
|
||||
{
|
||||
error(ERROR_system(1), "%s: write error", log);
|
||||
UNREACHABLE();
|
||||
}
|
||||
return minion ? minion : master;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user