Correct (English language) style. No change in (C language) style.
This commit is contained in:
parent
8e212e3580
commit
d754830ed7
@ -58,12 +58,12 @@ After any copyright header, there is a blank line, and the
|
||||
for source files.
|
||||
Version control system ID tags should only exist once in a file
|
||||
(unlike this one).
|
||||
Non-C/C++ source files follow the above example, while C/C++ source files
|
||||
follow the below one.
|
||||
Non-C/C++ source files follow the example above, while C/C++ source files
|
||||
follow the one below.
|
||||
All VCS (version control system) revision identification from files obtained
|
||||
from elsewhere should be maintained, including if there are multiple IDs
|
||||
from elsewhere should be maintained, including, where applicable, multiple IDs
|
||||
showing a file's history.
|
||||
In general, keep the IDs in tact, including any `$'s.
|
||||
In general, keep the IDs intact, including any `$'s.
|
||||
Most
|
||||
.No non- Ns Fx
|
||||
VCS IDs should be indented by a tab if in a comment.
|
||||
@ -77,17 +77,17 @@ static const char rcsid[] =
|
||||
#endif /* not lint */
|
||||
.Ed
|
||||
.Pp
|
||||
Followed by another blank line.
|
||||
Leave another blank line before the header files.
|
||||
.Pp
|
||||
Kernel include files (i.e. sys/*.h) come first; normally, you'll need
|
||||
Kernel include files (i.e. sys/*.h) come first; normally, include
|
||||
<sys/types.h>
|
||||
OR <sys/param.h>, but not both! <sys/types.h> includes <sys/cdefs.h>,
|
||||
OR <sys/param.h>, but not both. <sys/types.h> includes <sys/cdefs.h>,
|
||||
and it's okay to depend on that.
|
||||
.Bd -literal
|
||||
#include <sys/types.h> /* Non-local includes in angle brackets. */
|
||||
.Ed
|
||||
.Pp
|
||||
If it's a network program, put the network include files next.
|
||||
For a network program, put the network include files next.
|
||||
.Bd -literal
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
@ -96,8 +96,8 @@ If it's a network program, put the network include files next.
|
||||
#include <protocols/rwhod.h>
|
||||
.Ed
|
||||
.Pp
|
||||
Then there's a blank line, followed by the /usr include files.
|
||||
The /usr include files should be sorted!
|
||||
Leave a blank line before the next group, the /usr include files,
|
||||
which should be sorted alphabetically by name.
|
||||
.Bd -literal
|
||||
#include <stdio.h>
|
||||
.Ed
|
||||
@ -108,7 +108,7 @@ to the program go in pathnames.h in the local directory.
|
||||
#include <paths.h>
|
||||
.Ed
|
||||
.Pp
|
||||
Then, there's a blank line, and the user include files.
|
||||
Leave another blank line before the user include files.
|
||||
.Bd -literal
|
||||
#include "pathnames.h" /* Local includes in double quotes. */
|
||||
.Ed
|
||||
@ -416,7 +416,7 @@ If a line overflows reuse the type keyword.
|
||||
.Pp
|
||||
Be careful to not obfuscate the code by initializing variables in
|
||||
the declarations. Use this feature only thoughtfully.
|
||||
DO NOT use function calls in initializers!
|
||||
DO NOT use function calls in initializers.
|
||||
.Bd -literal
|
||||
struct foo one, *two;
|
||||
double three;
|
||||
@ -469,7 +469,7 @@ Use
|
||||
.Xr err 3
|
||||
or
|
||||
.Xr warn 3 ,
|
||||
don't roll your own!
|
||||
don't roll your own.
|
||||
.Bd -literal
|
||||
if ((four = malloc(sizeof(struct foo))) == NULL)
|
||||
err(1, (char *)NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user