Exemplo n.º 1
0
static char *
get_system_aliasfile() {
#ifdef WIN32
/*	static char alias_path[500];	/* a good longer than MAX_PATH */

	if (idn__util_getregistrystring(idn__util_hkey_localmachine,
					IDNVAL_ALIASFILE,
					alias_path, sizeof(alias_path))) {
		return (alias_path);
	} else {*/
		return (NULL);
/*	}*/
#else
	return (IDN_ALIAS_FILE);
#endif
}

static int
file_exist(const char *filename) {
	FILE  *fp;

	if ((fp = fopen(filename, "r")) == NULL)
		return (0);
	fclose(fp);
	return (1);
}
Exemplo n.º 2
0
static idn_result_t
open_userdefaultfile(FILE **fpp) {
#ifdef WIN32
	char user_path[MAX_PATH_SIZE];

	TRACE(("open_userdefaultfile()\n"));

	if (idn__util_getregistrystring(idn__util_hkey_currentuser,
					IDNVAL_CONFFILE, user_path,
					sizeof(user_path)) == 0) {
		return (idn_nofile);
	}
	*fpp = fopen(user_path, "r");
	if (*fpp == NULL) {
		return (idn_nofile);
	}
	return (idn_success);
#else /* WIN32 */
	const char *homedir;
	char *file;
	int len;

	TRACE(("open_userdefaultfile()\n"));

	homedir = userhomedir();
	len = strlen(IDN_USER_RESCONF_FILE) + 1;
	if (homedir != NULL) {
		len += strlen(homedir);
	} else {
		return (idn_notfound);
	}

	file = (char *)malloc(sizeof(char) * len);
	if (file == NULL) {
		WARNING(("open_userdefaultfile(): malloc failed\n"));
		return (idn_nomemory);
	}

	(void)strcpy(file, homedir);
	strcat(file, IDN_USER_RESCONF_FILE);
	
	*fpp = fopen(file, "r");
	free(file);
	if (*fpp == NULL) {
		return (idn_nofile);
	}

	return (idn_success);
#endif /* WIN32 */
}
Exemplo n.º 3
0
char *
idn_resconf_defaultfile() {
#ifdef WIN32
	static char default_path[MAX_PATH_SIZE];

	if (idn__util_getregistrystring(idn__util_hkey_localmachine,
					IDNVAL_CONFFILE, default_path,
					sizeof(default_path))) {
		return (default_path);
	} else {
		return (NULL);
	}
#else
	return (IDN_RESCONF_FILE);
#endif
}
Exemplo n.º 4
0
static char *
get_system_aliasfile() {
#ifdef WIN32
	static char alias_path[500];	/* a good longer than MAX_PATH */

	if (idn__util_getregistrystring(idn__util_hkey_localmachine,
					IDNVAL_ALIASFILE,
					alias_path, sizeof(alias_path))) {
		return (alias_path);
	} else {
		return (NULL);
	}
#else
	return (IDN_ALIAS_FILE);
#endif
}