Esempio n. 1
0
/* Called to get a char that isn't a \newline sequence. */
static int
getsc_bn(void)
{
	int c, c2;

	if (ignore_backslash_newline)
		return (o_getsc_u());

	if (backslash_skip == 1) {
		backslash_skip = 2;
		return (o_getsc_u());
	}

	backslash_skip = 0;

	while (/* CONSTCOND */ 1) {
		c = o_getsc_u();
		if (c == '\\') {
			if ((c2 = o_getsc_u()) == '\n')
				/* ignore the \newline; get the next char... */
				continue;
			ungetsc_i(c2);
			backslash_skip = 1;
		}
		return (c);
	}
}
Esempio n. 2
0
void
yyskiputf8bom(void)
{
	int c;

	if ((unsigned char)(c = o_getsc_u()) != 0xEF) {
		ungetsc_i(c);
		return;
	}
	if ((unsigned char)(c = o_getsc_u()) != 0xBB) {
		ungetsc_i(c);
		ungetsc_i(0xEF);
		return;
	}
	if ((unsigned char)(c = o_getsc_u()) != 0xBF) {
		ungetsc_i(c);
		ungetsc_i(0xBB);
		ungetsc_i(0xEF);
		return;
	}
	UTFMODE |= 8;
}
Esempio n. 3
0
File: lex.c Progetto: tomgrean/mksh
void
yyskiputf8bom(void)
{
	int c;

	if (rtt2asc((c = o_getsc_u())) != 0xEF) {
		ungetsc_i(c);
		return;
	}
	if (rtt2asc((c = o_getsc_u())) != 0xBB) {
		ungetsc_i(c);
		ungetsc_i(asc2rtt(0xEF));
		return;
	}
	if (rtt2asc((c = o_getsc_u())) != 0xBF) {
		ungetsc_i(c);
		ungetsc_i(asc2rtt(0xBB));
		ungetsc_i(asc2rtt(0xEF));
		return;
	}
	UTFMODE |= 8;
}