aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrant <grant@NetBSD.org>2003-02-12 15:18:28 +0000
committergrant <grant@NetBSD.org>2003-02-12 15:18:28 +0000
commit3c56f42b47321c00d3f5b0c99e151f1293fd31b5 (patch)
tree64585d609e086ad4740c9dd81d670d1f8048af2a
parent0c9ec8b0c3e49e562c5d84b59ed21592148103cd (diff)
downloadbsd-progress-3c56f42b47321c00d3f5b0c99e151f1293fd31b5.tar.gz
bsd-progress-3c56f42b47321c00d3f5b0c99e151f1293fd31b5.tar.zst
bsd-progress-3c56f42b47321c00d3f5b0c99e151f1293fd31b5.zip
change a couple #ifdef's so /usr/bin/progress doesn't stomp all over
the tty if it's not in the foreground. ok'd by jhawk.
-rw-r--r--include/progressbar.h4
-rw-r--r--progressbar.c11
2 files changed, 6 insertions, 9 deletions
diff --git a/include/progressbar.h b/include/progressbar.h
index f0f8485..994ca4f 100644
--- a/include/progressbar.h
+++ b/include/progressbar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: progressbar.h,v 1.1 2003/01/21 16:08:08 jhawk Exp $ */
+/* $NetBSD: progressbar.h,v 1.2 2003/02/12 15:18:28 grant Exp $ */
/*-
* Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
@@ -135,13 +135,13 @@ GLOBAL char *direction; /* direction transfer is occurring */
GLOBAL sigjmp_buf toplevel; /* non-local goto stuff for cmd scanner */
#endif /* !STANDALONE_PROGRESS */
+int foregroundproc(void);
void alarmtimer(int);
void progressmeter(int);
sigfunc xsignal(int, sigfunc);
sigfunc xsignal_restart(int, sigfunc, int);
#ifndef STANDALONE_PROGRESS
-int foregroundproc(void);
void psummary(int);
void ptransfer(int);
#endif /* !STANDALONE_PROGRESS */
diff --git a/progressbar.c b/progressbar.c
index c1a3a28..c77bb53 100644
--- a/progressbar.c
+++ b/progressbar.c
@@ -1,4 +1,4 @@
-/* $NetBSD: progressbar.c,v 1.1 2003/01/21 16:08:08 jhawk Exp $ */
+/* $NetBSD: progressbar.c,v 1.2 2003/02/12 15:18:28 grant Exp $ */
/*-
* Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: progressbar.c,v 1.1 2003/01/21 16:08:08 jhawk Exp $");
+__RCSID("$NetBSD: progressbar.c,v 1.2 2003/02/12 15:18:28 grant Exp $");
#endif /* not lint */
/*
@@ -95,7 +95,7 @@ __RCSID("$NetBSD: progressbar.c,v 1.1 2003/01/21 16:08:08 jhawk Exp $");
#include "progressbar.h"
-#if !defined(NO_PROGRESS) && !defined(STANDALONE_PROGRESS)
+#if !defined(NO_PROGRESS)
/*
* return non-zero if we're the current foreground process
*/
@@ -109,7 +109,7 @@ foregroundproc(void)
return (tcgetpgrp(fileno(ttyout)) == pgrp);
}
-#endif /* !defined(NO_PROGRESS) && !defined(STANDALONE_PROGRESS) */
+#endif /* !defined(NO_PROGRESS) */
#ifndef NO_PROGRESS
@@ -230,14 +230,11 @@ progressmeter(int flag)
return;
len = 0;
-#ifndef STANDALONE_PROGRESS
/*
* print progress bar only if we are foreground process.
*/
if (! foregroundproc())
return;
-#endif /* !STANDALONE_PROGRESS */
-
len += snprintf(buf + len, BUFLEFT, "\r");
if (filesize > 0) {