[gnome-db]gda-test patch



Hello
This one makes gda-test to ask which provider is to be tested when
there's more than one available.
mv

diff -rp libgda/testing/gda-test.c libgda-mv/testing/gda-test.c
*** libgda/testing/gda-test.c	Sun May  6 20:26:19 2001
--- libgda-mv/testing/gda-test.c	Sun May  6 20:24:57 2001
***************
*** 26,31 ****
--- 26,32 ----
  #include <glib.h>
  #include <gda-common.h>
  #include <gda-client.h>
+ #include <stdlib.h>
  
  /*
------------------------------------------------------------------------- */
  /* Print intro messages
*************** list_providers ()
*** 76,81 ****
--- 77,85 ----
    GdaProvider* provider;
    int i = 0;
    char* selected;
+   char* number = NULL; /* the number of provider entered */
+   gint dummy;
+   gint pno; /* provider number converted with atoi */
  
    list = gda_provider_list ();
    if (!list)
*************** list_providers ()
*** 100,108 ****
      {
        provider = (GdaProvider*) node->data;
        g_print ("%d: %s\n", ++i, GDA_PROVIDER_NAME (provider));
-       if (i = 1)
- 	selected = g_strdup (GDA_PROVIDER_NAME (provider));
      }
    gda_provider_free_list (list);
    return (selected);
  }
--- 104,124 ----
      {
        provider = (GdaProvider*) node->data;
        g_print ("%d: %s\n", ++i, GDA_PROVIDER_NAME (provider));
      }
+ 
+   if ( i > 1 ) {
+     do {
+       g_print ("\nChoose one (enter the number):");
+       getline (&number, &dummy, stdin);
+       pno = atoi (number);
+     } while (pno < 1 || pno > i);
+     node = g_list_nth ( list, pno-1 );
+   } else {
+     node = g_list_first (list);
+   }
+   provider = (GdaProvider*) node->data;
+   selected = g_strdup (GDA_PROVIDER_NAME (provider));
+ 
    gda_provider_free_list (list);
    return (selected);
  }






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]