diff --git a/GNUmakefile.debian b/GNUmakefile.debian new file mode 100644 index 0000000..f2f0bf1 --- /dev/null +++ b/GNUmakefile.debian @@ -0,0 +1,137 @@ +ifdef PREFIX + prefix := $(PREFIX) +else + prefix := /opt/magicka +endif + +exec_prefix := $(prefix) +datarootdir = $(prefix)/share +datadir = $(datarootdir) +bindir = $(exec_prefix)/bin +localstatedir = $(prefix)/var +sysconfdir = $(prefix)/etc + +user := magicka + +all: magicka + +.PHONY: magicka www clean cleanwww install + +magicka: + cd src && $(MAKE) -f GNUmakefile.debian + +www: + cd src && $(MAKE) -f GNUmakefile.debian www + +clean: + cd src && $(MAKE) -f GNUmakefile.debian clean + +cleanwww: + cd src && $(MAKE) -f GNUmakefile.debian clean + +install: + install -m755 -d ${DESTDIR}${bindir} + install -m755 -d ${DESTDIR}${datarootdir}/doc/magicka + install -m755 -d ${DESTDIR}${localstatedir}/magicka + install -m755 -d ${DESTDIR}${sysconfdir}/magicka + install -m755 -d ${DESTDIR}${datarootdir}/magicka + install -m755 -d ${DESTDIR}${localstatedir}/magicka/logs + install -m755 -d ${DESTDIR}${localstatedir}/magicka/msgs + install -m755 -d ${DESTDIR}${localstatedir}/magicka/files/misc + install -m755 -d ${DESTDIR}${datarootdir}/magicka/scripts/data + install -m755 -d ${DESTDIR}${datarootdir}/magicka/ansis + install -m755 -d ${DESTDIR}${datarootdir}/magicka/www/static/fonts + install -m755 -d ${DESTDIR}${datarootdir}/magicka/menus + + install -m755 magicka ${DESTDIR}${exec_prefix}/magicka + install -m755 utils/dosbox_shim/shim ${DESTDIR}${bindir}/magi_shim + install -m755 utils/filecenter/filecenter ${DESTDIR}${bindir}/magi_filecenter + install -m755 utils/magichat/magichat ${DESTDIR}${bindir}/magichat + install -m755 utils/magiedit/magiedit ${DESTDIR}${bindir}/magiedit + install -m755 utils/magiftpd/magiftpd ${DESTDIR}${bindir}/magiftpd + install -m755 utils/magimail/bin/magiexport ${DESTDIR}${bindir}/magiexport + install -m755 utils/magimail/bin/magigetnode ${DESTDIR}${bindir}/magigetnode + install -m755 utils/magimail/bin/magilist ${DESTDIR}${bindir}/magilist + install -m755 utils/magimail/bin/magilistout ${DESTDIR}${bindir}/magilistout + install -m755 utils/magimail/bin/magimail ${DESTDIR}${bindir}/magimail + install -m755 utils/magimail/bin/magimaint ${DESTDIR}${bindir}/magimaint + install -m755 utils/magimail/bin/magistats ${DESTDIR}${bindir}/magistats + install -m755 utils/magimail/bin/magiwrite ${DESTDIR}${bindir}/magiwrite + install -m755 utils/massupload/massupload.pl ${DESTDIR}${bindir}/magi_massupload.pl + install -m755 utils/mgpost/mgpost ${DESTDIR}${bindir}/mgpost + install -m755 utils/nodelistp/nodelistp.pl ${DESTDIR}${bindir}/magi_nodelistp.pl + install -m755 utils/reset_pass/reset_pass ${DESTDIR}${bindir}/magi_reset_pass + install -m755 utils/ticproc/ticproc ${DESTDIR}${bindir}/magi_ticproc + + install -m644 dist/config/bbs.ini ${DESTDIR}${sysconfdir}/magicka/bbs.ini + sed -i "s@__CONFIGPREFIX__@${sysconfdir}/magicka@g" ${DESTDIR}${sysconfdir}/magicka/bbs.ini + sed -i "s@__LOCALSTATEPREFIX__@${localstatedir}/magicka@g" ${DESTDIR}${sysconfdir}/magicka/bbs.ini + sed -i "s@__SHAREPREFIX__@${datarootdir}/magicka@g" ${DESTDIR}${sysconfdir}/magicka/bbs.ini + sed -i "s@__EXECPREFIX__@${bindir}@g" ${DESTDIR}${sysconfdir}/magicka/bbs.ini + + install -m644 dist/config/archivers.ini ${DESTDIR}${sysconfdir}/magicka/archivers.ini + install -m644 dist/config/doors.ini ${DESTDIR}${sysconfdir}/magicka/doors.ini + install -m644 dist/config/protocols.ini ${DESTDIR}${sysconfdir}/magicka/protocols.ini + install -m644 dist/config/s10.ini ${DESTDIR}${sysconfdir}/magicka/s10.ini + + install -m644 dist/config/filesgen.ini ${DESTDIR}${sysconfdir}/magicka/filesgen.ini + sed -i "s@__LOCALSTATEPREFIX__@$${localstatedir}/magicka@g" config/filesgen.ini + + + install -m644 dist/config/happynet.ini ${DESTDIR}${sysconfdir}/magicka/happynet.ini + sed -i "s@__LOCALSTATEPREFIX__@${localstatedir}/magicka@g" ${DESTDIR}${sysconfdir}/magicka/happynet.ini + + install -m644 dist/config/localmail.ini ${DESTDIR}${sysconfdir}/magicka/localmail.ini + sed -i "s@__LOCALSTATEPREFIX__@${localstatedir}/magicka@g" ${DESTDIR}${sysconfdir}/magicka/localmail.ini + + install -m755 utils/magiedit/magiedit.sh ${DESTDIR}${bindir}/magiedit.sh + sed -i "s@__LOCALSTATEPREFIX__@${localstatedir}/magicka@g" ${DESTDIR}${bindir}/magiedit.sh + sed -i "s@__EXECPREFIX__@${bindir}@g" ${DESTDIR}${bindir}/magiedit.sh + + install -m644 dist/scripts/doors.lua ${DESTDIR}${datarootdir}/magicka/scripts/doors.lua + install -m644 dist/scripts/filemenu.lua ${DESTDIR}${datarootdir}/magicka/scripts/filemenu.lua + install -m644 dist/scripts/login_stanza.lua ${DESTDIR}${datarootdir}/magicka/scripts/login_stanza.lua + + sed -i "s@__SHAREPREFIX__@${datarootdir}/magicka@g" ${DESTDIR}${datarootdir}/magicka/scripts/login_stanza.lua + + install -m644 dist/scripts/logoff.lua ${DESTDIR}${datarootdir}/magicka/scripts/logoff.lua + install -m644 dist/scripts/logout_stanza.lua ${DESTDIR}${datarootdir}/magicka/scripts/logout_stanza.lua + install -m644 dist/scripts/mailmenu.lua ${DESTDIR}${datarootdir}/magicka/scripts/mailmenu.lua + install -m644 dist/scripts/mainmenu.lua ${DESTDIR}${datarootdir}/magicka/scripts/mainmenu.lua + install -m644 dist/scripts/data/taglines.txt ${DESTDIR}${datarootdir}/magicka/scripts/data/taglines.txt + + install -m644 dist/ansis/bulletin0.ans ${DESTDIR}${datarootdir}/magicka/ansis/bulletin0.ans + install -m644 dist/ansis/bulletin1.ans ${DESTDIR}${datarootdir}/magicka/ansis/bulletin1.ans + install -m644 dist/ansis/doors.ans ${DESTDIR}${datarootdir}/magicka/ansis/doors.ans + install -m644 dist/ansis/filemenu.ans ${DESTDIR}${datarootdir}/magicka/ansis/filemenu.ans + install -m644 dist/ansis/goodbye.ans ${DESTDIR}${datarootdir}/magicka/ansis/goodbye.ans + install -m644 dist/ansis/issue.ans ${DESTDIR}${datarootdir}/magicka/ansis/issue.ans + install -m644 dist/ansis/logoff.ans ${DESTDIR}${datarootdir}/magicka/ansis/logoff.ans + install -m644 dist/ansis/mailmenu.ans ${DESTDIR}${datarootdir}/magicka/ansis/mailmenu.ans + install -m644 dist/ansis/mainmenu.ans ${DESTDIR}${datarootdir}/magicka/ansis/mainmenu.ans + install -m644 dist/ansis/newuser.ans ${DESTDIR}${datarootdir}/magicka/ansis/newuser.ans + install -m644 utils/magiedit/magiedit.ans ${DESTDIR}${datarootdir}/magicka/ansis/magiedit.ans + install -m644 utils/magiedit/magiquote.ans ${DESTDIR}${datarootdir}/magicka/ansis/magiquote.ans + + install -m644 dist/www-bootstrap/401.tpl ${DESTDIR}${datarootdir}/magicka/www/401.tpl + install -m644 dist/www-bootstrap/403.tpl ${DESTDIR}${datarootdir}/magicka/www/403.tpl + install -m644 dist/www-bootstrap/404.tpl ${DESTDIR}${datarootdir}/magicka/www/404.tpl + install -m644 dist/www-bootstrap/footer.tpl ${DESTDIR}${datarootdir}/magicka/www/footer.tpl + install -m644 dist/www-bootstrap/header.tpl ${DESTDIR}${datarootdir}/magicka/www/header.tpl + install -m644 dist/www-bootstrap/index.tpl ${DESTDIR}${datarootdir}/magicka/www/index.tpl + install -m644 dist/www-bootstrap/mime.types ${DESTDIR}${datarootdir}/magicka/www/mime.types + + install -m644 dist/www-bootstrap/static/delete.png ${DESTDIR}${datarootdir}/magicka/www/static/delete.png + install -m644 dist/www-bootstrap/static/flag.png ${DESTDIR}${datarootdir}/magicka/www/static/flag.png + install -m644 dist/www-bootstrap/static/header-m.png ${DESTDIR}${datarootdir}/magicka/www/static/header-m.png + install -m644 dist/www-bootstrap/static/header.png ${DESTDIR}${datarootdir}/magicka/www/static/header.png + install -m644 dist/www-bootstrap/static/newuser.png ${DESTDIR}${datarootdir}/magicka/www/static/newuser.png + install -m644 dist/www-bootstrap/static/style.css ${DESTDIR}${datarootdir}/magicka/www/static/style.css + install -m644 dist/www-bootstrap/static/style-mobile.css ${DESTDIR}${datarootdir}/magicka/www/static/style-mobile.css + + install -m644 dist/www-bootstrap/static/fonts/LICENSE.TXT ${DESTDIR}${datarootdir}/magicka/www/static/fonts/LICENSE.TXT + install -m644 dist/www-bootstrap/static/fonts/pxplus_ibm_vga8-webfont.svg ${DESTDIR}${datarootdir}/magicka/www/static/fonts/pxplus_ibm_vga8-webfont.svg + install -m644 dist/www-bootstrap/static/fonts/pxplus_ibm_vga8-webfont.woff ${DESTDIR}${datarootdir}/magicka/www/static/fonts/pxplus_ibm_vga8-webfont.woff + install -m644 dist/www-bootstrap/static/fonts/pxplus_ibm_vga8-webfont.woff2 ${DESTDIR}${datarootdir}/magicka/www/static/fonts/pxplus_ibm_vga8-webfont.woff2 + + diff --git a/dist/config/bbs.ini b/dist/config/bbs.ini index 4b91ba9..febf54b 100644 --- a/dist/config/bbs.ini +++ b/dist/config/bbs.ini @@ -9,7 +9,7 @@ MagiChat Server = localhost MagiChat Port = 6667 MagiChat BBSTag = Magicka Default Tagline = Brought to you by Another Magicka BBS! -External Editor cmd = /home/andrew/MagickaBBS/utils/magiedit/magiedit.sh +External Editor cmd = __EXECPREFIX__/magiedit.sh External Editor stdio = true External Editor Codepage = CP437 Automessage Write Level = 10 @@ -20,8 +20,8 @@ WWW Port = 8080 WWW URL = http://127.0.0.1:8080/ Enable SSH = false SSH Port = 2024 -SSH DSA Key = /home/andrew/MagickaBBS/keys/ssh_host_dsa_key -SSH RSA Key = /home/andrew/MagickaBBS/keys/ssh_host_rsa_key +SSH DSA Key = __CONFIGPREFIX__/keys/ssh_host_dsa_key +SSH RSA Key = __CONFIGPREFIX__/keys/ssh_host_rsa_key Main AKA = 1:2/3.4 QWK Name = MAGICKA QWK Max Messages = 5000 @@ -39,25 +39,25 @@ Date Style = EU Enable IPv6 = true [paths] -Config Path = /home/andrew/MagickaBBS/config -WWW Path = /home/andrew/MagickaBBS/www -String File = /home/andrew/MagickaBBS/magicka.strings -PID File = /home/andrew/MagickaBBS/magicka.pid -ANSI Path = /home/andrew/MagickaBBS/ansis -BBS Path = /home/andrew/MagickaBBS -Log Path = /home/andrew/MagickaBBS/logs -Script Path = /home/andrew/MagickaBBS/scripts -Echomail Semaphore = /home/andrew/MagickaBBS/echomail.out -Netmail Semaphore = /home/andrew/MagickaBBS/netmail.out -Menu Path = /home/andrew/MagickaBBS/menus +Config Path = __CONFIGPREFIX__ +WWW Path = __SHAREPREFIX__/www +String File = __SHAREPREFIX__/magicka.strings +PID File = __LOCALSTATEPREFIX__/magicka.pid +ANSI Path = __SHAREPREFIX__/ansis +BBS Path = __LOCALSTATEPREFIX__ +Log Path = __LOCALSTATEPREFIX__/logs +Script Path = __SHAREPREFIX__/scripts +Echomail Semaphore = __LOCALSTATEPREFIX__/mail.out +Netmail Semaphore = __LOCALSTATEPREFIX__/mail.out +Menu Path = __SHAREPREFIX__/menus [mail conferences] -Local Mail = config/localmail.ini -HappyNet = config/happynet.ini +Local Mail = __CONFIGPREFIX__/localmail.ini +HappyNet = __CONFIGPREFIX__/happynet.ini [file directories] -General Files = config/filesgen.ini +General Files = __CONFIGPREFIX__/filesgen.ini [text files] -Magicka Advertisement = ansis/bulletin0.ans -Whats New = ansis/bulletin1.ans +Magicka Advertisement = __SHAREPREFIX__/ansis/bulletin0.ans +Whats New = __SHAREPREFIX__/ansis/bulletin1.ans diff --git a/dist/config/filesgen.ini b/dist/config/filesgen.ini index ec292da..93fb2bb 100644 --- a/dist/config/filesgen.ini +++ b/dist/config/filesgen.ini @@ -6,4 +6,4 @@ Visible on Web = false Database = files_misc Download Sec Level = 10 Upload Sec Level = 10 -Upload Path = /home/andrew/MagickaBBS/files/misc +Upload Path = __LOCALSTATEPREFIX__/files/misc diff --git a/dist/config/happynet.ini b/dist/config/happynet.ini index b93404d..97be383 100644 --- a/dist/config/happynet.ini +++ b/dist/config/happynet.ini @@ -15,7 +15,7 @@ domain = happynet [General] Read Sec Level = 10 Write Sec Level = 10 -Path = /home/andrew/MagickaBBS/msgs/hnet_general +Path = __LOCALSTATEPREFIX__/msgs/hnet_general ; local / echo or netmail Type = Echo QWK Name = HN_GEN @@ -23,7 +23,7 @@ QWK Name = HN_GEN [Netmail] Read Sec Level = 10 Write Sec Level = 10 -Path = /home/andrew/MagickaBBS/msgs/hnet_netmail +Path = __LOCALSTATEPREFIX__/msgs/hnet_netmail ; local / echo or netmail Type = Netmail QWK Name = HN_NET diff --git a/dist/config/localmail.ini b/dist/config/localmail.ini index 73ce9d6..32cd7db 100644 --- a/dist/config/localmail.ini +++ b/dist/config/localmail.ini @@ -6,13 +6,13 @@ Real Names = false [General] Read Sec Level = 10 Write Sec Level = 10 -Path = /home/andrew/MagickaBBS/msgs/general +Path = __LOCALSTATEPREFIX__/msgs/general Type = Local QWK Name = GENERAL [Testing] Read Sec Level = 10 Write Sec Level = 10 -Path = /home/andrew/MagickaBBS/msgs/testing +Path = __LOCALSTATEPREFIX__/msgs/testing Type = Local QWK Name = TEST diff --git a/dist/scripts/login_stanza.lua b/dist/scripts/login_stanza.lua index 153cff8..2b0abdc 100644 --- a/dist/scripts/login_stanza.lua +++ b/dist/scripts/login_stanza.lua @@ -1,4 +1,4 @@ -local bulletin_path = "/home/andrew/MagickaBBS/ansis"; +local bulletin_path = "__SHAREPREFIX__/ansis"; function file_exists(name) diff --git a/setup.sh b/setup.sh index 69e3d5b..a3580fb 100755 --- a/setup.sh +++ b/setup.sh @@ -70,16 +70,20 @@ else fi -$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" config/bbs.ini +$SED -i "s@__CONFIGPREFIX__/keys@${PWD}/keys@g" config/bbs.ini +$SED -i "s@__CONFIGPREFIX__@${PWD}@g" config/bbs.ini +$SED -i "s@__LOCALSTATEPREFIX__@${PWD}@g" config/bbs.ini +$SED -i "s@__SHAREPREFIX__@${PWD}@g" config/bbs.ini +$SED -i "s@__EXECPREFIX__@${PWD}/utils/magiedit/@g" config/bbs.ini $SED -i "s/BBS Name = Magicka BBS/BBS Name = ${bbsname}/g" config/bbs.ini $SED -i "s/Sysop Name = sysop/Sysop Name = ${handle}/g" config/bbs.ini $SED -i "s/USERNAME/${USERNAME}/g" config/bbs.ini -$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" config/localmail.ini -$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" config/filesgen.ini -$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" config/happynet.ini -$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" utils/magiedit/magiedit.sh -$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" scripts/login_stanza.lua +$SED -i "s@__LOCALSTATEPREFIX__@${PWD}@g" config/localmail.ini +$SED -i "s@__LOCALSTATEPREFIX__@${PWD}@g" config/filesgen.ini +$SED -i "s@__LOCALSTATEPREFIX__@${PWD}@g" config/happynet.ini +$SED -i "s@__BINPREFIX__@${PWD}@g" utils/magiedit/magiedit.sh +$SED -i "s@__LOCALSTATEPREFIX__@${PWD}@g" utils/magiedit/magiedit.sh +$SED -i "s@__EXECPREFIX__@.@g" utils/magiedit/magiedit.sh +$SED -i "s@__SHAREPREFIX__@${PWD}@g" scripts/login_stanza.lua $SED -i "s/MagiChat Server = localhost/; MagiChat Server = localhost/g" config/bbs.ini $SED -i "s/Default Tagline = Brought to you by Another Magicka BBS!/Default Tagline = ${bbsname}/g" config/bbs.ini -$SED -i "s/echomail.out/mail.out/g" config/bbs.ini -$SED -i "s/netmail.out/mail.out/g" config/bbs.ini diff --git a/src/GNUmakefile.common b/src/GNUmakefile.common index c38f6e6..c77d539 100644 --- a/src/GNUmakefile.common +++ b/src/GNUmakefile.common @@ -74,7 +74,7 @@ magicka: ${OBJS} ${LUA} ${ZMODEM} ${JAMLIB} ${JSMN} ${UUID} magiedit: ${ODOORS} - cd ${UTILSDIR}/magiedit && ${MAKE} + cd ${UTILSDIR}/magiedit && ${MAKE} ANSI_PATH=${MAGIEDIT_ANSI_PATH} DRAFT_PATH=${MAGIEDIT_DRAFT_PATH} magimail: ${JAMLIB} cd ${UTILSDIR}/magimail && ${MAKE} all diff --git a/src/GNUmakefile.debian b/src/GNUmakefile.debian new file mode 100644 index 0000000..2ce730b --- /dev/null +++ b/src/GNUmakefile.debian @@ -0,0 +1,14 @@ +CC:= cc +CFLAGS:= -std=gnu99 -I/usr/local/include -ggdb +LIBS:= -L/usr/local/lib -lsqlite3 -lutil -lm -ldl -lssl -lcrypto -lssh -lmosquitto +EXTRAOBJS:= strlcpy/strlcpy.o strlcpy/strlcat.o + +LIBTOOLIZE:= libtoolize + +DEPS_LUA_TARGET:= linux +DEPS_JAMLIB_MAKEFILE:= Makefile.linux + +MAGIEDIT_ANSI_PATH:= "$(datarootdir)/magicka/ansis" +MAGIEDIT_DRAFT_PATH:= "$(localstatedir)/magicka" + +include GNUmakefile.common diff --git a/src/GNUmakefile.dragonfly b/src/GNUmakefile.dragonfly index 1312a93..5712519 100644 --- a/src/GNUmakefile.dragonfly +++ b/src/GNUmakefile.dragonfly @@ -9,4 +9,7 @@ DEPS_CDK_OPTS:= --with-curses-dir=/usr/local DEPS_LUA_TARGET:= dragonfly DEPS_JAMLIB_MAKEFILE:= Makefile.linux +MAGIEDIT_ANSI_PATH:= "" +MAGIEDIT_DRAFT_PATH:= "" + include GNUmakefile.common diff --git a/src/GNUmakefile.freebsd b/src/GNUmakefile.freebsd index 98022de..edf6491 100644 --- a/src/GNUmakefile.freebsd +++ b/src/GNUmakefile.freebsd @@ -7,4 +7,7 @@ LIBTOOLIZE:= libtoolize DEPS_LUA_TARGET:= freebsd DEPS_JAMLIB_MAKEFILE:= Makefile.linux +MAGIEDIT_ANSI_PATH:= "" +MAGIEDIT_DRAFT_PATH:= "" + include GNUmakefile.common diff --git a/src/GNUmakefile.haiku b/src/GNUmakefile.haiku index 3e05fe5..4297846 100644 --- a/src/GNUmakefile.haiku +++ b/src/GNUmakefile.haiku @@ -8,4 +8,7 @@ LIBTOOLIZE:= libtoolize DEPS_LUA_TARGET:= haiku DEPS_JAMLIB_MAKEFILE:= Makefile.linux +MAGIEDIT_ANSI_PATH:= "" +MAGIEDIT_DRAFT_PATH:= "" + include GNUmakefile.common diff --git a/src/GNUmakefile.linux b/src/GNUmakefile.linux index bb16c7e..c569ac1 100644 --- a/src/GNUmakefile.linux +++ b/src/GNUmakefile.linux @@ -8,4 +8,7 @@ LIBTOOLIZE:= libtoolize DEPS_LUA_TARGET:= linux DEPS_JAMLIB_MAKEFILE:= Makefile.linux +MAGIEDIT_ANSI_PATH:= "" +MAGIEDIT_DRAFT_PATH:= "" + include GNUmakefile.common diff --git a/src/GNUmakefile.linux-musl b/src/GNUmakefile.linux-musl index 518983f..b95335d 100644 --- a/src/GNUmakefile.linux-musl +++ b/src/GNUmakefile.linux-musl @@ -10,4 +10,7 @@ DEPS_JAMLIB_MAKEFILE:= Makefile.linux-musl FTSLIB:= FTSLIB=1 +MAGIEDIT_ANSI_PATH:= "" +MAGIEDIT_DRAFT_PATH:= "" + include GNUmakefile.common diff --git a/src/GNUmakefile.netbsd b/src/GNUmakefile.netbsd index d7d129c..289a4fc 100644 --- a/src/GNUmakefile.netbsd +++ b/src/GNUmakefile.netbsd @@ -8,4 +8,7 @@ DEPS_CDK_OPTS:= --with-curses-dir=/usr/pkg DEPS_LUA_TARGET:= bsd DEPS_JAMLIB_MAKEFILE:= Makefile.linux +MAGIEDIT_ANSI_PATH:= "" +MAGIEDIT_DRAFT_PATH:= "" + include GNUmakefile.common diff --git a/src/GNUmakefile.openbsd b/src/GNUmakefile.openbsd index e28f497..d07cbfa 100644 --- a/src/GNUmakefile.openbsd +++ b/src/GNUmakefile.openbsd @@ -7,4 +7,7 @@ LIBTOOLIZE:= libtoolize DEPS_LUA_TARGET:= bsd DEPS_JAMLIB_MAKEFILE:= Makefile.linux +MAGIEDIT_ANSI_PATH:= "" +MAGIEDIT_DRAFT_PATH:= "" + include GNUmakefile.common diff --git a/src/GNUmakefile.osx b/src/GNUmakefile.osx index 935d44e..6f66ee0 100644 --- a/src/GNUmakefile.osx +++ b/src/GNUmakefile.osx @@ -7,4 +7,7 @@ LIBTOOLIZE:= glibtoolize DEPS_LUA_TARGET:= macosx DEPS_JAMLIB_MAKEFILE:= Makefile.linux +MAGIEDIT_ANSI_PATH:= "" +MAGIEDIT_DRAFT_PATH:= "" + include GNUmakefile.common diff --git a/src/GNUmakefile.sunos b/src/GNUmakefile.sunos index fdea58c..b8b5777 100644 --- a/src/GNUmakefile.sunos +++ b/src/GNUmakefile.sunos @@ -8,4 +8,7 @@ LIBTOOLIZE:= libtoolize DEPS_LUA_TARGET:= solaris DEPS_JAMLIB_MAKEFILE:= Makefile.sunos +MAGIEDIT_ANSI_PATH:= "" +MAGIEDIT_DRAFT_PATH:= "" + include GNUmakefile.common diff --git a/utils/magiedit/magiedit.sh b/utils/magiedit/magiedit.sh index fc90487..e6b095f 100755 --- a/utils/magiedit/magiedit.sh +++ b/utils/magiedit/magiedit.sh @@ -1,3 +1,3 @@ #!/bin/sh -cd /home/andrew/MagickaBBS/utils/magiedit -./magiedit -D /home/andrew/MagickaBBS/node$1/dorinfo1.def -MSGTMP /home/andrew/MagickaBBS/node$1 +cd __LOCALSTATEPREFIX__/magiedit +__EXECPREFIX__/magiedit -D __LOCALSTATEPREFIX__/node$1/dorinfo1.def -MSGTMP __LOCALSTATEPREFIX__/node$1 diff --git a/utils/magiedit/main.c b/utils/magiedit/main.c index 4a644b5..107e05a 100644 --- a/utils/magiedit/main.c +++ b/utils/magiedit/main.c @@ -16,6 +16,14 @@ #include #include +#ifndef DRAFT_PATH +#define DRAFT_PATH "" +#endif + +#ifndef ANSI_PATH +#define ANSI_PATH "" +#endif + char **quote_lines; int quote_line_count; @@ -27,7 +35,6 @@ int msgpriv; char *draft_filename = NULL; - char *load_draft() { DIR *dirp; struct dirent *dent; @@ -40,7 +47,7 @@ char *load_draft() { int i; tODInputEvent ch; - snprintf(draft_path, PATH_MAX, "drafts/%s", od_control_get()->user_name); + snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s", od_control_get()->user_name); dirp = opendir(draft_path); @@ -183,7 +190,7 @@ char *load_draft() { return draft_filename; } else if (ch.chKeyPress == 'd') { - snprintf(draft_path, PATH_MAX, "drafts/%s/%s.draft", od_control_get()->user_name, filenames[selected]); + snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s/%s.draft", od_control_get()->user_name, filenames[selected]); unlink(draft_path); free(filenames[selected]); @@ -213,7 +220,7 @@ char *load_draft() { void delete_draft(char *filename) { char draft_path[PATH_MAX]; - snprintf(draft_path, PATH_MAX, "drafts/%s/%s.draft", od_control_get()->user_name, filename); + snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s/%s.draft", od_control_get()->user_name, filename); unlink(draft_path); } @@ -233,13 +240,13 @@ int check_draft_filename(char *filename) { mkdir("drafts", 0700); } - snprintf(draft_path, PATH_MAX, "drafts/%s", od_control_get()->user_name); + snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s", od_control_get()->user_name); if (stat(draft_path, &s) != 0) { mkdir(draft_path, 0700); } - snprintf(draft_path, PATH_MAX, "drafts/%s/%s.draft", od_control_get()->user_name, filename); + snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s/%s.draft", od_control_get()->user_name, filename); if (stat(draft_path, &s) != 0) { return 1; @@ -290,7 +297,7 @@ char *message_editor() { while (!done) { od_clr_scr(); od_set_cursor(1, 1); - od_send_file("magiedit.ans"); + od_send_file(ANSI_PATH "magiedit.ans"); od_set_color(D_GREY, D_BLACK); od_set_cursor(2, 13); od_printf("%-26.26s", msgto); @@ -467,7 +474,7 @@ char *message_editor() { // restore screen od_clr_scr(); od_set_cursor(1, 1); - od_send_file("magiedit.ans"); + od_send_file(ANSI_PATH "magiedit.ans"); od_set_color(D_GREY, D_BLACK); od_set_cursor(2, 13); od_printf("%-26.26s", msgto); @@ -535,7 +542,7 @@ char *message_editor() { // restore screen od_clr_scr(); od_set_cursor(1, 1); - od_send_file("magiedit.ans"); + od_send_file(ANSI_PATH "magiedit.ans"); od_set_color(D_GREY, D_BLACK); od_set_cursor(2, 13); od_printf("%-26.26s", msgto); @@ -846,7 +853,7 @@ char *message_editor() { // Quote od_clr_scr(); od_set_cursor(1, 1); - od_send_file("magiquote.ans"); + od_send_file(ANSI_PATH "magiquote.ans"); od_set_color(D_GREY, D_BLACK); od_set_cursor(2, 13); od_printf("%-26.26s", msgto); @@ -1015,7 +1022,7 @@ char *message_editor() { // restore screen od_clr_scr(); od_set_cursor(1, 1); - od_send_file("magiedit.ans"); + od_send_file(ANSI_PATH "magiedit.ans"); od_set_color(D_GREY, D_BLACK); od_set_cursor(2, 13); od_printf("%-26.26s", msgto);