
#include "V_M_UC.h"
#include "str.h"

/*
* Here  are some routines that trim away all sorts of white space from the end
* of a string, replacing them with nulls, and  returning  the  length  of  the
* trimmed string.  If the caller passes us n<0, we calculate the length.  Note
* that we accept nulls as white space and trim them, too.
*/
str_ntrim(p,n)
	char *p;
	int   n;
{	int   c;
	if (n < 0) n = strlen(p);
	while (n > 0) {
		Switch(c = p[n-1]) {
		case ' ':
		case '\t':
		case '\r':
		case '\n':
		case '\f':
		case 0: p[--n] = 0; break;
		default: return n;
		}
	}
	return n;
}
