Fix 1988/litmaath/README.md + add alt code

There was no 'To build' or 'To run' section.

The alt code is that which the judges suggested to try and understand
the code a bit more. As it was fun output and it seems instructive I
decided to add it as an alt version.

Updated .gitignore.
This commit is contained in:
Cody Boone Ferguson committed 2023-05-27 04:30:19 -07:00
1 parent 864cc7bffb
commit ac949a735d
4 files changed
+47 -6

No files matched your search

+1
View File
@@ -1 +1,2 @@
litmaath
litmaath.alt
+2 -2
View File
@@ -111,8 +111,8 @@ OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
+28 -4
View File
@@ -1,18 +1,42 @@
# Best small program
Maarten Litmaath
Free University (VU) Amsterdam
Department of computer science
Uilenstede 72
1183 AK Amstelveen
The Netherlands
## To build:
```sh
make
```
## To run:
```sh
./litmaath some text
```
There is an alternate version provided. See the Alternate code section below.
## Try:
```sh
./litmaath eschew obfuscation
```
### Alternate code:
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) added the
[litmaath.alt.c](litmaath.alt.c) which we described in our remarks below. To
use:
```sh
make alt
```
Use `litmaath.alt` as you would `litmaath` above.
Thank you Cody!
## Judges' remarks:
+16
View File
@@ -0,0 +1,16 @@
#include <stdio.h>
main(argc, argv)
int argc;
char **argv;
{
while (*argv != argv[1] && (*argv = argv[1]) && (argc = 0) || (*++argv
&& (**argv && ((++argc)[*argv] && (**argv <= argc[*argv] ||
(**argv += argc[*argv] -= **argv = argc[*argv] - **argv)) &&
--argv || putchar(**argv) && ++*argv--) || putchar(10))))
fprintf(stderr,
"argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n",
(long) argv, (long) *argv, *argv && **argv ? **argv : '@',
(long) argv[1], argv[1] && *argv[1] ? *argv[1] : '@', argc);
;
}