O'Reilly logo

Advanced Programming in the UNIX® Environment, Third Edition by Stephen A. Rago, W. Richard Stevens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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>     /* ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required