Index: [thread] [date] [subject] [author]
  From: Stephen Byrd <sab11@duke.edu>
  To  : 
  Date: Thu, 4 Mar 1999 19:32:39 -0500

Re: getopt()

as far as i can tell, most command lines come in a rather specific format,
the program name, command line options and their arguments (if any), and
then other arguments such as search keys and directory names.  getopt() --
atleast the c version of it, you could try writing your own without ever
using getopt() -- assumes that argv is in this format so when it comes
across something without the - it assumes that the command line options are
finished.
    I advise documenting the format that everything needs to be entered and
giving an error message when the format is incorrect.
Stephen
sab11@duke.edu

Michael Abernethy wrote in message ...
>
>I'm working on goof right now and have tried to implement the getopt()
>function.
>It works fine when I type:     goof -r filename
>It works fine when I type:     goof wordToFind
>
>It doesn't work when I type:   goof wordToFind -r filename
>
>Has anyone run across this problem, and if you have, how did you manage
>to fix it?
>getopt() seems to work only when there's a -command as argv[1], and not at
>any other position
>Thanks alot,
>
>Mike Abernethy
>www.duke.edu/~mna
>IBM Club Cyberblue - www.cybrblu.ibm.com
>




Index: [thread] [date] [subject] [author]