예제 #1
0
파일: sed.c 프로젝트: DeadZen/qse
static int expand_wildcards (int argc, qse_char_t* argv[], int glob, xarg_t* xarg)
{
	int i;
	qse_cstr_t tmp;

	for (i = 0; i < argc; i++)
	{
		int x;

		if (glob)
		{
		#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
			int glob_flags = QSE_GLOB_TOLERANT | QSE_GLOB_PERIOD | QSE_GLOB_NOESCAPE | QSE_GLOB_IGNORECASE;
		#else
			int glob_flags = QSE_GLOB_TOLERANT | QSE_GLOB_PERIOD;
		#endif

			x = qse_glob (
				argv[i], collect_into_xarg, xarg,
				glob_flags, xarg->mmgr, qse_getdflcmgr()
			);

			if (x <= -1) return -1;
		}
		else x = 0;

		if (x == 0)
		{
			/* not expanded. just use it as is */
			tmp.ptr = argv[i];
			tmp.len = qse_strlen(argv[i]);
			if (collect_into_xarg (&tmp, xarg) <= -1) return -1;
		}
	}

	return 0;
}
예제 #2
0
파일: tio.c 프로젝트: apense/qse
int qse_tio_init (qse_tio_t* tio, qse_mmgr_t* mmgr, int flags)
{
	QSE_MEMSET (tio, 0, QSE_SIZEOF(*tio));

	tio->mmgr = mmgr;
	tio->cmgr = qse_getdflcmgr();

	tio->flags = flags;

	/*
	tio->input_func = QSE_NULL;
	tio->input_arg = QSE_NULL;
	tio->output_func = QSE_NULL;
	tio->output_arg = QSE_NULL;

	tio->status = 0;
	tio->inbuf_cur = 0;
	tio->inbuf_len = 0;
	tio->outbuf_len = 0;
	*/

	tio->errnum = QSE_TIO_ENOERR;
	return 0;
}