Paul,

On 8/9/2011 22:03, Paul Alfille wrote:
I'm sorry the documentation is poor.

I looked into your first question.
opt_c is a enum value for the type of program calling initialization in owlib:

enum opt_program { opt_owfs, opt_server, opt_httpd, opt_ftpd, opt_tcl,
opt_swig, opt_c,
};

I'll change the names in the next version to:

enum enum_program_type { program_type_filesystem, program_type_server,
program_type_httpd, program_type_ftpd, program_type_tcl, program_type_swig,
                                         program_type_clibrary,
};

A little wordy, but clearer when seen alone.
Makes sense.

I dug deeper in this area and bored a nice hole leaving some additional debug statements - managing to find that the issue was elsewhere.


----------------------------
Nice pickup on the optind problem, but I do have a question:

My reading of the man page is that optind should be set to 1 (not 0) to reset scanning.

"The variable optind is the index of the next element to be processed in argv. The system initializes this value to 1. The caller can reset it to 1 to restart scanning of the same argv, or when scanning a new argument vector."

Is there any reason for owcapi not to set optind to 1 before the start of processing? It's probably a very rare case the a user would want to start with any other value.
I can't imagine any problem with this. Haven't examined how getopt is used in owfs, but the following might be worth noting (from getopt manpage):

"A program that scans multiple argument vectors, or rescans the same vector more than once, and wants to make use of GNU extensions such as '+' and '-' at the start of /optstring/, or changes the value of *POSIXLY_CORRECT* between scans, must reinitialize *getopt*() by resetting /optind/ to 0, rather than the traditional value of 1. (Resetting to 0 forces the invocation of an internal initialization routine that rechecks *POSIXLY_CORRECT* and checks for GNU extensions in /optstring/.)"

My workaround was to set optind=0 following my getopt loop, but as you suggest above such might be better placed in owfs before its use of getopt. Setting it to 0 in my program doesn't seem break anything. Or so I hope...

/m
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to