X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=direct%2Ftimothy_tests%2Flinux_tests%2Flib.c;h=5f439040e3ee891677bec7cfc7168d759a80e138;hb=a78bce6f4a7042fa153ab32d2bb263ecf7d27b66;hp=c5adae72e2d2d71d4e1064684aff17cb86048f23;hpb=9c35dd427cec7ce855ed5816f12b241d2d5f8ba2;p=yaffs2.git diff --git a/direct/timothy_tests/linux_tests/lib.c b/direct/timothy_tests/linux_tests/lib.c index c5adae7..5f43904 100644 --- a/direct/timothy_tests/linux_tests/lib.c +++ b/direct/timothy_tests/linux_tests/lib.c @@ -14,13 +14,26 @@ #include "lib.h" static char message[200]; static int PRINT_LEVEL = 3; +static int exit_on_error_val =1; +char string[FILE_NAME_LENGTH+1]; + + +int get_exit_on_error(void) +{ + return exit_on_error_val; +} + +void set_exit_on_error(int val) +{ + exit_on_error_val=val; +} node * linked_list_add_node(int pos,node *head_node) { node *new_node=NULL; if (pos==HEAD){ new_node=malloc(sizeof(node)); - memset(new_node, NULL, sizeof(node)); + memset(new_node, 0, sizeof(node)); new_node->string=NULL; new_node->next=head_node; return new_node; @@ -53,7 +66,7 @@ int delete_linked_list(node *head_node) char * generate_random_string(unsigned int length) { - char string[length+1]; + unsigned int x; for (x=0;x<(length-1);x++) { @@ -62,6 +75,7 @@ char * generate_random_string(unsigned int length) string[x]='\0'; return string; } + void set_print_level(int new_level) { PRINT_LEVEL=new_level; @@ -73,12 +87,12 @@ int get_print_level(void) void print_message(char print_level,char *message) { if (print_level <= PRINT_LEVEL){ - printf(message); + printf("%s",message); } } -unsigned int random_int(void) +int random_int(void) { - return (random()%4294967295); + return (random()%1000000); } void check_function(int output)