]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
958b66ea LP |
2 | #pragma once |
3 | ||
958b66ea | 4 | #include <stdbool.h> |
dccca82b | 5 | #include <stdio.h> |
958b66ea LP |
6 | |
7 | #include "macro.h" | |
8 | ||
9 | bool hostname_is_set(void); | |
10 | ||
11 | char* gethostname_malloc(void); | |
8e1ad1ea | 12 | int gethostname_strict(char **ret); |
958b66ea | 13 | |
b59abc4d | 14 | bool hostname_is_valid(const char *s, bool allow_trailing_dot) _pure_; |
ae691c1d | 15 | char* hostname_cleanup(char *s); |
958b66ea | 16 | |
25300b5a LP |
17 | #define machine_name_is_valid(s) hostname_is_valid(s, false) |
18 | ||
958b66ea | 19 | bool is_localhost(const char *hostname); |
46a5e0e7 | 20 | bool is_gateway_hostname(const char *hostname); |
958b66ea LP |
21 | |
22 | int sethostname_idempotent(const char *s); | |
139e5336 | 23 | |
2de2abad LB |
24 | int shorten_overlong(const char *s, char **ret); |
25 | ||
f35cb39e LP |
26 | int read_etc_hostname_stream(FILE *f, char **ret); |
27 | int read_etc_hostname(const char *path, char **ret); |