summaryrefslogtreecommitdiffstats
path: root/isys/isys.c
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-08-26 13:02:23 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-08-26 13:02:23 -1000
commit2302f8d4823b2cecd8e83b497354324d88e697c6 (patch)
treeb0b3439237375de7165b7d4042db403e95a99147 /isys/isys.c
parent9b4df3ca71129976a44f1f5aa4c46c64bcdc2fab (diff)
downloadanaconda-2302f8d4823b2cecd8e83b497354324d88e697c6.tar.gz
anaconda-2302f8d4823b2cecd8e83b497354324d88e697c6.tar.xz
anaconda-2302f8d4823b2cecd8e83b497354324d88e697c6.zip
Remove isys.getopt()
Code isn't used anywhere in anaconda anymore.
Diffstat (limited to 'isys/isys.c')
-rw-r--r--isys/isys.c148
1 files changed, 0 insertions, 148 deletions
diff --git a/isys/isys.c b/isys/isys.c
index 21592cde9..d583da45b 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -87,9 +87,6 @@
#define CDROMEJECT 0x5309
#endif
-static PyObject * doGetOpt(PyObject * s, PyObject * args);
-/*static PyObject * doInsmod(PyObject * s, PyObject * args);
-static PyObject * doRmmod(PyObject * s, PyObject * args);*/
static PyObject * doMount(PyObject * s, PyObject * args);
static PyObject * doUMount(PyObject * s, PyObject * args);
static PyObject * smpAvailable(PyObject * s, PyObject * args);
@@ -151,7 +148,6 @@ static PyMethodDef isysModuleMethods[] = {
{ "losetup", (PyCFunction) doLoSetup, METH_VARARGS, NULL },
{ "unlosetup", (PyCFunction) doUnLoSetup, METH_VARARGS, NULL },
{ "ddfile", (PyCFunction) doDdFile, METH_VARARGS, NULL },
- { "getopt", (PyCFunction) doGetOpt, METH_VARARGS, NULL },
{ "mount", (PyCFunction) doMount, METH_VARARGS, NULL },
{ "smpavailable", (PyCFunction) smpAvailable, METH_VARARGS, NULL },
{ "htavailable", (PyCFunction) htAvailable, METH_VARARGS, NULL },
@@ -273,150 +269,6 @@ static PyObject * doLoSetup(PyObject * s, PyObject * args) {
return Py_None;
}
-static PyObject * doGetOpt(PyObject * s, PyObject * pyargs) {
- PyObject * argList, * longArgs, * strObject;
- PyObject * retList, * retArgs;
- char * shortArgs;
- struct poptOption * options;
- int numOptions, i, rc;
- char * ch;
- poptContext optCon;
- char * str;
- char * error;
- const char ** argv;
- char strBuf[3];
-
- if (!PyArg_ParseTuple(pyargs, "OsO", &argList, &shortArgs, &longArgs))
- return NULL;
-
- if (!(PyList_Check(argList))) {
- PyErr_SetString(PyExc_TypeError, "list expected");
- }
- if (!(PyList_Check(longArgs))) {
- PyErr_SetString(PyExc_TypeError, "list expected");
- }
-
- numOptions = PyList_Size(longArgs);
- for (ch = shortArgs; *ch; ch++)
- if (*ch != ':') numOptions++;
-
- options = alloca(sizeof(*options) * (numOptions + 1));
-
- ch = shortArgs;
- numOptions = 0;
- while (*ch) {
- options[numOptions].shortName = *ch++;
- options[numOptions].longName = NULL;
- options[numOptions].val = 0;
- options[numOptions].descrip = NULL;
- options[numOptions].argDescrip = NULL;
- options[numOptions].arg = NULL;
- if (*ch == ':') {
- options[numOptions].argInfo = POPT_ARG_STRING;
- ch++;
- } else {
- options[numOptions].argInfo = POPT_ARG_NONE;
- }
-
- options[numOptions].val = numOptions + 1;
-
- numOptions++;
- }
-
- for (i = 0; i < PyList_Size(longArgs); i++) {
- options[numOptions].shortName = 0;
- options[numOptions].val = 0;
- options[numOptions].descrip = NULL;
- options[numOptions].argDescrip = NULL;
- options[numOptions].arg = NULL;
-
- strObject = PyList_GetItem(longArgs, i);
- str = PyString_AsString(strObject);
- if (!str) return NULL;
-
- if (str[strlen(str) - 1] == '=') {
- str = strcpy(alloca(strlen(str) + 1), str);
- str[strlen(str) - 1] = '\0';
- options[numOptions].argInfo = POPT_ARG_STRING;
- } else {
- options[numOptions].argInfo = POPT_ARG_NONE;
- }
-
- options[numOptions].val = numOptions + 1;
- options[numOptions].longName = str;
-
- numOptions++;
- }
-
- memset(options + numOptions, 0, sizeof(*options));
-
- argv = alloca(sizeof(*argv) * (PyList_Size(argList) + 1));
- for (i = 0; i < PyList_Size(argList); i++) {
- strObject = PyList_GetItem(argList, i);
- str = PyString_AsString(strObject);
- if (!str) return NULL;
-
- argv[i] = str;
- }
-
- argv[i] = NULL;
-
- optCon = poptGetContext("", PyList_Size(argList), argv,
- options, POPT_CONTEXT_KEEP_FIRST);
- retList = PyList_New(0);
- retArgs = PyList_New(0);
-
- while ((rc = poptGetNextOpt(optCon)) >= 0) {
- const char * argument;
-
- rc--;
-
- if (options[rc].argInfo == POPT_ARG_STRING)
- argument = poptGetOptArg(optCon);
- else
- argument = NULL;
-
- if (options[rc].longName) {
- str = alloca(strlen(options[rc].longName) + 3);
- sprintf(str, "--%s", options[rc].longName);
- } else {
- str = strBuf;
- sprintf(str, "-%c", options[rc].shortName);
- }
-
- if (argument) {
- argument = strcpy(alloca(strlen(argument) + 1), argument);
- PyList_Append(retList,
- Py_BuildValue("(ss)", str, argument));
- } else {
- PyList_Append(retList, Py_BuildValue("(ss)", str, ""));
- }
- }
-
- if (rc < -1) {
- i = strlen(poptBadOption(optCon, POPT_BADOPTION_NOALIAS)) +
- strlen(poptStrerror(rc));
-
- error = alloca(i) + 50;
-
- sprintf(error, "bad argument %s: %s\n",
- poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
- poptStrerror(rc));
-
- PyErr_SetString(PyExc_TypeError, error);
- return NULL;
- }
-
- argv = (const char **) poptGetArgs(optCon);
- for (i = 0; argv && argv[i]; i++) {
- PyList_Append(retArgs, PyString_FromString(argv[i]));
- }
-
- poptFreeContext(optCon);
-
- return Py_BuildValue("(OO)", retList, retArgs);
-}
-
static PyObject * doUMount(PyObject * s, PyObject * args) {
char * fs;