TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Roger Scudder
from: Bob Stout
date: 2003-09-24 09:05:52
subject: RE: Snippets ini.c

From: rbs{at}snippets.org
To: c_echo{at}yahoogroups.com

On Wed, 24 Sep 2003, Roger Scudder wrote:

> Beauty is in the eye of the beholder.  I find the following to be easier
> on my eyes.
>
> static char *notrail(char *s)
> {
> 	if (s)
> 	{
> 		char n = strlen(s)-1;
> 		while(n >= 0 && isspace(s[n]))
> 			s[n--] = '\0';
> 	}
> 	return s;
> }

And I personally prefer...

----[ snip ]----
char *rmtrail(char *str)
{
      if (str)
      {
            int i;

            for (i = strlen(str) - 1; i >= 0 && isspace(str[i]); --i)
                  ;
            str[++i] = NUL;
      }
      return str;
}
----[ snip ]----

...proving once again that programming is both art and science and, like
any art, subject to matters of taste.

-------------------------------------------------------------
Consulting: http://www.MicroFirm.biz/
Web graphics development: http://Image-Magicians.com/
Software archives: http://snippets.snippets.org/
  c.snippets.org/   cpp.snippets.org/      java.snippets.org/
  d.snippets.org/   python.snippets.org/   perl.snippets.org/
  dos.snippets.org/ embedded.snippets.org/ apps.snippets.org/
Audio and loudspeaker design:
  http://LDSG.snippets.org/   http://www.diyspeakers.net/

--- SoupGate-Win32 v1.05
* Origin: rbs{at}snippets.org (2:292/516.666)
SEEN-BY: 633/267 270
@PATH: 292/516 854 140/1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.