1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
$NetBSD: patch-ap,v 1.2 2005/12/14 13:53:24 joerg Exp $
--- tcl/tclCmdAH.c.orig 1995-02-24 21:19:53.000000000 +0000
+++ tcl/tclCmdAH.c
@@ -38,9 +38,21 @@ static char rcsid[] = "$Header: /home/ag
#include <sys/wait.h>
#include "tclInt.h"
-extern int errno;
+#ifdef __NetBSD__
+#define unix
+#endif
+
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
+#include <sys/param.h>
+#include <unistd.h>
+#endif
+
+#if !(defined(BSD) && BSD >= 199306)
extern long lseek();
+#endif
+#ifndef BSD4_4
extern char *mktemp();
+#endif
/*
*----------------------------------------------------------------------
@@ -430,7 +442,7 @@ Tcl_ExecCmd(dummy, interp, argc, argv)
int pid = -1; /* -1 means child process doesn't
* exist (yet). Non-zero gives its
* id (0 only in child). */
- union wait status;
+ int status;
char *cmdName, *execName;
/*
@@ -501,8 +513,13 @@ Tcl_ExecCmd(dummy, interp, argc, argv)
} else {
char tmp[sizeof(TMP_FILE_NAME) + 1];
strcpy(tmp, TMP_FILE_NAME);
+#ifdef BSD4_4
+ mkstemp(tmp);
+ stdIn[0] = mkstemp(tmp);
+#else
mktemp(tmp);
stdIn[0] = open(tmp, O_RDWR|O_CREAT, 0);
+#endif
if (stdIn[0] < 0) {
sprintf(interp->result,
"couldn't create input file for \"%.50s\" command: %.50s",
@@ -642,7 +659,7 @@ Tcl_ExecCmd(dummy, interp, argc, argv)
sprintf(interp->result, "command terminated abnormally");
result = TCL_ERROR;
}
- result = status.w_retcode;
+ result = WEXITSTATUS(status);
}
if (stdIn[0] != -1) {
close(stdIn[0]);
|