Added my own evdev handler for dpad/dpadbuttons/nubs, works fantastic
[pandora-libraries.git] / lib / pnd_conf.c
index 129d278..5f1901f 100644 (file)
@@ -12,6 +12,9 @@ pnd_conf_filename_t pnd_conf_filenames[] = {
   { pnd_conf_conf,         PND_CONF_FILE },
   { pnd_conf_apps,         "apps" },
   { pnd_conf_startup,      "startup" },
+  { pnd_conf_desktop,      "desktop" },
+  { pnd_conf_categories,   "categories" },
+  { pnd_conf_evmap,        "eventmap" },
   { pnd_conf_nil,          NULL },
 };
 
@@ -32,7 +35,7 @@ char *pnd_conf_query_searchpath ( void ) {
 
   temp = pnd_conf_get_as_char ( ch, PND_CONF_KEY );
 
-  if ( searchpath ) {
+  if ( temp ) {
     searchpath = strdup ( temp );
   } else {
     searchpath = strdup ( PND_CONF_SEARCHPATH );
@@ -176,6 +179,11 @@ pnd_conf_handle pnd_conf_fetch_by_path ( char *fullpath ) {
       *mid = '\0';
       mid++;
 
+      // skip past any heading space for the key
+      while ( *mid && isspace ( *mid ) ) {
+       mid++;
+      }
+
       //printf ( "key head: '%s'\n", head );
       //printf ( "key mid: '%s'\n", mid );
 
@@ -203,7 +211,7 @@ pnd_conf_handle pnd_conf_fetch_by_path ( char *fullpath ) {
        }
 
       } else {
-       // key/value pairing
+       // key only
        char *v;
 
        // form the actual new key
@@ -237,3 +245,27 @@ pnd_conf_handle pnd_conf_fetch_by_path ( char *fullpath ) {
 char *pnd_conf_get_as_char ( pnd_conf_handle c, char *key ) {
   return ( pnd_box_find_by_key ( c, key ) );
 }
+
+int pnd_conf_get_as_int ( pnd_conf_handle c, char *key ) {
+  char *t = pnd_box_find_by_key ( c, key );
+
+  if ( ! t ) {
+    return ( PND_CONF_BADNUM ); // non-existant
+  }
+
+  int i = atoi ( t );
+
+  return ( i );
+}
+
+int pnd_conf_get_as_int_d ( pnd_conf_handle c, char *key, int def ) {
+  char *t = pnd_box_find_by_key ( c, key );
+
+  if ( ! t ) {
+    return ( def ); // non-existant
+  }
+
+  int i = atoi ( t );
+
+  return ( i );
+}