Merge branch 'master' into readmes

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-02-22 20:56:02 -08:00
commit 341010ee03
450 files changed
+15581 -7477

No files matched your search

+1 -1
View File
@@ -50,7 +50,7 @@
# tool locations
################
#
SHELL= /bin/bash
SHELL= bash
MAKE= make
+12
View File
@@ -0,0 +1,12 @@
adbasename
adbasename.c
adecho
adecho.c
adgrep
adhead
adhead.c
adrian
adsleep
adsleep.c
adwc
adwc.c
+588 -211
View File
@@ -1,244 +1,621 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - adrian
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
# An Historical Makefile NOTE:
#
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
# GitHub pull requests are welcome:
#
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
# https://github.com/ioccc-src/winner
#
################################################################################
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
#############################
# shell used by this Makefile
#############################
#
# On some systems:
# CPP=/lib/cpp
#
CPP=/usr/ccs/lib/acpp
SHELL= bash
# flags for ansi compiles
#######################
# common tool locations
#######################
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# misc shell babble
# Set X11_LIBDIR to the directory where the X11 library resides
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
# winners that compile under ANSI C
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
all: $(WINNERS) $(ALT_NAMES)
# Common C compiler warnings to silence
#
#CSILENCE=
CSILENCE= -Wno-bitwise-op-parentheses -Wno-comment -Wno-deprecated-declarations \
-Wno-error -Wno-implicit-function-declaration -Wno-format-security \
-Wno-logical-op-parentheses -Wno-macro-redefined -Wno-parentheses \
-Wno-return-type -Wno-uninitialized -Wno-unused-value -Wno-unused-variable \
-Wno-unused-but-set-variable -Wno-unsequenced -Wno-unused-parameter
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
# Common C compiler warning flags
#
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# Defines that are needed to compile
#
CDEFINE=
#CDEFINE= -DIOCCC
# Include files that are needed to compile
#
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-comma -Wno-float-conversion -Wno-missing-noreturn \
-Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-padded \
-Wno-poison-system-directories -Wno-shadow -Wno-unreachable-code \
-Wno-unused-macros
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= adrian
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
${RM} -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${SED} '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
${CC} ${CFLAGS} -o adwc adwc.c
${SED} '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
${CC} ${CFLAGS} -o adbasename adbasename.c
${SED} '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
${CC} ${CFLAGS} -o adecho adecho.c
${SED} '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
${CC} ${CFLAGS} -o adhead adhead.c
${SED} '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
${CC} ${CFLAGS} -o adsleep adsleep.c
${RM} -f ad.temp
# NOTE: this is the original source that won
adgrep: ${PROG}
${RM} -f $@
${LN} $< $@
# alternative executable
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
alt: data ${ALT_TARGET}
@${TRUE}
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# data files
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
data: ${DATA}
@${TRUE}
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# both all and alt
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
everything: all alt
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
###############
# utility rules
###############
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# NOTE: this is the original program that won
#
# NOTE: some systems may only need:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
# NOTE: some systems may need:
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
# NOTE: this is the original program that won
#
# NOTE: some systems may need:
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
+12 -11
View File
@@ -1,4 +1,4 @@
Most Educational:
# Most Educational:
Adrian Mariano
University of Washington
@@ -6,25 +6,26 @@ Most Educational:
Mercer Island, WA 98040
USA
## To build:
Judges' comments:
make all
To build:
make adrian
### To run
Try:
adrian adrian.grep.try < adrian.hint
For the slow minded, try:
adsleep 32767
./adrian adrian.grep.try < adrian.hint
For the slow minded, try:
./adsleep 32767
## Judges' comments
Once you get past the obfuscation, you have an opportunity to learn
about regular expressions and state machines.
NOTE: Some compilers have had trouble optimizing this entry.
Selected notes from the author:
## Author's comments
ADrian's GREP (adgrep)
-113
View File
@@ -1,113 +0,0 @@
/* . wc . */
#include<stdio.h>/* Wht majr flwchrt? */
#include<string.h>/* That mjr flwchrt! */
#define P 257
#define G 17
#define z 8
#define v(jr) jr
int W ,head;
#define S(W,b,f) strncpy(W,b,f),W[f]=0\
char *wcs=" \t\n";
struct{ char X[z+1];
char f ;
int e ;
struct{ char g[z+1];
int b ;
} w[ G];
} o[ P];
int L=0,j= -28;
void E(int i, int m,char*c)
{
for(; i<43; i+=3)
putc(i["}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"]+i-9,stderr);
fprintf(stderr,"(%d): %s\n" ,m,c);
exit(1);
}
int N(int m, char *t)
{
int i ;
if (strlen (
t)>z) t[z ]=0;
for(i= 0; i< L ; i++) if(
!strcmp (o[ i] . X
, t))return i;
if( L== P)
E(0, m, t);
S (o[ L] . X , t
,z);
head; W = .1* head;
o[L ].f = !( strchr( t,']' )== 0 );
o[L ++ ] . e = 0;
return L -1 ; }
#define v(x )
int A(char *R)
{
int c=0, i;
while(* R) {
i = -1;
while(j){
if( ++ i==o[ c].e ) return 0;
if(o[
c] .w[i ] .g[0 ]
=='.' ||strchr (o[ c].w[i] .g ,* R)){
c=
o[ c ] .w[i].b; break;/*
main(int sl,char *j[]){
sleep (~~~~~~~~atoi(j[1])) ;/* . sl
sl s l . sl
l l ]
sl */ }
}
R++;
}
return o[ c].f;
}
main(int wc,char *V[]){char Y[999],*s;FILE*W;int m=0,echo,jr,q,wcl=0,wcw=0,wcc=0;
v(s = V[1]; if (*V=strrchr(s,'/'))s=*V+1; if(( !strncmp( s + (jr=strlen(s)) -
(q=strlen(V[2]) ),V[2],q))&&jr!=q) s[jr-q] = 0; puts(s); )
int e,p,C,Q ,basename;
W= fopen(wc>= 2 ? V[1] : "adgrep.c","rt");
echo| m^ e| 5| (int) .8| echo|
wc |C ==o[o[C] .e] .
e| e==+p,p; s[o[C] .e ]
;
while( fgets(Y,998,W)) { wcc += strlen(Y); m++;
if( s = strtok(Y,wcs)) wcw++;
else continue ;
C=
basename= j +j+*"* . basename"
+j+*"* r ] " + N(m,s) ;
while( s = strtok(0,wcs)) {
if( o[ C ] . e ==
G) E(1 ,m,o[C] .X) ;
S(o[C
] .w[o[C ] .e].g,s, z);
Q= C ;
if(! ( s =strtok ( 0 ,wcs )))wcw --
,E( 2 , m, o[C]
. w[ o[ Q ] .e] . g );
e
= o[C ] .w[o[C ] .e++ ] .b= N(m,s)
; wcw += 2; }
0&&
W && wcl++
< 10 && printf((W,Y)); }
if(j+28) { {
; } printf("%7u%7u%7u\n", wcl , wcw , wcc); }
while( gets(Y) ) if(A(Y)) puts(Y);
W, jr; }
O(int wc,char**V) {
--wc && (printf("%s ",*++V), main(wc,V), 1) || printf("\n"); }
+1
View File
@@ -0,0 +1 @@
albert
+551 -202
View File
@@ -1,244 +1,593 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - albert
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
#CSILENCE=
CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-unused-parameter
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-poison-system-directories -Wno-shorten-64-to-32
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= albert
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
+9 -7
View File
@@ -1,4 +1,4 @@
Most Useful Program:
# Most Useful Program:
Albert van der Horst
S P&A R&C
@@ -6,19 +6,21 @@ Most Useful Program:
3511 RA UTRECHT
The Netherlands
## To build:
Judges' comments:
make all
For a canned example:
make albert
albert 1234567890123456789
### To run
./albert 1234567890123456789
## Judges' comments
We were impressed with the speed at which it was able to factor
arbitrarily large numbers consisting of factors that fit into
a long.
Selected notes from the author:
## Author's comments
The Obfuscated version of the Horst algorithm.
+26 -144
View File
@@ -1,152 +1,34 @@
#include <stdio.h>
#include <malloc.h>
#include <setjmp.h>
#include <ctype.h>
#define new(PP) (PP *) malloc(sizeof(PP))
typedef struct q {
jmp_buf ppp;
long qq;
struct q *P;
struct q *p;
}
PP;
PP *P;
int aaaaaa=2;
int aaaaaaa=1;
long qqq;
aaAaaa(aa,aaa)
char *aa;
char *aaa;
main(argc,argv)
int argc;
char **argv;
{
char aaaa = 0;
if ((((( aaa )))))
{
aaaa = *aa;
*aa=0;
aa+=strlen(aa+1);
P =new(PP);
P->P=P;
P->p=P;
}
long arg[100];
int i,j;
int base = 10;
int start = 0;
int end= strlen(argv[1]);
if ((((( !setjmp(P->ppp) )))))
for (i=0;i<end;i++)
arg[i] = argv[1][i]-'0';
while ( end-start > 2 )
{
if ((((( !isdigit(*aa) )))))
longjmp(P->ppp,aaaaaaa);
else {
P->p->P = new(PP);
P->p->P->P = P;
P->p->P->p = P->p;
P->p = P->p->P;
while ( arg[end-1] == 0 ) {
printf("%d\n",base);
end--;
}
while ( arg[start] == 0 ) start +=1;
base += 1;
P->qq = *aa--;
P = P->p;
aaAaaa(aa,0);
for (i=start+1;i<end;i++)
for (j=i;j>start;j--)
if ( (arg[j]-=arg[j-1])<0 )
{
arg[j]+=base;
arg[j-1] -= 1;
}
}
} else {
if ( !aaaa&&!*aa )
longjmp(P->p->ppp,aaaaaaa);
if ((((( (P->qq=aaaa)<10 &&!
(isdigit(aaaa)) ||!
(isdigit(*aa) ||!
*aa ))))))
{
fprintf(stderr,"Usage %c%s <number>\n",
(aaa[0]?7:aaaa),aaa+!aaa[0]);
exit(1);
}
}
}
ppPppp(pp,ppp)
PP **pp, *ppp;
{
int aa;
if ((((( !(aa=setjmp(ppp->ppp))||aa==aaaaaa )))))
{
if ((((( *pp==ppp )))))
{
ppp = (*pp)->p;
if ( qqq<47 ) return;
if ( ppp->qq!=48 ) return;
while ( ppp->qq==48 )
{
printf("%ld\n",qqq-45);
*pp = ppp;
ppp = ppp->p;
}
qqq -= 1;
longjmp(ppp->ppp,aaaaaaa);
} else {
PP *p;
ppPppp(pp,ppp->p);
for (p=ppp;p!=*pp;p=p->p)
{
int qq=4;
if ((((( qqq<47 &&
(qq=0,p->qq+=p->p->qq-96)>=48-qqq ||
qqq>46 &&
(p->qq-=p->p->qq)<0 )))))
{
p->qq += qqq+qq;
if ( p->p==P && qqq<=46 )
{
P->p->P = new(PP);
P->p->P->P = P;
P->p->P->p = P->p;
*pp = P = P->p = P->p->P;
P->qq = 48;
}
p->p->qq+=qq==0;
p->p->qq-=qq!=0;
}
else
{
p->qq += 48;
}
}
if ( ppp->P==P ) longjmp(ppp->ppp,aaaaaaa);
}
}
else
{
qqq += 1;
while (48==P->qq )
{
P->P->p = P->p;
P = P->p->P = P->P;
}
if ( ppp!=ppp->p->p || qqq<47 )
longjmp(ppp->ppp,aaaaaa);
else
{
printf("At most one remains\n");
exit(0);
}
}
}
main(aaa,aaaa)
int aaa;
char **aaaa;
{
aaAaaa(aaa==aaaaaaa?aaaa[0]:aaaa[1],aaaa[0]);
qqq = 39;
ppPppp(&P,P->p);
}
-34
View File
@@ -1,34 +0,0 @@
#include <stdio.h>
main(argc,argv)
int argc;
char **argv;
{
long arg[100];
int i,j;
int base = 10;
int start = 0;
int end= strlen(argv[1]);
for (i=0;i<end;i++)
arg[i] = argv[1][i]-'0';
while ( end-start > 2 )
{
while ( arg[end-1] == 0 ) {
printf("%d\n",base);
end--;
}
while ( arg[start] == 0 ) start +=1;
base += 1;
for (i=start+1;i<end;i++)
for (j=i;j>start;j--)
if ( (arg[j]-=arg[j-1])<0 )
{
arg[j]+=base;
arg[j-1] -= 1;
}
}
}
-152
View File
@@ -1,152 +0,0 @@
#include <stdio.h>
#include <malloc.h>
#include <setjmp.h>
#include <ctype.h>
#define new(PP) (PP *) malloc(sizeof(PP))
typedef struct q {
jmp_buf ppp;
long qq;
struct q *P;
struct q *p;
}
PP;
PP *P;
int aaaaaa=2;
int aaaaaaa=1;
long qqq;
aaAaaa(aa,aaa)
char *aa;
char *aaa;
{
char aaaa = 0;
if ((((( aaa )))))
{
aaaa = *aa;
*aa=0;
aa+=strlen(aa+1);
P =new(PP);
P->P=P;
P->p=P;
}
if ((((( !setjmp(P->ppp) )))))
{
if ((((( !isdigit(*aa) )))))
longjmp(P->ppp,aaaaaaa);
else {
P->p->P = new(PP);
P->p->P->P = P;
P->p->P->p = P->p;
P->p = P->p->P;
P->qq = *aa--;
P = P->p;
aaAaaa(aa,0);
}
} else {
if ( !aaaa&&!*aa )
longjmp(P->p->ppp,aaaaaaa);
if ((((( (P->qq=aaaa)<10 &&!
(isdigit(aaaa)) ||!
(isdigit(*aa) ||!
*aa ))))))
{
fprintf(stderr,"Usage %c%s <number>\n",
(aaa[0]?7:aaaa),aaa+!aaa[0]);
exit(1);
}
}
}
ppPppp(pp,ppp)
PP **pp, *ppp;
{
int aa;
if ((((( !(aa=setjmp(ppp->ppp))||aa==aaaaaa )))))
{
if ((((( *pp==ppp )))))
{
ppp = (*pp)->p;
if ( qqq<47 ) return;
if ( ppp->qq!=48 ) return;
while ( ppp->qq==48 )
{
printf("%ld\n",qqq-45);
*pp = ppp;
ppp = ppp->p;
}
qqq -= 1;
longjmp(ppp->ppp,aaaaaaa);
} else {
PP *p;
ppPppp(pp,ppp->p);
for (p=ppp;p!=*pp;p=p->p)
{
int qq=4;
if ((((( qqq<47 &&
(qq=0,p->qq+=p->p->qq-96)>=48-qqq ||
qqq>46 &&
(p->qq-=p->p->qq)<0 )))))
{
p->qq += qqq+qq;
if ( p->p==P && qqq<=46 )
{
P->p->P = new(PP);
P->p->P->P = P;
P->p->P->p = P->p;
*pp = P = P->p = P->p->P;
P->qq = 48;
}
p->p->qq+=qq==0;
p->p->qq-=qq!=0;
}
else
{
p->qq += 48;
}
}
if ( ppp->P==P ) longjmp(ppp->ppp,aaaaaaa);
}
}
else
{
qqq += 1;
while (48==P->qq )
{
P->P->p = P->p;
P = P->p->P = P->P;
}
if (ppp!=ppp->p->p )
longjmp(ppp->ppp,aaaaaa);
else
{
printf("At most one remains\n");
exit(0);
}
}
}
main(aaa,aaaa)
int aaa;
char **aaaa;
{
aaAaaa(aaa==aaaaaaa?aaaa[0]:aaaa[1],aaaa[0]);
qqq = 39;
ppPppp(&P,P->p);
}
+3
View File
@@ -0,0 +1,3 @@
am
am.safe
ant
+564 -201
View File
@@ -1,244 +1,607 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - ant
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
#CSILENCE=
CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-unsequenced
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-conditional-uninitialized -Wno-implicit-int-conversion \
-Wno-missing-prototypes -Wno-missing-variable-declarations \
-Wno-poison-system-directories -Wno-shadow -Wno-shorten-64-to-32 \
-Wno-sign-conversion -Wno-strict-prototypes
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= ant
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
am am_clobber \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
am: ${PROG}
${RM} -f $@
${LN} $< $@
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
${RM} -f am.safe
${CP} am am.safe
${CP} am.safe am
${RM} -f am.safe
nuke: clobber
@true
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
install: all
cat $(WINNERS) > /dev/null
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
-4
View File
@@ -9,16 +9,12 @@
## To build:
make all
### To run
./am ant.test.mk
## Judges' comments
+4
View File
@@ -0,0 +1,4 @@
babble
babble.cppcb
buzzard.1
tmp
+587 -202
View File
@@ -1,244 +1,629 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - buzzard.1
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
#CSILENCE=
CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-pedantic \
-Wno-unused-parameter
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
CWARN= -Wall -Wextra ${CSILENCE}
#CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-missing-variable-declarations -Wno-poison-system-directories \
-Wno-unused-macros
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= buzzard.1
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
NOINCLUDE= ${SED} -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN= ${SED} -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN= ${GREP} -v '^. [0-9][0-9]*'
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
babble.cppcb: ${PROG}.c
${RM} -f tmp
${NOINCLUDE} ${PROG}.c | \
${CPP} ${CPPFLAGS} | \
${CPPCLEAN} | \
${UNIQ} | \
${SPACECLEAN} > tmp 2>&1
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < tmp > $@"; \
${GINDENT} < tmp > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < tmp > $@; \
else \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${MV} -f tmpbabble.cppcb $@"; \
${MV} -f tmp $@; \
fi
${RM} -f tmp
babble: ${PROG}
${RM} -f $@
${LN} $< $@
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -f babble.cppcb babble
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
+13 -11
View File
@@ -7,24 +7,26 @@ Most Obfuscated Algorithm:
USA
Judges' comments:
## To build:
make all
### To run
./babble 0 10
./babble 56 720
./babble 1 521
## Judges' comments
To see clearly why this won an award:
make babble
Try:
babble 0 10
babble 56 720
babble 1 521
To see good C Preprocessor babble, try:
make babble.cppcb
cat babble.cppcb
Notice how many statements it takes to do anything useful?
Selected notes from the author:
## Author's comments
What you shouldn't think about babble:
+2
View File
@@ -0,0 +1,2 @@
buzzard.2
first
+558 -202
View File
@@ -1,244 +1,600 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - buzzard.2
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
#CSILENCE=
CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-pedantic \
-Wno-return-type
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-comma -Wno-missing-prototypes -Wno-missing-variable-declarations \
-Wno-poison-system-directories -Wno-strict-prototypes -Wno-unreachable-code
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= buzzard.2
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
first: ${PROG}
${RM} -f $@
${LN} $< $@
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -f first
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
+23 -13
View File
@@ -1,4 +1,4 @@
Best Language Tool:
# Best Language Tool:
Sean Barrett
Software Construction Company
@@ -6,27 +6,37 @@ Best Language Tool:
College Station, TX 77840
USA
## To build:
Judges' comments:
make all
### To run
First:
make first
Second:
echo help | cat third help.th - | first
cat third demo5.th | first
Third:
cat third help.th - | first
Wait until Ok is printed and the type:
make first
Second:
echo help | cat third help.th - | ./first
cat third demo5.th | ./first
Third:
cat third help.th - | ./first
NOTE: Wait until Ok is printed and the type:
2 3 + . cr <-- yes you should really type the 2 letters: cr
Forth:
Sorry, this is third!
## Judges' comments
Selected notes from the author:
Have fun!
## Author's comments
What it does:
@@ -116,7 +126,7 @@ Selected notes from the author:
it also obfuscates the code. (Unfortunately, the top of stack
is a global variable and neither gcc nor most bundled compilers
seem to register allocate it.)
More significant are the design obfuscations. m[0] is the
"dictionary pointer", used when compiling words, and m[1] is
the return stack index. Both are used as integer offsets into
+2
View File
@@ -0,0 +1,2 @@
gson
og
+561 -202
View File
@@ -1,244 +1,603 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - gson
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
#CSILENCE=
CSILENCE= -Wno-bitwise-op-parentheses -Wno-char-subscripts \
-Wno-deprecated-declarations -Wno-empty-body -Wno-error \
-Wno-implicit-function-declaration -Wno-parentheses -Wno-pedantic \
-Wno-return-type -Wno-unused-parameter -Wno-unused-value
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-comma -Wno-implicit-int-conversion -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-poison-system-directories \
-Wno-shorten-64-to-32 -Wno-strict-prototypes
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= gson
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG} og
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
og: ${PROG}
${RM} -f $@
${LN} $< $@
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -f og
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
+21 -18
View File
@@ -1,4 +1,4 @@
Most Humorous Output:
# Most Humorous Output:
Andreas Gustafsson
Helsinki University of Technology
@@ -6,36 +6,39 @@ Most Humorous Output:
00410 Helsinki
FINLAND
## To build:
Judges' comments:
make all
### To run
./og word word2 word3 < /path/to/dictionary
## Judges' comment
To make:
make ag
Determine where your system dictionary is located. You may find
it located in one of the following places:
/usr/dict/words
/usr/share/lib/spell/words
/usr/ucblib/dict/words
/dev/null <-- for machines with nothing to say
/usr/share/dict/words
/usr/share/lib/spell/words
/usr/ucblib/dict/words
/dev/null # <-- for machines with nothing to say
Then using the proper dictionary:
ag free software foundation < /usr/dict/words
ag obfuscated c contest < /usr/dict/words
ag unix international < /usr/dict/words
ag george bush < /usr/dict/words
ag bill clinton < /usr/dict/words
ag ross perot < /usr/dict/words
ag paul e tsongas < /usr/dict/words
./ag free software foundation < /usr/share/dict/words
./ag obfuscated c contest < /usr/share/dict/words
./ag unix international < /usr/share/dict/words
./ag george bush < /usr/share/dict/words
./ag bill clinton < /usr/share/dict/words
./ag ross perot < /usr/share/dict/words
./ag paul e tsongas < /usr/share/dict/words
Recently some newspapers printed amusing anagrams of one of the
names listed above. Run this program to find the anagrams they
weren't allowed to print!
Selected notes from the author:
## Author's comments
The name of the game:
+1
View File
@@ -0,0 +1 @@
imc
+553 -202
View File
@@ -1,244 +1,595 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - imc
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
#CSILENCE=
CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-format
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-error -Wno-implicit-function-declaration -Wno-format \
-Wno-missing-variable-declarations -Wno-poison-system-directorie \
-Wno-poison-system-directories -Wno-unknown-warning-option
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= imc
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
+9 -7
View File
@@ -1,4 +1,4 @@
Best Output:
$ Best Output:
Ian Collier
Oxford University
@@ -8,10 +8,13 @@ Best Output:
OX1 4AW
ENGLAND
## To build:
Judges' comments:
make all
Make and run.
### To run
## Judges' comments
The program is more interesting to run on workstations that can
make use of a Sun raster file. Others can make use of the -text
@@ -19,13 +22,12 @@ Judges' comments:
Of course, the source (layout) is self-documenting! :-)
NOTE: The original winning source imc.orig.c assumed that
NOTE: The original winning source assumed that
exit returned a value which cause problems for some
systems where exit returned a void. The file imc.c
avoids this problem.
has been modified to avoid this problem.
Selected notes from the author:
## Author's comments
Portability
+1 -2
View File
@@ -1,5 +1,4 @@
#include <stdio.h>
#include <malloc.h>
#define ext(a) (exit(a),0)
#define I " .:\';+<?F7RQ&%#*"
#define a "%s?\n"
@@ -29,7 +28,7 @@
=128,K=1,V,B=0,Y,m=128,p=0,N
=768,U=768,h[]={0x59A66A95,256
,192,1,6912,1,0,0},t,A=0,W=0,Z=63,X=23
;o*J,_;main(c,v)l c;o**v;{l q=1;for(;;q<
;o*J,_;main(c,v)int c;o**v;{l q=1;for(;;q<
c ?(((J=v[q])[0]&&J[0]<48&&J++,((_= *J)<99||
_/2== '2'||(_-1)/3=='\"'||_==107||_/05*2==','||_
>0x074)?( fprintf(i,a,v[q]),r):_>0152?(_/4>27?(_&1?(
-54
View File
@@ -1,54 +0,0 @@
#include <stdio.h>
#include <malloc.h>
#define I " .:\';+<?F7RQ&%#*"
#define a "%s?\n"
#define n "0?\n"
#define C double
#define o char
#define l long
#define L sscanf
#define i stderr
#define e stdout
#define r exit (1)
#define s(O,B) L(++J,O,&B)!=1&&c>++q&&L(v[q],O,&B)!=1&&--q
#define F(U,S,C,A) t=0,*++J&&(t=L(J,U,&C,&A)),(!t&&c>++q&&!(t=L(v[q],U,\
&C,&A)))?--q:(t<2&&c>++q&&!(t=L(v[q],S,&A))&&--q
#define T(E) (s("%d",E),E||(fputs(n,i),r))
#define d(C,c) (F("%lg,%lg","%lg",C,c)))
#define O (F("%d,%d","%d",N,U),(N&&U)||(fputs(n,i),r)))
#define D (s("%lg",f))
#define E putc
C
G=0,
R
=0,Q,H
,M,P,z,S
=0,x=0
, f=0;l b,j=0, k
=128,K=1,V,B=0,Y,m=128,p=0,N
=768,U=768,h[]={0x59A66A95,256
,192,1,6912,1,0,0},t,A=0,W=0,Z=63,X=23
;o*J,_;main(c,v)l c;o**v;{l q=1;for(;;q<
c ?(((J=v[q])[0]&&J[0]<48&&J++,((_= *J)<99||
_/2== '2'||(_-1)/3=='\"'||_==107||_/05*2==','||_
>0x074)?( fprintf(i,a,v[q]),r):_>0152?(_/4>27?(_&1?(
O,Z=N,X=U): (W++,N=Z,U=X)):_&1?T(K):T(k)):_>103?(d(G,
R ),j=1):_&1? d(S,x):D,q++),q--,main(c-q,v+q)):A==0?(A=
1,f||(f=N/4.),b=(((N-1)&017)<8),q=(((N+7)>>3)+b)*U,(J=malloc(q)
)||(perror("malloc"),r),S-=(N/2)/f,x+=(U/2)/f):A==1?(B<U?(A=2,V
= 0,Q=x-B/f,j ||(R=Q),W&&E('\n',e),E(46,i)):(W&&E('\n',
e),E('\n',i ),h[1]=N,h[2]=U,h[4]=q,W||(fwrite(h,1,32,
e),fwrite (J,1,q,e)),free(J),exit(0))):A==2?(V<N?(j?
(H=V/f +S,M=Q):(G=V/f+S,H=M=0),Y=0,A=03):((m&0x80
) ||(m=0x80,p++),b&&(J[p++]=0),A=1,B++)):((Y
<k&&(P=H*H)+(z=M*M)<4.)?(M=2*H*M+R,H=P-z
+G,Y++):(W&&E(I[0x0f*(Y&K)/K],e),Y&K?J
[p]&=~m:(J[p]|=m),(m>>=1)||/*/
(m=128,u--),A==6?exit(1):B<u
. e=3,l=2*c*/( m
=0x80,
p++),V++
,A=0x2
)
));
}
+1
View File
@@ -0,0 +1 @@
kivinen
+553 -202
View File
@@ -1,244 +1,595 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - kivinen
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
#CSILENCE=
CSILENCE= -Wno-bitwise-op-parentheses -Wno-error -Wno-implicit-function-declaration \
-Wno-logical-op-parentheses -Wno-main -Wno-variadic-macros
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
#CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
CINCLUDE= -I ${HOMEBREW_PREFIX}/include
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
#LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11 -lresolv
LIBS= -L ${HOMEBREW_PREFIX}/lib -lX11 -lresolv
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-poison-system-directories -Wno-comma \
-Wno-conditional-uninitialized -Wno-sign-conversion
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= kivinen
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
-38
View File
@@ -1,38 +0,0 @@
#include <X11/Xlib.h>
# define X( x,v,y) XMoveWindow(d,s[x],(v)*z,(y)*z)
# define _ ButtonPressMask|ButtonReleaseMask
# define I( x,y) XSelectInput(d,s[x],y)
# define N( v) (XMapWindow(d,s[v]),v)
# define V VisibilityChangeMask
# define A XCreateSimpleWindow
# define D DefaultScreen(d)
# define E r.xbutton.button
# define R BlackPixel(d,D)
# define S r.xvisibility
int main(a)int a;{Window s[53];int w,u,i,c,y,l=0
,q,e=32,t,k,j=~0,z=(a+1)/2,x=a&1,v=z&1;XEvent r;Display*
d=XOpenDisplay("");s[0]=A(d,DefaultRootWindow(d),200,200,(x&
v?330:120)*z,215*z,2,R,R);I(N(c=0),_);for(;c<(x?32:52);c++){s[
c+1]=A(d,s[0],x ?c*20*z:(c-1)%10 *12*z,x?-20*z:(
c-1)/10*12*z,x ?z*(c^31?10: 2):z*10*(c?1:2
), x& v?z*10: (c &&!x?10:1+ x) *z,k =q=1, R,
WhitePixel(d ,D));I (N(c+1), V);}X( N(1),y=(x&v)
*115+50,x*70+ 60 ); X(N(c-- )+ 1,x?-10:(i=y)
,u=!x*130-20); while(c &&e< 160){if(x){if(
v){l=!(e &32)*9; for(w=30; w--;){ if(s[w+2]){ k=w%
10;l=e&32?k>l?k:l:k<l?k:l;X(w+2,10+k *20+q,(w/10)*20+e);}}l*=20;
e&31?e++:e&32?(q++,(q+l>300?e++:0)):(q--,q+l<10?e++:0); } u>140?
exit(c):u>-20?X(32,i,u-=(v?5:-1)):(!v?(u =5,srandom(time(0)),i=
random()%88+6):0); } else{k>0?i+=(i>105?k= -k:k):(i+=(i<1?k= -k:
k)); j>0?u +=(u>140?exit(++c):j):(u+=(u <1?j= -j:j
)); X( 52,i,u);}XSync(d,0); while(
XCheckMaskEvent(d ,_|V,&r))if(!(r. type==ButtonPress
?(E&1||!x||!v?t=E*4-8 :u<0?i=y+4,u=122:1):r
.type==ButtonRelease&&E?t=0,1:r.type^VisibilityNotify|S.state^1)
)for(x&v?(u= -15),w++:(w=0);++w <52-x*20;)if
(s[w] ==S.window)x&&v|| w ^1?
XUnmapWindow (d,s[w]) ,s[w]=0,c--:
0,l=1; if(!x&&l)j= -j,l=0; if(l&x&&!v
)u=~19,c--,l=0;t=(!x||!v) &&(y<5&&t<0||y>95&&t>0)?0
:t;s[1]?X(1,y+=x&v?t:t/(x+1),130):exit(++c);};return(c);}
+1
View File
@@ -0,0 +1 @@
lush
+558 -202
View File
@@ -1,244 +1,600 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - lush
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
#CSILENCE=
CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-macro-redefined
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-comma -Wno-missing-variable-declarations \
-Wno-poison-system-directories -Wno-unused-macros
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= lush
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
@echo "NOTE: This entry requires a non-standard K&R C compiler to compile."
${CC} ${CFLAGS} $< -o $@ ${LIBS}
lush.again: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
${RM} -f $@
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
${RM} -f lush.again
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
+11 -11
View File
@@ -1,27 +1,27 @@
Worst Abuse of the C Preprocessor:
# Worst Abuse of the C Preprocessor:
Ed Luke
Mississippi State University
P.O. Box 6176
Mississippi State, MS 39762, USA
## To build:
Judges' comments:
make all
To setup:
make lush
Try:
make lush.again 2>&1 | lush (sh or ksh users)
or:
make lush.again |& lush (csh users)
### To run
make lush.again 2>&1 | ./lush
NOTE: This entry requires a non-standard K&R C compiler to compile.
## Judges' comments
The program uses error messages issued by the C Proproessor to
generate its message to the world. One program's error is another
program's data!
Selected notes from the author:
## Author's comments
This program is yet another "Hello World." program with a twist. The
string Hello World has been encoded in the error messages the compiler
-167
View File
@@ -1,167 +0,0 @@
#define f 000:
char
*s,*
t,v;
char
_ [
999]
,x [
999]
,*p=
x ;
char
*av[
]= {
"W",
"H",
"o",
"l",
"N",
"e",
" ",
"r",
"d",
".",
"m",
"s",
"g",
"!",
"*",
"\n"
} ;
int
n= 0
;int
__ =
0,i=
000;
main
() {
#define f 001:
#define F 042:
#define f 100:
i--[
#define f 126:
#define f 132:
#define f 103:
#define f 202:
#define f 666:
#define f 77::
#define f 101:
_]=0
#define f 232:
#define f 151:
;if(
#define f 256:
!i){
puts
("I"
"BM"
" S"
"UX"
);;;
;;;}
;for
( ;
gets
(_);
) {
for(
#define f 301:
t=_,
#define f 700:
#define f 999:
s=t,
#define f 77 :
#define f 300:
s=t;
#define f s=t;
#define f 123:
#define f 127:
*t&&
!(!(
*t <
'0'
||*t
>'9'
)&&!
((t[
1] ^
':')
&&(t
[1]^
'.')
)) ;
t++)
#define f 137:
#define f 133:
;if(
#define f 111:
#define f 220:
v^*t
&&*t
){v=
*t;;
n=n*
2+(1
&*t)
;__=
(__+
1)&3
; __
||((
n<15
&&(*
p= *
av[n
] ),
#define f 2+2:
p++)
,n=0
);}}
#define f ==4:
;*p=
'\0'
;;;;
#define f puts
puts
(x);
s=t;
#define f s=5;
s=t;
#define f s=5:
s=t;
#define f 445:
#define f 113:
#define f 900:
s=t;
#define f n22:
#define f n40:
s=t;
#define f nn6:
s=t;
#define f nn1:
#define f 0:--
s=t;
#define f 19:-
#define f x2:x
s=t;
#define f x1:x
s=t;
#define f y2:x
#define f y7:y
s=t;
#define f 1:::
s=t;
#define f @3:@
#define f 10:0
#define f x+1:
s=t;
#define f 2:::
#define f 3:::
#define x 7:::
#define y 3:::
#define z 990:
#define Z 47::
;;;}
+1
View File
@@ -0,0 +1 @@
marangon
+555 -202
View File
@@ -1,244 +1,597 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - marangon
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
#CSILENCE=
CSILENCE= -Wno-bitwise-op-parentheses -Wno-error -Wno-implicit-function-declaration \
-Wno-logical-op-parentheses -Wno-main-return-type -Wno-missing-braces \
-Wno-parentheses -Wno-return-type -Wno-tautological-bitwise-compare \
-Wno-unsequenced
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
#LIBS=
LIBS= -lcurses
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-comma -Wno-missing-prototypes -Wno-missing-variable-declarations \
-Wno-poison-system-directories -Wno-strict-prototypes -Wno-unreachable-code
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= marangon
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
+9 -5
View File
@@ -1,4 +1,4 @@
Best Game:
# Best Game:
Marangoni Andrea
Department of Computer Science at Milano
@@ -6,10 +6,15 @@ Best Game:
62014 Corridonia (MC)
Italy
## To build:
Judges' comments:
make all
Make and run.
### To run
./marangon
## Judges' comments
The object is to refill the table with 5's, by incrementing
or decrementing numbers as needed. It is the side effects
@@ -25,8 +30,7 @@ Judges' comments:
systems where exit returned a void. The file marangon.c
avoids this problem.
Selected notes from the author:
## Author's comments
It starts off by creating a table with number 5 in all places. The
CPU melts the numbers and you must return them in original state.
-77
View File
@@ -1,77 +0,0 @@
#include <stdio.h>
#include <curses.h>
#define ST strchr
#define SRD srand48
#define RD lrand48
#define Q return
#define W wrefresh(r)
typedef int i;
#define Z(d,a) (RD()%((a)-(d)+1)+(d))
i f[3][3] = {15,52,36,20,-39,48,60,0,-25};
char z[6][6];
#define Y(x) (4*(x)+3)
#define X(x) (2*(x)+1)
#define I for
WINDOW *r=NULL;
#define K endwin()
char *g ="\
Use l-h-k-j for move.\nUse + for increment. Use - for decrement.\nUse Q to quit.";
i (*d())();
nt()
{
long time();
SRD(time((i *)0));
memset(z,5,36);
initscr();
cbreak();
noecho();
nonl();
if (COLS<80||LINES<24)
K,exit(1);
if (!(r=newwin(X(6),Y(6),
(LINES-X(6))/2,(COLS-Y(6))/2)))
K,exit(1);
mvaddstr(LINES-5,0,g);
refresh();
}
i ci()
{
i x,y=0;
I (;y<6;++y)
I(x=0;x<6;++x)
mvwaddch(r,X(y),Y(x),z[x][y]+'0'); Q(0);
}
void main()
{
char *ST();
i a=0,b=0,c,q,t,s,x,sc=0;
i(*(*p)())()=(nt(),d);
I(x=0 ; x++<20; )d(Z(0,5),Z(0,5),Z(1,2));
I(t=Z(0,2),q=s=0; q<3; s+=f[q][t]*f[q++][t]);
I(box(r,'|','-'),ci(),wmove(r,X(a),Y(b)),
W; (ST ("+-Qlkjh",(char)(c=wgetch(r))))&&
((i)((i)(q^=s%=Y(q),s/=2)!=(i)(s^=q)&&c&64&&(!(c&7|0)&&--b<0&&
(b=q^s)&0|| c&4&&++b==6&&c&4<(~b&23?q^=s,b^=b
:b&12?b=3:b|2)||c&2&&~c&1&&++a==++q/2+1&&c&16>(
!a|12?a=7,a&=~a:a|4?a=2:a&2)||~c&4&&c&
1&&--a<0&&(a+=6)&0)||~c&64&&(**p(b,a,~c))()||
c&16)?K,exit(0):1)||c; sc==36?ci(),W,K,exit(0):wmove(r,X(a),Y(b)),
W)
I(t=Z(0,2),q=s=0; q<3; s+=f[q][t]*f[q++][t])
I(sc=0; sc<36&&*((char *)z+sc++)==5; );
}
i (*d(a,b,c))()i a,b,c;
{
i x,y;
I(x=a>0?a-1:0; x<=(a<5?a+1:5); ++x)
I(y=b>0?b-1:0; y<=(b<5?b+1:5); ++y)
if(x==a&&y==b&&z[x][y]==(c&2?1:9)||z[x][y]==(c&2?9:1)&&(x!=a||y!=b))Q(ci);
I(x=a>0?a-1:0; x<=(a<5?a+1:5); x++)
I(y=b>0?b-1:0; y<=(b<5?b+1:5)&&(x==a&&y==b&&(z[x][y]+=(c&2?-1:1))||(z[x][y]+=(c&2?1:-1))); y++); Q(ci);
}
+1
View File
@@ -0,0 +1 @@
nathan
+551 -202
View File
@@ -1,244 +1,593 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - nathan
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
CSILENCE=
#CSILENCE= -Wno-implicit-int
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-poison-system-directories
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= nathan
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
+11 -6
View File
@@ -1,4 +1,4 @@
Worst Abuse of the Rules:
# Worst Abuse of the Rules:
Nathan Sidwell
Inmos UK
@@ -7,8 +7,15 @@ Worst Abuse of the Rules:
Bristol
UK BS12 4SQ
## To build:
Judges' comments:
make all
### To run
./nathan
## Judges' comments
The US International Traffic in Arms Regulations controls certain
exportations going out of the United States. The U.S. Munitions
@@ -54,8 +61,7 @@ Judges' comments:
rules entries are ones that tend to 'streach' the limits and
take the contest into unexpected territory.
Personal note from chongo:
### Personal note from chongo:
I think this situation shows just how ridiculous US crypto
regulations really are. Certain US federal officials can get away
@@ -63,8 +69,7 @@ Personal note from chongo:
laws, but I personally can't re-distribute a program contest winner
to the network!
Selected notes from the author:
## Author's comments
PROGRAM USE
+2
View File
@@ -0,0 +1,2 @@
vern
vern.tmp.c
+561 -202
View File
@@ -1,244 +1,603 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - vern
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
#CSILENCE=
CSILENCE= -Wno-bitwise-conditional-parentheses -Wno-dangling-else -Wno-error \
-Wno-implicit-function-declaration -Wno-parentheses -Wno-pedantic \
-Wno-return-type -Wno-shift-op-parentheses
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-comma -Wno-float-conversion -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-poison-system-directories \
-Wno-shadow -Wno-strict-prototypes
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= vern
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.tmp.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
${PROG}.tmp.c: ${PROG}.c
${RM} -f $@
${SED} <${PROG}.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
${SED} 's/} /=/g;s/{ /i/g' >$@
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -f ${PROG}.tmp.c
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
+13 -9
View File
@@ -1,4 +1,4 @@
Best of Show:
# Best of Show:
Vern Paxson
Lawrence Berkeley Laboratory
@@ -8,24 +8,29 @@ Best of Show:
1 Cyclotron Rd.
Berkeley, CA 94720 USA
## To build:
Judges' comments:
make all
Try:
make vern
vern 3 <-- default is 2
### To run
./vern 3 # <-- default is 2
## Judges' comments
You might start off by giving the following input:
63 43
76 55
71 52
67 57 (this may take a while)
The judges assume no responsibility for the obfuscated opening
suggested above. :-)
For a real quick game try:
vern
./vern
65 55
66 46
@@ -35,8 +40,7 @@ Judges' comments:
NOTE: Because some mailers have problems with the original winning source,
a slightly modified version with shorter lines has been provided.
Selected notes from the author:
## Author's comments
This program plays chess. You play the white pieces and the program
the black pieces. Moves are entered as a two-digit number specifying
-210
View File
@@ -1,210 +0,0 @@
#include <stdio.h>
; m(x)(x<0?-1:!!x)
; g tj()-J
; a(x)(x<0?-x:x)
; h(x)((x)<=K?x:N-(x))
; f 9999
; A return
; H printf{
; R double
; U int
; V for
; b else
; u while
; B if
U v,w,Y} -1,W,J,p,F,o} f,M,N,K,X,YY,_,P[f],s{ } ;
typedef U{ *L} { } ;
L q[f];
tj{ } {
U S} m{ v} +{ m{ w} <<K} ;
B{ !S} A J;
V{ v} W+S; v!} J&&!q[v]; v+} S} ;
A v;
}
k{ } {
_} K;
A v?a{ v} >1||w-Y||!q[J]:{ w-Y&&{ w-Y*2||q[W+Y*{ N+1} ]||
{ J>>K} -K+{ Y-1} / 2} } ||q[J];
}
z{ } {
_} 5;
A v*w||g;
}
e{ } {
_} -2;
A{ v*v*v-v||w*w*w-w} &&{ J-W-2||{ W&N} -4||{ W>>K!} { Y-1?N:0} } ||
q[W+1]||q[W+2]||q[W+K]!} z||P[W+K]*Y<0} ;
}
R VR{ } {
int PZ} 0x7fff;
A{ R} { rand{ } &PZ} /{ R} PZ;
}
l{ } {
_} K+1;
A{ v*w&&a{ v} -a{ w} } ||g;
}
R UC{ } {
R { } 0,d;
u{ { { +} d} VR{ } } <1.0} ;
A d;
}
c{ } {
_} -11;
A a{ v} -a{ w} ||g;
}
I{ ur,n,x} {
W} ur;
J} n;
B{ P[W]!} Y||P[J]} } Y} A J+1;
v} { J&N} -{ W&N} ;
w} { J>>K} -{ W>>K} ;
A q[W]{ } ||{ x&&QL{ W,J,s} } ;
}
TT{ W} {
v} w} 0;
A q[W]{ } +K;
}
s{ } {
U j} -1,{ ;
Y} -Y;
V{ { } 0; { <M; ++{ } {
B{ j<0&&P[{ ]} } -Y&&TT{ { } &&_} } -2}
{
j} { ;
{ } -1;
}
b B{ j>} 0&&!I{ { ,j,0} } A Y} -Y;
}
A!{ Y} -Y} ;
}
bb{ } {
_} 1;
A a{ v*w} -2;
}
uv{ } {
V{ v} 0; v<f; ++v} {
B{ h{ v>>K} } } 0} {
U S} h{ v&N} ;
q[v]} !S?z:{ S} } 1?bb:{ S} } 2?c:{ v&N>K?l:e} } } ;
}
b B{ h{ v>>K} } } 1} q[v]} k;
b q[v]} 0;
P[v]} !!q[v]*{ 28-v} ;
}
}
y{ } {
U G} Y,{ ;
J} 0;
V{ { } 0; { <M; ++{ } {
{ %8||H"\n%4o ",{ } ;
B{ { Y} P[{ ]} m{ P[{ ]} } &&TT{ { } } H"%c ",_+93+Y*16} ;
b H"- "} ;
}
H"\n "} ;
do
H"%2d",{ ++&N} ;
u{ { &N} ;
Y} G;
H"\n"} ;
}
O{ W,J} {
B{ { q[J]} q[W]} } } k&&h{ J>>K} } } 0} q[J]} l;
B{ q[W]} } e} B{ J-W} } 2} O{ J+1,J-1} ;
b B{ W-J} } 2} O{ W-1,W+1} ;
P[J]} P[W];
q[W]} 0;
P[W]} 0;
}
QL{ W,J,D} L D;
{
U HQ} P[J],YX;
L AJ} q[J],XY} q[W];
O{ W,J} ;
YX} D{ } ;
O{ J,W} ;
q[J]} AJ;
q[W]} XY;
P[J]} HQ;
A YX;
}
C{ } {
U { ,j,BZ} 0;
V{ { } 0; { <M; ++{ } {
L Z} q[{ ];
B{ Z} {
U r} h{ { >>K} +h{ { &N} ,G} Y,
S} Z} } z?88:{ Z} } k?11+r+{ P[{ ]<0?N-{ { >>K} :{ { >>K} } :
{ Z} } l?124-{ { YY<8&&{ { { &N} !} K||
{ { >>K} !} { P[{ ]>0?0:N} } } ?M:0} :
{ Z} } c?41+r:{ Z} } e?f-r-r:36+r+r} } } } ;
Y} P[{ ];
V{ j} 0; j<M; ++j} B{ !I{ { ,j,0} } S+} { P[j]?5:1} ;
BZ+} G} } Y?S:-S;
Y} G;
}
}
B{ !{ ++X&M-1} } write{ 1,".",1} ;
A BZ;
}
PX{ } {
U { ,Q} 0,XP} 0,JZ} M*M,E} -f,t,S} o;
B{ !F--} A++F+C{ } ;
V{ { } 0; { <JZ; ++{ } B{ !I{ { >>K+K,{ &M-1,1} } {
Y} -Y;
o} -E;
t} -QL{ { >>K+K,{ &M-1,PX} ;
Y} -Y;
B{ t>E} {
++XP;
Q} { ;
E} t;
B{ E>} S}
A++F,E;
}
}
B{ !XP} E} s{ } ?-f+1:0;
p} Q;
A++F,E;
}
RZ{ } {
U { ,j,T} 0;
V{ ; ; } {
y{ } ;
o} f;
do{
H"\n%d %d %d %s ",X,T,C{ } ,s{ } ?"!":">"} ;
fflush{ stdout} ;
}
u{ scanf{ "%o%o",&{ ,&j} !} 2||I{ { ,j,1} } ;
O{ { ,j} ;
y{ } ;
X} 0;
++YY;
Y} -Y;
T} PX{ } ;
{ } p>>{ K<<1} ;
j} p&{ M-1} ;
B{ I{ { ,j,1} } {
H"Rats!\n"} ;
A;
}
O{ { ,j} ;
Y} -Y;
B{ T>M*M} H"\nHar har.\n"} ;
}
}
main{ ac,av} char**av;
{
long time{ } ,j} time{ &j} ;
R { } 0;
srand{ { U} j} ;
V{ M} 0; M<} f; ++M} { +} UC{ } ;
M} { /100;
B{ M&3} ++M;
B{ M&1} --M;
V{ N} 1; N*N<M; ++N} ;
K} --N/2;
F} ac>1?atoi{ av[1]} :2;
uv{ } ;
RZ{ } ;
}
+1
View File
@@ -0,0 +1 @@
westley
+558 -202
View File
@@ -1,244 +1,600 @@
# %W% %G% %U%
#!/usr/bin/env make
#
# 1992 makefile
# IOCCC 1992 winning entry - westley
################################################################################
#
# Copyright (c) 1992, Landon Curt Noll & Larry Bassel.
# All Rights Reserved. Permission for personal, educational or non-profit
# use is granted provided this this copyright and notice are included in its
# entirety and remains unaltered. All other uses must receive prior permission
# from Landon Curt Noll and Larry Bassel.
SHELL=/bin/sh
CHMOD=chmod
CP=cp
RM=rm
SED=sed
LN=ln
UNIQ=uniq
CB=cb
GREP=grep
# set this to where your C Processor resides
# An Historical Makefile NOTE:
#
# On some systems:
# CPP=/lib/cpp
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
CPP=/usr/ccs/lib/acpp
# flags for ansi compiles
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
# The orig.Makefile, if it exits, is a copy of the pre-modified Makefile.
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others may want nothing
# at all. Adjust the CFLAGS line as needed.
# Regarding individual entries:
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# entries incorrectly. You might want need to turn on -O
# to see if your compiler can handle them.
# IOCCC winning entry code may not work on your system. Even with standards,
# conditions and build environments change, especially when it comes to more
# extreme code such you might find in an IOCCC winner. Moreover, what was
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
# later IOCCC years.
#
#CFLAGS=-O -Xa
CFLAGS=-Xa
CC=cc
# misc shell babble
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
#
NOINCLUDE=$(SED) -e 's/^.\([ ]*\)include/%include/'
SPACECLEAN=$(SED) -e 's/\([^ ]\)\([ ]\)[ ][ ]*/\1\2/g'
CPPCLEAN=$(GREP) -v '^. [0-9][0-9]*'
# winners that compile under ANSI C
# GitHub pull requests are welcome:
#
WINNERS= adrian albert ant buzzard.1 buzzard.2 gson kivinen imc \
lush marangon nathan vern westley
ALT_NAMES= adgrep am babble first ag whereami
all: $(WINNERS) $(ALT_NAMES)
adrian: adrian.c
$(CC) $(CFLAGS) adrian.c -o adrian
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
$(SED) '1s/\..*\./. wc ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adwc.c
$(CC) -o adwc adwc.c
$(SED) '1s/\..*\./. basename ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adbasename.c
$(CC) -o adbasename adbasename.c
$(SED) '1s/\..*\./. echo| ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adecho.c
$(CC) -o adecho adecho.c
$(SED) '1s/\..*\./. head; ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adhead.c
$(CC) -o adhead adhead.c
$(SED) '1s/\..*\./. sleep ./' adrian.c > ad.temp
-./adrian ad.temp <ad.temp >adsleep.c
$(CC) -o adsleep adsleep.c
$(RM) -f ad.temp
# NOTE: this is the original source that won
# If you have a patch that might make running an entry work in modern Unix-like
# environments, please create a GitHub pull request for the IOCCC judges to
# consider.
#
adrian.orig: adrian.orig.c
$(CC) $(CFLAGS) adrian.orig.c -o adrian.orig
albert: albert.c
$(CC) $(CFLAGS) albert.c -o albert
# NOTE: this is the original source that won
# Suggestions and corrections regarding Makefiles, winning author information,
# fixing typos in remarks, and code patches are welcome via opening a GitHub
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
# to consider. To form a GitHub issue or GitHub pull, please visit:
#
albert.orig: albert.orig.c
$(CC) $(CFLAGS) albert.orig.c -o albert.orig
ant: ant.c
$(CC) $(CFLAGS) ant.c -o ant
buzzard.1: buzzard.1.c
$(CC) $(CFLAGS) buzzard.1.c -o buzzard.1
babble.cppcb: buzzard.1.c
$(NOINCLUDE) buzzard.1.c | \
$(CPP) $(CPPFLAGS) | \
$(CPPCLEAN) | \
$(CB) $(CBFLAGS) | \
$(UNIQ) | \
$(SPACECLEAN) > babble.cppcb 2>&1
buzzard.2: buzzard.2.c
$(CC) $(CFLAGS) buzzard.2.c -o buzzard.2
# NOTE: this is the original source that won
# https://github.com/ioccc-src/winner
#
buzzard.2.orig: buzzard.2.orig.c
$(CC) $(CFLAGS) buzzard.2.orig.c -o buzzard.2.orig
################################################################################
gson: gson.c
$(CC) $(CFLAGS) gson.c -o gson
# NOTE: some systems may only need:
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
kivinen: kivinen.c
$(CC) $(CFLAGS) kivinen.c -o kivinen -lX11 -lsocket -lresolv -lnsl
# See: http://creativecommons.org/licenses/by-sa/3.0/
# NOTE: this is the original program that won
#############################
# shell used by this Makefile
#############################
#
# NOTE: some systems may only need:
SHELL= bash
#######################
# common tool locations
#######################
#
# $(CC) $(CFLAGS) kivinen.c -o kivinen -lX11
A2P= a2p
AR= ar
ASA= asa
AT= at
ATQ= atq
ATRM= atrm
AWK= awk
BANNER= banner
BASE64= base64
BASENAME= basename
BATCH= batch
BC= bc
BINHEX= binhex
BISON= bison
BUNZIP2= bunzip2
BZCAT= bzcat
BZCMP= bzcmp
BZDIFF= bzdiff
BZEGREP= bzegrep
BZFGREP= bzfgrep
BZGREP= bzgrep
BZIP2= bzip2
BZLESS= bzless
BZMORE= bzmore
C2PH= c2ph
C89= c89
C99= c99
CAL= cal
CALC= calc
CAT= cat
CD= cd
CHFLAGS= chflags
CHGRP= chgrp
CHMOD= chmod
CKSUM= cksum
CLANG= clang
CLANG_PLUSPLUS= clang++
CLEAR= clear
CMP= cmp
COL= col
COLLDEF= colldef
COLRM= colrm
COLUMN= column
COMPRESS= compress
CP= cp
CPIO= cpio
CPP= cpp
CRC32= crc32
CSH= csh
CSPLIT= csplit
CURL= curl
CUT= cut
C_PLUSPLUS= c++
C_PLUSPLUS_FILT= c++filt
DATE= date
DC= dc
DD= dd
DF= df
DIFF3= diff3
DIFF= diff
DIG= dig
DIRNAME= dirname
ED= ed
EGREP= egrep
ENV= env
EQN= eqn
ETAGS= etags
EXPECT= expect
EXPR= expr
FALSE= false
FGREP= fgrep
FILE= file
FIND2PERL= find2perl
FIND= find
FLEX= flex
FLEX_PLUSPLUS= flex++
FMT= fmt
FOLD= fold
FS_USAGE= fs_usage
FUNZIP= funzip
FUSER= fuser
GCC= gcc
GDIFFMK= gdiffmk
GENCAT= gencat
GENSTRINGS= genstrings
GETOPT= getopt
GETOPTS= getopts
GINDENT= gindent
GNUMAKE= gnumake
GREP= grep
GROFF= groff
GROFFER= groffer
GROG= grog
GROPS= grops
GROTTY= grotty
GUNZIP= gunzip
GVIM= gvim
GZCAT= gzcat
GZEXE= gzexe
GZIP_PROG= gzip
G_PLUSPLUS= g++
H2PH= h2ph
H2XS= h2xs
HASH= hash
HEAD= head
HOSTNAME_PROG= hostname
ICONV= iconv
ID= id
INDENT= indent
INFO= info
JOT= jot
KILL= kill
KSH= ksh
LAST= last
LD= ld
LESSECHO= lessecho
LEX= len
LINK= link
LN= ln
LS= ls
M4= m4
MAKE= make
MAN= man
MKDIR= mkdir
MKFIFO= mkfifo
MKTEMP= mktemp
MV= mv
NANO= nano
NASM= nasm
NEQN= neqn
NICE= nice
NL= nl
NM= nm
NOHUP= nohup
NROFF= nroff
NSLOOKUP= nslookup
OD= od
OPENSSL= openssl
PASTE= paste
PATCH= patch
PATHCHK= pathchk
PAX= pax
PERL= perl
PICO= pico
PR= pr
PRINTENV= printenv
PS= ps
PTAR= ptar
PTARDIFF= ptardiff
PTARGREP= ptargrep
PWD= pwd
PYDOC= pydoc
PYTHON= python
PYTHONW= pythonw
READLINK= readlink
RENICE= renice
RESET= reset
REV= rev
RI= ri
RM= rm
RMDIR= rmdir
RSYNC= rsync
RUBY= ruby
RVIM= rvim
SAY= say
SCP= scp
SCREEN= screen
SCRIPT= script
SDIFF= sdiff
SED= sed
SEQ= seq
SFTP= sftp
SH= sh
SHA1= sha1
SHA= sha
SHAR= shar
SHASUM5_18= shasum5.18
SHASUM= shasum
SIZE= size
SLEEP= sleep
SORT= sort
SSH= ssh
STAT= stat
STRIP= strip
STTY= stty
SUM= sum
SYNC= sync
TABS= tabs
TAIL= tail
TAR= tar
TEE= tee
TEST= test
TFTP= tftp
TIDY= tidy
TIME= time
TOP= top
TOUCH= touch
TPUT= tout
TPUT= tput
TR= tr
TROFF= troff
TRUE= true
TSET= tset
TSORT= tsort
UL= ul
UNAME= uname
UNCOMPRESS= uncompress
UNEXPAND= unexpand
UNIFDEF= unifdef
UNIFDEFALL= unifdefall
UNIQ= uniq
UNITS= units
UNLINK= unlink
UNZIP= unzip
UNZIPSFX= unzipsfx
UPTIME= uptime
UUDECODE= uudecode
UUENCODE= uuencode
UUIDGEN= uuidgen
VI= vi
VIEW= view
VIM= vim
VIMDIFF= vimdiff
W= w
WAIT4PATH= wait4path
WAIT= wait
WC= wc
WGET= wget
WHAT= what
WHATIS= whatis
WHICH= which
WHO= who
WHOAMI= whoami
WHOIS= whois
WRTIE= write
XAR= xar
XARGS= xargs
XATTR= xattr
XXD= xxd
YACC= yacc
YES= yes
ZCAT= zcat
ZCMP= zcmp
ZDIFF= zdiff
ZEGREP= zegrep
ZFGREP= zfgrep
ZFORCE= zforce
ZGREP= zgrep
ZIP= zip
ZIPCLOAK= zipcloak
ZIPGREp= zipgrep
ZIPINFo= zipinfo
ZIPNOTE= zipnote
ZIPSPLIT= zipsplit
ZLESS= zless
ZMORE= zmore
ZNEW= znew
ZPRINT= zprint
ZSH= zsh
# Set X11_LIBDIR to the directory where the X11 library resides
#
kivinen.orig: kivinen.orig.c
$(CC) $(CFLAGS) kivinen.orig.c -o kivinen.orig -lX11 \
-lsocket -lresolv -lnsl
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
imc: imc.c
$(CC) $(CFLAGS) imc.c -o imc
# NOTE: this is the original program that won
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
#
imc.orig: imc.orig.c
$(CC) $(CFLAGS) imc.orig.c -o imc.orig
#X11_INCDIR= /usr/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
lush: lush.c
$(CC) $(CFLAGS) lush.c -o lush
lush.again: lush.c
$(CC) $(CFLAGS) lush.c -o lush.again
$(RM) -f lush.again
# NOTE: this is the original program that won
# Common C compiler warnings to silence
#
lush.orig: lush.orig.c
$(CC) $(CFLAGS) lush.orig.c -o lush.orig
#CSILENCE=
CSILENCE= -Wno-bitwise-op-parentheses -Wno-error -Wno-implicit-function-declaration \
-Wno-parentheses -Wno-pedantic
# NOTE: some systems may need:
# Common C compiler warning flags
#
# $(CC) $(CFLAGS) marangon.c -o marangon -lcurses -ltermcap
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
marangon: marangon.c
$(CC) $(CFLAGS) marangon.c -o marangon -lcurses
#CSTD=
#CSTD= -ansi
CSTD= -std=gnu90
# NOTE: this is the original program that won
# Compiler bit architecture
#
# NOTE: some systems may need:
# Some entries require 32-bitness:
# ARCH= -m32
#
# $(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses -ltermcap
# Some entries require 64-bitness:
# ARCH= -m64
#
marangon.orig: marangon.orig.c
$(CC) $(CFLAGS) marangon.orig.c -o marangon.orig -lcurses
nathan: nathan.c
$(CC) $(CFLAGS) nathan.c -o nathan
# NOTE: this is the original program that won
# By default we assume nothing:
#
nathan.orig: nathan.orig.c
$(CC) $(CFLAGS) nathan.orig.c -o nathan.orig
ARCH=
vern: vern.tmp.c
$(CC) $(CFLAGS) vern.tmp.c -o vern
vern.tmp.c: vern.c
$(RM) -f vern.tmp.c
$(SED) <vern.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.tmp.c
# NOTE: this is the original program that won
# Defines that are needed to compile
#
vern.orig: vern.orig.tmp.c
$(CC) $(CFLAGS) vern.orig.tmp.c -o vern.orig
CDEFINE=
#CDEFINE= -DIOCCC
vern.orig.tmp.c: vern.orig.c
$(RM) -f vern.orig.tmp.c
$(SED) <vern.orig.c 's/{ /(/g;s/} /)/g;s/; /#define /' | \
$(SED) 's/} /=/g;s/{ /i/g' >vern.orig.tmp.c
westley: westley.c
$(CC) $(CFLAGS) westley.c -o westley
# alternate names for selected entries
# Include files that are needed to compile
#
adgrep: adrian
$(RM) -f adgrep
$(LN) adrian adgrep
am: ant
$(RM) -f am
$(LN) ant am
babble: buzzard.1
$(RM) -f babble
$(LN) buzzard.1 babble
first: buzzard.2
$(RM) -f first
$(LN) buzzard.2 first
ag: gson
$(RM) -f ag
$(LN) gson ag
whereami: westley
$(RM) -f whereami
$(LN) westley whereami
CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers or this entry make break
# under those buggy optimizers and thus you may not want anything.
# Reasonable compilers will allow for -O3.
#
#OPT=
#OPT= -O
#OPT= -O1
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-poison-system-directories
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= westley
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: data ${TARGET}
@${TRUE}
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
@echo "NOTE: This entry may not compile when using modern compilers."
${CC} ${CFLAGS} $< -o $@ ${LIBS}
whereami: ${PROG}
${RM} -f $@
${LN} $< $@
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
$(RM) -f *.o a.out core
$(RM) -f vern.tmp.c lush.again babble.cppcb vern.orig.tmp.c
$(RM) -f ad.temp adwc.c adbasename.c adecho.c adhead.c adsleep.c
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -f whereami
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
am_clobber: clean am
$(RM) -f am.safe
$(CP) am am.safe
$(RM) -f $(WINNERS) a.out
$(RM) -f $(ALT_NAMES)
$(RM) -f adwc adbasename adecho adhead adsleep
$(RM) -f adrian.orig lush.orig nathan.orig buzzard.2.orig
$(RM) -f kivinen.orig imc.orig albert.orig marangon.orig vern.orig
$(CP) am.safe am
$(RM) -f am.safe
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
nuke: clobber
@true
# you may be able to misunderstand the source by reading indent.c
#
indent.c: ${PROG}.c
@if which "${GINDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${GINDENT} < $< > $@"; \
${GINDENT} < $< > $@; \
elif which "${INDENT}" >/dev/null 2>&1; then \
echo ${RM} -f $@; \
${RM} -f $@; \
echo "${INDENT} < $< > $@"; \
${INDENT} < $< > $@; \
else \
echo "no intent tool found, ident $< yourself, sorry"; \
echo "exit 1"; \
exit 1; \
fi
install: all
cat $(WINNERS) > /dev/null
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo 'What? Make it yourself.'; \
exit 1; \
fi
# Understand the history of the Homebrew Computer Club
# as well as the West Coast Computer Faire and
# you might be confused different. :-)
#
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v6; \
else \
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
fi
@echo "A $@ helps ${MAKE} the elements that help form planets"
@${TRUE}
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
sleep 2; \
echo "Wrong! Do it again!"; \
fi
@${TRUE}
magic: deep_magic
@-if [ -r .code_anal ]; then \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "If you don't eat yer meat, you can't have any pudding!"; \
echo "How can you have any pudding if you don't eat yer meat?!"; \
fi
@${TRUE}
# The IOCCC resident astronomer states
#
charon: magic
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore IAU, $@ is a planet"
pluto: charon
${MAKE} charon
@echo "$@ is a dwarf planet"
@echo "dwarf is a type of planet"
@echo "therefore, $@ is a planet"
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
+14 -6
View File
@@ -1,4 +1,4 @@
Best Small Program:
# Best Small Program:
Brian Westley (aka Merlyn LeRoy)
Digi International
@@ -6,23 +6,31 @@ Best Small Program:
St. Paul, MN 55104
USA
## To build:
Judges' comments:
make all
NOTE: This entry may not compile when using modern compilers.
### To run
If lost:
make whereami
Then run:
whereami lat long
./whereami lat long
## Judges' comments
Where lat and long correspond to your latitude and longitude.
To find the approximate place where this entry was judged, type:
whereami 37 -122 (- means west of meridian)
./whereami 37 -122 (- means west of meridian)
Selected notes from the author:
## Author's comments
Run the program with your latitude & longitude as integer
arguments; it will produce a map made up of '!' with the given