1414#include "journal-remote.h"
1515#include "main-func.h"
1616#include "memory-util.h"
17+ #include "parse-argument.h"
1718#include "pretty-print.h"
1819#include "process-util.h"
1920#include "rlimit-util.h"
@@ -34,8 +35,8 @@ static const char* arg_listen_raw = NULL;
3435static const char * arg_listen_http = NULL ;
3536static const char * arg_listen_https = NULL ;
3637static char * * arg_files = NULL ; /* Do not free this. */
37- static int arg_compress = true;
38- static int arg_seal = false;
38+ static bool arg_compress = true;
39+ static bool arg_seal = false;
3940static int http_socket = -1 , https_socket = -1 ;
4041static char * * arg_gnutls_log = NULL ;
4142
@@ -965,34 +966,20 @@ static int parse_argv(int argc, char *argv[]) {
965966 break ;
966967
967968 case ARG_COMPRESS :
968- if (optarg ) {
969- r = parse_boolean (optarg );
970- if (r < 0 )
971- return log_error_errno (r , "Failed to parse --compress= parameter." );
972-
973- arg_compress = !!r ;
974- } else
975- arg_compress = true;
976-
969+ r = parse_boolean_argument ("--compress" , optarg , & arg_compress );
970+ if (r < 0 )
971+ return r ;
977972 break ;
978973
979974 case ARG_SEAL :
980- if (optarg ) {
981- r = parse_boolean (optarg );
982- if (r < 0 )
983- return log_error_errno (SYNTHETIC_ERRNO (EINVAL ),
984- "Failed to parse --seal= parameter." );
985-
986- arg_seal = !!r ;
987- } else
988- arg_seal = true;
989-
975+ r = parse_boolean_argument ("--seal" , optarg , & arg_seal );
976+ if (r < 0 )
977+ return r ;
990978 break ;
991979
992- case ARG_GNUTLS_LOG : {
980+ case ARG_GNUTLS_LOG :
993981#if HAVE_GNUTLS
994- const char * p = optarg ;
995- for (;;) {
982+ for (const char * p = optarg ;;) {
996983 _cleanup_free_ char * word = NULL ;
997984
998985 r = extract_first_word (& p , & word , "," , 0 );
@@ -1011,7 +998,6 @@ static int parse_argv(int argc, char *argv[]) {
1011998 return log_error_errno (SYNTHETIC_ERRNO (EINVAL ),
1012999 "Option --gnutls-log is not available." );
10131000#endif
1014- }
10151001
10161002 case '?' :
10171003 return - EINVAL ;
0 commit comments