TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: All
from: Kurt Kuzba
date: 2003-08-31 09:00:08
subject: getopt()

From: kkuzba{at}centurytel.net
To: c_echo{at}yahoogroups.com

* Author: Charles Angelich
CA>  I haven't used getopt() for some time now but I have often
CA>  wondered what the reasons are that most methods of parsing
CA>  the command line want to use switch characters such as
CA>  "/" or "-"?

    Streamlining.  Searching for those characters allows you to
 set your program parameters before you actually parse the command
 line.  Then you can parse for arguments, discarding switches and
 simply plugging the arguments into their receptacles.
 The branching logic construct for parsing the command line is
 thus simplified, because you already know all the commands and
 can disregard them while parsing out the arguments instead of
 dealing with them as they occur in the command line.  Also, it
 removes the need for the program to be able to distinguish the
 commands from the arguments.  In some cases, you might actually
 have a one or two byte string as an argument instead of as a
 command.  Confusion might otherwise result if you did not specify
 a cmd string identifier, like the backslash in ANSI C strings.

>  kkuzba{at}centurytel.net   http://home.centurytel.net/kkuzba
>  The host had almost passed when suddenly Aragorn stood up, and
>  called in a loud voice:
>  'What news from the North, Riders of Rohan?'

--- SoupGate-Win32 v1.05
* Origin: kkuzba{at}centurytel.net (2:292/516.666)
SEEN-BY: 633/267 270
@PATH: 292/516 854 140/1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.