Chapter Contents

Previous

Next
Porting UNIX Socket Applications to the SAS/C Environment

BSD Library Dependencies

Many socket programs implicitly assume the presence of the BSD library. For example, the BSD function bcopy is widely used in socket programs even though it is not portable to UNIX System V. Because of the lack of acceptance of such routines outside of the BSD environment and the fact that the same functionality is often available using ANSI Standard routines, BSD string and utility functions have not been added to the SAS/C Library.

Many UNIX programs ported to the SAS/C Library already contain support for System V environments in which Berkeley string and utility routines are not available. These programs usually call ANSI Standard functions instead. Using ANSI Standard functions is the best means of porting UNIX programs to the SAS/C Library because common ANSI string functions are often built in, and because the code will be more portable to other environments. To ease porting of code that relies on Berkeley string and utility routines, the SAS/C Usage Notes sample library contains the member BSDSTR, which includes sample source code for the following functions:

The BSD <strings.h> header file is also available to facilitate the compilation of programs that rely on Berkeley string and utility routines. By default, the <strings.h> header file does not define macros for the functions in the previous list because problems arise in compiling programs that contain direct declarations of the functions. If your program does not contain direct declarations of functions, you can use the #define option to define _BSD_MACROS before you include the <strings.h> header file. Refer to Chapter 7, "Compiler Options," in the SAS/C Compiler and Library User's Guide for information on the define compiler option.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.