Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ksh Temporarily revert previous.
details: https://anonhg.NetBSD.org/src/rev/8772e1f95c06
branches: trunk
changeset: 354595:8772e1f95c06
user: kamil <kamil%NetBSD.org@localhost>
date: Thu Jun 22 14:11:27 2017 +0000
description:
Temporarily revert previous.
emacs.* gets wrong code in generation
diffstat:
bin/ksh/c_ksh.c | 40 +++++++++++++-
bin/ksh/c_sh.c | 15 ++++-
bin/ksh/c_ulimit.c | 7 +-
bin/ksh/config.h | 19 ++++++-
bin/ksh/edit.c | 18 +++++-
bin/ksh/emacs.c | 53 +++++++++++++++++-
bin/ksh/eval.c | 17 +++++-
bin/ksh/exec.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++-
bin/ksh/history.c | 8 ++-
bin/ksh/io.c | 20 ++++++-
bin/ksh/jobs.c | 8 ++-
bin/ksh/lex.c | 10 ++-
bin/ksh/main.c | 74 +++++++++++++++++++++++++-
bin/ksh/misc.c | 33 ++++++++++-
bin/ksh/path.c | 19 ++++++-
bin/ksh/sh.h | 49 ++++++++++++++++-
bin/ksh/shf.c | 11 +++-
bin/ksh/trap.c | 7 +-
bin/ksh/tree.h | 5 +-
bin/ksh/vi.c | 31 ++++++++++-
20 files changed, 551 insertions(+), 43 deletions(-)
diffs (truncated from 1369 to 300 lines):
diff -r cdcf75510b3c -r 8772e1f95c06 bin/ksh/c_ksh.c
--- a/bin/ksh/c_ksh.c Thu Jun 22 13:42:09 2017 +0000
+++ b/bin/ksh/c_ksh.c Thu Jun 22 14:11:27 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: c_ksh.c,v 1.21 2017/06/22 13:35:47 kamil Exp $ */
+/* $NetBSD: c_ksh.c,v 1.22 2017/06/22 14:11:27 kamil Exp $ */
/*
* built-in Korn commands: c_*
@@ -6,13 +6,17 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.21 2017/06/22 13:35:47 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.22 2017/06/22 14:11:27 kamil Exp $");
#endif
#include "sh.h"
#include "ksh_stat.h"
#include <ctype.h>
+#ifdef __CYGWIN__
+#include <sys/cygwin.h>
+#endif /* __CYGWIN__ */
+
int
c_cd(wp)
char **wp;
@@ -141,7 +145,15 @@
setstr(oldpwd_s, current_wd, KSH_RETURN_ERROR);
if (!ISABSPATH(Xstring(xs, xp))) {
+#ifdef OS2
+ /* simplify_path() doesn't know about os/2's drive contexts,
+ * so it can't set current_wd when changing to a:foo.
+ * Handle this by calling getcwd()...
+ */
+ pwd = ksh_get_wd((char *) 0, 0);
+#else /* OS2 */
pwd = (char *) 0;
+#endif /* OS2 */
} else
#ifdef S_ISLNK
if (!physical || !(pwd = get_phys_path(Xstring(xs, xp))))
@@ -150,7 +162,12 @@
/* Set PWD */
if (pwd) {
+#ifdef __CYGWIN__
+ char ptmp[PATH]; /* larger than MAX_PATH */
+ cygwin_conv_to_full_posix_path(pwd, ptmp);
+#else /* __CYGWIN__ */
char *ptmp = pwd;
+#endif /* __CYGWIN__ */
set_current_wd(ptmp);
/* Ignore failure (happens if readonly or integer) */
setstr(pwd_s, ptmp, KSH_RETURN_ERROR);
@@ -224,6 +241,7 @@
#define PO_PMINUSMINUS BIT(2) /* print a -- argument */
#define PO_HIST BIT(3) /* print to history instead of stdout */
#define PO_COPROC BIT(4) /* printing to coprocess: block SIGPIPE */
+#define PO_FSLASH BIT(5) /* swap slash for backslash (for os2 ) */
int fd = 1;
int flags = PO_EXPAND|PO_NL;
char *s;
@@ -264,7 +282,11 @@
}
} else {
int optc;
+#if OS2
+ const char *options = "Rnpfrsu,"; /* added f flag */
+#else
const char *options = "Rnprsu,";
+#endif
while ((optc = ksh_getopt(wp, &builtin_opt, options)) != EOF)
switch (optc) {
case 'R': /* fake BSD echo command */
@@ -275,6 +297,11 @@
case 'e':
flags |= PO_EXPAND;
break;
+#ifdef OS2
+ case 'f':
+ flags |= PO_FSLASH;
+ break;
+#endif
case 'n':
flags &= ~PO_NL;
break;
@@ -320,12 +347,19 @@
s = *wp;
while ((c = *s++) != '\0') {
Xcheck(xs, xp);
+#ifdef OS2
+ if ((flags & PO_FSLASH) && c == '\\')
+ if (*s == '\\')
+ *s++;
+ else
+ c = '/';
+#endif /* OS2 */
if ((flags & PO_EXPAND) && c == '\\') {
int i;
switch ((c = *s++)) {
/* Oddly enough, \007 seems more portable than
- * \a (due to Ultrix cc, old pcc's,
+ * \a (due to HP-UX cc, Ultrix cc, old pcc's,
* etc.).
*/
case 'a': c = '\007'; break;
diff -r cdcf75510b3c -r 8772e1f95c06 bin/ksh/c_sh.c
--- a/bin/ksh/c_sh.c Thu Jun 22 13:42:09 2017 +0000
+++ b/bin/ksh/c_sh.c Thu Jun 22 14:11:27 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: c_sh.c,v 1.17 2017/06/22 13:33:39 kamil Exp $ */
+/* $NetBSD: c_sh.c,v 1.18 2017/06/22 14:11:27 kamil Exp $ */
/*
* built-in Bourne commands
@@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.17 2017/06/22 13:33:39 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.18 2017/06/22 14:11:27 kamil Exp $");
#endif
@@ -331,6 +331,9 @@
while (1) {
c = shf_getc(shf);
if (c == '\0'
+#ifdef OS2
+ || c == '\r'
+#endif /* OS2 */
)
continue;
if (c == EOF && shf_error(shf)
@@ -902,5 +905,13 @@
{"ulimit", c_ulimit},
{"+umask", c_umask},
{"*=unset", c_unset},
+#ifdef OS2
+ /* In OS2, the first line of a file can be "extproc name", which
+ * tells the command interpreter (cmd.exe) to use name to execute
+ * the file. For this to be useful, ksh must ignore commands
+ * starting with extproc and this does the trick...
+ */
+ {"extproc", c_label},
+#endif /* OS2 */
{NULL, NULL}
};
diff -r cdcf75510b3c -r 8772e1f95c06 bin/ksh/c_ulimit.c
--- a/bin/ksh/c_ulimit.c Thu Jun 22 13:42:09 2017 +0000
+++ b/bin/ksh/c_ulimit.c Thu Jun 22 14:11:27 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: c_ulimit.c,v 1.13 2017/06/22 13:35:47 kamil Exp $ */
+/* $NetBSD: c_ulimit.c,v 1.14 2017/06/22 14:11:27 kamil Exp $ */
/*
ulimit -- handle "ulimit" builtin
@@ -20,7 +20,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: c_ulimit.c,v 1.13 2017/06/22 13:35:47 kamil Exp $");
+__RCSID("$NetBSD: c_ulimit.c,v 1.14 2017/06/22 14:11:27 kamil Exp $");
#endif
@@ -113,6 +113,9 @@
# ifdef UL_GETBREAK /* osf/1 */
{ "vmemory(maxaddr)", ULIMIT, UL_GETBREAK, -1, 1, 'v' },
# else /* UL_GETBREAK */
+# ifdef UL_GETMAXBRK /* hpux */
+ { "vmemory(maxaddr)", ULIMIT, UL_GETMAXBRK, -1, 1, 'v' },
+# endif /* UL_GETMAXBRK */
# endif /* UL_GETBREAK */
# endif /* UL_GMEMLIM */
#endif /* RLIMIT_VMEM */
diff -r cdcf75510b3c -r 8772e1f95c06 bin/ksh/config.h
--- a/bin/ksh/config.h Thu Jun 22 13:42:09 2017 +0000
+++ b/bin/ksh/config.h Thu Jun 22 14:11:27 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: config.h,v 1.12 2017/06/22 13:37:16 kamil Exp $ */
+/* $NetBSD: config.h,v 1.13 2017/06/22 14:11:27 kamil Exp $ */
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
@@ -11,6 +11,13 @@
#ifndef CONFIG_H
#define CONFIG_H
+/* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+/* #undef _ALL_SOURCE */
+#endif
+
/* Define if the closedir function returns void instead of int. */
/* #undef CLOSEDIR_VOID */
@@ -171,9 +178,15 @@
/* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
/* #undef NEED_PGRP_SYNC */
+/* Define if you arg running SCO unix */
+/* #undef OS_SCO */
+
/* Define if you arg running ISC unix */
/* #undef OS_ISC */
+/* Define if you arg running OS2 with the EMX library */
+/* #undef OS2 */
+
/* Define if you have a POSIX.1 compatible <sys/wait.h> */
#define POSIX_SYS_WAIT 1
@@ -187,6 +200,10 @@
#define DEFAULT_PATH "/bin:/usr/bin:/sbin:/usr/sbin"
#endif
+/* Define if your C library's getwd/getcwd function dumps core in unreadable
+ * directories. */
+/* #undef HPUX_GETWD_BUG */
+
/* Include ksh features? */
#define KSH 1
diff -r cdcf75510b3c -r 8772e1f95c06 bin/ksh/edit.c
--- a/bin/ksh/edit.c Thu Jun 22 13:42:09 2017 +0000
+++ b/bin/ksh/edit.c Thu Jun 22 14:11:27 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: edit.c,v 1.28 2017/06/22 13:34:48 kamil Exp $ */
+/* $NetBSD: edit.c,v 1.29 2017/06/22 14:11:27 kamil Exp $ */
/*
* Command line editing - common code
@@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: edit.c,v 1.28 2017/06/22 13:34:48 kamil Exp $");
+__RCSID("$NetBSD: edit.c,v 1.29 2017/06/22 14:11:27 kamil Exp $");
#endif
@@ -19,6 +19,10 @@
#define EXTERN
#include "edit.h"
#undef EXTERN
+#ifdef OS_SCO /* SCO Unix 3.2v4.1 */
+# include <sys/stream.h> /* needed for <sys/ptem.h> */
+# include <sys/ptem.h> /* needed for struct winsize */
+#endif /* OS_SCO */
#include <sys/ioctl.h>
#include <ctype.h>
#include "ksh_stat.h"
@@ -157,6 +161,10 @@
int
x_getc()
{
+#ifdef OS2
+ unsigned char c = _read_kbd(0, 1, 0);
+ return c == 0 ? 0xE0 : c;
+#else /* OS2 */
char c;
int n;
@@ -169,6 +177,7 @@
if (n != 1)
return -1;
return (int) (unsigned char) c;
+#endif /* OS2 */
}
void
@@ -284,6 +293,11 @@
set_tty(tty_fd, &cb, TF_WAIT);
+#ifdef __CYGWIN__
+ if (edchars.eof == '\0')
+ edchars.eof = '\4';
+#endif /* __CYGWIN__ */
+
/* Convert unset values to internal `unset' value */
if (edchars.erase == vdisable_c)
edchars.erase = -1;
diff -r cdcf75510b3c -r 8772e1f95c06 bin/ksh/emacs.c
--- a/bin/ksh/emacs.c Thu Jun 22 13:42:09 2017 +0000
+++ b/bin/ksh/emacs.c Thu Jun 22 14:11:27 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emacs.c,v 1.33 2017/06/22 13:33:39 kamil Exp $ */
+/* $NetBSD: emacs.c,v 1.34 2017/06/22 14:11:27 kamil Exp $ */
/*
* Emacs-like command line editing and history
@@ -10,7 +10,7 @@
Home |
Main Index |
Thread Index |
Old Index