Initial revision

This commit is contained in:
tg 2005-03-06 15:42:55 +00:00
parent 4075a35b8e
commit a90702a5a1
56 changed files with 77 additions and 5070 deletions

View File

@ -1,94 +0,0 @@
#!/bin/sh
# $MirBSD: src/bin/ksh/Build.sh,v 2.5 2004/12/31 19:24:20 tg Exp $
#-
# Copyright (c) 2004
# Thorsten "mirabile" Glaser <tg@66h.42h.de>
#
# Licensee is hereby permitted to deal in this work without restric-
# tion, including unlimited rights to use, publicly perform, modify,
# merge, distribute, sell, give away or sublicence, provided all co-
# pyright notices above, these terms and the disclaimer are retained
# in all redistributions or reproduced in accompanying documentation
# or other materials provided with binary redistributions.
#
# Licensor hereby provides this work "AS IS" and WITHOUT WARRANTY of
# any kind, expressed or implied, to the maximum extent permitted by
# applicable law, but with the warranty of being written without ma-
# licious intent or gross negligence; in no event shall licensor, an
# author or contributor be held liable for any damage, direct, indi-
# rect or other, however caused, arising in any way out of the usage
# of this work, even if advised of the possibility of such damage.
#-
# Build the more or less portable mksh on most (non-MirBSD) UNIX®ish
# operating systems. Building on various operating systems:
# - Solaris: SHELL=ksh LDFLAGS=-ldl WEIRD_OS=1 sh ./Build.sh
# - Interix: SHELL=ksh sh ./Build.sh (also on GNU and most *BSD)
# - Mac OSX: SHELL=bash WEIRD_OS=1 sh ./Build.sh
#
# Explicit note: you _have_ to use a "modern" bourne-compatible pre-
# installed shell to execute the build script, such as the GNU bash,
# PDKSH or AT&T KSH; Solaris /usr/xpg4/bin/sh works as well; Solaris
# /bin/sh, zsh or non-bourne (csh, bsh) won't do. Rebuild afterwards
# with mksh (suggested). Explicit notice to Debian GNU/Some*nix pak-
# kagers: you also have to set SHELL=/path/to/yourshell in the envi-
# ronment of the script, as shown above.
SHELL="${SHELL:-/bin/sh}"; export SHELL
CONFIG_SHELL="${SHELL}"; export CONFIG_SHELL
CC="${CC:-gcc}"
CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -I."
COPTS="-O2 -fomit-frame-pointer -fno-strict-aliasing -fno-strength-reduce"
[ -z "$WEIRD_OS" ] && LDFLAGS="${LDFLAGS:--static}"
if test -e strlfun.c; then
echo "Configuring..."
$SHELL ./configure
echo "Generating prerequisites..."
$SHELL ./emacs-gen.sh emacs.c >emacs.out
for hdr in errno signal; do
h2ph -d . /usr/include/$hdr.h && mv _h2ph_pre.ph $hdr.ph
done
echo "Building..."
$CC $COPTS $CFLAGS $CPPFLAGS $LDFLAGS -o mksh *.c
test -e mksh || exit 1
echo "Finalizing..."
tbl <ksh.1tbl >mksh.1 || cat ksh.1tbl >mksh.1
nroff -mdoc -Tascii <mksh.1 >mksh.cat1 || rm -f mksh.cat1
man=mksh.cat1
test -s $man || man=mksh.1
test -s $man || man=ksh.1tbl
size mksh
echo "done."
echo ""
echo "If you want to test mirbsdksh:"
echo "perl ./tests/th -s ./tests -p ./mksh -C" \
"pdksh,sh,ksh,posix,posix-upu"
echo ""
echo "generated files: mksh $man"
echo ""
echo "Sample Installation Commands:"
echo "a) installing the executable"
echo "# install -c -s -o root -g bin -m 555 mksh /bin/mksh"
echo "# echo /bin/mksh >>/etc/shells"
echo "b) installing the manual page (system dependent)"
if test -s mksh.cat1; then
echo " - most Unices, BSD"
echo "# install -c -o root -g bin -m 444 mksh.cat1" \
"/usr/local/man/cat1/mksh.0"
fi
if test -s mksh.1; then
echo " - some Unices, GNU/Linux"
echo "# install -c -o root -g bin -m 444 mksh.1" \
"/usr/share/man/man1/mksh.1"
fi
echo " - the unformatted manual page"
echo "=> format ksh.1tbl yourself and copy to the appropriate place."
echo "=> visit http://wiki.mirbsd.de/MirbsdKsh for online manpages."
else
echo "Your kit isn't complete, please download the"
echo "mirbsdksh-Rxx.cpio.gz distfile, then extract"
echo "it and try again! Due to the folks of Ulrich"
echo "Drepper & co. not including strlcpy/strlcat,"
echo "this is a necessity to circumvent the broken"
echo "libc imitation of GNU's."
fi

View File

@ -1,4 +1,4 @@
$MirBSD: src/bin/ksh/CONTRIBUTORS,v 2.2 2004/12/13 18:53:25 tg Exp $
$MirOS$
$OpenBSD: CONTRIBUTORS,v 1.9 1999/07/14 13:37:23 millert Exp $
This is a partial history of this shell gleened from old change logs and

View File

@ -1,11 +1,11 @@
# $MirBSD: src/bin/ksh/Makefile,v 2.5 2004/12/31 19:24:20 tg Exp $
# $MirOS$
# $OpenBSD: Makefile,v 1.18 2004/02/16 19:07:19 deraadt Exp $
PROG= ksh
SRCS= alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c eval.c \
exec.c expr.c history.c io.c jobs.c lex.c main.c misc.c missing.c \
path.c shf.c syn.c table.c trap.c tree.c tty.c var.c vi.c
MAN= ksh.1tbl sh.1tbl
MAN= ksh.1 sh.1
CPPFLAGS+= -DHAVE_CONFIG_H -I. -DMIRBSD_NATIVE
CFLAGS+= -Wall -Werror -W -pedantic

2
NOTES
View File

@ -1,4 +1,4 @@
$MirBSD: src/bin/ksh/NOTES,v 2.3 2004/12/13 18:53:25 tg Exp $
$MirOS$
$OpenBSD: NOTES,v 1.9 2003/10/26 15:07:25 jmc Exp $
General features of at&t ksh88 that are not (yet) in pdksh:

2
README
View File

@ -1,4 +1,4 @@
$MirBSD: src/bin/ksh/README,v 2.4 2004/12/31 19:24:20 tg Exp $
$MirOS$
This is the README for mirbsdksh, developed as part of the MirBSD
operating system at The MirOS Project, and produced portably.

879
aclocal.m4 vendored
View File

