specifier: use %q for pretty hostname

%R is already used in service manager specifier expansion (cgroup root),
hence use a different char, that was so far not used.

Follow-up for: 6ceb0a4094
This commit is contained in:
Lennart Poettering
2022-04-08 22:18:28 +02:00
parent e22983e80f
commit d0aba07f1a
5 changed files with 10 additions and 9 deletions
+2 -1
View File
@@ -51,6 +51,7 @@ int specifier_var_tmp_dir(char specifier, const void *data, const char *root, co
* %B: the OS build ID, according to /etc/os-release
* %H: the hostname of the running system
* %l: the short hostname of the running system
* %q: the 'pretty' hostname as per /etc/machine-info
* %m: the machine ID of the running system
* %M: the OS image ID, according to /etc/os-release
* %o: the OS ID according to /etc/os-release
@@ -76,7 +77,7 @@ int specifier_var_tmp_dir(char specifier, const void *data, const char *root, co
{ 'B', specifier_os_build_id, NULL }, \
{ 'H', specifier_host_name, NULL }, \
{ 'l', specifier_short_host_name, NULL }, \
{ 'R', specifier_pretty_host_name,NULL }, \
{ 'q', specifier_pretty_host_name,NULL }, \
{ 'm', specifier_machine_id, NULL }, \
{ 'M', specifier_os_image_id, NULL }, \
{ 'o', specifier_os_id, NULL }, \
+1 -1
View File
@@ -74,7 +74,7 @@ TEST(specifier_printf) {
assert_se(streq(w, "xxx a=AAAA b=BBBB e= yyy"));
free(w);
r = specifier_printf("machine=%m, boot=%b, host=%H, pretty=%R, version=%v, arch=%a, empty=%e", SIZE_MAX, table, NULL, NULL, &w);
r = specifier_printf("machine=%m, boot=%b, host=%H, pretty=%q, version=%v, arch=%a, empty=%e", SIZE_MAX, table, NULL, NULL, &w);
assert_se(r >= 0);
assert_se(w);
puts(w);