]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/hostname-util.h
Merge pull request #11827 from keszybz/pkgconfig-variables
[thirdparty/systemd.git] / src / basic / hostname-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include <stdbool.h>
5 #include <stdio.h>
6
7 #include "macro.h"
8
9 bool hostname_is_set(void);
10
11 char* gethostname_malloc(void);
12 int gethostname_strict(char **ret);
13
14 bool valid_ldh_char(char c) _const_;
15 bool hostname_is_valid(const char *s, bool allow_trailing_dot) _pure_;
16 char* hostname_cleanup(char *s);
17
18 #define machine_name_is_valid(s) hostname_is_valid(s, false)
19
20 bool is_localhost(const char *hostname);
21 bool is_gateway_hostname(const char *hostname);
22
23 int sethostname_idempotent(const char *s);
24
25 int shorten_overlong(const char *s, char **ret);
26
27 int read_etc_hostname_stream(FILE *f, char **ret);
28 int read_etc_hostname(const char *path, char **ret);