This is the first "blog" of any kind I've ever had, so it's probably not the greatest...
Just a little snippet about me:
I'd like to consider myself relatively tech-savvy; obviously I use Linux (Arch to be precise; K.I.S.S. FTW), and I enjoy learning new things about computers in general (both software and hardware-related).
This blog is mostly just for whenever I feel like telling the world about my experiences with computers/Linux (or just life in general), or just posting for the hell of it.
Just a little snippet about me:
I'd like to consider myself relatively tech-savvy; obviously I use Linux (Arch to be precise; K.I.S.S. FTW), and I enjoy learning new things about computers in general (both software and hardware-related).
This blog is mostly just for whenever I feel like telling the world about my experiences with computers/Linux (or just life in general), or just posting for the hell of it.
no
Posted 03-14-2011 at 10:52 PM by MrCode
Updated 04-02-2011 at 03:28 PM by MrCode (Major program revision)
Updated 04-02-2011 at 03:28 PM by MrCode (Major program revision)
Tags programming
Code:
#include <stdio.h> #include <string.h> #include <malloc.h> int main(int argc,char** argv) { char* str = malloc(1); if(argc >= 2) { int i; for(i = 1; i < argc; i++) { strcat(str," "); strcat(str,argv[i]); } int len = strlen(str); while(1) { while(len--) putchar(str[len]); putchar('\n'); len = strlen(str); } } else { while(1) printf("n\n"); } return 0; }
Code:
[mrcode@lappy486 ~]$ no The quick brown fox jumps over the lazy dog. hT .god yzal eht revo spmuj xof nworb kciuq ehT .god yzal eht revo spmuj xof nworb kciuq ehT .god yzal eht revo spmuj xof nworb kciuq ehT .god yzal eht revo spmuj xof nworb kciuq ehT .god yzal eht revo spmuj xof nworb kciuq ehT .god yzal eht revo spmuj xof nworb kciuq ehT ...
Code:
gcc -Wall -Werror -pedantic -std=c99 -o no no.c
EDIT: Argh, I was right about one thing: it definitely terminates on SIGSEGV (segfaults when run without params).
EDIT of EDIT: The program has been revised...the first if clause was redundant, and the goto has been removed. Output has also been edited (turns out it ain't perfect ).
Total Comments 0