yaffs Restructuring timothy_tests folder.
[yaffs2.git] / direct / timothy_tests / dev / error_handler.c
1 /*
2  * YAFFS: Yet another FFS. A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2010 Aleph One Ltd.
5  *   for Toby Churchill Ltd and Brightstar Engineering
6  *
7  * Created by Timothy Manning <timothy@yaffs.net>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13
14 /*
15  * error_handler.c contains code for checking yaffs function calls for errors.
16  */
17 #include "error_handler.h"
18
19 void yaffs_check_for_errors(char output, buffer *message_buffer,char error_message[],char success_message[])
20 {
21         char dummy='0';
22         if (output==-1)
23         {
24                 add_to_buffer(message_buffer, "\nerror##########",MESSAGE_LEVEL_ERROR,PRINT);
25                 add_to_buffer(message_buffer, error_message,MESSAGE_LEVEL_ERROR,PRINT);
26                 add_to_buffer(message_buffer, "error_code: ",MESSAGE_LEVEL_ERROR,PRINT);
27                 if (MESSAGE_LEVEL_ERROR<=DEBUG_LEVEL)   printf("%d\n\n\n",yaffs_get_error());   /*cannot yet add int types to buffer. this is a quick fix*/             
28                 scanf("%c",dummy);
29                 //print_buffer(message_buffer,PRINT_ALL);
30                 
31         }
32         else{
33                 add_to_buffer(message_buffer, success_message,MESSAGE_LEVEL_BASIC_TASKS,PRINT);
34         }
35                 
36 }