On Mon, Oct 05, 2015 at 05:38:34PM +0059, Jason McIntyre wrote:
> On Mon, Oct 05, 2015 at 11:50:49AM -0400, Rob Pierce wrote:
> > There are some offending braces. I just added leading tabs in the right
> > places to correct indentation.
> > 
> > Rob
> > 
> 
> why are you indenting? the point of "-offset indent" in the list/display
> is to do just that.
> 
> jmc

Hey Jason,

I am back at my desk now, so here is a better explination of my diff.

In my example corrections I indented the commands, but not the function's
closing brace.

Is it KNF compliant to have an exit() or return() at the same indentation as
the closing function brace? For example:

        exit(1);
        }

Or:

        return(1);
        }

My interpretation was that the style guide (and source code that I have
looked at) suggests that this is not the preferred style. My understanding
was that the following is preferred:

                exit(1);
        }

And:

                return(1);
        }

The common usage() function that I have seen in code is as follows:

/* From ntp.c. */

__dead void
usage(void)
{
        extern char *__progname;

        if (strcmp(__progname, "ntpctl") == 0)
                fprintf(stderr,
                    "usage: ntpctl -s all | peers | Sensors | status\n");
        else
                fprintf(stderr, "usage: %s [-dnSsv] [-f file]\n",
                    __progname);
        exit(1);
}

Rob

Reply via email to