From e50b1b2c29602ffb5b815d2a7f46628605514ab6 Mon Sep 17 00:00:00 2001 From: Gerard Wagener Date: Fri, 8 Jan 2010 22:25:24 +0100 Subject: [PATCH] Forgot that the index 0 was reserved --- aha/insult.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/aha/insult.c b/aha/insult.c index ab594ded5f3..9e460a85529 100644 --- a/aha/insult.c +++ b/aha/insult.c @@ -7,20 +7,27 @@ */ #include #include -#define N 4 -char* list[] = {"Fuck you", +#define N 5 + +/* The element 0 is reserved for that insult is not set and if the program is + * started from the shell with no arguments nothing should happen + * atoi(sss) -> 0 + */ +char* list[] = {"", + "Fuck you", "Is that all? I want to do more ...", "Go away", "I love you"}; int main(int argc, char* argv[]){ int idx; - if (argc==2){ - idx=atoi(argv[1]); - if ((idx>=0) && (idx=0) && (idx