Checkpoint.
diff --git a/src/cmd/grap/find b/src/cmd/grap/find
index 1c2e905..eccbfbd 100644
--- a/src/cmd/grap/find
+++ b/src/cmd/grap/find
@@ -1 +1 @@
-exec /usr/bin/egrep -n "$1" *.[chyl]
+grep $1 *.[ch]
diff --git a/src/cmd/grap/frame.c b/src/cmd/grap/frame.c
index a00a9d8..6126087 100644
--- a/src/cmd/grap/frame.c
+++ b/src/cmd/grap/frame.c
@@ -53,6 +53,8 @@
 	int n;
 	char buf[100];
 
+	n = 0; /* gcc */
+
 	nsides++;
 	switch (type) {
 	case 0:		/* no side specified; kludge up all */
diff --git a/src/cmd/grap/grap.h b/src/cmd/grap/grap.h
index 65c7f83..da76108 100644
--- a/src/cmd/grap/grap.h
+++ b/src/cmd/grap/grap.h
@@ -110,7 +110,7 @@
 extern	int	lineno;
 extern	int	synerr;
 extern	int	codegen;
-extern	char	tempfile[];
+extern	char	*tempfile;
 extern	FILE	*tfd;
 
 extern	Point	ptmin, ptmax;
diff --git a/src/cmd/grap/input.c b/src/cmd/grap/input.c
index f558145..0c25bba 100644
--- a/src/cmd/grap/input.c
+++ b/src/cmd/grap/input.c
@@ -135,6 +135,7 @@
 	return tostring(buf);
 }
 
+int
 baldelim(int c, char *s)	/* replace c by balancing entry in s */
 {
 	for ( ; *s; s += 2)
@@ -175,6 +176,7 @@
 	pushsrc(Macro, stp->val);
 }
 
+int
 getarg(char *p)	/* pick up single argument, store in p, return length */
 {
 	int n, c, npar;
@@ -215,6 +217,7 @@
 extern	Obj	*thrudef;
 extern	char	*untilstr;
 
+int
 input(void)
 {
 	register int c;
@@ -230,10 +233,13 @@
 	return *ep++ = c;
 }
 
+int
 nextchar(void)
 {
 	register int c;
 
+	c = 0; /* gcc */
+
   loop:
 	switch (srcp->type) {
 	case Free:	/* free string */
@@ -384,6 +390,7 @@
 	pushsrc(Macro, thrudef->val);
 }
 
+int
 unput(int c)
 {
 	if (++pb >= pbuf + sizeof pbuf)
@@ -533,7 +540,7 @@
 	FILE *fin;
 
 	if (newfile) {
-		if ((fin = fopen(unsharp(newfile), "r")) == NULL)
+		if ((fin = fopen(newfile, "r")) == NULL)
 			ERROR "can't open file %s", newfile FATAL;
 		curfile++;
 		curfile->fin = fin;
diff --git a/src/cmd/grap/main.c b/src/cmd/grap/main.c
index 0aa6741..4179756 100644
--- a/src/cmd/grap/main.c
+++ b/src/cmd/grap/main.c
@@ -2,20 +2,20 @@
 #include <signal.h>
 #include <math.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <string.h>
 #include "grap.h"
 #include "y.tab.h"
 
+extern	char	*unsharp(char*);
+
 int	dbg	= 0;
 
-#ifndef GRAPDEFINES
-#define GRAPDEFINES "#9/sys/lib/grap.defines"
-#endif
-char	*lib_defines	= GRAPDEFINES;
+char	*lib_defines;
 
 int	lib	= 1;		/* 1 to include lib_defines */
 FILE	*tfd	= NULL;
-char	tempfile[L_tmpnam];
+char	*tempfile;
 
 int	synerr	= 0;
 int	codegen	= 0;   		/* 1=>output for this picture; 0=>no output */
@@ -32,17 +32,22 @@
 extern int yyparse(void);
 extern void setdefaults(void);
 extern void getdata(void);
-extern	int	unlink(char *);
 
+/* extern	int	unlink(char *); */ /* in unistd.h */
+
+int
 main(int argc, char *argv[])
 {
 	extern void onintr(int), fpecatch(int);
 
+	lib_defines = unsharp("#9/lib/grap.defines");
+
 	if (signal(SIGINT, SIG_IGN) != SIG_IGN)
 		signal(SIGINT, onintr);
 	signal(SIGFPE, fpecatch);
 	cmdname = argv[0];
-	tmpnam(tempfile);
+	tempfile = strdup("grap.XXXXXX");
+	mkstemp(tempfile);
 	while (argc > 1 && *argv[1] == '-') {
 		switch (argv[1][1]) {
 		case 'd':
@@ -85,7 +90,7 @@
 
 void onintr(int n)
 {
-	n;
+	//n;
 	if (!dbg)
 		unlink(tempfile);
 	exit(1);
@@ -114,11 +119,11 @@
 	char	*name;
 	double	val;
 } defaults[] ={
-	"frameht", FRAMEHT,
-	"framewid", FRAMEWID,
-	"ticklen", TICKLEN,
-	"slop", SLOP,
-	NULL, 0
+	{ "frameht", FRAMEHT },
+	{ "framewid", FRAMEWID },
+	{ "ticklen", TICKLEN },
+	{ "slop", SLOP },
+	{ NULL, 0 }
 };
 
 void setdefaults(void)	/* set default sizes for variables */
diff --git a/src/cmd/grap/print.c b/src/cmd/grap/print.c
index 8f553c8..9364d11 100644
--- a/src/cmd/grap/print.c
+++ b/src/cmd/grap/print.c
@@ -184,7 +184,7 @@
 	sprintf(buf, "define pid /%d/\n", getpid());
 	pbstr(buf);	
 	if (lib != 0) {
-		if ((fp = fopen(unsharp(lib_defines), "r")) != NULL) {
+		if ((fp = fopen(lib_defines, "r")) != NULL) {
 			sprintf(buf1, "copy \"%s\"\n", lib_defines);
 			pbstr(buf1);
 			fclose(fp);
@@ -226,8 +226,8 @@
 	if (tfd != NULL)
 		fclose(tfd);
 	if (tfd != stdout) {
-//		if (tfd != NULL)
-//			fclose(tfd);
+		if (tfd != NULL)
+			fclose(tfd);
 		if ((tfd = fopen(tempfile, "w")) == NULL) {
 			fprintf(stderr, "grap: can't open %s\n", tempfile);
 			exit(1);
diff --git a/src/cmd/grap/ticks.c b/src/cmd/grap/ticks.c
index 72fc06f..72c81b2 100644
--- a/src/cmd/grap/ticks.c
+++ b/src/cmd/grap/ticks.c
@@ -481,6 +481,7 @@
 		return p;
 }
 
+int
 sidelog(int logflag, int side)	/* figure out whether to scale a side */
 {
 	if ((logflag & XFLAG) && ((side & (BOT|TOP)) || side == 0))