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@.service /some/path -> 
myunit@some-path.service

?

Zbyszek
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to