Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
02cc38b5
Commit
02cc38b5
authored
Jul 31, 1994
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(my_strerror): New function.
(error_from_errno, perror_with_name): Use it. From-SVN: r7841
parent
71061807
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
9 deletions
+43
-9
gcc/cccp.c
+43
-9
No files found.
gcc/cccp.c
View file @
02cc38b5
...
@@ -93,7 +93,6 @@ typedef unsigned char U_CHAR;
...
@@ -93,7 +93,6 @@ typedef unsigned char U_CHAR;
/* VMS-specific definitions */
/* VMS-specific definitions */
#ifdef VMS
#ifdef VMS
#include <time.h>
#include <time.h>
#include <perror.h>
/* This defines sys_errlist/sys_nerr properly */
#include <descrip.h>
#include <descrip.h>
#define O_RDONLY 0
/* Open arg for Read/Only */
#define O_RDONLY 0
/* Open arg for Read/Only */
#define O_WRONLY 1
/* Open arg for Write/Only */
#define O_WRONLY 1
/* Open arg for Write/Only */
...
@@ -186,12 +185,20 @@ extern char *getenv ();
...
@@ -186,12 +185,20 @@ extern char *getenv ();
extern
FILE
*
fdopen
();
extern
FILE
*
fdopen
();
extern
char
*
version_string
;
extern
char
*
version_string
;
extern
struct
tm
*
localtime
();
extern
struct
tm
*
localtime
();
#ifndef VMS
#ifndef HAVE_STRERROR
extern
int
sys_nerr
;
extern
int
sys_nerr
;
#if defined(bsd4_4) || defined(__NetBSD__)
#if defined(bsd4_4) || defined(__NetBSD__)
extern
const
char
*
const
sys_errlist
[];
extern
const
char
*
const
sys_errlist
[];
#else
#else
extern
char
*
sys_errlist
[];
extern
char
*
sys_errlist
[];
#endif
#endif
#else
/* HAVE_STERRROR */
char
*
strerror
();
#endif
#else
/* VMS */
char
*
strerror
(
int
,...);
#endif
extern
int
parse_escape
();
extern
int
parse_escape
();
#ifndef errno
#ifndef errno
...
@@ -8387,6 +8394,39 @@ change_newlines (start, length)
...
@@ -8387,6 +8394,39 @@ change_newlines (start, length)
}
}
/*
/*
* my_strerror - return the descriptive text associated with an `errno' code.
*/
char
*
my_strerror
(
errnum
)
int
errnum
;
{
char
*
result
;
#ifndef VMS
#ifndef HAVE_STRERROR
result
=
(
char
*
)
((
errnum
<
sys_nerr
)
?
sys_errlist
[
errnum
]
:
0
);
#else
result
=
strerror
(
errnum
);
#endif
#else
/* VMS */
/* VAXCRTL's strerror() takes an optional second argument, which only
matters when the first argument is EVMSERR. However, it's simplest
just to pass it unconditionally. `vaxc$errno' is declared in
<errno.h>, and maintained by the library in parallel with `errno'.
We assume that caller's `errnum' either matches the last setting of
`errno' by the library or else does not have the value `EVMSERR'. */
result
=
strerror
(
errnum
,
vaxc
$
errno
);
#endif
if
(
!
result
)
result
=
"undocumented I/O error"
;
return
result
;
}
/*
* error - print error message and increment count of errors.
* error - print error message and increment count of errors.
*/
*/
...
@@ -8433,10 +8473,7 @@ error_from_errno (name)
...
@@ -8433,10 +8473,7 @@ error_from_errno (name)
if
(
ip
!=
NULL
)
if
(
ip
!=
NULL
)
fprintf
(
stderr
,
"%s:%d: "
,
ip
->
nominal_fname
,
ip
->
lineno
);
fprintf
(
stderr
,
"%s:%d: "
,
ip
->
nominal_fname
,
ip
->
lineno
);
if
(
errno
<
sys_nerr
)
fprintf
(
stderr
,
"%s: %s
\n
"
,
name
,
my_strerror
(
errno
));
fprintf
(
stderr
,
"%s: %s
\n
"
,
name
,
sys_errlist
[
errno
]);
else
fprintf
(
stderr
,
"%s: undocumented I/O error
\n
"
,
name
);
errors
++
;
errors
++
;
}
}
...
@@ -9395,10 +9432,7 @@ perror_with_name (name)
...
@@ -9395,10 +9432,7 @@ perror_with_name (name)
char
*
name
;
char
*
name
;
{
{
fprintf
(
stderr
,
"%s: "
,
progname
);
fprintf
(
stderr
,
"%s: "
,
progname
);
if
(
errno
<
sys_nerr
)
fprintf
(
stderr
,
"%s: %s
\n
"
,
name
,
my_strerror
(
errno
));
fprintf
(
stderr
,
"%s: %s
\n
"
,
name
,
sys_errlist
[
errno
]);
else
fprintf
(
stderr
,
"%s: undocumented I/O error
\n
"
,
name
);
errors
++
;
errors
++
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment