lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> but there must be a public-domain or MIT-licencsed

Mark Martinec's snprintf etc fits the bill. I have used it
and it is implementable on even very primitive platforms.
It is reliable. If the problem is the license and you want
a MIT license then email him, he will probaly accomodate 
your wishes.
David B

David Jones <drj@pobox.com> wrote:

>On Mar 04, 2004, at 16:19, Luiz Henrique de Figueiredo wrote:
>
>> I wrote a simple (public-domain) implementation of most of the 
>> functions from
>> the standard C library that are needed by the Lua core. Unfortunately, 
>> it
>> does not contain vsprinf, but there must be a public-domain or 
>> MIT-licencsed
>> implementation of it somewhere.
>> --lhf
>>
>> /*
>> * libc.c
>> * functions from the standard C library that are needed by the Lua core
>> */
>>
>> char *strncpy(char *d, const char *s, size_t n)
>> {
>>  char *t=d;
>>  while (n-- && (*t++=*s++)) ;
>>  return d;
>> }
>
>The ISO C strncpy is required to always write exactly n chars into the 
>destination (null characters are appended).  This fact is not nearly 
>well enough known.  Presumably you know for sure, but I doubt that Lua 
>relies on this null padding.
>
>Also, many of the prototypes are not C99 compliant, but that is really 
>the standard's fault, not yours.
>
>David Jones