commit d27a48633aa0785c213ed37c5cd72f919818eb1b
parent ed21e29ea4465ee431ddf57c02869955b47d74a2
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 21 Nov 2014 20:11:22 +0100
bc: fix build (but needs more work)
Diffstat:
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/bc/Makefile b/bc/Makefile
@@ -1,13 +1,14 @@
-# $OpenBSD: Makefile,v 1.7 2013/09/19 16:12:00 otto Exp $
-
build: clean
- yacc bc.y
- flex scan.l
- cc *.c -o bc -ledit -lcurses
+ ../yacc/yacc -d bc.y
+ ../lex/lex -oscan.c scan.l
+ cc -c reallocarray.c
+ cc -c y.tab.c scan.c tty.c
+ cc -o bc scan.o tty.o y.tab.o reallocarray.o -ledit -lcurses
clean:
- rm -f bc *.o
+ rm -f bc *.o y.tab.c y.tab.h scan.c
+# $OpenBSD: Makefile,v 1.7 2013/09/19 16:12:00 otto Exp $
#PROG= bc
#SRCS= bc.y scan.l tty.c
#CPPFLAGS+= -I. -I${.CURDIR}
diff --git a/bc/bc.y b/bc/bc.y
@@ -42,10 +42,12 @@
#include <signal.h>
#include <stdarg.h>
#include <string.h>
+#include <stdlib.h>
#include <unistd.h>
#include "extern.h"
#include "pathnames.h"
+#include "util.h"
#define END_NODE ((ssize_t) -1)
#define CONST_STRING ((ssize_t) -2)
@@ -85,7 +87,7 @@ static void add_par(ssize_t);
static void add_local(ssize_t);
static void warning(const char *);
static void init(void);
-static __dead void usage(void);
+static void usage(void);
static char *escape(const char *);
static ssize_t instr_sz = 0;
@@ -994,7 +996,7 @@ init(void)
}
-static __dead void
+static void
usage(void)
{
fprintf(stderr, "usage: %s [-cl] [-e expression] [file ...]\n",
diff --git a/bc/extern.h b/bc/extern.h
@@ -16,6 +16,9 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifndef EXTERN_H
+#define EXTERN_H
+
#include <stdbool.h>
#include <stdio.h>
@@ -46,3 +49,5 @@ extern History *hist;
extern HistEvent he;
extern char *cmdexpr;
extern struct termios ttysaved;
+
+#endif