🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #50

Re: strins()

#50
From: Christian Motz
Date: Wed, 14 Jun 1989 00:37
34 lines
1258 bytes
In article <109394@sun.Eng.Sun.COM> cmcmanis%pepper@Sun.COM (Chuck McManis) writes:
>
> [...]
>
>Probably the best way to simulate this is with :
>string(s1, s2)
>	char	*s1, *s2;
>{
>	char tmp[80];
>
>	strcpy(tmp, s1);
>	strcat(tmp, s2);
>	strcpy(s1, tmp);
>	return;
>}

Maybe so, but isn't this a little bit inflexible? I usually use the
following routine:

char *strins(at, str)
char *at, *str;
{
	movmem(at, at+strlen(str), strlen(at)+1);
	movmem(str, at, strlen(str));
	return at;
}

There is no limit to your string length imposed by this routine,
you don't need a lot of valuable stack space, and who knows, it
might even be a tick faster ...

--
Christian Motz       uucp: ...!uunet!mcvax!unido!pfm!nadia!dialog!root
"Trust me, I know what I'm doing!" -- Sledge Hammer         Bix: cmotz
Technical Details
Message-ID: <916@dialog.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!unido!pfm!nadia!dialog!root
References: <0929.AA0929@caleb> <109394@sun.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!unido!pfm!nadia!dialog!root
From: root@dialog.UUCP (Christian Motz)
Newsgroups: comp.sys.amiga.tech
Subject: Re: strins()
Message-ID: <916@dialog.UUCP>
Date: 14 Jun 89 00:37:40 GMT
References: <0929.AA0929@caleb> <109394@sun.Eng.Sun.COM>
Reply-To: root@dialog.UUCP (Christian Motz)
Organization: Dialog Software Development
Lines: 34