Date : Mon, 27 Jul 2009 17:06:28 +0100
From : jgh@... (Jonathan Graham Harston)
Subject: ANN: Updated CmdLine command line parsing library
CmdLine is available at <http://mdfs.net/blib/CmdLine> with
documentation at <http://mdfs.net/blib/Docs/CmdLine.txt>.
CmdLine is a BASIC library that provides a simple interface for
parsing a command line (or any other space-sperated string). It has
just been updated to correctly parse quoted strings such as with
myprog -i "H:\My Documents" -o "D:\Backup 2"
It is used in a manner similar to the following:
A$=@...$
IF FNcl("-?",0):PRINT "Syntax: zip -v -r -d dest -t date outfile indir"
vb%=FNcl("-v",0) :REM vb%=TRUE if -v switch present
rc%=FNcl("-r",0) :REM rc%=TRUE if -r switch present
dest$=FNcl("-d",1) :REM dest$=parameter after any -d option
date$=FNcl("-t",1) :REM date$=parameter after any -t option
out$=FNcl("",0) :REM out$=first parameter
in$=FNcl("",0) :REM in$=second paramter
Previous versions did not parse quoted strings correctly. With the
above example, zip "C:\My Documents" would set out$="""C:\My" and
in$="Document""". This version correctly sets out$="C:\My Documents"
and in$="".
Note that the library code is very much a black-box system and it
not expected that its working is to be understood. Some of the
coding is specifically written so that it can run on any version of
BBC BASIC so that it can be called by a program before it knows
what platform it is running on.
--
J.G.Harston - jgh@... - mdfs.net/User/JGH