Appendix B. Miscellaneous Source Code

B.1. Our Header File

Most programs in the text include the header apue.h, shown in Figure B.1. It defines constants (such as MAXLINE) and prototypes for our own functions.

/* * 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 */#if defined(MACOS) || !defined(TIOCGWINSZ)#include <sys/ioctl.h>#endif#include <stdio.h>      /* for convenience */#include <stdlib.h>     /* ...

Get Advanced Programming in the UNIX® Environment, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.