Merge pull request #179 from xexyl/1988-spinellis

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-03-27 11:18:32 -07:00
commit c050380361
4 files changed
+36 -15

No files matched your search

+1
View File
@@ -1,2 +1,3 @@
prog.c prog.c
spinellis spinellis
spinellis.alt
+6 -2
View File
@@ -111,8 +111,8 @@ OBJ= ${PROG}.o
DATA= spinellis.data DATA= spinellis.data
TARGET= ${PROG} TARGET= ${PROG}
# #
ALT_OBJ= ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ALT_TARGET= ${PROG}.alt
################# #################
@@ -135,6 +135,10 @@ ${PROG}: ${PROG}.c
alt: data ${ALT_TARGET} alt: data ${ALT_TARGET}
@${TRUE} @${TRUE}
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} -Wno-implicit-function-declaration $< -o $@ ${LIBS}
@while read -r r; do echo $$r ; done | ./${PROG}.alt
# data files # data files
# #
data: ${DATA} data: ${DATA}
+28 -13
View File
@@ -10,11 +10,11 @@
make all make all
and then type a C program into followed by EOF two times (`^D^D`). and then type a C program into followed by EOF (usually `^D`, ctrl-d).
NOTE: this entry will not compile with clang. Also be advised that gcc in macOS
is actually clang so this will not work even with the default compiler in macOS.
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) made a version (also
one-line) for clang. See the alternative code section below for how to use.
Thank you Cody for your assistance!
## Try: ## Try:
@@ -24,7 +24,6 @@ is actually clang so this will not work even with the default compiler in macOS.
printf("Hello world\n"); printf("Hello world\n");
} }
^D ^D
^D
./spinellis ./spinellis
make clobber all make clobber all
@@ -35,23 +34,39 @@ is actually clang so this will not work even with the default compiler in macOS.
printf("%d\n", i); printf("%d\n", i);
} }
^D ^D
./spinellis
## Alternative code:
For clang try the alt code like:
make clobber alt
#include <stdio.h>
main()
{
puts("Hello world\n");
}
^D ^D
./spinellis ./spinellis
## Judges' comments
## Judges' comments:
We enjoyed this entry this year, however in the future programs must be able to We enjoyed this entry this year, however in the future programs must be able to
be compiled from within a Makefile without the need of human intervention. be compiled from within a Makefile without the need of human intervention.
The author originally wrote: Meanwhile Cody was twisted enough to point out (though to be fair he felt sick
doing this) that with a slight modification this entry can be C++ instead. We don't
thank him for this ghastly point! :-)
This program can be configured to do almost everything. ## Author's comments:
The configuration is done during compile time by typing
in, C code, that one would like the program to perform. This program can be configured to do almost everything. The configuration is
A trivial example is given in the `how to compile' section done during compile time by typing in, C code, that one would like the program
but the possibilities are clearly limited only by your to perform. A trivial example is given in the `how to compile' section but the
imagination and programming skills. possibilities are clearly limited only by your imagination and programming
skills.
## Copyright and CC BY-SA 4.0 License: ## Copyright and CC BY-SA 4.0 License:
+1
View File
@@ -0,0 +1 @@
main(){system("gcc -x c - -o spinellis");}