bc: sync with OpenBSD

tty.c Rev. 1.3
Avoid unintended problems with operator precedence when doing an
assignment and comparison.

bc.1, Rev. 1.31, 1.32
'.Ql Quit' -> '.Ql quit' because only the lowercase command is valid.
Clarify sentence about `quit` in BUGS section.

extern.h, Rev. 1.12
whitespace

bc.y, Rev. 1.47
Prefer setvbuf() to setlinebuf() for portability

Obtained from:	OpenBSD
MFC after:	2 weeks
This commit is contained in:
Pedro F. Giffuni 2015-11-22 02:43:14 +00:00
parent 181f3573ee
commit bafb3a75ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=291155
4 changed files with 14 additions and 13 deletions

View file

@ -1,5 +1,5 @@
.\" $FreeBSD$ .\" $FreeBSD$
.\" $OpenBSD: bc.1,v 1.30 2014/01/14 07:42:42 jmc Exp $ .\" $OpenBSD: bc.1,v 1.32 2015/11/17 05:45:35 mmcc Exp $
.\" .\"
.\" Copyright (C) Caldera International Inc. 2001-2002. .\" Copyright (C) Caldera International Inc. 2001-2002.
.\" All rights reserved. .\" All rights reserved.
@ -35,7 +35,7 @@
.\" .\"
.\" @(#)bc.1 6.8 (Berkeley) 8/8/91 .\" @(#)bc.1 6.8 (Berkeley) 8/8/91
.\" .\"
.Dd April 16, 2014 .Dd November 21 2015
.Dt BC 1 .Dt BC 1
.Os .Os
.Sh NAME .Sh NAME
@ -407,8 +407,9 @@ The current version of the
utility was written by utility was written by
.An Otto Moerbeek . .An Otto Moerbeek .
.Sh BUGS .Sh BUGS
.Ql Quit The
is interpreted when read, not when executed. .Ql quit
statement is interpreted when read, not when executed.
.Pp .Pp
Some non-portable extensions, as found in the GNU version of the Some non-portable extensions, as found in the GNU version of the
.Nm .Nm

View file

@ -1125,7 +1125,7 @@ main(int argc, char *argv[])
int ch, i; int ch, i;
init(); init();
setlinebuf(stdout); setvbuf(stdout, NULL, _IOLBF, 0);
sargv = malloc(argc * sizeof(char *)); sargv = malloc(argc * sizeof(char *));
if (sargv == NULL) if (sargv == NULL)

View file

@ -1,5 +1,5 @@
/* $FreeBSD$ */ /* $FreeBSD$ */
/* $OpenBSD: extern.h,v 1.10 2013/09/19 16:12:01 otto Exp $ */ /* $OpenBSD: extern.h,v 1.12 2014/04/17 19:07:14 otto Exp $ */
/* /*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net> * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@ -39,9 +39,9 @@ extern int fileindex;
extern int sargc; extern int sargc;
extern const char **sargv; extern const char **sargv;
extern const char *filename; extern const char *filename;
extern bool interactive; extern bool interactive;
extern EditLine *el; extern EditLine *el;
extern History *hist; extern History *hist;
extern HistEvent he; extern HistEvent he;
extern char *cmdexpr; extern char *cmdexpr;
extern struct termios ttysaved; extern struct termios ttysaved;

View file

@ -1,5 +1,5 @@
/* $FreeBSD$ */ /* $FreeBSD$ */
/* $OpenBSD: tty.c,v 1.2 2013/11/12 13:54:51 deraadt Exp $ */ /* $OpenBSD: tty.c,v 1.3 2015/09/05 09:49:24 jsg Exp $ */
/* /*
* Copyright (c) 2013, Otto Moerbeek <otto@drijf.net> * Copyright (c) 2013, Otto Moerbeek <otto@drijf.net>
@ -30,7 +30,7 @@ settty(struct termios *t)
{ {
int ret; int ret;
while ((ret = tcsetattr(0, TCSADRAIN, t) == -1) && errno == EINTR) while ((ret = tcsetattr(0, TCSADRAIN, t)) == -1 && errno == EINTR)
continue; continue;
return ret; return ret;
} }
@ -40,7 +40,7 @@ gettty(struct termios *t)
{ {
int ret; int ret;
while ((ret = tcgetattr(0, t) == -1) && errno == EINTR) while ((ret = tcgetattr(0, t)) == -1 && errno == EINTR)
continue; continue;
return ret; return ret;
} }