Module Name: src
Committed By: kamil
Date: Fri Jun 30 02:06:59 UTC 2017
Modified Files:
src/bin/ksh: config.h eval.c exec.c
Log Message:
ksh: Drop support for systems without handling shebang
To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/bin/ksh/config.h
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/eval.c src/bin/ksh/exec.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.41 src/bin/ksh/config.h:1.42
--- src/bin/ksh/config.h:1.41 Fri Jun 30 02:02:41 2017
+++ src/bin/ksh/config.h Fri Jun 30 02:06:59 2017
@@ -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
Index: src/bin/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.19 src/bin/ksh/eval.c:1.20
--- src/bin/ksh/eval.c:1.19 Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/eval.c Fri Jun 30 02:06:59 2017
@@ -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 @@ eval(ap, f)
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
}
/*
Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.19 src/bin/ksh/exec.c:1.20
--- src/bin/ksh/exec.c:1.19 Thu Jun 22 23:47:29 2017
+++ src/bin/ksh/exec.c Fri Jun 30 02:06:59 2017
@@ -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 @@ scriptexec(tp, ap)
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);