GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
c_list_drivers.c
Go to the documentation of this file.
1 
15 #include <grass/dbmi.h>
16 
22 const char *db_list_drivers(void)
23 {
24  dbDbmscap *list, *cur;
25  dbString drivernames;
26 
27  db_init_string(&drivernames);
28 
29  /* read the dbmscap info */
30  if (NULL == (list = db_read_dbmscap()))
31  return NULL;
32  else {
33  /* build the comma separated string of existing drivers */
34  for (cur = list; cur; cur = cur->next) {
35  if (cur->driverName == '\0')
36  break;
37  else {
38  if (cur != list)
39  db_append_string(&drivernames, ",");
40  db_append_string(&drivernames, cur->driverName);
41  }
42  }
43  }
44 
45  return db_get_string(&drivernames);
46 }
dbDbmscap * db_read_dbmscap(void)
Definition: dbmscap.c:87
int db_append_string(dbString *x, const char *s)
Definition: string.c:193
const char * db_list_drivers(void)
Return comma separated list of existing DB drivers, used for driver parameter options.
return NULL
Definition: dbfopen.c:1394
char * db_get_string(dbString *x)
Definition: string.c:131
void db_init_string(dbString *x)
Definition: string.c:11