Update of /cvsroot/x2serv/x2/source
In directory usw-pr-cvs1:/tmp/cvs-serv3543/source
Modified Files:
accounting.c config.h
Log Message:
fixed a very large loop runtime condition in .LAST, and formatted the display with header/footer.
Index: accounting.c
===================================================================
RCS file: /cvsroot/x2serv/x2/source/accounting.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** accounting.c 2001/02/13 11:47:53 1.7
--- accounting.c 2001/02/13 13:22:47 1.8
***************
*** 4,8 ****
/* we read this many bytes at a time. */
! #define Block 2048
int parselog(char *LogLine, UserListType uptr, ChannelListType cptr, char *chan, char *nuh, char *command, char *rest, time_t start, time_t end)
--- 4,8 ----
/* we read this many bytes at a time. */
! #define Block 4096
int parselog(char *LogLine, UserListType uptr, ChannelListType cptr, char *chan, char *nuh, char *command, char *rest, time_t start, time_t end)
***************
*** 18,22 ****
char *gmode;
// time_t mystart, myend;
! Debug(DBGINFO, "Examining: %s", LogLine);
datestr = (char *) mysep(&LogLine, "]");
--- 18,22 ----
char *gmode;
// time_t mystart, myend;
! // Debug(DBGINFO, "Examining: %s", LogLine);
datestr = (char *) mysep(&LogLine, "]");
***************
*** 29,33 ****
if(!mycommand)
{
! Debug(DBGINFO, "Invalid line in log input.");
return(0);
}
--- 29,33 ----
if(!mycommand)
{
! //Debug(DBGINFO, "Invalid line in log input.");
return(0);
}
***************
*** 45,48 ****
--- 45,49 ----
if(!chan)
chan = "";
+
if(!nuh)
nuh = "";
***************
*** 65,69 ****
FILE *TheFile;
int i, s, Last = FALSE, filelen, first;
! int line = 0;
int FilePosition;
--- 66,70 ----
FILE *TheFile;
int i, s, Last = FALSE, filelen, first;
! int line = 0, searchline = 0;
int FilePosition;
***************
*** 79,82 ****
--- 80,84 ----
filelen = ftell(TheFile); /* Find out the length. */
FilePosition = 0; /* (from the bottom) */
+ send_to_user(uptr, "=--- Command log ---=");
while(Last == FALSE)
{
***************
*** 117,128 ****
--- 119,141 ----
// Debug(DBGINFO, "LOGLINE: %s", LogLine);
// send_to_user(uptr, "LOGLINE: %s", LogLine);
+ searchline++;
if(parselog(LogLine, uptr, cptr, chan, nuh, command, rest, start, end))
line++;
if(line >= maxlines)
+ {
+ send_to_user(uptr, "=--- Stopping at %d lines ---=", maxlines);
return(TRUE);
+ }
+ if( searchline >= MAXLOGSEARCHLENGTH )
+ {
+ send_to_user(uptr, "=--- Data age limit reached ---=");
+ return(TRUE);
+ }
+
}
}
strcpy(PrevBuff, Buff); /* Save the remaining bit. */
}
+ send_to_user(uptr, "=--- End of log data ---=");
return(TRUE);
}
Index: config.h
===================================================================
RCS file: /cvsroot/x2serv/x2/source/config.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** config.h 2001/02/13 11:59:42 1.53
--- config.h 2001/02/13 13:22:48 1.54
***************
*** 143,146 ****
--- 143,154 ----
#define MAXLOGINLEN 10
+ /* This is the max # of lines of accounting.log
+ * that will be read while trying to display
+ * the last n lines of a spesific channels info.
+ * the bigger it is, the more cpu can be wasted
+ * by a chan owner.
+ */
+ #define MAXLOGSEARCHLENGTH 10000
+
/* These are for userlist entries. */
#define MAXHANDLELEN 20
|