X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Ftimothy_tests%2Fmirror_tests%2Flib.c;h=0d1443050763c4c2de188c00e65b79dfbd1c9581;hp=4b9ebd67db3f1c9224c4d6be865547b56b88ac09;hb=df369209e1ee1d05eba9527b1e6447e8e78d0988;hpb=137f935f6d622bffdef2fece0c5194e85f5174e9 diff --git a/direct/timothy_tests/mirror_tests/lib.c b/direct/timothy_tests/mirror_tests/lib.c index 4b9ebd6..0d14430 100644 --- a/direct/timothy_tests/mirror_tests/lib.c +++ b/direct/timothy_tests/mirror_tests/lib.c @@ -37,6 +37,28 @@ void display_error(void) { } + +void generate_random_string(char *ptr,int length_of_str){ + unsigned int x; + unsigned int length=((rand() %length_of_str)+1); /*creates a int with the number of charecters been between 1 and 51*/ + char letter='\0'; + strcpy(ptr,""); + //printf("generating string\n"); + //printf("string length is %d\n",length); + for (x=0; x <= (length-2) &&length>2 ; x++) + { + //printf("x=%d\n",x); + /* keep generating a charecter until the charecter is legal*/ + while((letter=='\0' )||(letter=='/')||(letter=='\\')){ + letter=(rand() % 125-59)+58; /*generate a number between 32 and 126 and uses it as a charecter (letter) */ + } + ptr[x]=letter; + //printf("charecter generated is %c\n",ptr[x]); + } + ptr[x+1]='\0'; /*adds NULL charecter to turn it into a string*/ + +} + void join_paths(char *path1,char *path2,char *new_path ) { char message[100];