[go: up one dir, main page]

File: format_print.h

package info (click to toggle)
cmus 2.0.4-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,092 kB
  • ctags: 2,405
  • sloc: ansic: 21,341; sh: 959; makefile: 165
file content (26 lines) | stat: -rw-r--r-- 721 bytes parent folder | download | duplicates (3)
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
#ifndef _FORMAT_PRINT_H
#define _FORMAT_PRINT_H

struct format_option {
	union {
		/* NULL is treated like "" */
		const char *fo_str;
		int fo_int;
		/* [h:]mm:ss. can be negative */
		int fo_time;
	};
	/* set to 1 if you want to disable printing */
	unsigned int empty : 1;
	enum { FO_STR, FO_INT, FO_TIME } type;
	char ch;
};

#define DEF_FO_STR(ch)	{ { .fo_str  = NULL }, 0, FO_STR,  ch }
#define DEF_FO_INT(ch)	{ { .fo_int  = 0    }, 0, FO_INT,  ch }
#define DEF_FO_TIME(ch)	{ { .fo_time = 0    }, 0, FO_TIME, ch }
#define DEF_FO_END	{ { .fo_str  = NULL }, 0, 0,       0  }

int format_print(char *str, int width, const char *format, const struct format_option *fopts);
int format_valid(const char *format);

#endif