[net.micro.atari16] How do I get the program name

fkc@warwick.UUCP (Frank K Carver) (05/24/86)

[ Lineater ----> TRASH ]

Hi Guys, More questions.

Does anyone know any way to read the name of an application or accessory
once it has been started (argv[0] to traditional `C' programmers).  I've
been trying to get the info, but can't seem to find it.  In particular,
I would like to have a single version of a RAM using accesory/program -
say an editor or ramdisk, and have it start up with the correct data
size just by changing the name.

Usual caveats apply: 1040, ROM TOS, Lattice C, PD assembler.

Any help, pointers, or workarounds appreciated.

Cheers,
Frank.

----
Frank K Carver   "In space ... no one can hear your laser sound-effect"
		Join the Group Against Gratuitous Acronyms (GAGA) NOW !

Computer Systems Engineering, University of Warwick, Coventry, UK
or "Magrathea", 5 Whitefields, Gibbet Hill Road, Coventry, CV4 7AL, UK

UUCP:		..mcvax!ukc!warwick!fkc
ARPA:             'fraid-not@THE-MOMENT
-- 
Frank K Carver   "In space ... no one can hear your laser sound-effect"
		Join the Group Against Gratuitous Acronyms (GAGA) NOW !

Computer Systems Engineering, University of Warwick, Coventry, UK
or "Magrathea", 5 Whitefields, Gibbet Hill Road, Coventry, CV4 7AL, UK

UUCP:		..mcvax!ukc!warwick!fkc
ARPA:             'fraid-not@THE-MOMENT

dyer@atari.UUcp (Landon Dyer) (05/28/86)

> Does anyone know any way to read the name of an application or accessory
> once it has been started (argv[0] to traditional `C' programmers).

No.  Not possible unless you have cooperation from the process that
Pexec()'d your application.  GEMDOS does not pass or preserve the name
of the program that was loaded.  The desktop does not cooperate.

This misfeature is a result of the way commandline arguments are
passed to an application.  It's been a problem --- in the CP/M and
MSDOS model operating systems --- since the first CP/M-80 C compilers
came out....

-- 

-Landon Dyer, Atari Corp.		{lll-lcc,lll-crg!vecpyr}!atari!dyer

/-----------------------------------------------\
| The views represented here do not necessarily | "If Business is War, then
| reflect those of Atari Corp., or even my own. |  I'm a Prisoner of Business!"
\-----------------------------------------------/

robt@molihp.UUCP (Robert L Thurlow) (06/02/86)

In article <520@snow.warwick.UUCP> fkc@snow.UUCP (Frank K Carver) writes:
>Does anyone know any way to read the name of an application or accessory
>once it has been started (argv[0] to traditional `C' programmers).

  Don't have the books  handy, but there are some  routines  to do this.
The 'gemlib'  startup code with the dev kit pulls things off the command
line and puts it into the char *argv[]  array like a UNIX system  would,
but it ALWAYS  puts the  string 'C  Runtime'  into  *argv[0].  This is a
pain, so the AES has a routine called SHEL_READ which allows you to pull
stuff off the  'command  line' or wherever  the command came from, and I
think they DO have the  ability  to get at the  command  name.  There is
also a SHEL_WRITE  which allows you to generate a new 'command line' for
Pexec()'ing another process, plus a couple of other routines.  Check the
Abacus GEM Reference  Manual.  Now if you could make  multiple  links to
the same executable, you'd be in business!

#   UUCP : ...!ubc_vision!molihp!robt		Robert Thurlow		#
#   My thoughts are my own, and are void where prohibited by law.	#
#   "There was something fishy about the butler.  I think he was a	#
#    Pisces, probably working for scale."	-Nick Danger, 3rd Eye	#