view src/doveadm/doveadm-print.h @ 19604:c996bc091c6b

master: Do not close stdout if going foreground This lets one to use /dev/stdout for logging. Mainly useful for testing purposes where we can generate log output to stdout and use tee to write it to a file for later examination.
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Mon, 18 Jan 2016 15:50:23 +0200
parents b84f4b881b88
children e7e593e68fce
line wrap: on
line source

#ifndef DOVEADM_PRINT_H
#define DOVEADM_PRINT_H

#define DOVEADM_PRINT_TYPE_TAB "tab"
#define DOVEADM_PRINT_TYPE_FLOW "flow"
#define DOVEADM_PRINT_TYPE_TABLE "table"

enum doveadm_print_header_flags {
	DOVEADM_PRINT_HEADER_FLAG_RIGHT_JUSTIFY 	= 0x01,
	DOVEADM_PRINT_HEADER_FLAG_STICKY	 	= 0x02,
	DOVEADM_PRINT_HEADER_FLAG_HIDE_TITLE	 	= 0x04,
	DOVEADM_PRINT_HEADER_FLAG_EXPAND	 	= 0x08
};

extern const struct doveadm_print_vfuncs *doveadm_print_vfuncs_all[];
extern bool doveadm_print_hide_titles;

bool doveadm_print_is_initialized(void);

void doveadm_print_header(const char *key, const char *title,
			  enum doveadm_print_header_flags flags);
void doveadm_print_header_simple(const char *key_title);
void doveadm_print(const char *value);
void doveadm_print_num(uintmax_t value);
/* Stream for same field continues until len=0 */
void doveadm_print_stream(const void *value, size_t size);
/* Print the whole input stream. Returns 0 if ok, -1 if stream read() failed */
int doveadm_print_istream(struct istream *input);
void doveadm_print_sticky(const char *key, const char *value);
void doveadm_print_flush(void);
void doveadm_print_unstick_headers(void);

void doveadm_print_init(const char *name);
void doveadm_print_deinit(void);

#endif