Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3b06619e
Kaydet (Commit)
3b06619e
authored
Haz 04, 1991
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added popen().
Added getmtime() function for use by ".pyc" processing.
üst
c405b7b2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletion
+37
-1
posixmodule.c
Modules/posixmodule.c
+37
-1
No files found.
Modules/posixmodule.c
Dosyayı görüntüle @
3b06619e
...
...
@@ -427,7 +427,7 @@ posix_utime(self, args)
#ifndef MSDOS
/* Process
Primitive
s */
/* Process
operation
s */
static
object
*
posix__exit
(
self
,
args
)
...
...
@@ -544,6 +544,26 @@ posix_kill(self, args)
return
None
;
}
static
object
*
posix_popen
(
self
,
args
)
object
*
self
;
object
*
args
;
{
extern
int
pclose
PROTO
((
FILE
*
));
object
*
name
,
*
mode
;
FILE
*
fp
;
if
(
args
==
NULL
||
!
is_tupleobject
(
args
)
||
gettuplesize
(
args
)
!=
2
||
!
is_stringobject
(
name
=
gettupleitem
(
args
,
0
))
||
!
is_stringobject
(
mode
=
gettupleitem
(
args
,
1
)))
{
err_setstr
(
TypeError
,
"open() requires 2 string arguments"
);
return
NULL
;
}
fp
=
popen
(
getstringvalue
(
name
),
getstringvalue
(
mode
));
if
(
fp
==
NULL
)
return
posix_error
();
return
newopenfileobject
(
fp
,
name
,
mode
,
pclose
);
}
static
object
*
posix_wait
(
self
,
args
)
/* Also waitpid() */
object
*
self
;
...
...
@@ -644,6 +664,7 @@ static struct methodlist posix_methods[] = {
{
"getpid"
,
posix_getpid
},
{
"getppid"
,
posix_getppid
},
{
"kill"
,
posix_kill
},
{
"popen"
,
posix_popen
},
{
"wait"
,
posix_wait
},
#endif
#ifndef NO_LSTAT
...
...
@@ -675,6 +696,21 @@ initposix()
fatal
(
"can't define posix.error"
);
}
/* Function used elsewhere to get a file's modification time */
long
getmtime
(
path
)
char
*
path
;
{
struct
stat
st
;
if
(
stat
(
path
,
&
st
)
!=
0
)
return
-
1
;
else
return
st
.
st_mtime
;
}
#ifdef MSDOS
/* A small "compatibility library" for TurboC under MS-DOS */
...
...
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