/* strrev: reverse a string in-place */


#include <string.h>

char *strrev(string)
	char *string;
{
	char *p = string, *q, c;

	q = p;
	if (*q) {
	/* only reverse non-empty strings */
		while (*q) q++;		/* find the end of the string */
		/* now reverse the string in place */
		while (--q > p) {
			c = *q;
			*q = *p;
			*p++ = c;
		}
	}
	return(string);
}
