Better error messages when opening include files

git-svn-id: svn://svn.cc65.org/cc65/trunk@83 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2000-06-14 21:07:58 +00:00
parent aa8737733f
commit 4b1abd7cc9
4 changed files with 5 additions and 7 deletions

View File

@@ -38,7 +38,6 @@
#if defined(_MSC_VER) #if defined(_MSC_VER)
/* Microsoft compiler */ /* Microsoft compiler */
# include <io.h> # include <io.h>
# define R_OK 4
#else #else
/* Anyone else */ /* Anyone else */
# include <unistd.h> # include <unistd.h>
@@ -137,7 +136,7 @@ static char* Find (const char* Path, const char* File)
strcpy (PathName + Count, File); strcpy (PathName + Count, File);
/* Check if this file exists */ /* Check if this file exists */
if (access (PathName, R_OK) == 0) { if (access (PathName, 0) == 0) {
/* The file exists */ /* The file exists */
return xstrdup (PathName); return xstrdup (PathName);
} }

View File

@@ -101,7 +101,7 @@ static char* ErrMsg [ERR_COUNT-1] = {
"`\"' or `<' expected", "`\"' or `<' expected",
"Missing terminator or name too long", "Missing terminator or name too long",
"Include file `%s' not found", "Include file `%s' not found",
"Open failure on include file `%s'", "Cannot open include file `%s': %s",
"Invalid #error directive", "Invalid #error directive",
"#error: %s", "#error: %s",
"Unexpected `#endif'", "Unexpected `#endif'",

View File

@@ -38,7 +38,6 @@
#if defined(_MSC_VER) #if defined(_MSC_VER)
/* Microsoft compiler */ /* Microsoft compiler */
# include <io.h> # include <io.h>
# define R_OK 4
#else #else
/* Anyone else */ /* Anyone else */
# include <unistd.h> # include <unistd.h>
@@ -138,7 +137,7 @@ static char* Find (const char* Path, const char* File)
strcpy (PathName + Count, File); strcpy (PathName + Count, File);
/* Check if this file exists */ /* Check if this file exists */
if (access (PathName, R_OK) == 0) { if (access (PathName, 0) == 0) {
/* The file exists */ /* The file exists */
return xstrdup (PathName); return xstrdup (PathName);
} }

View File

@@ -156,7 +156,7 @@ void OpenIncludeFile (const char* Name, unsigned DirSpec)
F = fopen (N, "r"); F = fopen (N, "r");
if (F == 0) { if (F == 0) {
/* Error opening the file */ /* Error opening the file */
PPError (ERR_INCLUDE_OPEN_FAILURE, N); PPError (ERR_INCLUDE_OPEN_FAILURE, N, strerror (errno));
xfree (N); xfree (N);
return; return;
} }