home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / OP2DEV.ZIP / CZAR.C < prev    next >
C/C++ Source or Header  |  1990-08-12  |  1KB  |  55 lines

  1. //
  2. //  CZAR.C
  3. //
  4. //  Launch program for the game CZARWARS
  5. //
  6. #define INCL_DOS
  7. #define INCL_SUB
  8. #include <os2.h>
  9.  
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13. #include <time.h>
  14.  
  15. #include "bbsexpan.h"
  16.  
  17. #define LENGTH     40
  18. #define FLAGS      2
  19. #define ENVS       0L
  20.  
  21. main(int argc, char *argv[])
  22. {
  23.    struct _RESULTCODES ExResult, CwResult;
  24.    USHORT procID, childID;
  25.    USHORT rc;
  26.    char fbuf[LENGTH];
  27.    char id[20];
  28.    char args[120];
  29.    long now;
  30.  
  31.    rc = UseChildAppInit(argv[1],argv[0],&anchor,&unhand,&semhand,&usernum,&instance);
  32.    if( rc != 0 ) {
  33.       printf("\nCould not initialize application (%d)\n",rc);
  34.       return(1);
  35.    }
  36.  
  37.    if( USENUM == 0 || SerConnected(unhand) ) {
  38.       time(&now);
  39.       strcpy(id,unhand->p_user->u_handle);
  40.       strupr(id);
  41.       sprintf(args,"CZAR_PGM.EXE !%d %s %ld %s\0",unhand->comtok, unhand->recnum == 0 ? "LOCA" : itoa(unhand->linkrate,fbuf,10),
  42.                   unhand->t_offby-now,id);
  43.  
  44.       if( DosExecPgm(fbuf,LENGTH,FLAGS,args,ENVS,&ExResult,"CZAR_PGM.EXE") == 0 ) {
  45.          childID = ExResult.codeTerminate;
  46.          DosCwait(1,0,&CwResult,&procID,childID);
  47.       }
  48.       else
  49.          DosSleep(2000L);
  50.    }
  51.    exit(0);
  52. }
  53.  
  54.  
  55.