mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-17 07:26:21 +00:00
april2
This commit is contained in:
parent
d9fac6178c
commit
f50111b895
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,6 +6,7 @@ src/Makefile
|
||||
src/config.h
|
||||
src/mcmd.h
|
||||
src/usercombo.h
|
||||
trivia/*.index
|
||||
|
||||
# compiled files
|
||||
energymech
|
||||
@ -14,6 +15,7 @@ src/*.o
|
||||
src/gencmd
|
||||
src/aliastest
|
||||
src/safepathtest
|
||||
trivia/mkindex
|
||||
|
||||
# mech typical user config files
|
||||
*~
|
||||
|
||||
31
Makefile
31
Makefile
@ -18,7 +18,9 @@
|
||||
#
|
||||
|
||||
MISCFILES = CREDITS LICENSE README README.TCL TODO VERSIONS VERSIONS-1 Makefile configure \
|
||||
checkmech sample.conf sample.py sample.tcl sample.userfile default.bigchars public/README
|
||||
checkmech sample.conf sample.py sample.tcl sample.userfile default.bigchars public/README trivia/README
|
||||
|
||||
ASCIIFILES = ascii/README ascii/bbw ascii/camel ascii/goatse ascii/mech ascii/phooler
|
||||
|
||||
HELPFILES = help/8BALL help/ACCESS help/ALIAS help/AWAY help/BAN help/BANLIST help/BYE \
|
||||
help/CCHAN help/CHACCESS help/CHANBAN help/CHANNELS help/CHAT help/CLEARSHIT \
|
||||
@ -47,11 +49,9 @@ RANDFILES = messages/8ball.txt messages/away.txt messages/insult.txt \
|
||||
|
||||
STUBFILES = src/Makefile.in src/config.h.in src/ld/README src/ld/elf32-i386 src/ld/elf64-x86-64
|
||||
|
||||
TESTFILES = config/cc.c config/endian.c config/inet_addr.c config/ldtest.c \
|
||||
config/ptr_size.c config/socket.c config/tcl.c config/which \
|
||||
config/md5.h config/md5_internal.c config/pw.c \
|
||||
config/sha_internal.c config/sha1.h \
|
||||
config/inet_aton.c config/unaligned.c config/python.c
|
||||
TESTFILES = config/cc.c config/endian.c config/inet_addr.c config/inet_aton.c config/ldtest.c config/md5.h config/md5_internal.c \
|
||||
config/perl.c config/ptr_size.c config/python.c config/pw.c config/sha1.h config/sha_internal.c config/socket.c config/tcl.c \
|
||||
config/unaligned.c config/which
|
||||
|
||||
TRIVFILES = trivia/mkindex.c
|
||||
|
||||
@ -69,46 +69,48 @@ HDRFILES = src/defines.h src/global.h src/h.h src/settings.h src/structs.h src/t
|
||||
|
||||
CONFFILES = src/Makefile src/config.h
|
||||
|
||||
DISTFILES = $(MISCFILES) $(RANDFILES) $(SRCFILES) $(HELPFILES) \
|
||||
DISTFILES = $(MISCFILES) $(RANDFILES) $(SRCFILES) $(HELPFILES) $(ASCIIFILES) \
|
||||
$(STUBFILES) $(HDRFILES) $(TRIVFILES) $(TESTFILES)
|
||||
|
||||
#
|
||||
# simple make rules
|
||||
#
|
||||
|
||||
.PHONY: clean install mech mega mega-install test dist dist2
|
||||
|
||||
mech: $(SRCFILES) $(CONFFILES)
|
||||
$(MAKE) -C src energymech
|
||||
|
||||
energymech: $(SRCFILES) $(CONFFILES)
|
||||
$(MAKE) -C src energymech
|
||||
|
||||
clean: FORCE
|
||||
clean:
|
||||
$(MAKE) -C src clean
|
||||
|
||||
install: FORCE
|
||||
install:
|
||||
$(MAKE) -C src install
|
||||
|
||||
mega: FORCE
|
||||
mega:
|
||||
$(MAKE) -C src mega
|
||||
|
||||
mega-install: FORCE
|
||||
mega-install:
|
||||
$(MAKE) -C src mega-install
|
||||
|
||||
#
|
||||
# code validation tests
|
||||
#
|
||||
|
||||
test: FORCE
|
||||
test:
|
||||
$(MAKE) -C src test
|
||||
|
||||
#
|
||||
# packing things up for distribution
|
||||
#
|
||||
|
||||
dist: FORCE
|
||||
dist:
|
||||
$(MAKE) dist2 DISTDIR=`sed 's/^.*VERSION.*"\(.*\)".*$$/emech-\1/p; d;' src/global.h`
|
||||
|
||||
dist2: FORCE
|
||||
dist2:
|
||||
rm -rf /tmp/$(DISTDIR)
|
||||
mkdir /tmp/$(DISTDIR)
|
||||
tar cf - $(DISTFILES) | ( cd /tmp/$(DISTDIR) ; tar --preserve-permissions -xf - )
|
||||
@ -116,4 +118,3 @@ dist2: FORCE
|
||||
rm -rf /tmp/$(DISTDIR)
|
||||
chmod 644 /tmp/$(DISTDIR).tar.gz
|
||||
|
||||
FORCE:
|
||||
|
||||
5
README
5
README
@ -37,6 +37,10 @@ To compile the source:
|
||||
export CROSS_COMPILE="armv7a-hardfloat-linux-gnueabi-"
|
||||
|
||||
4) make clean install
|
||||
-- On a modern multi-core cpu, you can run make with the appropriate
|
||||
-j switch to shave off a few seconds of compile time.
|
||||
For example:
|
||||
``make -j4'' for a 4 core cpu system.
|
||||
|
||||
If all went well you should now have an executable called
|
||||
``energymech''.
|
||||
@ -88,6 +92,7 @@ to see what's going on with...
|
||||
|
||||
If you get an 'Unknown option -d', you need to answer 'Y' to debug
|
||||
support when running ./configure from the compiling section above.
|
||||
Or run with ``./configure --with-debug''.
|
||||
|
||||
---*---
|
||||
|
||||
|
||||
3
VERSIONS
3
VERSIONS
@ -1,5 +1,8 @@
|
||||
3.0.99p4 -- WORK IN PROGRESS (~March, 2018)
|
||||
|
||||
* Added: Energymech can now link with libmusl (--with-libmusl[=/PATH/TO/musl-gcc])
|
||||
* Added: (ALPHA) Perl scripting support (PERL, PERLSCRIPT)
|
||||
* Changed: Trivia question file must be placed in ./trivia/*
|
||||
* Changed: If compiled with debug, Free() on unknown memory no longer shuts down the bot,
|
||||
now it just ignores the panic and swallows the (possible) leak.
|
||||
* Added: Experimental code to suppress certain commands to run on only one bot even
|
||||
|
||||
17
config/perl.c
Normal file
17
config/perl.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
|
||||
static PerlInterpreter *my_perl;
|
||||
|
||||
int main(int argc, char **argv, char **env)
|
||||
{
|
||||
PERL_SYS_INIT3(&argc,&argv,&env);
|
||||
my_perl = perl_alloc();
|
||||
perl_construct(my_perl);
|
||||
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
|
||||
perl_parse(my_perl, NULL, argc, argv, (char **)NULL);
|
||||
perl_run(my_perl);
|
||||
perl_destruct(my_perl);
|
||||
perl_free(my_perl);
|
||||
PERL_SYS_TERM();
|
||||
}
|
||||
515
configure
vendored
515
configure
vendored
@ -20,15 +20,50 @@
|
||||
|
||||
umask 077
|
||||
|
||||
# perl still unsupported
|
||||
#has_perl=no
|
||||
compile=no
|
||||
install=no
|
||||
silentopt=no
|
||||
try_libmusl=no
|
||||
|
||||
# default optimization goal, speed = -O2, size = -Os
|
||||
optitype=size
|
||||
|
||||
set_feature_defaults() {
|
||||
ft_alias=$ft_default
|
||||
ft_botnet=$ft_default
|
||||
ft_bounce=$ft_default
|
||||
ft_chanban=$ft_default
|
||||
ft_ctcp=$ft_default
|
||||
ft_dccfile=$ft_default
|
||||
ft_debug=$ft_default
|
||||
ft_dynamode=$ft_default
|
||||
ft_dyncmd=$ft_default
|
||||
ft_greet=$ft_default
|
||||
ft_hostinfo=$ft_default
|
||||
ft_ircd_ext=$ft_default
|
||||
ft_md5=$ft_default
|
||||
ft_newbie=$ft_default
|
||||
ft_note=$ft_default
|
||||
ft_notify=$ft_default
|
||||
ft_perl=$ft_default
|
||||
ft_python=$ft_default
|
||||
ft_rawdns=$ft_default
|
||||
ft_redirect=$ft_default
|
||||
ft_seen=$ft_default
|
||||
ft_session=$ft_default
|
||||
ft_sha=$ft_default
|
||||
ft_stats=$ft_default
|
||||
ft_suppress=$ft_default
|
||||
ft_tcl=$ft_default
|
||||
ft_telnet=$ft_default
|
||||
ft_toybox=$ft_default
|
||||
ft_trivia=$ft_default
|
||||
ft_uptime=$ft_default
|
||||
ft_urlcapture=$ft_default
|
||||
ft_web=$ft_default
|
||||
ft_wingate=$ft_default
|
||||
}
|
||||
|
||||
for opt
|
||||
do
|
||||
|
||||
@ -41,10 +76,10 @@ do
|
||||
|
||||
yesno=
|
||||
case "$opt" in
|
||||
--with=* ) yesno=yes ;;
|
||||
--enable=* ) yesno=yes ;;
|
||||
--without=* ) yesno=no ;;
|
||||
--disable=* ) yesno=no ;;
|
||||
--with=* ) yesno=yes ;;
|
||||
--enable=* ) yesno=yes ;;
|
||||
--without=* ) yesno=no ;;
|
||||
--disable=* ) yesno=no ;;
|
||||
esac
|
||||
|
||||
if [ "$yesno" = yes -o "$yesno" = no ]; then
|
||||
@ -55,40 +90,40 @@ do
|
||||
do
|
||||
if [ "$notfirst" ]; then
|
||||
case "$nn" in
|
||||
alias ) ft_alias=$yesno ;;
|
||||
botnet ) ft_botnet=$yesno ;;
|
||||
bounce ) ft_bounce=$yesno ;;
|
||||
chanban ) ft_chanban=$yesno ;;
|
||||
ctcp ) ft_ctcp=$yesno ;;
|
||||
dccfile ) ft_dccfile=$yesno ;;
|
||||
debug ) ft_debug=$yesno ;;
|
||||
dynamode ) ft_dynamode=$yesno ;;
|
||||
dyncmd ) ft_dyncmd=$yesno ;;
|
||||
greet ) ft_greet=$yesno ;;
|
||||
hostinfo ) ft_hostinfo=$yesno ;;
|
||||
idwrap ) ft_idwrap=$yesno ;;
|
||||
ircd_ext ) ft_ircd_ext=$yesno ;;
|
||||
md5 ) ft_md5=$yesno ;;
|
||||
newbie ) ft_newbie=$yesno ;;
|
||||
note ) ft_note=$yesno ;;
|
||||
notify ) ft_notify=$yesno ;;
|
||||
perl ) ft_perl=$yesno ;;
|
||||
python ) ft_python=$yesno ;;
|
||||
rawdns ) ft_rawdns=$yesno ;;
|
||||
redirect ) ft_redirect=$yesno ;;
|
||||
seen ) ft_seen=$yesno ;;
|
||||
session ) ft_session=$yesno ;;
|
||||
sha ) ft_sha=$yesno ;;
|
||||
stats ) ft_stats=$yesno ;;
|
||||
suppress ) ft_suppress=$yesno ;;
|
||||
tcl ) ft_tcl=$yesno ;;
|
||||
telnet ) ft_telnet=$yesno ;;
|
||||
toybox ) ft_toybox=$yesno ;;
|
||||
trivia ) ft_trivia=$yesno ;;
|
||||
uptime ) ft_uptime=$yesno ;;
|
||||
urlcapture ) ft_urlcapture=$yesno ;;
|
||||
web ) ft_web=$yesno ;;
|
||||
wingate ) ft_wingate=$yesno ;;
|
||||
alias ) ft_alias=$yesno ;;
|
||||
botnet ) ft_botnet=$yesno ;;
|
||||
bounce ) ft_bounce=$yesno ;;
|
||||
chanban ) ft_chanban=$yesno ;;
|
||||
ctcp ) ft_ctcp=$yesno ;;
|
||||
dccfile ) ft_dccfile=$yesno ;;
|
||||
debug ) ft_debug=$yesno ;;
|
||||
dynamode ) ft_dynamode=$yesno ;;
|
||||
dyncmd ) ft_dyncmd=$yesno ;;
|
||||
greet ) ft_greet=$yesno ;;
|
||||
hostinfo ) ft_hostinfo=$yesno ;;
|
||||
idwrap ) ft_idwrap=$yesno ;;
|
||||
ircd_ext ) ft_ircd_ext=$yesno ;;
|
||||
md5 ) ft_md5=$yesno ;;
|
||||
newbie ) ft_newbie=$yesno ;;
|
||||
note ) ft_note=$yesno ;;
|
||||
notify ) ft_notify=$yesno ;;
|
||||
perl ) ft_perl=$yesno ;;
|
||||
python ) ft_python=$yesno ;;
|
||||
rawdns ) ft_rawdns=$yesno ;;
|
||||
redirect ) ft_redirect=$yesno ;;
|
||||
seen ) ft_seen=$yesno ;;
|
||||
session ) ft_session=$yesno ;;
|
||||
sha ) ft_sha=$yesno ;;
|
||||
stats ) ft_stats=$yesno ;;
|
||||
suppress ) ft_suppress=$yesno ;;
|
||||
tcl ) ft_tcl=$yesno ;;
|
||||
telnet ) ft_telnet=$yesno ;;
|
||||
toybox ) ft_toybox=$yesno ;;
|
||||
trivia ) ft_trivia=$yesno ;;
|
||||
uptime ) ft_uptime=$yesno ;;
|
||||
urlcapture ) ft_urlcapture=$yesno ;;
|
||||
web ) ft_web=$yesno ;;
|
||||
wingate ) ft_wingate=$yesno ;;
|
||||
esac
|
||||
else
|
||||
notfirst=yes
|
||||
@ -115,17 +150,20 @@ do
|
||||
esac
|
||||
|
||||
case "$feature" in
|
||||
debug | botnet | telnet | alias | seen | session | dyncmd | newbie | wingate | md5 | sha \
|
||||
| ctcp | dccfile | uptime | redirect | greet | perl | profiling | tcl | dynamode | web | hostinfo \
|
||||
| note | notify | trivia | toybox | bounce | stats | suppress | rawdns | ircd_ext | idwrap | chanban | python | urlcapture )
|
||||
alias | botnet | bounce | chanban | ctcp | dccfile | debug | dynamode | dyncmd | greet | hostinfo | idwrap | ircd_ext | libmusl | md5 | newbie | note | notify | perl \
|
||||
| profiling | python | rawdns | redirect | seen | session | sha | stats | suppress | tcl | telnet | toybox | trivia | uptime | urlcapture | web | wingate )
|
||||
case _"$optarg"_ in
|
||||
_yes_ | _no_ | __ )
|
||||
;;
|
||||
*)
|
||||
echo "unknown argument for $feature":" $optarg"
|
||||
echo "Usage: configure [options]"
|
||||
echo "use \"$0 --help\" for help"
|
||||
exit 1
|
||||
if [ "$feature" = libmusl ]; then
|
||||
try_libmusl="$optarg"
|
||||
else
|
||||
echo "unknown argument for $feature":" $optarg"
|
||||
echo "Usage: configure [options]"
|
||||
echo "use \"$0 --help\" for help"
|
||||
exit 1
|
||||
fi
|
||||
esac
|
||||
;;
|
||||
___none___ )
|
||||
@ -141,76 +179,76 @@ do
|
||||
--with=* | --without=* | --enable=* | --disable=* ) ;;
|
||||
--enable-* | --with-*)
|
||||
case "$feature"_"$optarg" in
|
||||
alias_yes | alias_ ) ft_alias=yes ;;
|
||||
alias_no ) ft_alias=no ;;
|
||||
botnet_yes | botnet_ ) ft_botnet=yes ;;
|
||||
botnet_no ) ft_botnet=no ;;
|
||||
bounce_yes | bounce_ ) ft_bounce=yes ;;
|
||||
bounce_no ) ft_bounce=no ;;
|
||||
chanban_yes | chanban_ ) ft_chanban=yes ;;
|
||||
chanban_no ) ft_chanban=no ;;
|
||||
ctcp_yes | ctcp_ ) ft_ctcp=yes ;;
|
||||
ctcp_no ) ft_ctcp=no ;;
|
||||
dccfile_yes | dccfile_ ) ft_dccfile=yes ;;
|
||||
dccfile_no ) ft_dccfile=no ;;
|
||||
debug_yes | debug_ ) ft_debug=yes ;;
|
||||
debug_no ) ft_debug=no ;;
|
||||
dynamode_yes | dynamode_ ) ft_dynamode=yes ;;
|
||||
dynamode_no ) ft_dynamode=no ;;
|
||||
dyncmd_yes | dyncmd_ ) ft_dyncmd=yes ;;
|
||||
dyncmd_no ) ft_dyncmd=no ;;
|
||||
greet_yes | greet_ ) ft_greet=yes ;;
|
||||
greet_no ) ft_greet=no ;;
|
||||
hostinfo_yes | hostinfo_ ) ft_hostinfo=yes ;;
|
||||
hostinfo_no ) ft_hostinfo=no ;;
|
||||
idwrap_yes | idwrap_ ) ft_idwrap=yes ;;
|
||||
idwrap_no ) ft_idwrap=no ;;
|
||||
ircd_ext_yes | ircd_ext_ ) ft_ircd_ext=yes ;;
|
||||
ircd_ext_no ) ft_ircd_ext=no ;;
|
||||
md5_yes | md5_ ) ft_md5=yes ;;
|
||||
md5_no ) ft_md5=no ;;
|
||||
newbie_yes | newbie_ ) ft_newbie=yes ;;
|
||||
newbie_no ) ft_newbie=no ;;
|
||||
note_yes | note_ ) ft_note=yes ;;
|
||||
note_no ) ft_note=no ;;
|
||||
notify_yes | notify_ ) ft_notify=yes ;;
|
||||
notify_no ) ft_notify=no ;;
|
||||
perl_yes | perl_ ) ft_perl=yes ;;
|
||||
perl_no ) ft_perl=no ;;
|
||||
python_yes | python_ ) ft_python=yes ;;
|
||||
python_no ) ft_python=no ;;
|
||||
rawdns_yes | rawdns_ ) ft_rawdns=yes ;;
|
||||
rawdns_no ) ft_rawdns=no ;;
|
||||
redirect_yes | redirect_ ) ft_redirect=yes ;;
|
||||
redirect_no ) ft_redirect=no ;;
|
||||
seen_yes | seen_ ) ft_seen=yes ;;
|
||||
seen_no ) ft_seen=no ;;
|
||||
session_yes | session_ ) ft_session=yes ;;
|
||||
session_no ) ft_session=no ;;
|
||||
sha_yes | sha_ ) ft_seen=yes ;;
|
||||
sha_no ) ft_sha=no ;;
|
||||
stats_yes | stats_ ) ft_stats=yes ;;
|
||||
stats_no ) ft_stats=no ;;
|
||||
suppress_yes | suppress_ ) ft_suppress=yes ;;
|
||||
suppress_no ) ft_suppress=no ;;
|
||||
tcl_yes | tcl_ ) ft_tcl=yes ;;
|
||||
tcl_no ) ft_tcl=no ;;
|
||||
telnet_yes | telnet_ ) ft_telnet=yes ;;
|
||||
telnet_no ) ft_telnet=no ;;
|
||||
toybox_yes | toybox_ ) ft_toybox=yes ;;
|
||||
toybox_no ) ft_toybox=no ;;
|
||||
trivia_yes | trivia_ ) ft_trivia=yes ;;
|
||||
trivia_no ) ft_trivia=no ;;
|
||||
uptime_yes | uptime_ ) ft_uptime=yes ;;
|
||||
uptime_no ) ft_uptime=no ;;
|
||||
urlcapture_yes | urlcapture_ ) ft_urlcapture=yes ;;
|
||||
urlcapture_no ) ft_urlcapture=no ;;
|
||||
web_yes | web_ ) ft_web=yes ;;
|
||||
web_no ) ft_web=no ;;
|
||||
wingate_yes | wingate_ ) ft_wingate=yes ;;
|
||||
wingate_no ) ft_wingate=no ;;
|
||||
profiling_yes | profiling_ ) ft_prof=yes ;;
|
||||
profiling_no ) ft_prof=no ;;
|
||||
alias_yes | alias_ ) ft_alias=yes ;;
|
||||
alias_no ) ft_alias=no ;;
|
||||
botnet_yes | botnet_ ) ft_botnet=yes ;;
|
||||
botnet_no ) ft_botnet=no ;;
|
||||
bounce_yes | bounce_ ) ft_bounce=yes ;;
|
||||
bounce_no ) ft_bounce=no ;;
|
||||
chanban_yes | chanban_ ) ft_chanban=yes ;;
|
||||
chanban_no ) ft_chanban=no ;;
|
||||
ctcp_yes | ctcp_ ) ft_ctcp=yes ;;
|
||||
ctcp_no ) ft_ctcp=no ;;
|
||||
dccfile_yes | dccfile_ ) ft_dccfile=yes ;;
|
||||
dccfile_no ) ft_dccfile=no ;;
|
||||
debug_yes | debug_ ) ft_debug=yes ;;
|
||||
debug_no ) ft_debug=no ;;
|
||||
dynamode_yes | dynamode_ ) ft_dynamode=yes ;;
|
||||
dynamode_no ) ft_dynamode=no ;;
|
||||
dyncmd_yes | dyncmd_ ) ft_dyncmd=yes ;;
|
||||
dyncmd_no ) ft_dyncmd=no ;;
|
||||
greet_yes | greet_ ) ft_greet=yes ;;
|
||||
greet_no ) ft_greet=no ;;
|
||||
hostinfo_yes | hostinfo_ ) ft_hostinfo=yes ;;
|
||||
hostinfo_no ) ft_hostinfo=no ;;
|
||||
idwrap_yes | idwrap_ ) ft_idwrap=yes ;;
|
||||
idwrap_no ) ft_idwrap=no ;;
|
||||
ircd_ext_yes | ircd_ext_ ) ft_ircd_ext=yes ;;
|
||||
ircd_ext_no ) ft_ircd_ext=no ;;
|
||||
md5_yes | md5_ ) ft_md5=yes ;;
|
||||
md5_no ) ft_md5=no ;;
|
||||
newbie_yes | newbie_ ) ft_newbie=yes ;;
|
||||
newbie_no ) ft_newbie=no ;;
|
||||
note_yes | note_ ) ft_note=yes ;;
|
||||
note_no ) ft_note=no ;;
|
||||
notify_yes | notify_ ) ft_notify=yes ;;
|
||||
notify_no ) ft_notify=no ;;
|
||||
perl_yes | perl_ ) ft_perl=yes ;;
|
||||
perl_no ) ft_perl=no ;;
|
||||
python_yes | python_ ) ft_python=yes ;;
|
||||
python_no ) ft_python=no ;;
|
||||
rawdns_yes | rawdns_ ) ft_rawdns=yes ;;
|
||||
rawdns_no ) ft_rawdns=no ;;
|
||||
redirect_yes | redirect_ ) ft_redirect=yes ;;
|
||||
redirect_no ) ft_redirect=no ;;
|
||||
seen_yes | seen_ ) ft_seen=yes ;;
|
||||
seen_no ) ft_seen=no ;;
|
||||
session_yes | session_ ) ft_session=yes ;;
|
||||
session_no ) ft_session=no ;;
|
||||
sha_yes | sha_ ) ft_seen=yes ;;
|
||||
sha_no ) ft_sha=no ;;
|
||||
stats_yes | stats_ ) ft_stats=yes ;;
|
||||
stats_no ) ft_stats=no ;;
|
||||
suppress_yes | suppress_ ) ft_suppress=yes ;;
|
||||
suppress_no ) ft_suppress=no ;;
|
||||
tcl_yes | tcl_ ) ft_tcl=yes ;;
|
||||
tcl_no ) ft_tcl=no ;;
|
||||
telnet_yes | telnet_ ) ft_telnet=yes ;;
|
||||
telnet_no ) ft_telnet=no ;;
|
||||
toybox_yes | toybox_ ) ft_toybox=yes ;;
|
||||
toybox_no ) ft_toybox=no ;;
|
||||
trivia_yes | trivia_ ) ft_trivia=yes ;;
|
||||
trivia_no ) ft_trivia=no ;;
|
||||
uptime_yes | uptime_ ) ft_uptime=yes ;;
|
||||
uptime_no ) ft_uptime=no ;;
|
||||
urlcapture_yes | urlcapture_ ) ft_urlcapture=yes ;;
|
||||
urlcapture_no ) ft_urlcapture=no ;;
|
||||
web_yes | web_ ) ft_web=yes ;;
|
||||
web_no ) ft_web=no ;;
|
||||
wingate_yes | wingate_ ) ft_wingate=yes ;;
|
||||
wingate_no ) ft_wingate=no ;;
|
||||
profiling_yes | profiling_ ) ft_prof=yes ;;
|
||||
profiling_no ) ft_prof=no ;;
|
||||
esac
|
||||
;;
|
||||
--disable-* | --without-*)
|
||||
@ -241,7 +279,7 @@ do
|
||||
session ) ft_session=no ;;
|
||||
sha ) ft_sha=yes ;;
|
||||
stats ) ft_stats=no ;;
|
||||
suppress ) ft_suppress=no ;;
|
||||
suppress ) ft_suppress=no ;;
|
||||
tcl ) ft_tcl=no ;;
|
||||
telnet ) ft_telnet=no ;;
|
||||
toybox ) ft_toybox=no ;;
|
||||
@ -252,90 +290,80 @@ do
|
||||
wingate ) ft_wingate=no ;;
|
||||
esac
|
||||
;;
|
||||
--compile) compile=yes ;;
|
||||
--install) install=yes ;;
|
||||
--silence=options) silentopt=yes ;;
|
||||
--md5=internal) ft_md5=internal ;;
|
||||
--sha=internal) ft_sha=internal ;;
|
||||
--use-cpuflags) cc_arch_opt=yes ;;
|
||||
--no-cpuflags) cc_arch_opt=no ;;
|
||||
--use-optimize) cc_optimize_opt=yes ;;
|
||||
--no-optimize) cc_optimize_opt=no ;;
|
||||
--optimize=speed) optitype=speed ;;
|
||||
--optimize=size) optitype=size ;;
|
||||
--use-gnudebug) cc_g_opt=yes ;;
|
||||
--no-gnudebug) cc_g_opt=no ;;
|
||||
--use-warnflag) cc_wall_opt=yes ;;
|
||||
--no-warnflag) cc_wall_opt=no ;;
|
||||
--use-pipeflag) cc_pipe_opt=yes ;;
|
||||
--no-pipeflag) cc_pipe_opt=no ;;
|
||||
--use-ofp) cc_ofp_opt=yes ;;
|
||||
--no-ofp) cc_ofp_opt=no ;;
|
||||
--yes) ft_alias=yes
|
||||
ft_botnet=yes
|
||||
ft_bounce=yes
|
||||
ft_chanban=yes
|
||||
ft_ctcp=yes
|
||||
ft_dccfile=yes
|
||||
ft_debug=yes
|
||||
ft_dynamode=yes
|
||||
ft_dyncmd=yes
|
||||
ft_greet=yes
|
||||
ft_hostinfo=yes
|
||||
ft_ircd_ext=yes
|
||||
ft_md5=yes
|
||||
ft_newbie=yes
|
||||
ft_note=yes
|
||||
ft_notify=yes
|
||||
ft_python=yes
|
||||
ft_rawdns=yes
|
||||
ft_redirect=yes
|
||||
ft_seen=yes
|
||||
ft_session=yes
|
||||
ft_sha=yes
|
||||
ft_stats=yes
|
||||
ft_suppress=yes
|
||||
ft_tcl=yes
|
||||
ft_telnet=yes
|
||||
ft_toybox=yes
|
||||
ft_trivia=yes
|
||||
ft_uptime=yes
|
||||
ft_urlcapture=yes
|
||||
ft_web=yes
|
||||
ft_wingate=yes
|
||||
;;
|
||||
--compile) compile=yes ;;
|
||||
--install) install=yes ;;
|
||||
--with-libmusl) try_libmusl=/usr/local/musl/bin/musl-gcc ;;
|
||||
--silence=options) silentopt=yes ;;
|
||||
--md5=internal) ft_md5=internal ;;
|
||||
--sha=internal) ft_sha=internal ;;
|
||||
--use-cpuflags) cc_arch_opt=yes ;;
|
||||
--no-cpuflags) cc_arch_opt=no ;;
|
||||
--use-optimize) cc_optimize_opt=yes ;;
|
||||
--no-optimize) cc_optimize_opt=no ;;
|
||||
--optimize=speed) optitype=speed ;;
|
||||
--optimize=size) optitype=size ;;
|
||||
--use-gnudebug) cc_g_opt=yes ;;
|
||||
--no-gnudebug) cc_g_opt=no ;;
|
||||
--use-warnflag) cc_wall_opt=yes ;;
|
||||
--no-warnflag) cc_wall_opt=no ;;
|
||||
--use-pipeflag) cc_pipe_opt=yes ;;
|
||||
--no-pipeflag) cc_pipe_opt=no ;;
|
||||
--use-ofp) cc_ofp_opt=yes ;;
|
||||
--no-ofp) cc_ofp_opt=no ;;
|
||||
--default-yes) ft_default=yes set_feature_defaults ;;
|
||||
--default-no) ft_default=no set_feature_defaults ;;
|
||||
--help | -h)
|
||||
cat <<__EOT__
|
||||
Usage: configure [options]
|
||||
Configuration:
|
||||
--help print this message
|
||||
Features and packages:
|
||||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--with-FEATURE[=ARG] use FEATURE [ARG=yes]
|
||||
--without-FEATURE do not use FEATURE (same as --with-FEATURE=no)
|
||||
--md5=internal Use internal routines for MD5 password hashes instead of system libraries
|
||||
--sha=internal Use internal routines for SHA password hashes instead of system libraries
|
||||
--use-ofp Try to use compiler flag -fomit-frame-pointer
|
||||
--no-ofp Do not use compiler flag -fomit-frame-pointer
|
||||
#md5 | ctcp | dccfile | uptime | redirect | greet | perl | dynamode | web \
|
||||
#note | notify | trivia | toybox | bounce | stats | rawdns | ircd_ext | idwrap | chanban | python )
|
||||
--with-alias ALIAS support
|
||||
--with-botnet Botnet support
|
||||
--with-debug Debug support
|
||||
--with-dyncmd Dynamic command levels support
|
||||
--with-hostinfo Support for code that reveals/displays/shares information about the host
|
||||
that the bot is running on
|
||||
--with-newbie Newbie support
|
||||
--with-profiling Profiling (gcc+gprof)
|
||||
--with-seen SEEN support
|
||||
--with-session Session support
|
||||
--with-suppress Command duplication suppression
|
||||
--with-tcl Tcl support
|
||||
--with-telnet Telnet support
|
||||
--with-uptime Include code that sends uptime reports to the IRC bot uptime contest server
|
||||
--with-urlcapture URL capture support
|
||||
--with-wingate Wingate support
|
||||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--with-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--without-FEATURE do not include FEATURE (same as --with-FEATURE=no)
|
||||
--default-yes Default answer for all feature selections is Yes
|
||||
--default-no Default answer for all feature selections is No
|
||||
--md5=internal Use internal routines for MD5 password hashes instead of system libraries
|
||||
--sha=internal Use internal routines for SHA password hashes instead of system libraries
|
||||
--use-ofp Try to use compiler flag -fomit-frame-pointer
|
||||
--no-ofp Do not use compiler flag -fomit-frame-pointer
|
||||
--with-alias ALIAS support
|
||||
--with-botnet Botnet support
|
||||
--with-bounce
|
||||
--with-chanban
|
||||
--with-ctcp
|
||||
--with-dccfile
|
||||
--with-debug Debug support
|
||||
--with-dynamode
|
||||
--with-dyncmd Dynamic command levels support
|
||||
--with-greet
|
||||
--with-hostinfo Support for code that reveals/displays/shares information about the host that the bot is running on
|
||||
--with-ircd_ext
|
||||
--with-libmusl[=/PATH/TO/musl-gcc]
|
||||
Try to use libmusl instead of system default
|
||||
--with-md5
|
||||
--with-newbie Newbie support for extra sanity checks and error messages
|
||||
--with-note
|
||||
--with-notify
|
||||
--with-perl
|
||||
--with-profiling Profiling (gcc+gprof)
|
||||
--with-python
|
||||
--with-rawdns
|
||||
--with-redirect
|
||||
--with-seen SEEN support
|
||||
--with-session Session support
|
||||
--with-sha
|
||||
--with-stats
|
||||
--with-suppress Command duplication suppression
|
||||
--with-tcl Tcl scripting support
|
||||
--with-telnet Telnet support
|
||||
--with-toybox
|
||||
--with-trivia
|
||||
--with-uptime Include code that sends uptime reports to the IRC bot uptime contest server
|
||||
--with-urlcapture URL capture support
|
||||
--with-web
|
||||
--with-wingate Wingate support
|
||||
__EOT__
|
||||
exit 0
|
||||
;;
|
||||
@ -434,6 +462,32 @@ TESTO=./test$$.o
|
||||
TESTP=./test$$
|
||||
rm -f $TESTO $TESTP
|
||||
|
||||
has_musl=no
|
||||
#
|
||||
# if directed to use libmusl instead of (g)libc ...
|
||||
#
|
||||
if [ ! "$try_libmusl" = no ]; then
|
||||
echo $ac_n "checking for libmusl ... "$ac_c
|
||||
mgcc=`config/which musl-gcc`
|
||||
if [ -x "$mgcc" ]; then
|
||||
CC="$mgcc"
|
||||
fi
|
||||
if [ -x "$try_musl" ]; then
|
||||
CC="$try_musl"
|
||||
fi
|
||||
if [ -x "$try_musl/musl-gcc" ]; then
|
||||
CC="$try_musl/musl-gcc"
|
||||
fi
|
||||
if [ -x "$try_musl/bin/musl-gcc" ]; then
|
||||
CC="$try_musl/bin/musl-gcc"
|
||||
fi
|
||||
if [ -x /opt/musl/bin/musl-gcc ]; then
|
||||
CC=/opt/musl/bin/musl-gcc
|
||||
fi
|
||||
CCshort=$CC
|
||||
echo $ac_t yes
|
||||
fi
|
||||
|
||||
#
|
||||
# does the C compile work?
|
||||
#
|
||||
@ -829,6 +883,29 @@ elif [ ! "$ft_md5" = no ]; then
|
||||
rm -f $TESTP
|
||||
fi
|
||||
|
||||
#
|
||||
# check for perl scripting support
|
||||
#
|
||||
has_perl=no
|
||||
perlinclude=
|
||||
libperl=
|
||||
if [ ! "$ft_perl" = no ]; then
|
||||
echo $ac_n "checking for perl ... "$ac_c
|
||||
pinc1=`perl -MConfig -e 'print $Config{archlib}'`
|
||||
if [ -r $pinc1/CORE/perl.h -a -r $pinc1/CORE/EXTERN.h -a -r $pinc1/CORE/XSUB.h ]; then
|
||||
perlinclude=$pinc1/CORE
|
||||
TESTC=config/perl.c
|
||||
if $CC -o $TESTP $TESTC -I$perlinclude -L$perlinclude -lperl 1> /dev/null 2> /dev/null; then
|
||||
has_perl=yes
|
||||
libperl=-lperl
|
||||
I_PERL=-I$perlinclude
|
||||
L_PERL=-L$perlinclude
|
||||
fi
|
||||
rm -f $TESTP
|
||||
fi
|
||||
echo $ac_t "$has_perl"
|
||||
fi
|
||||
|
||||
#
|
||||
# check for tcl
|
||||
#
|
||||
@ -977,6 +1054,28 @@ if [ "$silentopt" = yes ]; then
|
||||
out=/bin/true
|
||||
fi
|
||||
|
||||
#
|
||||
# is this a git environment
|
||||
#
|
||||
echo $ac_n "checking for git ... "$ac_c
|
||||
GITEXE=`config/which git`
|
||||
echo $ac_t "$GITEXE"
|
||||
|
||||
#
|
||||
# multiple cpus/cores for multiple parallell compiler jobs (make -j#)
|
||||
#
|
||||
cores=1
|
||||
if [ -r /proc/cpuinfo ]; then
|
||||
echo $ac_n "checking for multiple cpus or multiple cores ... "$ac_c
|
||||
cores=`cat /proc/cpuinfo | grep '^processor' | wc -l`
|
||||
echo $ac_t "$cores cpus/cores"
|
||||
fi
|
||||
|
||||
makejobs=
|
||||
if [ ! "$cores" = 1 ]; then
|
||||
makejobs="-j$cores"
|
||||
fi
|
||||
|
||||
echo
|
||||
$out "Do you want ..."
|
||||
$out
|
||||
@ -1141,11 +1240,11 @@ fi
|
||||
#
|
||||
def_perl='#undef PERL'
|
||||
unset ans
|
||||
echo $ac_n "[ ALPHA] Perl scripting support? .................... [y/N] "$ac_c
|
||||
$out $ac_n "[ ALPHA] Perl scripting support? .................... [y/N] "$ac_c
|
||||
if [ "$has_perl" = no ]; then
|
||||
echo 'no (unsupported)'
|
||||
$out 'no (unsupported)'
|
||||
else
|
||||
test "$ft_perl" && echo "$ft_perl" && ans=$ft_perl
|
||||
test "$ft_perl" && $out "$ft_perl" && ans=$ft_perl
|
||||
test -z "$ft_perl" && read ans
|
||||
test "$ans" = y -o "$ans" = Y -o "$ans" = yes -o "$ans" = YES -o "$ans" = Yes && def_perl='#define PERL'
|
||||
fi
|
||||
@ -1248,7 +1347,7 @@ echo "Creating src/Makefile"
|
||||
|
||||
O_FLAGS="$cc_optimize_flag $cc_arch_flag $cc_march_flag $cc_ofp_flag"
|
||||
W_FLAGS="$cc_wall_flag $cc_wshadow_flag $cc_fnostrictalias"
|
||||
libflags="$libcrypt $libtcl $libnsl $libsocket $libresolv $libpython"
|
||||
libflags="$libcrypt $libtcl $libnsl $libsocket $libresolv $libpython $libperl"
|
||||
lflags="$cc_g_flag -o"
|
||||
cprof="$cc_pg_flag $cc_pg_define"
|
||||
lprof="$cc_pg_flag $cc_pg_define $libpgdl"
|
||||
@ -1265,12 +1364,15 @@ s%@gdbflag@%$cc_g_flag%;
|
||||
/@libflags@/ { s,@libflags@,$libflags,; };
|
||||
/@W_FLAGS@/ { s/@W_FLAGS@/$W_FLAGS/; };
|
||||
/@O_FLAGS@/ { s/@O_FLAGS@/$O_FLAGS/; };
|
||||
/@I_PERL@/ { s,@I_PERL@,$I_PERL,; };
|
||||
/@L_PERL@/ { s,@L_PERL@,$L_PERL,; };
|
||||
/@PYINCLUDE@/ { s,@PYINCLUDE@,$incpython,; };
|
||||
/@TCLINCLUDE@/ { s,@TCLINCLUDE@,$inctcl,; };
|
||||
s|@MD5_O@|$MD5_O|;
|
||||
s|@SHA_O@|$SHA_O|;
|
||||
s%@oc@%$objcomment%;
|
||||
s%@sz@%$sizecomment%;
|
||||
s%@makejobs@%$makejobs%;
|
||||
s/[ ]*\$//g;
|
||||
" < src/Makefile.in >> src/Makefile || exit 1
|
||||
|
||||
@ -1333,19 +1435,26 @@ s|@UNALIGNED_MEM@|$UNALIGNED_MEM|;
|
||||
" < src/config.h.in >> src/config.h
|
||||
|
||||
if [ "$install" = yes ]; then
|
||||
make -C src energymech
|
||||
make $makejobs -C src energymech
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$compile" = yes ]; then
|
||||
make -C src energymech
|
||||
make $makejobs -C src energymech
|
||||
exit
|
||||
fi
|
||||
|
||||
echo ''
|
||||
echo 'All done. You can now "make clean install"'
|
||||
echo 'All done. You can now "make install"'
|
||||
if [ ! "$cores" = 1 ]; then
|
||||
echo "For speedy compiling, use \`\`make -j$cores''"
|
||||
fi
|
||||
echo ''
|
||||
echo 'Submit your bugreports at https://github.com/MadCamel/energymech/issues'
|
||||
echo ''
|
||||
echo 'You have read the README file I hope?'
|
||||
echo ''
|
||||
|
||||
# make: 7.962u 0.870s 0:08.52 103.6% 0+0k 0+0io 0pf+0w
|
||||
# make -j4: 8.779u 1.069s 0:03.11 316.0% 0+0k 0+0io 0pf+0w
|
||||
# make -j8: 8.977u 1.064s 0:02.92 343.4% 0+0k 0+0io 0pf+0w
|
||||
|
||||
@ -31,6 +31,8 @@ WARNFLAG = @W_FLAGS@
|
||||
OPTIMIZE = @O_FLAGS@
|
||||
PYINCLUDE = @PYINCLUDE@
|
||||
TCLINCLUDE = @TCLINCLUDE@
|
||||
I_PERL = @I_PERL@
|
||||
L_PERL = @L_PERL@
|
||||
|
||||
CFLAGS = $(PIPEFLAG) $(GDBFLAG) $(WARNFLAG) $(OPTIMIZE)
|
||||
LFLAGS = $(PIPEFLAG) $(GDBFLAG)
|
||||
@ -58,6 +60,8 @@ SRCFILES = alias.c auth.c bounce.c chanban.c channel.c core.c \
|
||||
spy.c stats.c tcl.c telnet.c toybox.c trivia.c uptime.c urlcap.c \
|
||||
user.c vars.c web.c
|
||||
|
||||
.PHONY: all clean mega-install mega mega-static test commands
|
||||
|
||||
all: $(INSTALLNAME)
|
||||
|
||||
#
|
||||
@ -78,16 +82,16 @@ install: $(INSTALLNAME)
|
||||
$(CHMOD) $(INSTALLMODE) $(INSTALLNAME)
|
||||
$(MV) $(INSTALLNAME) $(INSTALLDIR)
|
||||
|
||||
clean: FORCE
|
||||
clean:
|
||||
$(RM) $(INSTALLNAME) gencmd mcmd.h usercombo.h core $(TESTFILES) $(OFILES)
|
||||
|
||||
$(INSTALLNAME): $(OFILES)
|
||||
$(CROSS_COMPILE)$(CC) $(LFLAGS) -o $(INSTALLNAME) $(OFILES) $(LPROF) $(LIBS) $(LDSCRIPT)
|
||||
$(CROSS_COMPILE)$(CC) $(LFLAGS) -o $(INSTALLNAME) $(OFILES) $(LPROF) $(LIBS) $(LDSCRIPT) $(L_PERL)
|
||||
@oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment $(INSTALLNAME)
|
||||
@sz@ size $(INSTALLNAME)
|
||||
|
||||
$(INSTALLNAME)-static: $(OFILES)
|
||||
$(CROSS_COMPILE)$(CC) $(LFLAGS) -o $(INSTALLNAME) $(OFILES) $(LPROF) $(LIBS) $(LDSCRIPT) -static
|
||||
$(CROSS_COMPILE)$(CC) $(LFLAGS) -o $(INSTALLNAME) $(OFILES) $(LPROF) $(LIBS) $(LDSCRIPT) $(L_PERL) -static
|
||||
@oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment $(INSTALLNAME)
|
||||
@sz@ size $(INSTALLNAME)
|
||||
|
||||
@ -103,12 +107,12 @@ mega-install: mega $(SRCFILES) $(INCS) usage.h
|
||||
$(MV) $(INSTALLNAME) $(INSTALLDIR)
|
||||
|
||||
mega: $(SRCFILES) $(INCS) usage.h
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) $(TCLINCLUDE)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) $(TCLINCLUDE) $(I_PERL) $(L_PERL)
|
||||
@oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment $(INSTALLNAME)
|
||||
@sz@ size $(INSTALLNAME)
|
||||
|
||||
mega-static: $(SRCFILES) $(INCS) usage.h
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) $(TCLINCLUDE) -static
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -o $(INSTALLNAME) mega.c $(LPROF) $(LIBS) $(LDSCRIPT) $(PYINCLUDE) $(TCLINCLUDE) $(I_PERL) $(L_PERL) -static
|
||||
@oc@ $(CROSS_COMPILE)objcopy -R .note -R .comment $(INSTALLNAME)
|
||||
@sz@ size $(INSTALLNAME)
|
||||
|
||||
@ -203,7 +207,7 @@ parse.o: parse.c $(INCS)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||
|
||||
perl.o: perl.c $(INCS)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) $(I_PERL) -c $< $(CPROF)
|
||||
|
||||
prot.o: prot.c $(INCS)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||
@ -265,4 +269,3 @@ md5/md5.o: md5/md5.c $(INCS)
|
||||
sha/sha1.o: sha/sha1.c $(INCS)
|
||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< -o $@ -Isha1 $(CPROF)
|
||||
|
||||
FORCE:
|
||||
|
||||
@ -1238,7 +1238,7 @@ void debug_rawdns(void)
|
||||
|
||||
#endif /* RAWDNS */
|
||||
|
||||
#if defined(TCL) || defined(PYTHON)
|
||||
#if defined(TCL) || defined(PYTHON) || defined(PERL)
|
||||
|
||||
#if 0
|
||||
typedef struct
|
||||
|
||||
@ -179,7 +179,7 @@ struct
|
||||
* Level 70 == JOINLEVEL
|
||||
*/
|
||||
{ 0, "CYCLE", "do_cycle", 70 | CCPW | CAXS | ACCHAN },
|
||||
{ 0, "FORGET", "do_forget", 70 | CCPW | CARGS },
|
||||
{ 0, "FORGET", "do_forget", 70 | CCPW | CAXS | CARGS },
|
||||
{ 0, "JOIN", "do_join", 70 | CCPW | CARGS },
|
||||
{ 0, "KS", "do_kicksay", 70 | CCPW | REDIR | LBUF },
|
||||
{ 0, "PART", "do_part", 70 | CCPW | CAXS | ACCHAN },
|
||||
@ -251,6 +251,12 @@ struct
|
||||
{ 0, "DEBUG", "do_debug", 100 | CCPW | GAXS },
|
||||
{ 0, "CRASH", "do_crash", 100 | CCPW | GAXS },
|
||||
#endif /* DEBUG */
|
||||
#ifdef PERL
|
||||
#ifdef PLEASE_HACK_MY_SHELL
|
||||
{ 0, "PERL", "do_perl", 100 | CCPW | GAXS | CARGS },
|
||||
#endif /* PLEASE_HACK_MY_SHELL */
|
||||
{ 0, "PERLSCRIPT", "do_perlscript", 100 | CCPW | GAXS | CARGS },
|
||||
#endif /* PERL */
|
||||
#ifdef PYTHON
|
||||
#ifdef PLEASE_HACK_MY_SHELL
|
||||
{ 0, "PYTHON", "do_python", 100 | CCPW | GAXS | CARGS },
|
||||
|
||||
4
src/h.h
4
src/h.h
@ -190,6 +190,10 @@ LS void netchanSuppress(BotNet *, char *) __page(CORE_SEG);
|
||||
/* ons.c */
|
||||
/* parse.c */
|
||||
/* perl.c */
|
||||
|
||||
LS void do_perl(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
LS void do_perlscript(COMMAND_ARGS) __page(CMD1_SEG);
|
||||
|
||||
/* prot.c */
|
||||
/* python.c */
|
||||
/* redirect.c */
|
||||
|
||||
@ -402,8 +402,8 @@ void sig_segv(int crap, siginfo_t *si, void *uap)
|
||||
debug("(sigsegv) trying to access "mx_pfmt"\n",(mx_ptr)si->si_addr);
|
||||
#ifdef __x86_64__
|
||||
mctx = &((ucontext_t *)uap)->uc_mcontext;
|
||||
rsp = &mctx->gregs[15]; // RSP, 64-bit stack pointer
|
||||
rip = &mctx->gregs[16]; // RIP, 64-bit instruction pointer
|
||||
rsp = &mctx->gregs[15]; // RSP, 64-bit stack pointer
|
||||
rip = &mctx->gregs[16]; // RIP, 64-bit instruction pointer
|
||||
|
||||
debug("(sigsegv) Stack pointer: "mx_pfmt", Instruction pointer: "mx_pfmt"\n",(mx_ptr)*rsp,(mx_ptr)*rip);
|
||||
debug("(sigsegv) sig_segv() = "mx_pfmt"\n",(mx_ptr)sig_segv);
|
||||
@ -948,6 +948,9 @@ execve( ./energymech, argv = { ./energymech <NULL> <NULL> <NULL> <NULL> }, envp
|
||||
else
|
||||
to_file(1,"error: Missing argument for -p <string>\n");
|
||||
_exit(0);
|
||||
case 't':
|
||||
startup = 666;
|
||||
break;
|
||||
case 'X':
|
||||
debug_on_exit = TRUE;
|
||||
break;
|
||||
@ -1120,6 +1123,8 @@ execve( ./energymech, argv = { ./energymech <NULL> <NULL> <NULL> <NULL> }, envp
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
if (startup == 666)
|
||||
exit(0);
|
||||
startup = FALSE;
|
||||
doit();
|
||||
}
|
||||
|
||||
50
src/perl.c
50
src/perl.c
@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
EnergyMech, IRC bot software
|
||||
Copyright (c) 2001-2009 proton
|
||||
Copyright (c) 2001 MadCamel
|
||||
Copyright (c) 2001-2018 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
|
||||
@ -19,11 +19,17 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
#define PERL_C
|
||||
#include "config.h"
|
||||
|
||||
#ifdef PERL
|
||||
|
||||
#ifdef __x86_64__
|
||||
typedef __off64_t off64_t;
|
||||
#define __off64_t_defined
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
#include "defines.h"
|
||||
#include "structs.h"
|
||||
#include "global.h"
|
||||
@ -31,12 +37,12 @@
|
||||
#include "text.h"
|
||||
#include "mcmd.h"
|
||||
|
||||
#include "EXTERN.h"
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
||||
#include "EXTERN.h"
|
||||
#include "XSUB.h"
|
||||
#include "perl.h"
|
||||
|
||||
PerlInterpreter *energymech_perl = NULL;
|
||||
#define my_perl energymech_perl
|
||||
|
||||
/*
|
||||
* parse_jump() translates from C to perl
|
||||
@ -55,8 +61,8 @@ int perl_parse_jump(char *from, char *rest, Hook *hook)
|
||||
args[1] = rest;
|
||||
args[2] = NULL;
|
||||
|
||||
/* Call_argv returns the # of args returned from perl */
|
||||
if (call_argv(Hook->self, G_EVAL|G_SCALAR, args) < 1)
|
||||
/* call_argv returns the # of args returned from perl */
|
||||
if (call_argv(hook->self, G_EVAL|G_SCALAR, args) < 1)
|
||||
return(0);
|
||||
|
||||
SPAGAIN; /* Rehash stack, it's probably been clobbered */
|
||||
@ -76,8 +82,8 @@ int perl_parse_jump(char *from, char *rest, Hook *hook)
|
||||
XS(XS_perl_parse_hook)
|
||||
{
|
||||
Hook *hook;
|
||||
char *name, *sub;
|
||||
int c;
|
||||
char *name, *sub;
|
||||
int c;
|
||||
dXSARGS; items = 0;
|
||||
|
||||
/*
|
||||
@ -86,29 +92,23 @@ XS(XS_perl_parse_hook)
|
||||
* but I don't know if it's safe to point directly in to perl
|
||||
* space like that.
|
||||
*/
|
||||
if ((name = strdup(SvPV(ST(0), i)))) == NULL)
|
||||
if ((name = SvPV_nolen(ST(0))) == NULL)
|
||||
XSRETURN_EMPTY;
|
||||
|
||||
if ((sub = strdup(SvPV(ST(0), i)))) == NULL)
|
||||
{
|
||||
free(name);
|
||||
if ((sub = SvPV_nolen(ST(0))) == NULL)
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
* make a Hook struct and link it into the parse hook list
|
||||
*/
|
||||
set_mallocdoer(perl_parse_hook);
|
||||
set_mallocdoer(XS_perl_parse_hook);
|
||||
hook = (Hook*)Calloc(sizeof(Hook) + Strlen2(name,sub)); // sub is never NULL
|
||||
hook->func = perl_parse_jump;
|
||||
hook->next = hooklist;
|
||||
hooklist = hook;
|
||||
|
||||
hook->command = Strcpy(hook->self,sub) + 1;
|
||||
Strcpy(hook->command,name);
|
||||
|
||||
free(name);
|
||||
free(sub);
|
||||
hook->type.command = Strcpy(hook->self,sub) + 1;
|
||||
Strcpy(hook->type.command,name);
|
||||
|
||||
/*
|
||||
* return successful status to script
|
||||
@ -126,7 +126,7 @@ void init_perl(void)
|
||||
/*
|
||||
* make parse_hook() callable from scripts
|
||||
*/
|
||||
newXS("mech::parse_hook", XS_perl_parse_hook, "mech");
|
||||
newXS("mech::hook", XS_perl_parse_hook, "mech");
|
||||
}
|
||||
|
||||
void do_perl(COMMAND_ARGS)
|
||||
@ -134,6 +134,8 @@ void do_perl(COMMAND_ARGS)
|
||||
/*
|
||||
* call init_perl() if the perl interpreter isnt initialized yet
|
||||
*/
|
||||
if (energymech_perl == NULL)
|
||||
init_perl();
|
||||
|
||||
/*
|
||||
* call the perl interpreter with the content of *rest
|
||||
@ -152,6 +154,8 @@ void do_perlscript(COMMAND_ARGS)
|
||||
/*
|
||||
* call init_perl() if the perl interpreter isnt initialized yet
|
||||
*/
|
||||
if (energymech_perl == NULL)
|
||||
init_perl();
|
||||
|
||||
/*
|
||||
* chop(&rest) for name of script filename and load it into the perl interpreter
|
||||
@ -160,10 +164,10 @@ void do_perlscript(COMMAND_ARGS)
|
||||
args[1] = chop(&rest);
|
||||
|
||||
/* FIXME: Trap parse errors */
|
||||
perl_parse(energymech_perl, NULL, 1, argv, (char **)NULL);
|
||||
perl_parse(energymech_perl, NULL, 1, args, (char **)NULL);
|
||||
|
||||
/* Call sub named Init, what should contain
|
||||
* mech::perl_parse_hook("PRIVMSG", "yoink_privmsg");
|
||||
* mech::hook("PRIVMSG", "yoink_privmsg");
|
||||
* Note to self: Wouldn't it be better to pass subs by
|
||||
* Reference(perl ver of pointer) instead of name?
|
||||
* How the fsck do i do that?!
|
||||
@ -173,7 +177,7 @@ void do_perlscript(COMMAND_ARGS)
|
||||
{
|
||||
STRLEN n_a;
|
||||
to_user(from, "perl script %s failed to init: %s",
|
||||
argv[1], SvPV(ERRSV, n_a));
|
||||
args[1], SvPV(ERRSV, n_a));
|
||||
}
|
||||
/*
|
||||
* be verbose about success or fail to the user
|
||||
|
||||
18
src/trivia.c
18
src/trivia.c
@ -325,7 +325,7 @@ void trivia_no_answer(void)
|
||||
|
||||
char *random_question(char *triv_rand)
|
||||
{
|
||||
char *p;
|
||||
char *p,tmpname[120];
|
||||
off_t sz;
|
||||
int fd,ifd;
|
||||
int n;
|
||||
@ -336,10 +336,22 @@ char *random_question(char *triv_rand)
|
||||
|
||||
} entry;
|
||||
|
||||
if ((fd = open(triv_qfile,O_RDONLY)) < 0)
|
||||
if (STRCHR(triv_qfile,'/') || strlen(triv_qfile) > 100) // really bad filenames...
|
||||
return(NULL);
|
||||
|
||||
Strcpy(triv_rand,triv_qfile);
|
||||
Strcat(Strcpy(tmpname,"trivia/"),triv_qfile);
|
||||
|
||||
if ((fd = open(tmpname,O_RDONLY)) < 0)
|
||||
#ifdef DEBUG
|
||||
{
|
||||
debug("(random_question) %s: %s\n",tmpname,strerror(errno));
|
||||
return(NULL);
|
||||
}
|
||||
#else
|
||||
return(NULL);
|
||||
#endif /* DEBUG */
|
||||
|
||||
Strcpy(triv_rand,tmpname);
|
||||
if ((p = STRCHR(triv_rand,'.')) == NULL)
|
||||
p = STREND(triv_rand);
|
||||
Strcpy(p,".index");
|
||||
|
||||
7
trivia/README
Normal file
7
trivia/README
Normal file
@ -0,0 +1,7 @@
|
||||
Trivia game files
|
||||
|
||||
trivia question file needs to be 1 line per question, each line in the form ``question*answer''
|
||||
|
||||
compile mkindex and run ``./mkindex <triviafile>'' to build the necessary index
|
||||
|
||||
put ``set qfile <triviafile>'' in your mechs config file, the mech will try to open ``trivia/<triviafile>'' when you start trivia
|
||||
Loading…
x
Reference in New Issue
Block a user