Exemple #1
0
/*
 * Modified	: 01.16.2002 Author	: Dark0n3
 *
 * Description	: Deletes all -missing files with preparsed sfv.
 */
void
delete_sfv(const char *path, struct VARS *raceI)
{
	char		*f = 0, missing_fname[NAME_MAX];
	FILE		*sfvfile;

	SFVDATA		sd;

	if (!(sfvfile = fopen(path, "r"))) {
		d_log("delete_sfv: Couldn't fopen %s: %s\n", path, strerror(errno));
		remove_lock(raceI);
		exit(EXIT_FAILURE);
	}

	while (fread(&sd, sizeof(SFVDATA), 1, sfvfile)) {
		snprintf(missing_fname, NAME_MAX, "%s-missing", sd.fname);
		if ((f = findfilename(missing_fname, f, raceI)))
                {
			if (unlink(missing_fname) < 0)
                            d_log("delete_sfv: Couldn't unlink missing-indicator '%s': %s\n", missing_fname, strerror(errno));
                }
	}
	ng_free(f);
	fclose(sfvfile);
}
Exemple #2
0
char *
ngraph_get_init_file(const char *init_file)
{
  char *homedir, *confdir, *inifile;;
  struct objlist *sys;

  if (init_file == NULL) {
    return NULL;
  }

  sys = chkobject("system");
  getobj(sys, "home_dir", 0, 0, NULL, &homedir);
  getobj(sys, "conf_dir", 0, 0, NULL, &confdir);

  inifile = NULL;
  if (findfilename(homedir, CONFTOP, init_file)) {
    inifile = getfilename(homedir, CONFTOP, init_file);
  } else if (findfilename(confdir, CONFTOP, init_file)) {
    inifile = getfilename(confdir, CONFTOP, init_file);
  }

  return inifile;
}