Article View: comp.lang.modula2
Article #80Re: argc and *argv in Modula-2 ?
From: Benedict Rafanello
Date: Mon, 06 Apr 1992 16:13
Date: Mon, 06 Apr 1992 16:13
27 lines
1538 bytes
1538 bytes
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. Ben
Technical Details
Message-ID:
<34995@uflorida.cis.ufl.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!tulane!uflorida!thedog.cis.ufl.edu!bmrReferences:
<23U676368B@tron.gun.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!tulane!uflorida!thedog.cis.ufl.edu!bmr From: bmr@thedog.cis.ufl.edu (Benedict Rafanello) Newsgroups: comp.lang.modula2 Subject: Re: argc and *argv in Modula-2 ? Message-ID: <34995@uflorida.cis.ufl.EDU> Date: 6 Apr 92 16:13:54 GMT Article-I.D.: uflorida.34995 References: <23U676368B@tron.gun.de> Sender: news@uflorida.cis.ufl.EDU Reply-To: bmr@thedog.cis.ufl.edu (Benedict Rafanello) Organization: U of Florida. Computer Science Dept. Lines: 27