GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
d_listdb.c
Go to the documentation of this file.
1 
15 #include <stdlib.h>
16 #include <grass/dbmi.h>
17 #include "macros.h"
18 #include "dbstubs.h"
19 
27 {
28  dbHandle *handles;
29  dbString *path;
30  int npaths;
31  int i, count;
32  int stat;
33 
34  /* arg(s) */
35  DB_RECV_STRING_ARRAY(&path, &npaths);
36 
37  /* call the procedure */
38  stat = db_driver_list_databases(path, npaths, &handles, &count);
39  db_free_string_array(path, npaths);
40 
41  /* send the return code */
42  if (stat != DB_OK) {
44  return DB_OK;
45  }
47 
48  /* send results */
49  DB_SEND_INT(count);
50  for (i = 0; i < count; i++) {
51  DB_SEND_HANDLE(&handles[i]);
52  }
53  db_free_handle_array(handles, count);
54  return DB_OK;
55 }
#define DB_SEND_HANDLE(x)
Definition: macros.h:57
#define DB_SEND_INT(x)
Definition: macros.h:37
int count
void db_free_handle_array(dbHandle *handle, int count)
Definition: handle.c:73
int(* db_driver_list_databases)()
int stat
Definition: g3dcolor.c:369
#define DB_SEND_FAILURE()
Definition: macros.h:9
int db_d_list_databases(void)
List databases.
Definition: d_listdb.c:26
void db_free_string_array(dbString *a, int n)
Definition: string.c:155
#define DB_RECV_STRING_ARRAY(x, n)
Definition: macros.h:20
#define DB_SEND_SUCCESS()
Definition: macros.h:7