@ -1,879 +0,0 @@
dnl $MirBSD: src/bin/ksh/aclocal.m4,v 2.6 2004/12/31 19:37:03 tg Exp $
dnl-
dnl Copyright (c) 2004
dnl Thorsten "mirabile" Glaser <tg@66h.42h.de>
dnl
dnl Licensee is hereby permitted to deal in this work without restric-
dnl tion, including unlimited rights to use, publicly perform, modify,
dnl merge, distribute, sell, give away or sublicence, provided all co-
dnl pyright notices above, these terms and the disclaimer are retained
dnl in all redistributions or reproduced in accompanying documentation
dnl or other materials provided with binary redistributions.
dnl
dnl Licensor hereby provides this work "AS IS" and WITHOUT WARRANTY of
dnl any kind, expressed or implied, to the maximum extent permitted by
dnl applicable law, but with the warranty of being written without ma-
dnl licious intent or gross negligence; in no event shall licensor, an
dnl author or contributor be held liable for any damage, direct, indi-
dnl rect or other, however caused, arising in any way out of the usage
dnl of this work, even if advised of the possibility of such damage.
dnl-
dnl Based upon code by:
dnl Copyright (C) 1996, Memorial University of Newfoundland.
dnl-
dnl
dnl
dnl Like AC_CHECK_TYPE(), only
dnl - user gets to specify header file(s) in addition to the default
dnl headers (<sys/types.h> and <stdlib.h>)
dnl - user gets to specify the message
dnl - word boundary checks are put at beginning/end of pattern
dnl (ie, \<pattern\>)
dnl - default argument is optional
dnl uses ac_cv_type_X 'cause this is used in other autoconf macros...
dnl KSH_CHECK_H_TYPE(type, message, header files, default)
AC_DEFUN(KSH_CHECK_H_TYPE,
[AC_CACHE_CHECK($2, ac_cv_type_$1,
[AC_EGREP_CPP([(^|[^a-zA-Z0-9_])]$1[([^a-zA-Z0-9_]|\$)],
[#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#endif
$3
], ac_cv_type_$1=yes, ac_cv_type_$1=no)])
ifelse($#, 4, [if test $ac_cv_type_$1 = no; then
AC_DEFINE($1, $4)
fi
])dnl
])dnl
dnl
dnl
dnl Check for memmove and if not found, check for bcopy. AC_CHECK_FUNCS()
dnl not used 'cause it confuses some compilers that have memmove/bcopy builtin;
dnl Also want to check if the function deals with overlapping src/dst properly.
AC_DEFUN(KSH_MEMMOVE,
[AC_CACHE_CHECK(for working memmove, ksh_cv_func_memmove,
[AC_TRY_RUN([
#ifdef HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#ifdef HAVE_MEMORY_H
# include <memory.h>
#endif
int
main()
{
char buf[16];
strcpy(buf, "abcdefABCDEF");
memmove(buf + 4, buf, 6);
if (strcmp(buf, "abcdabcdefEF"))
exit(1);
memmove(buf, buf + 4, 6);
if (strcmp(buf, "abcdefcdefEF"))
exit(2);
exit(0);
return 0;
}],
ksh_cv_func_memmove=yes, ksh_cv_func_memmove=no,
AC_MSG_WARN(assuming memmove broken); ksh_cv_func_memmove=no)])
if test $ksh_cv_func_memmove = yes; then
AC_DEFINE(HAVE_MEMMOVE)
else
AC_CACHE_CHECK(for working bcopy, ksh_cv_func_bcopy,
[AC_TRY_RUN([
#ifdef HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#ifdef HAVE_MEMORY_H
# include <memory.h>
#endif
int
main()
{
char buf[16];
strcpy(buf, "abcdefABCDEF");
bcopy(buf, buf + 4, 6);
if (strcmp(buf, "abcdabcdefEF"))
exit(1);
bcopy(buf + 4, buf, 6);
if (strcmp(buf, "abcdefcdefEF"))
exit(2);
exit(0);
}],
ksh_cv_func_bcopy=yes, ksh_cv_func_bcopy=no,
AC_MSG_WARN(assuming bcopy broken); ksh_cv_func_bcopy=no)])
if test $ksh_cv_func_bcopy = yes; then
AC_DEFINE(HAVE_BCOPY)
fi
fi
])dnl
dnl
dnl
dnl Check for sigsetjmp()/siglongjmp() and _setjmp()/_longjmp() pairs.
dnl Can't use simple library check as QNX 422 has _setjmp() but not _longjmp()
dnl (go figure).
AC_DEFUN(KSH_SETJMP,
[AC_CACHE_CHECK(for sigsetjmp()/siglongjmp(), ksh_cv_func_sigsetjmp,
[AC_TRY_LINK([], [sigsetjmp(); siglongjmp()],
ksh_cv_func_sigsetjmp=yes, ksh_cv_func_sigsetjmp=no)])
if test $ksh_cv_func_sigsetjmp = yes; then
AC_DEFINE(HAVE_SIGSETJMP)
else
AC_CACHE_CHECK(for _setjmp()/_longjmp(), ksh_cv_func__setjmp,
[AC_TRY_LINK([], [_setjmp(); _longjmp();],
ksh_cv_func__setjmp=yes, ksh_cv_func__setjmp=no)])
if test $ksh_cv_func__setjmp = yes; then
AC_DEFINE(HAVE__SETJMP)
fi
fi
])dnl
dnl
dnl
dnl Check for memset function. AC_CHECK_FUNCS() not used 'cause it confuses
dnl some compilers that have memset builtin.
AC_DEFUN(KSH_MEMSET,
[AC_CACHE_CHECK(for memset, ksh_cv_func_memset,
[AC_TRY_LINK([
#ifdef HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#ifdef HAVE_MEMORY_H
# include <memory.h>
#endif
], [
char buf[16]; memset(buf, 'x', 7); printf("%7s", buf);],
ksh_cv_func_memset=yes, ksh_cv_func_memset=no)])
if test $ksh_cv_func_memset = yes; then
AC_DEFINE(HAVE_MEMSET)
fi
])dnl
dnl
dnl
dnl Check for rlim_t in a few places, and if not found, figure out the
dnl size rlim_t should be by looking at struct rlimit.rlim_cur.
AC_DEFUN(KSH_RLIM_CHECK,
[KSH_CHECK_H_TYPE(rlim_t, for rlim_t in <sys/types.h> and <sys/resource.h>,
[#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif])dnl
if test $ac_cv_type_rlim_t = no; then
AC_MSG_CHECKING(what to set rlim_t to)
if test $ac_cv_header_sys_resource_h = yes; then
AC_CACHE_VAL(ksh_cv_rlim_check,
[AC_TRY_RUN([
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
main()
{
struct rlimit rl;
if (sizeof(rl.rlim_cur) == sizeof(quad_t))
exit(0);
exit(1);
}
], ksh_cv_rlim_check=quad_t, ksh_cv_rlim_check=long,
AC_MSG_ERROR(cannot determine type for rlimt_t when cross compiling)
)])dnl
else
ksh_cv_rlim_check=long
fi
AC_MSG_RESULT($ksh_cv_rlim_check)
AC_DEFINE_UNQUOTED(rlim_t, $ksh_cv_rlim_check)
fi
])dnl
dnl
dnl
AC_DEFUN(KSH_DEV_FD,
[AC_CACHE_CHECK(if you have /dev/fd/n, ksh_cv_dev_fd,
[AC_TRY_RUN([
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
main()
{
struct stat s1, s2;
FILE *fp1, *fp2;
char *file = "conftest.file";
char devfd[32];
if (!(fp1 = fopen(file, "w")))
exit(1);
if (fstat(fileno(fp1), &s1) < 0)
exit(2);
sprintf(devfd, "/dev/fd/%d", fileno(fp1));
if (!(fp2 = fopen(devfd, "w")))
exit(3);
if (fstat(fileno(fp2), &s2) < 0)
exit(4);
if (s1.st_dev != s2.st_dev || s1.st_ino != s2.st_ino)
exit(5);
exit(0);
}
], ksh_cv_dev_fd=yes, ksh_cv_dev_fd=no,
AC_MSG_WARN(cannot determine if you have /dev/fd support, assuming not)
ksh_cv_dev_fd=no)])
if test $ksh_cv_dev_fd = yes; then
AC_DEFINE(HAVE_DEV_FD)
fi
])dnl
dnl
dnl
AC_DEFUN(KSH_C_VOID,
[AC_CACHE_CHECK(if compiler understands void, ksh_cv_c_void,
[AC_TRY_COMPILE(
[
void foo() { }
/* Some compilers (old pcc ones) like "void *a;", but a can't be used */
void *bar(a) void *a; { int *b = (int *) a; *b = 1; return a; }
], , ksh_cv_c_void=yes, ksh_cv_c_void=no)])
if test $ksh_cv_c_void = yes; then
:
else
AC_DEFINE(void, char)
fi
])dnl
dnl
dnl
dnl Early MIPS compilers (used in Ultrix 4.2) don't like
dnl "int x; int *volatile a = &x; *a = 0;"
AC_DEFUN(KSH_C_VOLATILE,
[AC_CACHE_CHECK(if compiler understands volatile, ksh_cv_c_volatile,
[AC_TRY_COMPILE([int x, y, z;],
[volatile int a; int * volatile b = x ? &y : &z;
/* Older MIPS compilers (eg., in Ultrix 4.2) don't like *b = 0 */
*b = 0;], ksh_cv_c_volatile=yes, ksh_cv_c_volatile=no)])
if test $ksh_cv_c_volatile = yes; then
:
else
AC_DEFINE(volatile, )
fi
])dnl
dnl
dnl
dnl Check if C compiler understands gcc's __attribute((...)).
dnl checks for noreturn, const, and format(type,fmt,param), also checks
dnl that the compiler doesn't die when it sees an unknown attribute (this
dnl isn't perfect since gcc doesn't parse unknown attributes with parameters)
AC_DEFUN(KSH_C_FUNC_ATTR,
[AC_CACHE_CHECK(if C compiler groks __attribute__(( .. )), ksh_cv_c_func_attr,
[AC_TRY_COMPILE([
#include <stdarg.h>
void test_fmt(char *fmt, ...) __attribute__((format(printf, 1, 2)));
void test_fmt(char *fmt, ...) { return; }
int test_cnst(int) __attribute__((const));
int test_cnst(int x) { return x + 1; }
void test_nr() __attribute__((noreturn));
void test_nr() { exit(1); }
void test_uk() __attribute__((blah));
void test_uk() { return; }
], [test_nr("%d", 10); test_cnst(2); test_uk(); test_nr(); ],
ksh_cv_c_func_attr=yes, ksh_cv_c_func_attr=no)])
if test $ksh_cv_c_func_attr = yes; then
AC_DEFINE(HAVE_GCC_FUNC_ATTR)
fi
])dnl
dnl
dnl
dnl Check if dup2() does not clear the close on exec flag
AC_DEFUN(KSH_DUP2_CLEXEC_CHECK,
[AC_CACHE_CHECK([if dup2() works (ie, resets the close-on-exec flag)], ksh_cv_dup2_clexec_ok,
[AC_TRY_RUN([
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif /* HAVE_FCNTL_H */
#ifndef F_GETFD
# define F_GETFD 1
#endif
#ifndef F_SETFD
# define F_SETFD 2
#endif
#ifndef O_RDONLY
# define O_RDONLY 0
#endif
/* On some systems (Ultrix 2.1..4.2 (and more?)), dup2() does not clear
the close on exec flag */
main()
{
int fd1, fd2;
fd1 = open("/dev/null", O_RDONLY);
if (fcntl(fd1, F_SETFD, 1) < 0)
exit(1);
fd2 = dup2(fd1, fd1 + 1);
if (fd2 < 0)
exit(2);
exit(fcntl(fd2, F_GETFD, 0) == 0 ? 0 : 3);
}
], ksh_cv_dup2_clexec_ok=yes, ksh_cv_dup2_clexec_ok=no,
AC_MSG_WARN(cannot test if dup2 is broken when cross compiling - assuming it is)
ksh_cv_dup2_clexec_ok=no)])
if test $ksh_cv_dup2_clexec_ok = no; then
AC_DEFINE(DUP2_BROKEN)
fi
])dnl
dnl
dnl
dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
AC_DEFUN(KSH_SIGNAL_CHECK,
[AC_CACHE_CHECK(flavour of signal routines, ksh_cv_signal_check,
[AC_TRY_LINK([#include <signal.h>], [
sigset_t ss;
struct sigaction sa;
sigemptyset(&ss); sigsuspend(&ss);
sigaction(SIGINT, &sa, (struct sigaction *) 0);
sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
], ksh_cv_signal_check=posix,
AC_TRY_LINK([#include <signal.h>], [
int mask = sigmask(SIGINT);
sigsetmask(mask); sigblock(mask); sigpause(mask);
], ksh_cv_signal_check=bsd42,
AC_TRY_LINK([#include <signal.h>
RETSIGTYPE foo() { }],
[
int mask = sigmask(SIGINT);
sigset(SIGINT, foo); sigrelse(SIGINT);
sighold(SIGINT); sigpause(SIGINT);
], ksh_cv_signal_check=bsd41, ksh_cv_signal_check=v7)))])
if test $ksh_cv_signal_check != posix; then
AC_MSG_WARN(no posix signals)
fi
])dnl
dnl
dnl
dnl What kind of process groups: POSIX, BSD, SYSV or none
dnl BSD uses setpgrp(pid, pgrp), getpgrp(pid)
dnl POSIX uses setpid(pid, pgrp), getpgrp(void)
dnl SYSV uses setpgrp(void), getpgrp(void)
dnl Checks for BSD first since the posix test may succeed on BSDish systems
dnl (depends on what random value gets passed to getpgrp()).
AC_DEFUN(KSH_PGRP_CHECK,
[AC_CACHE_CHECK(flavour of pgrp routines, ksh_cv_pgrp_check,
[AC_TRY_RUN([
/* Check for BSD process groups */
#include <signal.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
main()
{
int ecode = 0, child = fork();
if (child < 0)
exit(1);
if (child == 0) {
signal(SIGTERM, SIG_DFL); /* just to make sure */
sleep(10);
exit(9);
}
if (setpgrp(child, child) < 0)
ecode = 2;
else if (getpgrp(child) != child)
ecode = 3;
kill(child, SIGTERM);
exit(ecode);
}
], ksh_cv_pgrp_check=bsd,
[AC_TRY_RUN([
/* Check for POSIX process groups */
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
main()
{
int child;
int n, p1[2], p2[2];
char buf[1];
if (pipe(p1) < 0 || pipe(p2) < 0)
exit(1);
if ((child = fork()) < 0)
exit(2);
if (child == 0) {
n = read(p1[0], buf, sizeof(buf)); /* wait for parent to setpgid */
buf[0] = (n != 1 ? 10 : (getpgrp() != getpid() ? 11 : 0));
if (write(p2[1], buf, sizeof(buf)) != 1)
exit(12);
exit(0);
}
if (setpgid(child, child) < 0)
exit(3);
if (write(p1[1], buf, 1) != 1)
exit(4);
if (read(p2[0], buf, 1) != 1)
exit(5);
exit((int) buf[0]);
}
], ksh_cv_pgrp_check=posix,
[AC_TRY_RUN([
/* Check for SYSV process groups */
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
main()
{
int child;
int n, p[2];
char buf[1];
if (pipe(p) < 0)
exit(1);
if ((child = fork()) < 0)
exit(2);
if (child == 0) {
buf[0] = (setpgrp() < 0 ? 10 : (getpgrp() != getpid() ? 11 : 0));
if (write(p[1], buf, sizeof(buf)) != 1)
exit(11);
exit(0);
}
if (read(p[0], buf, 1) != 1)
exit(3);
exit((int) buf[0]);
}
], ksh_cv_pgrp_check=sysv, ksh_cv_pgrp_check=none,
AC_MSG_ERROR(cannot taste pgrp routines when cross compiling))],
AC_MSG_ERROR(cannot taste pgrp routines when cross compiling))],
AC_MSG_ERROR(cannot taste pgrp routines when cross compiling))])
if test $ksh_cv_pgrp_check = bsd; then
AC_DEFINE(BSD_PGRP)
elif test $ksh_cv_pgrp_check = posix; then
AC_DEFINE(POSIX_PGRP)
elif test $ksh_cv_pgrp_check = sysv; then
AC_DEFINE(SYSV_PGRP)
else
AC_DEFINE(NO_PGRP)
fi
])dnl
dnl
dnl
dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process.
dnl On some systems, the kernel doesn't count zombie processes when checking
dnl if a process group is valid, which can cause problems in creating the
dnl pipeline "cmd1 | cmd2": if cmd1 can die (and go into the zombie state)
dnl before cmd2 is started, the kernel doesn't allow the setpgrp() for cmd2
dnl to succeed. This test defines NEED_PGRP_SYNC if the kernel has this bug.
dnl (pgrp_sync test doesn't mean much if don't have bsd or posix pgrps)
AC_DEFUN(KSH_PGRP_SYNC,
[AC_REQUIRE([KSH_PGRP_CHECK])dnl
if test $ksh_cv_pgrp_check = bsd || test $ksh_cv_pgrp_check = posix ; then
AC_CACHE_CHECK(if process group synchronization is required, ksh_cv_need_pgrp_sync,
[AC_TRY_RUN([
main()
{
#ifdef POSIX_PGRP
# define getpgID() getpgrp()
#else
# define getpgID() getpgrp(0)
# define setpgid(x,y) setpgrp(x,y)
#endif
int pid1, pid2, fds[2];
int status;
char ok;
switch (pid1 = fork()) {
case -1:
exit(1);
case 0:
setpgid(0, getpid());
exit(0);
}
setpgid(pid1, pid1);
sleep(2); /* let first child die */
if (pipe(fds) < 0)
exit(2);
switch (pid2 = fork()) {
case -1:
exit(3);
case 0:
setpgid(0, pid1);
ok = getpgID() == pid1;
write(fds[1], &ok, 1);
exit(0);
}
setpgid(pid2, pid1);
close(fds[1]);
if (read(fds[0], &ok, 1) != 1)
exit(4);
wait(&status);
wait(&status);
exit(ok ? 0 : 5);
}
], ksh_cv_need_pgrp_sync=no, ksh_cv_need_pgrp_sync=yes,
AC_MSG_WARN(cannot test if pgrp synchronization needed when cross compiling - assuming it is)
ksh_cv_need_pgrp_sync=yes)])
if test $ksh_cv_need_pgrp_sync = yes; then
AC_DEFINE(NEED_PGRP_SYNC)
fi
fi
])dnl
dnl
dnl
dnl Check to see if opendir will open non-directories (not a nice thing)
AC_DEFUN(KSH_OPENDIR_CHECK,
[AC_CACHE_CHECK(if opendir() fails to open non-directories, ksh_cv_opendir_ok,
[AC_TRY_RUN([
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if defined(HAVE_DIRENT_H)
# include <dirent.h>
#else
# define dirent direct
# ifdef SYSNDIR
# include <sys/ndir.h>
# endif /* SYSNDIR */
# ifdef SYSDIR
# include <sys/dir.h>
# endif /* SYSDIR */
# ifdef NDIR
# include <ndir.h>
# endif /* NDIR */
#endif /* DIRENT */
main()
{
int i, ret = 0;
FILE *fp;
char *fname = "conftestod", buf[256];
for (i = 0; i < sizeof(buf); i++) /* memset(buf, 0, sizeof(buf)) */
buf[i] = 0;
unlink(fname); /* paranoia */
i = ((fp = fopen(fname, "w")) == (FILE *) 0 && (ret = 1))
|| (fwrite(buf, sizeof(buf), 1, fp) != 1 && (ret = 2))
|| (fclose(fp) == EOF && (ret = 3))
|| (opendir(fname) && (ret = 4))
|| (opendir("/dev/null") && (ret = 5));
unlink(fname);
exit(ret);
}
], ksh_cv_opendir_ok=yes, ksh_cv_opendir_ok=no,
AC_MSG_WARN(cannot test if opendir opens non-directories when cross compiling - assuming it does)
ksh_cv_opendir_ok=no)])
if test $ksh_cv_opendir_ok = no; then
AC_DEFINE(OPENDIR_DOES_NONDIR)
fi
])dnl
dnl
dnl
dnl Like AC_HAVE_HEADER(unistd.h) but only defines HAVE_UNISTD_H if
dnl the header file is sane (MIPS RISC/os 5.0 (and later?) has a unistd.h
dnl in the bsd43 environ that is incorrect - it defines POSIX_VERSION even
dnl though its non-posix).
AC_DEFUN(KSH_UNISTD_H,
[AC_CACHE_CHECK(for sane unistd.h, ksh_cv_header_unistd,
[AC_TRY_COMPILE([
#include <unistd.h>
#if defined(_POSIX_VERSION)
# include <sys/types.h>
# include <dirent.h> /* _POSIX_VERSION => HAVE_DIRENT_H test not needed */
#endif
], , ksh_cv_header_unistd=yes, ksh_cv_header_unistd=no)])
if test $ksh_cv_header_unistd = yes; then
AC_DEFINE(HAVE_UNISTD_H)
fi
])dnl
dnl
dnl
dnl Several OSes need to be detected and symbols defined so the shell can
dnl deal with them. This is a bit kludgy, but...
dnl Currently tests for:
dnl AIX, ISC (Interactive systems corp), MINIX,
dnl SCO (santa cruz operation), NEXT, Interix/MS Services for Unix
dnl DO NOT USE with AC_AIX, AC_MINIX or AC_ISC_POSIX tests as these are
dnl incorperated in this test.
AC_DEFUN(KSH_OS_TYPE,
[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
AC_BEFORE([$0], [AC_TRY_LINK])dnl
AC_BEFORE([$0], [AC_TRY_RUN])dnl
AC_CACHE_CHECK(if this is a problematic os, ksh_cv_os_type,
[ ksh_cv_os_type=no
# Some tests below add -C to CPPFLAGS
saveCPPFLAGS="$CPPFLAGS"
for i in AIX ISC MINIX SCO TITANOS NEXT HPUX Interix; do
case $i in #((
AIX)
AC_EGREP_CPP(yes,
[
#ifdef _AIX
yes
#endif
], ksh_cv_os_type=$i)
;; #(
ISC)
# Both native ISC cpp and gcc understand this (leave comments in)
CPPFLAGS="$CPPFLAGS -C"
#XXX grep part won't work if cross-compiling...
AC_EGREP_CPP(INTERACTIVE Systems Corporation,
[#include <unistd.h>],
[if grep _POSIX_VERSION /usr/include/sys/unistd.h > /dev/null 2>&1; then
ksh_cv_os_type="$i-posix"
else
ksh_cv_os_type=$i
fi])dnl
CPPFLAGS="$saveCPPFLAGS"
;; #(
MINIX)
AC_CHECK_HEADER(minix/config.h, ksh_cv_os_type=$i)dnl
AC_MSG_CHECKING(for problematic OS continues)
;; #(
SCO)
# Both native SCO cpp and gcc understand this (leave comments in)
CPPFLAGS="$CPPFLAGS -C"
AC_EGREP_CPP(The Santa Cruz Operation,
[#include <unistd.h>], ksh_cv_os_type=$i)dnl
CPPFLAGS="$saveCPPFLAGS"
;; #(
TITANOS)
AC_EGREP_CPP(YesTitan,
[
#if defined(titan) || defined(_titan) || defined(__titan)
YesTitan
#endif
], ksh_cv_os_type=$i)dnl
;; #(
NEXT)
#
# NeXT 3.2 (other versions?) - cc -E doesn't work and /lib/cpp
# doesn't define things that need defining, so tests that rely
# on $CPP will break.
#
# Hmmm - can't safely use CPP to test for NeXT defines, so have
# to use a program that won't compile on a NeXT and one that will
# only compile on a NeXT...
AC_TRY_COMPILE([], [
#if defined(__NeXT) || defined(NeXT)
this is a NeXT box and the compile should fail
#endif
], , AC_TRY_COMPILE([], [
#if !defined(__NeXT) && !defined(NeXT)
this is NOT a NeXT box and the compile should fail
#endif
], ksh_cv_os_type=$i))dnl
;; #(
HPUX)
AC_EGREP_CPP(yes,
[
#ifdef __hpux
yes
#endif
], ksh_cv_os_type=$i)
;; #(
Interix)
AC_EGREP_CPP(is_interix_sfu,
[
#include <interix/interix.h>
#if defined(__MirInterix__)
#elif defined(_INTERIX_INTERIX_H) || defined(WIN_REG_NONE)
is_interix_sfu
#endif
], ksh_cv_os_type=$i)dnl
;; #(
esac #))
test $ksh_cv_os_type != no && break
done
])
case $ksh_cv_os_type in #((
AIX)
AC_DEFINE(_ALL_SOURCE)dnl
;; #(
Interix)
AC_DEFINE(_ALL_SOURCE)dnl
;; #(
ISC)
AC_DEFINE(OS_ISC)dnl
;; #(
ISC-posix)
AC_DEFINE(OS_ISC)dnl
AC_DEFINE(_POSIX_SOURCE)dnl
if test "$GCC" = yes; then
CC="$CC -posix"
else
CC="$CC -Xp"
fi
;; #(
MINIX)
AC_DEFINE(_POSIX_SOURCE)dnl
AC_DEFINE(_POSIX_1_SOURCE, 2)dnl
AC_DEFINE(_MINIX)dnl
;; #(
SCO)
AC_DEFINE(OS_SCO)dnl
;; #(
TITANOS)
# Need to use cc -43 to get a shell with job control
case "$CC" in #((
*-43*) # Already have -43 option?
;; #(
*/cc|*/cc' '|*/cc' '|cc|cc' '|cc' ') # Using stock compiler?
CC="$CC -43"
;; #(
esac #))
#
# Force dirent check to find the right thing. There is a dirent.h
# (and a sys/dirent.h) file which compiles, but generates garbage...
#
ac_cv_header_dirent_dirent_h=no
ac_cv_header_dirent_sys_ndir_h=no
ac_cv_header_dirent_sys_dir_h=yes
;; #(
NEXT)
#
# NeXT 3.2 (other versions?) - cc -E doesn't work and /lib/cpp
# doesn't define things that need defining, so tests that rely
# on $CPP will break.
#
AC_EGREP_CPP([Bad NeXT], [#include <signal.h>
#if !defined(SIGINT) || !defined(SIGQUIT)
Bad NeXT
#endif
], AC_MSG_ERROR([
There is a problem on NeXT boxes resulting in a bad siglist.out file being
generated (which breaks the trap and kill commands) and probably resulting
in many configuration tests not working correctly.
You appear to have this problem - see the comments on NeXT in the pdksh
README file for work arounds.]))dnl
;; #(
HPUX)
#
# In some versions of hpux (eg, 10.2), getwd & getcwd will dump core
# if directory is not readble.
#
# name is used in test program
AC_CACHE_CHECK(for bug in getwd, ksh_cv_hpux_getwd_bug,
[ tmpdir=conftest.dir
if mkdir $tmpdir ; then
AC_TRY_RUN([
int
main()
{
char buf[8 * 1024];
char *dirname = "conftest.dir";
int ok = 0;
if (chdir(dirname) < 0)
exit(2);
if (chmod(".", 0) < 0)
exit(3);
/* Test won't work if run as root - so don't be root */
if (getuid() == 0 || geteuid() == 0)
setresuid(1, 1, 1); /* hpux has this */
#ifdef HAVE_GETWD /* silly since HAVE_* tests haven't been done yet */
{
extern char *getwd();
ok = getwd(buf) == 0;
}
#else
{
extern char *getcwd();
ok = getcwd(buf, sizeof(buf)) == 0;
}
#endif
exit(ok ? 0 : 10);
return ok ? 0 : 10;
}],
ksh_cv_hpux_getwd_bug=no, ksh_cv_hpux_getwd_bug=yes,
AC_MSG_WARN(assuming getwd broken); ksh_cv_hpux_getwd_bug=yes)
test -d $tmpdir && rmdir $tmpdir
else
AC_MSG_ERROR(could not make temp directory for test); ksh_cv_hpux_getwd_bug=yes
fi])
if test $ksh_cv_hpux_getwd_bug = yes; then
AC_DEFINE(HPUX_GETWD_BUG)
fi
;; #(
esac #))
])dnl
dnl
dnl
dnl Some systems (eg, SunOS 4.0.3) have <termios.h> and <termio.h> but don't
dnl have the related functions/defines (eg, tcsetattr(), TCSADRAIN, etc.)
dnl or the functions don't work well with tty process groups. Sun's bad
dnl termios can be detected by the lack of tcsetattr(), but its bad termio
dnl is harder to detect - so check for (sane) termios first, then check for
dnl BSD, then termio.
AC_DEFUN(KSH_TERM_CHECK,
[AC_CACHE_CHECK(terminal interface, ksh_cv_term_check,
[AC_TRY_LINK([#include <termios.h>], [
struct termios t;
#if defined(ultrix) || defined(__ultrix__)
Termios in ultrix 4.2 botches type-ahead when going from cooked to
cbreak mode. The BSD tty interface works fine though, so use it
(would be good to know if alter versions of ultrix work).
#endif /* ultrix */
tcgetattr(0, &t); tcsetattr(0, TCSADRAIN, &t);
], ksh_cv_term_check=termios,
[AC_TRY_LINK([#include <sys/ioctl.h>], [
struct sgttyb sb; ioctl(0, TIOCGETP, &sb);
#ifdef TIOCGATC
{ struct ttychars lc; ioctl(0, TIOCGATC, &lc); }
#else /* TIOCGATC */
{ struct tchars tc; ioctl(0, TIOCGETC, &tc); }
# ifdef TIOCGLTC
{ struct ltchars ltc; ioctl(0, TIOCGLTC, &ltc); }
# endif /* TIOCGLTC */
#endif /* TIOCGATC */
], ksh_cv_term_check=bsd,
[AC_CHECK_HEADER(termio.h, ksh_cv_term_check=termio,
ksh_cv_term_check=sgtty)])])])
if test $ksh_cv_term_check = termios; then
AC_DEFINE(HAVE_TERMIOS_H)
dnl Don't know of a system on which this fails...
dnl AC_CACHE_CHECK(sys/ioctl.h can be included with termios.h,
dnl ksh_cv_sys_ioctl_with_termios,
dnl [AC_TRY_COMPILE([#include <termios.h>
dnl #include <sys/ioctl.h>], , ksh_cv_sys_ioctl_with_termios=yes,
dnl ksh_cv_sys_ioctl_with_termios=no)])
dnl if test $ksh_cv_sys_ioctl_with_termios = yes; then
dnl AC_DEFINE(SYS_IOCTL_WITH_TERMIOS)
dnl fi
elif test $ksh_cv_term_check = termio; then
AC_DEFINE(HAVE_TERMIO_H)
dnl Don't know of a system on which this fails...
dnl AC_CACHE_CHECK(sys/ioctl.h can be included with termio.h,
dnl ksh_cv_sys_ioctl_with_termio,
dnl [AC_TRY_COMPILE([#include <termio.h>
dnl #include <sys/ioctl.h>], , ksh_cv_sys_ioctl_with_termio=yes,
dnl ksh_cv_sys_ioctl_with_termio=no)])
dnl if test $ksh_cv_sys_ioctl_with_termio = yes; then
dnl AC_DEFINE(SYS_IOCTL_WITH_TERMIO)
dnl fi
fi
])dnl
dnl
dnl
dnl Check if lstat() is available - special test needed 'cause lstat only
dnl becomes visable if <sys/stat.h> is included (linux 1.3.x)...
AC_DEFUN(KSH_FUNC_LSTAT,
[AC_CACHE_CHECK(for lstat, ksh_cv_func_lstat,
[AC_TRY_LINK([
#include <sys/types.h>
#include <sys/stat.h>
], [
struct stat statb;
lstat("/", &statb);
],
ksh_cv_func_lstat=yes, ksh_cv_func_lstat=no)])
if test $ksh_cv_func_lstat = yes; then
AC_DEFINE(HAVE_LSTAT)
fi
])
dnl
dnl
dnl Like AC_HEADER_SYS_WAIT, only HAVE_SYS_WAIT_H if sys/wait.h exists and
dnl defines POSIX_SYS_WAIT if it is posix compatable. This way things
dnl like WNOHANG, WUNTRACED can still be used.
AC_DEFUN(KSH_HEADER_SYS_WAIT,
[AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible],
ksh_cv_header_sys_wait_h,
[AC_MSG_RESULT(further testing...)
AC_HEADER_SYS_WAIT
ksh_cv_header_sys_wait_h=$ac_cv_header_sys_wait_h
unset ac_cv_header_sys_wait_h
AC_MSG_CHECKING(if we got a POSIX.1 compatible sys/wait.h)])
AC_CHECK_HEADERS(sys/wait.h)
if test $ksh_cv_header_sys_wait_h = yes; then
AC_DEFINE(POSIX_SYS_WAIT)dnl
fi
])

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/alloc.c,v 2.1 2004/12/10 18:09:40 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: alloc.c,v 1.7 2004/02/19 18:51:17 deraadt Exp $ */
/*

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/c_ksh.c,v 2.7 2004/12/31 17:29:28 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: c_ksh.c,v 1.18 2004/02/10 13:03:36 jmc Exp $ */
/*
@ -13,7 +13,7 @@
#include <sys/cygwin.h>
#endif /* __CYGWIN__ */
__RCSID("$MirBSD: src/bin/ksh/c_ksh.c,v 2.7 2004/12/31 17:29:28 tg Exp $");
__RCSID("$MirOS$");
int
c_cd(char **wp)

