{ pnd_conf_startup, "startup" },
{ pnd_conf_desktop, "desktop" },
{ pnd_conf_categories, "categories" },
+ { pnd_conf_evmap, "eventmap" },
{ pnd_conf_nil, NULL },
};
temp = pnd_conf_get_as_char ( ch, PND_CONF_KEY );
- if ( searchpath ) {
+ if ( temp ) {
searchpath = strdup ( temp );
} else {
searchpath = strdup ( PND_CONF_SEARCHPATH );
*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 );
}
} else {
- // key/value pairing
+ // key only
char *v;
// form the actual new key
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 );
+}