Date: Sat, 4 May 2013 09:44:35 +0100 From: Chris Rees <utisoft@gmail.com> To: "freebsd-rc@freebsd.org" <freebsd-rc@freebsd.org> Subject: rc style guide Message-ID: <CADLo839Dq4D97ms5_Vqxv9QRTXzXng-ZOGwiQJZuB5Ln2FQdhw@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi all,
Since writing ports-mgmt/rclint with what I figure are sane defaults,
I've come across some differences between general usage in ports and
the "official" style guide.
I'd like to propose the following modifications:
1. Stop recommending using ${name}; it is inconsistent because
although you can do something like:
start_precmd=${name}_prestart
You then *can't* do:
${name}_prestart()
{
It's also very slightly slower (though of course this is a tiny effect).
2. Move load_rc_config directly below name and rcvar;
name=dummy
rcvar=dummy_enable
load_rc_config dummy
3. Remove the style recommendation on quoting variable values given as
expressions;
# OK
dummy_msg="Nothing started."
# Not OK
: ${dummy_msg="Nothing started."}
# OK
: ${dummy_msg=Nothing started.}
# [which is preferable to most people?? Comments please]
start_cmd=dummy_start
start_cmd="dummy_start"
There being no objections, I'm going to put these recommendations into
the style guide, and enforce them using rclint.
[most of this is ports stuff really]
http://www.freebsd.org/doc/en_US.ISO8859-1/articles/rc-scripting/rcng-dummy.html
http://www.freebsd.org/doc/en_US.ISO8859-1/articles/rc-scripting/rcng-confdummy.html
Chris
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADLo839Dq4D97ms5_Vqxv9QRTXzXng-ZOGwiQJZuB5Ln2FQdhw>