4
c_sh.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/c_sh.c,v 2.11 2004/12/31 18:41:46 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: c_sh.c,v 1.25 2004/12/22 18:48:56 millert Exp $ */
/*
@ -10,7 +10,7 @@
#include <sys/time.h>
#include <sys/resource.h>
__RCSID("$MirBSD: src/bin/ksh/c_sh.c,v 2.11 2004/12/31 18:41:46 tg Exp $");
__RCSID("$MirOS$");
static void p_time(struct shf *, int, struct timeval *, int, char *, char *);

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/c_test.c,v 2.4 2004/12/28 22:32:08 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: c_test.c,v 1.10 2003/10/10 19:09:07 millert Exp $ */
/*
@ -14,7 +14,7 @@
#include "ksh_stat.h"
#include "c_test.h"
__RCSID("$MirBSD: src/bin/ksh/c_test.c,v 2.4 2004/12/28 22:32:08 tg Exp $");
__RCSID("$MirOS$");
/* test(1) accepts the following grammar:
oexpr ::= aexpr | aexpr "-o" oexpr ;

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/c_test.h,v 2.1 2004/12/10 18:09:41 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: c_test.h,v 1.2 2003/10/22 07:40:38 jmc Exp $ */
#ifndef C_TEST_H

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/c_ulimit.c,v 2.2 2004/12/31 19:15:39 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: c_ulimit.c,v 1.10 2003/10/22 07:40:38 jmc Exp $ */
/*
@ -32,7 +32,7 @@ extern long ulimit();
# endif /* HAVE_ULIMIT */
#endif /* HAVE_ULIMIT_H */
__RCSID("$MirBSD: src/bin/ksh/c_ulimit.c,v 2.2 2004/12/31 19:15:39 tg Exp $");
__RCSID("$MirOS$");
#define SOFT 0x1
#define HARD 0x2

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/conf-end.h,v 2.9 2004/12/31 17:29:28 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: conf-end.h,v 1.2 1996/08/25 12:37:58 downsj Exp $ */
#ifndef CONF_END_H

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/config.h,v 2.6 2004/12/31 19:37:03 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: config.h,v 1.9 2003/10/22 07:40:38 jmc Exp $ */
/*

3912
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,108 +0,0 @@
dnl $MirBSD: src/bin/ksh/configure.in,v 2.4 2004/12/31 19:37:03 tg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_INIT(c_ksh.c)
test -s config.h.in || sed -e 's!^/\* #undef \(.*\) \*/!#undef \1!' \
-e 's!^#define \(.*\) 1!#undef \1!' <config.h >config.h.in
AC_CONFIG_HEADER(config.h)
dnl
dnl
dnl Start of auto-configuration stuff...
dnl
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
dnl this incorperates AC_AIX, AC_ISC_POSIX and AC_MINIX tests and does others
KSH_OS_TYPE
dnl
dnl Program name munging stuff (prefix, suffix, transform)
AC_ARG_PROGRAM
dnl
dnl Headers
dnl
AC_HEADER_DIRENT
KSH_UNISTD_H
KSH_TERM_CHECK
AC_CHECK_HEADERS(sys/param.h sys/types.h sys/resource.h sys/time.h \
stdbool.h stddef.h stdint.h stdlib.h string.h limits.h paths.h \
memory.h fcntl.h values.h ulimit.h)
AC_HEADER_TIME
KSH_HEADER_SYS_WAIT
dnl
dnl Typedefs
dnl
dnl (don't use AC_TYPE_XXX() 'cause it doesn't check word boundaries)
KSH_CHECK_H_TYPE(off_t, for off_t in sys/types.h, , long)
KSH_CHECK_H_TYPE(mode_t, for mode_t in sys/types.h, , short)
KSH_CHECK_H_TYPE(pid_t, for pid_t in sys/types.h, , int)
KSH_CHECK_H_TYPE(uid_t, for uid_t in sys/types.h, , int)
if test $ac_cv_type_uid_t = no; then
AC_DEFINE(gid_t, int)
fi
define([AC_PROVIDE_AC_TYPE_UID_T],)
AC_TYPE_SIGNAL
case $ac_cv_type_signal in
int) ksh_cv_signal_retval=0 ;;
void) ksh_cv_signal_retval= ;;
*)
AC_MSG_ERROR(Internal erorr: unknown signal return type: $ac_cv_type_signal)
esac
AC_DEFINE_UNQUOTED(RETSIGVAL, $ksh_cv_signal_retval)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
dnl sh.h sets INT32 to int or long as appropriate. Some burnt systems, such
dnl as NeXT's, clock_t is in sys/time.h (in non-posix mode).
KSH_CHECK_H_TYPE(clock_t, [[for clock_t in any of <sys/types.h>, <sys/times.h> and <sys/time.h>]],
[
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
#include <sys/times.h>
], INT32)
KSH_CHECK_H_TYPE(sigset_t, for sigset_t in <sys/types.h> and <signal.h>,
[#include <signal.h>], unsigned)
KSH_RLIM_CHECK
dnl
dnl Library functions
dnl
KSH_MEMMOVE
KSH_MEMSET
AC_CHECK_FUNCS(arc4random arc4random_addrandom arc4random_push confstr \
dup2 flock getcwd getgroups getpagesize getrusage getwd killpg \
mkstemp nice random revoke setrlimit setsid srandom strcasecmp \
strerror strlcat strlcpy strstr sysconf tcsetpgrp ulimit valloc \
wait3 waitpid)
AC_CHECK_FUNCS(sigsetjmp _setjmp, break)
AC_FUNC_MMAP
KSH_FUNC_LSTAT
dnl
dnl Structures
dnl
AC_HEADER_STAT
AC_STRUCT_ST_RDEV
dnl
dnl Compiler characteristics
dnl
AC_C_CONST
KSH_C_VOID
KSH_C_VOLATILE
KSH_C_FUNC_ATTR
dnl
dnl System services
dnl
AC_SYS_INTERPRETER
if test $ac_cv_sys_interpreter = no;
then AC_DEFINE(SHARPBANG)
fi
dnl
dnl Misc ksh tests
dnl
KSH_DUP2_CLEXEC_CHECK
KSH_SIGNAL_CHECK
KSH_PGRP_CHECK
KSH_PGRP_SYNC
KSH_OPENDIR_CHECK
KSH_DEV_FD
ac_clean_files="$ac_clean_files a.out"
AC_OUTPUT

4
edit.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/edit.c,v 2.8 2004/12/31 17:39:12 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: edit.c,v 1.23 2004/12/18 22:12:23 millert Exp $ */
/*
@ -21,7 +21,7 @@
#include <ctype.h>
#include "ksh_stat.h"
__RCSID("$MirBSD: src/bin/ksh/edit.c,v 2.8 2004/12/31 17:39:12 tg Exp $");
__RCSID("$MirOS$");
#if defined(TIOCGWINSZ)
static RETSIGTYPE x_sigwinch(int sig);

2
edit.h
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/edit.h,v 2.2 2004/12/28 22:32:08 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: edit.h,v 1.3 1999/11/14 22:04:02 d Exp $ */
/* $From: edit.h,v 1.2 1994/05/19 18:32:40 michael Exp michael $ */

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $MirBSD: src/bin/ksh/emacs-gen.sh,v 2.1 2004/12/10 18:09:41 tg Exp $
# $MirOS$
# $OpenBSD: emacs-gen.sh,v 1.1.1.1 1996/08/14 06:19:10 downsj Exp $
case $# in

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/emacs.c,v 2.8 2004/12/31 19:37:03 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: emacs.c,v 1.34 2004/12/23 11:29:02 jsg Exp $ */
/*
@ -18,7 +18,7 @@
#include <locale.h>
#include "edit.h"
__RCSID("$MirBSD: src/bin/ksh/emacs.c,v 2.8 2004/12/31 19:37:03 tg Exp $");
__RCSID("$MirOS$");
static Area aedit;
#define AEDIT &aedit /* area for kill ring and macro defns */

4
eval.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/eval.c,v 2.9 2004/12/31 19:37:03 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: eval.c,v 1.24 2004/12/22 18:52:37 millert Exp $ */
/*
@ -10,7 +10,7 @@
#include <dirent.h>
#include "ksh_stat.h"
__RCSID("$MirBSD: src/bin/ksh/eval.c,v 2.9 2004/12/31 19:37:03 tg Exp $");
__RCSID("$MirOS$");
#ifdef OPENDIR_DOES_NONDIR
extern DIR *ksh_opendir(const char *d);

4
exec.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/exec.c,v 2.9 2004/12/31 17:42:44 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: exec.c,v 1.35 2004/12/18 22:35:41 millert Exp $ */
/*
@ -10,7 +10,7 @@
#include <ctype.h>
#include "ksh_stat.h"
__RCSID("$MirBSD: src/bin/ksh/exec.c,v 2.9 2004/12/31 17:42:44 tg Exp $");
__RCSID("$MirOS$");
static int comexec(struct op *t, struct tbl *volatile tp, char **ap,
int volatile flags);

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/expand.h,v 2.1 2004/12/10 18:09:41 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: expand.h,v 1.3 2001/03/26 16:19:45 todd Exp $ */
#ifndef EXPAND_H

4
expr.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/expr.c,v 2.6 2004/12/28 22:40:40 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: expr.c,v 1.16 2004/12/22 18:57:28 otto Exp $ */
/*
@ -8,7 +8,7 @@
#include "sh.h"
#include <ctype.h>
__RCSID("$MirBSD: src/bin/ksh/expr.c,v 2.6 2004/12/28 22:40:40 tg Exp $");
__RCSID("$MirOS$");
/* The order of these enums is constrained by the order of opinfo[] */
enum token {

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/history.c,v 2.7 2004/12/28 22:32:08 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: history.c,v 1.24 2004/08/03 12:44:59 danh Exp $ */
/*
@ -21,7 +21,7 @@
#include "sh.h"
#include "ksh_stat.h"
__RCSID("$MirBSD: src/bin/ksh/history.c,v 2.7 2004/12/28 22:32:08 tg Exp $");
__RCSID("$MirOS$");
#ifndef EASY_HISTORY
/* Defines and includes for the complicated case */

2
io.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/io.c,v 2.6 2004/12/31 17:42:45 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: io.c,v 1.17 2004/12/18 22:35:41 millert Exp $ */
/*

4
jobs.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/jobs.c,v 2.8 2004/12/31 18:41:47 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: jobs.c,v 1.30 2004/12/22 18:48:56 millert Exp $ */
/*
@ -32,7 +32,7 @@
#include <sys/resource.h>
#include "tty.h"
__RCSID("$MirBSD: src/bin/ksh/jobs.c,v 2.8 2004/12/31 18:41:47 tg Exp $");
__RCSID("$MirOS$");
/* Start of system configuration stuff */

View File

@ -1,4 +1,4 @@
.\" $MirBSD: src/bin/ksh/ksh.1tbl,v 2.11 2005/01/18 17:12:21 tg Exp $
.\" $MirOS$
.\" $OpenBSD: ksh.1tbl,v 1.84 2004/12/22 18:58:44 millert Exp $
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
.\"

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/ksh_stat.h,v 2.1 2004/12/10 18:09:41 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: ksh_stat.h,v 1.3 1996/10/01 02:05:39 downsj Exp $ */
#ifndef KSH_STAT_H

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/ksh_wait.h,v 2.2 2004/12/18 19:22:29 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: ksh_wait.h,v 1.3 1997/06/19 13:58:43 kstailey Exp $ */
#ifndef KSH_WAIT_H

4
lex.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/lex.c,v 2.8 2004/12/28 22:40:40 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: lex.c,v 1.30 2004/12/22 18:57:28 otto Exp $ */
/*
@ -8,7 +8,7 @@
#include "sh.h"
#include <ctype.h>
__RCSID("$MirBSD: src/bin/ksh/lex.c,v 2.8 2004/12/28 22:40:40 tg Exp $");
__RCSID("$MirOS$");
/* Structure to keep track of the lexing state and the various pieces of info
* needed for each particular state.

2
lex.h
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/lex.h,v 2.3 2004/12/18 19:17:10 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: lex.h,v 1.8 2004/11/02 22:09:24 deraadt Exp $ */
/* $From: lex.h,v 1.4 1994/05/31 13:34:34 michael Exp $ */

4
main.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/main.c,v 2.16 2005/01/18 17:12:22 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: main.c,v 1.35 2004/12/22 18:57:28 otto Exp $ */
/*
@ -15,7 +15,7 @@
* shell version
*/
__RCSID("$MirBSD: src/bin/ksh/main.c,v 2.16 2005/01/18 17:12:22 tg Exp $");
__RCSID("$MirOS$");
const char ksh_version[] =
"@(#)PD KSH v5.2.14 MirOS R20 in "

4
misc.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/misc.c,v 2.10 2004/12/31 19:37:03 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: misc.c,v 1.20 2003/10/22 07:40:38 jmc Exp $ */
/*
@ -11,7 +11,7 @@
#include <dirent.h>
#include "ksh_stat.h"
__RCSID("$MirBSD: src/bin/ksh/misc.c,v 2.10 2004/12/31 19:37:03 tg Exp $");
__RCSID("$MirOS$");
#ifndef UCHAR_MAX
# define UCHAR_MAX 0xFF

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/missing.c,v 2.6 2004/12/31 19:37:03 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: missing.c,v 1.5 2003/05/16 18:49:46 jsyn Exp $ */
/*
@ -8,7 +8,7 @@
#include "sh.h"
#include "ksh_stat.h"
__RCSID("$MirBSD: src/bin/ksh/missing.c,v 2.6 2004/12/31 19:37:03 tg Exp $");
__RCSID("$MirOS$");
#ifndef HAVE_STRERROR
char *

4
path.c
View File

@ -1,10 +1,10 @@
/** $MirBSD: src/bin/ksh/path.c,v 2.3 2004/12/18 19:22:30 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: path.c,v 1.9 2003/10/22 07:40:38 jmc Exp $ */
#include "sh.h"
#include "ksh_stat.h"
__RCSID("$MirBSD: src/bin/ksh/path.c,v 2.3 2004/12/18 19:22:30 tg Exp $");
__RCSID("$MirOS$");
/*
* Contains a routine to search a : separated list of

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/proto.h,v 2.10 2004/12/31 17:42:45 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: proto.h,v 1.11 2003/05/16 19:58:57 jsyn Exp $ */
/* $From: proto.h,v 1.3 1994/05/19 18:32:40 michael Exp michael $ */

View File

@ -1,4 +1,4 @@
.\" $MirBSD: src/bin/ksh/sh.1tbl,v 2.6 2005/01/02 21:49:12 tg Exp $
.\" $MirOS$
.\" _MirBSD: src/bin/ksh/ksh.1tbl,v 2.10 2004/12/31 19:00:30 tg Exp $
.\" $OpenBSD: ksh.1tbl,v 1.84 2004/12/22 18:58:44 millert Exp $
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $

2
sh.h
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/sh.h,v 2.12 2004/12/31 19:54:16 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: sh.h,v 1.23 2004/12/18 22:11:43 millert Exp $ */
/* $From: sh.h,v 1.2 1994/05/19 18:32:40 michael Exp michael $ */

4
shf.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/shf.c,v 2.5 2004/12/31 19:37:03 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: shf.c,v 1.10 2004/12/18 22:35:41 millert Exp $ */
/*
@ -8,7 +8,7 @@
#include "sh.h"
#include "ksh_stat.h"
__RCSID("$MirBSD: src/bin/ksh/shf.c,v 2.5 2004/12/31 19:37:03 tg Exp $");
__RCSID("$MirOS$");
/* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */

2
shf.h
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/shf.h,v 2.1 2004/12/10 18:09:42 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: shf.h,v 1.2 1999/01/08 20:25:02 millert Exp $ */
#ifndef SHF_H

4
syn.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/syn.c,v 2.5 2004/12/28 22:32:08 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: syn.c,v 1.14 2003/10/22 07:40:38 jmc Exp $ */
/*
@ -8,7 +8,7 @@
#include "sh.h"
#include "c_test.h"
__RCSID("$MirBSD: src/bin/ksh/syn.c,v 2.5 2004/12/28 22:32:08 tg Exp $");
__RCSID("$MirOS$");
struct nesting_state {
int start_token; /* token than began nesting (eg, FOR) */

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/table.c,v 2.2 2004/12/18 19:22:30 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: table.c,v 1.5 1999/01/10 17:55:03 millert Exp $ */
/*
@ -7,7 +7,7 @@
#include "sh.h"
__RCSID("$MirBSD: src/bin/ksh/table.c,v 2.2 2004/12/18 19:22:30 tg Exp $");
__RCSID("$MirOS$");
#define INIT_TBLS 8 /* initial table size (power of 2) */

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/table.h,v 2.2 2005/01/18 17:12:22 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: table.h,v 1.5 1999/06/15 01:18:36 millert Exp $ */
/* $From: table.h,v 1.3 1994/05/31 13:34:34 michael Exp $ */

View File

@ -1,4 +1,4 @@
# $MirBSD: src/bin/ksh/tests/bksl-nl.t,v 2.1 2004/12/10 18:09:44 tg Exp $
# $MirOS$
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
#
# These tests deal with how \newline is handled in various situations. The

View File

@ -1,4 +1,4 @@
# $MirBSD: src/bin/ksh/tests/history.t,v 2.1 2004/12/10 18:09:44 tg Exp $
# $MirOS$
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
#
# Not tested yet:

View File

@ -1,4 +1,4 @@
# $MirBSD: src/bin/ksh/tests/read.t,v 2.1 2004/12/10 18:09:45 tg Exp $
# $MirOS$
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
#
# To test:

View File

@ -1,4 +1,4 @@
# $MirBSD: src/bin/ksh/tests/regress.t,v 2.1 2004/12/10 18:09:45 tg Exp $
# $MirOS$
# $OpenBSD: regress.t,v 1.12 2003/11/08 19:17:27 jmc Exp $
#
# The first 39 of these tests are from the old Bugs script.

View File

@ -1,5 +1,5 @@
#!/usr/bin/perl
# $MirBSD: src/bin/ksh/tests/th,v 2.1 2004/12/10 18:09:45 tg Exp $
# $MirOS$
# $OpenBSD: th,v 1.10 2003/09/01 05:16:46 fgsch Exp $
#
# Test harness for pdksh tests.

4
trap.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/trap.c,v 2.6 2004/12/31 19:24:20 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: trap.c,v 1.19 2004/12/22 17:47:03 millert Exp $ */
/*
@ -9,7 +9,7 @@
#define FROM_TRAP_C
#include "sh.h"
__RCSID("$MirBSD: src/bin/ksh/trap.c,v 2.6 2004/12/31 19:24:20 tg Exp $");
__RCSID("$MirOS$");
Trap sigtraps[NSIG + 1];

4
tree.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/tree.c,v 2.3 2004/12/18 19:22:30 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: tree.c,v 1.10 2002/02/27 19:37:09 dhartmei Exp $ */
/*
@ -7,7 +7,7 @@
#include "sh.h"
__RCSID("$MirBSD: src/bin/ksh/tree.c,v 2.3 2004/12/18 19:22:30 tg Exp $");
__RCSID("$MirOS$");
#define INDENT 4

2
tree.h
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/tree.h,v 2.2 2004/12/13 19:05:09 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: tree.h,v 1.8 2003/10/22 07:40:38 jmc Exp $ */
/* $From: tree.h,v 1.3 1994/05/31 13:34:34 michael Exp $ */

4
tty.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/tty.c,v 2.4 2004/12/31 17:42:45 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: tty.c,v 1.5 2004/12/18 22:35:41 millert Exp $ */
#include "sh.h"
@ -7,7 +7,7 @@
#include "tty.h"
#undef EXTERN
__RCSID("$MirBSD: src/bin/ksh/tty.c,v 2.4 2004/12/31 17:42:45 tg Exp $");
__RCSID("$MirOS$");
/* Initialize tty_fd. Used for saving/reseting tty modes upon
* foreground job completion and for setting up tty process group.

2
tty.h
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/tty.h,v 2.2 2004/12/31 17:39:12 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: tty.h,v 1.4 2004/12/18 22:12:23 millert Exp $ */
#ifndef TTY_H

4
var.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/var.c,v 2.9 2005/01/18 17:12:22 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: var.c,v 1.17 2004/05/08 19:42:35 deraadt Exp $ */
#include "sh.h"
@ -6,7 +6,7 @@
#include "ksh_stat.h"
#include <ctype.h>
__RCSID("$MirBSD: src/bin/ksh/var.c,v 2.9 2005/01/18 17:12:22 tg Exp $");
__RCSID("$MirOS$");
/*
* Variables

4
vi.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/vi.c,v 2.5 2004/12/28 22:32:09 tg Exp $ */
/** $MirOS$ */
/* $OpenBSD: vi.c,v 1.13 2004/05/10 16:28:47 pvalchev Exp $ */
/*
@ -14,7 +14,7 @@
#include "ksh_stat.h" /* completion */
#include "edit.h"
__RCSID("$MirBSD: src/bin/ksh/vi.c,v 2.5 2004/12/28 22:32:09 tg Exp $");
__RCSID("$MirOS$");
#define Ctrl(c) (c&0x1f)
#define is_wordch(c) (letnum(c))