From 1df9b19429212012b245a88b08ab37caef564d1c Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sun, 24 Jan 2010 10:26:24 +1000 Subject: 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 --- jim-posix.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'jim-posix.c') 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; } -- cgit v1.1