
#include"oldreg.c"

FILE *f = NULL;

void gokey ( char * key ) {
  p_registry_search inf = (p_registry_search) malloc(sizeof(t_registry_search));


  if ( reg_find_first(key, inf) ){
	fprintf(f,"[%s]\n",key);
  do {
    fprintf(f,"%s=",inf->key.name);
    if ( inf->key.type == KT_STRING ) {
	  fprintf(f,"\"%s\"",get_key(inf->name));
    } else if ( inf->key.type == KT_INTEGER ) {
	  fprintf(f,"%d",get_key_integer(inf->name));
    } else {
	  fprintf(f,"(nodata)");
    };
    fprintf(f,"\n");
    free(inf->name);
  } while (reg_find_next(inf));
  fprintf(f,"\n");
  };
  if ( reg_find_first(key, inf) ) do {
    gokey(inf->name);
    free(inf->name);
  } while (reg_find_next(inf));
  free(inf);
};

int main ( void ) {
  f = fopen("output.reg","wt");
init_registry();

  gokey("");

  fclose(f);
};