🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: strins()

#15
From: Miguel Casteleiro
Date: Tue, 13 Jun 1989 00:38
47 lines
1864 bytes
In article <109394@sun.Eng.Sun.COM>, cmcmanis%pepper@Sun.COM (Chuck McManis) writes:
> 
> SUMMARY:
> 	(void) strins(s1, s2)
> 	char *s1, *s2;
> 
> Null terminated string s2 is copied into the front of null terminated
> string s1. So if s2 had a pointer to "foo" in it and s1 had a pointer
> to "bar" in it, after the call s1 will point to a string "foobar".
                                                           ^^^^^^^^
  Shouldn't it be "barfoo" ??

> 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;
> }
>
> --Chuck McManis

   Am I missing something, or this is exactly wath strcat is suppose to do !!

   From the UNIX manual:

SYNTAX
     char *strcat(s1, s2)
     char *s1, *s2;

DESCRIPTION
     The arguments s1 and s2 point to strings (arrays of
     characters terminated by a null character).

     The strcat subroutine appends a copy of string s2 to the end
     of string s1.


-- 
                                                                      __
 Miguel Casteleiro at                                            __  ///
 INESC, Lisboa, Portugal.                                        \\\/// Only
 UUCP: ...!mcvax!inesc!jmsc   "Life is hard and then you die."    \XX/ Amiga
Technical Details
Message-ID: <897@inesc.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!inesc!jmsc
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!inesc!jmsc
From: jmsc@inesc.UUCP (Miguel Casteleiro)
Newsgroups: comp.sys.amiga.tech
Subject: Re: strins()
Summary: ... and what about strcat ???
Keywords: Lattice C Manx Aztec C strins()
Message-ID: <897@inesc.UUCP>
Date: 13 Jun 89 00:38:36 GMT
References: <0929.AA0929@caleb> <109394@sun.Eng.Sun.COM>
Organization: INESC - Inst. Eng. Sistemas e Computadores, LISBOA. PORTUGAL.
Lines: 47