🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: strins()

#48
From: Doug Merritt
Date: Wed, 14 Jun 1989 18:18
30 lines
1456 bytes
In article <109819@sun.Eng.Sun.COM> cmcmanis@sun.UUCP (Chuck McManis) writes:
>In article <897@inesc.UUCP> jmsc@inesc.UUCP (Miguel Casteleiro) writes:
>>   Am I missing something, or this is exactly wath strcat is suppose to do !!
>
>Your missing something, it is the _inverse_ of strcat(). strins() _prepends_
>strings, whereas strcat() _appends_ strings.
>
He's not missing as much as you think; your posted example definition of
strins() had a bug in it such that it actually implemented the functionality
of strcat()!

I didn't say anything at the time because I figured it was an obvious
mistake and somebody else would probably nitpick it anyway.

If anyone's still confused, this is what he *meant*:

strins(d, s)
	char	*d, *s;
{
	char	tmp[256];

	strcpy(tmp, s);
	strcat(tmp, d);
	strcpy(d, tmp);
}

	Doug
-- 
Doug Merritt		{pyramid,apple}!xdos!doug
Member, Crusaders for a Better Tomorrow		Professional Wildeyed Visionary
Technical Details
Message-ID: <385@xdos.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!motcsd!xdos!doug
References: <0929.AA0929@caleb> <109394@sun.Eng.Sun.COM> <897@inesc.UUCP> <109819@sun.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!motcsd!xdos!doug
From: doug@xdos.UUCP (Doug Merritt)
Newsgroups: comp.sys.amiga.tech
Subject: Re: strins()
Keywords: Lattice C Manx Aztec C strins()
Message-ID: <385@xdos.UUCP>
Date: 14 Jun 89 18:18:36 GMT
References: <0929.AA0929@caleb> <109394@sun.Eng.Sun.COM> <897@inesc.UUCP> <109819@sun.Eng.Sun.COM>
Reply-To: doug@xdos.UUCP (Doug Merritt)
Organization: Hunter Systems, Mountain View CA (Silicon Valley)
Lines: 30