aboutsummaryrefslogtreecommitdiff
path: root/jim-posix.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-08-12 12:27:33 +1000
committerSteve Bennett <steveb@workware.net.au>2010-10-15 11:02:50 +1000
commit4374aaf2b8c59544f9c39ededfdfe659eae9c9c0 (patch)
treed2df29aa83e80b0b2f82ed713a7aaf78f30813e6 /jim-posix.c
parent0f4cb39eb1ebaf3cc931b450b517a177beb8c05e (diff)
downloadjimtcl-4374aaf2b8c59544f9c39ededfdfe659eae9c9c0.zip
jimtcl-4374aaf2b8c59544f9c39ededfdfe659eae9c9c0.tar.gz
jimtcl-4374aaf2b8c59544f9c39ededfdfe659eae9c9c0.tar.bz2
Improvements to jim configure
Create and use config.h Check for backtrace, fork, vfork, syslog, regcomp and others Disable extensions which require missing functions/features Check for one arg vs. two arg mkdir() Distinguish between mingw and native windows The aio extension has reduced functionality for ANSI C only Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim-posix.c')
-rw-r--r--jim-posix.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/jim-posix.c b/jim-posix.c
index df8ed48..7aa266e 100644
--- a/jim-posix.c
+++ b/jim-posix.c
@@ -20,29 +20,26 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/wait.h>
-#ifdef HAVE_SYSINFO
-#include <sys/sysinfo.h>
-#endif
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
-#define JIM_EXTENSION
#include "jim.h"
+#ifdef HAVE_SYSINFO
+#include <sys/sysinfo.h>
+#endif
+
static void Jim_PosixSetError(Jim_Interp *interp)
{
Jim_SetResultString(interp, strerror(errno), -1);
}
+#ifdef HAVE_FORK
static int Jim_PosixForkCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
-#ifdef JIM_NOFORK
- Jim_SetResultString(interp, "Not supported", -1);
- return JIM_ERR;
-#else
pid_t pid;
JIM_NOTUSED(argv);
@@ -56,8 +53,8 @@ static int Jim_PosixForkCommand(Jim_Interp *interp, int argc,
}
Jim_SetResultInt(interp, (jim_wide)pid);
return JIM_OK;
-#endif
}
+#endif
/*
* os.wait ?-nohang? pid
@@ -217,7 +214,9 @@ int Jim_posixInit(Jim_Interp *interp)
{
if (Jim_PackageProvide(interp, "posix", "1.0", JIM_ERRMSG) != JIM_OK)
return JIM_ERR;
+#ifdef HAVE_FORK
Jim_CreateCommand(interp, "os.fork", Jim_PosixForkCommand, NULL, NULL);
+#endif
Jim_CreateCommand(interp, "os.wait", Jim_PosixWaitCommand, NULL, NULL);
Jim_CreateCommand(interp, "os.getids", Jim_PosixGetidsCommand, NULL, NULL);
Jim_CreateCommand(interp, "os.gethostname", Jim_PosixGethostnameCommand, NULL, NULL);