Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)

In addition to these checks, lint checks for the following programming faults:
Defined but unused variables and functions
Variables used before they are set
Functions that return unused values
Flow control: unreachable program portions, unlabeled statements, and endless loops
Strict type-checking: enumeration, function use, operator selection, and implied assignments
Nonportable character use, such as incompatible character ranges
The most important messages lint returns involve the matching of the number and type of formal
and actual parameters to functions, the matching of the type of return expressions and return values
of functions, and the use of return values from functions.
A frequent programming error occurs when you fail to declare external functions. The C
programming language operates as if, unless declared, every function returns an int type. A
problem can arise when a function returns a char* type. The lint tool detects this type-mismatch
problem. (In environments where int and char* are the same size, the ported code will work,
but only sometimes. However, this type-mismatch will cause problems on machines where int is
16 bits and char* is 32 bits.)
findcalls Tool
findcalls is a programming tool developed by HP to help port applications to an Open System
Services (OSS) environment. findcalls is a source code analyzer written in the Perl programming
language. To use findcalls, you must have Perl installed on a UNIX workstation. findcalls
does not run on NonStop systems, and it is available only through your service provider.
When porting a large UNIX application from one platform to another, determine in advance which
system calls are used by the application. No two implementations of the UNIX operating system
are exactly alike. Even those that conform to open standards such as IEEE POSIX or X/Open XPG
often supply proprietary extensions beyond the standards. Even if two platforms share 95 percent
of the system calls used by an application, you must deal with the other 5 percent.
findcalls performs a simple but fast lexical analysis of your C source code by searching for
occurrences of system calls. By using the UNIX comm utility to compare the list of system calls used
by the application with the list provided in the OSS environment, you can approximate the task of
porting the application to the OSS environment. (A shell script for the UNIX comm tasks is provided
with findcalls.)
findcalls seeks occurrences of a known list of functions by using a list you provide when starting
findcalls. The default list supplied by HP contains all the functions whose names appear in
reference pages for SunOS, OSF/1, and UNIX System V Release 4 (SVR4). Each time findcalls
finds a function call, it checks whether the function name is present in the provided list of OSS
function calls. If it finds the call, findcalls writes the name to a file whose name ends in
.is_in_list.” If it does not find the call, findcalls writes the name to a file whose name
ends in “.not_in_list.
The findcalls distribution includes a helpful README file explaining the use of the tool in detail.
Within the README file, there is a tutorial that directs you through an example of using findcalls.
CodeCheck Tool
CodeCheck is a programming tool developed by ABRAXAS Software, Inc. for the UNIX workstation.
It examines source C and C++ code for compliance with POSIX.1 and POSIX.2 standards. It
reviews code and locates which parts are not portable (not standards-compliant). When it encounters
a noncompliant line of code, CodeCheck flags it and offers suggestions on how to correct it.
CodeCheck uses rule files to check for invalid or faulty coding techniques. For example, there are
rules that check for ISO/ANSI C compatibility, for portability (specific vendor machines, or in
findcalls Tool 49