TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Charles Angelich
from: Jasen Betts
date: 2003-08-03 22:39:38
subject: getopt()

Hi Charles.

02-Aug-03 21:00:00, Charles Angelich wrote to All

 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 the
 CA> command line want to use switch characters such as "/" or
"-"?

usually to separate switches (ie commands) from filenames or other literals

 CA> I've written code that parses from the _end_ of the CLI from
 CA> whitespace to whitespace with no switch characters and noticed no
 CA> inherent weaknesses (for my purposes).

??? "_end_ of the CLI"  means what exactly?

 CA> One reason I am asking is that using DOS and Linux plus third
 CA> party binaries it is sometimes difficult to remember what the
 CA> switch character even is. I'm getting old?

propperly written dos utils should use whatever switch character dos is
configured for... (new versions of dos from major suppliers have'nt been
configurable on this matter for some time)

many unix ports will ask for - in the documentation but recognise / too.

 CA> The requirement of some binaries to use "-f" preceding filenames
 CA> seems a bit unnecessary and I do often forget. TAR and GAWK come
 CA> to mind.

there's no requirement for "-f"

 tar cf source.tar Makefile README *.c *.h

:)

but seriously  the f specifies an optional archive filename while
un-swittched filenames on the command-line specify files fo put in the
archive or extract.

(IIRC the default archive name for tar is either of tar.out or /dev/rmt)

---
* Origin: Success is a journey, not a destination. (3:640/1042)
SEEN-BY: 633/267 270
@PATH: 640/1042 531 954 774/605 123/500 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™.