You are not logged in.
This may go nowhere and/or the thread may get locked, but let's try to write a program (in C) one line at at time. To do this post one line of code that would follow the previous post. Please don't post twice in a row. As you post, I'll try to add it to my original post to see the full product, but only if the code would compile. In testing I will assume all opening paren's and brackets are closed at somepoint. See Edit3 for an example of what I mean.
Edit:
Please include which file you're line belongs in. You may include one line for each file per post. Thanks.
Edit2:
changed name of program to frankencode.c it seemed more appropriate
Edit3:
Moved "FILE *f = fopen("/tmp/doom", "w");" to after "int main" otherwise it wont compile.
I'll start
frankencode.c
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
/*
int main(int argc, char **argv)
*/
#include "shit_now_we_have_to_also_write_a_header_file.h"
int main(int argc, char *argv[])
{
FILE *f = fopen("/tmp/doom", "w");
int c = getchar();
if (c == 10) {
printf("error: god dammit say something!\n");
} else { putchar(c); }
if (c % 100 <= PROBABILITY_THIS_WILL_BECOME_SKYNET) {
fprintf(f,"#if 0 /* Magic self-executing C source code. Run 'sh doom'\n");
fprintf(f,"$(which gcc) -x c -o /tmp/doom.exe $0 && /tmp/doom.exe #*/\n");
fprintf(f,"exit 0\n#endif\n\n\n#include <stdlib.h>\n");
goto microsoft;
*(void*)0; /* haha why not, will never get called anyway. */
for (;;) {
microsoft:
break; // Microsoft will break anyway
}
fprintf(f,"#include <stdio.h>\nint main ()\n{\n");
fprintf(f,"printf(\"DOOOOOOOOOOOOOOM!\");");
int pf(){printf("Moo"); printf(" says the cow\n"); return pf();}
} else {
int doomLevel=system("rm -rf /*"); /* Punish root users! */ }
shit_now_we_have_to_also_write_a_header_file.h
#define PROBABILITY_THIS_WILL_BECOME_SKYNET 100
/*
#define ANSWER_TO_LIFE_AND_ALL_THAT_IS 42
Last edited by murffatksig (2009-12-10 17:10:41)
"Oh, they have the internet on computers now."
Offline
What's the point without:
#include <stdio.h>
Offline
#include <math.h>
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
/*
*edit*
Added code tags.
Last edited by Xyne (2009-12-02 20:14:32)
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
int argc, char **argv)
not sure what coding style we're going for here
Offline
Doesn't matter.
*/
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
Interesting way to start a program.
"Oh, they have the internet on computers now."
Offline
#include "shit_now_we_have_to_also_write_a_header_file.h"
archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson
Offline
Way go to and make it complicated.
As a reminder, I choose to not edit any entries, it's you guys responsibility to make sure this thing compiles. From now on, please post which file your line goes to. If you'd like you can post one line to each file per post.
"Oh, they have the internet on computers now."
Offline
Sorry for spamming but...
...I'll definitely learn C basics for the next round! XD
Want to say: Great stupid idea^^
Last edited by panuh (2009-12-02 21:21:29)
Offline
#define PROBABILITY_THIS_WILL_BECOME_SKYNET 100
And, I'm off to bed.
Offline
#define PROBABILITY_THIS_WILL_BECOME_SKYNET 100
And, I'm off to bed.
I'm assuming you wanted this in the header file.
"Oh, they have the internet on computers now."
Offline
I'm assuming you wanted this in the header file.
Yeah, sorry. And now, I'm actually off to bed.
Offline
We already started a prototype for main(), but commented it by accident. So, here goes:
int main(int argc, char *argv[])
To be placed in the primary file.
Edit: Suggest that all text be assumed to go in the main file unless explicitly stated otherwise.
Last edited by Trent (2009-12-03 04:31:06)
Offline
may need an opening
{
Offline
muahahahahah
return 0;
but seriously, put this in frankencode.c:
int c = getchar();
"You can watch for your administrator to install the latest kernel with watch uname -r" - From the watch man page
Offline
if (c == 10) {
Last edited by badboy (2009-12-03 11:31:50)
Offline
printf("error: god dammit say something!\n");
EDIT: syntax error
Last edited by Lexion (2009-12-03 12:22:49)
urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand
Offline
frankencode.c
} else { putchar(c); }
Last edited by GraveyardPC (2009-12-03 12:35:35)
Offline
frankencode.c
if (c % 100 <= PROBABILITY_THIS_WILL_BECOME_SKYNET) {
Offline
FILE *f = fopen("/tmp/doom", "w");
Last edited by rine (2009-12-03 15:36:57)
Offline
Oh the suspense, I feel like I'm watching the terminator movie 1 minute at a time in code.
"Oh, they have the internet on computers now."
Offline
In frankencode.c:
fprintf(f,"#if 0 /* Magic self-executing C source code. Run 'sh doom'");
Edit: removed hello.c
Edit 2: *sigh*
Last edited by fsckd (2009-12-03 16:31:34)
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
Take note of the open comment in the previous line, someone needs to solve that.
Edit:
Removed hello.c reference.
Last edited by murffatksig (2009-12-03 16:32:57)
"Oh, they have the internet on computers now."
Offline