1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 PyDoc_STRVAR(grp_getgrgid__doc__,
6 "getgrgid($module, /, id)\n"
7 "--\n"
8 "\n"
9 "Return the group database entry for the given numeric group ID.\n"
10 "\n"
11 "If id is not valid, raise KeyError.");
12
13 #define GRP_GETGRGID_METHODDEF \
14 {"getgrgid", (PyCFunction)grp_getgrgid, METH_FASTCALL|METH_KEYWORDS, grp_getgrgid__doc__},
15
16 static PyObject *
17 grp_getgrgid_impl(PyObject *module, PyObject *id);
18
19 static PyObject *
grp_getgrgid(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)20 grp_getgrgid(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
21 {
22 PyObject *return_value = NULL;
23 static const char * const _keywords[] = {"id", NULL};
24 static _PyArg_Parser _parser = {"O:getgrgid", _keywords, 0};
25 PyObject *id;
26
27 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
28 &id)) {
29 goto exit;
30 }
31 return_value = grp_getgrgid_impl(module, id);
32
33 exit:
34 return return_value;
35 }
36
37 PyDoc_STRVAR(grp_getgrnam__doc__,
38 "getgrnam($module, /, name)\n"
39 "--\n"
40 "\n"
41 "Return the group database entry for the given group name.\n"
42 "\n"
43 "If name is not valid, raise KeyError.");
44
45 #define GRP_GETGRNAM_METHODDEF \
46 {"getgrnam", (PyCFunction)grp_getgrnam, METH_FASTCALL|METH_KEYWORDS, grp_getgrnam__doc__},
47
48 static PyObject *
49 grp_getgrnam_impl(PyObject *module, PyObject *name);
50
51 static PyObject *
grp_getgrnam(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)52 grp_getgrnam(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
53 {
54 PyObject *return_value = NULL;
55 static const char * const _keywords[] = {"name", NULL};
56 static _PyArg_Parser _parser = {"U:getgrnam", _keywords, 0};
57 PyObject *name;
58
59 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
60 &name)) {
61 goto exit;
62 }
63 return_value = grp_getgrnam_impl(module, name);
64
65 exit:
66 return return_value;
67 }
68
69 PyDoc_STRVAR(grp_getgrall__doc__,
70 "getgrall($module, /)\n"
71 "--\n"
72 "\n"
73 "Return a list of all available group entries, in arbitrary order.\n"
74 "\n"
75 "An entry whose name starts with \'+\' or \'-\' represents an instruction\n"
76 "to use YP/NIS and may not be accessible via getgrnam or getgrgid.");
77
78 #define GRP_GETGRALL_METHODDEF \
79 {"getgrall", (PyCFunction)grp_getgrall, METH_NOARGS, grp_getgrall__doc__},
80
81 static PyObject *
82 grp_getgrall_impl(PyObject *module);
83
84 static PyObject *
grp_getgrall(PyObject * module,PyObject * Py_UNUSED (ignored))85 grp_getgrall(PyObject *module, PyObject *Py_UNUSED(ignored))
86 {
87 return grp_getgrall_impl(module);
88 }
89 /*[clinic end generated code: output=0ccba09e8ec14c81 input=a9049054013a1b77]*/
90