Make 1987/heckbert look more like original

As index(3) in some systems requires strings.h and since it's identical
to strchr and since the judges said in System V machines (not that we
should have to worry about those these days) they had to define index to
strchr I have done this in the Makefile.

Also the #define _ define was restored even though it's not used in
order to make it look closer to the original entry. This has to be done
in other files as well, as I think on it.

Format and typo checked README.md.
This commit is contained in:
Cody Boone Ferguson committed 2023-10-17 12:02:13 -07:00
1 parent a2a5bcd507
commit 12e547c1fa
5 files changed
+26 -8

No files matched your search

+1
View File
@@ -7,3 +7,4 @@ ph
ph.c
heckbert.orig
prog.orig
foo.md
+1 -1
View File
@@ -58,7 +58,7 @@ ARCH=
# Defines that are needed to compile
#
CDEFINE=
CDEFINE= -Dindex=strchr
# Include files that are needed to compile
#
+12 -7
View File
@@ -1,7 +1,6 @@
# Best Obfuscator of Programs
Paul Heckbert
Pixar
Paul Heckbert<br>
## To build:
@@ -12,15 +11,20 @@ make all
On System V systems, we had to compile with `-Dindex=strchr`.
To compile on a 16 bit machine, change 300000 to 30000.
## To run:
```sh
./heckbert col < file
```
where col is the number of columns to fold at and file is the file to fold.
## Try:
```sh
./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:
@@ -41,9 +45,10 @@ 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.
The judges used this program to fold up<br>
very long lines which the BSD fold(1)<br>
was unable to process. This program has<br>
been added to the contest tool chest.
## Author's remarks:
+1
View File
@@ -1,5 +1,6 @@
#include <ctype.h>
#include <stdio.h>
#define _ define
#define A putchar
#define B return
#define C index
+11
View File
@@ -273,6 +273,17 @@ If you'd like to see the difference between the version that requires
git diff 82cbf069a781d64802fc59b36778c0b02be4043e..a74abb69b7e9b87e305b529941bf46f97ffff341 1986/wall/wall.c
```
## [1987/heckbert](1987/heckbert/heckbert.c) ([README.md](1987/heckbert/README.md))
Cody made this look more like the original entry by restoring the `#define` of
`define`. It's not used but it now looks closer to the original.
Also because `index(3)` is deprecated and in some systems requires the inclusion
of `strings.h` and because it's identical in use to `strchr(3)` (and we noted
that for System V we had to do this) Cody added to the Makefile
`-Dindex=strchr`.
## [1987/wall](1987/wall/wall.c) ([README.md](1987/wall/README.md]))
Cody made this safer by using `fgets()` instead of `gets()`. This prevents an