aboutsummaryrefslogtreecommitdiffstats
path: root/eqn
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2016-10-23 00:24:25 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2016-10-23 00:24:25 +0000
commitab1717bb35d85041e0184f79daa1313a1306dc01 (patch)
treefa0739f76b49b902269f8f7c1e1c7c5ea30c0556 /eqn
parentaa7798c94fa57f6c00fab4393c9fe91334864371 (diff)
downloadsrc-ab1717bb35d85041e0184f79daa1313a1306dc01.tar.gz
src-ab1717bb35d85041e0184f79daa1313a1306dc01.zip
Import heirloom doctools snapshot 20161016vendor/heirloom-doctools/20161016
Notes
Notes: svn path=/vendor/heirloom-doctools/dist/; revision=307809 svn path=/vendor/heirloom-doctools/20161016/; revision=307810; tag=vendor/heirloom-doctools/20161016
Diffstat (limited to 'eqn')
-rw-r--r--eqn/checkeq.d/checkeq.c22
-rw-r--r--eqn/diacrit.c2
-rw-r--r--eqn/e.h16
-rw-r--r--eqn/eqnbox.c2
-rw-r--r--eqn/eqnchar.d/genutf8.c2
-rw-r--r--eqn/funny.c2
-rw-r--r--eqn/integral.c2
-rw-r--r--eqn/io.c14
-rw-r--r--eqn/lex.c12
-rw-r--r--eqn/lookup.c14
-rw-r--r--eqn/matrix.c2
-rw-r--r--eqn/paren.c2
-rw-r--r--eqn/shift.c2
-rw-r--r--eqn/text.c10
14 files changed, 37 insertions, 67 deletions
diff --git a/eqn/checkeq.d/checkeq.c b/eqn/checkeq.d/checkeq.c
index e925a17b0dfd..046b44011856 100644
--- a/eqn/checkeq.d/checkeq.c
+++ b/eqn/checkeq.d/checkeq.c
@@ -31,7 +31,6 @@ static const char sccsid[] USED = "@(#)/usr/ucb/checkeq.sl 4.1 (gritter) 9/15/05
#include <stdlib.h>
static void check(FILE *);
-static char *fgetline(char **, size_t *, FILE *);
static FILE *fin;
static int delim = '$';
@@ -62,7 +61,7 @@ check(FILE *f)
size_t insize = 0;
start = eq = line = ndel = totdel = 0;
- while (fgetline(&in, &insize, f) != NULL) {
+ while (getline(&in, &insize, f) > 0) {
line++;
ndel = 0;
for (p = in; *p; p++)
@@ -127,22 +126,3 @@ check(FILE *f)
if (eq)
printf(" Unfinished EQ\n");
}
-
-static char *
-fgetline(char **lp, size_t *zp, FILE *fp)
-{
- size_t n = 0;
- int c;
-
- while ((c = getc(fp)) != EOF) {
- if (n >= *zp)
- *lp = realloc(*lp, *zp += 600);
- (*lp)[n++] = c;
- if (c == '\n')
- break;
- }
- if (n >= *zp)
- *lp = realloc(*lp, *zp += 600);
- (*lp)[n] = 0;
- return c != EOF ? *lp : NULL;
-}
diff --git a/eqn/diacrit.c b/eqn/diacrit.c
index 07d0e1759467..e8265a2a0c2b 100644
--- a/eqn/diacrit.c
+++ b/eqn/diacrit.c
@@ -35,7 +35,7 @@ diacrit(int p1, int type) {
t = oalloc();
#ifdef NEQN
nrwid(p1, ps, p1);
- printf(".nr 10 %gu\n", max(eht[p1]-ebase[p1]-VERT(2),0));
+ printf(".nr 10 %gu\n", (float)max(eht[p1]-ebase[p1]-VERT(2),0));
#else /* NEQN */
effps = EFFPS(ps);
nrwid(p1, effps, p1);
diff --git a/eqn/e.h b/eqn/e.h
index 6c699fbe646d..25f8884cea8d 100644
--- a/eqn/e.h
+++ b/eqn/e.h
@@ -29,11 +29,6 @@
#include <inttypes.h>
#include "global.h"
-#if defined (__GLIBC__) && defined (_IO_getc_unlocked)
-#undef getc
-#define getc(f) _IO_getc_unlocked(f)
-#endif
-
#define FATAL 1
#define ROM '1'
#ifndef NEQN
@@ -92,8 +87,8 @@ extern int markline; /* 1 if this EQ/EN contains mark or lineup */
extern char *progname;
typedef struct s_tbl {
- char *name;
- char *defn;
+ const char *name;
+ const char *defn;
struct s_tbl *next;
} tbl;
extern char *spaceval; /* use in place of normal \x (for pic) */
@@ -125,7 +120,6 @@ int eqn(int, char **);
int getline(char **, size_t *);
void do_inline(void);
void putout(int);
-float max(float, float);
int oalloc(void);
void ofree(int);
void setps(float);
@@ -137,7 +131,7 @@ void error(int, const char *, ...);
/* lex.c */
int gtc(void);
int openinfile(void);
-void pbstr(register char *);
+void pbstr(register const char *);
int yylex(void);
int getstr(char *, register int);
int cstr(char *, int, int);
@@ -147,7 +141,7 @@ char *strsave(char *);
void include(void);
void delim(void);
/* lookup.c */
-tbl *lookup(tbl **, char *, char *);
+tbl *lookup(tbl **, const char *, const char *);
void init_tbl(void);
/* mark.c */
void mark(int);
@@ -161,7 +155,7 @@ void move(int, int, int);
void boverb(int, int);
/* paren.c */
void paren(int, int, int);
-void brack(int, char *, char *, char *);
+void brack(int, const char *, const char *, const char *);
/* pile.c */
void lpile(int, int, int);
/* shift.c */
diff --git a/eqn/eqnbox.c b/eqn/eqnbox.c
index c51f0a4b95dc..2a9a4bc5d832 100644
--- a/eqn/eqnbox.c
+++ b/eqn/eqnbox.c
@@ -37,7 +37,7 @@ eqnbox(int p1, int p2, int lu) {
#else /* NEQN */
int b, h;
#endif /* NEQN */
- char *sh;
+ const char *sh;
yyval.token = p1;
b = max(ebase[p1], ebase[p2]);
diff --git a/eqn/eqnchar.d/genutf8.c b/eqn/eqnchar.d/genutf8.c
index d43b3624411d..f9575121f29a 100644
--- a/eqn/eqnchar.d/genutf8.c
+++ b/eqn/eqnchar.d/genutf8.c
@@ -14,7 +14,7 @@
#include <wctype.h>
#include <stdio.h>
-const char *const ctl[] = {
+static const char *const ctl[] = {
"nul",
"soh",
"stx",
diff --git a/eqn/funny.c b/eqn/funny.c
index ba230e21ce3f..71f8d7caa239 100644
--- a/eqn/funny.c
+++ b/eqn/funny.c
@@ -32,7 +32,7 @@ extern YYSTYPE yyval;
void
funny(int n) {
- char *f = NULL;
+ const char *f = NULL;
yyval.token = oalloc();
switch(n) {
diff --git a/eqn/integral.c b/eqn/integral.c
index 55c2eb4949cb..b2dffa72023e 100644
--- a/eqn/integral.c
+++ b/eqn/integral.c
@@ -56,7 +56,7 @@ integral(int p, int p1, int p2) {
void
setintegral(void) {
- char *f;
+ const char *f;
yyval.token = oalloc();
f = "\\(is";
diff --git a/eqn/io.c b/eqn/io.c
index 6b4c490bcaec..116267ba14ec 100644
--- a/eqn/io.c
+++ b/eqn/io.c
@@ -26,9 +26,9 @@
#include <stdlib.h>
#include <libgen.h>
-char *in; /* input buffer */
-size_t insize; /* input buffer size */
-int noeqn;
+static char *in; /* input buffer */
+static size_t insize; /* input buffer size */
+static int noeqn;
int
main(int argc,char **argv) {
@@ -95,7 +95,8 @@ eqn(int argc,char **argv) {
int
getline(char **sp, size_t *np) {
- register int c, n = 0, esc = 0, par = 0, brack = 0;
+ register int c, esc = 0, par = 0, brack = 0;
+ size_t n = 0;
char *xp;
for (;;) {
c = gtc();
@@ -225,11 +226,6 @@ putout(int p1) {
}
-float
-max(float i,float j) {
- return (i>j ? i : j);
-}
-
int
oalloc(void) {
int i;
diff --git a/eqn/lex.c b/eqn/lex.c
index 2e7884efc170..6815801c92d3 100644
--- a/eqn/lex.c
+++ b/eqn/lex.c
@@ -34,12 +34,12 @@
extern YYSTYPE yyval;
#define SSIZE 400
-char token[SSIZE];
-int sp;
+static char token[SSIZE];
+static int sp;
#define putbak(c) *ip++ = c;
#define PUSHBACK 300 /* maximum pushback characters */
-char ibuf[PUSHBACK+SSIZE]; /* pushback buffer for definitions, etc. */
-char *ip = ibuf;
+static char ibuf[PUSHBACK+SSIZE]; /* pushback buffer for definitions, etc. */
+static char *ip = ibuf;
int
gtc(void) {
@@ -77,9 +77,9 @@ openinfile(void)
}
void
-pbstr(register char *str)
+pbstr(register const char *str)
{
- register char *p;
+ register const char *p;
p = str;
while (*p++);
diff --git a/eqn/lookup.c b/eqn/lookup.c
index 7b303fe9e0d4..fb31d181aea3 100644
--- a/eqn/lookup.c
+++ b/eqn/lookup.c
@@ -33,8 +33,8 @@ tbl *keytbl[TBLSIZE]; /* key words */
tbl *restbl[TBLSIZE]; /* reserved words */
tbl *deftbl[TBLSIZE]; /* user-defined names */
-struct {
- char *key;
+static struct {
+ const char *key;
int keyval;
} keyword[] ={
{ "sub", SUB },
@@ -104,9 +104,9 @@ struct {
{ NULL, 0 }
};
-struct {
- char *res;
- char *resval;
+static struct {
+ const char *res;
+ const char *resval;
} resword[] ={
{ ">=", "\\(>=" },
{ "<=", "\\(<=" },
@@ -220,11 +220,11 @@ struct {
};
tbl *
-lookup(tbl **tblp, char *name, char *defn) /* find name in tbl. if defn non-null, install */
+lookup(tbl **tblp, const char *name, const char *defn) /* find name in tbl. if defn non-null, install */
{
register tbl *p;
register int h;
- register unsigned char *s = (unsigned char *)name;
+ register unsigned const char *s = (unsigned const char *)name;
for (h = 0; *s != '\0'; )
h += *s++;
diff --git a/eqn/matrix.c b/eqn/matrix.c
index 53b674f4b227..85228e0572e0 100644
--- a/eqn/matrix.c
+++ b/eqn/matrix.c
@@ -52,7 +52,7 @@ matrix(int p1) {
int hb, b;
#endif /* NEQN */
int nrow, ncol, i, j, k, val[100];
- char *space;
+ const char *space;
space = "\\ \\ ";
nrow = lp[p1]; /* disaster if rows inconsistent */
diff --git a/eqn/paren.c b/eqn/paren.c
index a55febdb9635..38cef5961173 100644
--- a/eqn/paren.c
+++ b/eqn/paren.c
@@ -163,7 +163,7 @@ paren(int leftc, int p1, int rightc) {
}
void
-brack(int m, char *t, char *c, char *b) {
+brack(int m, const char *t, const char *c, const char *b) {
int j;
printf("\\b'%s", t);
for( j=0; j<m; j++)
diff --git a/eqn/shift.c b/eqn/shift.c
index 666a9c07a21c..d86c0acfd298 100644
--- a/eqn/shift.c
+++ b/eqn/shift.c
@@ -35,7 +35,7 @@ bshiftb(int p1, int dir, int p2) {
#ifndef NEQN
float shval, d1, h1, b1, h2, b2;
float diffps, effps, effps2;
- char *sh1, *sh2;
+ const char *sh1, *sh2;
#else /* NEQN */
int shval, d1, h1, b1, h2, b2;
#endif /* NEQN */
diff --git a/eqn/text.c b/eqn/text.c
index 7b7b58ff7f9f..6ad51c550f06 100644
--- a/eqn/text.c
+++ b/eqn/text.c
@@ -30,17 +30,17 @@
extern YYSTYPE yyval;
-int csp;
-int psp;
+static int csp;
+static int psp;
#define CSSIZE 400
-char cs[420];
+static char cs[420];
-int lf, rf; /* temporary spots for left and right fonts */
+static int lf, rf; /* temporary spots for left and right fonts */
void
text(int t,char *p1) {
int c;
- char *p;
+ const char *p;
tbl *tp;
extern tbl *restbl;