summaryrefslogtreecommitdiffstats
path: root/stopwatch.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-03-30 18:17:26 +0200
committerMattias Andrée <maandree@kth.se>2021-03-30 18:17:55 +0200
commitafe89e5f9fc443383c8067ebe870541b73c679da (patch)
tree4a52e9ed502fdd0bace255152f8219d92e089d4b /stopwatch.c
parentAdd dice (diff)
downloadpdatools-afe89e5f9fc443383c8067ebe870541b73c679da.tar.gz
pdatools-afe89e5f9fc443383c8067ebe870541b73c679da.tar.bz2
pdatools-afe89e5f9fc443383c8067ebe870541b73c679da.tar.xz
m + Add timer
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'stopwatch.c')
-rw-r--r--stopwatch.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/stopwatch.c b/stopwatch.c
index 5bfa69c..dcb36dd 100644
--- a/stopwatch.c
+++ b/stopwatch.c
@@ -142,6 +142,7 @@ int
main(int argc, char *argv[])
{
int timerfd = -1, old_flags = -1, tcset = 0, old_sig = 0;
+ int saved_errno;
struct sigaction sigact;
int64_t owner_set = 0;
struct f_owner_ex old_owner, new_owner;
@@ -218,9 +219,14 @@ main(int argc, char *argv[])
return 0;
fail:
- printf("\033[?25h\n");
- perror(argv0 ? argv0 : "stopwatch");
+ saved_errno = errno;
+ if (quadsize)
+ printf("\n\n\033#5\033[?25h");
+ else
+ printf("\033[?25h\n");
fflush(stdout);
+ errno = saved_errno;
+ perror(argv0 ? argv0 : "stopwatch");
if (owner_set)
fcntl(STDIN_FILENO, F_SETOWN_EX, &old_owner);
if (old_flags != -1)