1 .\" CDDL HEADER START
   2 .\"
   3 .\" The contents of this file are subject to the terms of the
   4 .\" Common Development and Distribution License (the "License").
   5 .\" You may not use this file except in compliance with the License.
   6 .\"
   7 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   8 .\" or http://www.opensolaris.org/os/licensing.
   9 .\" See the License for the specific language governing permissions
  10 .\" and limitations under the License.
  11 .\"
  12 .\" When distributing Covered Code, include this CDDL HEADER in each
  13 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  14 .\" If applicable, add the following below this CDDL HEADER, with the
  15 .\" fields enclosed by brackets "[]" replaced with your own identifying
  16 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  17 .\"
  18 .\" CDDL HEADER END
  19 .\"
  20 .\" Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  21 .\" Use is subject to license terms.
  22 .\"
  23 .\" ident       "%Z%%M% %I%     %E% SMI"
  24 .\"
  25 .TH hdrchk 1 "02 July 2008"
  26 .SH NAME
  27 hdrchk \- check that header files conform to ON standards
  28 .SH SYNOPSIS
  29 .nf
  30 \fBhdrchk\fR [\fB-a\fP] \fIfile\fR [\fIfile ...\fR]\fP
  31 .fi
  32 .LP
  33 .SH DESCRIPTION
  34 .IX "OS-Net build tools" "hdrchk" "" "\fBhdrchk\fP"
  35 .LP
  36 .I hdrchk
  37 verifies that C header files (*.h) conform to the standards of the ON
  38 consolidation.
  39 See HEADER STANDARDS for details.
  40 .LP
  41 .SH OPTIONS
  42 .LP
  43 .TP 10
  44 .B -a
  45 Apply (more lenient) application header rules.
  46 .LP
  47 .SH HEADER STANDARDS
  48 .LP
  49 Standards for all header files:
  50 .TP 4
  51 .B 1.
  52 Begin with a comment containing a copyright message.
  53 .LP
  54 .TP 4
  55 .B 2.
  56 Enclosed in a guard of the form:
  57 .LP
  58 .nf
  59         #ifndef GUARD
  60         #define GUARD
  61         #endif /* [!]GUARD */
  62 .fi
  63 .sp
  64 .RS 4n
  65 The preferred form is without the bang character, but either is
  66 acceptable.
  67 .RE
  68 .LP
  69 .TP 4
  70 .B 3.
  71 Has a valid ident declaration.
  72 .LP
  73 Additional standards for system header files:
  74 .TP 4
  75 .B 1.
  76 The file guard must take the form '_\fBFILENAME\fP_H[_]', where
  77 \fBFILENAME\fP matches the basename of the file.
  78 If it is installed in a subdirectory, it should be of the
  79 form '_\fBDIR\fP_\fBFILENAME\fP_H[_]', though this is not currently enforced.
  80 The form without the trailing underscore is preferred in both cases.
  81 .LP
  82 .TP 4
  83 .B 2.
  84 All #include directives must use the <> form.
  85 .LP
  86 .TP 4
  87 .B 3.
  88 If the header file contains anything besides comments and preprocessor
  89 directives, then it must be enclosed in a C++ guard of the form:
  90 .LP
  91 .nf
  92         #ifdef __cplusplus
  93         extern "C" {
  94         #endif
  95 
  96         #ifdef __cplusplus
  97         }
  98         #endif
  99 .fi
 100