/* nexttrib.c - find the next attribute in the string
 */

#include "mstring.h"


/* Return the index into "str" of the next attribute character after or at
 * index "n", or -1 if there isn't one. If a newline is encountered, -1 is
 * returned.
 */
int mnexttrib(char *str, int n)
{

	if (!str)
		return (-1);

	do {
		while (str[n] > 31)
			n++;
		if (miscntl(str[n]))
			return (n);
		if ((str[n] == 0) || (str[n] == 10))
			return (-1);
		n++;
	} while ((str[n] != 0) && (str[n] != 10));

	return (-1);
}

/* EOF */
