rc style guide

Chris Rees utisoft at gmail.com
Sat May 4 11:44:04 UTC 2013


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


More information about the freebsd-rc mailing list