From 3c56f42b47321c00d3f5b0c99e151f1293fd31b5 Mon Sep 17 00:00:00 2001 From: grant Date: Wed, 12 Feb 2003 15:18:28 +0000 Subject: 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. --- include/progressbar.h | 4 ++-- progressbar.c | 11 ++++------- 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 #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) { -- cgit v1.2.3-56-ge451