From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 24-MAY-1992 19:59:25.59
To:	info-vax@kl.sri.com
CC:	
Subj:	SUMMARY: Case of the commandline-how do I get it?

In article <1992May18.133220.876@nbivax.nbi.dk>, I wrote:

> How can I from an image obtain the command line that invoked the image
> *with the case conserved*?
[TPU example deleted]

SUMMARY OF ANSWERS:

We all agree that this is not possible using the standard calls of
LIB$GET_FOREIGN and CLI$GET_VALUE nor is it possible with the slightly less
standard SYS$CLI call. The all return the command line converted to uppercase
(and often further mangled.)

I later posted a note explaining that TPU was displaying the command line
recall buffer. Arne Vajh{\o}j (sometime written: Vajhxj :-) National characters
are fun :-6) kindly send me an example of how to do this. You'll find the
example below my signature.

Reading from the RECALL buffer has the obvious limitation/feature that the
commandline is not mangled by DCL; i.e. no symbol substitution, no nothing.

A less obvious limitation is that it can not be used from a command procedure
(will return the DCL command used to start the (outermost) procedure.)

A real challenge for VMS internals: DCL has to read the .COM file somehow,
right? So DCL will store the line-number read (presumably in a RAB), right? So
we could find the line that started our image, right? One question from a
neophyte: How might one go about doing just that? :-)

Thanks for the help.
              --- Allan
-- 
Internet:     Allan.Engelhardt@nbi.dk        |  Allan Engelhardt
HEPnet:       NBIVAX::ENGELHARDT             |  Niels Bohr Institute
Bitnet/EARN:  ENGELH at CERNVM               |  Blegdamsvej 17
Phone direct: (+45)31424284<dial-tone>355    |  DK-2100 Copenhagen
Fax:          (+45)31421016                  |  DENMARK

[CMDLIN.MAR]
        .title  cmdlin
        .link   "sys$system:dcldef.stb"/se
        .link   "sys$system:sys.stb"/se
        .psect  $CODE quad,pic,con,lcl,shr,exe,nowrt
        .entry  cmdlin,^m<iv,r2,r3,r4,r5>
        movl    #CTL$AG_CLIDATA,r0
        movl    W^PPD$L_PRC(r0),r0
        movl    W^PRC_L_RECALLPTR(r0),r0
        decl    r0
        cvtbl   (r0),@B^8(ap)
        subl2   @B^8(ap),r0
        movl    B^4(ap),r1
        movc3   @B^8(ap),(r0),@B^4(r1)
        ret
        .end
[ZZ.FOR]
      PROGRAM ZZ
      INTEGER*4 L
      CHARACTER*80 K
      CALL CMDLIN(K,L)
      WRITE(*,*) '>>'//K(1:L)//'<<'
      END

