aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2020-12-26 21:21:49 +0000
committerStefan Eßer <se@FreeBSD.org>2020-12-27 21:32:22 +0000
commit50fcb4ee771cabbae99bb3150b26484f3e573fab (patch)
tree815de7578e7f7a1b18fd258f188e697416df3f9a
parent3fee777ec5a2e91ffbd9b396e99edae386eb150e (diff)
-rw-r--r--bin/stty/gfmt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/stty/gfmt.c b/bin/stty/gfmt.c
index 055edf880bd6..12ed2a2d3500 100644
--- a/bin/stty/gfmt.c
+++ b/bin/stty/gfmt.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "stty.h"
@@ -85,7 +86,7 @@ gread(struct termios *tp, char *s)
if (!(ep = strchr(p, '=')))
gerr(p);
*ep++ = '\0';
- (void)sscanf(ep, "%lx", (u_long *)&tmp);
+ tmp = strtoul(ep, NULL, 0x10);
#define CHK(s) (*p == s[0] && !strcmp(p, s))
if (CHK("cflag")) {
@@ -97,7 +98,7 @@ gread(struct termios *tp, char *s)
continue;
}
if (CHK("ispeed")) {
- (void)sscanf(ep, "%ld", &tmp);
+ tmp = strtoul(ep, NULL, 10);
tp->c_ispeed = tmp;
continue;
}
@@ -110,14 +111,14 @@ gread(struct termios *tp, char *s)
continue;
}
if (CHK("ospeed")) {
- (void)sscanf(ep, "%ld", &tmp);
+ tmp = strtoul(ep, NULL, 10);
tp->c_ospeed = tmp;
continue;
}
for (cp = cchars1; cp->name != NULL; ++cp)
if (CHK(cp->name)) {
if (cp->sub == VMIN || cp->sub == VTIME)
- (void)sscanf(ep, "%ld", &tmp);
+ tmp = strtoul(ep, NULL, 10);
tp->c_cc[cp->sub] = tmp;
break;
}