ptg10805159
Appendix B. Miscellaneous Source Code
B.1Our Header File
Most programs in the text include the headerapue.h,shown in FigureB.1. It defines
constants (such asMAXLINE)and prototypes for our own functions.
Most programs need to include the following headers:<stdio.h>,<stdlib.h>
(for the exit function prototype), and <unistd.h> (for all the standardUNIX
function prototypes). So our header automatically includes these system headers, along
with<string.h>.This also reduces the size of all the program listings in the text.
/*
*Our own header, to be included before all standard system headers.
*/
#ifndef _APUE_H
#define _APUE_H
#define _POSIX_C_SOURCE 200809L
#if defined(SOLARIS) /* Solaris 10 */
#define _XOPEN_SOURCE 600
#else
#define _XOPEN_SOURCE 700
#endif
#include <sys/types.h> /* some systems still require this */
#include <sys/stat.h>
#include <sys/termios.h> /* for winsize */
895