3 ms·
The source code to the original Bourne shell did that and a lot worse. It became one of the inspirations for the IOCCC (International Obfuscated C Code Competit
by cbd1984 12y ago
The source code to the original Bourne shell did that and a lot worse. It became one of the inspirations for the IOCCC (International Obfuscated C Code Competition).
http://www.ioccc.org/faq.html http://www.ioccc.org/faq.html
(What that FAQ doesn't mention is the real reason the Bourne shell deserved to be in the IOCCC: The way it allocated memory. It trapped SIGSEGV (the signal the kernel sends you when you've provoked a segmentation violation or segfault by trying to access memory you don't own) so it would know when to request more RAM from the OS. This later became a problem for people looking to port the Bourne shell, for example to the Motorola 68000 CPUs which powered the first generation of Unix workstations.
http://www.in-ulm.de/~mascheck/bourne/segv.html http://www.in-ulm.de/~mascheck/bourne/segv.html )
- anatoly 12y agoThat's an amazing story, thanks! This is the place where it catches the fault: http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/sh/fault.c http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/...
- 0942v8653 12y agoHere's the IF/FI #defines: http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/sh/mac.h http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/...