Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
Re: [Freeciv-Dev] snprintf, again
Home

Re: [Freeciv-Dev] snprintf, again

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jazepeda@xxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] snprintf, again
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Tue, 24 Aug 1999 18:58:56 +1000 (EST)

Alex Zepeda wrote:

> Say what you will, but I think that grabbing an appropiate copy of
> snprintf and vnprintf is a very easy thing to do, 

Well, so far no-one has done so for freeciv, and this issue
has been around for a while...

> and will require very little maintenence. 

Easy for you to say ;-)

> Snprintf would be implemented on top of vnprintf

Certainly (assuming you really mean vsnprintf).

> which if not available would be IIRC implemented on top of vprintf which
> nearly everything has AFAIK.

Huh?  If only it were so easy -- the whole problem is that one
can't safely implement vsnprintf on top of vsprintf, without 
doing some trickery like mprotect(), or calculating an upper 
bound and malloc/strncpy/free, or similar.

> For example, Apache, ssh, KDE, Qt, and IIRC even Gnome have snprintf
> implemented in a rather portable manner.  Finding a ready made copy is IMO
> much easier than reinventing the wheel.

If you think so, I certainly invite you (or anyone else) to 
volunteer to find such an appropriate implementation and submit 
a patch to add it to freeciv.  

And be prepared to argue that it doesn't suffer (or doesn't 
suffer too much) from previously mentioned problems :-)  

And note the licensing must be suitable: apache I think is 
maybe not (advertising and other clauses); ssh is not open 
source; Qt remains problematic wrt GPL despite QPL.

My previous post was made _after_ previously looking at a few such
implementations (though certainly not exhastively), and finding 
a variety of methods (indeed unfortunately _not_ finding one 
drop-in implementation which everyone clearly agrees is best), 
with all of them having perceived problems with complexity and/or 
portability.

Regards,
-- David

[Prev in Thread] Current Thread [Next in Thread]