On Jun 20, 2006, at 3:20 AM, Massimo Valle wrote:
On 20/giu/06, at 00:41, Guyren Howe wrote:
On Jun 19, 2006, at 4:54 PM, Massimo Valle wrote:
I have a console application requiring a complex mix of command
line options, therefore I fell in the problem of advanced command
line parsing. To avoid reinventing the wheel I tried to search
something pre-built for RB but found nothing.
Is there someone that already solved the problem? and how?
The obvious answer is: GREP. All programmers should know how to
use grep, at least in a basic fashion. And if your command line
options are too complex for basic grep, you should almost
certainly rethink them.
Guyren,
using grep it's an interesting idea, however I would avoid to open
a shell from my application to invoke grep.
A better solution of grep would be calling getopt() via a declare
which is standard in libc. But again this is something external and
only available to Mac OS X and Linux.
I'd prefer to have something written in RB and possibly cross-
platform.
getopt might be available in Windows apps. Perhaps someone could try
the following test --
If System.IsFunctionAvailable("getopt", "msvcrt") then
//it's available
A REALbasic solution shouldn't be too hard to write. What you first
need is a simple grammar for arguments, for which a good starting
point might be <http://www.opengroup.org/pubs/online/7908799/xsh/
getopt.html> and <http://www.opengroup.org/pubs/online/7908799/xbd/
utilconv.html#usg>.
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>