OpenVMS Source-Code Demos
UNIX_HATER
//-----------------------------------------------------------------------------
// title : unix_hater.c
// author : Neil Rieck
// created: 2012-11-28
// purpose: does the example program shown in the "UNIX Haters Hand Book" compile?
//-----------------------------------------------------------------------------
//
// declare some stuff so the sample code can do anything (not necessarily useful)
//
#include <stdio.h>
#include <stdlib.h>
int e;
int C;
int R;
int you;
int *u;
int P(char* yada){
printf("%s", yada);
return(1);
}
main() {
u = &you; // initialize pointer
//-----------------------------------------------------------------------------
// This syntax is from our "UNIX Hater's Hand Book" PDF
// which does not compile (look at the statement "R=;")
// This happens all the time when copying to/from PDF (the author
// probably did not double check after pasting into Adobe Publisher)
//
// for(; P("\n"),R=; P("|"))
// for(e=C; e=P("_"+(*u++/8)%2))P("|"+(*u/4)%2);
//-----------------------------------------------------------------------------
// this syntax is from the web
// http://soup.fin.io/post/87786406/We-stopped-when-we-got-a-clean
// and it does compile.
//
for(; P("\n"),R--;P("|"))
for(e=C;e--;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);
//-----------------------------------------------------------------------------
}