aboutsummaryrefslogtreecommitdiff
path: root/jim-posix.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-01-24 10:26:24 +1000
committerSteve Bennett <steveb@workware.net.au>2010-10-15 11:02:38 +1000
commit1df9b19429212012b245a88b08ab37caef564d1c (patch)
treee48d6153d5cde43723f2729d92e0b75d7e848ea1 /jim-posix.c
parentc4ec906079ac99fe52e8c4b27036ca0f2495848f (diff)
downloadjimtcl-1df9b19429212012b245a88b08ab37caef564d1c.zip
jimtcl-1df9b19429212012b245a88b08ab37caef564d1c.tar.gz
jimtcl-1df9b19429212012b245a88b08ab37caef564d1c.tar.bz2
Implement some new features
Implement 'lreplace' Implement 'string last' Implement 'pid' Implement 'info procs' Implement 'info script' Implement 'info patchlevel' as an alias for 'info version' Implement syslog extensions for jim Fix return code display in jim-interactive.c Make jim more compatible if JIM_TCL_COMPAT is set *: Use tcl_interactive rather than jim_interactive *: Use auto_path rather than jim_libpath Add "." to the lib search path, not "./" Fix a couple of files with CRLF line endings
Diffstat (limited to 'jim-posix.c')
-rw-r--r--jim-posix.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/jim-posix.c b/jim-posix.c
index 9a81a55..a7dba75 100644
--- a/jim-posix.c
+++ b/jim-posix.c
@@ -88,6 +88,17 @@ static int Jim_PosixGethostnameCommand(Jim_Interp *interp, int argc,
return JIM_OK;
}
+static int Jim_PosixPidCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+{
+ if (argc != 1) {
+ Jim_WrongNumArgs(interp, 1, argv, "");
+ return JIM_ERR;
+ }
+
+ Jim_SetResultInt(interp, getpid());
+ return JIM_OK;
+}
+
// end added
int Jim_posixInit(Jim_Interp *interp)
{
@@ -96,5 +107,6 @@ int Jim_posixInit(Jim_Interp *interp)
Jim_CreateCommand(interp, "os.fork", Jim_PosixForkCommand, NULL, NULL);
Jim_CreateCommand(interp, "os.getids", Jim_PosixGetidsCommand, NULL, NULL);
Jim_CreateCommand(interp, "os.gethostname", Jim_PosixGethostnameCommand, NULL, NULL);
+ Jim_CreateCommand(interp, "pid", Jim_PosixPidCommand, NULL, NULL);
return JIM_OK;
}