What’s in a Standard?
The Single UNIX Specification and POSIX both specify a set of command-line utilities as well as C functions. These include things like the Bourne Shell, which must be installed as sh on any compliant system. On a GNU system, this is typically the GNU Bourne-Again Shell (bash), which runs in compatibility mode when invoked as sh. Other systems have their own implementations.
The basic utilities that these specifications require are quite varied. While you would expect any UNIX to support a basic shell and commands such as ls and cat, it’s less obvious that an M4 macro processor should also be a requirement.
Since one of the main goals of the efforts to standardize UNIX has been source compatibility, it should come as no surprise that the standard defines C interfaces to a set of standard system calls and library functions. Perhaps less obvious is the fact that the Single UNIX Specification requires a c99 compiler (called c99) and defines a set of command-line options that it must support.
Of course, the make utility is also part of POSIX and the SUS. Unfortunately, unlike C, makefile syntax isn’t well standardized. Each implementation of make supports basic rules of the following form:
target: dependencies action
For simple projects, this setup is enough. More complicated projects require things like conditional statement, however. These items aren’t defined by the standard, and different make implementations support them in different ways. A complex makefile that works with BSD make may not work on GNU or Solaris systems, for example, and utilities such as GNU Autoconf are often used to generate platform-specific makefiles.
Lots of cracks are apparent in the standard. For example, while the du command is standardized and has a set of standard options, none of these options specify how to state the maximum depth for du to print. On a GNU platform, you would use --max-depth; on Minix you’d use -l, on FreeBSD you’d use -d, and on most other platforms you would have to resort to something more complicated involving find.
It’s worth noting that, although the POSIX specification was based on UNIX, the first platform to pass the certification wasn’t a UNIX derivative. Digital’s VMS has that honor, and was rebranded as OpenVMS to indicate this compliance. Unlike Windows, the POSIX support in VMS actually was usable, although most VMS users look down on the POSIX environment as somewhat inferior to the native interfaces.