| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | getopt() |
1237c90693cf c_echo Hello Andrew - CA>>>> I haven't used getopt() for some time now but I have CA>>>> often wondered what the reasons are that most methods of CA>>>> parsing the command line want to use switch characters CA>>>> such as "/" or "-"? JB>>> usually to separate switches (ie commands) from filenames JB>>> or other literals Whitespace works too. CA>> With argc available I don't see the need for the switch CA>> chars. Order of entry should be sufficient. ac> Among other things it allows for optional switches, eg. ac> touch -t 030806 myfile ac> It's fairly obvious to anyone accustomed to command line ac> switches will realise 030806 is the parameter to -t. On the ac> other hand if you had to use ac> touch t 030806 myfile ac> then you would need to always three arguments. Plus it's ac> not so obvious that argv[1] is a switch and that argv[2] is ac> the parameter to argv[2]. Someone unfamilar with the touch ac> utility may think that 030806 is a filename. I used "touch t030806 myfile" (no whitespace) and parsed from whitespace to whitespace. ac> '/' is rarely used in UNIX as a switch character because it ac> is a path delimeter. True. ac> The whole thing is a bit of a non-issue really... I see from recent messages that speed is considered a non-issue now. I would imagine that size is also a non-issue for most. My concern was to reduce size and to reduce the complexity (for myself) when modifying the code later on. > > , , > o/ Charles.Angelich \o , > __o/ > / > USA, MI < \ __\__ ___ * ATP/16bit 2.31 * ... DOS the Ghost in the Machine! http://www.undercoverdesign.com/dosghost/ --- Maximus/2 3.01* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000) SEEN-BY: 633/267 270 @PATH: 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™.