diff options
author | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2014-10-26 02:39:15 -0500 |
---|---|---|
committer | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2014-10-26 02:39:15 -0500 |
commit | df553e722fc97af5179bbcaee2ee0c97a45a61db (patch) | |
tree | b219aea8ecfe28f07a3c6a59a70e2172de8b0ac3 /segfault.c | |
parent | 135482f52e2bcb14592ba60f97ea60088aa39275 (diff) | |
download | segfault-df553e722fc97af5179bbcaee2ee0c97a45a61db.tar.gz segfault-df553e722fc97af5179bbcaee2ee0c97a45a61db.zip |
made some new messages debug messages. fixed... fuck. I forgot. check the diff. you know how to read source code. :P
Diffstat (limited to 'segfault.c')
-rw-r--r-- | segfault.c | 35 |
1 files changed, 25 insertions, 10 deletions
@@ -328,13 +328,22 @@ void file_tail(int fd,char *from,char *file,char *args,char opt,struct user *use if(i == MAXTAILS -1) { exit(3); } + if(*file == '#') { + from=file; + file=strchr(file,':'); + if(file) {*file=0; + file++; + } + } if((fdd=open(file,O_RDONLY|O_NONBLOCK,0)) == -1) { snprintf(tmp,sizeof(tmp)-1,"file_tail: %s: (%s) fd:%d",strerror(errno),file,fdd); privmsg(fd,"#cmd",tmp); return; } - snprintf(tmp,sizeof(tmp)-1,"file_tail opened file '%s' with fd: %d / %d",file,fdd,maxtails); - privmsg(fd,"#cmd",tmp); + if(debug) { + snprintf(tmp,sizeof(tmp)-1,"file_tail opened file '%s' with fd: %d / %d",file,fdd,maxtails); + privmsg(fd,"#cmd",tmp); + } fstat(fdd,&st); // <-- is this needed? /*for(j=0;j<MAXTAILS;j++) { if(tailf[j].fp && tailf[j].file && tailf[j].inode) { @@ -434,8 +443,10 @@ void c_changetail(int fd,char *from,char *line,struct user *user,...) { privmsg(fd,"#cmd",tmp); return; } - snprintf(tmp,sizeof(tmp)-1,"changetail opened file '%s' with fd: %d / %d\n",line,fdd,maxtails); - privmsg(fd,"#cmd",tmp); + if(debug) { + snprintf(tmp,sizeof(tmp)-1,"changetail opened file '%s' with fd: %d / %d\n",line,fdd,maxtails); + privmsg(fd,"#cmd",tmp); + } fstat(fdd,&st); close(fdd); for(i=0;i<MAXTAILS;i++) { @@ -451,7 +462,8 @@ void c_changetail(int fd,char *from,char *line,struct user *user,...) { } } } - privmsg(fd,from,"tail not found"); + snprintf(tmp,sizeof(tmp)-1,"changetail: tail (%s) not found",line); + privmsg(fd,from,tmp); } void prestartup_stuff(int fd) { @@ -686,9 +698,10 @@ char append_file(int fd,char *from,char *file,char *line,unsigned short nl) { privmsg(fd,from,tmp); return 0; } - snprintf(tmp,sizeof(tmp)-1,"append_file opened file '%s' with fd: %d / %d\n",file,fdd,maxtails); - privmsg(fd,"#cmd",tmp); - + if(debug) { + snprintf(tmp,sizeof(tmp)-1,"append_file opened file '%s' with fd: %d / %d\n",file,fdd,maxtails); + privmsg(fd,"#cmd",tmp); + } if(!(fp=fdopen(fdd,"a"))) { snprintf(tmp,sizeof(tmp)-1,"Couldn't fdopen file (%s) fd:%d for appending.",file,fdd); privmsg(fd,from,tmp); @@ -807,8 +820,10 @@ void c_leetsetout(int fd,char *from,char *msg,...) { privmsg(fd,"#cmd",tmp); return; } - snprintf(tmp,sizeof(tmp)-1,"leetsetout opened file '%s' with fd: %d / %d\n",msg+3,redirect_to_fd,maxtails); - privmsg(fd,"#cmd",tmp); + if(debug) { + snprintf(tmp,sizeof(tmp)-1,"leetsetout opened file '%s' with fd: %d / %d\n",msg+3,redirect_to_fd,maxtails); + privmsg(fd,"#cmd",tmp); + } } void c_linelimit(int fd,char *from,char *msg,...) { |