Added rfcdate function

This commit is contained in:
Michiel Broek 2005-04-18 13:37:19 +00:00
parent afb8ee26b1
commit 57dae361b2
4 changed files with 27 additions and 2 deletions

View File

@ -73,7 +73,7 @@ scanout.o: ../config.h ../lib/mbselib.h taskutil.h scanout.h
taskcomm.o: ../config.h ../lib/mbselib.h taskstat.h taskregs.h taskdisk.h taskinfo.h taskutil.h taskchat.h taskcomm.h taskcomm.o: ../config.h ../lib/mbselib.h taskstat.h taskregs.h taskdisk.h taskinfo.h taskutil.h taskchat.h taskcomm.h
taskinfo.o: ../config.h ../lib/mbselib.h taskinfo.h taskinfo.o: ../config.h ../lib/mbselib.h taskinfo.h
taskstat.o: ../config.h ../lib/mbselib.h taskstat.h callstat.h outstat.h taskutil.h taskstat.o: ../config.h ../lib/mbselib.h taskstat.h callstat.h outstat.h taskutil.h
taskibc.o: ../config.h ../lib/mbselib.h taskibc.h taskibc.o: ../config.h ../lib/mbselib.h taskstat.h taskutil.h taskibc.h
mbtask.o: ../config.h ../lib/mbselib.h ../paths.h signame.h taskstat.h taskutil.h taskregs.h taskcomm.h taskdisk.h taskibc.h callstat.h outstat.h ../lib/nodelist.h ports.h calllist.h ping.h taskchat.h mbtask.h mbtask.o: ../config.h ../lib/mbselib.h ../paths.h signame.h taskstat.h taskutil.h taskregs.h taskcomm.h taskdisk.h taskibc.h callstat.h outstat.h ../lib/nodelist.h ports.h calllist.h ping.h taskchat.h mbtask.h
outstat.o: ../config.h ../lib/mbselib.h taskutil.h taskstat.h scanout.h ../lib/nodelist.h callstat.h ports.h outstat.h outstat.o: ../config.h ../lib/mbselib.h taskutil.h taskstat.h scanout.h ../lib/nodelist.h callstat.h ports.h outstat.h
signame.o: ../config.h signame.h signame.o: ../config.h signame.h

View File

@ -31,6 +31,7 @@
#include "../config.h" #include "../config.h"
#include "../lib/mbselib.h" #include "../lib/mbselib.h"
#include "taskstat.h" #include "taskstat.h"
#include "taskutil.h"
#include "taskibc.h" #include "taskibc.h"
@ -133,7 +134,7 @@ void dump_ncslist(void)
Syslog('r', "Server Users Connect time"); Syslog('r', "Server Users Connect time");
Syslog('r', "------------------------------ ----- ---------------------"); Syslog('r', "------------------------------ ----- ---------------------");
for (srv = servers; srv; srv = srv->next) { for (srv = servers; srv; srv = srv->next) {
Syslog('r', "%-30s %5d %s", srv->server, srv->users, (char *)"NA"); Syslog('r', "%-30s %5d %s", srv->server, srv->users, rfcdate(srv->connected));
} }
changed = FALSE; changed = FALSE;
} }
@ -247,6 +248,12 @@ void check_servers(void)
fill_ncslist(&ncsl, ibcsrv.server, ibcsrv.myname, ibcsrv.passwd); fill_ncslist(&ncsl, ibcsrv.server, ibcsrv.myname, ibcsrv.passwd);
changed = TRUE; changed = TRUE;
Syslog('+', "IBC: added Internet BBS Chatserver %s", ibcsrv.server); Syslog('+', "IBC: added Internet BBS Chatserver %s", ibcsrv.server);
if (servers == NULL) {
/*
* First add this server name to the servers database.
*/
add_server(&servers, ibcsrv.myname);
}
} }
} }
} }

View File

@ -82,6 +82,23 @@ char *date(void)
char *rfcdate(time_t now)
{
struct tm ptm;
static char buf[20];
#if defined(__OpenBSD__)
localtime_r(&now, &ptm);
#else
ptm = *localtime(&now);
#endif
sprintf(buf,"%02d-%s-%04d %02d:%02d:%02d", ptm.tm_mday, mon[ptm.tm_mon], ptm.tm_year+1900,
ptm.tm_hour, ptm.tm_min, ptm.tm_sec);
return(buf);
}
void WriteError(const char *format, ...) void WriteError(const char *format, ...)
{ {
char *outputstr; char *outputstr;

View File

@ -21,6 +21,7 @@ typedef struct _srv_auth {
/* /*
* Function prototypes * Function prototypes
*/ */
char *rfcdate(time_t);
void WriteError(const char *, ...); void WriteError(const char *, ...);
void Syslog(int, const char *, ...); void Syslog(int, const char *, ...);
int ulog(char *, char *, char *, char *, char*); int ulog(char *, char *, char *, char *, char*);