summaryrefslogtreecommitdiff
path: root/src/shared/output-mode.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-20 19:37:46 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-22 16:16:59 +0200
commit766cd081525575875dd1291d4de0e65bcb5e1a89 (patch)
tree3b329618552e0d0a8fb8a8b0cc19b6ba1333f09b /src/shared/output-mode.c
parent03532f0ae0fae40f9f04091340e2bf156d0ec21a (diff)
shared: move output_mode_to_string() into output-mode.c
After all, the enum definition is in output-mode.h
Diffstat (limited to 'src/shared/output-mode.c')
-rw-r--r--src/shared/output-mode.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/shared/output-mode.c b/src/shared/output-mode.c
new file mode 100644
index 0000000000..be6281bd3f
--- /dev/null
+++ b/src/shared/output-mode.c
@@ -0,0 +1,36 @@
+/***
+ This file is part of systemd.
+
+ Copyright 2012 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "output-mode.h"
+#include "string-table.h"
+
+static const char *const output_mode_table[_OUTPUT_MODE_MAX] = {
+ [OUTPUT_SHORT] = "short",
+ [OUTPUT_SHORT_ISO] = "short-iso",
+ [OUTPUT_SHORT_PRECISE] = "short-precise",
+ [OUTPUT_SHORT_MONOTONIC] = "short-monotonic",
+ [OUTPUT_VERBOSE] = "verbose",
+ [OUTPUT_EXPORT] = "export",
+ [OUTPUT_JSON] = "json",
+ [OUTPUT_JSON_PRETTY] = "json-pretty",
+ [OUTPUT_JSON_SSE] = "json-sse",
+ [OUTPUT_CAT] = "cat"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(output_mode, OutputMode);