shithub: sox

Download patch

ref: c3437a5a8a1389606a61f7bf0c7bb1f20d8d7cec
parent: fed56489592e3d3eba57c40fd8eb3e0bd9c60e16
author: rrt <rrt>
date: Sat Jan 27 10:47:49 EST 2007

A couple of fixes from Chris Lightfoot, who tested the build on
FreeBSD/i386 6.1.

Add test scripts to dist.

Fix sox.c/sigint() to use gettimeofday rather than the ancient (and
not-on-BSD-without-compatibility-mode) ftime.

--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,6 +33,8 @@
 sox_SOURCES = sox.c
 sox_LDADD = libst.la
 
+EXTRA_DIST = tests.sh testall.sh tests.bat testall.bat
+
 all: sox$(EXEEXT) play rec
 
 libgsm/libgsm.la:
--- a/src/sox.c
+++ b/src/sox.c
@@ -28,8 +28,8 @@
 #include <string.h>
 #include <stdlib.h>
 #include <signal.h>
+#include <sys/time.h>
 #include <time.h>
-#include <sys/timeb.h>
 #include <errno.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>             /* for unlink() */
@@ -740,15 +740,16 @@
 
 static void sigint(int s)
 {
-  static struct timeb then;
-  struct timeb now;
+  static struct timeval then;
+  struct timeval now;
   time_t secs;
-  ftime(&now);
-  secs = now.time - then.time;
+  gettimeofday(&now, NULL);
+  secs = now.tv_sec - then.tv_sec;
   if (show_progress && s == SIGINT && combine_method <= SOX_CONCAT &&
-      (secs > 1 || 1000 * secs + now.millitm - then.millitm > 999))
+      (secs > 1 || 1000000 * secs + now.tv_usec - then.tv_usec > 999999))
     user_skip = st_true;
-  else user_abort = st_true;
+  else
+    user_abort = st_true;
   then = now;
 }