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
4c803f1c
Kaydet (Commit)
4c803f1c
authored
May 25, 2006
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Move over to use of METH_O and METH_NOARGS.
üst
45c6472f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
grpmodule.c
Modules/grpmodule.c
+24
-12
No files found.
Modules/grpmodule.c
Dosyayı görüntüle @
4c803f1c
...
...
@@ -84,12 +84,18 @@ mkgrent(struct group *p)
}
static
PyObject
*
grp_getgrgid
(
PyObject
*
self
,
PyObject
*
args
)
grp_getgrgid
(
PyObject
*
self
,
PyObject
*
pyo_id
)
{
PyObject
*
py_int_id
;
unsigned
int
gid
;
struct
group
*
p
;
if
(
!
PyArg_ParseTuple
(
args
,
"I:getgrgid"
,
&
gid
))
return
NULL
;
py_int_id
=
PyNumber_Int
(
pyo_id
);
if
(
!
py_int_id
)
return
NULL
;
gid
=
PyInt_AS_LONG
(
py_int_id
);
Py_DECREF
(
py_int_id
);
if
((
p
=
getgrgid
(
gid
))
==
NULL
)
{
PyErr_Format
(
PyExc_KeyError
,
"getgrgid(): gid not found: %d"
,
gid
);
return
NULL
;
...
...
@@ -98,27 +104,33 @@ grp_getgrgid(PyObject *self, PyObject *args)
}
static
PyObject
*
grp_getgrnam
(
PyObject
*
self
,
PyObject
*
args
)
grp_getgrnam
(
PyObject
*
self
,
PyObject
*
pyo_name
)
{
PyObject
*
py_str_name
;
char
*
name
;
struct
group
*
p
;
if
(
!
PyArg_ParseTuple
(
args
,
"s:getgrnam"
,
&
name
))
return
NULL
;
py_str_name
=
PyObject_Str
(
pyo_name
);
if
(
!
py_str_name
)
return
NULL
;
name
=
PyString_AS_STRING
(
py_str_name
);
if
((
p
=
getgrnam
(
name
))
==
NULL
)
{
PyErr_Format
(
PyExc_KeyError
,
"getgrnam(): name not found: %s"
,
name
);
Py_DECREF
(
py_str_name
);
return
NULL
;
}
Py_DECREF
(
py_str_name
);
return
mkgrent
(
p
);
}
static
PyObject
*
grp_getgrall
(
PyObject
*
self
,
PyObject
*
args
)
grp_getgrall
(
PyObject
*
self
,
PyObject
*
ignore
)
{
PyObject
*
d
;
struct
group
*
p
;
if
(
!
PyArg_ParseTuple
(
args
,
":getgrall"
))
return
NULL
;
if
((
d
=
PyList_New
(
0
))
==
NULL
)
return
NULL
;
setgrent
();
...
...
@@ -136,15 +148,15 @@ grp_getgrall(PyObject *self, PyObject *args)
}
static
PyMethodDef
grp_methods
[]
=
{
{
"getgrgid"
,
grp_getgrgid
,
METH_
VARARGS
,
{
"getgrgid"
,
grp_getgrgid
,
METH_
O
,
"getgrgid(id) -> tuple
\n
\
Return the group database entry for the given numeric group ID. If
\n
\
id is not valid, raise KeyError."
},
{
"getgrnam"
,
grp_getgrnam
,
METH_
VARARGS
,
{
"getgrnam"
,
grp_getgrnam
,
METH_
O
,
"getgrnam(name) -> tuple
\n
\
Return the group database entry for the given group name. If
\n
\
name is not valid, raise KeyError."
},
{
"getgrall"
,
grp_getgrall
,
METH_
VAR
ARGS
,
{
"getgrall"
,
grp_getgrall
,
METH_
NO
ARGS
,
"getgrall() -> list of tuples
\n
\
Return a list of all available group entries, in arbitrary order."
},
{
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