]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hostname-util: introduce get_pretty_hostname()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 26 Sep 2021 10:53:00 +0000 (19:53 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 27 Sep 2021 16:34:02 +0000 (01:34 +0900)
src/basic/hostname-util.h

index 28975c879203f6af1467a5319a136ed1a8d9d34e..0d1574db9e307e3e7238efd2ece2351eff8553b6 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 
+#include "env-file.h"
 #include "macro.h"
 #include "strv.h"
 
@@ -60,3 +61,7 @@ static inline bool is_outbound_hostname(const char *hostname) {
         /* This tries to identify the valid syntaxes for the our synthetic "outbound" host. */
         return STRCASE_IN_SET(hostname, "_outbound", "_outbound.");
 }
+
+static inline int get_pretty_hostname(char **ret) {
+        return parse_env_file(NULL, "/etc/machine-info", "PRETTY_HOSTNAME", ret);
+}