home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dosapi.zip / STARTSES.C < prev   
C/C++ Source or Header  |  1994-08-16  |  1KB  |  41 lines

  1. /**********************************************************/
  2. /*  Stub program for starting OS/2 programs under DOS     */
  3. /*  Only use this program as a DOS stub in LINK386        */
  4. /*  Refer to documentation regarding DEF files for CSet/2 */
  5. /**********************************************************/
  6.  
  7.  
  8. #include "dosapi.h"
  9. #include <string.h>
  10.  
  11. char Sem_Name[32] = "\\SEM32\\STARTSES";
  12. unsigned long Sem_Handle;
  13. Session_Data Start_Sess;
  14. char OS2_PGM[128] = "";
  15.  
  16. main(int argc, char *argv[])
  17. {
  18.     int i;
  19.  
  20.     Dos32CreateEventSem( Sem_Name, &Sem_Handle, 0, 0 );
  21.  
  22.     strcpy(OS2_PGM,"/C");
  23.     for(i=0;i<argc;++i){
  24.         strcat(OS2_PGM," ");
  25.         strcat(OS2_PGM,argv[i]);
  26.         }
  27.  
  28.     memset(&Start_Sess, 0, sizeof(Start_Sess));
  29.     Start_Sess.Sess_Struct_Len = sizeof(Start_Sess);
  30.     Start_Sess.Sess_Relation = 0;
  31.     Start_Sess.Sess_Fore_Back = 1;
  32.     Start_Sess.Sess_Trace = 0;
  33.     Start_Sess.Sess_Program_Title = 0;
  34.     Start_Sess.Sess_Program_Name = 0;
  35.     Start_Sess.Sess_Program_Args = OS2_PGM;
  36.     Start_Sess.Sess_Type = 1;
  37.     DosStartSession( &Start_Sess );
  38.     Dos32WaitEventSem( Sem_Handle, -1 );
  39.     Dos32CloseEventSem( Sem_Handle );
  40. }
  41.