swh:1:snp:2ca5d6eff8f04a671c0d5b13646cede522c64b7d
Raw File
Tip revision: 1341150ac0d1b1758ec027ffa396173ef97c220a authored by Bill Joy on 01 February 1978, 17:53:23 UTC
BSD 1 development
Tip revision: 1341150
string.c
#
/*
 * pxp - Pascal execution profiler
 *
 * Bill Joy UCB
 * Version 1.0 August 1977
 */

#include "0.h"

/*
 * STRING SPACE DECLARATIONS
 *
 * Strng is the base of the current
 * string space and strngp the
 * base of the free area therein.
 * No array of descriptors is needed
 * as string space is never freed.
 */
STATIC	char strings[STRINC];
STATIC	char *strng strings;
STATIC	char *strngp strings;

/*
initstring()
{

}
 */
/*
 * Copy a string into the string area.
 */
savestr(cp)
	register char *cp;
{
	register int i;

	i = strlen(cp) + 1;
	if (strngp + i >= strng + STRINC) {
		strngp = alloc(STRINC);
		if (strngp == -1) {
			yerror("Ran out of memory (string)");
			pexit(DIED);
		}
		strng = strngp;
	}
	strcpy(strngp, cp);
	cp = strngp;
	strngp = cp + i;
	return (cp);
}

esavestr(cp)
	char *cp;
{

	strngp = (strngp + 1) &~ 1;
	return (savestr(cp));
}
back to top