Additions:
They are both the same function, see bsedos.h.
//**Search in API for ""DosSetFHState"" instead of ""DosSetFHandState""**//
16-bit DosSetFHandState 32-bit DosSetFHState
They are both the same function, see bsedos.h.
Additions:
///lib_misc/h/rtdata.h: #define _FP_PIPEDATA(""__""[[OwFILE fp]]) ((""__""[[OwFILE fp]])->_link->pipeInfo)//
//static int connect_pipe( FILE *[[OwFILE fp]], const CHAR_TYPE *command, int *handles,//
Deletions:
///lib_misc/h/rtdata.h: #define _FP_PIPEDATA(""__fp"") ((""__fp"")->_link->pipeInfo)//
//static int connect_pipe( FILE *fp, const CHAR_TYPE *command, int *handles,//
Additions:
if( spawn_it( [[OwFILE fp]], command ) ""=="" 0 ) {
return( [[OwFILE fp]] )
Deletions:
if( spawn_it( fp, command ) ""=="" 0 ) {
return( fp )
Additions:
Sets up spawnvp (P_NOWAIT) for execution. Problem here is that uses CMD.EXE under NT and OS/2, and COMMAND.COM under ""Win95"".
Deletions:
Sets up spawnvp (P_NOWAIT) for execution. Problem here is that uses CMD.EXE under NT and OS/2, and COMMAND.COM under Win95.
Additions:
if( spawn_it( fp, command ) ""=="" 0 ) {
Deletions:
if( spawn_it( fp, command ) == 0 ) {
Additions:
""_FP_PIPEDATA(fp).isPipe = 1;""
///lib_misc/h/rtdata.h: #define _FP_PIPEDATA(""__fp"") ((""__fp"")->_link->pipeInfo)//
if( connect_pipe( fp, command, handles, readOrWrite, textOrBinary ) )
**connect_pipe is static function:**
//static int connect_pipe( FILE *fp, const CHAR_TYPE *command, int *handles,//
//int readOrWrite, int textOrBinary )//
If write -
oldHandle = 0xFFFFFFFF; /* duplicate standard input */
rc = DosDupHandle( STDIN_HANDLE, &oldHandle );
if( rc != NO_ERROR ) {
return( 0 );
}
osHandle = STDIN_HANDLE; /* use new standard input */
rc = DosDupHandle( (HFILE)_os_handle(handles[0]), &osHandle );
if( rc != NO_ERROR ) {
DosClose( oldHandle );
return( 0 );
}
if read -
oldHandle = 0xFFFFFFFF; /* duplicate standard input */
rc = DosDupHandle( STDOUT_HANDLE, &oldHandle );
if( rc != NO_ERROR ) {
return( 0 );
}
osHandle = STDOUT_HANDLE; /* use new standard input */
rc = DosDupHandle( (HFILE)_os_handle(handles[1]), &osHandle );
if( rc != NO_ERROR ) {
DosClose( oldHandle );
return( 0 );
}
/*** Spawn the process and go home ***/
if( spawn_it( fp, command ) == 0 ) {
return( 0 );
}
spawn_it summary:
Sets up spawnvp (P_NOWAIT) for execution. Problem here is that uses CMD.EXE under NT and OS/2, and COMMAND.COM under Win95.
After executing spawnvp _FP_PIPEDATA(fp).pid to set pid.
back to connect_pipe ""-->""
osHandle = STDOUT_HANDLE;
rc = DosDupHandle( oldHandle, &osHandle );
close( handles[1] ); /* parent process should close this */
return from _popen
return( fp )
Deletions:
""_FP_PIPEDATA(fp).isPipe = 1;""
if( connect_pipe( fp, command, handles, readOrWrite, textOrBinary ) ) {
Additions:
**Create pipe using OW _pipe:**
_pipe( handles, 0, textOrBinary ""=="" 't' ? _O_TEXT : _O_BINARY)
**Make handle non-inheritable if read or write:**
rc = ""DosQFHandState("" (HFILE)[[OsHandle _os_handle]](handles[**0 read or 1 for write**]), &handleState );
//**NOTE:**//
//**Search in API for ""DosQueryFHState"" instead of ""DosQFHandState""**//
16-bit DosQFHandState 32-bit DosQueryFHState
handleState |= OPEN_FLAGS_NOINHERIT;
handleState &= 0x00007F88; /* some bits must be zero */ 0111111110001000
rc = DosSetFHandState( (HFILE)_os_handle(handles[0]), handleState );
**Create the pipe's FILE:**
fp = ""__F_NAME""(fdopen,_wfdopen)( handles[readOrWrite ""=="" 'r' ? 0 : 1], mode );
""_FP_PIPEDATA(fp).isPipe = 1;""
""_FP_PIPEDATA(fp).pid = -1;""
**Spawn the process:**
if( connect_pipe( fp, command, handles, readOrWrite, textOrBinary ) ) {
Deletions:
Create pipe using OW _pipe:
_pipe( handles, 0, textOrBinary ""=="" 't' ? _O_TEXT : _O_BINARY)
Make handle non-inheritable if read or write:
rc = ""DosQFHandState("" (HFILE)[[OsHandle _os_handle]](handles[0]), &handleState );
//**NOTE:**//
//**Search in API for ""DosQueryFHState"" instead of ""DosQFHandState""**//
16-bit DosQFHandState 32-bit DosQueryFHState
handleState |= OPEN_FLAGS_NOINHERIT;
handleState &= 0x00007F88; /* some bits must be zero */
rc = DosSetFHandState( (HFILE)_os_handle(handles[0]), handleState );
Additions:
16-bit DosQFHandState 32-bit DosQueryFHState
Additions:
rc = ""DosQFHandState("" (HFILE)[[OsHandle _os_handle]](handles[0]), &handleState );
Deletions:
rc = ""DosQFHandState("" (HFILE)[[OsHandle_os_handle]](handles[0]), &handleState );
Additions:
rc = ""DosQFHandState("" (HFILE)[[OsHandle_os_handle]](handles[0]), &handleState );
Deletions:
rc = ""DosQFHandState("" (HFILE)_os_handle(handles[0]), &handleState );
Additions:
Create pipe using OW _pipe:
_pipe( handles, 0, textOrBinary ""=="" 't' ? _O_TEXT : _O_BINARY)
Make handle non-inheritable if read or write:
rc = ""DosQFHandState("" (HFILE)_os_handle(handles[0]), &handleState );
//**NOTE:**//
//**Search in API for ""DosQueryFHState"" instead of ""DosQFHandState""**//
handleState |= OPEN_FLAGS_NOINHERIT;
handleState &= 0x00007F88; /* some bits must be zero */
rc = DosSetFHandState( (HFILE)_os_handle(handles[0]), handleState );
Deletions:
_pipe( handles, 0, textOrBinary ""=="" 't' ? _O_TEXT : _O_BINARY
Additions:
====Notes on Open Watcom _popen====
The synopsis is at the bottom of page and I am only concern with OS2 ""__386__"".
Additions:
_pipe( handles, 0, textOrBinary ""=="" 't' ? _O_TEXT : _O_BINARY
Deletions:
_pipe( handles, 0, textOrBinary == 't' ? _O_TEXT : _O_BINARY
Additions:
_pipe( handles, 0, textOrBinary == 't' ? _O_TEXT : _O_BINARY