tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

userconf_parse() return status



With some delay, I'm finishing modification of cons/userconf/config
(having implemented more in userconf than initially projected):

	* aliases hence local malloc/free;
	* executable aliases (macros without parameters but multiple
		lines possible meaning that one can define drmkms
		as alias with a list of devices and one can define
		"nodrmkms" as "disable -a drmkms" for example);
	* multiple arguments (instead of only one), aliases being 
		replaced and their definition parsed;
	* patterns;
	* kmap (char mapping for console input);
	* single letter support for built-ins (case insensitive:
		'e'|'E' for enable and so on).

Questions about current usage:

It is not obvious, but userconf_parse() was a function, returning
something. In fact, 0 generally (including when error) and (-1) when
quitting which is used (not obvious) to quit interactive mode (kernel
-c).

There are two outside usages of userconf_parse():

sys/arch/x86/x86/x86_userconf.c
sys/dev/fdt/fdt_userconf.c

where the return status is not tested (it should, since one could
imagine adding a "quit" or 'Q' in the series of instructions to
"comment out" the remaining instructions). So I will correct these.

I have modified userconf_parse() to return negative on error, 0 if OK,
and 1 if quitting. Is this OK? (Even if this is not of great use,
returning different values---here: negative ones---on error documents
the code).

The other question concerns the "history" in userconf.

I have corrected a blunder (a 'd' as "command" where a
'e'---enable---was expected) and I have added single letter support.

But if the history is now correct and could be executed (with support
for single letters), it is not accessible to user. So was this intended
to record what was done at boot time for post-mortem or debugging
purposes (which it seems) or was this intended for interactive user
comfort---I don't think so because I fail to see a benefit: user
will not repeat the same command again and again...

Does someone know the history of... "history"?
-- 
        Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index