Fix umpnpmgr build
[reactos.git] / rosapps / mc / slang / slerr.c
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 */
8
9
10 #include "config.h"
11
12 #include <stdio.h>
13 #include <string.h>
14 #include <stdarg.h>
15
16 #ifdef HAVE_STDLIB_H
17 # include <stdlib.h>
18 #endif
19
20 #include "slang.h"
21 #include "_slang.h"
22
23 void (*SLang_Error_Routine)(char *);
24 void (*SLang_Exit_Error_Hook)(char *);
25 volatile int SLang_Error = 0;
26 char *SLang_Error_Message;
27 volatile int SLKeyBoard_Quit = 0;
28
29 void SLang_doerror (char *error)
30 {
31 char err [1024];
32 char *str = NULL;
33
34 *err = 0;
35
36 str = "Slang/Midnight Commander unknown error";
37
38 sprintf(err, "S-Lang Error: %s", str);
39
40 if (SLang_Error_Routine == NULL)
41 {
42 fputs (err, stderr);
43 fputs("\r\n", stderr);
44 }
45 else
46 (*SLang_Error_Routine)(err);
47 }
48
49
50
51 void SLang_exit_error (char *s)
52 {
53 if (SLang_Exit_Error_Hook != NULL)
54 {
55 (*SLang_Exit_Error_Hook) (s);
56 }
57 if (s != NULL) fprintf (stderr, "%s\n", s);
58 exit (-1);
59 }