projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3be1e84
)
hostname-util: introduce get_pretty_hostname()
author
Yu Watanabe
<watanabe.yu+github@gmail.com>
Sun, 26 Sep 2021 10:53:00 +0000
(19:53 +0900)
committer
Yu Watanabe
<watanabe.yu+github@gmail.com>
Mon, 27 Sep 2021 16:34:02 +0000
(
01:34
+0900)
src/basic/hostname-util.h
patch
|
blob
|
history
diff --git
a/src/basic/hostname-util.h
b/src/basic/hostname-util.h
index 28975c879203f6af1467a5319a136ed1a8d9d34e..0d1574db9e307e3e7238efd2ece2351eff8553b6 100644
(file)
--- a/
src/basic/hostname-util.h
+++ b/
src/basic/hostname-util.h
@@
-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);
+}