summaryrefslogtreecommitdiffstats
path: root/term-utils
diff options
context:
space:
mode:
Diffstat (limited to 'term-utils')
-rw-r--r--term-utils/Makemodule.am1
-rw-r--r--term-utils/scriptreplay.c17
2 files changed, 5 insertions, 13 deletions
diff --git a/term-utils/Makemodule.am b/term-utils/Makemodule.am
index ea1affcdc..8ddb0687b 100644
--- a/term-utils/Makemodule.am
+++ b/term-utils/Makemodule.am
@@ -21,6 +21,7 @@ if BUILD_SCRIPTREPLAY
usrbin_exec_PROGRAMS += scriptreplay
dist_man_MANS += term-utils/scriptreplay.1
scriptreplay_SOURCES = term-utils/scriptreplay.c
+scriptreplay_LDADD = $(LDADD) libcommon.la
endif # BUILD_SCRIPTREPLAY
diff --git a/term-utils/scriptreplay.c b/term-utils/scriptreplay.c
index 51985cda8..146133518 100644
--- a/term-utils/scriptreplay.c
+++ b/term-utils/scriptreplay.c
@@ -30,6 +30,7 @@
#include "closestream.h"
#include "nls.h"
+#include "strutils.h"
#include "c.h"
#define SCRIPT_MIN_DELAY 0.0001 /* from original sripreplay.pl */
@@ -60,21 +61,11 @@ usage(FILE *out)
static double
getnum(const char *s)
{
- double d;
- char *end;
+ const double d = strtod_or_err(s, _("failed to parse number"));
- errno = 0;
- d = strtod(s, &end);
-
- if (end && *end != '\0')
- errx(EXIT_FAILURE, _("expected a number, but got '%s'"), s);
-
- if ((d == HUGE_VAL || d == -HUGE_VAL) && ERANGE == errno)
- err(EXIT_FAILURE, _("divisor '%s'"), s);
-
- if (!(d==d)) { /* did they specify "nan"? */
+ if (isnan(d)) {
errno = EINVAL;
- err(EXIT_FAILURE, _("divisor '%s'"), s);
+ err(EXIT_FAILURE, "%s: %s", _("failed to parse number"), s);
}
return d;
}