Changeset 1696 for branches/daemon


Ignore:
Timestamp:
Apr 10, 2007, 2:27:46 AM (15 years ago)
Author:
joshe
Message:

Add strlcpy and strlcat from openbsd and use them when not provided by libc.

Location:
branches/daemon
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/daemon/configure

    r1621 r1696  
    137137  then
    138138    CFLAGS="$CFLAGS -DHAVE_LRINTF"
     139  fi
     140  rm -f testconf*
     141}
     142
     143strlcpy_test()
     144{
     145  verbose strlcpy_test
     146  cat > testconf.c << EOF
     147#include <string.h>
     148int main()
     149{
     150  char buf[] = "1234:p";
     151  strlcpy( buf, "foo", sizeof buf );
     152  return ( 0 == memcmp( buf, "foo\0:p, 6 ) ? 0 : 1 );
     153}
     154EOF
     155  if runcmd $CC -o testconf testconf.c && runcmd ./testconf
     156  then
     157    CFLAGS="$CFLAGS -DHAVE_STRLCPY"
     158  fi
     159  rm -f testconf*
     160}
     161
     162strlcat_test()
     163{
     164  verbose strlcat_test
     165  cat > testconf.c << EOF
     166#include <string.h>
     167int main()
     168{
     169  char buf[] = "1234567:p";
     170  buf[0] = '\0';
     171  strlcat( buf, "foo", sizeof buf );
     172  strlcat( buf, "bar", sizeof buf );
     173  return ( 0 == memcmp( buf, "foobar\0:p, 6 ) ? 0 : 1 );
     174}
     175EOF
     176  if runcmd $CC -o testconf testconf.c && runcmd ./testconf
     177  then
     178    CFLAGS="$CFLAGS -DHAVE_STRLCAT"
    139179  fi
    140180  rm -f testconf*
  • branches/daemon/daemon/client.c

    r1635 r1696  
    4343#include "ipc.h"
    4444#include "misc.h"
     45#include "trcompat.h"
    4546
    4647/* time out server after this many seconds */
  • branches/daemon/daemon/daemon.c

    r1617 r1696  
    4545#include "server.h"
    4646#include "torrents.h"
     47#include "trcompat.h"
    4748#include "version.h"
    4849
  • branches/daemon/daemon/misc.c

    r1635 r1696  
    3535#include "misc.h"
    3636#include "transmission.h"
     37#include "trcompat.h"
    3738
    3839static void pushdir ( char *, const char *, size_t );
  • branches/daemon/daemon/misc.h

    r1638 r1696  
    2727
    2828#include <sys/types.h>
     29#include <inttypes.h>
    2930#include <limits.h>
    3031
  • branches/daemon/daemon/remote.c

    r1635 r1696  
    4141#include "misc.h"
    4242#include "transmission.h"
     43#include "trcompat.h"
    4344
    4445#define BESTDECIMAL(d)          (10.0 > (d) ? 2 : (100.0 > (d) ? 1 : 0))
  • branches/daemon/daemon/torrents.c

    r1641 r1696  
    4646#include "torrents.h"
    4747#include "transmission.h"
     48#include "trcompat.h"
    4849
    4950#define EXIT_TIMEOUT 10         /* how many seconds to wait on exit */
  • branches/daemon/libtransmission/internal.h

    r1614 r1696  
    131131typedef enum { TR_NET_OK, TR_NET_ERROR, TR_NET_WAIT } tr_tristate_t;
    132132
     133#include "trcompat.h"
    133134#include "platform.h"
    134135#include "bencode.h"
  • branches/daemon/mk/lib.mk

    r1405 r1696  
    77       metainfo.c sha1.c utils.c fdlimit.c clients.c completion.c \
    88       platform.c ratecontrol.c choking.c natpmp.c upnp.c http.c xml.c \
    9        shared.c torrent.c
     9       shared.c torrent.c strlcpy.c strlcat.c
    1010
    1111OBJS = $(SRCS:%.c=%.o)
Note: See TracChangeset for help on using the changeset viewer.