From ca97dc3913735ac0aed03974ada43aede82bec02 Mon Sep 17 00:00:00 2001 From: epochqwert Date: Sun, 8 Mar 2015 06:04:41 -0500 Subject: added a linkbot example to libirc, bunch of random shit in segfault I guess. I don't remember. I should commit more. --- segfault.c | 78 ++++++++++++++++++++++++++------------------------------------ 1 file changed, 32 insertions(+), 46 deletions(-) (limited to 'segfault.c') diff --git a/segfault.c b/segfault.c index 8404577..2706543 100644 --- a/segfault.c +++ b/segfault.c @@ -64,6 +64,7 @@ int lines_sent; unsigned long oldtime; int maxtails; int currentmaxtails; +char seghome[SEGHOMELEN]; struct hashtable alias; struct hashtable builtin; @@ -73,8 +74,6 @@ union hack { void *data; }; -#define HACK(a) (void *)((union hack){a}.data) - void (*func)(int fd,...); struct user { @@ -104,19 +103,16 @@ char *tailmode_to_txt(int mode) { char *modes="recmbsnf"; int i,j=0; char *m=malloc(strlen(modes)); - for(i=0;inick: ((fmt[i]=='u')?user->user: ((fmt[i]=='~')?seghome: @@ -296,7 +281,7 @@ void extra_handler(int fd) { if(redirect_to_fd != -1) { fd=redirect_to_fd; } - for(i=0;i %s",user->nick,msg); - append_file(fd,user->nick,LOG,tmp,'\n'); + //snprintf(tmp,sizeof(tmp)-1,"<%s> %s",user->nick,msg); + tmp2=format_magic(fd,from,user,recording,msg); + append_file(fd,user->nick,LOG,tmp2,'\n'); + free(tmp2); debug_time(fd,from,"finished writing to log."); } len=strchr(msg,'*')?strchr(msg,'*')-msg:strlen(myuser->nick); @@ -1244,6 +1229,7 @@ int main(int argc,char *argv[]) { // "segfault segfault segfault :segfault"); printf("cd %s\n",pwd->pw_dir); chdir(getenv("seghome")?getenv("seghome"):pwd->pw_dir); + getcwd(seghome,SEGHOMELEN); prestartup_stuff(fd); return runit(fd,line_handler,extra_handler); } -- cgit v1.2.3