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
f1af3fe8
Commit
f1af3fe8
authored
Jul 23, 1996
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added simple-minded (i.e. leaking :-) putenv() interface, if os has it.
parent
761f7922
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
Modules/posixmodule.c
Modules/posixmodule.c
+27
-0
No files found.
Modules/posixmodule.c
View file @
f1af3fe8
...
...
@@ -1596,6 +1596,30 @@ posix_ftruncate(self, args)
}
#endif
#ifdef HAVE_PUTENV
static
object
*
posix_putenv
(
self
,
args
)
object
*
self
;
object
*
args
;
{
char
*
s1
,
*
s2
;
char
*
new
;
if
(
!
newgetargs
(
args
,
"ss"
,
&
s1
,
&
s2
))
return
NULL
;
/* XXX This leaks memory -- not easy to fix :-( */
if
((
new
=
malloc
(
strlen
(
s1
)
+
strlen
(
s2
)
+
2
))
==
NULL
)
return
err_nomem
();
(
void
)
sprintf
(
new
,
"%s=%s"
,
s1
,
s2
);
if
(
putenv
(
new
))
{
posix_error
();
return
NULL
;
}
INCREF
(
None
);
return
None
;
}
#endif
static
struct
methodlist
posix_methods
[]
=
{
{
"chdir"
,
posix_chdir
},
{
"chmod"
,
posix_chmod
},
...
...
@@ -1716,6 +1740,9 @@ static struct methodlist posix_methods[] = {
#endif
#ifdef HAVE_FTRUNCATE
{
"ftruncate"
,
posix_ftruncate
,
1
},
#endif
#ifdef HAVE_PUTENV
{
"putenv"
,
posix_putenv
,
1
},
#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