From a5823bfb1dfee6e3c3b285fdbc232f644083d1ef Mon Sep 17 00:00:00 2001 From: Mark Linton Date: Thu, 20 May 1982 03:35:44 -0800 Subject: [PATCH] added error handling for the "file" command SCCS-vsn: usr.bin/pascal/pdx/tree/eval.c 1.8 --- usr/src/usr.bin/pascal/pdx/tree/eval.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/usr/src/usr.bin/pascal/pdx/tree/eval.c b/usr/src/usr.bin/pascal/pdx/tree/eval.c index fe417212f0..feec3bf084 100644 --- a/usr/src/usr.bin/pascal/pdx/tree/eval.c +++ b/usr/src/usr.bin/pascal/pdx/tree/eval.c @@ -1,6 +1,6 @@ /* Copyright (c) 1982 Regents of the University of California */ -static char sccsid[] = "@(#)eval.c 1.7 %G%"; +static char sccsid[] = "@(#)eval.c 1.8 %G%"; /* * Parse tree evaluation. @@ -32,6 +32,7 @@ register NODE *p; { long r0, r1; double fr0, fr1; + FILE *fp; if (p == NULL) { return; @@ -264,7 +265,13 @@ register NODE *p; if (p->sconval == NIL) { printf("%s\n", cursource); } else { - skimsource(p->sconval); + fp = fopen(p->sconval, "r"); + if (fp == NIL) { + error("can't read \"%s\"", p->sconval); + } else { + fclose(fp); + skimsource(p->sconval); + } } break; -- 2.20.1