home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / os2 / programm / 4201 < prev    next >
Encoding:
Text File  |  1992-08-13  |  2.1 KB  |  46 lines

  1. Newsgroups: comp.os.os2.programmer
  2. Path: sparky!uunet!mcsun!Germany.EU.net!news.netmbx.de!zrz.tu-berlin.de!math.fu-berlin.de!informatik.tu-muenchen.de!rommel
  3. From: rommel@Informatik.TU-Muenchen.DE (Kai-Uwe Rommel)
  4. Subject: Re: DosExecPgm Args Question
  5. References: <13AUG199208152210@lims01.lerc.nasa.gov> <19920813.054753.507@almaden.ibm.com>
  6. Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem)
  7. Organization: Technische Universitaet Muenchen, Germany
  8. Date: Thu, 13 Aug 1992 16:51:22 GMT
  9. Message-ID: <1992Aug13.165122.12595@Informatik.TU-Muenchen.DE>
  10. Lines: 34
  11.  
  12. In article <19920813.054753.507@almaden.ibm.com> fattire@vnet.ibm.com (BJ Hargrave) writes:
  13. >PSZ buff = "C:\\OS2\\CMD.EXE\0/C Echo Hello!";
  14. >
  15. >rc = DosExecPgm ( NULL,                 /* Object name buffer         */
  16. >                  0,                    /* len of object name buffer  */
  17. >                  EXEC_SYNC,            /* execute synchronously      */
  18. >                  buff,                 /* arguments                  */
  19. >                  NULL,                 /* environment                */
  20. >                  (PRESULTCODES)&exec_rc,       /* return codes       */
  21. >                  buff );               /* program to execute         */
  22.  
  23. Actually, you can even call a program like:
  24.  
  25. rc = DosExecPgm(NULL, 0, EXEC_SYNC, "uncompress\0-v\0file.Z", NULL,
  26.         &exec_rc, "c:\\bin\\compress.exe");
  27.  
  28. i.e. pass a different name than the executable file has as the argv[0]
  29. value to the program. This is similar to what usually is done under
  30. Unix, where some programs act differently when called with a different
  31. name.
  32.  
  33. If you port such a program to OS/2, you can't make hard or soft links in
  34. the file system to call the same executable with different names.
  35. However, you can make a small dummy program which in turn just calls the
  36. desired one with a different argv[0] value. This may help to save disk
  37. space if the app is rather large.
  38.  
  39. Kai Uwe Rommel
  40.  
  41. /* Kai Uwe Rommel --- rommel@informatik.tu-muenchen.de */
  42.  
  43. DOS ... is still a real mode only non-reentrant interrupt
  44. handler, and always will be.                -Russell Williams
  45.  
  46.