Quine ~~~~~ The `Jargon File' (well, my GNU Info edition) defines a `quine' as: :quine: /kwi:n/ n. [from the name of the logician Willard van Orman Quine, via Douglas Hofstadter] A program that generates a copy of its own source text as its complete output. Devising the shortest possible quine in some given programming language is a common hackish amusement. Here is one classic quine: ((lambda (x) (list x (list (quote quote) x))) (quote (lambda (x) (list x (list (quote quote) x))))) This one works in LISP or Scheme. It's relatively easy to write quines in other languages such as Postscript which readily handle programs as data; much harder (and thus more challenging!) in languages like C which do not. Here is a classic C quine for ASCII machines: char*f="char*f=%c%s%c;main() {printf(f,34,f,34,10);}%c"; main(){printf(f,34,f,34,10);} For excruciatingly exact quinishness, remove the interior line breaks. Some infamous *note Obfuscated C Contest:: entries have been quines that reproduced in exotic ways. Small quines, like the one above (or the author's strictly conformant ANSI C version) have been around for ages. However, I'm not aware of any programs which provide quine support for arbitrary pieces of software. The `quine' program is intended to remedy this omission. Building the package is easy. Run the `configure' script, and then say `make'. This then gowes through the rather convoluted build process automatically, and produces a binary `quine'. As an example of `quine's ability to enquine programs, it is (of course) a quine itself. To demonstrate this, run the command ./quine --quine It should (very quickly) create a `quine' source distribution in the current directory. Conferring quineishness upon other programs isn't hard. You require the `quine.h' file from the source distribution (`make install' will install it in some standard place for you), and the `quine' binary. The `quine' program works by writing a file describing the contents of your source files, and the code necessary to recreate them. It reads the names of your sources from standard input and writes (by default) to `qqout.c'; thus an incantation like find . -type f -print | quine should be sufficient to build the `qqout.c' file. Then all you need to do to your code to output the source code is call `qq_create' to build a distribution directory, or `qq_dump(STREAM)' to dump the source code to the output stream STREAM. Easy, no? The author's own preference for creating source distributions is to create a distribution directory (with `make distdir') and use `find' within that to build the `qqout.c' file. See the `Makefile.am' to see how this was achieved for `quine' itself. (Note that `quine' has to use itself to build its `qqout.c' file, which makes the whole procedure a little more interesting.) I'll admit it: this isn't what you'd call a `useful' program.