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)(void(*)(void))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 * |
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 = {NULL, _keywords, "getgrgid" , 0}; |
25 | PyObject *argsbuf[1]; |
26 | PyObject *id; |
27 | |
28 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); |
29 | if (!args) { |
30 | goto exit; |
31 | } |
32 | id = args[0]; |
33 | return_value = grp_getgrgid_impl(module, id); |
34 | |
35 | exit: |
36 | return return_value; |
37 | } |
38 | |
39 | PyDoc_STRVAR(grp_getgrnam__doc__, |
40 | "getgrnam($module, /, name)\n" |
41 | "--\n" |
42 | "\n" |
43 | "Return the group database entry for the given group name.\n" |
44 | "\n" |
45 | "If name is not valid, raise KeyError." ); |
46 | |
47 | #define GRP_GETGRNAM_METHODDEF \ |
48 | {"getgrnam", (PyCFunction)(void(*)(void))grp_getgrnam, METH_FASTCALL|METH_KEYWORDS, grp_getgrnam__doc__}, |
49 | |
50 | static PyObject * |
51 | grp_getgrnam_impl(PyObject *module, PyObject *name); |
52 | |
53 | static PyObject * |
54 | grp_getgrnam(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
55 | { |
56 | PyObject *return_value = NULL; |
57 | static const char * const _keywords[] = {"name" , NULL}; |
58 | static _PyArg_Parser _parser = {NULL, _keywords, "getgrnam" , 0}; |
59 | PyObject *argsbuf[1]; |
60 | PyObject *name; |
61 | |
62 | args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); |
63 | if (!args) { |
64 | goto exit; |
65 | } |
66 | if (!PyUnicode_Check(args[0])) { |
67 | _PyArg_BadArgument("getgrnam" , "argument 'name'" , "str" , args[0]); |
68 | goto exit; |
69 | } |
70 | if (PyUnicode_READY(args[0]) == -1) { |
71 | goto exit; |
72 | } |
73 | name = args[0]; |
74 | return_value = grp_getgrnam_impl(module, name); |
75 | |
76 | exit: |
77 | return return_value; |
78 | } |
79 | |
80 | PyDoc_STRVAR(grp_getgrall__doc__, |
81 | "getgrall($module, /)\n" |
82 | "--\n" |
83 | "\n" |
84 | "Return a list of all available group entries, in arbitrary order.\n" |
85 | "\n" |
86 | "An entry whose name starts with \'+\' or \'-\' represents an instruction\n" |
87 | "to use YP/NIS and may not be accessible via getgrnam or getgrgid." ); |
88 | |
89 | #define GRP_GETGRALL_METHODDEF \ |
90 | {"getgrall", (PyCFunction)grp_getgrall, METH_NOARGS, grp_getgrall__doc__}, |
91 | |
92 | static PyObject * |
93 | grp_getgrall_impl(PyObject *module); |
94 | |
95 | static PyObject * |
96 | grp_getgrall(PyObject *module, PyObject *Py_UNUSED(ignored)) |
97 | { |
98 | return grp_getgrall_impl(module); |
99 | } |
100 | /*[clinic end generated code: output=9b3f26779e4e1a52 input=a9049054013a1b77]*/ |
101 | |