Update of /cvsroot/opengtoolkit/pipe/c_source
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25244/c_source
Modified Files:
pipes.c
Log Message:
Added Create and Kill Process functions
Index: pipes.c
===================================================================
RCS file: /cvsroot/opengtoolkit/pipe/c_source/pipes.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** pipes.c 30 Jun 2005 21:10:59 -0000 1.16
--- pipes.c 27 Oct 2006 20:09:58 -0000 1.17
***************
*** 37,40 ****
--- 37,41 ----
typedef enum {
+ kNone,
kReadMode,
kWriteMode,
***************
*** 187,191 ****
pipe_handle hChildStdout = 0L, hChildStdin = 0L, hChildStderr = 0L;
#endif
-
if ((mode > kReadWriteMode) ||
((mode == kReadMode || mode == kReadWriteMode) && !fdIn) ||
--- 188,191 ----
***************
*** 220,223 ****
--- 220,226 ----
out:
+ if (processID && err)
+ *processID = 0;
+
/* After process creation, restore the saved STDIN. STDOUT,
and STDERR. Also close the intermediate handle. */
***************
*** 239,242 ****
--- 242,269 ----
}
+ MgErr LibAPI KillProcess(uInt32 pid)
+ {
+ MgErr err = noErr;
+ #if defined(MSWin)
+ HANDLE handle;
+ #endif
+
+ if (!pid)
+ return mgArgErr;
+
+ #if defined(MSWin)
+ handle = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
+ if (!handle)
+ return Win32ToLVErr(GetLastError());
+
+ if (!TerminateProcess(handle, 0))
+ err = Win32ToLVErr(GetLastError());
+ CloseHandle(handle);
+ #elif defined(Unix)
+ #else
+ err = mgNotImplementd;
+ #endif
+ return err;
+ }
MgErr LibAPI PipeClose(uInt32 fd)
{
***************
*** 450,455 ****
*lvpipe = 0;
}
-
-
#else
return mgNotImplementd
--- 477,480 ----
***************
*** 627,631 ****
else if (error >= MIN_EXEC_ERROR && error <= MAX_EXEC_ERROR)
return mgArgErr;
! return mgArgErr;
}
--- 652,656 ----
else if (error >= MIN_EXEC_ERROR && error <= MAX_EXEC_ERROR)
return mgArgErr;
! return bogusError;
}
***************
*** 669,673 ****
/* The error code wasn't in the table. */
! return mgArgErr
}
--- 694,698 ----
/* The error code wasn't in the table. */
! return bogusError;
}
***************
*** 742,746 ****
/* The error code wasn't in the table. */
! return mgArgErr
}
#endif
\ No newline at end of file
--- 767,771 ----
/* The error code wasn't in the table. */
! return bogusError;
}
#endif
\ No newline at end of file
|