summaryrefslogtreecommitdiff
path: root/examples/ambs-lgp2-frontend/main.c
blob: cc3c9f13ab3634b9e64b0309e282bd100ab1183f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>

#include <gphoto2/gphoto2-version.h>

/* The purpose of this code is to use things defined in gphoto2 header
 * files and then link to libgphoto2. */

static
struct {
  const char *const title;
  GPVersionFunc version_func;
} versions[] = {
  {"libgphoto2_port", gp_port_library_version},
  {"libgphoto2",      gp_library_version}
};

int main()
{
  for (size_t i=0; i<(sizeof(versions)/sizeof(versions[0])); i++) {
    const char *const title          = versions[i].title;
    const GPVersionFunc version_func = versions[i].version_func;
    const char **version_data = version_func(GP_VERSION_VERBOSE);
    printf("%s\n", title);
    for (size_t j=0; version_data[j]; j++) {
      printf("  %s\n", version_data[j]);
    }
  }
  return 0;
}