Line data Source code
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_CAST(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 644 : grp_getgrgid(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
21 : {
22 644 : 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 644 : args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
29 644 : if (!args) {
30 1 : goto exit;
31 : }
32 643 : id = args[0];
33 643 : return_value = grp_getgrgid_impl(module, id);
34 :
35 644 : exit:
36 644 : 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_CAST(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 87 : grp_getgrnam(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
55 : {
56 87 : 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 87 : args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
63 87 : if (!args) {
64 1 : goto exit;
65 : }
66 86 : if (!PyUnicode_Check(args[0])) {
67 0 : _PyArg_BadArgument("getgrnam", "argument 'name'", "str", args[0]);
68 0 : goto exit;
69 : }
70 86 : if (PyUnicode_READY(args[0]) == -1) {
71 0 : goto exit;
72 : }
73 86 : name = args[0];
74 86 : return_value = grp_getgrnam_impl(module, name);
75 :
76 87 : exit:
77 87 : 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 4 : grp_getgrall(PyObject *module, PyObject *Py_UNUSED(ignored))
97 : {
98 4 : return grp_getgrall_impl(module);
99 : }
100 : /*[clinic end generated code: output=ba680465f71ed779 input=a9049054013a1b77]*/
|