[comp.lang.pascal] Parsing the command line ...

perrone@loligo.cc.fsu.edu (Perrone Ford) (02/07/89)

 Hello netters,

 I have a question, but first I would like to thank all the 
 knowledgeable fokls out there who have helped me in the past.

	Does any one out there know a "simple" way to parse the 
comand line in ANSI pascal/TurboP4.0 ?  If so, lay the info
down on me.  I would prefer knowing if there is a way to do so in
ANSI because I want to port this to as mainframe.

Also, by simple, I mean without going into assemble code and reading
memory segments.

abcscnuk@csuna.UUCP (Naoto Kimura) (02/08/89)

In article <547@loligo.cc.fsu.edu> perrone@loligo.UUCP (Perrone Ford) writes:
>
> Hello netters,
>
> I have a question, but first I would like to thank all the 
> knowledgeable fokls out there who have helped me in the past.
>
>	Does any one out there know a "simple" way to parse the 
>comand line in ANSI pascal/TurboP4.0 ?  If so, lay the info
>down on me.  I would prefer knowing if there is a way to do so in
>ANSI because I want to port this to as mainframe.
>
>Also, by simple, I mean without going into assemble code and reading
>memory segments.

Well, I don't know what ANSI says about such beasties, but I know that
some implementations allow you access to the arguments passed through
the command line.  Most of them will pass you the already parsed
arguments to you.

- Under Berkeley pascal on UNIX systems, there is usually a argv(n)
  function (interesting name eh?) that will return the n'th argument
  string of the command line.
- With Turbo the function is ParamStr(n).  If you want to get at the
  unparsed string, you'll have to start reading somewhere in the
  environment segment or the prefix segment (don't recall where, but
  it's somewhere in there)
- There is an include file and a library on the Cyber here at CSUN that
  will allow you to access the parsed portions of the command line.
  Unfortunately, you could only access the option flags if I recall
  correctly, as the other strings were used to associate the internal
  variables with the external filenames
- I don't recall how it was done under PASCAL/VS on IBM mainframes, but
  there was a way to do it.  On the VM/CMS system that I used, there
  were two forms of the command line, one that was parsed according to
  older rules, which resulted in space-separated 8-character arguments,
  and another which returned the entire command line string.  You had to
  do a bit of twiddling with machine registers to get at the latter.

Hope this helps.

                //-n-\\				Naoto Kimura
        _____---=======---_____			(csun!csuna!abcscnuk)
    ====____\   /.. ..\   /____====
  //         ---\__O__/---         \\	Enterprise... Surrender or we'll
  \_\                             /_/	send back your *&^$% tribbles !!

perrone@loligo.cc.fsu.edu (Perrone Ford) (02/09/89)

	Did I hear you correctly?  You have a cyber? what cyber might 
that be and what pascal are you running on it.  Also thanks for
the great info on the comand line parsing or reading,,,


Perrone Ford

abcscnuk@csuna.UUCP (Naoto Kimura) (02/11/89)

In article <551@loligo.cc.fsu.edu> perrone@loligo.UUCP (Perrone Ford) writes:
]	Did I hear you correctly?  You have a cyber? what cyber might 
]that be and what pascal are you running on it.  Also thanks for
]the great info on the comand line parsing or reading,,,
]
]Perrone Ford

We've got a Cyber 170/750 running NOS (2.3).  The version of pascal we
use is PASCAL-6000 (V4.1.E), and on the compiler listing we get "E.T.H.
ZEURICH / UNIVERSITY OF MINNESOTA".  I pretty much trust the compiler,
as this compiler is a descendant of the original pascal compiler written
for the CDC 6600.  Using the Cyber made me appreciate the EOF() and
EOLN() functions of pascal (newline is defined to be 12 zero bits
aligned on a word boundary -- which meant you had to be careful in
outputting colons -- unless you were working with the 6/12 character
set).

                //-n-\\				Naoto Kimura
        _____---=======---_____			(csun!csuna!abcscnuk)
    ====____\   /.. ..\   /____====
  //         ---\__O__/---         \\	Enterprise... Surrender or we'll
  \_\                             /_/	send back your *&^$% tribbles !!