source: trunk/kernel/ksh/error.c @ 143

Last change on this file since 143 was 1, checked in by alain, 8 years ago

First import

File size: 2.2 KB
RevLine 
[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
29static const   char *msg1 = "NOT FOUND" ;
30static const   char *msg2 = "NO MORE MEMROY RESSOURCES" ;
31static const   char *msg3 = "NO MORE SPACE" ;
32static const   char *msg4 = "I/O ERROR" ;
33static const   char *msg5 = "UNKNOWN ERROR" ;
34static const   char *msg6 = "INVAILD IN VALUE" ;
35static const   char *msg7 = "BAD BLOCK FOUND" ;
36static const   char *msg8 = "ALREADY EXIST !" ;
37static const   char *msg9 = "IT'S DIRECTORY !" ;
38static const   char *msg10 = "BAD FILE DESCRIPTOR" ;
39static const   char *msg11 = "IT'S A PIPE OR FIFO" ;
40static const   char *msg12 = "SIZE OVERFLOW" ;
41static const   char *msg13 = "IS NOT DIRECTORY" ;
42static const   char *msg14 = "END OF DIRECTORY" ;
43static const   char *msg15 = "NOT IMPLEMENTED BY THAT SUB-SYSTEM" ;
44static const   char *msg16 = "NO MORE READERS ON PIPE OR FIFO" ;
45static const   char *msg17 = "DIRECTORY IS NOT EMPTY" ;
46 
47void 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
61void print_error_msg(error_t err)
62{
63  ksh_print("Command has failed\n");
64}
65#endif
Note: See TracBrowser for help on using the repository browser.