diff --git a/1987/heckbert/.gitignore b/1987/heckbert/.gitignore index 86f36dcd0..cb092098f 100644 --- a/1987/heckbert/.gitignore +++ b/1987/heckbert/.gitignore @@ -1,4 +1,7 @@ +bar bar.c +foo +foo.c heckbert ph ph.c diff --git a/1987/heckbert/Makefile b/1987/heckbert/Makefile index 935394a50..22bfccb5c 100644 --- a/1987/heckbert/Makefile +++ b/1987/heckbert/Makefile @@ -179,21 +179,13 @@ ALT_TARGET= ${PROG}.orig all: ${DATA} ${TARGET} @${TRUE} -.PHONY: alt data everything clean clobber nuke dist_clean \ +.PHONY: data everything clean clobber nuke dist_clean \ install build love haste waste make easter_egg \ supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c ${CC} ${CFLAGS} $< -o $@ ${LIBS} -# alternative executable -# -alt: ${DATA} ${ALT_TARGET} - @${TRUE} - -${PROG}.orig: ${PROG}.orig.c - @echo "NOTE: The original source may not compile using modern compilers." - ${CC} ${CFLAGS} $< -o $@ ${LIBS} # data files # diff --git a/1987/heckbert/README.md b/1987/heckbert/README.md index 8042262f9..71024f9d8 100644 --- a/1987/heckbert/README.md +++ b/1987/heckbert/README.md @@ -7,23 +7,39 @@ Pixar make all -NOTE: The original entry may be built with "make alt". + +On System V systems, we had to compile with `-Dindex=strchr`. +To compile on a 16 bit machine, change 300000 to 30000. + ## Judges' comments: - ### Try: - ph 40 < ph.c > foo.c; cc foo.c -o ph - ph 20 < a_C_prog.c > bar.c; cc bar.c + + ./heckbert 40 < heckbert.c > ph.c; make ph + ./ph 21 < heckbert.c > bar.c; make bar + # or more generally fold some other file at a positive column: + ./ph col < file + +Ask yourself what happens to `foo.md` if you try: + + ./ph 40 < README.md > foo.md + +Folding at the wrong length may be equivalent to a "Spindle or Mutilate" operation. For example: + + ./heckbert 40 < heckbert.c > ph.c ; make ph ; ./ph 20 < heckbert.c > bar.c ; make bar + + +Try not to +[Fold, Spindle or Mutilate](https://repository.library.brown.edu/studio/item/bdr:788264/PDF/) +files. :-) + The judges used this program to fold up very long lines which the BSD fold(1) was unable to process. This program has been added to the contest tool chest. -On System V systems, compile with: `-Dindex=strchr` -To compile on a 16 bit machine, change 300000's to 30000. -NOTE: This entry requires a non-standard K&R C compiler to compile. Copyright (c) 1987, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1987/heckbert/heckbert.orig.c b/1987/heckbert/heckbert.orig.c deleted file mode 100644 index ccdb7e0b7..000000000 --- a/1987/heckbert/heckbert.orig.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#define _ define -#_ A putchar -#_ B return -#_ C index -char*r,c[300001],*d=">=<=!===||&&->++-->><<",*i,*l,*j,*m,*k,*n,*h,*y;e,u=1,v,w, -f=1,p,s,x;main(a,b)char**b;{p=a>1?atoi(b[1]):79;r=c+read(0,j=l=i=c,300000);v=g( -j,&m);for(k=m;v!=2;j=k,m=n,v=w,k=m){w=g(k,&n);if(v==1&&m-j==1&&*j==35)e&&A(10), -e=f=0;if(!f&&v==3&&(char*)C(j,10)2&&(u||w)&&(f||u)&& -(l-i>1||*i!=61||n-k>1||!C("-*&",*k)))continue;else if(v==3)if(f&&e+1+n-k>p&&e)A -(10),e=0;else A(32),e++;else{if(f&&e+m-j>p&&e)A(10),e=0;e+=m-j;k=j;while(k=r)B*m=j,2;s=isdigit(*j)|| -*j==46&&isdigit(j[1]);for(h=j;hj)B*m=h,0;x=1;for(h=j;hj)h--,x=3;if(*j==34||*j==39)for(h=j+1;h