Author Topic: An early Christmas present for you...  (Read 1630 times)

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
An early Christmas present for you...
« on: 20 July 2002, 19:54 »
Compile this:

Code: [Select]
Someone please remove this account. Thanks...

choasmaster

  • Member
  • **
  • Posts: 199
  • Kudos: 0
An early Christmas present for you...
« Reply #1 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.
id rather be on fire then use windoze

x86, a hack on a hack of a hack
alpha, the compaqed way
ppc, the fruity way
mips, the graphical way
m68k, the NeXT way
sparc, the reliable way


voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
An early Christmas present for you...
« Reply #2 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?     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.
Someone please remove this account. Thanks...

ahri

  • Member
  • **
  • Posts: 50
  • Kudos: 0
An early Christmas present for you...
« Reply #3 on: 21 July 2002, 05:28 »
how do i compile it?

$gcc filename.extension?

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
An early Christmas present for you...
« Reply #4 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 ]

Someone please remove this account. Thanks...

choasmaster

  • Member
  • **
  • Posts: 199
  • Kudos: 0
An early Christmas present for you...
« Reply #5 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
id rather be on fire then use windoze

x86, a hack on a hack of a hack
alpha, the compaqed way
ppc, the fruity way
mips, the graphical way
m68k, the NeXT way
sparc, the reliable way


badkarma

  • VIP
  • Member
  • ***
  • Posts: 497
  • Kudos: 0
An early Christmas present for you...
« Reply #6 on: 21 July 2002, 17:40 »
lol ... looks like you visited http://www.ioccc.org .... great stuff there
If you can't learn to do something well, learn to enjoy doing it poorly.

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
An early Christmas present for you...
« Reply #7 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]
Someone please remove this account. Thanks...

choasmaster

  • Member
  • **
  • Posts: 199
  • Kudos: 0
An early Christmas present for you...
« Reply #8 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????
id rather be on fire then use windoze

x86, a hack on a hack of a hack
alpha, the compaqed way
ppc, the fruity way
mips, the graphical way
m68k, the NeXT way
sparc, the reliable way


badkarma

  • VIP
  • Member
  • ***
  • Posts: 497
  • Kudos: 0
An early Christmas present for you...
« Reply #9 on: 23 July 2002, 13:09 »
I think you would be in the looney house after a few months .... lol
If you can't learn to do something well, learn to enjoy doing it poorly.

choasmaster

  • Member
  • **
  • Posts: 199
  • Kudos: 0
An early Christmas present for you...
« Reply #10 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++
id rather be on fire then use windoze

x86, a hack on a hack of a hack
alpha, the compaqed way
ppc, the fruity way
mips, the graphical way
m68k, the NeXT way
sparc, the reliable way


voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
An early Christmas present for you...
« Reply #11 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

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

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.
Someone please remove this account. Thanks...