static void show_releases(const char *hostname, const int verbose) { GTH_api api; int result; char attribute[1000]; result = gth_connect(&api, hostname, verbose); if (result != 0) { die("unable to connect to GTH"); } result = gth_query_resource_attribute(&api, "system_image", "version", attribute, sizeof(attribute)); assert(result == 0); printf(" Current system image version: %s\n", attribute); result = gth_query_resource_attribute(&api, "failsafe_image", "version", attribute, sizeof(attribute)); assert(result == 0); printf("Current failsafe image version: %s\n", attribute); gth_bye(&api); }
// Entry point int main(int argc, char** argv) { int result; GTH_api api; int verbose = 0; GTH_const_attribute attrs[MAX_ATTRIBUTES]; int n_attrs = 0; while (argc > 1 && argv[1][0] == '-') { switch (argv[1][1]) { case 'v': verbose = 1; break; default: usage(); } argc--; argv++; } if (argc < 3) { usage(); } win32_specific_startup(); result = gth_connect(&api, argv[1], verbose); if (result != 0) { die("Unable to connect to the GTH. Giving up."); } api.event_handler = >h_silent_event_handler; // First attribute is in argv[3], first value in argv[4] if (argc >= MAX_ATTRIBUTES) { die("Too many name/value pairs. Abort."); } for (n_attrs = 0; n_attrs < (argc - 3) / 2; n_attrs++) { attrs[n_attrs].key = argv[n_attrs * 2 + 3]; attrs[n_attrs].value = argv[n_attrs * 2 + 4]; } result = gth_enable(&api, argv[2], attrs, n_attrs); if (result != 0) { fprintf(stderr, "failed to enable %s\n", argv[2]); exit(1); } gth_bye(&api); return 0; }
// Entry point int main(int argc, char** argv) { int result; GTH_api api; char pcm_name[20]; int t1_mulaw_mode = 0; int verbose = 0; int setup_l1 = 1; while (argc > 1 && argv[1][0] == '-') { switch (argv[1][1]) { case 'v': verbose = 1; break; case 'l': setup_l1 = 0; break; case 'T': t1_mulaw_mode = 1; break; default: usage(); } argc--; argv++; } if (argc != 5) { usage(); } win32_specific_startup(); result = gth_connect(&api, argv[1], verbose); if (result != 0) { die("unable to connect to the GTH"); } assert(sizeof(pcm_name) > (strlen("pcm") + strlen(argv[2]))); strncpy_s(pcm_name, sizeof pcm_name, "pcm", sizeof pcm_name - 1); strncat(pcm_name, argv[2], sizeof pcm_name); if (setup_l1) { setup_layer_1(&api, pcm_name, t1_mulaw_mode); } record_a_file(&api, argv[2], atoi(argv[3]), argv[4], t1_mulaw_mode); gth_bye(&api); fprintf(stderr, "all done\n"); return 0; }
// Entry point int main(int argc, char** argv) { int result; GTH_api api; int verbose = 0; char name[MAX_RESOURCE_NAME]; char *sdh_resource; while (argc > 1 && argv[1][0] == '-') { switch (argv[1][1]) { case 'v': verbose = 1; break; default: usage(); } argc--; argv++; } if (argc != 3) { usage(); } sdh_resource = argv[2]; win32_specific_startup(); result = gth_connect(&api, argv[1], verbose); if (result != 0) { die("Unable to connect to the GTH. Giving up."); } result = gth_map(&api, sdh_resource, name, MAX_RESOURCE_NAME); if (result == 0) { printf("%s\n", name); } else { fprintf(stderr, "unable to map %s. Is SDH enabled? -v for more info.\n", sdh_resource); exit(-1); } gth_bye(&api); return 0; }
// Entry point int main(int argc, char** argv) { int result; GTH_api api; if (argc != 3) { usage(); } win32_specific_startup(); result = gth_connect(&api, argv[1], 1 /* verbose */); if (result != 0) { die("Unable to connect to the GTH. Giving up."); } gth_raw_xml(&api, argv[2]); gth_bye(&api); return 0; }