Added simple WCSA
[SXSI/TextCollection.git] / swcsa / utils / errors.c
1
2 /*////////////////
3 //Error handling//
4 ////////////////*/
5 /*
6 char *error_index(int e){
7   switch(e) {
8     case 0:  return "No error"; break;
9     case 1:  return "Out of memory"; break;
10     case 2:  return "The text must end with a \\0"; break;
11     case 5:  return "You can't free the text if you don't copy it"; break;
12     case 20: return "Cannot create files"; break;
13     case 21: return "Error writing the index"; break;
14     case 22: return "Error writing the index"; break;
15     case 23: return "Cannot open index; break";
16     case 24: return "Cannot open text; break";
17     case 25: return "Error reading the index"; break;
18     case 26: return "Error reading the index"; break;
19     case 27: return "Error reading the text"; break;
20     case 28: return "Error reading the text"; break;
21     case 99: return "Not implemented"; break;
22     default: return "Unknown error";
23   }
24 }
25 */
26
27
28 char *error_index(int e){
29 static char err[100];
30   switch(e) {
31     case 0:  strcpy(err, "No error"); break;
32     case 1:  strcpy(err, "Out of memory"); break;
33     case 2:  strcpy(err, "The text must end with a \\0"); break;
34     case 5:  strcpy(err, "You can't free the text if you don't copy it"); break;
35     case 20: strcpy(err, "Cannot create files"); break;
36     case 21: strcpy(err, "Error writing the index"); break;
37     case 22: strcpy(err, "Error writing the index"); break;
38     case 23: strcpy(err, "Cannot open index; break");
39     case 24: strcpy(err, "Cannot open text; break");
40     case 25: strcpy(err, "Error reading the index"); break;
41     case 26: strcpy(err, "Error reading the index"); break;
42     case 27: strcpy(err, "Error reading the text"); break;
43     case 28: strcpy(err, "Error reading the text"); break;
44     case 99: strcpy(err, "Not implemented"); break;
45     default: strcpy(err,  "Unknown error");
46   }
47   return err;
48 }