Source Compatibility Guide

Routines in libucb

alphasort and scandir

These routines combine the functions of readdir and qsort to process directory information. scandir reads a directory and builds an array of pointers to directory entries, returning the number of entries in the array and a pointer to the array through the parameter, namelist. namelist is a pointer to an arrangement of directory structure pointers. If the directory cannot be opened for reading or if malloc cannot allocate enough memory to hold all the data structures, scandir returns -1. alphasort is a routine that alphabetically sorts an array of pointers to directory entries (built by the routine, scandir).

These routines are not available in the default SunOS 5.x release.

bcmp, bcopy, and bzero

Functionally equivalent to the memcmp, memcpy, and memset routines, see memory(3C). bcopy copies bytes, handling overlapping strings correctly. bcmp compares bytes, returning zero if they are identical, non-zero otherwise. bzero zeros out bytes. These routines are not available in the default SunOS 5.x release.

fopen and freopen

The SunOS 5.x and SunOS 4.1 versions differ in the handling of the a type. If mode a is specified, the SunOS 5.x version opens the file with O_APPEND set, while the SunOS 4.1 version doesn't. Also, the SunOS 4.1version always seeks to the end of the file when mode a is specified, while the SunOS 5.x version seeks to the end of the file if update mode is not specified.

ftime

Returns a structure that contains elements showing the elapsed time since the epoch (00:00:00, January 1st, 1970). See ctime(3C). This routine is not available in the default SunOS 5.x release.

getwd

Similar to getcwd. getwd returns the pathname of the current working directory, or NULL if there is an error. The return value of getwd is placed in a character string allocated by the caller. This routine is not available in the default SunOS 5.x release.

index and rindex

index returns a pointer to the first occurrence of a single character in a null-terminated character string. If the character does not occur in the string, index returns a NULL pointer. In the SunOS 5.x release, strchr replaces index, see string(3C).

rindex returns a pointer to the last occurrence of a single character in a null-terminated string, or a NULL pointer if the letter does not occur in the string. In the SunOS 5.x release, strrchr replaces rindex, see string(3C).

These routines are not available in the default SunOS 5.x release.

initstate, random, setstate, and srandom

Random number generator routines relied on by many user programs in the SunOS 4.1 release. These routines are not available in the default SunOS 5.x release.

See rand(3C), srand(3C), and drand(3C) in the SunOS Reference Manual.

nice

The SunOS 4.1 version always returns 0 if successful. The SunOS 5.x version returns the new nice value minus 20.

nlist

If unsuccessful, returns the number of symbols that were not located in the symbol table. (The SunOS 5.x version returns -1 if unsuccessful.) Also, nlist takes a file name as an argument, rather than a file descriptor.

printf, fprintf, sprintf, vfprintf, vprintf, and vsprintf

The following differences exist for these functions: