Commit Graph

19 Commits

Author SHA1 Message Date
Kevin Easton
fea88185f8 Clean up function move_to_abs_word() and rename to move_to_word()
Remove the output argument, as it's the same as the function return value anyway, so
the callers should just use that.
2017-11-14 23:15:33 +11:00
Kevin Easton
5e40c1ac01 Don't move pointer before start of object in move_word_rel()
The old code could move the variable 'pointer' backwards one character before the start
of the string (then incremented it again before returning).  Formally this is undefined
behaviour, so fix it.
2017-11-12 23:34:54 +11:00
Kevin Easton
bbd18ba47e Introduce time_offset() helper and replace open-coded versions in timer.c
This function takes a struct timeval and offsets it by a (potentially fractional)
number of seconds, given as a 'double'.
2017-09-20 23:07:52 +10:00
Kevin Easton
0a16ab16ac Introduce strbegins() macro and replace all open-coded instances
This test is done quite a bit across the tree, and the open-coded variants make it easy to have an
accidental mismatch between the length of the prefix being tested and the length actually passed to
strncmp().

This fixes an issue of that type comparing the server version against the prefix "u2.10", where the old
code used an incorrect length of 4.
2017-06-06 23:47:10 +10:00
Kevin Easton
84fc347f5a Move declarations of compat functions from ircaux.h to irc_std.h
irc_std.h is where these belong - it's where the normal declarations (via the system headers) come from on
systems which don't need the compat functions.
2017-05-05 00:28:21 +10:00
Kevin Easton
eb4b2a29d6 Remove unused function quote_it()
This function is no longer needed.  It was problematic anyway because it didn't have a way for
the caller to specify the destination buffer size.
2016-10-13 01:44:29 +11:00
Kevin Easton
d0b0a95330 Convert skip_ctl_c_seq() and its callers (except strip_ansi()) from unsigned char to char
This should make no functional difference, and cuts out a large number of
unsigned char * / char * mismatch warnings.
2015-06-17 22:50:49 +10:00
Kevin Easton
7eae2aba86 Change arguments of my_strnstr() from const unsigned char * to const char *
This kills warnings in both ircaux.c and input.c.
2015-06-07 00:30:05 +10:00
Kevin Easton
b14d0ddcb9 Add timer_cmp() utility function to compare two timevals.
This is preferable to using time_diff() to compare two timevals, because
time_diff() gives its result as a 'double' which only has 53 bits of
precision.

Also switch a couple of places from using time_diff() to using
this function.
2015-05-21 01:21:02 +10:00
Kevin Easton
b944573a5e Minor fixes to enable compiling against TCL8.5
Define USE_NON_CONST so that the newer TCL headers define functions in the
same way as pre-8.4 TCL headers.  It will be a good idea to change to
USE_COMPAT_CONST instead at some point.

Also use ckfree() instead of free() to free an allocation returned by TCL.
2015-05-16 22:20:25 +10:00
Kevin Easton
4ee6c6295b Add time_until() and time_since() utility functions
Adding these in preparation for converting server->connect_time from time_t
to struct timeval.  Also converts three existing open-coded versions over to
the new functions.
2015-05-13 21:50:30 +10:00
Kevin Easton
3de05c07c1 Only build and use the compat.c bsd_setenv/bsd_putenv/bsd_unsetenv on systems
that don't provide the POSIX setenv().

This fixes building plugins that link to compat.c on OS X (shared libraries on
OS X don't have direct access to environ).  It also reduces the binary size on
platforms which provide setenv(), which these days is most of them.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@382 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-09 21:40:55 +00:00
Kevin Easton
5582171286 Switch random_number() to always use the best entropy source for internal
client purposes.  The RANDOM_SOURCE setting now only affects the $rand()
scripting function.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@357 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-17 14:47:04 +00:00
Tim Cava
a3b938dfd5 Make the addrlen argument to my_accept() a socklen_t.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@277 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 02:59:11 +00:00
Kevin Easton
1541299fa1 Merge infrastructure for SASL authentication support from flashback.
This includes all of the underlying support, but doesn't hook it up to the
/SERVER command yet, so it's not useable at this point.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@216 13b04d17-f746-0410-82c6-800466cd88b0
2012-12-30 02:22:56 +00:00
Kevin Easton
7ac4b8520c Convert my_stricmp, my_strnicmp and wild_match from unsigned char * to char *.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@80 13b04d17-f746-0410-82c6-800466cd88b0
2009-11-24 10:21:30 +00:00
Kevin Easton
3de93b1dbc Far-reaching changes to make BitchX compatible with 64 bit architectures
like x86-64, where sizeof(int) != sizeof (void *).  This involves correctly
casting every function pointer from the global table to the correct
function type, which has the added benefit of allowing type-checking of
function arguments and return values.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@26 13b04d17-f746-0410-82c6-800466cd88b0
2008-04-30 13:57:56 +00:00
Kevin Easton
533c3dbcbf Turn on SVN keyword replacement for $Date$, $Author$, $Revision$, $Id$ for all
*.c and *.h files.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/branches/ircii-pana-1.1@3 13b04d17-f746-0410-82c6-800466cd88b0
2008-02-25 09:49:14 +00:00
Kevin Easton
28febcfea9 Initial import of the ircii-pana-1.1-final source tree.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/tags/ircii-pana-1.1-final@1 13b04d17-f746-0410-82c6-800466cd88b0
2008-02-25 09:25:32 +00:00