nmh-workers
[Top] [All Lists]

Re: Alan Cox's patches

1998-07-06 21:55:54

In message <199807060146(_dot_)VAA29174(_at_)math(_dot_)gatech(_dot_)edu>,   
you write:
Couldn't you just #ifdef HAS_SNPRINTF the things or something?

Isn't this what gnu autoconf is for?

I could.  But there is so many of them, that the code
would become unreadable.  I want a cleaner solution.

--
Richard Coleman
coleman(_at_)math(_dot_)gatech(_dot_)edu
I looked at what Keith Bostic does in nvi...

He just ignores the size parameter if you don't have
snprintf.

Here's vsnprintf:
/*
 * PUBLIC: #ifndef HAVE_VSNPRINTF
 * PUBLIC: int vsnprintf __P((char *, size_t, const char *, ...));
 * PUBLIC: #endif
 */
int
vsnprintf(str, n, fmt, ap)
        char *str;
        size_t n;
        const char *fmt;
        va_list ap;
{
#ifdef SPRINTF_RET_CHARPNT
        (void)vsprintf(str, fmt, ap);
        return (strlen(str));
#else
        return (vsprintf(str, fmt, ap));
#endif


On another note,
Can't we also do something like:

#ifdef linux
#define LINUX_STDIO 1
#endif

(LINUX_STDIO is not detected in autoconf)

marty


<Prev in Thread] Current Thread [Next in Thread>