🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #799

Re: DosExecPgm Args Question

#799
From: Kai-Uwe Rommel
Date: Thu, 13 Aug 1992 16:51
33 lines
2155 bytes
In article <19920813.054753.507@almaden.ibm.com> fattire@vnet.ibm.com (BJ Hargrave) writes:
>PSZ buff = "C:\\OS2\\CMD.EXE\0/C Echo Hello!";
>
>rc = DosExecPgm ( NULL,                 /* Object name buffer         */
>                  0,                    /* len of object name buffer  */
>                  EXEC_SYNC,            /* execute synchronously      */
>                  buff,                 /* arguments                  */
>                  NULL,                 /* environment                */
>                  (PRESULTCODES)&exec_rc,       /* return codes       */
>                  buff );               /* program to execute         */

Actually, you can even call a program like:

rc = DosExecPgm(NULL, 0, EXEC_SYNC, "uncompress\0-v\0file.Z", NULL,
		&exec_rc, "c:\\bin\\compress.exe");

i.e. pass a different name than the executable file has as the argv[0]
value to the program. This is similar to what usually is done under
Unix, where some programs act differently when called with a different
name.

If you port such a program to OS/2, you can't make hard or soft links in
the file system to call the same executable with different names.
However, you can make a small dummy program which in turn just calls the
desired one with a different argv[0] value. This may help to save disk
space if the app is rather large.

Kai Uwe Rommel

/* Kai Uwe Rommel --- rommel@informatik.tu-muenchen.de */

DOS ... is still a real mode only non-reentrant interrupt
handler, and always will be.                -Russell Williams
Technical Details
Message-ID: <1992Aug13.165122.12595@Informatik.TU-Muenchen.DE>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!news.netmbx.de!zrz.tu-berlin.de!math.fu-berlin.de!informatik.tu-muenchen.de!rommel
References: <13AUG199208152210@lims01.lerc.nasa.gov> <19920813.054753.507@almaden.ibm.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!news.netmbx.de!zrz.tu-berlin.de!math.fu-berlin.de!informatik.tu-muenchen.de!rommel
From: rommel@Informatik.TU-Muenchen.DE (Kai-Uwe Rommel)
Subject: Re: DosExecPgm Args Question
References: <13AUG199208152210@lims01.lerc.nasa.gov> <19920813.054753.507@almaden.ibm.com>
Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem)
Organization: Technische Universitaet Muenchen, Germany
Date: Thu, 13 Aug 1992 16:51:22 GMT
Message-ID: <1992Aug13.165122.12595@Informatik.TU-Muenchen.DE>
Lines: 34