]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/hostname-util.h
Merge pull request #8575 from keszybz/non-absolute-paths
[thirdparty/systemd.git] / src / basic / hostname-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2010-2015 Lennart Poettering
8 ***/
9
10 #include <stdbool.h>
11 #include <stdio.h>
12
13 #include "macro.h"
14
15 bool hostname_is_set(void);
16
17 char* gethostname_malloc(void);
18 int gethostname_strict(char **ret);
19
20 bool hostname_is_valid(const char *s, bool allow_trailing_dot) _pure_;
21 char* hostname_cleanup(char *s);
22
23 #define machine_name_is_valid(s) hostname_is_valid(s, false)
24
25 bool is_localhost(const char *hostname);
26 bool is_gateway_hostname(const char *hostname);
27
28 int sethostname_idempotent(const char *s);
29
30 int shorten_overlong(const char *s, char **ret);
31
32 int read_etc_hostname_stream(FILE *f, char **ret);
33 int read_etc_hostname(const char *path, char **ret);