Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b6a47162
Commit
b6a47162
authored
Sep 15, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add strerror() interface.
parent
a2f626ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
Modules/posixmodule.c
Modules/posixmodule.c
+30
-2
No files found.
Modules/posixmodule.c
View file @
b6a47162
...
...
@@ -2006,7 +2006,7 @@ static char posix_putenv__doc__[] =
Change or add an environment variable."
;
static
PyObject
*
posix_putenv
(
self
,
args
)
posix_putenv
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
{
...
...
@@ -2026,7 +2026,32 @@ posix_putenv(self,args)
Py_INCREF
(
Py_None
);
return
Py_None
;
}
#endif
#endif
/* putenv */
#ifdef HAVE_STRERROR
static
char
posix_strerror__doc__
[]
=
"strerror(code) -> string
\n
\
Translate an error code to a message string."
;
PyObject
*
posix_strerror
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
{
int
code
;
char
*
message
;
if
(
!
PyArg_ParseTuple
(
args
,
"i"
,
&
code
))
return
NULL
;
message
=
strerror
(
code
);
if
(
message
==
NULL
)
{
PyErr_SetString
(
PyExc_ValueError
,
"strerror code out of range"
);
return
NULL
;
}
return
PyString_FromString
(
message
);
}
#endif
/* strerror */
static
PyMethodDef
posix_methods
[]
=
{
{
"chdir"
,
posix_chdir
,
0
,
posix_chdir__doc__
},
...
...
@@ -2151,6 +2176,9 @@ static PyMethodDef posix_methods[] = {
#endif
#ifdef HAVE_PUTENV
{
"putenv"
,
posix_putenv
,
1
,
posix_putenv__doc__
},
#endif
#ifdef HAVE_STRERROR
{
"strerror"
,
posix_strerror
,
1
,
posix_strerror__doc__
},
#endif
{
NULL
,
NULL
}
/* Sentinel */
};
...
...
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