stroke: Fix --utc option for list* commands

Fixes: dcb168413f ("stroke: Add --daemon option")
This commit is contained in:
Tobias Brunner
2015-12-17 16:56:20 +01:00
parent 891e9e95ea
commit 1c3aa9bfc8
+7 -2
View File
@@ -279,7 +279,7 @@ static int list_flags[] = {
LIST_ALL LIST_ALL
}; };
static int list(stroke_keyword_t kw, int utc) static int list(stroke_keyword_t kw, bool utc)
{ {
stroke_msg_t *msg; stroke_msg_t *msg;
@@ -478,6 +478,7 @@ int main(int argc, char *argv[])
{ {
const stroke_token_t *token; const stroke_token_t *token;
char *cmd; char *cmd;
bool utc = FALSE;
int res = 0; int res = 0;
library_init(NULL, "stroke"); library_init(NULL, "stroke");
@@ -487,6 +488,7 @@ int main(int argc, char *argv[])
{ {
struct option long_opts[] = { struct option long_opts[] = {
{"help", no_argument, NULL, 'h' }, {"help", no_argument, NULL, 'h' },
{"utc", no_argument, NULL, 'u' },
{"daemon", required_argument, NULL, 'd' }, {"daemon", required_argument, NULL, 'd' },
{0,0,0,0}, {0,0,0,0},
}; };
@@ -499,6 +501,9 @@ int main(int argc, char *argv[])
case 'd': case 'd':
daemon_name = optarg; daemon_name = optarg;
continue; continue;
case 'u':
utc = TRUE;
continue;
default: default:
return usage("invalid option"); return usage("invalid option");
} }
@@ -611,7 +616,7 @@ int main(int argc, char *argv[])
case STROKE_LIST_ALGS: case STROKE_LIST_ALGS:
case STROKE_LIST_PLUGINS: case STROKE_LIST_PLUGINS:
case STROKE_LIST_ALL: case STROKE_LIST_ALL:
res = list(token->kw, argc && streq(argv[0], "--utc")); res = list(token->kw, utc);
break; break;
case STROKE_REREAD_SECRETS: case STROKE_REREAD_SECRETS:
case STROKE_REREAD_CACERTS: case STROKE_REREAD_CACERTS: