ftp.nice.ch/pub/next/text/rtf/RTF.1.10.s.tar.gz#/rtf/lib-mac/misc.c

This is misc.c in view mode; [Download] [Up]

/*
 * misc.c - miscellaneous stuff
 */

# include	<stdio.h>

# include	"rtf-mac.h"

/* ------------------------------------------------------------------ */

/*
 * Return Pascal string containing application name
 */


StringPtr
ApplicationName (void)
{
static Str31	appName;
short			appRefNum;	/* ignored */
Handle			appParam;	/* ignored */

	GetAppParms (appName, &appRefNum, &appParam);
	return (appName);
}


/* ------------------------------------------------------------------ */

/*
 * String operations
 */

void
PStrCpy (StringPtr dst, StringPtr src)
{
	BlockMove (src, dst, src[0] + 1);
}


void
PStrCat (StringPtr dst, StringPtr src)
{
	BlockMove (src + 1, dst + dst[0] + 1, src[0]);
	dst[0] += src[0];
}


void
PStrInsert (StringPtr dst, StringPtr src)
{
	BlockMove (dst + 1, dst + src[0] + 1, dst[0]);
	BlockMove (src + 1, dst + 1, src[0]);
	dst[0] += src[0];
}


Boolean
PStrEqual (StringPtr s1, StringPtr s2)
{
short	i;

	/*
	 * Loop counter begins at zero, so if the length bytes are
	 * different, the comparison fails immediately.
	 */

	for (i = 0; i <= s1[0]; i++)
	{
		if (s1[i] != s2[i])
			return (false);
	}
	return (true);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.