summaryrefslogtreecommitdiff
path: root/src/basic/af-list.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/af-list.h')
-rw-r--r--src/basic/af-list.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/basic/af-list.h b/src/basic/af-list.h
index e346ab87f5..6a4cc03839 100644
--- a/src/basic/af-list.h
+++ b/src/basic/af-list.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
@@ -21,7 +19,23 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "string-util.h"
+
const char *af_to_name(int id);
int af_from_name(const char *name);
+static inline const char* af_to_name_short(int id) {
+ const char *f;
+
+ if (id == AF_UNSPEC)
+ return "*";
+
+ f = af_to_name(id);
+ if (!f)
+ return "unknown";
+
+ assert(startswith(f, "AF_"));
+ return f + 3;
+}
+
int af_max(void);