- char * err = "Trouble in init_cmds() with fopen() on file 'commands'.";
- FILE * file = fopen("config/commands", "r");
- exit_err(NULL == file, world, err);
- uint16_t lines, linemax;
- textfile_sizes(file, &linemax, &lines);
- err = "Trouble in init_cmds() with malloc().";
- char * line = malloc(linemax);
- exit_err(NULL == line, world, err);
- struct Command * cmds = malloc(lines * sizeof(struct Command));
- exit_err(NULL == line, world, err);
+ char * f_name = "init_command_db()";
+
+ char * path = "config/commands";
+ FILE * file = try_fopen(path, "r", f_name);
+ uint16_t lines;
+ uint16_t linemax = textfile_sizes(file, &lines);
+ char line[linemax + 1];
+
+ struct Command * cmds = try_malloc(lines * sizeof(struct Command), f_name);