home *** CD-ROM | disk | FTP | other *** search
- This was written to separate slash-letter options from argv strings when
- they have been typed tight against the previous argument; e.g., the
- command line myprog name.x/p would treat "name.x/p" as the filename string.
-
- The function is passed the usual argc and argv parameters and makes new
- ones, named uargc and uargv. Define uargc and uargv as global in the
- calling module.
-
- Quoted strings may use either double quote characters or single ones.
- Turbo C's initialize code processes the command line and separates
- double-quoted strings. This program scans each argv to see if it contains
- a space; if so, double quotes are placed around it before re-extracting.
-
- If the hyphen character begins an argv, it is changed to a slash. A
- hyphen appearing within a string is left as is, since it could be part
- of a file name.
-
- All letters, except for those within quoted strings, are converted to
- lower case.
-
- The characters comma and semicolon are treated as argument separators.
-
- uargv[0] is still the calling path\filename, just like the original argv[0].
-
- The file demo.exe shows how it works. Just type demo followed by a
- messy argument string, such as
- demo FILE/A "12 34 aBc" /b /c/dir -k 89-0,1,2
-
- The only problem I have found so far is when a double-quoted string
- contains a slash, but no space. There is no indication that the
- original line had quotes, so the slash is assumed to be an option.
-
- I am including the source (what there is of it) because you will no
- doubt want to customize it, and also because I do not
- accept responsibility for errors or maintenance. If you have
- suggestions for improvement, or hints as to how I could have made this
- more elegant, leave a message for me on PC-Library BBS, (612) 435-3943.
-
- 01-Dec-87 Bruce Nerase
-