mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-18 16:07:11 +00:00
url crash fix
This commit is contained in:
parent
9664b98665
commit
06be1ee4d2
20
configure
vendored
20
configure
vendored
@ -21,7 +21,7 @@
|
|||||||
umask 077
|
umask 077
|
||||||
|
|
||||||
# perl still unsupported
|
# perl still unsupported
|
||||||
has_perl=no
|
#has_perl=no
|
||||||
compile=no
|
compile=no
|
||||||
install=no
|
install=no
|
||||||
silentopt=no
|
silentopt=no
|
||||||
@ -1127,15 +1127,15 @@ fi
|
|||||||
# perl support not yet functional (2009-05-11)
|
# perl support not yet functional (2009-05-11)
|
||||||
#
|
#
|
||||||
def_perl='#undef PERL'
|
def_perl='#undef PERL'
|
||||||
# unset ans
|
unset ans
|
||||||
# echo $ac_n "Perl scripting support? .................... [y/N] "$ac_c
|
echo $ac_n "[ ALPHA] Perl scripting support? .................... [y/N] "$ac_c
|
||||||
# if [ "$has_perl" = no ]; then
|
if [ "$has_perl" = no ]; then
|
||||||
# echo 'no (unsupported)'
|
echo 'no (unsupported)'
|
||||||
# else
|
else
|
||||||
# test "$ft_perl" && echo "$ft_perl" && ans=$ft_perl
|
test "$ft_perl" && echo "$ft_perl" && ans=$ft_perl
|
||||||
# test -z "$ft_perl" && read ans
|
test -z "$ft_perl" && read ans
|
||||||
# test "$ans" = y -o "$ans" = Y -o "$ans" = yes -o "$ans" = YES -o "$ans" = Yes && def_perl='#define PERL'
|
test "$ans" = y -o "$ans" = Y -o "$ans" = yes -o "$ans" = YES -o "$ans" = Yes && def_perl='#define PERL'
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
def_python='#undef PYTHON'
|
def_python='#undef PYTHON'
|
||||||
unset ans
|
unset ans
|
||||||
|
|||||||
@ -274,7 +274,6 @@ LS char *au_userhost;
|
|||||||
LS char *au_channel;
|
LS char *au_channel;
|
||||||
LS int au_access;
|
LS int au_access;
|
||||||
|
|
||||||
__attr(CORE_SEG, __regparm (1) )
|
|
||||||
void aucheck(User *user)
|
void aucheck(User *user)
|
||||||
{
|
{
|
||||||
Strp *ump;
|
Strp *ump;
|
||||||
|
|||||||
@ -58,7 +58,6 @@ void check_idlekick(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG, __regparm(2))
|
|
||||||
Chan *find_channel(const char *name, int anychannel)
|
Chan *find_channel(const char *name, int anychannel)
|
||||||
{
|
{
|
||||||
Chan *chan;
|
Chan *chan;
|
||||||
@ -78,13 +77,11 @@ Chan *find_channel(const char *name, int anychannel)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG, __regparm (1))
|
|
||||||
Chan *find_channel_ac(const char *name)
|
Chan *find_channel_ac(const char *name)
|
||||||
{
|
{
|
||||||
return(find_channel(name,CHAN_ACTIVE));
|
return(find_channel(name,CHAN_ACTIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG, __regparm (1))
|
|
||||||
Chan *find_channel_ny(const char *name)
|
Chan *find_channel_ny(const char *name)
|
||||||
{
|
{
|
||||||
return(find_channel(name,CHAN_ANY));
|
return(find_channel(name,CHAN_ANY));
|
||||||
@ -546,7 +543,6 @@ void channel_massunban(Chan *chan, char *pattern, time_t seconds)
|
|||||||
* for each nickcmp call, 10-15% cpu is saved by skipping one char
|
* for each nickcmp call, 10-15% cpu is saved by skipping one char
|
||||||
* into both nicks (first-char comparison has already been made).
|
* into both nicks (first-char comparison has already been made).
|
||||||
*/
|
*/
|
||||||
__attr(CORE_SEG, __regparm (2) )
|
|
||||||
ChanUser *find_chanuser(Chan *chan, const char *nick)
|
ChanUser *find_chanuser(Chan *chan, const char *nick)
|
||||||
{
|
{
|
||||||
ChanUser *cu;
|
ChanUser *cu;
|
||||||
@ -578,7 +574,6 @@ ChanUser *find_chanuser(Chan *chan, const char *nick)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG, __regparm (2) )
|
|
||||||
void remove_chanuser(Chan *chan, char *nick)
|
void remove_chanuser(Chan *chan, char *nick)
|
||||||
{
|
{
|
||||||
ChanUser *cu,**pp;
|
ChanUser *cu,**pp;
|
||||||
@ -625,7 +620,6 @@ void remove_chanuser(Chan *chan, char *nick)
|
|||||||
/*
|
/*
|
||||||
* Requires CurrentChan to be set properly
|
* Requires CurrentChan to be set properly
|
||||||
*/
|
*/
|
||||||
__attr(CORE_SEG, __regparm(2))
|
|
||||||
void make_chanuser(char *nick, char *userhost)
|
void make_chanuser(char *nick, char *userhost)
|
||||||
{
|
{
|
||||||
ChanUser *new;
|
ChanUser *new;
|
||||||
|
|||||||
@ -391,7 +391,7 @@ void signoff(char *from, char *reason)
|
|||||||
#endif /* NOTIFY */
|
#endif /* NOTIFY */
|
||||||
if (from)
|
if (from)
|
||||||
{
|
{
|
||||||
to_user(from,"ShutDown Complete");
|
to_user(from,TEXT_SHUTDOWNCOMPLETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(current->chanlist)
|
while(current->chanlist)
|
||||||
|
|||||||
@ -141,6 +141,7 @@ LS struct
|
|||||||
{ make_ban, "make_ban" },
|
{ make_ban, "make_ban" },
|
||||||
{ make_chanuser, "make_chanuser" },
|
{ make_chanuser, "make_chanuser" },
|
||||||
{ make_ireq, "make_ireq" },
|
{ make_ireq, "make_ireq" },
|
||||||
|
{ make_strp, "make_strp" },
|
||||||
{ mirror_user, "mirror_user" },
|
{ mirror_user, "mirror_user" },
|
||||||
{ on_join, "on_join" },
|
{ on_join, "on_join" },
|
||||||
{ on_kick, "on_kick" },
|
{ on_kick, "on_kick" },
|
||||||
|
|||||||
@ -43,7 +43,6 @@ LS const char daylist[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
__attr(CORE_SEG,__regparm(1))
|
|
||||||
void *Calloc(int size)
|
void *Calloc(int size)
|
||||||
{
|
{
|
||||||
aME *mmep;
|
aME *mmep;
|
||||||
@ -98,7 +97,6 @@ void *Calloc(int size)
|
|||||||
return((void*)mmep->area+4);
|
return((void*)mmep->area+4);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG,__regparm(1))
|
|
||||||
void Free(char **mem)
|
void Free(char **mem)
|
||||||
{
|
{
|
||||||
aME *mmep;
|
aME *mmep;
|
||||||
@ -145,7 +143,6 @@ void Free(char **mem)
|
|||||||
|
|
||||||
#else /* DEBUG */
|
#else /* DEBUG */
|
||||||
|
|
||||||
__attr(CORE_SEG,__regparm(1))
|
|
||||||
void *Calloc(int size)
|
void *Calloc(int size)
|
||||||
{
|
{
|
||||||
void *tmp;
|
void *tmp;
|
||||||
@ -158,7 +155,6 @@ void *Calloc(int size)
|
|||||||
/*
|
/*
|
||||||
* Free() can be called with NULL's
|
* Free() can be called with NULL's
|
||||||
*/
|
*/
|
||||||
__attr(CORE_SEG,__regparm(1))
|
|
||||||
void Free(char **mem)
|
void Free(char **mem)
|
||||||
{
|
{
|
||||||
if (*mem)
|
if (*mem)
|
||||||
@ -170,7 +166,70 @@ void Free(char **mem)
|
|||||||
|
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
const int Strlen(const char *first, ...)
|
Strp *make_strp(Strp **pp, const char *string)
|
||||||
|
{
|
||||||
|
set_mallocdoer(make_strp);
|
||||||
|
*pp = (Strp*)Calloc(sizeof(Strp) + strlen(string));
|
||||||
|
Strcpy((*pp)->p,string);
|
||||||
|
return(*pp);
|
||||||
|
}
|
||||||
|
|
||||||
|
Strp *append_strp(Strp **pp, const char *string)
|
||||||
|
{
|
||||||
|
while((*pp)->next != NULL)
|
||||||
|
pp = &((*pp)->next);
|
||||||
|
make_strp(pp,string);
|
||||||
|
return(*pp);
|
||||||
|
}
|
||||||
|
|
||||||
|
Strp *prepend_strp(Strp **pp, const char *string)
|
||||||
|
{
|
||||||
|
Strp *sp;
|
||||||
|
|
||||||
|
make_strp(&sp,string);
|
||||||
|
sp->next = *pp;
|
||||||
|
*pp = sp;
|
||||||
|
return(sp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void purge_strplist(Strp *sp)
|
||||||
|
{
|
||||||
|
Strp *nxt;
|
||||||
|
|
||||||
|
debug("do...\n");
|
||||||
|
while(sp)
|
||||||
|
{
|
||||||
|
debug("nxt =...\n");
|
||||||
|
nxt = sp->next;
|
||||||
|
debug("free...\n");
|
||||||
|
Free((char**)&sp);
|
||||||
|
debug("sp = nx\n");
|
||||||
|
sp = nxt;
|
||||||
|
debug("while..\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* duplicate a list of Strp
|
||||||
|
*/
|
||||||
|
void dupe_strp(Strp *sp, Strp **pp)
|
||||||
|
{
|
||||||
|
while(sp)
|
||||||
|
{
|
||||||
|
make_strp(pp,sp->p);
|
||||||
|
pp = &((*pp)->next);
|
||||||
|
sp = sp->next;
|
||||||
|
/*
|
||||||
|
set_mallocdoer(dupe_strp);
|
||||||
|
*pp = (Strp*)Calloc(sizeof(Strp) + strlen(sp->p));
|
||||||
|
Strcpy((*pp)->p,sp->p);
|
||||||
|
pp = &((*pp)->next);
|
||||||
|
sp = sp->next;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const int StrlenX(const char *first, ...)
|
||||||
{
|
{
|
||||||
const char *s,*o;
|
const char *s,*o;
|
||||||
int n;
|
int n;
|
||||||
@ -193,7 +252,6 @@ const int Strlen(const char *first, ...)
|
|||||||
return(n);
|
return(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG,__regparm(2))
|
|
||||||
const int Strlen2(const char *one, const char *two)
|
const int Strlen2(const char *one, const char *two)
|
||||||
{
|
{
|
||||||
const char *s1,*s2;
|
const char *s1,*s2;
|
||||||
@ -206,7 +264,6 @@ const int Strlen2(const char *one, const char *two)
|
|||||||
return((s1 - one) + (s2 - two));
|
return((s1 - one) + (s2 - two));
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG,__regparm(2))
|
|
||||||
char *nickcpy(char *dest, const char *nuh)
|
char *nickcpy(char *dest, const char *nuh)
|
||||||
{
|
{
|
||||||
char *ret;
|
char *ret;
|
||||||
@ -405,7 +462,6 @@ char *idle2str(time_t when, int small)
|
|||||||
return(idlestr);
|
return(idlestr);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CMD1_SEG,__regparm(2))
|
|
||||||
char *get_channel(char *to, char **rest)
|
char *get_channel(char *to, char **rest)
|
||||||
{
|
{
|
||||||
char *channel;
|
char *channel;
|
||||||
@ -658,7 +714,6 @@ int capslevel(char *text)
|
|||||||
return(upper >= sz);
|
return(upper >= sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG,__regparm(1))
|
|
||||||
int a2i(char *anum)
|
int a2i(char *anum)
|
||||||
{
|
{
|
||||||
int res = 0,neg;
|
int res = 0,neg;
|
||||||
@ -698,7 +753,6 @@ int get_number(const char *rest)
|
|||||||
return(n);
|
return(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG,__regparm(1))
|
|
||||||
void fix_config_line(char *text)
|
void fix_config_line(char *text)
|
||||||
{
|
{
|
||||||
char *s,*space;
|
char *s,*space;
|
||||||
@ -720,7 +774,6 @@ void fix_config_line(char *text)
|
|||||||
/*
|
/*
|
||||||
* returns NULL or non-zero length string
|
* returns NULL or non-zero length string
|
||||||
*/
|
*/
|
||||||
__attr(CORE_SEG,__regparm(1))
|
|
||||||
char *chop(char **src)
|
char *chop(char **src)
|
||||||
{
|
{
|
||||||
char *tok,*cut = *src;
|
char *tok,*cut = *src;
|
||||||
@ -749,7 +802,6 @@ char *chop(char **src)
|
|||||||
/*
|
/*
|
||||||
* remove all '\0' in an array bounded by two pointers
|
* remove all '\0' in an array bounded by two pointers
|
||||||
*/
|
*/
|
||||||
__attr(CORE_SEG,__regparm(2))
|
|
||||||
void unchop(char *orig, char *rest)
|
void unchop(char *orig, char *rest)
|
||||||
{
|
{
|
||||||
for(;orig<rest;orig++)
|
for(;orig<rest;orig++)
|
||||||
@ -759,7 +811,6 @@ void unchop(char *orig, char *rest)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__att2(CORE_SEG,const,__regparm(2))
|
|
||||||
int Strcasecmp(const char *p1, const char *p2)
|
int Strcasecmp(const char *p1, const char *p2)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -773,7 +824,6 @@ int Strcasecmp(const char *p1, const char *p2)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
__att2(CORE_SEG,const,__regparm(2))
|
|
||||||
int Strcmp(const char *p1, const char *p2)
|
int Strcmp(const char *p1, const char *p2)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -787,7 +837,6 @@ int Strcmp(const char *p1, const char *p2)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
__att2(CORE_SEG,const,__regparm(2))
|
|
||||||
int nickcmp(const char *p1, const char *p2)
|
int nickcmp(const char *p1, const char *p2)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -802,7 +851,6 @@ int nickcmp(const char *p1, const char *p2)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG,__regparm(3))
|
|
||||||
void Strncpy(char *dst, const char *src, int sz)
|
void Strncpy(char *dst, const char *src, int sz)
|
||||||
{
|
{
|
||||||
char *stop = dst + sz - 1;
|
char *stop = dst + sz - 1;
|
||||||
@ -816,7 +864,6 @@ void Strncpy(char *dst, const char *src, int sz)
|
|||||||
*dst = 0;
|
*dst = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG,__regparm(2))
|
|
||||||
char *Strcpy(char *dst, const char *src)
|
char *Strcpy(char *dst, const char *src)
|
||||||
{
|
{
|
||||||
while(*src)
|
while(*src)
|
||||||
@ -825,7 +872,6 @@ char *Strcpy(char *dst, const char *src)
|
|||||||
return(dst);
|
return(dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
__att2(CORE_SEG,const,__regparm(2))
|
|
||||||
char *Strchr(const char *t, int c)
|
char *Strchr(const char *t, int c)
|
||||||
{
|
{
|
||||||
char ch = c;
|
char ch = c;
|
||||||
@ -835,7 +881,6 @@ char *Strchr(const char *t, int c)
|
|||||||
return((*t == ch) ? (char*)t : NULL);
|
return((*t == ch) ? (char*)t : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG,__regparm(1))
|
|
||||||
char *Strdup(const char *src)
|
char *Strdup(const char *src)
|
||||||
{
|
{
|
||||||
char *dest;
|
char *dest;
|
||||||
@ -845,7 +890,6 @@ char *Strdup(const char *src)
|
|||||||
return(dest);
|
return(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CMD1_SEG,__regparm(2))
|
|
||||||
char *tolowercat(char *dest, const char *src)
|
char *tolowercat(char *dest, const char *src)
|
||||||
{
|
{
|
||||||
dest = STREND(dest);
|
dest = STREND(dest);
|
||||||
@ -858,7 +902,6 @@ char *tolowercat(char *dest, const char *src)
|
|||||||
* This code might look odd but its optimized for size,
|
* This code might look odd but its optimized for size,
|
||||||
* so dont change it!
|
* so dont change it!
|
||||||
*/
|
*/
|
||||||
__attr(CORE_SEG,__regparm(2))
|
|
||||||
char *Strcat(char *dst, const char *src)
|
char *Strcat(char *dst, const char *src)
|
||||||
{
|
{
|
||||||
while(*(dst++))
|
while(*(dst++))
|
||||||
@ -874,7 +917,6 @@ char *Strcat(char *dst, const char *src)
|
|||||||
* returns 0 for match
|
* returns 0 for match
|
||||||
* returns 1 for non-match
|
* returns 1 for non-match
|
||||||
*/
|
*/
|
||||||
__att2(CORE_SEG,const,__regparm(2))
|
|
||||||
int matches(const char *mask, const char *text)
|
int matches(const char *mask, const char *text)
|
||||||
{
|
{
|
||||||
const uchar *m = (uchar*)mask;
|
const uchar *m = (uchar*)mask;
|
||||||
@ -949,7 +991,6 @@ loop:
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
__att2(CORE_SEG,const,__regparm(2))
|
|
||||||
int num_matches(const char *mask, const char *text)
|
int num_matches(const char *mask, const char *text)
|
||||||
{
|
{
|
||||||
const char *p = mask;
|
const char *p = mask;
|
||||||
@ -989,7 +1030,6 @@ void table_buffer(const char *format, ...)
|
|||||||
Strcpy((*sp)->p,gsockdata);
|
Strcpy((*sp)->p,gsockdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CMD1_SEG, __regparm (2) )
|
|
||||||
void table_send(const char *from, const int space)
|
void table_send(const char *from, const int space)
|
||||||
{
|
{
|
||||||
char message[MAXLEN];
|
char message[MAXLEN];
|
||||||
@ -1103,7 +1143,6 @@ int is_safepath(const char *path)
|
|||||||
#define FILE_MAY_EXIST 2
|
#define FILE_MAY_EXIST 2
|
||||||
#define FILE_MUST_NOTEXIST 3
|
#define FILE_MUST_NOTEXIST 3
|
||||||
|
|
||||||
__attr(CORE_SEG,__regparm(2))
|
|
||||||
int is_safepath(const char *path, int filemustexist)
|
int is_safepath(const char *path, int filemustexist)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|||||||
@ -80,7 +80,7 @@ void greet(void)
|
|||||||
{
|
{
|
||||||
str = CurrentUser->greet;
|
str = CurrentUser->greet;
|
||||||
single_line:
|
single_line:
|
||||||
*pp = sp = (Strp*)Calloc(sizeof(Strp) + 13 + Strlen(CurrentChan->name,CurrentNick,str,NULL));
|
*pp = sp = (Strp*)Calloc(sizeof(Strp) + 13 + StrlenX(CurrentChan->name,CurrentNick,str,NULL));
|
||||||
sprintf(sp->p,"PRIVMSG %s :[%s] %s",CurrentChan->name,CurrentNick,str);
|
sprintf(sp->p,"PRIVMSG %s :[%s] %s",CurrentChan->name,CurrentNick,str);
|
||||||
/* Calloc sets to zero sp->next = NULL; */
|
/* Calloc sets to zero sp->next = NULL; */
|
||||||
}
|
}
|
||||||
|
|||||||
9
src/h.h
9
src/h.h
@ -138,7 +138,14 @@ void do_crash(COMMAND_ARGS) __page(RARE_SEG);
|
|||||||
|
|
||||||
LS void *Calloc(int) __attr(CORE_SEG, __regparm(1));
|
LS void *Calloc(int) __attr(CORE_SEG, __regparm(1));
|
||||||
LS void Free(char **) __attr(CORE_SEG, __regparm(1));
|
LS void Free(char **) __attr(CORE_SEG, __regparm(1));
|
||||||
LS const int Strlen(const char *, ...) __page(CORE_SEG);
|
|
||||||
|
LS Strp *make_strp(Strp **, const char *) __attr(CORE_SEG, __regparm(2));
|
||||||
|
LS Strp *append_strp(Strp **, const char *) __attr(CORE_SEG, __regparm(2));
|
||||||
|
LS Strp *prepend_strp(Strp **, const char *) __attr(CORE_SEG, __regparm(2));
|
||||||
|
LS void purge_strplist(Strp *) __attr(CORE_SEG, __regparm(1));
|
||||||
|
LS void dupe_strp(Strp *, Strp **) __attr(CORE_SEG, __regparm(2));
|
||||||
|
|
||||||
|
LS const int StrlenX(const char *, ...) __attr(CORE_SEG, __regparm(1));
|
||||||
LS const int Strlen2(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS const int Strlen2(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
||||||
LS int matches(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS int matches(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
||||||
LS int num_matches(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS int num_matches(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
||||||
|
|||||||
@ -241,7 +241,6 @@ void usage_command(char *to, const char *arg)
|
|||||||
to_user(to,"Usage: (missing)");
|
to_user(to,"Usage: (missing)");
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CMD1_SEG,__regparm(1))
|
|
||||||
void usage(char *to)
|
void usage(char *to)
|
||||||
{
|
{
|
||||||
CurrentChan = NULL;
|
CurrentChan = NULL;
|
||||||
|
|||||||
@ -37,7 +37,7 @@ void make_ireq(int t, char *from, char *nick)
|
|||||||
char *pt;
|
char *pt;
|
||||||
|
|
||||||
set_mallocdoer(make_ireq);
|
set_mallocdoer(make_ireq);
|
||||||
ir = (IReq*)Calloc(sizeof(IReq) + Strlen(from,nick,NULL)); // can not use Strlen2() if 2nd arg might be NULL, Strlen() handles NULLs.
|
ir = (IReq*)Calloc(sizeof(IReq) + StrlenX(from,nick,NULL)); // can not use Strlen2() if 2nd arg might be NULL, StrlenX() handles NULLs.
|
||||||
|
|
||||||
ir->t = t;
|
ir->t = t;
|
||||||
ir->when = now;
|
ir->when = now;
|
||||||
|
|||||||
@ -210,7 +210,7 @@ void do_kicksay(COMMAND_ARGS)
|
|||||||
* add it to the list
|
* add it to the list
|
||||||
*/
|
*/
|
||||||
set_mallocdoer(do_kicksay);
|
set_mallocdoer(do_kicksay);
|
||||||
kick = (KickSay*)Calloc(sizeof(KickSay) + Strlen(channel,mask,rest,NULL));
|
kick = (KickSay*)Calloc(sizeof(KickSay) + StrlenX(channel,mask,rest,NULL));
|
||||||
|
|
||||||
kick->next = current->kicklist;
|
kick->next = current->kicklist;
|
||||||
current->kicklist = kick;
|
current->kicklist = kick;
|
||||||
|
|||||||
@ -157,7 +157,7 @@ BotInfo *make_botinfo(int guid, int hops, char *nuh, char *server, char *version
|
|||||||
BotInfo *new;
|
BotInfo *new;
|
||||||
|
|
||||||
set_mallocdoer(make_botinfo);
|
set_mallocdoer(make_botinfo);
|
||||||
new = (BotInfo*)Calloc(sizeof(BotInfo) + Strlen(nuh,server,version,NULL));
|
new = (BotInfo*)Calloc(sizeof(BotInfo) + StrlenX(nuh,server,version,NULL));
|
||||||
|
|
||||||
new->guid = guid;
|
new->guid = guid;
|
||||||
new->hops = hops;
|
new->hops = hops;
|
||||||
@ -210,7 +210,6 @@ void botnet_refreshbotinfo(void)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG, __regparm (2))
|
|
||||||
void botnet_binfo_relay(BotNet *source, BotInfo *binfo)
|
void botnet_binfo_relay(BotNet *source, BotInfo *binfo)
|
||||||
{
|
{
|
||||||
botnet_relay(source,"BL%i %i %s %s %s\n",binfo->guid,(binfo->hops + 1),
|
botnet_relay(source,"BL%i %i %s %s %s\n",binfo->guid,(binfo->hops + 1),
|
||||||
@ -219,7 +218,6 @@ void botnet_binfo_relay(BotNet *source, BotInfo *binfo)
|
|||||||
(binfo->version) ? binfo->version : "-");
|
(binfo->version) ? binfo->version : "-");
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG, __regparm (2))
|
|
||||||
void botnet_binfo_tofile(int sock, BotInfo *binfo)
|
void botnet_binfo_tofile(int sock, BotInfo *binfo)
|
||||||
{
|
{
|
||||||
to_file(sock,"BL%i %i %s %s %s\n",binfo->guid,(binfo->hops + 1),
|
to_file(sock,"BL%i %i %s %s %s\n",binfo->guid,(binfo->hops + 1),
|
||||||
@ -1567,7 +1565,7 @@ usage:
|
|||||||
goto usage;
|
goto usage;
|
||||||
|
|
||||||
set_mallocdoer(do_link);
|
set_mallocdoer(do_link);
|
||||||
cfg = (NetCfg*)Calloc(sizeof(NetCfg) + Strlen(pass,host,NULL)); // host might be NULL, Strlen() handles NULLs, Strlen2() does not.
|
cfg = (NetCfg*)Calloc(sizeof(NetCfg) + StrlenX(pass,host,NULL)); // host might be NULL, StrlenX() handles NULLs, Strlen2() does not.
|
||||||
|
|
||||||
cfg->guid = iguid;
|
cfg->guid = iguid;
|
||||||
cfg->port = iport;
|
cfg->port = iport;
|
||||||
|
|||||||
18
src/note.c
18
src/note.c
@ -61,13 +61,7 @@ int catch_note(char *from, char *to, char *rest)
|
|||||||
}
|
}
|
||||||
if (!(u = find_handle(n->user)))
|
if (!(u = find_handle(n->user)))
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
np = &u->note;
|
append_strp(&u->note,rest);
|
||||||
while(*np)
|
|
||||||
np = &(*np)->next;
|
|
||||||
set_mallocdoer(catch_note);
|
|
||||||
*np = sp = (Strp*)Calloc(sizeof(Strp) + strlen(rest));
|
|
||||||
/* Calloc sets to zero sp->next = NULL; */
|
|
||||||
Strcpy(sp->p,rest);
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
if ((now - n->start) > 120)
|
if ((now - n->start) > 120)
|
||||||
@ -106,7 +100,7 @@ void do_note(COMMAND_ARGS)
|
|||||||
u->name);
|
u->name);
|
||||||
|
|
||||||
set_mallocdoer(do_note);
|
set_mallocdoer(do_note);
|
||||||
n = Calloc(sizeof(Note) + Strlen(from,to,u->name,NULL));
|
n = Calloc(sizeof(Note) + StrlenX(from,to,u->name,NULL));
|
||||||
n->start = now;
|
n->start = now;
|
||||||
n->next = notelist;
|
n->next = notelist;
|
||||||
notelist = n;
|
notelist = n;
|
||||||
@ -122,13 +116,7 @@ void do_note(COMMAND_ARGS)
|
|||||||
* add a note header
|
* add a note header
|
||||||
*/
|
*/
|
||||||
sprintf(header,"\001%s %s",from,time2str(now));
|
sprintf(header,"\001%s %s",from,time2str(now));
|
||||||
np = &u->note;
|
append_strp(&u->note,header);
|
||||||
while(*np)
|
|
||||||
np = &(*np)->next;
|
|
||||||
set_mallocdoer(do_note);
|
|
||||||
*np = sp = (Strp*)Calloc(sizeof(Strp) + strlen(header));
|
|
||||||
/* Calloc sets to zero sp->next = NULL; */
|
|
||||||
Strcpy(sp->p,header);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_read(COMMAND_ARGS)
|
void do_read(COMMAND_ARGS)
|
||||||
|
|||||||
@ -442,7 +442,7 @@ int notify_callback(char *rest)
|
|||||||
* src = description or NULL
|
* src = description or NULL
|
||||||
*/
|
*/
|
||||||
set_mallocdoer(notify_callback);
|
set_mallocdoer(notify_callback);
|
||||||
nf = (Notify*)Calloc(sizeof(Notify) + Strlen(nick,rest,src,NULL));
|
nf = (Notify*)Calloc(sizeof(Notify) + StrlenX(nick,rest,src,NULL));
|
||||||
dst = Strcat(nf->nick,nick);
|
dst = Strcat(nf->nick,nick);
|
||||||
if (*rest)
|
if (*rest)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -558,9 +558,7 @@ PyObject *python_to_server(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
else
|
else
|
||||||
if (sz)
|
if (sz)
|
||||||
{
|
{
|
||||||
*pp = sp = (Strp*) Calloc(sizeof(Strp) + sz);
|
make_strp(pp,line);
|
||||||
/* Calloc sets to zero sp->next = NULL; */
|
|
||||||
Strcpy(sp->p, line);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -153,7 +153,7 @@ void send_redirect(char *message)
|
|||||||
while(*pp)
|
while(*pp)
|
||||||
pp = &(*pp)->next;
|
pp = &(*pp)->next;
|
||||||
|
|
||||||
*pp = new = (Strp*)Calloc(sizeof(Strp) + Strlen(message,fmt,redirect.to,NULL));
|
*pp = new = (Strp*)Calloc(sizeof(Strp) + StrlenX(message,fmt,redirect.to,NULL));
|
||||||
/* Calloc sets to zero new->next = NULL; */
|
/* Calloc sets to zero new->next = NULL; */
|
||||||
sprintf(new->p,fmt,redirect.to,message);
|
sprintf(new->p,fmt,redirect.to,message);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -186,10 +186,10 @@ step_two:
|
|||||||
/*
|
/*
|
||||||
* dont fuck with this code unless you really know what you're doing
|
* dont fuck with this code unless you really know what you're doing
|
||||||
* pa might be NULL, but then pb is NULL also; pb might be NULL
|
* pa might be NULL, but then pb is NULL also; pb might be NULL
|
||||||
* any NULL terminates the Strlen() check
|
* any NULL terminates the StrlenX() check
|
||||||
*/
|
*/
|
||||||
set_mallocdoer(make_seen);
|
set_mallocdoer(make_seen);
|
||||||
seen = (Seen*)Calloc(sizeof(Seen) + Strlen(nick,userhost,pa,pb,NULL));
|
seen = (Seen*)Calloc(sizeof(Seen) + StrlenX(nick,userhost,pa,pb,NULL));
|
||||||
|
|
||||||
seen->next = *pp;
|
seen->next = *pp;
|
||||||
*pp = seen;
|
*pp = seen;
|
||||||
|
|||||||
@ -136,7 +136,7 @@ Shit *add_shit(char *from, char *chan, char *mask, char *reason, int axs, int ex
|
|||||||
Shit *shit;
|
Shit *shit;
|
||||||
|
|
||||||
set_mallocdoer(add_shit);
|
set_mallocdoer(add_shit);
|
||||||
shit = (Shit*)Calloc(sizeof(Shit) + Strlen(from,chan,mask,reason,NULL));
|
shit = (Shit*)Calloc(sizeof(Shit) + StrlenX(from,chan,mask,reason,NULL));
|
||||||
|
|
||||||
shit->action = axs;
|
shit->action = axs;
|
||||||
shit->time = now;
|
shit->time = now;
|
||||||
|
|||||||
@ -388,7 +388,7 @@ void to_user_q(const char *target, const char *format, ...)
|
|||||||
pp = &(*pp)->next;
|
pp = &(*pp)->next;
|
||||||
|
|
||||||
set_mallocdoer(to_user_q);
|
set_mallocdoer(to_user_q);
|
||||||
*pp = new = (Strp*)Calloc(sizeof(Strp) + Strlen(fmt,target,message,NULL));
|
*pp = new = (Strp*)Calloc(sizeof(Strp) + StrlenX(fmt,target,message,NULL));
|
||||||
/* Calloc sets to zero new->next = NULL; */
|
/* Calloc sets to zero new->next = NULL; */
|
||||||
sprintf(new->p,fmt,target,message);
|
sprintf(new->p,fmt,target,message);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,11 +118,11 @@
|
|||||||
#define TEXT_NAMETOOLONG "Hostname exceeds maximum length"
|
#define TEXT_NAMETOOLONG "Hostname exceeds maximum length"
|
||||||
|
|
||||||
#define TEXT_SHUTDOWNBY "Shutdown initiated by %s[100], flatlining ..."
|
#define TEXT_SHUTDOWNBY "Shutdown initiated by %s[100], flatlining ..."
|
||||||
|
#define TEXT_SHUTDOWNCOMPLETE "Shutdown Complete"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main.c
|
* main.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define TEXT_SIGINT "Lurking interrupted by luser ... er, owner. (SIGINT)"
|
#define TEXT_SIGINT "Lurking interrupted by luser ... er, owner. (SIGINT)"
|
||||||
#define TEXT_SIGSEGV "Mary had a little signal segmentation fault (SIGSEGV)"
|
#define TEXT_SIGSEGV "Mary had a little signal segmentation fault (SIGSEGV)"
|
||||||
#define TEXT_SIGBUS "Another one drives the bus! (SIGBUS)"
|
#define TEXT_SIGBUS "Another one drives the bus! (SIGBUS)"
|
||||||
|
|||||||
@ -69,13 +69,7 @@ int read_bigcharset_callback(char *rest)
|
|||||||
sz = strlen(rest);
|
sz = strlen(rest);
|
||||||
if (sz > newchar->width)
|
if (sz > newchar->width)
|
||||||
newchar->width = sz;
|
newchar->width = sz;
|
||||||
pp = &newchar->data;
|
append_strp(&newchar->data,rest);
|
||||||
while(*pp)
|
|
||||||
pp = &(*pp)->next;
|
|
||||||
set_mallocdoer(read_bigcharset_callback);
|
|
||||||
*pp = sp = (Strp*)Calloc(sizeof(Strp) + sz);
|
|
||||||
/* Calloc sets to zero sp->next = NULL; */
|
|
||||||
Strcpy(sp->p,rest);
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
src/trivia.c
10
src/trivia.c
@ -368,7 +368,6 @@ char *random_question(char *triv_rand)
|
|||||||
void trivia_question(void)
|
void trivia_question(void)
|
||||||
{
|
{
|
||||||
char buffer[MSGLEN];
|
char buffer[MSGLEN];
|
||||||
Strp *ans,**pp;
|
|
||||||
char *question,*answer,*rest;
|
char *question,*answer,*rest;
|
||||||
|
|
||||||
if (triv_halt_flag)
|
if (triv_halt_flag)
|
||||||
@ -392,15 +391,8 @@ stop_trivia:
|
|||||||
|
|
||||||
question = get_token(&rest,MATCH_ALL);
|
question = get_token(&rest,MATCH_ALL);
|
||||||
|
|
||||||
pp = &triv_answers;
|
|
||||||
while((answer = get_token(&rest,MATCH_ALL)))
|
while((answer = get_token(&rest,MATCH_ALL)))
|
||||||
{
|
append_strp(&triv_answers,answer);
|
||||||
set_mallocdoer(trivia_question);
|
|
||||||
*pp = ans = (Strp*)Calloc(sizeof(Strp) + strlen(answer));
|
|
||||||
pp = &ans->next;
|
|
||||||
Strcpy(ans->p,answer);
|
|
||||||
}
|
|
||||||
*pp = NULL;
|
|
||||||
|
|
||||||
if (triv_answers == NULL)
|
if (triv_answers == NULL)
|
||||||
goto bad_question;
|
goto bad_question;
|
||||||
|
|||||||
@ -190,7 +190,7 @@ void send_uptime(int type)
|
|||||||
}
|
}
|
||||||
#endif /* ! RAWDNS */
|
#endif /* ! RAWDNS */
|
||||||
|
|
||||||
sz = sizeof(PackStub) + 3 + Strlen(nick,server,VERSION,NULL);
|
sz = sizeof(PackStub) + 3 + StrlenX(nick,server,VERSION,NULL);
|
||||||
if (sz > sizeof(PackUp))
|
if (sz > sizeof(PackUp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
21
src/urlcap.c
21
src/urlcap.c
@ -29,7 +29,6 @@
|
|||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
|
||||||
__page(CORE_SEG)
|
|
||||||
void urlcapture(const char *rest)
|
void urlcapture(const char *rest)
|
||||||
{
|
{
|
||||||
Strp *sp,*nx;
|
Strp *sp,*nx;
|
||||||
@ -49,23 +48,18 @@ void urlcapture(const char *rest)
|
|||||||
|
|
||||||
if ((n = urlhistmax))
|
if ((n = urlhistmax))
|
||||||
{
|
{
|
||||||
set_mallocdoer(urlcapture);
|
debug("prepend\n");
|
||||||
sp = (Strp*)Calloc(sizeof(Strp) + strlen(url));
|
prepend_strp(&urlhistory,url);
|
||||||
Strcpy(sp->p,url);
|
|
||||||
sp->next = urlhistory;
|
|
||||||
urlhistory = sp;
|
|
||||||
|
|
||||||
|
debug("for...\n");
|
||||||
for(sp=urlhistory;sp;sp=sp->next)
|
for(sp=urlhistory;sp;sp=sp->next)
|
||||||
{
|
{
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
{
|
{
|
||||||
do
|
debug("purge...\n");
|
||||||
{
|
purge_strplist(sp->next);
|
||||||
nx = sp->next;
|
debug("return\n");
|
||||||
Free((char**)&sp);
|
return;
|
||||||
sp = nx;
|
|
||||||
}
|
|
||||||
while(sp);
|
|
||||||
}
|
}
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
@ -84,7 +78,6 @@ Display a list of URLs seen by the bot in order most recent to oldest.
|
|||||||
|
|
||||||
[max] Maximum number of URLs to display.
|
[max] Maximum number of URLs to display.
|
||||||
*/
|
*/
|
||||||
__page(CMD1_SEG)
|
|
||||||
void do_urlhist(COMMAND_ARGS)
|
void do_urlhist(COMMAND_ARGS)
|
||||||
{
|
{
|
||||||
Strp *sp;
|
Strp *sp;
|
||||||
|
|||||||
21
src/user.c
21
src/user.c
@ -479,7 +479,6 @@ int write_userlist(char *filename)
|
|||||||
* remfromuser() remove a channel or mask from a user
|
* remfromuser() remove a channel or mask from a user
|
||||||
*/
|
*/
|
||||||
|
|
||||||
__page(CORE_SEG)
|
|
||||||
void rehash_chanusers(void)
|
void rehash_chanusers(void)
|
||||||
{
|
{
|
||||||
Chan *chan;
|
Chan *chan;
|
||||||
@ -492,7 +491,6 @@ void rehash_chanusers(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG, __regparm (3))
|
|
||||||
void addtouser(Strp **pp, const char *string, int rehash)
|
void addtouser(Strp **pp, const char *string, int rehash)
|
||||||
{
|
{
|
||||||
Strp *um;
|
Strp *um;
|
||||||
@ -512,7 +510,6 @@ void addtouser(Strp **pp, const char *string, int rehash)
|
|||||||
rehash_chanusers();
|
rehash_chanusers();
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG, __regparm (2))
|
|
||||||
int remfromuser(Strp **pp, const char *string)
|
int remfromuser(Strp **pp, const char *string)
|
||||||
{
|
{
|
||||||
Strp *um;
|
Strp *um;
|
||||||
@ -532,21 +529,6 @@ int remfromuser(Strp **pp, const char *string)
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* duplicate a list of Strp
|
|
||||||
*/
|
|
||||||
void dupe_strp(Strp *sp, Strp **pp)
|
|
||||||
{
|
|
||||||
while(sp)
|
|
||||||
{
|
|
||||||
set_mallocdoer(dupe_strp);
|
|
||||||
*pp = (Strp*)Calloc(sizeof(Strp) + strlen(sp->p));
|
|
||||||
Strcpy((*pp)->p,sp->p);
|
|
||||||
pp = &((*pp)->next);
|
|
||||||
sp = sp->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* make duplicates of a user on other local bots
|
* make duplicates of a user on other local bots
|
||||||
*/
|
*/
|
||||||
@ -762,7 +744,7 @@ User *add_user(char *handle, char *pass, int axs)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
set_mallocdoer(add_user);
|
set_mallocdoer(add_user);
|
||||||
user = (User*)Calloc(sizeof(User) + Strlen(handle,pass,NULL)); // Strlen() tolerates pass being NULL, Strlen2() does not.
|
user = (User*)Calloc(sizeof(User) + StrlenX(handle,pass,NULL)); // StrlenX() tolerates pass being NULL, Strlen2() does not.
|
||||||
user->x.x.access = axs;
|
user->x.x.access = axs;
|
||||||
user->next = current->userlist;
|
user->next = current->userlist;
|
||||||
current->userlist = user;
|
current->userlist = user;
|
||||||
@ -927,7 +909,6 @@ int get_protaction(Chan *chan, char *userhost)
|
|||||||
return(prot);
|
return(prot);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attr(CORE_SEG, __regparm (2))
|
|
||||||
int usercanmodify(const char *from, const User *user)
|
int usercanmodify(const char *from, const User *user)
|
||||||
{
|
{
|
||||||
User *u;
|
User *u;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user