🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #82

Re: argc and *argv in Modula-2 ?

#82
From: M. Gallo
Date: Tue, 07 Apr 1992 21:24
36 lines
2112 bytes
In article <34995@uflorida.cis.ufl.EDU> bmr@thedog.cis.ufl.edu (Benedict Rafanello) writes:
>In article <23U676368B@tron.gun.de> g_dotzel@tron.gun.de (Guenter Dotzel) writes:
> 
> >MODULE mod_copy;
> >FROM ProgramArgs IMPORT IsArgPresent, ArgChan;
> >FROM IOResult IMPORT ReadResult, ReadResults;
> >FROM TextIO IMPORT WriteString, ReadToken, SkipLine, ReadString;
> >
> >TYPE fnam = ARRAY[0..254] OF CHAR;
> >VAR from, to: fnam;
> >
> >BEGIN
> >  IF (ReadResult(ArgChan()) <> endOfInput) THEN ReadToken(ArgChan(), from);
> >    IF (ReadResult(ArgChan()) <> endOfInput) THEN ReadToken(ArgChan(), to);
> >    ELSE (* ... *)
> >    END;
> >  ELSE (* ... *)
> >  END;
> >END mod_copy.
>
>I certainly don't like the look of this!  I would prefer to get the command line
>as a single string which I can parse myself.  This is the approach taken by
>Stony Brook.  Their library has a procedure, I believe its called GetCommandline,
>which returns the command line for the program as a string.  While parsing the
>command line yourself may be more work, I think it is more flexible than the
>approach above, unless I am missing something.

I agree with you completely.  I have been frustrated by C for precisely
the same reason.  But even argc and argv would be far more straightforward
than the above code.  I don't recall, is *that* the new ISO standard?  (I
hope not!)
-- 
IMHO, as always                                            _   /|
Miguel                                                     \'o.O'
mgallo@ares.calpoly.edu                                    =(___)=
"C is its own virus."                                         U
Technical Details
Message-ID: <1992Apr07.212413.190449@zeus.calpoly.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ucselx!petunia!zeus!mgallo
References: <23U676368B@tron.gun.de> <34995@uflorida.cis.ufl.EDU>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.modula2
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ucselx!petunia!zeus!mgallo
From: mgallo@zeus.calpoly.edu (M. Gallo)
Subject: Re: argc and *argv in Modula-2 ?
Message-ID: <1992Apr07.212413.190449@zeus.calpoly.edu>
Organization: California Polytechnic State University, San Luis Obispo
References: <23U676368B@tron.gun.de> <34995@uflorida.cis.ufl.EDU>
Date: Tue, 07 Apr 1992 21:24:13 GMT