FreeBSD/contrib/mdocml/roff.c
/*
 * Find out whether a line is a macro line or not.
 * If it is, adjust the current position and return one; if it isn't,
 * return zero and don't change the current position.
 * If the control character has been set with `.cc', then let that grain
 * precedence.
 * This is slighly contrary to groff, where using the non-breaking
 * control character when `cc' has been invoked will cause the
 * non-breaking macro contents to be printed verbatim.
 */
Find out whether a line is a macro line or not.
If it is, adjust the current position and return one; if it isn't,
return zero and don't change the current position.
If the control character has been set with `.cc', then let that grain
precedence.
This is slighly contrary to groff, where using the non-breaking
control character when `cc' has been invoked will cause the
non-breaking macro contents to be printed verbatim.
Find out whether a line is a macro line or not . If it is adjust the current position and return one ; if it isn ' t return zero and don ' t change the current position . If the control character has been set with ` . cc ' then let that grain precedence . This is slighly contrary to groff where using the non - breaking control character when ` cc ' has been invoked will cause the non - breaking macro contents to be printed verbatim .
int
roff_getcontrol(const struct roff *r, const char *cp, int *ppos)
{
	int		pos;
	pos = *ppos;
	if (0 != r->control && cp[pos] == r->control)
		pos++;
	else if (0 != r->control)
		return 0;
	else if ('\\' == cp[pos] && '.' == cp[pos + 1])
		pos += 2;
	else if ('.' == cp[pos] || '\'' == cp[pos])
		pos++;
	else
		return 0;
	while (' ' == cp[pos] || '\t' == cp[pos])
		pos++;
	*ppos = pos;
	return 1;
}
int roff_getcontrol ( const struct roff * r , const char * cp , int * ppos ) { int pos ; pos = * ppos ; if ( 0 != r -> control && cp [ pos ] == r -> control ) pos ++ ; else if ( 0 != r -> control ) return 0 ; else if ( ' \\ ' == cp [ pos ] && ' ' == cp [ pos + 1 ] ) pos += 2 ; else if ( ' ' == cp [ pos ] || ' \' ' == cp [ pos ] ) pos ++ ; else return 0 ; while ( ' ' == cp [ pos ] || ' \t ' == cp [ pos ] ) pos ++ ; * ppos = pos ; return 1 ; }
Find out whether a line is a macro line or not.
Find out whether a line is a macro line or not .