[Nut-upsdev] RFC: allow HID subdriver's to register ups.conf

j T hyvan_trant at hotmail.com
Sun Jun 4 14:16:03 UTC 2006

Hi Peter

You see, this is the problem that I'm having; I *really* don't want to be 
polluting the vartable with all the options from all the different 
subdrivers, but the current design doesn't allow me to avoid this (atleast 
that I can tell).

Basically, main() does:

	process command line (while loop)
	chroot, setup signals, etc

Because main() processes the command line straight after it does 
makevartable(), there's no way to have the subdriver selected before the 
command line stuff happens. If the subdriver's init() is called from 
initups(), issuing a "-x wait" on the command line will always get rejected 
by the command line processing simply because the subdriver hasn't been 
init()ed at that point.

Also, the command line needs to have been processed before the initups() 
happens because it needs to know the regexs and so-on in order to match the 
relevent UPS.

This is the whole reason that it turned into a bit of a bodge... I rather 
hoped to avoid trying to sort the whole thing out; C isn't my forte, and I 
don't really feel confident enough in my ability to start trying to rework 
the main() routine.

Having said that, I did have one thought... what if each subdriver had it's 
own supplemental vartable?

I just need to work out how on earth to implement it (and use it from 
main())!!! ;-)

I might just have a look into this later today.

BTW; is it ok to use #ifdef preprocessor conditionals in NUT code? I don't 
remember reading anything in the developer notes against it, but I'd rather 
not go writing something using it if its unofficially tagged as being 

>Please keep the traffic on the mailing list.

Shucks, did it manage to get sent without the mailing list CC'd in? I 
thought I'd caught it and modified the recipients... doh!

Jo Turner

More information about the Nut-upsdev mailing list