2014-07-06 22:12 GMT+02:00 Lennart Poettering <lenn...@poettering.net>:
> (And I think I would prefer this as seperate tool from systemctl -- and > not just as new verbs), since this appears to not be directly related to > what systemctl otherwise does which is control the system...) I ended up with something like this. See attached patch. I've put it in /lib/systemd/ as I wasn't sure at that time that it would be accepted upstream so I didn't want to put it in $PATH If there is consensus, I'll just move it from rootlibexec_PROGRAMS to rootbin_PROGRAMS Cheers, Michael -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?
From c8d500e547063b0d0480d34869ee6fd97ec0e01a Mon Sep 17 00:00:00 2001 From: Michael Biebl <bi...@debian.org> Date: Wed, 4 Jun 2014 01:57:11 +0200 Subject: [PATCH] Add systemd-escape helper --- Makefile.am | 8 ++++++++ src/escape/escape.c | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/escape/escape.c diff --git a/Makefile.am b/Makefile.am index 8af619c..9b319c9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -349,6 +349,7 @@ dist_kernelinstall_SCRIPTS = \ rootlibexec_PROGRAMS = \ systemd \ + systemd-escape \ systemd-cgroups-agent \ systemd-initctl \ systemd-update-utmp \ @@ -2003,6 +2004,13 @@ systemd_cgroups_agent_LDADD = \ libsystemd-shared.la # ------------------------------------------------------------------------------ +systemd_escape_SOURCES = \ + src/escape/escape.c + +systemd_escape_LDADD = \ + libsystemd-shared.la +# ----------------------------------------------------------------------------- + systemctl_SOURCES = \ src/systemctl/systemctl.c diff --git a/src/escape/escape.c b/src/escape/escape.c new file mode 100644 index 0000000..1db6a0f --- /dev/null +++ b/src/escape/escape.c @@ -0,0 +1,25 @@ +#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."); + return EXIT_FAILURE; + } + + escaped_name = unit_name_escape(argv[1]); + + if (!escaped_name) { + log_error("Failed to escape name."); + return EXIT_FAILURE; + } + + printf("%s", escaped_name); + + return EXIT_SUCCESS; +} -- 2.0.1
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel