[systemd-devel] systemctl escaping of unit names
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Sun Jul 6 14:22:31 PDT 2014
On Sun, Jul 06, 2014 at 10:28:55PM +0200, Michael Biebl wrote:
> +#include <stdio.h>
> +#include <stdlib.h>
> +
> +#include "log.h"
> +#include "unit-name.h"
> +
> +int main(int argc, char *argv[]) {
> + char *escaped_name = NULL;
> +
> + if (argc != 2) {
> + log_error("This program requires on argument.");
"an" or "one"?
> + return EXIT_FAILURE;
> + }
> +
> + escaped_name = unit_name_escape(argv[1]);
> +
> + if (!escaped_name) {
> + log_error("Failed to escape name.");
Maybe just log_oom()?
> + return EXIT_FAILURE;
> + }
> +
> + printf("%s", escaped_name);
> +
> + return EXIT_SUCCESS;
What about adding a --template parameter, to be used as
systemd-escape --template myunit at .service /some/path -> myunit at some-path.service
?
Zbyszek
More information about the systemd-devel
mailing list