cvs commit: src/usr.sbin/nologin nologin.c

Dag-Erling Smørgrav des at des.no
Fri Jan 28 02:24:04 PST 2005


Jacques Vidrine <nectar at FreeBSD.org> writes:
> On Jan 4, 2005, at 2:22 PM, Maxime Henrion wrote:
> > Xin LI wrote:
> > >   Modified files:
> > >     usr.sbin/nologin     nologin.c
> > >   Log:
> > >   Use __unused macro instead of a bare void for main().
> > I bet there is a reason behind this, but I'm totally puzzled at why
> > you would do such a thing.  It was much prettier and more "C"
> > before.  Could you shed some light on this please?
> The point was to kill the spurious warnings.  Marking arguments as
> "unused" accomplishes this, and indicates more clearly to readers of
> the code the intentions of the writer.  Though "int main(void)" is
> acceptable Standard C, the canonical form is preferable, IMHO.

Neither is correct; the proper solution (with ample precedent in
FreeBSD) is to call getopt() with an empty option string.

Furthermore, if __unused is to be used at all, it should be after the
argument name, not before its type.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the cvs-all mailing list