diff --git a/1988/litmaath/.gitignore b/1988/litmaath/.gitignore index 5722bebf5..ef2cc4b0f 100644 --- a/1988/litmaath/.gitignore +++ b/1988/litmaath/.gitignore @@ -1 +1,2 @@ litmaath +litmaath.alt diff --git a/1988/litmaath/Makefile b/1988/litmaath/Makefile index 08b070b99..370e7cbc0 100644 --- a/1988/litmaath/Makefile +++ b/1988/litmaath/Makefile @@ -111,8 +111,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# diff --git a/1988/litmaath/README.md b/1988/litmaath/README.md index e776052d5..0e801e4ca 100644 --- a/1988/litmaath/README.md +++ b/1988/litmaath/README.md @@ -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: diff --git a/1988/litmaath/litmaath.alt.c b/1988/litmaath/litmaath.alt.c new file mode 100644 index 000000000..a08e45ea2 --- /dev/null +++ b/1988/litmaath/litmaath.alt.c @@ -0,0 +1,16 @@ +#include +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); + + ; +}