+ char * f_name = "read_winconf_from_file()";
+ char * context = "Failed reading individual window's configuration from "
+ "interface config file. ";
+ char * err_id = "Illegal ID(s) selected.";
+ char * err_2 = "Double-initialized window.";
+ char * err_brk = "Illegal line break type index.";
+ int test_for_end = try_fgetc(file, f_name);
+ if (EOF == test_for_end || '\n' == test_for_end)
+ {
+ return 0;
+ }
+ exit_trouble(EOF == ungetc(test_for_end, file), f_name, "ungetc()");
+ err_try_fgets(line, linemax, file, context, "ns");
+ err_line(NULL == strchr(world.winDB.legal_ids, line[0]), line, context,
+ err_id);
+ exit_err(world.winDB.ids && NULL!=strchr(world.winDB.ids, line[0]), err_2);
+ struct Win win;
+ memset(&win, 0, sizeof(struct Win));
+ win.id = (char) line[0];
+ err_try_fgets(line, linemax, file, context, "0n");
+ win.title = try_malloc(strlen(line), f_name);
+ memcpy(win.title, line, strlen(line) - 1); /* Eliminate newline char */
+ win.title[strlen(line) - 1] = '\0'; /* char at end of string. */
+ err_try_fgets(line, linemax, file, context, "0nsi");
+ err_line(atoi(line) > 2, line, context, err_brk);
+ win.linebreak = atoi(line);
+ err_try_fgets(line, linemax, file, context, "0ni");
+ win.target_height = atoi(line);
+ win.target_height_type = (0 >= win.target_height);
+ err_try_fgets(line, linemax, file, context, "0ni");
+ win.target_width = atoi(line);
+ win.target_width_type = (0 >= win.target_width);
+ read_keybindings_from_file(line, linemax, file, &win.kb);
+ if (world.winDB.ids)
+ {
+ uint8_t old_ids_size = strlen(world.winDB.ids);
+ char * new_ids = try_malloc(old_ids_size + 1 + 1, f_name);
+ sprintf(new_ids, "%s%c", world.winDB.ids, win.id);
+ free(world.winDB.ids);
+ world.winDB.ids = new_ids;
+ array_append(old_ids_size, sizeof(struct Win), (void *) &win,
+ (void **) &world.winDB.wins);
+ return 1;
+ }
+ world.winDB.ids = try_malloc(2, f_name);
+ sprintf(world.winDB.ids, "%c", win.id);
+ world.winDB.wins = try_malloc(sizeof(struct Win), f_name);
+ world.winDB.wins[0] = win;
+ return 1;