🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #13597

Re: String Processing Instruction

#13597
From: stevew
Date: Sat, 11 Apr 1987 17:13
24 lines
1625 bytes
In article <486@danews.ATT.COM>, lvc@danews.ATT.COM (Larry Cipriani) writes:
> In article <15317@amdcad.UUCP>, rpw3@amdcad.UUCP (Rob Warnock) writes:
> > I find myself doing:
> > 	char *p = &buf[0];
> > 	int n;
> > 	strcpy(p, "piece");		p += strlen(p);
> > 	strcpy(p, "another piece");	p += strlen(p);
> > 	etc...
> It seems to me that the code would be far more readable and faster
> if it were written as:
> 	p = cat(p1, p2, ..., (char*)0);
> where all the p's are pointers to characters.  Cat will malloc
> enough space to store a concatenation of all the pn's and a '\0'.

Another possible solution would be:
	cat(p, n, p1, p2, ..., (char*)0);
Where p == destination string,  n == amount of space available,
p1 == the first pointer,  etc...

You might have two versions one with n, one without.  The debate is now
what it should return:
	1. pointer to the initial string.
	2. the number of characters cat()'ed.
	3. a pointer to the terminating null.
Technical Details
Message-ID: <467@karau.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!dayton!ems!meccts!nis!karau!stevew
References: <15292@amdcad.UUCP> <978@ames.UUCP> <15304@amdcad.UUCP> <486@danews.ATT.COM>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!dayton!ems!meccts!nis!karau!stevew
From: stevew@karau.UUCP
Newsgroups: comp.arch,comp.lang.c
Subject: Re: String Processing Instruction
Message-ID: <467@karau.UUCP>
Date: Sat, 11-Apr-87 12:13:08 EST
Article-I.D.: karau.467
Posted: Sat Apr 11 12:13:08 1987
Date-Received: Sun, 12-Apr-87 17:40:58 EST
References: <15292@amdcad.UUCP> <978@ames.UUCP> <15304@amdcad.UUCP> <486@danews.ATT.COM>
Distribution: na
Organization: Karau Assoc. Inc., Hopkins MN
Lines: 24
Keywords: strlen strcmp strcpy
Summary: another cat() proposal