/[baselayout]/trunk/src/einfo.h
Gentoo

Contents of /trunk/src/einfo.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2834 - (show annotations) (download) (as text)
Thu Aug 16 16:53:20 2007 UTC (7 years, 1 month ago) by uberlord
File MIME type: text/x-chdr
File size: 2639 byte(s)
Add esyslog support
1 /*
2 rc.h
3 Header file for external applications to get RC information.
4 Copyright 2007 Gentoo Foundation
5 Released under the GPLv2
6 */
7
8 #ifndef __EINFO_H__
9 #define __EINFO_H__
10
11 #ifdef __GNUC__
12 # define EINFO_PRINTF(_one, _two) __attribute__ ((__format__ (__printf__, _one, _two)))
13 # define EINFO_XPRINTF(_one, _two) __attribute__ ((__noreturn__, __format__ (__printf__, _one, _two)))
14 #endif
15
16 #include <sys/types.h>
17 #include <stdbool.h>
18
19 typedef enum
20 {
21 ecolor_good,
22 ecolor_warn,
23 ecolor_bad,
24 ecolor_hilite,
25 ecolor_bracket,
26 ecolor_normal
27 } einfo_color_t;
28
29 /* We work out if the terminal supports colour or not through the use
30 of the TERM env var. We cache the reslt in a static bool, so
31 subsequent calls are very fast.
32 The n suffix means that a newline is NOT appended to the string
33 The v suffix means that we only print it when RC_VERBOSE=yes
34 NOTE We use the v suffix here so we can add veinfo for va_list
35 in the future, but veinfo is used by shell scripts as they don't
36 have the va_list concept
37 */
38 const char *ecolor (einfo_color_t);
39 void elog (int level, const char *fmt, ...) EINFO_PRINTF (2, 3);
40 int einfon (const char *fmt, ...) EINFO_PRINTF (1, 2);
41 int ewarnn (const char *fmt, ...) EINFO_PRINTF (1, 2);
42 int eerrorn (const char *fmt, ...) EINFO_PRINTF (1, 2);
43 int einfo (const char *fmt, ...) EINFO_PRINTF(1, 2);
44 int ewarn (const char *fmt, ...) EINFO_PRINTF (1, 2);
45 void ewarnx (const char *fmt, ...) EINFO_XPRINTF (1,2);
46 int eerror (const char *fmt, ...) EINFO_PRINTF (1,2);
47 void eerrorx (const char *fmt, ...) EINFO_XPRINTF (1,2);
48 int ebegin (const char *fmt, ...) EINFO_PRINTF (1, 2);
49 int eend (int retval, const char *fmt, ...) EINFO_PRINTF (2, 3);
50 int ewend (int retval, const char *fmt, ...) EINFO_PRINTF (2, 3);
51 void ebracket (int col, einfo_color_t color, const char *msg);
52 void eindent (void);
53 void eoutdent (void);
54
55 int einfovn (const char *fmt, ...) EINFO_PRINTF (1, 2);
56 int ewarnvn (const char *fmt, ...) EINFO_PRINTF (1, 2);
57 int ebeginvn (const char *fmt, ...) EINFO_PRINTF (1, 2);
58 int eendvn (int retval, const char *fmt, ...) EINFO_PRINTF (2, 3);
59 int ewendvn (int retval, const char *fmt, ...) EINFO_PRINTF (2, 3);
60 int einfov (const char *fmt, ...) EINFO_PRINTF (1, 2);
61 int ewarnv (const char *fmt, ...) EINFO_PRINTF (1, 2);
62 int ebeginv (const char *fmt, ...) EINFO_PRINTF (1, 2);
63 int eendv (int retval, const char *fmt, ...) EINFO_PRINTF (2, 3);
64 int ewendv (int retval, const char *fmt, ...) EINFO_PRINTF (2, 3);
65 void eindentv (void);
66 void eoutdentv (void);
67
68 /* Pointer to a string that is always prefixed to einfo/ewarn/error */
69 void eprefix (const char *prefix);
70
71 #endif

  ViewVC Help
Powered by ViewVC 1.1.20