/* If the filename is an absolute path, then dirname is ignored. If it is a relative path, then we look in that directory for the file. */
static char* try_open(const char *dirname, const char *fname, FILE **fp)
/* If the filename is an absolute path, then dirname is ignored. If it is a relative path, then we look in that directory for the file. */
static char* try_open(const char *dirname, const char *fname, FILE **fp)
{
	char *fullname;
	if (!dirname || fname[0] == '/')
		fullname = xstrdup(fname);
	else
		fullname = join_path(dirname, fname);
	*fp = fopen(fullname, "rb");
	if (!*fp) {
		free(fullname);
		fullname = NULL;
	}
	return fullname;
}