+ int i = 0;
+ opkg_option_t **options = opkg->options;
+
+ /* NULL values are not defined */
+ if (!value)
+ return;
+
+ /* look up the option
+ * TODO: this would be much better as a hash table
+ */
+ while (options[i]->name)
+ {
+ if (strcmp(options[i]->name, option) != 0)
+ {
+ i++;
+ continue;
+ }
+ }
+
+ /* set the option */
+ switch (options[i]->type)
+ {
+ case OPKG_OPT_TYPE_BOOL:
+ if (*((int *) value) == 0)
+ *((int *)options[i]->value) = 0;
+ else
+ *((int *)options[i]->value) = 1;
+ return;
+
+ case OPKG_OPT_TYPE_INT:
+ *((int *) options[i]->value) = *((int *) value);
+ return;
+
+ case OPKG_OPT_TYPE_STRING:
+ *((char **)options[i]->value) = strdup(value);
+ return;
+ }
+