Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/usr.bin/audio/record pull up revs 1.7-1.8 from trunk (r...



details:   https://anonhg.NetBSD.org/src/rev/fecf093e89f7
branches:  netbsd-1-4
changeset: 469513:fecf093e89f7
user:      cgd <cgd%NetBSD.org@localhost>
date:      Mon Sep 27 05:28:31 1999 +0000

description:
pull up revs 1.7-1.8 from trunk (requested by mrg):
  Fix audiorecord(1)'s "-t" option so that it actually works.

diffstat:

 usr.bin/audio/record/record.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (59 lines):

diff -r 4be75b1b29b4 -r fecf093e89f7 usr.bin/audio/record/record.c
--- a/usr.bin/audio/record/record.c     Mon Sep 27 05:26:24 1999 +0000
+++ b/usr.bin/audio/record/record.c     Mon Sep 27 05:28:31 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: record.c,v 1.4.2.1 1999/06/23 14:03:01 perry Exp $     */
+/*     $NetBSD: record.c,v 1.4.2.2 1999/09/27 05:28:31 cgd Exp $       */
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -84,7 +84,7 @@
 {
        char    *buffer;
        size_t  len, bufsize;
-       int     ch;
+       int     ch, no_time_limit = 1;
 
        while ((ch = getopt(argc, argv, "ab:C:c:d:e:fhi:m:P:p:qt:s:Vv:")) != -1) {
                switch (ch) {
@@ -150,6 +150,7 @@
                                errx(1, "sample rate must be between 0 and 96000\n");
                        break;
                case 't':
+                       no_time_limit = 0;
                        decode_time(optarg, &record_time);
                        break;
                case 'V':
@@ -256,7 +257,7 @@
        total_size = 0;
 
        (void)gettimeofday(&start_time, NULL);
-       while (timeleft(&start_time, &record_time)) {
+       while (no_time_limit || timeleft(&start_time, &record_time)) {
                if (read(audiofd, buffer, bufsize) != bufsize)
                        err(1, "read failed");
                if (write(outfd, buffer, bufsize) != bufsize)
@@ -274,8 +275,8 @@
        struct timeval now, diff;
 
        (void)gettimeofday(&now, NULL);
-       timersub(&diff, &now, start_tvp);
-       timersub(&now, record_tvp, &diff);
+       timersub(&now, start_tvp, &diff);
+       timersub(record_tvp, &diff, &now);
 
        return (now.tv_sec > 0 || (now.tv_sec == 0 && now.tv_usec > 0));
 }
@@ -298,11 +299,10 @@
        exit(0);
 }
 
-sun_audioheader auh;
-
 void
 write_header()
 {
+       sun_audioheader auh;
        struct iovec iv[3];
        int veclen = 0, left, tlen = 0;
 



Home | Main Index | Thread Index | Old Index