1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
10 typedef enum ShowStatus
{
11 SHOW_STATUS_NO
, /* printing of status is disabled */
12 SHOW_STATUS_ERROR
, /* only print errors */
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 */
17 _SHOW_STATUS_INVALID
= -1,
20 typedef enum ShowStatusFlags
{
21 SHOW_STATUS_ELLIPSIZE
= 1 << 0,
22 SHOW_STATUS_EPHEMERAL
= 1 << 1,
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,
32 static inline bool show_status_on(ShowStatus s
) {
33 return IN_SET(s
, SHOW_STATUS_TEMPORARY
, SHOW_STATUS_YES
);
35 ShowStatus
show_status_from_string(const char *v
) _const_
;
36 const char* show_status_to_string(ShowStatus s
) _pure_
;
37 int parse_show_status(const char *v
, ShowStatus
*ret
);
39 StatusUnitFormat
status_unit_format_from_string(const char *v
) _const_
;
40 const char* status_unit_format_to_string(StatusUnitFormat s
) _pure_
;
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);