diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/generator.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/shared/generator.h b/src/shared/generator.h index bd768daf49..1b4f36ac53 100644 --- a/src/shared/generator.h +++ b/src/shared/generator.h @@ -3,6 +3,7 @@ #include <stdio.h> +#include "macro.h" #include "main-func.h" int generator_open_unit_file( @@ -86,11 +87,11 @@ void log_setup_generator(void); _DEFINE_MAIN_FUNCTION( \ ({ \ log_setup_generator(); \ - if (argc > 1 && argc != 4) \ + if (!IN_SET(argc, 2, 4)) \ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), \ - "This program takes zero or three arguments."); \ + "This program takes one or three arguments."); \ }), \ - impl(argc > 1 ? argv[1] : "/tmp", \ - argc > 1 ? argv[2] : "/tmp", \ - argc > 1 ? argv[3] : "/tmp"), \ + impl(argv[1], \ + argv[argc == 4 ? 2 : 1], \ + argv[argc == 4 ? 3 : 1]), \ r < 0 ? EXIT_FAILURE : EXIT_SUCCESS) |