mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-29 16:14:43 +00:00
minor related updates: warnings, hostinfo, calc, debug, ...
This commit is contained in:
27
src/core.c
27
src/core.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
|
||||
EnergyMech, IRC bot software
|
||||
Parts Copyright (c) 1997-2018 proton
|
||||
Parts Copyright (c) 1997-2024 proton
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -29,6 +29,10 @@
|
||||
#include "mcmd.h"
|
||||
#include "settings.h"
|
||||
|
||||
#ifdef HOSTINFO
|
||||
#include <sys/utsname.h>
|
||||
#endif /* HOSTINFO */
|
||||
|
||||
#ifdef IDWRAP
|
||||
|
||||
void unlink_identfile(void)
|
||||
@@ -444,6 +448,13 @@ void signoff(char *from, char *reason)
|
||||
Free(¤t->lastcmds[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
* little of this n that
|
||||
*/
|
||||
Free((char**)¤t->nick);
|
||||
Free((char**)¤t->wantnick);
|
||||
Free((char**)¤t->userhost);
|
||||
|
||||
/*
|
||||
* These 2 are used by do_die() to pass reason and doer.
|
||||
*/
|
||||
@@ -1251,6 +1262,10 @@ void do_version(COMMAND_ARGS)
|
||||
|
||||
void do_core(COMMAND_ARGS)
|
||||
{
|
||||
#ifdef HOSTINFO
|
||||
char *h,hostname[256];
|
||||
struct utsname un;
|
||||
#endif /* HOSTINFO */
|
||||
char tmp[MSGLEN]; /* big buffers at the top */
|
||||
Server *sp;
|
||||
Chan *chan;
|
||||
@@ -1330,6 +1345,16 @@ void do_core(COMMAND_ARGS)
|
||||
table_buffer(TEXT_CURRSERVERNOT);
|
||||
table_buffer(TEXT_SERVERONTIME,idle2str(now - current->ontime,FALSE));
|
||||
table_buffer(TEXT_BOTMODES,(*current->modes) ? current->modes : TEXT_NONE);
|
||||
#ifdef HOSTINFO
|
||||
hostname[255] = 0;
|
||||
if (gethostname(hostname,250) < 0)
|
||||
h = "(hostname error)";
|
||||
else
|
||||
h = hostname;
|
||||
|
||||
if (uname(&un) == 0)
|
||||
table_buffer(TEXT_HOSTINFO,h,un.sysname,un.release,un.machine);
|
||||
#endif /* HOSTINFO */
|
||||
table_buffer(TEXT_CURRENTTIME,time2str(now));
|
||||
table_buffer(TEXT_BOTSTARTED,time2str(uptime));
|
||||
table_buffer(TEXT_BOTUPTIME,idle2str(now - uptime,FALSE));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
|
||||
EnergyMech, IRC bot software
|
||||
Copyright (c) 1997-2018 proton
|
||||
Copyright (c) 1997-2024 proton
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -42,8 +42,8 @@
|
||||
#define DEFAULTCMDCHAR '-'
|
||||
#define MECHUSERLOGIN "v3.energymech.net"
|
||||
|
||||
BEG const char VERSION[] MDEF("3.1p" GITHASH);
|
||||
BEG const char SRCDATE[] MDEF("April 14th, 2018");
|
||||
BEG const char VERSION[] MDEF("3.2p" GITHASH);
|
||||
BEG const char SRCDATE[] MDEF("May 13th, 2024");
|
||||
#ifdef __CYGWIN__
|
||||
BEG const char BOTCLASS[] MDEF("WinMech");
|
||||
#else /* ! CYGWIN */
|
||||
|
||||
4
src/h.h
4
src/h.h
@@ -336,7 +336,7 @@ void select_monitor() __page(CORE_SEG);
|
||||
void process_monitor() __page(CORE_SEG);
|
||||
int parse_proc_status(char *line) __page(CMD1_SEG);
|
||||
int parse_proc_cpuinfo(char *line) __page(CMD1_SEG);
|
||||
void do_hostinfo(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_sysinfo(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_meminfo(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_cpuinfo(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
void do_filemon(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
@@ -419,7 +419,7 @@ LS void sig_segv(int) __attr(RARE_SEG, __noreturn__);
|
||||
#endif
|
||||
LS void sig_term(int) __attr(RARE_SEG, __noreturn__); /* rare */
|
||||
LS void doit(void) __page(CORE_SEG);
|
||||
LS int main(int argc, char **argv, char **envp) __page(CFG1_SEG);
|
||||
LS int main(int argc, char **argv, char **envp) __page(INIT_SEG);
|
||||
|
||||
/* net.c */
|
||||
|
||||
|
||||
5
src/io.c
5
src/io.c
@@ -269,7 +269,7 @@ int SockAccept(int sock)
|
||||
/*
|
||||
* Format text and send to a socket or file descriptor
|
||||
*/
|
||||
int to_file(int sock, const char *format, ...)
|
||||
int to_file(const int sock, const char *format, ...)
|
||||
{
|
||||
va_list msg;
|
||||
#if defined(DEBUG) && !defined(GENCMD_C)
|
||||
@@ -357,7 +357,8 @@ void to_user_q(const char *target, const char *format, ...)
|
||||
|
||||
if (STARTUP_ECHOTOCONSOLE)
|
||||
{
|
||||
write(1,message,strlen(message));
|
||||
int n;
|
||||
n = write(1,message,strlen(message));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1287,6 +1287,10 @@ int main(int argc, char **argv, char **envp)
|
||||
|
||||
if (startup == STARTUP_TESTRUN)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (debug_on_exit == TRUE)
|
||||
run_debug();
|
||||
#endif /* DEBUG */
|
||||
to_file(1,"init: test run completed, exiting...\n");
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
11
src/spy.c
11
src/spy.c
@@ -69,6 +69,9 @@ static int basepos(char c)
|
||||
return(63);
|
||||
return(0);
|
||||
}
|
||||
#if defined(SHACRYPT) || defined(MD5CRYPT)
|
||||
char *CRYPT_FUNC(const char *, const char *);
|
||||
#endif
|
||||
|
||||
void send_spy(const char *src, const char *format, ...)
|
||||
{
|
||||
@@ -130,12 +133,12 @@ void send_spy(const char *src, const char *format, ...)
|
||||
SHA-512 | 86 characters
|
||||
*/
|
||||
#ifdef SHACRYPT
|
||||
sprintf(tempdata,"$6$%04x",(now & 0xFFFF));
|
||||
sprintf(tempdata,"$6$%04x",(uint32_t)(now & 0xFFFF));
|
||||
rnd = CRYPT_FUNC(tempsrc,tempdata);
|
||||
#endif /* SHACRYPT */
|
||||
|
||||
#if !defined(SHACRYPT) && defined(MD5CRYPT)
|
||||
sprintf(tempdata,"$1$%04x",(now & 0xFFFF));
|
||||
sprintf(tempdata,"$1$%04x",(uint32_t)(now & 0xFFFF));
|
||||
rnd = CRYPT_FUNC(tempsrc,tempdata);
|
||||
#endif /* !SHACRYPT && MD5CRYPT */
|
||||
|
||||
@@ -164,7 +167,9 @@ void send_spy(const char *src, const char *format, ...)
|
||||
#endif /* DEBUG */
|
||||
if ((fd = open(spy->dest,O_WRONLY|O_CREAT|O_APPEND,NEWFILEMODE)) >= 0)
|
||||
{
|
||||
write(fd,tempdata,dst - tempdata);
|
||||
int n;
|
||||
|
||||
n = write(fd,tempdata,dst - tempdata);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
|
||||
EnergyMech, IRC bot software
|
||||
Copyright (c) 2000-2018 proton
|
||||
Copyright (c) 2000-2024 proton
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -102,6 +102,7 @@
|
||||
#define TEXT_BOTUPTIME "Uptime\t%s"
|
||||
#define TEXT_BOTVERSION "Version\t%s (%s)"
|
||||
#define TEXT_BOTFEATURES "Features\t%s"
|
||||
#define TEXT_HOSTINFO "Host\t%s %s %s %s"
|
||||
|
||||
#define TEXT_CSERV "Current Server: %s:%i"
|
||||
#define TEXT_CSERVNOT "Current Server: " TEXT_NOTINSERVLIST
|
||||
|
||||
Reference in New Issue
Block a user