.Dd January 1, 1999 .Dt WRAPHFILE 1 .Os NetBSD 1.3F .Sh NAME .Nm wraphfile .Nd .h file wrapper utility .Sh SYNOPSIS .Nm .Ar filename ... .Sh DESCRIPTION .Nm is a utility to generate the canonical .\" Grr, why does .Bd/.Ed produce a blank line before but not after?! .\" Grr again, how come -literal doesn't quote the ... line? .Bd -literal -offset indent #ifndef symbol #define symbol \&... #endif .Ed wrapper around a .h file. It takes one or more filenames on the command line; each file is modified in-place to have such a wrapper. .\" Grrr...why does .Pf demand an argument for Nm? .Pf ( Nm wraphfile blindly assumes the files are .h files; it does not check this in any way.) .Pp The symbol used in the #ifndef and #define lines is derived from the basename of the file (the part after the last slash, or the whole name if it contains no slashes). It is computed by starting with the basename, then .Bl -bullet -compact -offset indent .It Converting all non-alphanumerics (as determined by .Xr isalnum 3 ) to underscores, .It Converting all letters to upper case, .It Prepending an underscore, and .It Appending a 10-character suffix. .El The suffix is simply a 32-bit checksum of the file's contents, expressed in hexadecimal, with underscores before and after it. (The checksum is a simple CRCish checksum. See the source code for details.) .Pp If the file already contains a wrapper that is identical to what .Nm would add, except for the checksum, then .Nm simply updates the checksum, or if even the checksum matches, doesn't touch the file at all. (This means you can just .\" Grrr, another case where we have to give an unnecessary argument to Nm! .Dq Nm wraphfile Pa *.h and it will interact correctly with .Xr make 1 . ) Additionally, if the very first characters in the file are a comment .Sq "/* NO WRAPHFILE */" , .Nm will not modify the file at all. .Pp The reason for having the checksum at all is distinct include files with the same basename. The canonical example is .Aq Pa time.h and .Aq Pa sys/time.h . I considered including the directory name in the generated symbol, but resolving this when relative pathnames are given on the command line was harder than I wanted to deal with. .Sh AUTHOR der Mouse, .Aq mouse@rodents.montreal.qc.ca .