Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ksh ksh: Drop support for systems without handling shebang
details: https://anonhg.NetBSD.org/src/rev/42cc90ae915d
branches: trunk
changeset: 354791:42cc90ae915d
user: kamil <kamil%NetBSD.org@localhost>
date: Fri Jun 30 02:06:59 2017 +0000
description:
ksh: Drop support for systems without handling shebang
diffstat:
bin/ksh/config.h | 5 +----
bin/ksh/eval.c | 11 ++---------
bin/ksh/exec.c | 51 ++-------------------------------------------------
3 files changed, 5 insertions(+), 62 deletions(-)
diffs (127 lines):
diff -r 1bf879473f55 -r 42cc90ae915d bin/ksh/config.h
--- a/bin/ksh/config.h Fri Jun 30 02:02:41 2017 +0000
+++ b/bin/ksh/config.h Fri Jun 30 02:06:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: config.h,v 1.41 2017/06/30 02:02:41 kamil Exp $ */
+/* $NetBSD: config.h,v 1.42 2017/06/30 02:06:59 kamil Exp $ */
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
@@ -36,9 +36,6 @@
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
-/* Define if your kernel doesn't handle scripts starting with #! */
-/* #undef SHARPBANG */
-
/* Define as the return value of signal handlers (0 or ). */
#define RETSIGVAL
diff -r 1bf879473f55 -r 42cc90ae915d bin/ksh/eval.c
--- a/bin/ksh/eval.c Fri Jun 30 02:02:41 2017 +0000
+++ b/bin/ksh/eval.c Fri Jun 30 02:06:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: eval.c,v 1.19 2017/06/22 14:20:46 kamil Exp $ */
+/* $NetBSD: eval.c,v 1.20 2017/06/30 02:06:59 kamil Exp $ */
/*
* Expansion - quoting, separation, substitution, globbing
@@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: eval.c,v 1.19 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: eval.c,v 1.20 2017/06/30 02:06:59 kamil Exp $");
#endif
#include <stdint.h>
@@ -95,17 +95,10 @@
return ap;
XPinit(w, 32);
XPput(w, NULL); /* space for shell name */
-#ifdef SHARPBANG
- XPput(w, NULL); /* and space for one arg */
-#endif
while (*ap != NULL)
expand(*ap++, &w, f);
XPput(w, NULL);
-#ifdef SHARPBANG
- return (char **) XPclose(w) + 2;
-#else
return (char **) XPclose(w) + 1;
-#endif
}
/*
diff -r 1bf879473f55 -r 42cc90ae915d bin/ksh/exec.c
--- a/bin/ksh/exec.c Fri Jun 30 02:02:41 2017 +0000
+++ b/bin/ksh/exec.c Fri Jun 30 02:06:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.19 2017/06/22 23:47:29 kamil Exp $ */
+/* $NetBSD: exec.c,v 1.20 2017/06/30 02:06:59 kamil Exp $ */
/*
* execute command tree
@@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.19 2017/06/22 23:47:29 kamil Exp $");
+__RCSID("$NetBSD: exec.c,v 1.20 2017/06/30 02:06:59 kamil Exp $");
#endif
@@ -764,53 +764,6 @@
shellv = __UNCONST(EXECSHELL);
*tp->args-- = tp->str;
-#ifdef SHARPBANG
- {
- char buf[LINE];
- register char *cp;
- register int fd, n;
-
- buf[0] = '\0';
- if ((fd = open(tp->str, O_RDONLY)) >= 0) {
- if ((n = read(fd, buf, LINE - 1)) > 0)
- buf[n] = '\0';
- (void) close(fd);
- }
- if ((buf[0] == '#' && buf[1] == '!' && (cp = &buf[2]))
- )
- {
- while (*cp && (*cp == ' ' || *cp == '\t'))
- cp++;
- if (*cp && *cp != '\n') {
- char *a0 = cp, *a1 = (char *) 0;
-
- while (*cp && *cp != '\n' && *cp != ' '
- && *cp != '\t')
- {
- cp++;
- }
- if (*cp && *cp != '\n') {
- *cp++ = '\0';
- while (*cp
- && (*cp == ' ' || *cp == '\t'))
- cp++;
- if (*cp && *cp != '\n') {
- a1 = cp;
- /* all one argument */
- while (*cp && *cp != '\n')
- cp++;
- }
- }
- if (*cp == '\n') {
- *cp = '\0';
- if (a1)
- *tp->args-- = a1;
- shellv = a0;
- }
- }
- }
- }
-#endif /* SHARPBANG */
*tp->args = shellv;
execve(tp->args[0], tp->args, ap);
Home |
Main Index |
Thread Index |
Old Index