ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/irc_string.c
(Generate patch)

Comparing:
ircd-hybrid/src/irc_string.c (file contents), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid-7.3/src/irc_string.c (file contents), Revision 1045 by michael, Tue Jan 26 12:58:42 2010 UTC

# Line 22 | Line 22
22   *  $Id$
23   */
24  
25 + #include "config.h"
26 + #ifdef HAVE_LIBPCRE
27 + #include <pcre.h>
28 + #endif
29 +
30   #include "stdinc.h"
26 – #include "tools.h"
27 – #include "pcre.h"
31   #include "irc_string.h"
32   #include "sprintf_irc.h"
30 – #include "client.h"
31 – #include "list.h"
32 – #include "memory.h"
33  
34   #ifndef INADDRSZ
35   #define INADDRSZ 4
# Line 44 | Line 44
44   #endif
45  
46  
47 – char *
48 – xstrldup(const char *s, size_t n)
49 – {
50 –  size_t len = strlen(s) + 1;
51 –  char *p = NULL;
52 –
53 –  if (len > n)
54 –    len = n;
55 –  return strlcpy((p = malloc(len)), s, len), p;
56 – }
57 –
47   /*
48   * myctime - This is like standard ctime()-function, but it zaps away
49   *   the newline from the end of that string. Also, it takes
# Line 81 | Line 70 | myctime(time_t value)
70   }
71  
72   /*
84 – * clean_string - clean up a string possibly containing garbage
85 – *
86 – * *sigh* Before the kiddies find this new and exciting way of
87 – * annoying opers, lets clean up what is sent to local opers
88 – * -Dianora
89 – */
90 – char *
91 – clean_string(char* dest, const unsigned char* src, size_t len)
92 – {
93 –  char* d    = dest;
94 –  assert(0 != dest);
95 –  assert(0 != src);
96 –
97 –  if(dest == NULL || src == NULL)
98 –    return NULL;
99 –    
100 –  len -= 3;  /* allow for worst case, '^A\0' */
101 –
102 –  while (*src && (len > 0))
103 –  {
104 –    if (*src & 0x80)             /* if high bit is set */
105 –    {
106 –      *d++ = '.';
107 –      --len;
108 –    }
109 –    else if (!IsPrint(*src))       /* if NOT printable */
110 –    {
111 –      *d++ = '^';
112 –      --len;
113 –      *d++ = 0x40 + *src;   /* turn it into a printable */
114 –    }
115 –    else
116 –      *d++ = *src;
117 –    ++src, --len;
118 –  }
119 –  *d = '\0';
120 –  return dest;
121 – }
122 –
123 – /*
73   * strip_tabs(dst, src, length)
74   *
75   *   Copies src to dst, while converting all \t (tabs) into spaces.
# Line 249 | Line 198 | inetntoa(const char *in)
198    return buf;
199   }
200  
201 < #ifndef HAVE_BASENAME
253 <
254 < /* basename()
201 > /* libio_basename()
202   *
203   * input        - i.e. "/usr/local/ircd/modules/m_whois.so"
204   * output       - i.e. "m_whois.so"
205   * side effects - this will be overwritten on subsequent calls
206   */
207 < char *
208 < basename(char *path)
207 > const char *
208 > libio_basename(const char *path)
209   {
210 <  char *s;
210 >  const char *s;
211  
212    if ((s = strrchr(path, '/')) == NULL)
213      s = path;
# Line 270 | Line 217 | basename(char *path)
217    return s;
218   }
219  
273 – #endif /* !HAVE_BASENAME */
274 –
220   /*
221   * Copyright (c) 1996-1999 by Internet Software Consortium.
222   *
# Line 339 | Line 284 | inet_ntop6(const unsigned char *src, cha
284           * to use pointer overlays.  All the world's not a VAX.
285           */
286          char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
287 <        struct { int base, len; } best, cur;
287 >        struct { int base, len; } best = {0,0}, cur = {0,0};
288          unsigned int words[IN6ADDRSZ / INT16SZ];
289          int i;
290  
# Line 437 | Line 382 | inetntop(int af, const void *src, char *
382      case AF_INET6:
383        if (IN6_IS_ADDR_V4MAPPED((const struct in6_addr *)src) ||
384            IN6_IS_ADDR_V4COMPAT((const struct in6_addr *)src))
385 <        return inet_ntop4((unsigned char *)&((const struct in6_addr *)src)->s6_addr[12], dst, size);
385 >        return inet_ntop4((const unsigned char *)&((const struct in6_addr *)src)->s6_addr[12], dst, size);
386        else
387          return inet_ntop6(src, dst, size);
388   #endif
# Line 542 | Line 487 | strlcpy(char *dst, const char *src, size
487   }
488   #endif
489  
490 < pcre *
490 > #ifdef HAVE_LIBPCRE
491 > void *
492   ircd_pcre_compile(const char *pattern, const char **errptr)
493   {
494    int erroroffset = 0;
# Line 554 | Line 500 | ircd_pcre_compile(const char *pattern, c
500   }
501  
502   int
503 < ircd_pcre_exec(const pcre *code, const char *subject)
503 > ircd_pcre_exec(const void *code, const char *subject)
504   {
505    assert(code && subject);
506  
507    return pcre_exec(code, NULL, subject, strlen(subject), 0, 0, NULL, 0) < 0;
508   }
509 + #endif

Comparing:
ircd-hybrid/src/irc_string.c (property svn:keywords), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid-7.3/src/irc_string.c (property svn:keywords), Revision 1045 by michael, Tue Jan 26 12:58:42 2010 UTC

# Line 1 | Line 1
1 < Revision
1 > Id Revision

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)