
/*
 *	Function	StopStrAt
 *	Programmer	N.d'Alterio
 *	Date		
 *
 *  Synopsis:	Terminates string at a char or \n with a \0
 *
 *  Arguments:	*str				String to work on.
 *		 ch				Character to stop at.
 *
 *  Returns:	None.
 *
 *  Variables:	i				Loop variable.
 * 
 *  Functions:	strlen				Length of string (ANSI)
 *
 *  $Id: StopStrAt.c 1.2 1995/09/18 12:06:35 daltern Exp $
 *
 */

#include <string.h>

void StopStrAt( char *str, char ch )

{

  int i;

/*
 *   Loop over all chars in string.
 */

  for ( i = 0; i < strlen( str ); i++ ) {

/*
 *   Write \0 and exit loop when get to \n or ch.
 */

	if ( ( str[i] == '\n' ) || ( str[i] == ch ) ) {

		str[i] = '\0';
		break;

	}   /* end if */

  }   /* end for i */

  return;

}   /* end function StopStrAt */

/*========================================================================*
                          END FUNCTION StopStrAt
 *========================================================================*/