$Id: cmt3.txt,v 1.3 2003/03/11 19:47:53 skaus Exp $
Command line parser

Changes: single quotes and backticks are valid filename characters,
	their meta function as quotes is dropped therefore -- 2003-03-11 ska

Unless stated otherwise, double quotes shall mark the beginning and
the end of strings in the following examples. If the quotes shall
serve a special function, strings are enclosed in [..].

+ options are separated from arguments and other options, e.g.:
		"arg1/opt1/opt2"
	-->
		%1 == "arg1"
		%2 == "/opt1"
		%3 == "/opt2"

+ multiple option characters are preserved, e.g.:
		"///opt1//opt2"
	-->
		%1 == "///opt1"
		%2 == "//op2"

+ arguments and options have different delimiters, at the time:
	arguments: (isspace(ch) || iscntrl(ch) || strchr(",;", ch))
	options: (isspace(ch) || iscntrl(ch))

	This also results in different handling of the additional
	delimiters command and semicolon, e.g.:
		"1,2,3,/4,/5,/6 7;8;/9;10"
	-->
		%1 == "1"
		%2 == "2"
		%3 == "3"
		%4 == "/4,"
		%5 == "/5,"
		%6 == "/6"
		%7 == "7"
		%8 == "8"
		%9 == "/9;10"

	This is necessary, because options can use comma and semicolon
	on their own, e.g. LH's /L switch.

	Also note: This rule effects _internal_ commands and batch files
	only.

+ Any number of valid delimiters are interpreted as a single one.

+ Quotes are removed from the arguments, but hide any metafunction
	of enclosed characters. The current implemention knows only
	paired double quotes.

	Quotes can appear within words.

	In the following example any quotes are quotes written on command line:
		"1 2'3"  "4 "567 "89/10"
	-->
		%1 == [1 2'3]
		%2 == [4 567]
		%3 == [89/10]

	Note: The 3rd argument contains the "/10", because the quotes
	remove the special meaning of '/'.

	BUT: If the very first character is a slash, the command line parser
	will still identify the argument as option, e.g.:
		"/123" /"456"
	-->
		%1 == [/123]
		%2 == [/456]

COMMAND.COM of MS DOS 6 makes heavy useage of the three characters:
comma ',', semicolon ';' and equal sign '='. Sometimes, but not always
all of those three characters are ignored to extract tokens, sometimes
any number, sometimes only a single character.

FreeCOM now uses scheme described below when to ignore what character.

Whitespaces, commas, semicolons and equal signs are ignored in any number
when extracting tokens that are a) fixed words, b) filenames or c)
options. The individual internal commands do treat those characters
specially, but at places where one whitespace is allowed, there are allowed
more than one always.

Fixed words are the names of the internal commands, "IN", "DO", "EXIST",
"ERRORLEVEL", but %v (in FOR), too.
Filenames are the arguments of DEL, TYPE, FOR ()'s etc.

For instance:
C> ==FOR,%A,IN,(*.c,*.h),DO,ECHO %a
is all correct.
C> ECHO,,a
will display ",a" ignoring the very first ',' only.
C> IF,,a;;;==a====echo OK
is all correct and will display "OK"
