summaryrefslogtreecommitdiffstats
path: root/tools/watchgnupg.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-10-06 13:29:10 +0200
committerWerner Koch <wk@gnupg.org>2010-10-06 13:29:10 +0200
commit002b30e75c623d15e89708a27442836bdf038ebc (patch)
tree6b8389135e5a762ea204c2c9480314eaaede0ef5 /tools/watchgnupg.c
parentDon't set SSH_AGENTPID_INFO. (diff)
downloadgnupg2-002b30e75c623d15e89708a27442836bdf038ebc.tar.xz
gnupg2-002b30e75c623d15e89708a27442836bdf038ebc.zip
Import fixes.
new otion for watchgnupg
Diffstat (limited to 'tools/watchgnupg.c')
-rw-r--r--tools/watchgnupg.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/tools/watchgnupg.c b/tools/watchgnupg.c
index 95726dae9..958605c62 100644
--- a/tools/watchgnupg.c
+++ b/tools/watchgnupg.c
@@ -52,7 +52,7 @@
static int verbose;
-
+static int time_only;
static void
die (const char *format, ...)
@@ -136,10 +136,15 @@ print_fd_and_time (int fd)
time_t atime = time (NULL);
tp = localtime (&atime);
- printf ("%3d - %04d-%02d-%02d %02d:%02d:%02d ",
- fd,
- 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
- tp->tm_hour, tp->tm_min, tp->tm_sec );
+ if (time_only)
+ printf ("%3d - %02d:%02d:%02d ",
+ fd,
+ tp->tm_hour, tp->tm_min, tp->tm_sec );
+ else
+ printf ("%3d - %04d-%02d-%02d %02d:%02d:%02d ",
+ fd,
+ 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
+ tp->tm_hour, tp->tm_min, tp->tm_sec );
}
@@ -262,6 +267,7 @@ print_version (int with_help)
" --tcp listen on a TCP port and optionally on a local socket\n"
" --force delete an already existing socket file\n"
" --verbose enable extra informational output\n"
+ " --time-only print only the time; not a full timestamp\n"
" --version print version of the program and exit\n"
" --help display this help and exit\n"
BUGREPORT_LINE, stdout );
@@ -306,6 +312,11 @@ main (int argc, char **argv)
verbose = 1;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--time-only"))
+ {
+ time_only = 1;
+ argc--; argv++;
+ }
else if (!strcmp (*argv, "--force"))
{
force = 1;