[RFC] rc.d integration for the bluetooth subsystem
Maksim Yevmenkin
maksim.yevmenkin at savvis.net
Mon Nov 7 10:27:42 PST 2005
Yar Tikhiy wrote:
> On Fri, Nov 04, 2005 at 02:26:53PM -0800, Maksim Yevmenkin wrote:
>
>>All,
>>
>>please find next revision of bluetooth-rc stuff at
>>
>>http://people.freebsd.org/~emax/bluetooth-rc-1.diff.txt
>>
>>in this revision i have moved all bluetooth configuration files under
>>/etc/bluetooth. bluetooth.device.sample is now called 'default.conf' and
>>file that contain device specific overrides called '$dev.conf' (i.e.
>>'ubt0.conf').
>>
>>so, '/etc/rc.d/bluetooth start $dev' does the following
>>
>>1) sets hardwired defaults (for backward compatibility)
>>
>>2) reads up /etc/bluetooth/default.conf (if any)
>>
>>3) reads up /etc/bluetooth/$dev.conf (if any)
>>
>>4) starts the stack
>>
>>even though /etc/bluetooth/{default,$dev}.conf are not exactly shell
>>scripts they are still kinda like shell scripts :) these files should
>>follow sh(1) syntax to set the variable, comments etc.
>>
>>the parser in bluetooth_read_conf() is very simple and value of a
>>variable is still used in sh(1) eval. so one must be careful when
>>editing these files.
>
> What about simplifying the inner parser code even more:
>
> case "$_line" in
> ''|\#*)
> ;;
> *)
> if expr "$_line" : "[a-zA-Z0-9_]*="; then
> eval "${_namespace}${_line}"
> else
> ${logger} "Unable to parse line \"$_line\" in $_file"
> return 1
> fi
> ;;
> esac
sure. only need to
if expr "$_line" : "[a-zA-Z0-9_]*=" > /dev/null 2>&1 ; then
...
fi
i do not really have any objection to this. since i already pass the
value through eval i might as well pass the entire line.
> BTW, couldn't just err() or warn() be used instead of ${logger}?
i guess they could
> And AFAIK stdin to a while loop can be redirected w/o enclosing
> the loop in braces.
sure, but it looked more clear (to me anyway) this way :)
so does this look like something?
http://people.freebsd.org/~emax/bluetooth-rc-2.diff.txt
any other comments, suggestions, objections? please speak.
thanks,
max
More information about the freebsd-bluetooth
mailing list