Name:
Anonymous
2013-05-22 17:48
My brain is being eaten by worms. My hair is falling out.
Help me. Please help me!
Name:
Anonymous
2013-05-22 20:33
$ echo -n "Advance my anus!" | ./advanced_bb_coad 10
Advance my anus[s][u][s][aa][b][/s][/b][/aa][/u][/s]!
$
And here. Because I hate you, OP, and I want to beat you at your own game.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE(x) (sizeof (x) / sizeof ((x)[0]))
const static char *tags[] = {"sub", "sup", "o", "i", "u", "s", "aa", "b", "m",
"spoiler"};
int main(int argc, char **argv)
{
int max_tags = 0, i, *trace, tidx;
char c;
if (argc != 2) {
fprintf(stderr, "Expected exactly one argument - a number greater than 0\n");
return -1;
}
srand(time(NULL));
max_tags = strtod(argv[1], NULL) + 1;
if (max_tags < 1)
max_tags = 1;
trace = malloc(max_tags * sizeof(int));
while (EOF != (c = getchar())) {
if (c == '\n') {
putchar('\n');
} else {
tidx = 0;
for (i = rand() % max_tags; i--; )
printf("[%s]", tags[(trace[tidx++] = rand() % SIZE(tags))]);
putchar(c);
while (tidx > 0)
printf("[/%s]", tags[trace[--tidx]]);
}
}
free(trace);
return 0;
}