summaryrefslogtreecommitdiffstats
path: root/src/dmihelper.c
diff options
context:
space:
mode:
authornima <nima@abc39116-655e-4be6-ad55-d661dc543056>2009-03-31 11:37:58 +0000
committernima <nima@abc39116-655e-4be6-ad55-d661dc543056>2009-03-31 11:37:58 +0000
commit37d1a8117cd212ee9e47bbd4225ba76dece7dad7 (patch)
treef5817d1780670702c0f92c32bd62de53d68b3d36 /src/dmihelper.c
parent17cfe3a41998c075991a54a6deace28ba7744ed6 (diff)
downloadpython-dmidecode-37d1a8117cd212ee9e47bbd4225ba76dece7dad7.tar.gz
python-dmidecode-37d1a8117cd212ee9e47bbd4225ba76dece7dad7.tar.xz
python-dmidecode-37d1a8117cd212ee9e47bbd4225ba76dece7dad7.zip
Preparing to migrate to GIT.
git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@179 abc39116-655e-4be6-ad55-d661dc543056
Diffstat (limited to 'src/dmihelper.c')
-rw-r--r--src/dmihelper.c115
1 files changed, 0 insertions, 115 deletions
diff --git a/src/dmihelper.c b/src/dmihelper.c
deleted file mode 100644
index 6d52e04..0000000
--- a/src/dmihelper.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <stdio.h>
-#include <strings.h>
-
-#include "dmihelper.h"
-
-/*
-dmi_minor* dmiAppendObject(long code, char const *key, const char *format, ...) {
- static dmi_minor* last = NULL;
-
- //. int minor = code&0x00FF;
- //. int major = code>>8;
-
- va_list arg;
- va_start(arg, format);
-
- dmi_minor *o = (dmi_minor *)malloc(sizeof(dmi_minor));
- o->next = last;
- o->id = code;
- o->major = (dmi_codes_major *)&dmiCodesMajor[map_maj[code>>8]];
- o->key = (char *)key;
-
- if((format != NULL)&&(vsnprintf(o->value, MAXVAL-1, format, arg) > MAXVAL)) {
- free(o);
- o = NULL;
- //. TODO: Make this a python exception.
- printf("dmidecode: Internal (python module) error; Value too long.\n");
- }
-
- last = o;
- va_end(arg); // cleanup
-
- return o;
-}
-*/
-
-int dmiSetItem(PyObject* dict, const char *key, const char *format, ...) {
- va_list arg;
- va_start(arg, format);
- char buffer[2048];
- vsprintf(buffer, format, arg);
- va_end(arg);
- //printf("DEBUG: Setting k:%s, f:%s s:%s...", key, format, buffer);
- PyDict_SetItem(dict, PyString_FromString(key), PyString_FromString(buffer));
- //printf("Done.\n");
- return 0;
-}
-
-
-/* NOTE: Decomissioned helper function...
-void dmiAppendData(PyObject *pydata, const int count) {
- dmi_minor* last = dmiAppendObject(count, "JUNK", "NODATA");
-
- const char *id = last->major->id;
- PyObject *_key, *_val;
-
- PyObject *pymajor = PyDict_New();
-
- _key = PyString_FromString("code");
- _val = PyInt_FromLong((long)last->major->code);
- PyDict_SetItem(pymajor, _key, _val);
- Py_DECREF(_key);
- Py_DECREF(_val);
-
- _key = PyString_FromString("id");
- _val = PyString_FromString(last->major->id);
- PyDict_SetItem(pymajor, _key, _val);
- Py_DECREF(_key);
- Py_DECREF(_val);
-
- _key = PyString_FromString("name");
- _val = PyString_FromString(last->major->desc);
- PyDict_SetItem(pymajor, _key, _val);
- Py_DECREF(_key);
- Py_DECREF(_val);
-
- PyObject *pyminor = PyDict_New();
- while((last = last->next)) {
- //printf("%d:<%s, %s> | %ld:[%s => %s]\n", last->major->code, last->major->id, last->major->desc, last->id, last->key, last->value);
- _key = PyString_FromString(last->key);
- _val = PyString_FromString(last->value);
- PyDict_SetItem(pyminor, _key, _val);
- Py_DECREF(_key);
- Py_DECREF(_val);
- }
- _key = PyString_FromString("data");
- PyDict_SetItem(pymajor, _key, pyminor);
- Py_DECREF(_key);
- Py_DECREF(pyminor);
-
- _key = PyString_FromString(id);
- PyDict_SetItem(pydata, _key, pymajor);
- Py_DECREF(_key);
- Py_DECREF(pymajor);
-}
-*/
-
-/* NOTE: Decomissioned helper function...
-int catsprintf(char *buf, const char *format, ...) {
- if(format == NULL) {
- bzero(buf, strlen(buf));
- return 0;
- }
-
- va_list arg; // will point to each unnamed argument in turn
- va_start(arg, format); // point to first element after fmt
-
- char b[8192];
- int c = vsprintf (b, format, arg);
-
- strcat(buf, b);
- va_end(arg); // cleanp
-
- return c;
-}
-*/