File: errmsg.h

package info (click to toggle)
libowfat 0.34-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,288 kB
  • sloc: ansic: 20,181; makefile: 16
file content (38 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */
#ifndef ERRMSG_H
#define ERRMSG_H

/* for exit(): */
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

/* These use file descriptor 2, not buffer_2!
 * Call buffer_flush(buffer_2) before calling these! */

extern const char* argv0;

void errmsg_iam(const char* who);	/* set argv0 */

/* terminate with NULL. */
/* newline is appended automatically. */
void errmsg_warn(const char* message, ...);
void errmsg_warnsys(const char* message, ...);

void errmsg_info(const char* message, ...);
void errmsg_infosys(const char* message, ...);

#define carp(...) errmsg_warn(__VA_ARGS__,(char*)0)
#define carpsys(...) errmsg_warnsys(__VA_ARGS__,(char*)0)
#define die(n,...) do { errmsg_warn(__VA_ARGS__,(char*)0); exit(n); } while (0)
#define diesys(n,...) do { errmsg_warnsys(__VA_ARGS__,(char*)0); exit(n); } while (0)
#define msg(...) errmsg_info(__VA_ARGS__,(char*)0);
#define msgsys(...) errmsg_infosys(__VA_ARGS__,(char*)0);

#ifdef __cplusplus
}
#endif

#endif