diff options
Diffstat (limited to 'jim-posix.c')
-rw-r--r-- | jim-posix.c | 12 |
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; } |