* Lib>param.c		Get CTOS parameters.
 *
 * DRH	920908	Prepare for external use.
 *

include std.h
include param.h

extern unsigned int		rgParam();			* CTOS Procedural API *
extern unsigned int		NlsYesOrNo();

*======================.=========< String >================================*
void get_param_string( param, subparam, target, maxlen)

unsigned int			param;
unsigned int			subparam;
char					* target;
unsigned int			maxlen;
{
	PBCB				pbcb;
	unsigned int		len;


	if( rgParam( param, subparam, pbcb) == ERC_OK) {
		len = min( maxlen, pbcb.cb);
		memcpy( target, pbcb.pb, len);
		target[len] = '\0';
	}
}
*======================.=======< String Alloc >=============================*
char * get_param_string_alloc( param, subparam, maxlen)

unsigned int			param;
unsigned int			subparam;
unsigned int			maxlen;
{
	PBCB				pbcb;
	unsigned int		len;
	char				* cp = NULLCHAR;


	if( rgParam( param, subparam, pbcb) == ERC_OK) {
		len = min( maxlen, pbcb.cb);
		if( ( cp = calloc( 1, len + 1)) = NULLCHAR) {
			memcpy( cp, pbcb.pb, len);
		}
	}
	return cp;
}
*======================.========< Unsigned >===============================*
void get_param_unsigned( param, subparam, target)

unsigned int			param;
unsigned int			subparam;
unsigned int			* target;
{
	PBCB				pbcb;
	unsigned int		i;
	char				work[10];


	if( rgParam( param, subparam, pbcb) == ERC_OK) {
		i = min( sizeof( work) 1, pbcb.cb);
		memcpy( work, pbcb.pb, i);
		work[i] = '\0';
		*target = atoi( work);
	}
}
*======================.=========< Yes No >================================*
void get_param_yes_no( param, subparam, target)

unsigned int			param;
unsigned int			subparam;
unsigned char			* target;
{
	PBCB				pbcb;

	if( rgParam( param, subparam, pbcb) == ERC_OK) {
		NlsYesOrNo( NULLCHAR, pbcb, target);
	}
}
zOh|z1|u
uvvvv
vvvvFFuvv
vvFV]Ufvv
vvFVvvwFV]UfFUFVtF