From 91eba4b27017c3b7bf0d0bb548a12a694ed51a3b Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 21 Mar 2018 11:52:14 +0000 Subject: Add -g option to s6-tai64nlocal --- src/daemontools-extras/s6-tai64nlocal.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/daemontools-extras') diff --git a/src/daemontools-extras/s6-tai64nlocal.c b/src/daemontools-extras/s6-tai64nlocal.c index 7084abd..097102b 100644 --- a/src/daemontools-extras/s6-tai64nlocal.c +++ b/src/daemontools-extras/s6-tai64nlocal.c @@ -4,14 +4,33 @@ #include #include #include +#include #include #include #include #include -int main (void) +#define USAGE "s6-tai64nlocal [ -g ]" + +int main (int argc, char const *const *argv) { + int islocal = 1 ; PROG = "s6-tai64nlocal" ; + { + subgetopt_t l = SUBGETOPT_ZERO ; + for (;;) + { + int opt = subgetopt_r(argc, argv, "g", &l) ; + if (opt == -1) break ; + switch (opt) + { + case 'g' : islocal = 0 ; break ; + default : strerr_dieusage(100, USAGE) ; + } + } + argc -= l.ind ; argv += l.ind ; + } + for (;;) { unsigned int p = 0 ; @@ -28,7 +47,7 @@ int main (void) if (p) { localtmn_t local ; - if (localtmn_from_tain(&local, &a, 1)) + if (localtmn_from_tain(&local, &a, islocal)) { char fmt[LOCALTMN_FMT+1] ; size_t len = localtmn_fmt(fmt, &local) ; -- cgit v1.2.3