Commit 2d8a8942 2d8a8942cda6d816c4840d0dff1cf7fe76964d88 by Sergey Poznyakoff

A template file for muerrno.c

1 parent e12873bf
1 /* -*- c -*- $AUTOWARN
2 GNU Mailutils -- a suite of utilities for electronic mail
3 Copyright (C) 1999, 2000, 2001, 2002, 2003,
4 2004, 2005 Free Software Foundation, Inc.
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
19
20 #ifdef HAVE_CONFIG_H
21 # include <config.h>
22 #endif
23
24 #include <stdio.h>
25 #include <errno.h>
26 #include <string.h>
27
28 #include <mailutils/errno.h>
29 #include <mailutils/nls.h>
30
31 #ifndef EOK
32 # define EOK 0
33 #endif
34
35 const char*
36 mu_errname (int e)
37 {
38 static char buf[128];
39
40 switch (e)
41 {
42 case EOK:
43 return "EOK";
44
45 $MESSAGE_CODES
46 }
47
48 snprintf (buf, sizeof buf, _("Error %d"), e);
49 return buf;
50 }
51
52 const char *
53 mu_strerror (int e)
54 {
55 switch (e)
56 {
57 case EOK:
58 return _("Success");
59
60 $MESSAGE_STRINGS
61 }
62
63 return strerror (e);
64 }
65