Пример #1
0
Файл: config.c Проект: XQF/xqf
void config_drop_file (const char *path) {
	struct config_file *file = NULL;

	parse_path (path, FALSE, NULL, &file, NULL);
	if (file)
		drop_file (file);
}
Пример #2
0
Файл: config.c Проект: XQF/xqf
void config_clean_file (const char *path) {
	struct config_file *file = NULL;
	char *filename;

	parse_path (path, FALSE, NULL, &file, NULL);
	if (file) {
		filename = g_strdup (file->filename);

		drop_file (file);

		/* Re-create file record and mark it as 'dirty' */

		find_key (filename, NULL, NULL, TRUE, &file, NULL, NULL);
		file->dirty = TRUE;

		g_free (filename);
	}
}
Пример #3
0
str
bam_drop_file(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
	lng file_id = *getArgReference_lng(stk, pci, pci->retc);
	sht dbschema = *getArgReference_sht(stk, pci, pci->retc + 1);

	str msg;

	msg = drop_file(cntxt, "bam.drop_file", file_id, dbschema);
	if (msg != MAL_SUCCEED) {
		str msg2 = createException(MAL, "bam_drop_file",
			  "Error when dropping file with file id '" LLFMT
			  "': %s\n", file_id, msg);
		GDKfree(msg);
		return msg2;
	}

	(void) stk;
	(void) pci;
	(void) mb;

	return MAL_SUCCEED;
}
Пример #4
0
Файл: config.c Проект: XQF/xqf
void config_drop_all (void) {
	while (files) {
		drop_file ((struct config_file *) files->data);
	}
}
Пример #5
0
Файл: ring.c Проект: gamma62/eda
/*
** list_buffers - open a special buffer with a list of open files and bookmarks,
**	switch to the open buffer or (re)generate it
*/
int
list_buffers (void)
{
	int ri, lno_read;
	LINE *lp=NULL, *lx=NULL;
	char one_line[CMDLINESIZE*2];
	int ret=1, bm_i;
	int origin = cnf.ring_curr;

	/* open or reopen? */
	ret = scratch_buffer("*ring*");
	if (ret==0) {
		/* switch to */
		if (origin != cnf.ring_curr && CURR_FILE.num_lines > 0)
			return (0);
		/* generate or regenerate */
		if (CURR_FILE.num_lines > 0)
			ret = clean_buffer();
	}
	if (ret) {
		return (ret);
	}
	CURR_FILE.num_lines = 0;
	CURR_FILE.fflag |= (FSTAT_SPECW);
	if (origin != cnf.ring_curr) {
		CURR_FILE.origin = origin;
	}

	/* fill with data from ring
	 */
	CURR_FILE.num_lines += cnf.ring_size;
	lp = CURR_FILE.bottom->prev;
	lno_read = 0;
	memset(one_line, 0, sizeof(one_line));
	for (ri=0; ret==0 && ri<RINGSIZE; ri++) {
		if (!(cnf.fdata[ri].fflag & FSTAT_OPEN))
			continue;

		/* base data
		*/
		if (cnf.fdata[ri].fflag & (FSTAT_SPECW | FSTAT_SCRATCH)) {
			snprintf(one_line, sizeof(one_line)-1, "%d \"%s\"   lines: %d   flags: %s%s%s%s\n",
				ri, cnf.fdata[ri].fname, cnf.fdata[ri].num_lines,
				(cnf.fdata[ri].fflag & FSTAT_SPECW) ? "special " : "",
				(cnf.fdata[ri].fflag & FSTAT_SCRATCH) ? "scratch " : "",
				(cnf.fdata[ri].fflag & FSTAT_CHMASK) ? "r/o " : "",
				(cnf.fdata[ri].pipe_output != 0) ? "pipe " : "");
		} else {
			snprintf(one_line, sizeof(one_line)-1, "%d \"%s\"   lines: %d   flags: %s%s%s%s\n",
				ri, cnf.fdata[ri].fname, cnf.fdata[ri].num_lines,
				(cnf.fdata[ri].fflag & FSTAT_RO) ? "R/O " : "R/W ",
				(cnf.fdata[ri].fflag & FSTAT_CHANGE) ? "Mod " : "",
				(cnf.fdata[ri].fflag & FSTAT_EXTCH) ? "Ext.Mod " : "",
				(cnf.fdata[ri].fflag & FSTAT_HIDDEN) ? "HIDDEN " : "");
		}

		if ((lx = append_line (lp, one_line)) != NULL) {
			lno_read++;
			lp=lx;
		} else {
			ret = 2;
			break;
		}

		/* optional: bookmarks
		*/
		for (bm_i=1; bm_i < 10; bm_i++) {
			if (ri == cnf.bookmark[bm_i].ring) {
				snprintf(one_line, sizeof(one_line)-1, "\tbookmark %d: %s\n",
					bm_i, cnf.bookmark[bm_i].sample);
				if ((lx = append_line (lp, one_line)) != NULL) {
					lno_read++;
					lp=lx;
				} else {
					ret = 2;
					break;
				}
			}
		}
	}/* for ri... */

	if (ret==0) {
		CURR_FILE.num_lines = lno_read;
		CURR_LINE = CURR_FILE.top->next;
		CURR_FILE.lineno = 1;
		update_focus(FOCUS_ON_2ND_LINE, cnf.ring_curr);
		go_home();
		CURR_FILE.fflag &= ~FSTAT_CHANGE;
		/* disable inline editing and adding lines */
		CURR_FILE.fflag |= (FSTAT_NOEDIT | FSTAT_NOADDLIN);
	} else {
		ret |= drop_file();
	}

	return (ret);
}