Stop Microsoft

Miscellaneous => Programming & Networking => Topic started by: voidmain on 20 July 2002, 19:54

Title: An early Christmas present for you...
Post by: voidmain on 20 July 2002, 19:54
Compile this:

Code: [Select]
Title: An early Christmas present for you...
Post by: choasmaster on 20 July 2002, 21:15
i don't compile things unless i know exactly what they do, i like my system as it is and i don't want to do anything that would hurt it. besides, if its in my power, i only compile code that has good explaination for what it is doing.
Title: An early Christmas present for you...
Post by: voidmain on 21 July 2002, 03:03
Heh heh.. well you don't have to worry about this one.  You won't believe what it does when you compile and run it.  Besides, can't you read the source?  (http://smile.gif)   This is actually an example of an entry in the obfuscated code contest.  I ran across it many years ago and it's still my favorite.  It has to do with Christmas...  Besides, if you compile and run it as a normal user in Linux what can it do?  Again, I only mess with Windows users, not Linux users so this one is safe.
Title: An early Christmas present for you...
Post by: ahri on 21 July 2002, 05:28
how do i compile it?

$gcc filename.extension?
Title: An early Christmas present for you...
Post by: voidmain on 21 July 2002, 07:39
Just copy/paste the quoted code into a file with a *.c extension.  Then "gcc filename.c" which will create a program called "a.out".  To run it type "./a.out", actually you might want to pipe it through "more" like this:

./a.out | more

[ July 20, 2002: Message edited by: VoidMain ]

Title: An early Christmas present for you...
Post by: choasmaster on 21 July 2002, 13:16
dude, it won't like compile on my system
 [choasforages@choasnet_v7 choasforages]$ gcc christmas.c
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start':
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main'
/tmp/ccoesqKi.o: In function `n':
/tmp/ccoesqKi.o(.text+0x23): undefined reference to `main'
/tmp/ccoesqKi.o(.text+0x3c): undefined reference to `main'
/tmp/ccoesqKi.o(.text+0x4e): undefined reference to `main'
/tmp/ccoesqKi.o(.text+0x6c): undefined reference to `main'
/tmp/ccoesqKi.o(.text+0x83): more undefined references to `main' follow
collect2: ld returned 1 exit status
Title: An early Christmas present for you...
Post by: badkarma on 21 July 2002, 17:40
lol ... looks like you visited http://www.ioccc.org (http://www.ioccc.org) .... great stuff there
Title: An early Christmas present for you...
Post by: voidmain on 21 July 2002, 23:06
quote:
Originally posted by choasmaster:
dude, it won't like compile on my system



Then you must not have copy/pasted it properly. I copy/pasted it into a file (and removed the leading white space before each line that somehow appeared in "vi" where I pasted it to).  It compiled without a single error or warning message.  In case you were wondering what the output of the code is, it's:

Code: [Select]
Title: An early Christmas present for you...
Post by: choasmaster on 23 July 2002, 13:07
im stupid, i used emacs on FreeBSD and entered and it compiled, one question HOW, and WHY, i know is an obfustaction/*i can't spell*/ contest, but could you imagine maintaing that kinda code????
Title: An early Christmas present for you...
Post by: badkarma on 23 July 2002, 13:09
I think you would be in the looney house after a few months .... lol
Title: An early Christmas present for you...
Post by: choasmaster on 23 July 2002, 13:09
after i though about it, it wouldn't be to significgane of a c++ prog either, written in NORMAL c++
Title: An early Christmas present for you...
Post by: voidmain on 23 July 2002, 20:01
Well, this code was the 1988 ioccc winner (phillipps.c) which you can find here:

http://www0.us.ioccc.org/years.html (http://www0.us.ioccc.org/years.html)

An interesting article and disection of the code can be found here:

http://www.go2net.com/internet/deep/1997/01/08/body.html (http://www.go2net.com/internet/deep/1997/01/08/body.html)

About 8 years ago I remember seeing a much better disection of the code where it was properly indented out and translated into more appropriate C code. Still it was very difficult to understand but it was a good article. I can't seem to find it now though.

All I have to say is the guys who wrote it were genious, along with the other winners of the contest.