#include #include #include int main(void) { int gbch_fd = 0; int num_jobs = 0; int slot_iterator = 0; slotno_t* slot_list = NULL; slotno_t current_slot; apiBtjob current_job; gbch_fd = gbatch_open ("localhost", NULL); if (gbch_fd < 0) { fprintf (stderr, "Can't connect to gbch\n"); return 1; } gbatch_joblist (gbch_fd, 0, &num_jobs, &slot_list); printf ("*** Found %d jobs***\n\n", num_jobs); for (slot_iterator = 0; slot_iterator < num_jobs; slot_iterator++) { current_slot = slot_list[slot_iterator]; if (gbatch_jobread (gbch_fd, 0, current_slot, ¤t_job)) { fprintf (stderr, "gbatch_jobread() failed\n"); continue; }; printf ("Job Number: %d\n", current_job.h.bj_job); printf ("Job title (access function): %s\n", gbatch_gettitle (-1, ¤t_job)); printf ("Job title (direct access): %s\n\n", current_job.bj_space[current_job.h.bj_title]); } gbatch_close (gbch_fd); return 0; }