Esempio n. 1
0
bool shares_reload() {
	pthread_mutex_lock(&shareMutex);
	int fd;
	char* shareFilename = shareList->shareFile;
	char line[PATH_MAX];

	logDebug("share reload");

	if (shareFilename == NULL) {
		logWarn("There is no share list to reload");
		pthread_mutex_unlock(&shareMutex);
		return false;
	}

	if (!fs_exist(shareFilename)) {
		logWarn("The share list file '%s' do not exist", shareFilename);
		pthread_mutex_unlock(&shareMutex);
		return false;
	}

	shares_clearList();

	fd = file_open(shareFilename);

	while (file_readLine(fd, line)) {
		shares_parse(line);
	}

	pthread_mutex_unlock(&shareMutex);
	return true;
}
Esempio n. 2
0
bool file_getLine(FILE *file, string_t *str)
{
    string_clear(str);
    bool v = file_readLine(file, str);
    string_cstr(str);
    return v;
}
Esempio n. 3
0
bool ini_parse(Ini* ini, const char* filename) {
	char line[1024];
	int fd = file_open(filename);

	if (fd < 0)
		return false;

	while (file_readLine(fd, line))
		ini_parseLine(ini, line);

	return true;
}