summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-08-06 22:48:19 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-08-06 22:48:19 +0000
commit958d9f695b78a03645cb9b426855c291355b7091 (patch)
treee70e0eab2c23adee20767109f2ebe3423f6aded9 /scp.c
parentde8fc6fadc2039747482f17bf4d32c505d0f0383 (diff)
- stevesk@cvs.openbsd.org 2001/08/06 19:47:05
[scp.c] use alarm vs. setitimer for portable; ok markus@
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/scp.c b/scp.c
index 71fa299d..4708f0ed 100644
--- a/scp.c
+++ b/scp.c
@@ -75,7 +75,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.78 2001/07/27 17:26:16 deraadt Exp $");
+RCSID("$OpenBSD: scp.c,v 1.79 2001/08/06 19:47:05 stevesk Exp $");
#include "xmalloc.h"
#include "atomicio.h"
@@ -91,6 +91,8 @@ char *__progname;
/* For progressmeter() -- number of seconds before xfer considered "stalled" */
#define STALLTIME 5
+/* alarm() interval for updating progress meter */
+#define PROGRESSTIME 1
/* Progress meter bar */
#define BAR \
@@ -1064,24 +1066,14 @@ lostconn(signo)
exit(1);
}
-
-static void
-alarmtimer(int wait)
-{
- struct itimerval itv;
-
- itv.it_value.tv_sec = wait;
- itv.it_value.tv_usec = 0;
- itv.it_interval = itv.it_value;
- setitimer(ITIMER_REAL, &itv, NULL);
-}
-
static void
updateprogressmeter(int ignore)
{
int save_errno = errno;
progressmeter(0);
+ signal(SIGALRM, updateprogressmeter);
+ alarm(PROGRESSTIME);
errno = save_errno;
}
@@ -1194,9 +1186,9 @@ progressmeter(int flag)
if (flag == -1) {
mysignal(SIGALRM, updateprogressmeter);
- alarmtimer(1);
+ alarm(PROGRESSTIME);
} else if (flag == 1) {
- alarmtimer(0);
+ alarm(0);
atomicio(write, fileno(stdout), "\n", 1);
statbytes = 0;
}