Systemd/src/shared/specifier.h
Lennart Poettering b294e5943f core: introduce specifiers for /tmp and /var/tmp
This corresponds nicely with the specifiers we already pass for
/var/lib, /var/cache, /run and so on.

This is particular useful to update the test-path service files to
operate without guessable files, thus allowing multiple parallel
test-path invocations to pass without issues (the idea is to set $TMPDIR
early on in the test to some private directory, and then only use the
new %T or %V specifier to refer to it).
2018-05-29 11:39:15 +02:00

42 lines
1.5 KiB
C

/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
***/
#include "string-util.h"
typedef int (*SpecifierCallback)(char specifier, void *data, void *userdata, char **ret);
typedef struct Specifier {
const char specifier;
const SpecifierCallback lookup;
void *data;
} Specifier;
int specifier_printf(const char *text, const Specifier table[], void *userdata, char **ret);
int specifier_string(char specifier, void *data, void *userdata, char **ret);
int specifier_machine_id(char specifier, void *data, void *userdata, char **ret);
int specifier_boot_id(char specifier, void *data, void *userdata, char **ret);
int specifier_host_name(char specifier, void *data, void *userdata, char **ret);
int specifier_kernel_release(char specifier, void *data, void *userdata, char **ret);
int specifier_user_name(char specifier, void *data, void *userdata, char **ret);
int specifier_user_id(char specifier, void *data, void *userdata, char **ret);
int specifier_user_home(char specifier, void *data, void *userdata, char **ret);
int specifier_user_shell(char specifier, void *data, void *userdata, char **ret);
int specifier_tmp_dir(char specifier, void *data, void *userdata, char **ret);
int specifier_var_tmp_dir(char specifier, void *data, void *userdata, char **ret);
static inline char* specifier_escape(const char *string) {
return strreplace(string, "%", "%%");
}
int specifier_escape_strv(char **l, char ***ret);