- g_string_append(optionsInfo->optionString, colons[option->hasArg]);
- g_queue_push_tail(optionsInfo->index, option);
+ if (option->shortName)
+ {
+ g_string_append_c(optionsInfo->optionString, option->shortName);
+ g_string_append(optionsInfo->optionString, colons[option->hasArg]);
+
+ g_hash_table_insert(optionsInfo->shortIndex, &option->shortName,
+ option);
+ }
+ g_queue_push_tail(optionsInfo->longIndex, option);
+}
+
+
+/*
+ * A GHashFunc for g_hash_table_new()
+ *
+ * Args:
+ * key char*, just one character
+ */
+static guint ghfCharHash(gconstpointer key)
+{
+ return *(char*) key;
+}
+
+
+/*
+ * A GEqualFunc for g_hash_table_new()
+ *
+ * Args:
+ * a, b char*, just one character each
+ *
+ * Returns:
+ * TRUE if both values are equal
+ */
+static gboolean gefCharEqual(gconstpointer a, gconstpointer b)
+{
+ if (*(char*) a == *(char*) b)
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }