c_list_drivers.c

Go to the documentation of this file.
00001 
00015 #include <grass/dbmi.h>
00016 
00022 const char *db_list_drivers(void)
00023 {
00024     dbDbmscap *list, *cur;
00025     dbString drivernames;
00026 
00027     db_init_string(&drivernames);
00028 
00029     /* read the dbmscap info */
00030     if (NULL == (list = db_read_dbmscap()))
00031         return NULL;
00032     else {
00033         /* build the comma separated string of existing drivers */
00034         for (cur = list; cur; cur = cur->next) {
00035             if (cur->driverName == '\0')
00036                 break;
00037             else {
00038                 if (cur != list)
00039                     db_append_string(&drivernames, ",");
00040                 db_append_string(&drivernames, cur->driverName);
00041             }
00042         }
00043     }
00044 
00045     return db_get_string(&drivernames);
00046 }