.\" CDDL HEADER START .\" .\" The contents of this file are subject to the terms of the .\" Common Development and Distribution License (the "License"). .\" You may not use this file except in compliance with the License. .\" .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE .\" or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions .\" and limitations under the License. .\" .\" When distributing Covered Code, include this CDDL HEADER in each .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. .\" If applicable, add the following below this CDDL HEADER, with the .\" fields enclosed by brackets "[]" replaced with your own identifying .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" CDDL HEADER END .\" .\" Copyright 2008 Sun Microsystems, Inc. All rights reserved. .\" Use is subject to license terms. .\" .\" ident "%Z%%M% %I% %E% SMI" .\" .TH hdrchk 1 "02 July 2008" .SH NAME hdrchk \- check that header files conform to ON standards .SH SYNOPSIS .nf \fBhdrchk\fR [\fB-a\fP] \fIfile\fR [\fIfile ...\fR]\fP .fi .LP .SH DESCRIPTION .IX "OS-Net build tools" "hdrchk" "" "\fBhdrchk\fP" .LP .I hdrchk verifies that C header files (*.h) conform to the standards of the ON consolidation. See HEADER STANDARDS for details. .LP .SH OPTIONS .LP .TP 10 .B -a Apply (more lenient) application header rules. .LP .SH HEADER STANDARDS .LP Standards for all header files: .TP 4 .B 1. Begin with a comment containing a copyright message. .LP .TP 4 .B 2. Enclosed in a guard of the form: .LP .nf #ifndef GUARD #define GUARD #endif /* [!]GUARD */ .fi .sp .RS 4n The preferred form is without the bang character, but either is acceptable. .RE .LP .TP 4 .B 3. Has a valid ident declaration. .LP Additional standards for system header files: .TP 4 .B 1. The file guard must take the form '_\fBFILENAME\fP_H[_]', where \fBFILENAME\fP matches the basename of the file. If it is installed in a subdirectory, it should be of the form '_\fBDIR\fP_\fBFILENAME\fP_H[_]', though this is not currently enforced. The form without the trailing underscore is preferred in both cases. .LP .TP 4 .B 2. All #include directives must use the <> form. .LP .TP 4 .B 3. If the header file contains anything besides comments and preprocessor directives, then it must be enclosed in a C++ guard of the form: .LP .nf #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif .fi