From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM"  4-SEP-1993 10:22:10.03
To:	EVERHART
CC:	
Subj:	Re: Log file protection

Message-Id: <9309041139.AA24323@uu7.psi.com>
From: simons/G=Colin/S=Sewell/O=H.A.Simons.Ltd/OU=PACIFIC@mhs.attmail.com
Date: 2 Sep 93 16:35:32 GMT
To: info-vax@sri.com
Transport-Options: /STANDARD/REPORT
Subject: Re: Log file protection
Importance: Normal
Content-Type: text

Dan Wing writes:
>In article <JAN.93Sep1090400@gaspra.neuroinformatik.ruhr-uni-bochum.de>, 
>jan@gaspra.neuroinformatik.ruhr-uni-bochum.de (Jan Vorbrueggen) writes:
>
>>In article <1993Aug31.150610.13722@colorado.edu> dwing@uh01.Colorado.EDU (Dan
>>Wing) writes:
>>
>>   Note that you can't really get the specific version number of the log file,
>>   and it is possible you could change the protection of the same file with a
>>   higher version number if more than one job has the same .LOG file name.
>>
>>Yes, you can. Actually, you could long before $GETQUI and friends existed.
>>What you do get is the DID/FID of SYS$INPUT and SYS$OUTPUT. Where? Dump
>>DCL.STB and look for the PPDxxx symbols (sorry, no VMS system on hand, explore
>>for yourself). The PPD structure is reached via one of those CTL symbols (was
>>that CTL$GL_CLIDATA? some such). It's undocumented, but unlikely to go away
>>(mostly, because too much of DEC's one software would have to change, so why
>>bother). LOGINOUT sets all this up, if I'm not mistaken. You also get access
>>to nice things like flags indicated which qualifiers where used at the
>>username prompt.
>
>I believe you need to be in exec mode to get this information, though -- 
>the details of this were brought up in vmsnet.internals awhile ago, if my
>memory is correct.  (followups directed there).
>
>-Dan Wing, Systems Administrator, University Hospital, Denver
> dwing@uh01.colorado.edu or wing_d@ucolmcc.bitnet

    exec mode not needed. here is a short bit of vax c code
    that will print out the input and output filespecs when
    running in batch):

$ create x.c
#include <descrip.h>
#include <nam.h>
#include <stdio.h>

#define PPD$C_LENGTH 360

globalvalue long int PPD$W_INPFID;
globalvalue long int PPD$W_OUTFID;
globalvalue long int PPD$T_OUTDVI;
globalvalue long int PPD$T_INPDVI;
globalref char	     CTL$AG_CLIDATA[PPD$C_LENGTH];

int main()
{
    long int		    status;
    char		    filespec[NAM$C_MAXRSS+1];
    unsigned short	    len;
    $DESCRIPTOR(    filespecdsc,    filespec );
    struct dsc$descriptor_s devnamdsc	= { 0, 0, 0, 0 };
    short int		    *fid;
    char		    *dvi;
    
    fid  = &CTL$AG_CLIDATA[PPD$W_INPFID];
    dvi = &CTL$AG_CLIDATA[PPD$T_INPDVI];

    devnamdsc.dsc$w_length = dvi[0];
    devnamdsc.dsc$a_pointer = &dvi[1];

    if (fid[0])
	{
	status = LIB$FID_TO_NAME( &devnamdsc, fid, &filespecdsc, &len );
	filespec[len] = '\0';
	printf( "input = %s\n", filespec );
	}
    else
	printf( "no input fid\n" );

    fid = &CTL$AG_CLIDATA[PPD$W_OUTFID];
    dvi = &CTL$AG_CLIDATA[PPD$T_OUTDVI];

    devnamdsc.dsc$w_length = dvi[0];
    devnamdsc.dsc$a_pointer = &dvi[1];

    if (fid[0])
	{
	status = LIB$FID_TO_NAME( &devnamdsc, fid, &filespecdsc, &len );
	filespec[len] = '\0';
	printf( "output = %s\n", filespec );
	}
    else
	printf( "no output fid\n" );
}
$   cc x.c
$   link x,sys$system:sys.stb/sel,sys$system:dcldef.stb/sel,sys$input/opt
sys$share:vaxcrtl/share
$

    totally unsupported, liable to break any second, etc. etc.
    sorry, if somebody already posted something like this.

    btw, when the hell is ray (or whomever manages the infovax
    mailing list) going to let mr. lydick back on to the
    infovax mailing list? i don't have a direct internet connection
    so i have to get infovax thru a mailer and it pisses me off only
    seeing something from mr. lydick when he's quoted by somebody else.
    are you listening ray? i won't blush at a few cuss words.

    colin sewell		"I am not a number, I am a free man!"
    h.a.simons ltd.					    No. 6
    vancouver, bc
    "simons/g=colin/s=sewell"@mhs.attmail.com

