it shouldn't be hard to use this "standard" way of parsing the command line everywhere except Win 9x

It would "just" require all existing programs to drop whatever command line parsing they use and use CommandLineToArgvW instead, converting the command line to Unicode and the returned elements back from Unicode in non-Unicode applications.

Windows argument passing simply sucks. Each program can and has to implement its own parsing routine. Most programs rely on the runtime library to handle the parsing. For them, we "only" have to handle the different parsers of the various runtime libraries (all Borland DOS and Windows compilers/RTLs ever released, all Microsoft DOS and Windows compilers/RTLs ever released, and all those special compilers/RTLs like DJGPP, Phar Laps, 4GW, MinGW, ...). Other programs may use Windows API functions like CommandLineToArgvW. For the remaining programs that implement their own parsing routine, we are simply lost. There is no standard for quoting or parsing.

A rather drastical approach would be to limit system(LIST) to a list of exactly one or two arguments, where the second argument would be the entire command line passed to the program via CreateProcess() or similar functions. This represents the underlying API quite well, but it would break nearly all perl code that uses system(LIST).

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re^5: Construct command portable way by afoken
in thread Construct command portable way by avinash_d

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.