/*====================================================================*
*
* void copytoken (SCAN * content, char buffer [], signed length);
*
* scan.h
*
* copy the current token to a user supplied buffer of specified
* length; the token is truncated and NUL terminated when needed
* to fit the buffer;
*
*. Motley Tools by Charles Maier <cmaier@cmassoc.net>;
*: Published 2001-2006 by Charles Maier Associates Limited;
*; Released under the GNU General Public Licence v2 and later;
*
*--------------------------------------------------------------------*/
#ifndef COPYTOKEN_SOURCE
#define COPYTOKEN_SOURCE
# include "../scan/scan.h"
void copytoken (SCAN * content, char buffer [], signed length)
{
if (length-- > 0)
{
content->index = content->first;
while ((length-- > 0) && (content->index < content->final))
{
*buffer++ = *content->index++;
}
*buffer = (char)(0);
}
return;
}
#endif