mksh/mksh.logging/exec.c
static Test_op
dbteste_isa(Test_env *te, Test_meta meta)
{
	Test_op ret = TO_NONOP;
	bool uqword;
	const char *p;

	if (!*te->pos.wp)
		return (meta == TM_END ? TO_NONNULL : TO_NONOP);

	/* unquoted word? */
	for (p = *te->pos.wp; *p == CHAR; p += 2)
		;
	uqword = *p == EOS;

	if (meta == TM_UNOP || meta == TM_BINOP) {
		if (uqword) {
			/* longer than the longest operator */
			char buf[8];
			char *q = buf;

			p = *te->pos.wp;
			while (*p++ == CHAR &&
			    (size_t)(q - buf) < sizeof(buf) - 1)
				*q++ = *p++;
			*q = '\0';
			ret = test_isop(meta, buf);
		}
	} else if (meta == TM_END)
		ret = TO_NONOP;
	else
		ret = (uqword && !strcmp(*te->pos.wp,
		    dbtest_tokens[(int)meta])) ? TO_NONNULL : TO_NONOP;

	/* Accept the token? */
	if (ret != TO_NONOP)
		te->pos.wp++;

	return (ret);
}
/*
 * Test if the current token is a whatever. Accepts the current token if
 * it is. Returns 0 if it is not, non-zero if it is (in the case of
 * TM_UNOP and TM_BINOP, the returned value is a Test_op).
 */
Test if the current token is a whatever. Accepts the current token if
it is. Returns 0 if it is not, non-zero if it is (in the case of
TM_UNOP and TM_BINOP, the returned value is a Test_op).
Test if the current token is a whatever . Accepts the current token if it is . Returns 0 if it is not non - zero if it is ( in the case of TM_UNOP and TM_BINOP the returned value is a Test_op ) .
static Test_op
dbteste_isa(Test_env *te, Test_meta meta)
{
	Test_op ret = TO_NONOP;
	bool uqword;
	const char *p;
	if (!*te->pos.wp)
		return (meta == TM_END ? TO_NONNULL : TO_NONOP);
	for (p = *te->pos.wp; *p == CHAR; p += 2)
		;
	uqword = *p == EOS;
	if (meta == TM_UNOP || meta == TM_BINOP) {
		if (uqword) {
			char buf[8];
			char *q = buf;
			p = *te->pos.wp;
			while (*p++ == CHAR &&
			    (size_t)(q - buf) < sizeof(buf) - 1)
				*q++ = *p++;
			*q = '\0';
			ret = test_isop(meta, buf);
		}
	} else if (meta == TM_END)
		ret = TO_NONOP;
	else
		ret = (uqword && !strcmp(*te->pos.wp,
		    dbtest_tokens[(int)meta])) ? TO_NONNULL : TO_NONOP;
	if (ret != TO_NONOP)
		te->pos.wp++;
	return (ret);
}
static Test_op dbteste_isa ( Test_env * te , Test_meta meta ) { Test_op ret = TO_NONOP ; bool uqword ; const char * p ; if ( ! * te -> pos . wp ) return ( meta == TM_END ? TO_NONNULL : TO_NONOP ) ; for ( p = * te -> pos . wp ; * p == CHAR ; p += 2 ) ; uqword = * p == EOS ; if ( meta == TM_UNOP || meta == TM_BINOP ) { if ( uqword ) { char buf [ 8 ] ; char * q = buf ; p = * te -> pos . wp ; while ( * p ++ == CHAR && ( size_t ) ( q - buf ) < sizeof ( buf ) - 1 ) * q ++ = * p ++ ; * q = ' \0 ' ; ret = test_isop ( meta , buf ) ; } } else if ( meta == TM_END ) ret = TO_NONOP ; else ret = ( uqword && ! strcmp ( * te -> pos . wp , dbtest_tokens [ ( int ) meta ] ) ) ? TO_NONNULL : TO_NONOP ; if ( ret != TO_NONOP ) te -> pos . wp ++ ; return ( ret ) ; }
Test if the current token is a whatever.
Test if the current token is a whatever .
/* unquoted word? */ /* longer than the longest operator */ /* Accept the token? */