]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
15bd9a28 LP |
2 | #pragma once |
3 | ||
b8faf2ec LP |
4 | #include <stdbool.h> |
5 | ||
6 | #include "macro.h" | |
7 | ||
15bd9a28 LP |
8 | /* Manager status */ |
9 | ||
10 | typedef enum ShowStatus { | |
5ca02bfc | 11 | SHOW_STATUS_NO, /* printing of status is disabled */ |
0d066dd1 | 12 | SHOW_STATUS_ERROR, /* only print errors */ |
5ca02bfc ZJS |
13 | SHOW_STATUS_AUTO, /* disabled but may flip to _TEMPORARY */ |
14 | SHOW_STATUS_TEMPORARY, /* enabled temporarily, may flip back to _AUTO */ | |
15 | SHOW_STATUS_YES, /* printing of status is enabled */ | |
bee38b5c | 16 | _SHOW_STATUS_MAX, |
7a293242 | 17 | _SHOW_STATUS_INVALID = -1, |
15bd9a28 LP |
18 | } ShowStatus; |
19 | ||
a885727a LP |
20 | typedef enum ShowStatusFlags { |
21 | SHOW_STATUS_ELLIPSIZE = 1 << 0, | |
22 | SHOW_STATUS_EPHEMERAL = 1 << 1, | |
23 | } ShowStatusFlags; | |
24 | ||
36cf4507 ZJS |
25 | typedef enum StatusUnitFormat { |
26 | STATUS_UNIT_FORMAT_NAME, | |
27 | STATUS_UNIT_FORMAT_DESCRIPTION, | |
28 | _STATUS_UNIT_FORMAT_MAX, | |
29 | _STATUS_UNIT_FORMAT_INVALID = -1, | |
30 | } StatusUnitFormat; | |
31 | ||
5ca02bfc ZJS |
32 | static inline bool show_status_on(ShowStatus s) { |
33 | return IN_SET(s, SHOW_STATUS_TEMPORARY, SHOW_STATUS_YES); | |
34 | } | |
7a293242 YW |
35 | ShowStatus show_status_from_string(const char *v) _const_; |
36 | const char* show_status_to_string(ShowStatus s) _pure_; | |
15bd9a28 | 37 | int parse_show_status(const char *v, ShowStatus *ret); |
b8faf2ec | 38 | |
36cf4507 ZJS |
39 | StatusUnitFormat status_unit_format_from_string(const char *v) _const_; |
40 | const char* status_unit_format_to_string(StatusUnitFormat s) _pure_; | |
41 | ||
a885727a LP |
42 | int status_vprintf(const char *status, ShowStatusFlags flags, const char *format, va_list ap) _printf_(3,0); |
43 | int status_printf(const char *status, ShowStatusFlags flags, const char *format, ...) _printf_(3,4); |