euglug.org

[Eug-lug] c and va_*

작성자

카테고리:



Senior GoatSun Jun 20 20:57:02 PDT 2004

Have you tried man va_copy?  Maybe man stdarg.

Should list the requirements for va_copy.  Make sure the includes are being 
included.

Don't be afraid of man -k [term] to search for things.

>From: Rob Hudson <rob at euglug.net>
>Reply-To: Eugene Unix and Gnu/Linux User Group <euglug at euglug.org>
>To: EUGLUG <euglug at euglug.org>
>Subject: [Eug-lug] c and va_*
>Date: Sun, 20 Jun 2004 20:50:24 -0700
>
>Hi EUGLUG,
>
>I discovered elmo, not the cartoon character, but the mail client:
>http://elmo.sourceforge.net/  I thought it might make a nice replacement 
to
>mutt, which I've been using on my server for years.
>
>I wanted to try it on my FreeBSD server but it dies on the linking stage
>saying:
>/usr/local/src/elmo-1.2.0/src/str.c(.text+0x28d): undefined reference to 
`va_copy'
>
>Do you know what va_copy does?  Is it part of C?
>
>Here's the actual function in str.c:
>
>int
>str_vsprintf (str_t *str, const char *fmt, va_list ap)
>{
>         int     n;
>         int     max_size;
>         va_list copy;
>
>         if (str == NULL || fmt == NULL)
>                 return -1;
>
>         while (1){
>                 max_size = str->size - str->len - 1;
>                 va_copy (copy, ap);
>                 n = vsnprintf (str->str + str->len, max_size, 
fmt, copy);
>                 if (n > -1 && n < max_size){
>                         str->len += n;
>                         return n;
>                 }
>                 if (n > -1)
>                         while (max_size < n + 1){
>                                 str->size *= 2;
>                                 max_size   = str->size - 
str->len;
>                         }
>                 else {
>                         str->size *= 2;
>                 }
>
>                 str->str = xrealloc (str->str, str->size + 1);
>         }
>}
>
>_______________________________________________
>EUGLUG mailing list
>euglug at euglug.org
>http://www.euglug.org/mailman/listinfo/euglug

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963