🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #34105

Re: argc and argv with gem

#34105
From: Leo de Wit
Date: Fri, 16 Sep 1988 05:14
22 lines
1666 bytes
In article <3441@boulder.Colorado.EDU> cochrane@spot.Colorado.EDU (COCHRANE JIM T) writes:
>How does one go about writing a GEM program that will accept arguments to
>main via argc and argv?  I'm using Mark Williams C and when I try to use
>argc and argv with a GEM program the program bombs.

Although I don't use MWC myself, I will make a few remarks:
    1) There is no means that I know of to supply parameters to a Gem
    program if it is started from the Desktop.
    2) If the program is started from a shell, the shell should be a Gem 
    program, otherwise the program cannot use Gem functions. I'm not very
    sure about this one, though.
    3) You don't need to do anything different for a Gem program than for
    a Tos-Takes-Parameters one.
    4) The bus error is perhaps caused by incorrect treatment of the
    argc,argv list, e.g. accessing an element argv[i], with i >= argc,
    or argv[0], whose contents is undefined (GEMDOS does not pass the
    program's name). I even think there are compilers that put a null
    pointer (not an empty string pointer) in argv[0], which is in effect
    incorrect - argv[argc] should be the first null pointer of the list.


            Leo.
Technical Details
Message-ID: <806@philmds.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!hp4nl!philmds!leo
References: <358@island.uu.net> <626@mace.cc.purdue.edu> <3441@boulder.Colorado.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!hp4nl!philmds!leo
From: leo@philmds.UUCP (Leo de Wit)
Newsgroups: comp.sys.atari.st
Subject: Re: argc and argv with gem
Keywords: MWC, argc, argv, GEM, commands.
Message-ID: <806@philmds.UUCP>
Date: 16 Sep 88 05:14:23 GMT
References: <358@island.uu.net> <626@mace.cc.purdue.edu> <3441@boulder.Colorado.EDU>
Reply-To: leo@philmds.UUCP (Leo de Wit)
Organization: Philips I&E DTS Eindhoven
Lines: 22