Not found [cups_]strl{cat|cpy} in Fedora 5

Michael Sweet mike at easysw.com
Tue Jun 20 13:10:26 PDT 2006


Emanuel Moura dos Santos wrote:
> Hi,
> 
> I'm using Fedora core 5. The script ./configure not found functions strlcat and strlcpy (or cups_strlcat/cpy) required for compile DDK. I found these in my system:
> 
> /usr/include/openssl/buffer.h:
>     size_t BUF_strlcpy(char *dst,const char *src,size_t siz);
>     size_t BUF_strlcat(char *dst,const char *src,size_t siz);
> 
> /usr/include/glib-2.0/glib/gstrfuncs.h:
>     gsize g_strlcpy(gchar *dest,const gchar *src,gsize dest_size);
>     gsize g_strlcat(gchar *dest,const gchar *src,gsize dest_size);
> 
> /usr/include/pppd/pppd.h:
>     size_t strlcpy __P((char *, const char *, size_t));
>     size_t strlcat __P((char *, const char *, size_t));
> 
> I did not obtain to use none of these.
> 
> I wrote the following code:
> 
> #include <string.h>
> 
> size_t cups_strlcpy(char *dest,const char *src,size_t dest_maxsize)
> {
>     strncpy(dest,src,dest_maxsize);
>     dest[dest_maxsize-1] = 0;
>     return strlen(dest) + 1;
> }
> 
> size_t cups_strlcat(char *dest,const char *src,size_t dest_maxsize)
> {
>     size_t dest_len = strlen(dest);
>     if(dest_len < dest_maxsize - 1) {
>         return dest_len +
>                cups_strlcpy(&dest[dest_len],src,dest_maxsize-dest_len);
>     } else return dest_maxsize;
> }
> 
> Now, I successfully compile DDK.
> 
> The algorithm for the functions above is correct?

Yes; the issue is that the emulation functions in libcups are not
public APIs, and the DDK was never supposed to use them.  This is
fixed in what will become v1.1 of the CUPS DDK (still a work in
progress...)

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Document Software          http://www.easysw.com




More information about the cups mailing list