#1 Better Access to command line

closed
None
5
2001-09-25
2001-06-29
Anonymous
No

Currently a rexx program accesses all its arguments
via arg(1), this does not allow the sort of parsing
required by windows programs where for example a
filename can contain spaces.

I believe that there should be 2 alternative methods
of access as follows:

(1) Direct access to the command line as supplied to
regina (no interpretation - double quotes remain as
they were etc).

(2) The equivalent of argv argc in a C program in
which quotes are removed (except where escaped etc).
Maybe accessed via a built in function or stem
called "argv"...

Both of the above are quite easy to do in "C" code...

As it is rexx is very dated in this area...

Discussion

  • Mark Hessling

    Mark Hessling - 2001-07-02
    • assigned_to: nobody --> rexx
     
  • Nobody/Anonymous

    Logged In: NO

    Well, I do not agree. Parsing the command line should be done under program
    control because of the many ways the given string could be interpreted.

    It *is* very easy to parse command line filenames with blanks in Rexx using the PARSE
    statement matching the enclosing quotes.

    (Wouldn't make sense to add a feature to a programming language, just because there
    may be a need because of a particular operating system environment, in this case
    the Windows environment. Would be *much* better to collect Windows-dependent
    features in a Rexx utility or an external Rexx-function package. )

     
  • Nobody/Anonymous

    Logged In: NO

    Well, I do not agree. Parsing the command line should be done under program
    control because of the many ways the given string could be interpreted.

    It *is* very easy to parse command line filenames with blanks in Rexx using the PARSE
    statement matching the enclosing quotes.

    (Wouldn't make sense to add a feature to a programming language, just because there
    may be a need because of a particular operating system environment, in this case
    the Windows environment. Would be *much* better to collect Windows-dependent
    features in a Rexx utility or an external Rexx-function package. )

     
  • dbareis

    dbareis - 2001-07-12

    Logged In: YES
    user_id=253196

    I'm not sure why you disagree since I proposed a solution
    where the programmer has full control and another where it
    works EXACTLY like just about every other program in
    existance (for example almost all Unix, OS/2, Windows and
    DOS programs). You might note I didn't say to change the
    current mechanism either...

    It is not a windows only requirement. The point is as rexx
    stands it is IMPOSSIBLE to correctly parse a lot of command
    lines (at least without requiring proprietry command line
    syntax of the rexx program's user.

    As for being able to parse by looking for quotes unless you
    know of some magic method which makes my request obsolete
    this rexx program proves you wrong:

    say arg(1)

    Not a quote in sight when it runs, for example when I run:

    noquotes "A"

    I certainly hope you don't require your users to type:

    noquotes \"A\"

    which does pass the quotes but is of course working
    differently to every other program the user is likely to be
    running...

    There was a big discussion about a year ago where no one
    disagreed except for minor details on this issue. The issue
    has gone to sleep to I thought I'd raise it again.

     
  • Mark Hessling

    Mark Hessling - 2001-07-12

    Logged In: YES
    user_id=86185

    Regina 2.3 will come with a command-line switch; -a to
    specify that arguments on the command line are passed to
    the Rexx program as is. ie
    regina -a "arg1 has spaces" arg2 arg3
    /**/
    Parse Arg arg1, arg2, arg3
    Say arg1 /* -> arg1 has spaces */
    Say arg2 /* -> arg2 */
    Say arg3 /* -> arg3 */
    Say Arg() /* -> 3 */
    Say Arg(1) /* -> arg1 has spaces */
    Say Arg(2) /* -> arg2 */
    Say Arg(3) /* -> arg3 */

     
  • Mark Hessling

    Mark Hessling - 2001-09-25
    • status: open --> closed
     
  • Mark Hessling

    Mark Hessling - 2001-09-25

    Logged In: YES
    user_id=86185

    Regina 3.0 beta 1 (released today) supports the -a switch.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks