grub2: bring back build of aros-side grub2 tools
[AROS.git] / tools / flexcat / src / showfuncs.c
blob226c3b738eff5696482ce1d658773a34590ae565
1 /*
2 * $Id$
4 * Copyright (C) 1993-1999 by Jochen Wiedmann and Marcin Orlowski
5 * Copyright (C) 2002-2010 by the FlexCat Open Source Team
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <stdarg.h>
24 #include "flexcat.h"
25 #include "readprefs.h"
26 #include "globals.h"
27 #include "utils.h"
29 /// ShowError
31 /* This shows an error message and quits. */
33 void ShowError(const char *msg, ...)
35 va_list args;
36 char header[256];
37 char message[256];
39 snprintf(header, sizeof(header), MSG_ERR_ERROR, ScanFile, ScanLine);
40 va_start(args, msg);
41 vsnprintf(message, sizeof(message), msg, args);
42 va_end(args);
43 fprintf(stderr, "%s %s\n", header, message);
45 #ifdef AMIGA
46 NumberOfWarnings++;
47 #endif
49 MyExit(10);
52 ///
53 /// ShowErrorQuick
55 /* Same as ShowError but in this case we omit any line number. */
57 void ShowErrorQuick(const char *msg, ...)
59 va_list args;
60 char header[256];
61 char message[256];
63 snprintf(header, sizeof(header), MSG_ERR_ERROR_QUICK, ScanFile);
64 va_start(args, msg);
65 vsnprintf(message, sizeof(message), msg, args);
66 va_end(args);
67 fprintf(stderr, "%s %s\n", header, message);
69 #ifdef AMIGA
70 NumberOfWarnings++;
71 #endif
73 MyExit ( 10 );
76 ///
77 /// MemError
79 /* This shows the 'Memory error' message. */
81 void MemError(void)
83 ShowError(MSG_ERR_NOMEMORY);
86 ///
87 /// ShowWarn
89 /* This shows a warning. */
91 void ShowWarn(const char *msg, ...)
93 if(!Quiet)
95 va_list args;
96 char header[256];
97 char message[256];
99 snprintf(header, sizeof(header), MSG_ERR_WARNING, ScanFile, ScanLine);
100 va_start(args, msg);
101 vsnprintf(message, sizeof(message), msg, args);
102 va_end(args);
103 fprintf(stderr, "%s %s\n", header, message);
106 NumberOfWarnings++;
107 GlobalReturnCode = 5;
111 /// ShowWarnQuick
113 /* This shows a warning without line number. */
115 void ShowWarnQuick(const char *msg, ...)
117 if(!Quiet)
119 va_list args;
120 char header[256];
121 char message[256];
123 snprintf(header, sizeof(header), MSG_ERR_WARNING_QUICK, ScanFile);
124 va_start(args, msg);
125 vsnprintf(message, sizeof(message), msg, args);
126 va_end(args);
127 fprintf(stderr, "%s %s\n", header, message);
130 NumberOfWarnings++;
131 GlobalReturnCode = 5;