Translated til menu left and right ...
[midnight-commander.git] / slang / slerr.c
blob6e305555f534288dc1d5b3dc657ab3c149dbee15
1 /* error handling common to all routines. */
2 /* Copyright (c) 1992, 1995 John E. Davis
3 * All rights reserved.
4 *
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Perl Artistic License.
7 */
10 #include "config.h"
12 #include <stdio.h>
13 #include <string.h>
14 #include <stdarg.h>
16 #ifdef HAVE_STDLIB_H
17 # include <stdlib.h>
18 #endif
20 #include "_slang.h"
22 void (*SLang_Error_Routine)(char *);
23 void (*SLang_Exit_Error_Hook)(char *);
24 volatile int SLang_Error = 0;
25 char *SLang_Error_Message;
26 volatile int SLKeyBoard_Quit = 0;
28 void SLang_doerror (char *error)
30 char err [1024];
31 char *str = NULL;
33 *err = 0;
35 str = "Slang/Midnight Commander unknown error";
37 g_snprintf(err, sizeof (err), "S-Lang Error: %s", str);
39 if (SLang_Error_Routine == NULL)
41 fputs (err, stderr);
42 fputs("\r\n", stderr);
44 else
45 (*SLang_Error_Routine)(err);
50 void SLang_exit_error (char *s)
52 if (SLang_Exit_Error_Hook != NULL)
54 (*SLang_Exit_Error_Hook) (s);
56 if (s != NULL) fprintf (stderr, "%s\n", s);
57 exit (-1);