🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5125

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

#5125
From: Doug Gwyn
Date: Thu, 23 Jun 1988 18:07
29 lines
1246 bytes
In article <1309@ark.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>Why do the functions named above return 'char *', instead of 'int', viz. the
>REALLY useful new size of the first argument string, or the number of chars
>moved?

"Historical reasons."

>Will this feature ever be changed?

No.  That would break a large number of existing correctly-written programs.

>One gets() tired of typing '(void) strcpy(buf, str);'.

Oh, I don't know about that.  Here is a real example from source code
I happened to have open in another layer on my terminal:

	(void)strcat(strcat(strcat(strcat(strcat(strcpy(fn,
							TargetDir
						       ),
       						 target
						),
					  Slash
  					 ),
 				   approx
   				  ),
  			    Slash
    			   ),
   		     CCMAP
     		    );
Technical Details
Message-ID: <8145@brl-smoke.ARPA>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn
References: <haddock.4604> <1719@ogcvax.ogc.edu> <1309@ark.cs.vu.nl>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn
From: gwyn@brl-smoke.ARPA (Doug Gwyn )
Newsgroups: comp.std.c
Subject: Re: char *strcat(), *strcpy(), *fgets();
Message-ID: <8145@brl-smoke.ARPA>
Date: 23 Jun 88 18:07:34 GMT
References: <haddock.4604> <1719@ogcvax.ogc.edu> <1309@ark.cs.vu.nl>
Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 29