aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/dc
diff options
context:
space:
mode:
authorGabor Kovesdan <gabor@FreeBSD.org>2010-02-03 19:13:41 +0000
committerGabor Kovesdan <gabor@FreeBSD.org>2010-02-03 19:13:41 +0000
commit4ef0890415a67872dd2b79e6b74b63ccfcd319b1 (patch)
tree9ae0000bbf342328463699531b982774871e0738 /usr.bin/dc
parent12360c49ddb7643f36a69fdfa5063fc12831c053 (diff)
downloadsrc-4ef0890415a67872dd2b79e6b74b63ccfcd319b1.tar.gz
src-4ef0890415a67872dd2b79e6b74b63ccfcd319b1.zip
Notes
Diffstat (limited to 'usr.bin/dc')
-rw-r--r--usr.bin/dc/bcode.c6
-rw-r--r--usr.bin/dc/dc.c12
2 files changed, 6 insertions, 12 deletions
diff --git a/usr.bin/dc/bcode.c b/usr.bin/dc/bcode.c
index 8b220080fc29..8be43b9043a6 100644
--- a/usr.bin/dc/bcode.c
+++ b/usr.bin/dc/bcode.c
@@ -1620,11 +1620,9 @@ skipN(void)
static void
skip_until_mark(void)
{
- int ch;
for (;;) {
- ch = readch();
- switch (ch) {
+ switch (readch()) {
case 'M':
return;
case EOF:
@@ -1649,7 +1647,7 @@ skip_until_mark(void)
free(read_string(&bmachine.readstack[bmachine.readsp]));
break;
case '!':
- switch (ch = readch()) {
+ switch (readch()) {
case '<':
case '>':
case '=':
diff --git a/usr.bin/dc/dc.c b/usr.bin/dc/dc.c
index fd412b856c21..08a95522b864 100644
--- a/usr.bin/dc/dc.c
+++ b/usr.bin/dc/dc.c
@@ -82,16 +82,8 @@ main(int argc, char *argv[])
{
int ch;
bool extended_regs = false;
- char *buf;
bool preproc_done = false;
- if ((buf = strdup("")) == NULL)
- err(1, NULL);
-
- init_bmachine(extended_regs);
- setlinebuf(stdout);
- setlinebuf(stderr);
-
/* accept and ignore a single dash to be 4.4BSD dc(1) compatible */
while ((ch = getopt_long(argc, argv, "e:f:Vx", long_options, NULL)) != -1) {
switch (ch) {
@@ -123,6 +115,10 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
+ init_bmachine(extended_regs);
+ setlinebuf(stdout);
+ setlinebuf(stderr);
+
if (argc > 1)
usage();
if (argc == 1) {