summaryrefslogtreecommitdiff
path: root/src/daemontools-extras
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2018-03-21 11:52:14 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2018-03-21 11:52:14 +0000
commit91eba4b27017c3b7bf0d0bb548a12a694ed51a3b (patch)
treed4abb4bb2cdfd779a94d78040529812ffc89f0fe /src/daemontools-extras
parent01c12e7ac7bd0c95099dbe299f049c59081e35bc (diff)
downloads6-91eba4b27017c3b7bf0d0bb548a12a694ed51a3b.tar.xz
Add -g option to s6-tai64nlocal
Diffstat (limited to 'src/daemontools-extras')
-rw-r--r--src/daemontools-extras/s6-tai64nlocal.c23
1 files changed, 21 insertions, 2 deletions
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 <errno.h>
#include <skalibs/buffer.h>
#include <skalibs/strerr2.h>
+#include <skalibs/sgetopt.h>
#include <skalibs/tai.h>
#include <skalibs/djbtime.h>
#include <skalibs/stralloc.h>
#include <skalibs/skamisc.h>
-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) ;