Xref: utzoo comp.misc:5587 comp.lang.c:17086 Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.misc,comp.lang.c Subject: Re: Silly programming problems Message-ID: <2358@buengc.BU.EDU> Date: 21 Mar 89 18:41:23 GMT References: <817@krafla.rhi.hi.is> <2179@fireball.cs.vu.nl> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.misc Organization: Boston Univ. Col. of Eng. Lines: 23 In article <2179@fireball.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: >frisk@rhi.hi.is (Fridrik Skulason) writes: >\ "write a one line C program that produces the source code >\ to itself when run." [...] "the source code to itself" -- that's what it sez. >A cheat. >----------8<----------8<----------8<----------8<----------8<---------- >main(){execlp("cat","",__FILE__,(char*)0);} >----------8<----------8<----------8<----------8<----------8<---------- Not so big a cheat. It seems it really would produce it's own source, rather than just a copy or whatever its buggy little self happens to contain. This way, you are _certain_ that the program is what its source looks like. Except now you have to keep them together forever...but it may be the only answer that fits the spec perfectly. --Blair "Maybe there should be some 'find' and 'diff' action in there, just to be sure..."