BSD Sockets Interface Programmer's Guide
Chapter 8 179
Programming Hints
Portability Issues
Utmp
The 4.3 BSD /etc/utmp file format is incompatible with the HP-UX
implementation. The HP-UX implementation uses UNIX System V
compatible calls. Refer to the utmp(4) man page for details.
Library Equivalencies
Certain commonly used library calls in 4.3 BSD are not present in HP-
UX systems, but they do have HP-UX equivalents. To make code porting
easier, use the following equivalent library calls. You can do this by
putting them in an include file, or by adding the define statements (listed
in the following table) to your code.
Table 8-4 Definition of Library Equivalents
NOTE Include string.h before using strchr and strrchr. Include sys/
param.h before using getcwd.
Signal Calls
Normal HP-UX signal calls are different from 4.3 BSD signals. See the
sigvector(2) man page for information on signal implementation.
Sprintf Return Value
For 4.3 BSD, sprintf returns a pointer to a string. For HP-UX systems,
sprintf returns a count of the number of characters in the buffer.
Define
Statement
4.3 BSD Library HP-UX Library
#define index(a,b) strchr(a,b)
#define rindex(a,b) strrchr(a,b)
#define bcmp(a,b,c) memcmp(a,b,c)
#define bcopy(a,b,c) memcpy(b,a,c)
#define bzero(a,b) memset(a,0,b)
#define getwd(a) getcwd(a,MAXPATHLEN)