1
#include "local_proto.h"
3
static int cmp(const void *, const void *);
5
/* to print available drivers in help text */
6
char *OGR_list_write_drivers(void)
10
OGRSFDriverH Ogr_driver;
20
G_debug(2, "driver count = %d", OGRGetDriverCount());
21
for (i = 0; i < OGRGetDriverCount(); i++) {
22
/* only fetch read/write drivers */
23
if (!OGR_Dr_TestCapability(OGRGetDriver(i), ODrCCreateDataSource))
26
Ogr_driver = OGRGetDriver(i);
27
G_debug(2, "driver %d/%d : %s", i, OGRGetDriverCount(),
28
OGR_Dr_GetName(Ogr_driver));
30
list = G_realloc(list, (count + 1) * sizeof(char *));
32
/* chg white space to underscore in OGR driver names */
33
sprintf(buf, "%s", OGR_Dr_GetName(Ogr_driver));
34
G_strchg(buf, ' ', '_');
35
list[count++] = G_store(buf);
36
len += strlen(buf) + 1; /* + ',' */
39
qsort(list, count, sizeof(char *), cmp);
42
ret = G_malloc((len + 1) * sizeof(char)); /* \0 */
44
for (i = 0; i < count; i++) {
56
G_debug(2, "all drivers: %s", ret);
61
int cmp(const void *a, const void *b)
63
return (strcmp(*(char **)a, *(char **)b));