🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5150

Re: char *strcat(), *strcpy(), *fgets();

#5150
From: Skip Tavakkolian
Date: Fri, 01 Jul 1988 02:31
44 lines
2333 bytes
In article <4773@haddock.ISC.COM>, karl@haddock.ISC.COM (Karl Heuer) writes:
> In article <11580010@hpisod2.HP.COM> decot@hpisod2.HP.COM (Dave Decot) writes:
> >While it's clear that we can't change the return value of strcat() because
> >of applications (such as the one above) that use it, there's nothing to
> >prevent adding more useful functions:
> Since this is comp.std.c, I'll redeclare your list in ANSI.
> >    char *strecpy(char *, char *)
> >    char *strecat(char *, char *)
> >    size_t strlcpy(char *, char *)
> >    size_t strlcat(char *, char *)
> Actually, given a useful set of end-string functions (including the simplest
> one, "char *strend(char *)"), I see no need for any of the "cat" functions.
> Even the standard strcat(x,y) is just strcpy(strend(x),y), and if the
> application was designed properly it probably already has the value of
> strend(x) in hand.
> As Doug has noted, "str*" is reserved to the implementation.  Thus, the vendor
> is free to add any of these to <string.h> as an extension (and would still
> have a conforming implementation).  I suppose many implementations will put
> strdup() there.
> Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint


Whitesmiths Ltd. had (still has but are now called WSL extensions to ANSI C),
several library routines dealing with multiple copy operations. For example:

	/* I do not recall the return value, but I think it is */
	char *cpystr(destination, _1st_source [, _2nd_source, ...], NULL)
		char *destination, *_1st_source, *_2nd_source, ...;

	/* last arg passed has to be `NULL' */

so that you can say:

	char buf[BUFSIZ];
	cpystr(&buf[0], "This ", "is ", "a test", NULL);

I think this will do what, the original code that was posted, was trying to.
(Yes/No)?

Sincerely
-- 
Fariborz ``Skip'' Tavakkolian

UUCP	...!uw-beaver!tikal!mcgp1!fst
Technical Details
Message-ID: <1426@mcgp1.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!pilchuck!ssc!apcisea!mcgp1!fst
References: <1309@ark.cs.vu.nl> <11580010@hpisod2.HP.COM> <4773@haddock.ISC.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!pilchuck!ssc!apcisea!mcgp1!fst
From: fst@mcgp1.UUCP (Skip Tavakkolian)
Newsgroups: comp.std.c
Subject: Re: char *strcat(), *strcpy(), *fgets();
Summary: Does anybody know about Whitesmiths C libraries?
Message-ID: <1426@mcgp1.UUCP>
Date: 1 Jul 88 02:31:47 GMT
References: <1309@ark.cs.vu.nl> <11580010@hpisod2.HP.COM> <4773@haddock.ISC.COM>
Organization: Computer Tools Int'l Inc.
Lines: 44