diff --git a/1988/spinellis/Makefile b/1988/spinellis/Makefile index f572e9f34..27a2c1bed 100644 --- a/1988/spinellis/Makefile +++ b/1988/spinellis/Makefile @@ -108,7 +108,7 @@ ENTRY= spinellis PROG= ${ENTRY} # OBJ= ${PROG}.o -DATA= spinellis.data +DATA= spinellis.data input.txt input2.txt TARGET= ${PROG} # ALT_OBJ= ${PROG}.alt.o @@ -126,19 +126,22 @@ all: data ${TARGET} love haste waste maker easter_egg sandwich \ supernova deep_magic magic charon pluto -${PROG}: ${PROG}.c +${PROG}: ${PROG}.c input.txt @echo "NOTE: this entry will not compile with some compilers like clang." @echo "NOTE: use make alt for clang." - ${CC} ${CFLAGS} $< -o $@ ${LIBS} + @echo Now run the following command: + ${RM} -f $@ + @echo ${CC} ${CFLAGS} $< -o $@ ${LIBS} '<' input.txt '&&' ./${PROG} # alternative executable # alt: data ${ALT_TARGET} @${TRUE} -${PROG}.alt: ${PROG}.alt.c +${PROG}.alt: ${PROG}.alt.c input.txt ${CC} ${CFLAGS} -Wno-implicit-function-declaration $< -o $@ ${LIBS} - @while read -r r; do echo $$r ; done | ./${PROG}.alt + @echo Now run the following command: + @echo ./${PROG}.alt '<' input.txt '&&' ./${PROG}.alt # data files # diff --git a/1988/spinellis/README.md b/1988/spinellis/README.md index 7d3fcb496..d92fefa1f 100644 --- a/1988/spinellis/README.md +++ b/1988/spinellis/README.md @@ -11,52 +11,31 @@ Mastodon: make all ``` -and then type a C program into followed by EOF (usually `^D`, ctrl-d). - -An alternate version (also one-line) that will work with clang has been -provided. See the Alternate code section below for how to use. - ## Try: ```sh -make clobber all -main() -{ - printf("Hello world\n"); -} -^D -./spinellis - -make clobber all -int main() -{ - int i; - for (i = 0; i < 5; ++i) - printf("%d\n", i); -} -^D -./spinellis +rm -f spinellis ; cc spinellis.c -o spinellis < input.txt && ./spinellis ``` -NOTE: you need to make clobber first for this entry to work right. +and try: + +``` +rm -f spinellis ; cc spinellis.c -o spinellis < input2.txt && ./spinellis +``` ## Alternate code: For clang try the alt code like: ```sh -make clobber alt -#include -main() -{ - puts("Hello world\n"); -} -^D -./spinellis - +cc spinellis.alt.c -o spinellis.alt < input.txt && ./spinellis.alt ``` -NOTE: you need to make clobber first for this entry to work right. +and try: + +``` +cc spinellis.alt.c -o spinellis.alt < input2.txt && ./spinellis.alt +``` ## Judges' remarks: diff --git a/1988/spinellis/input.txt b/1988/spinellis/input.txt new file mode 100644 index 000000000..650dc9b5f --- /dev/null +++ b/1988/spinellis/input.txt @@ -0,0 +1,8 @@ +#include + +int +main(void) +{ + printf("Hello, world!\n"); + return 0; +} diff --git a/1988/spinellis/input2.txt b/1988/spinellis/input2.txt new file mode 100644 index 000000000..8691ddffb --- /dev/null +++ b/1988/spinellis/input2.txt @@ -0,0 +1,11 @@ +#include + +int +main(void) +{ + int i; + for (i = 0; i < 5; ++i) { + printf("%d\n", i); + } + return 0; +} diff --git a/1988/spinellis/spinellis.alt.c b/1988/spinellis/spinellis.alt.c index 2795d4a89..79f6e7633 100644 --- a/1988/spinellis/spinellis.alt.c +++ b/1988/spinellis/spinellis.alt.c @@ -1 +1 @@ -main(){system("gcc -x c - -o spinellis");} +int main(void){system("rm -f spinellis.alt; cc -x c - -o spinellis.alt");return 0;}