[1] | 1 | /* |
---|
| 2 | This file is part of MutekP. |
---|
| 3 | |
---|
| 4 | MutekP is free software; you can redistribute it and/or modify it |
---|
| 5 | under the terms of the GNU General Public License as published by |
---|
| 6 | the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | (at your option) any later version. |
---|
| 8 | |
---|
| 9 | MutekP is distributed in the hope that it will be useful, but |
---|
| 10 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 12 | General Public License for more details. |
---|
| 13 | |
---|
| 14 | You should have received a copy of the GNU General Public License |
---|
| 15 | along with MutekP; if not, write to the Free Software Foundation, |
---|
| 16 | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 17 | |
---|
| 18 | UPMC / LIP6 / SOC (c) 2008 |
---|
| 19 | Copyright Ghassan Almaless <ghassan.almaless@gmail.com> |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #include <system.h> |
---|
| 23 | #include <stdint.h> |
---|
| 24 | #include <kminiShell.h> |
---|
| 25 | |
---|
| 26 | #if 0 |
---|
| 27 | #define ERROR_NR 17 |
---|
| 28 | |
---|
| 29 | static const char *msg1 = "NOT FOUND" ; |
---|
| 30 | static const char *msg2 = "NO MORE MEMROY RESSOURCES" ; |
---|
| 31 | static const char *msg3 = "NO MORE SPACE" ; |
---|
| 32 | static const char *msg4 = "I/O ERROR" ; |
---|
| 33 | static const char *msg5 = "UNKNOWN ERROR" ; |
---|
| 34 | static const char *msg6 = "INVAILD IN VALUE" ; |
---|
| 35 | static const char *msg7 = "BAD BLOCK FOUND" ; |
---|
| 36 | static const char *msg8 = "ALREADY EXIST !" ; |
---|
| 37 | static const char *msg9 = "IT'S DIRECTORY !" ; |
---|
| 38 | static const char *msg10 = "BAD FILE DESCRIPTOR" ; |
---|
| 39 | static const char *msg11 = "IT'S A PIPE OR FIFO" ; |
---|
| 40 | static const char *msg12 = "SIZE OVERFLOW" ; |
---|
| 41 | static const char *msg13 = "IS NOT DIRECTORY" ; |
---|
| 42 | static const char *msg14 = "END OF DIRECTORY" ; |
---|
| 43 | static const char *msg15 = "NOT IMPLEMENTED BY THAT SUB-SYSTEM" ; |
---|
| 44 | static const char *msg16 = "NO MORE READERS ON PIPE OR FIFO" ; |
---|
| 45 | static const char *msg17 = "DIRECTORY IS NOT EMPTY" ; |
---|
| 46 | |
---|
| 47 | void print_error_msg(error_t err) |
---|
| 48 | { |
---|
| 49 | const char *msg_tab[18] = {NULL,msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9, \ |
---|
| 50 | msg10,msg11,msg12,msg13,msg14,msg15,msg16,msg17}; |
---|
| 51 | |
---|
| 52 | err = (err < 0) ? -err : err; |
---|
| 53 | |
---|
| 54 | if((err < 1) || (err > ERROR_NR)) |
---|
| 55 | ksh_print("Invaild error code !!! %d\n", err); |
---|
| 56 | else |
---|
| 57 | ksh_print("Error: %s\n",msg_tab[err]); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | #else |
---|
| 61 | void print_error_msg(error_t err) |
---|
| 62 | { |
---|
| 63 | ksh_print("Command has failed\n"); |
---|
| 64 | } |
---|
| 65 | #endif |
---|