File:  [Research Unix] / researchv10no / cmd / basic / bite / src / str.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

/* Copyright Bell Telephone Laboratories Whippany, N.J.

 *	/////////////////////////////////////
 *	/////////////////////////////////////
 *	/////////////// str.c ///////////////
 *	/// J. P. Hawkins WH X4610 8C-001 ///
 *	///// Thu Mar  5 10:38:56 1981 //////
 *	/////////////////////////////////////
 *	/////////////////////////////////////
 *	@(#) str.c: V1.1 3/5/81
 * BASIC	str$(expr)
 *		returns ASCII string representing evaluated expression
 */
#include	"bas.h"

char	*
str(exp)
char	exp[];
{
	double	evalx(),val;
	char	num[40];
	char	s[40];

	val = evalx(exp);		/* convert to numerical value */
	sprintf(s, "%g", val);		/* convert the number to ASCII */
	num[0] = '\0';
	if(val >= 0.0)			/* put blank in place of - sign */
		strcat(num," ");
	strcat(num,s);			/* copy number to result */
	return(num);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.