/*
	Changes:
	23 Feb 1996 JS terminated returned string at returned length, instead of
			end of buffer, and read as a string (3 passed to SWI)
*/

#include "Desk.KernelSWIs.h"
#include "Desk.SWI.h"
#include "Desk.Debug.h"
#include "Desk.Error2.h"


int	Desk_OS_ReadVarVal_ReadIntoBuffer( char *buffer, const char *varname, int bufflen)
{
int	r2;

Desk_Error2_CheckOS(
	SWI(	5, 3, 
  		Desk_SWI_XOS_Bit+Desk_SWI_OS_ReadVarVal, 
  		varname, buffer, bufflen, 0, 3,
  		NULL, NULL, &r2
  		)
  	);

buffer[ r2] = 0;

Desk_Debug_Printf( Desk_error_PLACE "returning '%s'\n", buffer);

return r2;
}
