From 4b1abd7cc9de9db1b49b877488b5c4ed93e43b7d Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 14 Jun 2000 21:07:58 +0000 Subject: [PATCH] Better error messages when opening include files git-svn-id: svn://svn.cc65.org/cc65/trunk@83 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/incpath.c | 5 ++--- src/cc65/error.c | 2 +- src/cc65/incpath.c | 3 +-- src/cc65/input.c | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/ca65/incpath.c b/src/ca65/incpath.c index 9021f44a6..80db9ed63 100644 --- a/src/ca65/incpath.c +++ b/src/ca65/incpath.c @@ -38,7 +38,6 @@ #if defined(_MSC_VER) /* Microsoft compiler */ # include -# define R_OK 4 #else /* Anyone else */ # include @@ -137,10 +136,10 @@ static char* Find (const char* Path, const char* File) strcpy (PathName + Count, File); /* Check if this file exists */ - if (access (PathName, R_OK) == 0) { + if (access (PathName, 0) == 0) { /* The file exists */ return xstrdup (PathName); - } + } /* Skip a list separator if we have one */ if (*P == ';') { diff --git a/src/cc65/error.c b/src/cc65/error.c index 6a2ab2aaf..dd2d17c57 100644 --- a/src/cc65/error.c +++ b/src/cc65/error.c @@ -101,7 +101,7 @@ static char* ErrMsg [ERR_COUNT-1] = { "`\"' or `<' expected", "Missing terminator or name too long", "Include file `%s' not found", - "Open failure on include file `%s'", + "Cannot open include file `%s': %s", "Invalid #error directive", "#error: %s", "Unexpected `#endif'", diff --git a/src/cc65/incpath.c b/src/cc65/incpath.c index 2776099b8..d0ba1f073 100644 --- a/src/cc65/incpath.c +++ b/src/cc65/incpath.c @@ -38,7 +38,6 @@ #if defined(_MSC_VER) /* Microsoft compiler */ # include -# define R_OK 4 #else /* Anyone else */ # include @@ -138,7 +137,7 @@ static char* Find (const char* Path, const char* File) strcpy (PathName + Count, File); /* Check if this file exists */ - if (access (PathName, R_OK) == 0) { + if (access (PathName, 0) == 0) { /* The file exists */ return xstrdup (PathName); } diff --git a/src/cc65/input.c b/src/cc65/input.c index a6845e281..72e157bdb 100644 --- a/src/cc65/input.c +++ b/src/cc65/input.c @@ -156,7 +156,7 @@ void OpenIncludeFile (const char* Name, unsigned DirSpec) F = fopen (N, "r"); if (F == 0) { /* Error opening the file */ - PPError (ERR_INCLUDE_OPEN_FAILURE, N); + PPError (ERR_INCLUDE_OPEN_FAILURE, N, strerror (errno)); xfree (N); return; }