🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: mod.computers.apollo
Article #375

Apollo Pascal Question

#375
From: kevinUUCP
Date: Tue, 17 Feb 1987 12:55
38 lines
1692 bytes
    Question -- I need to access command line arguments in pascal -
    why can't I do it in one step as this example shows?
    
    program t;
    %include '/sys/ins/base.ins.pas';
    %include '/sys/ins/streams.ins.pas';
    %include '/sys/ins/pgm.ins.pas';
    var argc,i,j : integer;
        argv : pgm_$argv_ptr;
        argvp : pgm_$argv;
        arg : ^pgm_$arg;
    
    begin
       pgm_$get_args(argc,argv);
       argc := argc - 1;
       writeln(argc:1,' arguments found.  They are :');
       for i:=1 to argc do
       begin
    
         { why can't I de-reference the structure in one step 
           as this line does ??
    
         ******* bad line ***** - error = argv not a pointer ******
    
         writeln(argv^[i]^.chars[1]);
    
         }
    
         arg := argv^[i];
         write(i:1,' : ');
         for j := 1 to arg^.len do write(arg^.chars[j]);
         writeln;
       end;
    end.
    
Kevin Buchs   3500 Zycad Dr. Oakdale, MN 55109  (612)779-5548
Zycad Corp.   {rutgers,ihnp4,amdahl,umn-cs}!meccts!zeke!kevin
Technical Details
Message-ID: <8702171355.AA20822@zeke.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ucbvax!kevin%UUCP@YALE.ARPA@zeke.UUCP

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ucbvax!kevin%UUCP@YALE.ARPA@zeke.UUCP
From: kevin%UUCP@YALE.ARPA@zeke.UUCP
Newsgroups: mod.computers.apollo
Subject: Apollo Pascal Question
Message-ID: <8702171355.AA20822@zeke.UUCP>
Date: Tue, 17-Feb-87 07:55:08 EST
Article-I.D.: zeke.8702171355.AA20822
Posted: Tue Feb 17 07:55:08 1987
Date-Received: Fri, 20-Feb-87 05:40:44 EST
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: Kevin Buchs <kevin@zeke>
Organization: The ARPA Internet
Lines: 38
Approved: apollo@yale-comix.arpa