daves@ios.UUCP (David B. Schnepper) (08/22/84)
Here's another repeater, much shorter than the 101 record that I've seen so far. I consider this one a cheater, as it is possible to break it. --------------cut line--------------- main(){char b[80],i=open(__FILE__,0);read(i,b,80);printf(b);} --------------end cut---------------- This program reads in its source and writes it. Will fail if the source is not present when run. Also assumes your cpp has the "__FILE__" construct (is that standard?). It DOES pass the cc file.c a.out >tmp cmp tmp file.c test. The program can be made shorter if we assume the file name is "y.c" or somesuch. (Replace __FILE__). I **don't** consider this a proper entry in the "shortest c" contest, as the executable will not always reproduce its source. Dave Schnepper ios!daves
adm@cbneb.UUCP (08/27/84)
#R:ios:-16200:cbnap:25300001:000:252 cbnap!whp Aug 27 11:16:00 1984 Sorry, but I disagree; it's not a cheat if it legal C and it works. So what if it can be "broken"? There are few C programs that *can't* be broken! Anyway, here's a 46 byte version for you to ponder: main(){char*x;x=__FILE__;execlp("cat",x,x,0);}