]> bicyclesonthemoon.info Git - botm/oldlogs/commitdiff
Adapted for new config tool.
authorb <rowerynaksiezycu@gmail.com>
Sun, 24 Sep 2023 15:18:54 +0000 (15:18 +0000)
committerb <rowerynaksiezycu@gmail.com>
Sun, 24 Sep 2023 15:18:54 +0000 (15:18 +0000)
43 files changed:
.gitmodules [new file with mode: 0644]
2words.1.c [deleted file]
2words.1.pl
attach.1.c [deleted file]
attach.1.pl
bbcode.1.c [deleted file]
bbcode.1.pl
botmlogo.png [new file with mode: 0644]
bsta.1.conf [new file with mode: 0644]
bsta.1.cron [new file with mode: 0644]
bsta_lib.1.pm
chat.1.c [deleted file]
chat.1.pl
config [new submodule]
config.1.txt [deleted file]
config.txt [deleted file]
configure.pl [deleted file]
exec [new submodule]
frame.1.c [deleted file]
frame.1.pl
goto.1.c [deleted file]
goto.1.pl
info.1.c [deleted file]
info.1.pl
make.sh [deleted file]
makefile
makefile.1.mak
oldlogs.1.pl
ong.1.pl
ongtimes.pl [deleted file]
reset.1.pl
settings [deleted file]
settings-again [deleted file]
settings-again.txt [new file with mode: 0644]
settings-bsta.txt [new file with mode: 0644]
settings-debug.txt [new file with mode: 0644]
settings-tbst.txt [new file with mode: 0644]
settings-test [deleted file]
settings.txt [new file with mode: 0644]
testhtml.pl [deleted file]
updlist.1.pl
viewer.1.c [deleted file]
viewer.1.pl

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..f0c8ec2
--- /dev/null
@@ -0,0 +1,6 @@
+[submodule "config"]
+       path = config
+       url = ../../botm/config
+[submodule "exec"]
+       path = exec
+       url = ../../botm/exec
diff --git a/2words.1.c b/2words.1.c
deleted file mode 100644 (file)
index 5fd947a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// 2words.c is generated from 2words.1.c
-// 28.09.2016
-// 
-// This is the wrapper for 2words.pl.
-// It's run with SETUID to have accesss to some files where the www server
-// should not. That's why it has a C wrapper. In modern systems running scripts
-// directly with SETUID is considered unsafe and not allowed.
-//
-//    Copyright (C) 2016  Balthasar Szczepański
-//
-//    This program is free software: you can redistribute it and/or modify
-//    it under the terms of the GNU Affero General Public License as
-//    published by the Free Software Foundation, either version 3 of the
-//    License, or (at your option) any later version.
-//
-//    This program is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//    GNU Affero General Public License for more details.
-//
-//    You should have received a copy of the GNU Affero General Public License
-//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#include <unistd.h>
-#include <stdio.h>
-
-###TWOWORDS_PL;
-###TWOWORDS_PL_ERRLOG;
-
-int main(int argc, char *argv[], char *envp[])
-{
-       freopen(TWOWORDS_PL_ERRLOG,"at",stderr);
-       return execve(TWOWORDS_PL,argv,envp);
-}
index 590d88b8711232b9deef8e0b1c5add8b49abc0e5..03ef99f741887a08baa28f7a704ff9266d359cfc 100644 (file)
@@ -1,54 +1,59 @@
-###PERL;
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # /bsta/2words
 # 2words is generated from 2words.1.pl.
-# 09.01.2023
 #
 # The wordgame interface
 #
-#    Copyright (C) 2016 - 2017, 2023  Balthasar Szczepański
+# Copyright (C) 2016 - 2017, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 use bsta_lib qw(failpage gethttpheader getcgi entityencode readdatafile writedatafile urlencode bb2ht);
 use  File::Copy;
 
-###STORY_PATH;
-###LOGO_PATH;
-###FAVICON_PATH;
-###WEBSITE;
-###WEBSITE_NAME;
-###CSS_PATH;
-###TWOWORDS_PATH;
-###CGI_PATH;
-###SETTINGS_PATH;
-###INDEX_PATH;
-###INTF_DATE;
-###DATA_PATH;
-###VIEWER_PATH;
-###DEFAULT_PATH;
-###STATE_PATH;
-###WWW_PATH;
-###STORY_LENGTH;
-###PAGE_LENGTH;
-###FIRSTPAGE_LENGTH;
-###COIN_PATH;
-###COIN_DATE;
-###LIST_PATH;
+###PERL_CGI_PATH:           CGI_PATH           = /bsta/
+###PERL_CGI_2WORDS_PATH:    CGI_2WORDS_PATH    = /bsta/2words
+###PERL_CGI_CSS_PATH:       CGI_CSS_PATH       = /bsta/bsta.css
+###PERL_CGI_LOGO_PATH:      CGI_LOGO_PATH      = /bsta/botmlogo.png
+###PERL_CGI_VIEWER_PATH:    CGI_VIEWER_PATH    = /bsta/v
+
+###PERL_DATA_PATH:          DATA_PATH          = /botm/data/bsta/
+###PERL_DATA_COIN_PATH:     DATA_COIN_PATH     = /botm/data/bsta/coincidence
+###PERL_DATA_DEFAULT_PATH:  DATA_DEFAULT_PATH  = /botm/data/bsta/default
+###PERL_DATA_LIST_PATH:     DATA_LIST_PATH     = /botm/data/bsta/list
+###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
+###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
+###PERL_DATA_STORY_PATH:    DATA_STORY_PATH    = /botm/data/bsta/story
+
+###PERL_WWW_PATH:           WWW_PATH           = /botm/www/1190/bsta/
+###PERL_WWW_INDEX_PATH:     WWW_INDEX_PATH     = /botm/www/1190/bsta/index.htm
+
+###PERL_WEBSITE:            WEBSITE            = 1190.bicyclesonthemoon.info
+###PERL_WEBSITE_NAME:       WEBSITE_NAME       = Bicycles on the Moon
+###PERL_FAVICON_PATH:       FAVICON_PATH       = /img/favicon.png
+
+###PERL_COIN_DATE:          COIN_DATE          = 13-Nov-2016 22:15
+###PERL_INTF_DATE:          INTF_DATE          = 28-Sep-2016 20:34
+
+###PERL_STORY_LENGTH:       STORY_LENGTH       = 16
+###PERL_PAGE_LENGTH:        PAGE_LENGTH        = 16
+###PERL_FIRSTPAGE_LENGTH:   FIRSTPAGE_LENGTH   = 4
+
 
 my %http;
 my %cgi;
@@ -84,7 +89,7 @@ my $page;
 
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
 if ($ENV{'REQUEST_METHOD'} =~ /^(HEAD|GET|POST)$/) {
        $method=$1;
@@ -130,12 +135,12 @@ if ($cgi{'words'} ne '') {
        $words=$cgi{'words'};
 }
 
-%settings=readdatafile(SETTINGS_PATH);
-%state=readdatafile(STATE_PATH);
+%settings=readdatafile(DATA_SETTINGS_PATH);
+%state=readdatafile(DATA_STATE_PATH);
 $ongstate=int($state{'state'});
 
 $storylock=0;
-if (open ($storyfile,"+<",STORY_PATH)){
+if (open ($storyfile,"+<",DATA_STORY_PATH)){
        $storylock=1;
        if (flock($storyfile,2)) {
                $storylock=2;
@@ -176,7 +181,7 @@ if (open ($storyfile,"+<",STORY_PATH)){
                $story{'state'}='0';
                $turn=0;
                if($ongstate == 0) {
-                       writeindex(INDEX_PATH,0,0,0);
+                       writeindex(WWW_INDEX_PATH,0,0,0);
                }
                writedatafile($storyfile,%story);
        }
@@ -204,7 +209,7 @@ if (open ($storyfile,"+<",STORY_PATH)){
                                        
                                        if ($cgi{'next'} ne '') {
                                                if (split(/\r?\n/,$story{'content'}) >= (STORY_LENGTH-1)) {
-                                                       $storypath = STORY_PATH.$storyid;
+                                                       $storypath = DATA_STORY_PATH.$storyid;
                                                        writedatafile($storypath,%story);
                                                        $newstory{'id'} = $storyid + 1;
                                                        $newstory{'letter'}='';
@@ -217,7 +222,7 @@ if (open ($storyfile,"+<",STORY_PATH)){
                                                        $intfmode=0;
                                                        $intfpause=0;
                                                        if($ongstate == 0) {
-                                                               writeindex(INDEX_PATH,0,0,0);
+                                                               writeindex(WWW_INDEX_PATH,0,0,0);
                                                        }
                                                        writedatafile($storyfile,%newstory);
                                                }
@@ -231,14 +236,14 @@ if (open ($storyfile,"+<",STORY_PATH)){
                                                        $intfpass = 2;
                                                        $story{'pass'} = '2';
                                                        if($ongstate == 0) {
-                                                               writeindex(INDEX_PATH,2,0,0);
+                                                               writeindex(WWW_INDEX_PATH,2,0,0);
                                                        }
                                                }
                                                elsif(lc($2).' '.lc($4) eq $settings{'unlock'}) {
                                                        if ($intfpass == 0) {
                                                                if($ongstate == 0) {
                                                                        my %framedata = readdatafile(DATA_PATH.0);
-                                                                       my %default = readdatafile(DEFAULT_PATH);
+                                                                       my %default = readdatafile(DATA_DEFAULT_PATH);
                                                                        my $inpath;
                                                                        my $outpath;
                                                                        
@@ -246,7 +251,7 @@ if (open ($storyfile,"+<",STORY_PATH)){
                                                                        $gotolist{'title-0'} = $framedata{'title'};
                                                                        $gotolist{'ongtime-0'} = $framedata{'ongtime'};
                                                                        writedatafile(DATA_PATH.0,%framedata);
-                                                                       writedatafile(LIST_PATH,%gotolist);
+                                                                       writedatafile(DATA_LIST_PATH,%gotolist);
                                                                        
                                                                        foreach my $ind (keys %default) {
                                                                                unless(defined($framedata{$ind})){
@@ -264,7 +269,7 @@ if (open ($storyfile,"+<",STORY_PATH)){
                                                                                $intfpause=0;
                                                                                $story{'pass'} = '1';
                                                                                $story{'state'} = '0';
-                                                                               writeindex(INDEX_PATH,1,0,0);
+                                                                               writeindex(WWW_INDEX_PATH,1,0,0);
                                                                        }
                                                                }
                                                                else {
@@ -295,7 +300,7 @@ if (open ($storyfile,"+<",STORY_PATH)){
                        $intfmode -= 1;
                }
                $story{'state'} = $intfstate;
-               writeindex(INDEX_PATH,1,$intfmode,$intfpause);
+               writeindex(WWW_INDEX_PATH,1,$intfmode,$intfpause);
                writedatafile($storyfile,%story);
        }
        @storylines = split(/\r?\n/,$story{'content'});
@@ -316,9 +321,9 @@ print '<html lang="en"><head>'."\n";
 print '<title>Two words &bull; '.WEBSITE_NAME.'</title>'."\n";
 print '<meta http-equiv="Content-type" content="text/html; charset=UTF-8">'."\n";
 print '<link rel="icon" type="image/png" href="'.FAVICON_PATH.'">'."\n";
-print '<link rel="stylesheet" href="'.CSS_PATH.'">'."\n";
+print '<link rel="stylesheet" href="'.CGI_CSS_PATH.'">'."\n";
 print '</head><body>'."\n";
-print '<a href="/"><img id="botmlogo" src="'.LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
+print '<a href="/"><img id="botmlogo" src="'.CGI_LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
 print '<div id="all">'."\n";
 
 print '<div id="inst" class="ins">'."\n";
@@ -341,7 +346,7 @@ if ($page == 0) {
        }
        
        if ($turn) {
-               print '<form method="post" action="'.TWOWORDS_PATH.'">'."\n";
+               print '<form method="post" action="'.CGI_2WORDS_PATH.'">'."\n";
                if ($message eq '') {
                        if ($story{"content"} eq '') {
                                print 'Two words, please:<br>'."\n";
@@ -399,22 +404,22 @@ if(($intfpass == 1) && ($ongstate == 0)) {
 print '</div><div id="insb" class="ins">'."\n";
 print '<div id="undertext">'."\n";
 for (my $i = $storyid-1-(($page!=0)?((($page-1)*PAGE_LENGTH)+FIRSTPAGE_LENGTH):0); $i > ($storyid-1-($page*PAGE_LENGTH)- FIRSTPAGE_LENGTH) && $i >= 0; --$i) {
-       $storypath = STORY_PATH.$i;
+       $storypath = DATA_STORY_PATH.$i;
        %newstory = readdatafile($storypath);
        print '<p class="'.(($i&1)?'br':'ni').'" id="s'.$i.'">'.entityencode($newstory{'content'}).'</p>'."\n";
 }
 
 print '</div>'."\n";
 print '<div id="underlinks">'."\n";
-print '<a href="'.CGI_PATH.'">BSTA</a> | <a href="'.TWOWORDS_PATH.'">Once again</a>';
+print '<a href="'.CGI_PATH.'">BSTA</a> | <a href="'.CGI_2WORDS_PATH.'">Once again</a>';
 if(($storyid - ($page*PAGE_LENGTH)) - FIRSTPAGE_LENGTH > 0) {
-       print ' | <a href="'.TWOWORDS_PATH.'/'.($page+1).'">Before</a>';
+       print ' | <a href="'.CGI_2WORDS_PATH.'/'.($page+1).'">Before</a>';
 }
 if($page > 0) {
-       print ' | <a href="'.TWOWORDS_PATH.'/'.($page-1).'">Unbefore</a>';
+       print ' | <a href="'.CGI_2WORDS_PATH.'/'.($page-1).'">Unbefore</a>';
 }
 if(($storyid - ($page*PAGE_LENGTH)) - FIRSTPAGE_LENGTH > 0) {
-       print ' | <a href="'.TWOWORDS_PATH.'/'.(int(($storyid - FIRSTPAGE_LENGTH - 1) / PAGE_LENGTH) + 1).'">Initially</a>';
+       print ' | <a href="'.CGI_2WORDS_PATH.'/'.(int(($storyid - FIRSTPAGE_LENGTH - 1) / PAGE_LENGTH) + 1).'">Initially</a>';
 }
 if($turn) {
        print ' | (Entering words here is irreversible. Your actions might be remembered forever. So please be reasonable.)';
@@ -447,7 +452,7 @@ sub writeindex {
        $indexof = CGI_PATH;
        $indexof =~ s/\/$//g;
        
-       my %coin = readdatafile(COIN_PATH);
+       my %coin = readdatafile(DATA_COIN_PATH);
        
        if ($pass != 1) {
                print $indexfile '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">'."\n";
@@ -473,7 +478,7 @@ sub writeindex {
                
                %framedata = readdatafile(DATA_PATH.0);
                %nextframedata = readdatafile(DATA_PATH.1);
-               %default=readdatafile(DEFAULT_PATH);
+               %default=readdatafile(DATA_DEFAULT_PATH);
                
                # if($mode == 16 && $pause) {
                        # $framedata{'ongtime'} = $time;
@@ -508,9 +513,9 @@ sub writeindex {
                print $indexfile '</title>'."\n";
                print $indexfile '<meta http-equiv="Content-type" content="text/html; charset=UTF-8">'."\n";
                print $indexfile '<link rel="icon" type="image/png" href="'.FAVICON_PATH.'">'."\n";
-               print $indexfile '<link rel="stylesheet" href="'.CSS_PATH.'">'."\n";
+               print $indexfile '<link rel="stylesheet" href="'.CGI_CSS_PATH.'">'."\n";
                print $indexfile '</head><body>'."\n";
-               print $indexfile '<a href="/"><img id="botmlogo" src="'.LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
+               print $indexfile '<a href="/"><img id="botmlogo" src="'.CGI_LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
                print $indexfile '<div id="all">'."\n";
                
                print $indexfile '<div id="inst" class="ins">'."\n";
@@ -580,7 +585,7 @@ sub writeindex {
                elsif ($mode == 16) {
                        if($pause) {
                                print $indexfile '[<span class="br">00</span>:<span class="br">00</span>:<span class="br">00</span>]<br>'."\n";
-                               print $indexfile '&gt;<a href="'.VIEWER_PATH.'/1">'.entityencode($nextframedata{'title'}).'</a>'."\n";
+                               print $indexfile '&gt;<a href="'.CGI_VIEWER_PATH.'/1">'.entityencode($nextframedata{'title'}).'</a>'."\n";
                        }
                        else {
                                print $indexfile '[<span class="ni">--</span>:<span class="ni">--</span>:<span class="ni">--</span>]<br>'."\n";
diff --git a/attach.1.c b/attach.1.c
deleted file mode 100644 (file)
index af32854..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// attach.c is generated from attach.1.c
-// 19.10.2016
-// 
-// This is the wrapper for frame.pl.
-// It's run with SETUID to have accesss to some files where the www server
-// should not. That's why it has a C wrapper. In modern systems running scripts
-// directly with SETUID is considered unsafe and not allowed.
-//
-//    Copyright (C) 2016  Balthasar Szczepański
-//
-//    This program is free software: you can redistribute it and/or modify
-//    it under the terms of the GNU Affero General Public License as
-//    published by the Free Software Foundation, either version 3 of the
-//    License, or (at your option) any later version.
-//
-//    This program is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//    GNU Affero General Public License for more details.
-//
-//    You should have received a copy of the GNU Affero General Public License
-//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#include <unistd.h>
-#include <stdio.h>
-
-###ATTACH_PL;
-###ATTACH_PL_ERRLOG;
-
-int main(int argc, char *argv[], char *envp[])
-{
-       freopen(ATTACH_PL_ERRLOG,"at",stderr);
-       return execve(ATTACH_PL,argv,envp);
-}
index da38af8ff770610d61df696c6c44f5df4208f22e..91fed4cc41a8a36b2c75d8f71c78307661030387 100644 (file)
@@ -1,35 +1,34 @@
-###PERL;
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # /bsta/a
 # attach.pl is generated from attach.1.pl.
-# 19.10.2016
 #
 # The attachment interface
 #
-#    Copyright (C) 2016  Balthasar Szczepañski
+# Copyright (C) 2016, 2023  Balthasar Szczepañski
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 
 use bsta_lib qw(failpage gethttpheader getcgi readdatafile);
 
-###SETTINGS_PATH;
-###DATA_PATH;
-###STATE_PATH;
+###PERL_DATA_PATH:          DATA_PATH          = /botm/data/bsta
+###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
+###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
 
 my %http;
 my %cgi;
@@ -53,7 +52,7 @@ my $filepath;
 my $direct;
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
 if ($ENV{'REQUEST_METHOD'} =~ /^(HEAD|GET|POST)$/) {
        $method=$1;
@@ -97,8 +96,8 @@ else {
        $password='';
 }
 
-%settings=readdatafile(SETTINGS_PATH);
-%state=readdatafile(STATE_PATH);
+%settings=readdatafile(DATA_SETTINGS_PATH);
+%state=readdatafile(DATA_STATE_PATH);
 %filedata=readdatafile(DATA_PATH.'a'.$ID);
 if ($filedata{'frame'} ne '') {
        $frame=int($filedata{'frame'});
diff --git a/bbcode.1.c b/bbcode.1.c
deleted file mode 100644 (file)
index deee30b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// bbcode.c is generated from bbcode.1.c
-// 05.06.2017
-// 
-// This is the wrapper for bbcode.pl.
-// It's run with SETUID to have accesss to some files where the www server
-// should not. That's why it has a C wrapper. In modern systems running scripts
-// directly with SETUID is considered unsafe and not allowed.
-//
-//    Copyright (C) 2017  Balthasar Szczepański
-//
-//    This program is free software: you can redistribute it and/or modify
-//    it under the terms of the GNU Affero General Public License as
-//    published by the Free Software Foundation, either version 3 of the
-//    License, or (at your option) any later version.
-//
-//    This program is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//    GNU Affero General Public License for more details.
-//
-//    You should have received a copy of the GNU Affero General Public License
-//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#include <unistd.h>
-#include <stdio.h>
-
-###BBCODE_PL;
-###BBCODE_PL_ERRLOG;
-
-int main(int argc, char *argv[], char *envp[])
-{
-       freopen(BBCODE_PL_ERRLOG,"at",stderr);
-       return execve(BBCODE_PL,argv,envp);
-}
index 34503b8a0863e76271a394f919464499e14f523d..c8112b9f6699de48819af46923377f5fe070d01a 100644 (file)
@@ -1,42 +1,43 @@
-###PERL;
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # /bsta/b
 # bbcode.pl is generated from bbcode.1.pl.
-# 05.06.2017
 #
 # The bbcode interface
 #
-#    Copyright (C) 2017  Balthasar Szczepański
+# Copyright (C) 2017, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 use bsta_lib qw(failpage gethttpheader getcgi readdatafile bb2bb linehtml);
 use File::Copy;
 
-###DATA_PATH;
-###DEFAULT_PATH;
-###SETTINGS_PATH;
-###STATE_PATH;
-###NOACCESS_PATH;
-###WEBSITE;
-###VIEWER_PATH;
-###ATTACH_PATH;
-###FRAME_PATH;
-###CGI_PATH;
+###PERL_CGI_PATH:           CGI_PATH           = /bsta/
+###PERL_CGI_ATTACH_PATH:    CGI_ATTACH_PATH    = /bsta/a
+###PERL_CGI_FRAME_PATH:     CGI_FRAME_PATH     = /bsta/f
+###PERL_CGI_VIEWER_PATH:    CGI_VIEWER_PATH    = /bsta/v
+
+###PERL_DATA_PATH:          DATA_PATH          = /botm/data/bsta/
+###PERL_DATA_DEFAULT_PATH:  DATA_DEFAULT_PATH  = /botm/data/bsta/default
+###PERL_DATA_NOACCESS_PATH: DATA_NOACCESS_PATH = /botm/data/bsta/noaccess
+###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
+###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
+
+###PERL_WEBSITE:            WEBSITE            = 1190.bicyclesonthemoon.info
 
 my %http;
 my %cgi;
@@ -58,7 +59,7 @@ my $ongtime;
 my $seconds;
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
 if ($ENV{'REQUEST_METHOD'} =~ /^(HEAD|GET|POST)$/) {
        $method=$1;
@@ -100,10 +101,10 @@ else {
        $password='';
 }
 
-%settings=readdatafile(SETTINGS_PATH);
-%default=readdatafile(DEFAULT_PATH);
+%settings=readdatafile(DATA_SETTINGS_PATH);
+%default=readdatafile(DATA_DEFAULT_PATH);
 %framedata=readdatafile(DATA_PATH.$frame);
-%state=readdatafile(STATE_PATH);
+%state=readdatafile(DATA_STATE_PATH);
 if($password eq $settings{'password'}){
        $passwordOK = 1;
 }
@@ -127,7 +128,7 @@ if ($passwordOK || (int($state{'state'}) >= 1 && $frame <= int($state{'last'}) &
 }
 else {
        $access=0;
-       %framedata = readdatafile(NOACCESS_PATH);
+       %framedata = readdatafile(DATA_NOACCESS_PATH);
        foreach my $ind (keys %default) {
                unless(defined($framedata{$ind})){
                        $framedata{$ind}=$default{$ind};
@@ -145,7 +146,7 @@ if($method eq 'HEAD') {
 }
 
 print '[quote][center][size=200]'.$framedata{'title'}.'[/size]'."\n";
-print '[url=http://'.WEBSITE.VIEWER_PATH.'/'.$frame.'][img]http://'.WEBSITE.CGI_PATH.($access?sprintf($settings{'frame'},$frame,$framedata{'ext'}):$framedata{'frame'}).'[/img][/url][/center]'."\n";
+print '[url=http://'.WEBSITE.CGI_VIEWER_PATH.'/'.$frame.'][img]http://'.WEBSITE.CGI_PATH.($access?sprintf($settings{'frame'},$frame,$framedata{'ext'}):$framedata{'frame'}).'[/img][/url][/center]'."\n";
 print bb2bbf($framedata{'content'}).'[/quote]'."\n";
 
 sub bb2bbf {
@@ -162,13 +163,13 @@ sub bb2bbf {
                $posttext = substr ($bb,pos ($bb));
                
                if ($tagvalue =~ /^att&([0-9]+)$/) {
-                       $tagvalue = 'http://'.WEBSITE.ATTACH_PATH.'/'.int($1);
+                       $tagvalue = 'http://'.WEBSITE.CGI_ATTACH_PATH.'/'.int($1);
                }
                elsif ($tagvalue =~ /^vw&([0-9]+)$/) {
-                       $tagvalue = 'http://'.WEBSITE.VIEWER_PATH.'/'.int($1);
+                       $tagvalue = 'http://'.WEBSITE.CGI_VIEWER_PATH.'/'.int($1);
                }
                elsif ($tagvalue =~ /^fr&([0-9]+)$/) {
-                       $tagvalue = 'http://'.WEBSITE.FRAME_PATH.'/'.int($1);
+                       $tagvalue = 'http://'.WEBSITE.CGI_FRAME_PATH.'/'.int($1);
                }
                else {
                        $tagvalue = '';
diff --git a/botmlogo.png b/botmlogo.png
new file mode 100644 (file)
index 0000000..d4aea7f
Binary files /dev/null and b/botmlogo.png differ
diff --git a/bsta.1.conf b/bsta.1.conf
new file mode 100644 (file)
index 0000000..62477df
--- /dev/null
@@ -0,0 +1,14 @@
+# bsta.conf is automatically generated from bsta.1.conf
+
+ScriptAlias ###CONF_CGI_2WORDS; ###CONF_BIN_2WORDS;
+ScriptAlias ###CONF_CGI_ATTACH; ###CONF_BIN_ATTACH;
+ScriptAlias ###CONF_CGI_BBCODE; ###CONF_BIN_BBCODE;
+ScriptAlias ###CONF_CGI_COIN; ###CONF_BIN_COIN;
+ScriptAlias ###CONF_CGI_FRAME; ###CONF_BIN_FRAME;
+ScriptAlias ###CONF_CGI_GOTO; ###CONF_BIN_GOTO;
+ScriptAlias ###CONF_CGI_INFO; ###CONF_BIN_INFO;
+ScriptAlias ###CONF_CGI_VIEWER; ###CONF_BIN_VIEWER;
+
+<Directory ###CONF_BIN;>
+       Require all granted
+</Directory>
diff --git a/bsta.1.cron b/bsta.1.cron
new file mode 100644 (file)
index 0000000..52f63d3
--- /dev/null
@@ -0,0 +1,5 @@
+# bsta.cron is automatically generated from bsta.1.cron
+
+###CRON_OLDLOGS_SCHEDULE; ###CRON_USER; ###CRON_OLDLOGS; ###CRON_LOG; ###CRON_LOG_SIZE_LIMIT; ###CRON_LOGS_TOTAL; ###CRON_LOGS_UNCOMPRESSED;
+###CRON_ONG_SCHEDULE; ###CRON_USER; ###CRON_ONG; >> ###CRON_ONG_LOG;
+###CRON_RESET_SCHEDULE; ###CRON_USER; ###CRON_RESET;
index 1105a4bc6f8230dee4f0b3e8bbeb1e8134a18a35..741634ff027501c337932f281d50c399363a53d8 100644 (file)
@@ -1,22 +1,21 @@
 # bsta_lib.pm is generated from bsta_lib.1.pm
-# 22.09.2022
 # 
 # Library of functions
 #
-#    Copyright (C) 2016-2017, 2019-2020, 2022  Balthasar Szczepański
+# Copyright (C) 2016, 2017, 2019, 2020, 2022, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 package bsta_lib;
 
@@ -343,11 +342,11 @@ use constant tagsht => {
        '/?'     => '[/unknown!]',
 };
 
-$VERSION     = 0.000002;
-@ISA         = qw(Exporter);
-@EXPORT      = ();
-@EXPORT_OK   = qw(entityencode failpage gethttpheader getcgi urldecode readdatafile writedatafile printdatafile printdatafileht urlencode linehtml bb2ht bb2bb);
-%EXPORT_TAGS = ();
+###PERL_EXPORT_VERSION: our $VERSION = 'x.x.x';
+our @ISA         = qw(Exporter);
+our @EXPORT      = ();
+our @EXPORT_OK   = qw(entityencode failpage gethttpheader getcgi urldecode readdatafile writedatafile printdatafile printdatafileht urlencode linehtml bb2ht bb2bb);
+our %EXPORT_TAGS = ();
 
 # Function to show an error page
 # arguments: 1 - header fields, 2 - page title, 3 - error message, 4 method
diff --git a/chat.1.c b/chat.1.c
deleted file mode 100644 (file)
index 2acd182..0000000
--- a/chat.1.c
+++ /dev/null
@@ -1,34 +0,0 @@
-// chat.c is generated from chat.1.c
-// 13.11.2016
-// 
-// This is the wrapper for chat.pl.
-// It's run with SETUID to have accesss to some files where the www server
-// should not. That's why it has a C wrapper. In modern systems running scripts
-// directly with SETUID is considered unsafe and not allowed.
-//
-//    Copyright (C) 2016  Balthasar Szczepański
-//
-//    This program is free software: you can redistribute it and/or modify
-//    it under the terms of the GNU Affero General Public License as
-//    published by the Free Software Foundation, either version 3 of the
-//    License, or (at your option) any later version.
-//
-//    This program is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//    GNU Affero General Public License for more details.
-//
-//    You should have received a copy of the GNU Affero General Public License
-//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#include <unistd.h>
-#include <stdio.h>
-
-###CHAT_PL;
-###CHAT_PL_ERRLOG;
-
-int main(int argc, char *argv[], char *envp[])
-{
-       freopen(CHAT_PL_ERRLOG,"at",stderr);
-       return execve(CHAT_PL,argv,envp);
-}
index ac274ba367f235181201402db1293e9996077877..5449aad43f4b42ad7d69d38f45761bfeace36cfa 100644 (file)
--- a/chat.1.pl
+++ b/chat.1.pl
@@ -1,43 +1,42 @@
-###PERL;
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # /bsta/coin
 # chat.pl is generated from chat.1.pl.
-# 11.01.2017
 #
 # The coincidence interface
 #
-#    Copyright (C) 2016-2017  Balthasar Szczepański
+# Copyright (C) 2016, 2017, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 use bsta_lib qw(failpage gethttpheader getcgi entityencode readdatafile writedatafile urlencode);
 use  File::Copy;
 
-###LOGO_PATH;
-###FAVICON_PATH;
-###COIN_PATH;
-###CHAT_PATH;
-###WEBSITE_NAME;
-###FAVICON_PATH;
-###CSS_PATH;
-###LOGO_PATH;
-###WEBSITE;
-###COINCIDENCE_PATH;
-###CGI_PATH;
+###PERL_CGI_PATH:           CGI_PATH           = /bsta/
+###PERL_CGI_COIN_PATH:      CGI_COIN_PATH      = /bsta/coin
+###PERL_CGI_CSS_PATH:       CGI_CSS_PATH       = /bsta/bsta.css
+###PERL_CGI_LOGO_PATH:      CGI_LOGO_PATH      = /bsta/botmlogo.png
+
+###PERL_DATA_CHAT_PATH:     DATA_CHAT_PATH     = /botm/data/bsta/chat
+###PERL_DATA_COIN_PATH:     DATA_COIN_PATH     = /botm/data/bsta/coincidence
+
+###PERL_WEBSITE:            WEBSITE            = 1190.bicyclesonthemoon.info
+###PERL_WEBSITE_NAME:       WEBSITE_NAME       = Bicycles on the Moon
+###PERL_FAVICON_PATH:       FAVICON_PATH       = /img/favicon.png
 
 my %http;
 my %cgi;
@@ -64,7 +63,7 @@ my $chatid;
 my $lastid;
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
 if ($ENV{'REQUEST_METHOD'} =~ /^(HEAD|GET|POST)$/) {
        $method=$1;
@@ -128,7 +127,7 @@ if ($cgi{'p'} ne '') {
        $password=$cgi{'p'};
 }
 
-%coin=readdatafile(COIN_PATH);
+%coin=readdatafile(DATA_COIN_PATH);
 
 if($password eq $coin{'password'}){
        $passwordOK = 1;
@@ -139,7 +138,7 @@ else{
 }
 
 if($page < 0) {
-       if (open ($chatfile,"+<",CHAT_PATH)){
+       if (open ($chatfile,"+<",DATA_CHAT_PATH)){
                if (flock($chatfile,2)) {
                        %chat=readdatafile($chatfile);
                        
@@ -210,7 +209,7 @@ if($page < 0) {
                                                        writedatafile($chatfile,%chat);
                                                }
                                                elsif ($chatstate > 1) {
-                                                       writedatafile(CHAT_PATH.$chatid,%chat);
+                                                       writedatafile(DATA_CHAT_PATH.$chatid,%chat);
                                                        my %newchat;
                                                        $newchat{'id'}=$chatid+1;
                                                        $newchat{'state'}=0;
@@ -265,11 +264,11 @@ if($page < 0) {
        }
 }
 else {
-       # %chat=readdatafile(CHAT_PATH);
+       # %chat=readdatafile(DATA_CHAT_PATH);
        # $chatid=int($chat{'id'})-$page;
-       %chat=readdatafile(CHAT_PATH);
+       %chat=readdatafile(DATA_CHAT_PATH);
        $lastid=int($chat{'id'});
-       %chat=readdatafile(CHAT_PATH.$page);
+       %chat=readdatafile(DATA_CHAT_PATH.$page);
        $chatid=int($chat{'id'});
        $chatstate=int($chat{'state'});
        @chatlines = split(/\r?\n/,$chat{'content'});
@@ -277,7 +276,7 @@ else {
 
 
 # print "Content-type: text/plain\n\n";
-# print CHAT_PATH."\n";
+# print DATA_CHAT_PATH."\n";
 # print 'state: '.$chat{'state'}."\n";
 # print 'id: '.$chat{'id'}."\n\n";
 # print $chat{'content'};
@@ -292,9 +291,9 @@ print '<html lang="en"><head>'."\n";
 print '<title>Coincidence &bull; '.WEBSITE_NAME.'</title>'."\n";
 print '<meta http-equiv="Content-type" content="text/html; charset=UTF-8">'."\n";
 print '<link rel="icon" type="image/png" href="'.FAVICON_PATH.'">'."\n";
-print '<link rel="stylesheet" href="'.CSS_PATH.'">'."\n";
+print '<link rel="stylesheet" href="'.CGI_CSS_PATH.'">'."\n";
 print '</head><body>'."\n";
-print '<a href="/"><img id="botmlogo" src="'.LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
+print '<a href="/"><img id="botmlogo" src="'.CGI_LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
 print '<div id="all">'."\n";
 
 print '<div id="inst" class="ins">'."\n";
@@ -319,7 +318,7 @@ if ($message ne '') {
        print '<span class="br">'.entityencode($message).'</span>'."\n";
 }
 if ($page < 0) {
-       print '<form method="post" action="'.COINCIDENCE_PATH.'">'."\n";
+       print '<form method="post" action="'.CGI_COIN_PATH.'">'."\n";
        if ($passwordOK) {
                print '<input class="intxc" type="text" name="words">'."\n";
                print '<input class="inbt" type="submit" value="Send">'."\n";
@@ -362,15 +361,15 @@ else {
 print '</div>'."\n";
 
 print '<div id="underlinks">'."\n";
-print '<a href="'.CGI_PATH.'">BSTA</a> | <a href="'.COINCIDENCE_PATH.($passwordOK?('?p='.urlencode($coin{'password'})):'').'">Once again</a>';
+print '<a href="'.CGI_PATH.'">BSTA</a> | <a href="'.CGI_COIN_PATH.($passwordOK?('?p='.urlencode($coin{'password'})):'').'">Once again</a>';
 if ($chatid > 0) {
-       print ' | <a href="'.COINCIDENCE_PATH.'/'.($chatid-1).($passwordOK?('?p='.urlencode($coin{'password'})):'').'">Before</a>';
+       print ' | <a href="'.CGI_COIN_PATH.'/'.($chatid-1).($passwordOK?('?p='.urlencode($coin{'password'})):'').'">Before</a>';
 }
 if ($chatid < $lastid) {
-       print ' | <a href="'.COINCIDENCE_PATH.'/'.(($chatid < $lastid-1)?($chatid +1):'').($passwordOK?('?p='.urlencode($coin{'password'})):'').'">Unbefore</a>';
+       print ' | <a href="'.CGI_COIN_PATH.'/'.(($chatid < $lastid-1)?($chatid +1):'').($passwordOK?('?p='.urlencode($coin{'password'})):'').'">Unbefore</a>';
 }
 if ($chatid > 0) {
-       print ' | <a href="'.COINCIDENCE_PATH.'/0'.($passwordOK?('?p='.urlencode($coin{'password'})):'').'">Initially</a>';
+       print ' | <a href="'.CGI_COIN_PATH.'/0'.($passwordOK?('?p='.urlencode($coin{'password'})):'').'">Initially</a>';
 }
 print ' | (This interface is only a demo, a proof of concept. It is very limited. No autorefresh, no private chat, etc. For full functionality use the actual Coincidence client.)'."\n";
 print "\n";
@@ -383,7 +382,7 @@ print '</body></html>'."\n";
 
 
 
-# print CHAT_PATH."\n";
+# print DATA_CHAT_PATH."\n";
 # print 'state: '.$chat{'state'}."\n";
 # print 'id: '.$chat{'id'}."\n\n";
 # print $chat{'content'};
diff --git a/config b/config
new file mode 160000 (submodule)
index 0000000..cc70d0d
--- /dev/null
+++ b/config
@@ -0,0 +1 @@
+Subproject commit cc70d0da5dd780e2b7b97672cc0638fd91196ee3
diff --git a/config.1.txt b/config.1.txt
deleted file mode 100644 (file)
index be78fb5..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# config.txt is generated from config.1.txt
-# 20.08.2016
-#
-# The file with the autogenerated configurations for Apache2 and crontab
-# 
-#    Copyright (C) 2016  Balthasar Szczepański
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-# ! the license is for config.1.txt, not config.txt.
-
-################################################################################
-#copy this to your Apache2 configuration,
-
-###VIEWER_ALIAS;
-###FRAME_ALIAS;
-
-################################################################################
diff --git a/config.txt b/config.txt
deleted file mode 100644 (file)
index 9f32353..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# config.txt is generated from config.1.txt
-# 20.08.2016
-#
-# The file with the autogenerated configurations for Apache2 and crontab
-# 
-#    Copyright (C) 2016  Balthasar Szczepański
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-# ! the license is for config.1.txt, not config.txt.
-
-################################################################################
-#copy this to your Apache2 configuration,
-
-ScriptAlias /bsta/v /eizm/bin/bsta/viewer
-ScriptAlias /bsta/v /eizm/bin/bsta/frame
-
-################################################################################
diff --git a/configure.pl b/configure.pl
deleted file mode 100644 (file)
index b397ac5..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/perl
-
-# configure.pl
-# 02.07.2017
-#
-# This script is called from the makefile. It reads the settings file and
-# inserts the information in the source files.
-#
-#    Copyright (C) 2015-2017  Balthasar Szczepański
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-unless ($ARGV[0]) {
-       print STDERR "Configfile missing.\n";
-       exit 1;
-}
-
-unless (open $configfile, "<", $ARGV[0]) {
-       print STDERR "Cannot open configfile\n";
-       exit 2;
-}
-
-# Read the config file, line format:
-# some_name = some value # some comment
-while (defined(my $line = <$configfile>)) {
-       $line =~ s/[\r\n]//g;
-       $line =~ s/#.*$//; #comment
-       if ($line =~ /^[ \t]*([a-zA-Z0-9_\-\.]+)[ \t]*=[ \t]*([^ \t](.*[^ \t])?)[ \t]*$/){
-               my $name=$1;
-               my $value=$2;
-               $set{$name}=$value;
-       }
-}
-close ($configfile);
-
-# Now generate things to be inserted.
-
-$def{'GZIP_PATH'}           = "use constant GZIP_PATH          => '".$set{'gzip'}."';";
-$def{'LOG_PATH'}            = "use constant LOG_PATH           => '".$set{'log_path'}."';";
-
-$def{'DATA_PATH'}           = "use constant DATA_PATH          => '".$set{'data_path'}."';";
-$def{'DEFAULT_PATH'}        = "use constant DEFAULT_PATH       => '".$set{'data_path'}."default';";
-$def{'SETTINGS_PATH'}       = "use constant SETTINGS_PATH      => '".$set{'data_path'}."settings';";
-$def{'NOACCESS_PATH'}       = "use constant NOACCESS_PATH      => '".$set{'data_path'}."noaccess';";
-$def{'STATE_PATH'}          = "use constant STATE_PATH         => '".$set{'data_path'}."state';";
-$def{'STORY_PATH'}          = "use constant STORY_PATH         => '".$set{'data_path'}."story';";
-$def{'CHAT_PATH'}           = "use constant CHAT_PATH          => '".$set{'data_path'}."chat';";
-$def{'COIN_PATH'}           = "use constant COIN_PATH          => '".$set{'data_path'}."coincidence';";
-$def{'LIST_PATH'}           = "use constant LIST_PATH          => '".$set{'data_path'}."list';";
-$def{'WWW_PATH'}            = "use constant WWW_PATH           => '".$set{'www_path'}."';";
-$def{'INDEX_PATH'}          = "use constant INDEX_PATH         => '".$set{'www_path'}."index.htm';";
-$def{'CGI_PATH'}            = "use constant CGI_PATH           => '".$set{'cgi_path'}."';";
-$def{'CSS_PATH'}            = "use constant CSS_PATH           => '".$set{'cgi_path'}."bsta.css';";
-$def{'LOGO_PATH'}           = "use constant LOGO_PATH          => '".$set{'cgi_path'}."botmlogo.png';";
-$def{'FRAME_PATH'}          = "use constant FRAME_PATH         => '".$set{'cgi_path'}."f';";
-$def{'VIEWER_PATH'}         = "use constant VIEWER_PATH        => '".$set{'cgi_path'}."v';";
-$def{'ATTACH_PATH'}         = "use constant ATTACH_PATH        => '".$set{'cgi_path'}."a';";
-$def{'INFO_PATH'}           = "use constant INFO_PATH          => '".$set{'cgi_path'}."i';";
-$def{'BBCODE_PATH'}         = "use constant BBCODE_PATH        => '".$set{'cgi_path'}."b';";
-$def{'GOTO_PATH'}           = "use constant GOTO_PATH          => '".$set{'cgi_path'}."g';";
-$def{'TWOWORDS_PATH'}       = "use constant TWOWORDS_PATH      => '".$set{'cgi_path'}."2words';";
-$def{'COINCIDENCE_PATH'}    = "use constant COINCIDENCE_PATH   => '".$set{'cgi_path'}."coin';";
-$def{'TIMER_PATH'}          = "use constant TIMER_PATH         => '".$set{'cgi_path'}."timer.js';";
-$def{'FAVICON_PATH'}        = "use constant FAVICON_PATH       => '".$set{'favicon_path'}."';";
-$def{'WEBSITE'}             = "use constant WEBSITE            => '".$set{'website'}."';";
-$def{'WEBSITE_NAME'}        = "use constant WEBSITE_NAME       => '".$set{'website_name'}."';";
-$def{'INTF_DATE'}           = "use constant INTF_DATE          => '".$set{'intf_date'}."';";
-$def{'COIN_DATE'}           = "use constant COIN_DATE          => '".$set{'coin_date'}."';";
-$def{'LOG_SIZE_LIMIT'}      = "use constant LOG_SIZE_LIMIT     => ".$set{'log_size_limit'}.";";
-$def{'LOGS_UNCOMPRESSED'}   = "use constant LOGS_UNCOMPRESSED  => ".$set{'logs_uncompressed'}.";";
-$def{'LOGS_TOTAL'}          = "use constant LOGS_TOTAL         => ".$set{'logs_total'}.";";
-$def{'STORY_LENGTH'}        = "use constant STORY_LENGTH       => ".int($set{'story_length'}).";";
-$def{'PAGE_LENGTH'}         = "use constant PAGE_LENGTH        => ".int($set{'page_length'}).";";
-$def{'FIRSTPAGE_LENGTH'}    = "use constant FIRSTPAGE_LENGTH   => ".int($set{'firstpage_length'}).";";
-
-$def{'VIEWER_ALIAS'}  = 'ScriptAlias '.$set{'cgi_path'}.'v '.$set{'bin_path'}.'viewer';
-$def{'FRAME_ALIAS' }  = 'ScriptAlias '.$set{'cgi_path'}.'v '.$set{'bin_path'}.'frame';
-
-$def{'LIB'} = "use lib '".$set{'lib_path'}."';";
-
-$def{'PATH'} = "\$ENV{'PATH'} = '".$set{'path'}."';";
-
-$def{'PERL'} = "#!".$set{'perl'};
-
-$def{'FRAME_PL'}            = '#define FRAME_PL           "'.$set{'bin_path'}.'frame.pl"';
-$def{'VIEWER_PL'}           = '#define VIEWER_PL          "'.$set{'bin_path'}.'viewer.pl"';
-$def{'ATTACH_PL'}           = '#define ATTACH_PL          "'.$set{'bin_path'}.'attach.pl"';
-$def{'TWOWORDS_PL'}         = '#define TWOWORDS_PL        "'.$set{'bin_path'}.'2words.pl"';
-$def{'CHAT_PL'}             = '#define CHAT_PL            "'.$set{'bin_path'}.'chat.pl"';
-$def{'INFO_PL'}             = '#define INFO_PL            "'.$set{'bin_path'}.'info.pl"';
-$def{'GOTO_PL'}             = '#define GOTO_PL            "'.$set{'bin_path'}.'goto.pl"';
-$def{'BBCODE_PL'}           = '#define BBCODE_PL          "'.$set{'bin_path'}.'bbcode.pl"';
-$def{'FRAME_PL_ERRLOG'}     = '#define FRAME_PL_ERRLOG    "'.$set{'log_path'}.'frame-stderr.log"';
-$def{'VIEWER_PL_ERRLOG'}    = '#define VIEWER_PL_ERRLOG   "'.$set{'log_path'}.'viewer-stderr.log"';
-$def{'ATTACH_PL_ERRLOG'}    = '#define ATTACH_PL_ERRLOG   "'.$set{'log_path'}.'attach-stderr.log"';
-$def{'TWOWORDS_PL_ERRLOG'}  = '#define TWOWORDS_PL_ERRLOG "'.$set{'log_path'}.'2words-stderr.log"';
-$def{'CHAT_PL_ERRLOG'}      = '#define CHAT_PL_ERRLOG     "'.$set{'log_path'}.'chat-stderr.log"';
-$def{'INFO_PL_ERRLOG'}      = '#define INFO_PL_ERRLOG     "'.$set{'log_path'}.'info-stderr.log"';
-$def{'GOTO_PL_ERRLOG'}      = '#define GOTO_PL_ERRLOG     "'.$set{'log_path'}.'goto-stderr.log"';
-$def{'BBCODE_PL_ERRLOG'}    = '#define BBCODE_PL_ERRLOG   "'.$set{'log_path'}.'bbcode-stderr.log"';
-
-$def{'CC'} = 'CC='.$set{'gcc'};
-$def{'CF'} = 'CF='.$set{'c_flags'};
-$def{'PL'} = 'PL='.$set{'perl'};
-$def{'MV'} = 'MV='.$set{'mv'};
-$def{'CP'} = 'CP='.$set{'cp'};
-$def{'RM'} = 'RM='.$set{'rm'};
-$def{'OD'} = 'OD='.$set{'bin_path'};
-$def{'LD'} = 'LD='.$set{'lib_path'};
-$def{'WD'} = 'WD='.$set{'www_path'};
-$def{'CM'} = 'CM='.$set{'chmod'};
-
-
-# Now go through input file, find lines to be replaced. Format:
-# ###SOME_NAME;
-# If found - replace.
-
-while (defined($line = <STDIN>)) {
-       $line =~ s/[\r\n]//g;
-       if ($line =~ /###([a-zA-Z0-9_]+);/) {
-               print "$def{$1}\n";
-       }
-       else {
-               print "$line\n";
-       }
-}
diff --git a/exec b/exec
new file mode 160000 (submodule)
index 0000000..92cf35c
--- /dev/null
+++ b/exec
@@ -0,0 +1 @@
+Subproject commit 92cf35c0340afcadb39f06248de26e114ad5603c
diff --git a/frame.1.c b/frame.1.c
deleted file mode 100644 (file)
index 0f74d7e..0000000
--- a/frame.1.c
+++ /dev/null
@@ -1,34 +0,0 @@
-// frame.c is generated from frame.1.c
-// 21.08.2016
-// 
-// This is the wrapper for frame.pl.
-// It's run with SETUID to have accesss to some files where the www server
-// should not. That's why it has a C wrapper. In modern systems running scripts
-// directly with SETUID is considered unsafe and not allowed.
-//
-//    Copyright (C) 2016  Balthasar Szczepański
-//
-//    This program is free software: you can redistribute it and/or modify
-//    it under the terms of the GNU Affero General Public License as
-//    published by the Free Software Foundation, either version 3 of the
-//    License, or (at your option) any later version.
-//
-//    This program is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//    GNU Affero General Public License for more details.
-//
-//    You should have received a copy of the GNU Affero General Public License
-//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#include <unistd.h>
-#include <stdio.h>
-
-###FRAME_PL;
-###FRAME_PL_ERRLOG;
-
-int main(int argc, char *argv[], char *envp[])
-{
-       freopen(FRAME_PL_ERRLOG,"at",stderr);
-       return execve(FRAME_PL,argv,envp);
-}
index ad58411e6b161fee9f90fd6b9a383bc8324f44c2..7645c47039c92b495ef093accb70aa9172f34e0d 100644 (file)
@@ -1,37 +1,36 @@
-###PERL;
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # /bsta/f
 # viewer.pl is generated from viewer.1.pl.
-# 19.10.2016
 #
 # The frame interface
 #
-#    Copyright (C) 2016  Balthasar Szczepañski
+# Copyright (C) 2016, 2023  Balthasar Szczepañski
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 
 use bsta_lib qw(failpage gethttpheader getcgi readdatafile);
 
-###SETTINGS_PATH;
-###DEFAULT_PATH;
-###DATA_PATH;
-###STATE_PATH;
-###NOACCESS_PATH;
+###PERL_DATA_PATH:          DATA_PATH          = /botm/data/bsta
+###PERL_DATA_DEFAULT_PATH:  DATA_DEFAULT_PATH  = /botm/data/bsta/default
+###PERL_DATA_NOACCESS_PATH: DATA_NOACCESS_PATH = /botm/data/bsta/noaccess
+###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
+###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
 
 my %http;
 my %cgi;
@@ -55,7 +54,7 @@ my $buffer;
 my @fileinfo;
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
 if ($ENV{'REQUEST_METHOD'} =~ /^(HEAD|GET|POST)$/) {
        $method=$1;
@@ -97,9 +96,9 @@ else {
        $password='';
 }
 
-%settings=readdatafile(SETTINGS_PATH);
-%default=readdatafile(DEFAULT_PATH);
-%state=readdatafile(STATE_PATH);
+%settings=readdatafile(DATA_SETTINGS_PATH);
+%default=readdatafile(DATA_DEFAULT_PATH);
+%state=readdatafile(DATA_STATE_PATH);
 if($frame<0) {
        $frame = $state{'last'} + $frame +1;
 }
@@ -116,12 +115,12 @@ else{
        $passwordOK = 0;
 }
 
-if ($passwordOK || (int($state{'state'}) >= 1 && $frame <= int($state{'last'}) && $frame > 0)) {
+if ($passwordOK || (int($state{'state'}) >= 1 && $frame <= int($state{'last'}) && $frame >= 0)) {
        $access=1;
 }
 else {
        $access=0;
-       %framedata = readdatafile(NOACCESS_PATH);
+       %framedata = readdatafile(DATA_NOACCESS_PATH);
        foreach my $ind (keys %default) {
                unless(defined($framedata{$ind})){
                        $framedata{$ind}=$default{$ind};
diff --git a/goto.1.c b/goto.1.c
deleted file mode 100644 (file)
index 110e0b7..0000000
--- a/goto.1.c
+++ /dev/null
@@ -1,34 +0,0 @@
-// info.c is generated from info.1.c
-// 29.06.2017
-// 
-// This is the wrapper for info.pl.
-// It's run with SETUID to have accesss to some files where the www server
-// should not. That's why it has a C wrapper. In modern systems running scripts
-// directly with SETUID is considered unsafe and not allowed.
-//
-//    Copyright (C) 2017  Balthasar Szczepański
-//
-//    This program is free software: you can redistribute it and/or modify
-//    it under the terms of the GNU Affero General Public License as
-//    published by the Free Software Foundation, either version 3 of the
-//    License, or (at your option) any later version.
-//
-//    This program is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//    GNU Affero General Public License for more details.
-//
-//    You should have received a copy of the GNU Affero General Public License
-//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#include <unistd.h>
-#include <stdio.h>
-
-###GOTO_PL;
-###GOTO_PL_ERRLOG;
-
-int main(int argc, char *argv[], char *envp[])
-{
-       freopen(GOTO_PL_ERRLOG,"at",stderr);
-       return execve(GOTO_PL,argv,envp);
-}
index dcc2072bfaced33b5cdbbba1c36596d0c8e32b71..36c44ecf064c5966982547c55829c4dcb3317019 100644 (file)
--- a/goto.1.pl
+++ b/goto.1.pl
@@ -1,44 +1,44 @@
-###PERL;
+###RUN_PERL: #!/usr/bin/perl
 #
 # /bsta/g
-# goto.pl is generated from goto.1.pl.
-# 02.07.2017
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # The frame list
 #
-#    Copyright (C) 2017  Balthasar Szczepański
+# Copyright (C) 2017, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 use bsta_lib qw(failpage gethttpheader getcgi readdatafile printdatafile entityencode urlencode);
 use File::Copy;
 
-###DATA_PATH;
-###SETTINGS_PATH;
-###STATE_PATH;
-###LIST_PATH;
-###WEBSITE_NAME;
-###FAVICON_PATH;
-###CSS_PATH;
-###LOGO_PATH;
-###WEBSITE;
-###CGI_PATH;
-###VIEWER_PATH;
+###PERL_CGI_PATH:           CGI_PATH           = /bsta/
+###PERL_CGI_CSS_PATH:       CGI_CSS_PATH       = /bsta/bsta.css
+###PERL_CGI_LOGO_PATH:      CGI_LOGO_PATH      = /bsta/botmlogo.png
+###PERL_CGI_VIEWER_PATH:    CGI_VIEWER_PATH    = /bsta/v
+
+###PERL_DATA_PATH:          DATA_PATH          = /botm/data/bsta/
+###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
+###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
+###PERL_DATA_LIST_PATH:     DATA_LIST_PATH     = /botm/data/bsta/list
 
+###PERL_WEBSITE:            WEBSITE            = 1190.bicyclesonthemoon.info
+###PERL_WEBSITE_NAME:       WEBSITE_NAME       = Bicycles on the Moon
+###PERL_FAVICON_PATH:       FAVICON_PATH       = /img/favicon.png
 
 my %http;
 my %cgi;
@@ -63,7 +63,7 @@ my $ongstate;
 my $line;
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
 if ($ENV{'REQUEST_METHOD'} =~ /^(HEAD|GET|POST)$/) {
        $method=$1;
@@ -95,9 +95,9 @@ else {
        $password='';
 }
 
-%settings=readdatafile(SETTINGS_PATH);
-%state=readdatafile(STATE_PATH);
-%gotolist=readdatafile(LIST_PATH);
+%settings=readdatafile(DATA_SETTINGS_PATH);
+%state=readdatafile(DATA_STATE_PATH);
+%gotolist=readdatafile(DATA_LIST_PATH);
 
 if($password eq $settings{'password'}){
        $passwordOK = 1;
@@ -117,9 +117,9 @@ print '<html lang="en"><head>'."\n";
 print '<title>GOTO &bull; '.entityencode($settings{'story'}).' &bull; '.WEBSITE_NAME.'</title>'."\n";
 print '<meta http-equiv="Content-type" content="text/html; charset=UTF-8">'."\n";
 print '<link rel="icon" type="image/png" href="'.FAVICON_PATH.'">'."\n";
-print '<link rel="stylesheet" href="'.CSS_PATH.'">'."\n";
+print '<link rel="stylesheet" href="'.CGI_CSS_PATH.'">'."\n";
 print '</head><body>'."\n";
-print '<a href="/"><img id="botmlogo" src="'.LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
+print '<a href="/"><img id="botmlogo" src="'.CGI_LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
 print '<div id="all">'."\n";
 
 print '<div id="inst" class="ins">'."\n";
@@ -146,7 +146,7 @@ for ($frame=0; ; ++$frame) {
        }
        @timetab=gmtime($ongtime);
        
-       print '<span class="'.(($frame==$last && int($state{'state'}<2))?'ni':'br').'">'.sprintf('%03d',$frame).'</span> '.sprintf('%02d.%02d.%02d %02d:%02d',$timetab[3],$timetab[4]+1,$timetab[5]-100,$timetab[2],$timetab[1]).' <a href="'.VIEWER_PATH.'/'.$frame.($passwordOK?('?p='.urlencode($password)):'').'">'.entityencode($title).'</a><br>'."\n";
+       print '<span class="'.(($frame==$last && int($state{'state'}<2))?'ni':'br').'">'.sprintf('%03d',$frame).'</span> '.sprintf('%02d.%02d.%02d %02d:%02d',$timetab[3],$timetab[4]+1,$timetab[5]-100,$timetab[2],$timetab[1]).' <a href="'.CGI_VIEWER_PATH.'/'.$frame.($passwordOK?('?p='.urlencode($password)):'').'">'.entityencode($title).'</a><br>'."\n";
 }
 
 print '</div>'."\n";
diff --git a/info.1.c b/info.1.c
deleted file mode 100644 (file)
index 7f55f1e..0000000
--- a/info.1.c
+++ /dev/null
@@ -1,34 +0,0 @@
-// info.c is generated from info.1.c
-// 02.02.2017
-// 
-// This is the wrapper for info.pl.
-// It's run with SETUID to have accesss to some files where the www server
-// should not. That's why it has a C wrapper. In modern systems running scripts
-// directly with SETUID is considered unsafe and not allowed.
-//
-//    Copyright (C) 2017  Balthasar Szczepański
-//
-//    This program is free software: you can redistribute it and/or modify
-//    it under the terms of the GNU Affero General Public License as
-//    published by the Free Software Foundation, either version 3 of the
-//    License, or (at your option) any later version.
-//
-//    This program is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//    GNU Affero General Public License for more details.
-//
-//    You should have received a copy of the GNU Affero General Public License
-//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#include <unistd.h>
-#include <stdio.h>
-
-###INFO_PL;
-###INFO_PL_ERRLOG;
-
-int main(int argc, char *argv[], char *envp[])
-{
-       freopen(INFO_PL_ERRLOG,"at",stderr);
-       return execve(INFO_PL,argv,envp);
-}
index 8e16798dbc8109a590f3476c2c02cc8a37e721bb..87720052ab5cf8ff06f1cb2360e6367b0d2356ec 100644 (file)
--- a/info.1.pl
+++ b/info.1.pl
@@ -1,37 +1,36 @@
-###PERL;
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # /bsta/i
 # info.pl is generated from info.1.pl.
-# 05.06.2017
 #
 # The frame/story info interface
 #
-#    Copyright (C) 2017  Balthasar Szczepański
+# Copyright (C) 2017, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 use bsta_lib qw(failpage gethttpheader getcgi readdatafile printdatafile);
 use File::Copy;
 
-###DATA_PATH;
-###DEFAULT_PATH;
-###SETTINGS_PATH;
-###STATE_PATH;
-###NOACCESS_PATH;
+###PERL_DATA_PATH:          DATA_PATH          = /botm/data/bsta
+###PERL_DATA_DEFAULT_PATH:  DATA_DEFAULT_PATH  = /botm/data/bsta/default
+###PERL_DATA_NOACCESS_PATH: DATA_NOACCESS_PATH = /botm/data/bsta/noaccess
+###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
+###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
 
 my %http;
 my %cgi;
@@ -54,7 +53,7 @@ my $ongtime;
 my $seconds;
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
 if ($ENV{'REQUEST_METHOD'} =~ /^(HEAD|GET|POST)$/) {
        $method=$1;
@@ -96,10 +95,10 @@ else {
        $password='';
 }
 
-%settings=readdatafile(SETTINGS_PATH);
-%default=readdatafile(DEFAULT_PATH);
+%settings=readdatafile(DATA_SETTINGS_PATH);
+%default=readdatafile(DATA_DEFAULT_PATH);
 %framedata=readdatafile(DATA_PATH.$frame);
-%state=readdatafile(STATE_PATH);
+%state=readdatafile(DATA_STATE_PATH);
 if($password eq $settings{'password'}){
        $passwordOK = 1;
 }
@@ -159,7 +158,7 @@ else {
        }
        else {
                $access=0;
-               %framedata = readdatafile(NOACCESS_PATH);
+               %framedata = readdatafile(DATA_NOACCESS_PATH);
                foreach my $ind (keys %default) {
                        unless(defined($framedata{$ind})){
                                $framedata{$ind}=$default{$ind};
diff --git a/make.sh b/make.sh
deleted file mode 100755 (executable)
index 38d663e..0000000
--- a/make.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-# make.sh
-# 13.01.2016
-#
-# This is the script for making the software. Normally, the makefile is used for
-# this purpose. But the makefile has to be generated first.
-# This script generates the makefile and then uses it and finally removes it.
-#
-#    Copyright (C) 2015-2016  Balthasar Szczepański
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-set -x
-perl configure.pl settings <makefile.1.mak >makefile
-make
-# rm makefile
index ad0f7d25c2db44cc33ca77530f099c825bd8b95e..5a25a9e8fd42200f9d7cd97d60f5e7afcc188c62 100644 (file)
--- a/makefile
+++ b/makefile
-# makefile is generated from makefile.1.mak.
-#  2.07.2017
+# "makefile" is automatically generated from "makefile.1.mak"
+# 
+# Copyright (C) 2016, 2017, 2023  Balthasar Szczepański
 #
-# This is the makefile
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    Copyright (C) 2016 - 2017  Balthasar Szczepañski
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-CC=/usr/bin/gcc
-CF=-g -Wall
-PL=/usr/bin/perl
-CP=/bin/cp
-MV=/bin/mv
-RM=/bin/rm
-CM=/bin/chmod
-OD=/eizm/bin/bsta/
-LD=/eizm/lib/bsta/
-WD=/eizm/www/time/bsta/
-
-all: moveout copyoutwww moveoutlib remove config.txt
-
-moveout: viewer viewer.pl frame frame.pl 2words 2words.pl chat chat.pl ong.pl updlist.pl oldlogs.pl attach attach.pl info info.pl goto goto.pl bbcode bbcode.pl   setuid exec
-       $(MV) viewer viewer.pl frame frame.pl 2words 2words.pl chat chat.pl ong.pl updlist.pl oldlogs.pl attach attach.pl info info.pl goto goto.pl bbcode bbcode.pl $(OD)
-
-copyout:   setuid exec
-#      $(CP) access.pl $(OD)
-
-copyoutwww: timer.js bsta.css   setuid exec
-       $(CP) timer.js bsta.css $(WD)
-
-
-moveoutlib: bsta_lib.pm   setuid exec
-       $(MV) bsta_lib.pm $(LD)
-
-setuid: viewer frame 2words attach chat info goto bbcode
-       $(CM) u+s viewer frame 2words attach chat info goto bbcode
-
-exec: viewer.pl frame.pl 2words.pl ong.pl updlist.pl oldlogs.pl attach.pl chat.pl info.pl goto.pl bbcode.pl
-       $(CM) +x viewer.pl frame.pl 2words.pl ong.pl updlist.pl oldlogs.pl attach.pl chat.pl info.pl goto.pl bbcode.pl
-
-remove: viewer.c frame.c 2words.c chat.c attach.c info.c goto.c bbcode.c   copyout moveout setuid exec 
-       $(RM) viewer.c frame.c 2words.c chat.c attach.c info.c goto.c bbcode.c
-
-
-bsta_lib.pm: bsta_lib.1.pm configure.pl settings
-       $(PL) configure.pl settings <bsta_lib.1.pm >bsta_lib.pm
-
-
-viewer: viewer.c
-       $(CC) $(CF) -o viewer viewer.c
-
-viewer.c: viewer.1.c configure.pl settings
-       $(PL) configure.pl settings <viewer.1.c >viewer.c
-
-viewer.pl: viewer.1.pl configure.pl settings
-       $(PL) configure.pl settings <viewer.1.pl >viewer.pl
-
-
-frame: frame.c
-       $(CC) $(CF) -o frame frame.c
-
-frame.c: frame.1.c configure.pl settings
-       $(PL) configure.pl settings <frame.1.c >frame.c
-
-frame.pl: frame.1.pl configure.pl settings
-       $(PL) configure.pl settings <frame.1.pl >frame.pl
-
-
-2words: 2words.c
-       $(CC) $(CF) -o 2words 2words.c
-
-2words.c: 2words.1.c configure.pl settings
-       $(PL) configure.pl settings <2words.1.c >2words.c
-
-2words.pl: 2words.1.pl configure.pl settings
-       $(PL) configure.pl settings <2words.1.pl >2words.pl
-
-
-attach: attach.c
-       $(CC) $(CF) -o attach attach.c
-
-attach.c: attach.1.c configure.pl settings
-       $(PL) configure.pl settings <attach.1.c >attach.c
-
-attach.pl: attach.1.pl configure.pl settings
-       $(PL) configure.pl settings <attach.1.pl >attach.pl
-
-
-chat: chat.c
-       $(CC) $(CF) -o chat chat.c
-
-chat.c: chat.1.c configure.pl settings
-       $(PL) configure.pl settings <chat.1.c >chat.c
-
-chat.pl: chat.1.pl configure.pl settings
-       $(PL) configure.pl settings <chat.1.pl >chat.pl
-
-
-info: info.c
-       $(CC) $(CF) -o info info.c
-
-info.c: info.1.c configure.pl settings
-       $(PL) configure.pl settings <info.1.c >info.c
-
-info.pl: info.1.pl configure.pl settings
-       $(PL) configure.pl settings <info.1.pl >info.pl
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DEFAULT_TARGET = debug
+ifndef TARGET
+TARGET = debug
+# when want to change target run this first:
+# make -B TARGET=target_name makefile
+endif
+PERL = perl
+
+CC   =/usr/bin/gcc
+CF   =-g -Wall
+
+CHMOD=/usr/bin/chmod
+CP   =/usr/bin/cp
+MKDIR=/usr/bin/mkdir
+PERL =/usr/bin/perl
+RM   =/usr/bin/rm
+SUDO =/usr/bin/sudo
+
+BIN_PATH  = /botm/bin/test-bsta
+DATA_PATH = /botm/data/test-bsta
+LIB_PATH  = /botm/lib/test-bsta
+LOG_PATH  = /botm/log/test-bsta
+TMP_PATH  = /botm/tmp/test-bsta
+WWW_PATH  = /botm/www/1190/bstatest
+
+CONF = /botm/etc/www/conf/1190/test-bsta.conf
+CRON = /etc/cron.d/test-bsta
+
+CONFIGFILE = settings-$(TARGET).txt settings.txt
+DEFAULT_CONFIGFILE = settings-$(DEFAULT_TARGET).txt settings.txt
+
+# The configuration tool
+CONFIGURE_CMD = $(PERL) ./configure.pl $(CONFIGFILE)
+
+# keep these 2 lists in the same order!:
+GENERATE_FROM=\
+2words.1.pl\
+attach.1.pl\
+bbcode.1.pl\
+bsta.1.conf\
+bsta.1.cron\
+bsta_lib.1.pm\
+chat.1.pl\
+frame.1.pl\
+goto.1.pl\
+info.1.pl\
+oldlogs.1.pl\
+ong.1.pl\
+reset.1.pl\
+updlist.1.pl\
+viewer.1.pl
+
+TO_GENERATE=\
+2words.pl\
+attach.pl\
+bbcode.pl\
+bsta.conf\
+bsta.cron\
+bsta_lib.pm\
+chat.pl\
+frame.pl\
+goto.pl\
+info.pl\
+oldlogs.pl\
+ong.pl\
+reset.pl\
+updlist.pl\
+viewer.pl
+
+DIR=\
+$(BIN_PATH)\
+$(DATA_PATH)\
+$(LIB_PATH)\
+$(LOG_PATH)\
+$(TMP_PATH)\
+$(WWW_PATH)
+
+HIDDEN_DIR=\
+$(DATA_PATH)\
+$(TMP_PATH)
+
+SETUID=\
+2words\
+bbcode\
+attach\
+chat\
+frame\
+goto\
+info\
+viewer
+
+EXEC=\
+2words.pl\
+attach.pl\
+bbcode.pl\
+chat.pl\
+frame.pl\
+goto.pl\
+info.pl\
+oldlogs.pl\
+ong.pl\
+reset.pl\
+updlist.pl\
+viewer.pl
+
+PERL_WRAP_EXEC=\
+2words\
+attach\
+bbcode\
+chat\
+frame\
+goto\
+info\
+viewer
+
+BIN=\
+$(EXEC)\
+$(PERL_WRAP_EXEC)
+
+LIB=\
+bsta_lib.pm
+
+WWW=\
+botmlogo.png\
+bsta.css\
+timer.js
+
+
+all: $(BIN) setuid exec
+
+makefile: makefile.1.mak $(CONFIGFILE) configure.pl
+       $(CONFIGURE_CMD) < makefile.1.mak > makefile
+
+configure.pl: $(CONFIGFILE) config/configure.1.pl
+       $(PERL) config/configure.1.pl target=direct settings-$(TARGET).txt config/settings.txt --in config/configure.1.pl --out configure.pl
+
+$(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE) configure.pl
+       $(CONFIGURE_CMD) --in $(GENERATE_FROM) --out $(TO_GENERATE)
+
+$(PERL_WRAP_EXEC): %: exec/exec.c exec/settings.txt configure.pl
+       $(PERL) configure.pl path=$(BIN_PATH) target=$*.pl io_path=$(LOG_PATH) stderr=$*-stderr.log exec/settings.txt --in exec/exec.c --out $*.c
+       $(CC) $(CF) -o $@ $*.c
+
+exec: $(EXEC)
+       $(CHMOD) +x $(EXEC)
+
+wrap_exec: 
        
-goto: goto.c
-       $(CC) $(CF) -o goto goto.c
-
-goto.c: goto.1.c configure.pl settings
-       $(PL) configure.pl settings <goto.1.c >goto.c
-
-goto.pl: goto.1.pl configure.pl settings
-       $(PL) configure.pl settings <goto.1.pl >goto.pl
+setuid: $(SETUID)
+       $(CHMOD) u+s,g+s $(SETUID)
 
 
-bbcode: bbcode.c
-       $(CC) $(CF) -o bbcode bbcode.c
+mktree:
+       $(MKDIR) -p $(DIR)
+       $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR)
 
-bbcode.c: bbcode.1.c configure.pl settings
-       $(PL) configure.pl settings <bbcode.1.c >bbcode.c
+ifdef BIN_PATH
+cp_bin: $(BIN) setuid exec | mktree
+       $(RM) -f $(BIN_PATH)/*
+       $(CP) -p $(BIN) $(BIN_PATH)
+endif
 
-bbcode.pl: bbcode.1.pl configure.pl settings
-       $(PL) configure.pl settings <bbcode.1.pl >bbcode.pl
+ifdef LIB_PATH
+cp_lib: $(LIB) | mktree
+       $(RM) -f $(LIB_PATH)/*
+       $(CP) -p $(LIB) $(LIB_PATH)
+endif
 
+cp_www:
+       $(CP) -p $(WWW) $(WWW_PATH)
 
-ong.pl: ong.1.pl configure.pl settings
-       $(PL) configure.pl settings <ong.1.pl >ong.pl
+cp_conf: bsta.conf
+       $(CP) bsta.conf $(CONF)
 
-updlist.pl: updlist.1.pl configure.pl settings
-       $(PL) configure.pl settings <updlist.1.pl >updlist.pl
+cp_cron: bsta.cron
+       $(SUDO) $(CP) bsta.cron $(CRON)
 
-oldlogs.pl: oldlogs.1.pl configure.pl settings
-       $(PL) configure.pl settings <oldlogs.1.pl >oldlogs.pl
+install: all cp_bin cp_lib cp_www cp_conf cp_cron
 
+clean:
+       $(RM) -f configure.pl $(TO_GENERATE) $(PERL_WRAP_EXEC) $(PERL_WRAP_EXEC:=.c)
+       $(PERL) config/configure.1.pl $(DEFAULT_CONFIGFILE) < makefile.1.mak > makefile
 
-config.txt: config.1.txt configure.pl settings
-       $(PL) configure.pl settings <config.1.txt >config.txt
+PHONY: all clean install setuid exec mktree cp_bin cp_lib cp_www cp_conf cp_cron
index cdeb46eda735e73eec9aadfc1f80aaa019a134b6..6477e36f5b7d188f8f84c469c9ffc5974b90c11b 100644 (file)
-# makefile is generated from makefile.1.mak.
-#  2.07.2017
+# "makefile" is automatically generated from "makefile.1.mak"
+# 
+# Copyright (C) 2016, 2017, 2023  Balthasar Szczepański
 #
-# This is the makefile
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    Copyright (C) 2016 - 2017  Balthasar Szczepañski
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-###CC;
-###CF;
-###PL;
-###CP;
-###MV;
-###RM;
-###CM;
-###OD;
-###LD;
-###WD;
-
-all: moveout copyoutwww moveoutlib remove config.txt
-
-moveout: reset.pl viewer viewer.pl frame frame.pl 2words 2words.pl chat chat.pl ong.pl updlist.pl oldlogs.pl attach attach.pl info info.pl goto goto.pl bbcode bbcode.pl   setuid exec
-       $(MV) reset.pl viewer viewer.pl frame frame.pl 2words 2words.pl chat chat.pl ong.pl updlist.pl oldlogs.pl attach attach.pl info info.pl goto goto.pl bbcode bbcode.pl $(OD)
-
-copyout:   setuid exec
-#      $(CP) access.pl $(OD)
-
-copyoutwww: timer.js bsta.css   setuid exec
-       $(CP) timer.js bsta.css $(WD)
-
-
-moveoutlib: bsta_lib.pm   setuid exec
-       $(MV) bsta_lib.pm $(LD)
-
-setuid: viewer frame 2words attach chat info goto bbcode
-       $(CM) u+s viewer frame 2words attach chat info goto bbcode
-
-exec: reset.pl viewer.pl frame.pl 2words.pl ong.pl updlist.pl oldlogs.pl attach.pl chat.pl info.pl goto.pl bbcode.pl
-       $(CM) +x reset.pl viewer.pl frame.pl 2words.pl ong.pl updlist.pl oldlogs.pl attach.pl chat.pl info.pl goto.pl bbcode.pl
-
-remove: viewer.c frame.c 2words.c chat.c attach.c info.c goto.c bbcode.c   copyout moveout setuid exec 
-       $(RM) viewer.c frame.c 2words.c chat.c attach.c info.c goto.c bbcode.c
-
-
-bsta_lib.pm: bsta_lib.1.pm configure.pl settings
-       $(PL) configure.pl settings <bsta_lib.1.pm >bsta_lib.pm
-
-
-viewer: viewer.c
-       $(CC) $(CF) -o viewer viewer.c
-
-viewer.c: viewer.1.c configure.pl settings
-       $(PL) configure.pl settings <viewer.1.c >viewer.c
-
-viewer.pl: viewer.1.pl configure.pl settings
-       $(PL) configure.pl settings <viewer.1.pl >viewer.pl
-
-
-frame: frame.c
-       $(CC) $(CF) -o frame frame.c
-
-frame.c: frame.1.c configure.pl settings
-       $(PL) configure.pl settings <frame.1.c >frame.c
-
-frame.pl: frame.1.pl configure.pl settings
-       $(PL) configure.pl settings <frame.1.pl >frame.pl
-
-
-2words: 2words.c
-       $(CC) $(CF) -o 2words 2words.c
-
-2words.c: 2words.1.c configure.pl settings
-       $(PL) configure.pl settings <2words.1.c >2words.c
-
-2words.pl: 2words.1.pl configure.pl settings
-       $(PL) configure.pl settings <2words.1.pl >2words.pl
-
-
-attach: attach.c
-       $(CC) $(CF) -o attach attach.c
-
-attach.c: attach.1.c configure.pl settings
-       $(PL) configure.pl settings <attach.1.c >attach.c
-
-attach.pl: attach.1.pl configure.pl settings
-       $(PL) configure.pl settings <attach.1.pl >attach.pl
-
-
-chat: chat.c
-       $(CC) $(CF) -o chat chat.c
-
-chat.c: chat.1.c configure.pl settings
-       $(PL) configure.pl settings <chat.1.c >chat.c
-
-chat.pl: chat.1.pl configure.pl settings
-       $(PL) configure.pl settings <chat.1.pl >chat.pl
-
-
-info: info.c
-       $(CC) $(CF) -o info info.c
-
-info.c: info.1.c configure.pl settings
-       $(PL) configure.pl settings <info.1.c >info.c
-
-info.pl: info.1.pl configure.pl settings
-       $(PL) configure.pl settings <info.1.pl >info.pl
-
-
-goto: goto.c
-       $(CC) $(CF) -o goto goto.c
-
-goto.c: goto.1.c configure.pl settings
-       $(PL) configure.pl settings <goto.1.c >goto.c
-
-goto.pl: goto.1.pl configure.pl settings
-       $(PL) configure.pl settings <goto.1.pl >goto.pl
-
-
-bbcode: bbcode.c
-       $(CC) $(CF) -o bbcode bbcode.c
-
-bbcode.c: bbcode.1.c configure.pl settings
-       $(PL) configure.pl settings <bbcode.1.c >bbcode.c
-
-bbcode.pl: bbcode.1.pl configure.pl settings
-       $(PL) configure.pl settings <bbcode.1.pl >bbcode.pl
-
-
-ong.pl: ong.1.pl configure.pl settings
-       $(PL) configure.pl settings <ong.1.pl >ong.pl
-
-updlist.pl: updlist.1.pl configure.pl settings
-       $(PL) configure.pl settings <updlist.1.pl >updlist.pl
-
-oldlogs.pl: oldlogs.1.pl configure.pl settings
-       $(PL) configure.pl settings <oldlogs.1.pl >oldlogs.pl
-
-reset.pl: reset.1.pl configure.pl settings
-       $(PL) configure.pl settings <reset.1.pl >reset.pl
-
-
-
-config.txt: config.1.txt configure.pl settings
-       $(PL) configure.pl settings <config.1.txt >config.txt
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DEFAULT_TARGET = debug
+ifndef TARGET
+TARGET = $(DEFAULT_TARGET) ###MAKE_TARGET:
+# when want to change target run this first:
+# make -B TARGET=target_name makefile
+endif
+PERL = perl
+
+###MAKE_CC:    CC=gcc
+###MAKE_CF:    CF=-g -Wall
+
+###MAKE_CHMOD: CHMOD = chmod
+###MAKE_CP:    CP    = cp
+###MAKE_MKDIR: MKDIR = mkdir
+###MAKE_PERL:  PERL  = perl
+###MAKE_RM:    RM    = rm
+###MAKE_SUDO:  SUDO  = sudo
+
+###MAKE_BIN_PATH:  BIN_PATH  = /botm/bin/bsta
+###MAKE_DATA_PATH: DATA_PATH = /botm/data/bsta
+###MAKE_LIB_PATH:  LIB_PATH  = /botm/lib/bsta
+###MAKE_LOG_PATH:  LOG_PATH  = /botm/log/bsta
+###MAKE_TMP_PATH:  TMP_PATH  = /botm/tmp/bsta
+###MAKE_WWW_PATH:  WWW_PATH  = /botm/www/1190/bsta
+
+###MAKE_CONF: CONF = /botm/etc/www/conf/1190/bsta.conf
+###MAKE_CRON: CRON = /etc/cron.d/bsta
+
+CONFIGFILE = settings-$(TARGET).txt settings.txt
+DEFAULT_CONFIGFILE = settings-$(DEFAULT_TARGET).txt settings.txt
+
+# The configuration tool
+CONFIGURE_CMD = $(PERL) ./configure.pl $(CONFIGFILE)
+
+# keep these 2 lists in the same order!:
+GENERATE_FROM=\
+2words.1.pl\
+attach.1.pl\
+bbcode.1.pl\
+bsta.1.conf\
+bsta.1.cron\
+bsta_lib.1.pm\
+chat.1.pl\
+frame.1.pl\
+goto.1.pl\
+info.1.pl\
+oldlogs.1.pl\
+ong.1.pl\
+reset.1.pl\
+updlist.1.pl\
+viewer.1.pl
+
+TO_GENERATE=\
+2words.pl\
+attach.pl\
+bbcode.pl\
+bsta.conf\
+bsta.cron\
+bsta_lib.pm\
+chat.pl\
+frame.pl\
+goto.pl\
+info.pl\
+oldlogs.pl\
+ong.pl\
+reset.pl\
+updlist.pl\
+viewer.pl
+
+DIR=\
+$(BIN_PATH)\
+$(DATA_PATH)\
+$(LIB_PATH)\
+$(LOG_PATH)\
+$(TMP_PATH)\
+$(WWW_PATH)
+
+HIDDEN_DIR=\
+$(DATA_PATH)\
+$(TMP_PATH)
+
+SETUID=\
+2words\
+bbcode\
+attach\
+chat\
+frame\
+goto\
+info\
+viewer
+
+EXEC=\
+2words.pl\
+attach.pl\
+bbcode.pl\
+chat.pl\
+frame.pl\
+goto.pl\
+info.pl\
+oldlogs.pl\
+ong.pl\
+reset.pl\
+updlist.pl\
+viewer.pl
+
+PERL_WRAP_EXEC=\
+2words\
+attach\
+bbcode\
+chat\
+frame\
+goto\
+info\
+viewer
+
+BIN=\
+$(EXEC)\
+$(PERL_WRAP_EXEC)
+
+LIB=\
+bsta_lib.pm
+
+WWW=\
+botmlogo.png\
+bsta.css\
+timer.js
+
+
+all: $(BIN) setuid exec
+
+makefile: makefile.1.mak $(CONFIGFILE) configure.pl
+       $(CONFIGURE_CMD) < makefile.1.mak > makefile
+
+configure.pl: $(CONFIGFILE) config/configure.1.pl
+       $(PERL) config/configure.1.pl target=direct settings-$(TARGET).txt config/settings.txt --in config/configure.1.pl --out configure.pl
+
+$(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE) configure.pl
+       $(CONFIGURE_CMD) --in $(GENERATE_FROM) --out $(TO_GENERATE)
+
+$(PERL_WRAP_EXEC): %: exec/exec.c exec/settings.txt configure.pl
+       $(PERL) configure.pl path=$(BIN_PATH) target=$*.pl io_path=$(LOG_PATH) stderr=$*-stderr.log exec/settings.txt --in exec/exec.c --out $*.c
+       $(CC) $(CF) -o $@ $*.c
+
+exec: $(EXEC)
+       $(CHMOD) +x $(EXEC)
+
+wrap_exec: 
+       
+setuid: $(SETUID)
+       $(CHMOD) u+s,g+s $(SETUID)
+
+
+mktree:
+       $(MKDIR) -p $(DIR)
+       $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR)
+
+ifdef BIN_PATH
+cp_bin: $(BIN) setuid exec | mktree
+       $(RM) -f $(BIN_PATH)/*
+       $(CP) -p $(BIN) $(BIN_PATH)
+endif
+
+ifdef LIB_PATH
+cp_lib: $(LIB) | mktree
+       $(RM) -f $(LIB_PATH)/*
+       $(CP) -p $(LIB) $(LIB_PATH)
+endif
+
+cp_www:
+       $(CP) -p $(WWW) $(WWW_PATH)
+
+cp_conf: bsta.conf
+       $(CP) bsta.conf $(CONF)
+
+cp_cron: bsta.cron
+       $(SUDO) $(CP) bsta.cron $(CRON)
+
+install: all cp_bin cp_lib cp_www cp_conf cp_cron
+
+clean:
+       $(RM) -f configure.pl $(TO_GENERATE) $(PERL_WRAP_EXEC) $(PERL_WRAP_EXEC:=.c)
+       $(PERL) config/configure.1.pl $(DEFAULT_CONFIGFILE) < makefile.1.mak > makefile
+
+PHONY: all clean install setuid exec mktree cp_bin cp_lib cp_www cp_conf cp_cron
index 67fca652033fbc88d8c466726fe145de8554457a..d7151b71cacc98fbf78eba2b1061bc9a6bb169ff 100644 (file)
@@ -1,32 +1,32 @@
-###PERL;
+###RUN_PERL: #!/usr/bin/perl
 
 # oldlogs is generated from oldlogs.1.pl.
-# 02.01.2016
 #
 # This script renames log files if they are big enough.
 # Compresses or removes older log files.
 #
-#    Copyright (C) 2015-2016  Balthasar Szczepański
+# Copyright (C) 2015, 2016, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-###GZIP_PATH;
-###LOG_PATH;
-###LOG_SIZE_LIMIT;
-###LOGS_TOTAL;
-###LOGS_UNCOMPRESSED;
+###PERL_GZIP:              GZIP              = gzip
+###PERL_LOG_PATH:          LOG_PATH          = /botm/log/bsta/
+###PERL_LOG_SIZE_LIMIT:    LOG_SIZE_LIMIT    = 65536
+###PERL_LOGS_UNCOMPRESSED: LOGS_UNCOMPRESSED = 2
+###PERL_LOGS_TOTAL:        LOGS_TOTAL        = 10
+
 
 if ($ARGV[0] ne '') {
        $log_path = $ARGV[0];
@@ -79,7 +79,7 @@ sub movelog {
        my $thispath;
        my $nextpath;
        my $nextnumber=$number+1;
-       my @gzip_arg = (GZIP_PATH, '-q', '-9','-f');
+       my @gzip_arg = (GZIP, '-q', '-9','-f');
        
        $thispath = $path.(($number != 0)?'.'.$number.($gz?'.gz':''):'');
        if ($number == $logs_total) {
index 8da5522c916b0a5c66eb07957f25d8b270b5e677..1eeb352697786e5e531f09c0c45d4730639538bf 100644 (file)
--- a/ong.1.pl
+++ b/ong.1.pl
@@ -1,37 +1,36 @@
-###PERL;
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # ong.pl is generated from ong.1.pl.
-# 29.06.2017
 #
 # The ONG bot
 #
-#    Copyright (C) 2016-2017  Balthasar Szczepański
+# Copyright (C) 2016, 2017, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 use bsta_lib qw(entityencode readdatafile writedatafile urlencode);
 use File::Copy;
 
-###DATA_PATH;
-###WWW_PATH;
-###SETTINGS_PATH;
-###STATE_PATH;
-###DEFAULT_PATH;
-###LIST_PATH;
+###PERL_DATA_PATH:          DATA_PATH    = /botm/data/bsta
+###PERL_DATA_DEFAULT_PATH:  DATA_DEFAULT_PATH = /botm/data/bsta/default
+###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
+###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
+###PERL_WWW_PATH:           WWW_PATH           = /botm/www/1190/bsta/
+###PERL_DATA_LIST_PATH:     DATA_LIST_PATH     = /botm/data/bsta/list
 
 my %framedata;
 my %nextframedata;
@@ -58,10 +57,10 @@ $ongtime = int($time / 3600) * 3600;
 print $time.' - '.$ongtime."\n";
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
 
-if (open ($statefile,"+<",STATE_PATH)){
+if (open ($statefile,"+<",DATA_STATE_PATH)){
        if (flock($statefile,2)) {
                %state=readdatafile($statefile);
                $ongstate=int($state{'state'});
@@ -71,7 +70,7 @@ if (open ($statefile,"+<",STATE_PATH)){
                        print 'ongtime: '.$nextong."\n";
                        
                        if($ongtime >= $nextong) {
-                               %settings=readdatafile(SETTINGS_PATH);
+                               %settings=readdatafile(DATA_SETTINGS_PATH);
                                $static=int($settings{'ongtime'});
                                $dynamic=int($settings{'dynamicongtime'});
                                $last=int($settings{'last'});
@@ -95,15 +94,15 @@ if (open ($statefile,"+<",STATE_PATH)){
                                if($ongstate == 2) {
                                        print 'next frame: '.$frame."\n";
                                        %framedata=readdatafile(DATA_PATH.$frame);
-                                       %default=readdatafile(DEFAULT_PATH);
-                                       %gotolist=readdatafile(LIST_PATH);
+                                       %default=readdatafile(DATA_DEFAULT_PATH);
+                                       %gotolist=readdatafile(DATA_LIST_PATH);
                                        
                                        $framedata{'ongtime'}=$time;
                                        $framedata{'timer'}=$dynamic;
                                        $gotolist{'title-'.$frame}=$framedata{'title'};
                                        $gotolist{'ongtime-'.$frame}=$framedata{'ongtime'};
                                        writedatafile(DATA_PATH.$frame,%framedata);
-                                       writedatafile(LIST_PATH,%gotolist);
+                                       writedatafile(DATA_LIST_PATH,%gotolist);
                                        
                                        foreach my $ind (keys %default) {
                                                unless(defined($framedata{$ind})){
diff --git a/ongtimes.pl b/ongtimes.pl
deleted file mode 100755 (executable)
index e44ff45..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/perl
-# 01.02.2017
-
-use strict;
-#use warnings;
-use lib '/eizm/lib/bstatest/';
-use bsta_lib qw(readdatafile writedatafile);
-
-use constant DATA_PATH          => '/eizm/data/bsta/';
-use constant SETTINGS_PATH      => '/eizm/data/bsta/settings';
-use constant STATE_PATH         => '/eizm/data/bsta/state';
-
-my %framedata;
-my %settings;
-my %state;
-
-my $last;
-my $ongtime;
-my @timetab;
-my $timer;
-my $prevongtime;
-my $cleantimer;
-my $nicetime;
-
-%state=readdatafile(STATE_PATH);
-$last=int($state{'last'});
-
-for (my $f=$last; $f>=0; --$f) {
-       %framedata=readdatafile(DATA_PATH.$f);\r $ongtime=int($framedata{'ongtime'});
-       @timetab=gmtime($ongtime);
-       $nicetime=sprintf('UTC %04d.%02d.%02d %02d:%02d:%02d',$timetab[5]+1900,$timetab[4]+1,$timetab[3],$timetab[2],$timetab[1],$timetab[0]);
-       
-       if($framedata{'timer'}ne'') {
-               $timer=int($framedata{'timer'});
-               $cleantimer=$timer;
-       }
-       # elsif($f<$last) {
-               # $timer=($prevongtime-$ongtime)/3600;
-               # $cleantimer=0-int($timer+0.5);
-               # $framedata{'timer'}=0-$cleantimer;
-               # writedatafile(DATA_PATH.$f,%framedata);
-       # }
-       
-       print "$f\t$nicetime\t$ongtime\t\t$timer\n";
-       $prevongtime=$ongtime;
-}
-for (my $f=0; $f<=$last; ++$f) {
-       
-}
\ No newline at end of file
index 353814bba7efb0f4adc296df2ba65cc44b610659..998096a0f25be5873db451e7dc880386a3ff3343 100644 (file)
@@ -1,39 +1,41 @@
-###PERL;
-#
-# /bsta/2words
+###RUN_PERL: #!/usr/bin/perl
+
 # reset is generated from reset.1.pl.
-# 26.03.2018
 #
 # Reset BSTA state
 #
-#    Copyright (C) 2016 - 2018  Balthasar Szczepański
+# Copyright (C) 2016 - 2018, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 use bsta_lib qw(writedatafile);
 
-###STORY_PATH;
-###WEBSITE;
-###CGI_PATH;
-###INDEX_PATH;
-###INTF_DATE;
-###STATE_PATH;
-###COIN_DATE;
-###CHAT_PATH;
+###PERL_CGI_PATH:           CGI_PATH           = /bsta/
+
+###PERL_DATA_CHAT_PATH:     DATA_CHAT_PATH     = /botm/data/bsta/chat
+###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
+###PERL_DATA_STORY_PATH:    DATA_STORY_PATH    = /botm/data/bsta/story
+
+###PERL_WWW_INDEX_PATH:     WWW_INDEX_PATH     = /botm/www/1190/bsta/index.htm
+
+###PERL_WEBSITE:            WEBSITE            = 1190.bicyclesonthemoon.info
+
+###PERL_COIN_DATE:          COIN_DATE          = 13-Nov-2016 22:15
+###PERL_INTF_DATE:          INTF_DATE          = 28-Sep-2016 20:34
 
 my %story = (
        'id'      => '0',
@@ -59,13 +61,13 @@ my %chat = (
 );
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
-writedatafile(STATE_PATH,%state);
-writedatafile(STORY_PATH,%story);
-writedatafile(CHAT_PATH,%chat);
+writedatafile(DATA_STATE_PATH,%state);
+writedatafile(DATA_STORY_PATH,%story);
+writedatafile(DATA_CHAT_PATH,%chat);
 
-writeindex(INDEX_PATH);
+writeindex(WWW_INDEX_PATH);
 
 #function borrowed from 2words.pl - keep consistent!
 sub writeindex {
diff --git a/settings b/settings
deleted file mode 100644 (file)
index 65579ae..0000000
--- a/settings
+++ /dev/null
@@ -1,64 +0,0 @@
-# settings
-# 19.11.2016
-#
-# In this file are defined values specific for the user's system
-# 
-#    Copyright (C) 2016  Balthasar Szczepański
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#all directory paths must end with '/' and must already exist.
-
-bin_path  = /eizm/bin/bsta/  #Where the software will be located
-data_path = /eizm/data/bsta/ #where the software  will remember data; subdir:
-                                  #group, groupsettings
-log_path  = /eizm/log/bsta/  #where the software will remember data
-tmp_path  = /eizm/tmp/bsta/  #for temporary fies
-www_path  = /eizm/www/time/bsta/  #for the www server
-lib_path  = /eizm/lib/bsta/
-cgi_path  = /bsta/
-
-path    = /usr/local/bin:/usr/bin:/bin #The path environment variable. Must be
-                                       #overwritten if SETUID. Otherwise
-                                       #launching programs may fail. (Perl
-                                       #security...)
-
-
-#paths to software
-perl    = /usr/bin/perl
-chmod   = /bin/chmod
-cp      = /bin/cp
-mv      = /bin/mv
-rm      = /bin/rm
-gcc     = /usr/bin/gcc
-gzip    = /bin/gzip
-c_flags = -g -Wall
-
-log_size_limit    = 65536 # How big can a log file be
-logs_uncompressed =     2 # How many uncompressed old logs to keep
-logs_total        =    10 # How many old logs to keep 
-
-rm_access_crontab = 10 2 * * * # How often to remove leftover unlock info.
-oldlogs_crontab   =  0 2 * * * # How often to deal with old logs
-bot_crontab       = 20 2 * * * # How often to run the bot
-
-website = 1190.bicyclesonthemoon.info
-website_name = Bicycles on the Moon
-favicon_path = /img/favicon.png
-intf_date = 28-Sep-2016 20:34
-coin_date = 13-Nov-2016 22:15
-
-story_length = 16
-firstpage_length = 4
-page_length = 16
diff --git a/settings-again b/settings-again
deleted file mode 100644 (file)
index ee732f9..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-# settings
-# 19.11.2016
-#
-# In this file are defined values specific for the user's system
-# 
-#    Copyright (C) 2016  Balthasar Szczepański
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#all directory paths must end with '/' and must already exist.
-
-bin_path  = /eizm/bin/bstagain/  #Where the software will be located
-data_path = /eizm/data/bstagain/ #where the software  will remember data; subdir:
-                                  #group, groupsettings
-log_path  = /eizm/log/bstagain/  #where the software will remember data
-tmp_path  = /eizm/tmp/bstagain/  #for temporary fies
-www_path  = /eizm/www/time/bstagain/  #for the www server
-lib_path  = /eizm/lib/bstagain/
-cgi_path  = /bstagain/
-
-path    = /usr/local/bin:/usr/bin:/bin #The path environment variable. Must be
-                                       #overwritten if SETUID. Otherwise
-                                       #launching programs may fail. (Perl
-                                       #security...)
-
-
-#paths to software
-perl    = /usr/bin/perl
-chmod   = /bin/chmod
-cp      = /bin/cp
-mv      = /bin/mv
-rm      = /bin/rm
-gcc     = /usr/bin/gcc
-gzip    = /bin/gzip
-c_flags = -g -Wall
-
-log_size_limit    = 65536 # How big can a log file be
-logs_uncompressed =     2 # How many uncompressed old logs to keep
-logs_total        =    10 # How many old logs to keep 
-
-rm_access_crontab = 10 2 * * * # How often to remove leftover unlock info.
-oldlogs_crontab   =  0 2 * * * # How often to deal with old logs
-bot_crontab       = 20 2 * * * # How often to run the bot
-
-website = 1190.bicyclesonthemoon.info
-website_name = Bicycles on the Moon
-favicon_path = /img/favicon.png
-intf_date = 28-Sep-2016 20:34
-coin_date = 13-Nov-2016 22:15
-
-story_length = 16
-firstpage_length = 4
-page_length = 16
diff --git a/settings-again.txt b/settings-again.txt
new file mode 100644 (file)
index 0000000..43b314b
--- /dev/null
@@ -0,0 +1,84 @@
+# In this file are defined values specific for the user's system
+
+
+# target name. settings file (THIS FILE) is "settings-TARGET_NAME.txt"
+# where TARGET_NAME is the value
+target: again
+
+name: bstagain
+
+
+# Where the software will be located
+bin_path: /botm/bin/bstagain
+
+# where the libraries will be located
+lib_path: /botm/lib/bstagain
+
+# where the software  will remember data
+data_path: /botm/data/bstagain
+
+#where the software will record logs
+log_path: /botm/log/bstagain
+
+#for temporary fies
+tmp_path: /botm/tmp/bstagain
+
+#for the www server
+www_path : /botm/www/1190/bstagain
+cgi_path : /bstagain
+conf_path: /botm/etc/www/conf/1190
+
+#cron files directory
+cron_path: /etc/cron.d
+
+path: /usr/local/bin:/usr/bin:/bin
+# The path environment variable. Must be overwritten if SETUID.
+# Otherwise launching programs may fail.
+# (Perl security...)
+
+
+#paths to software
+
+chmod: /usr/bin/chmod
+cp   : /usr/bin/cp
+gzip : /usr/bin/gzip
+mkdir: /usr/bin/mkdir
+mv   : /usr/bin/mv
+perl : /usr/bin/perl
+rm   : /usr/bin/rm
+sudo : /usr/bin/sudo
+
+CC: /usr/bin/gcc
+CF: -g -Wall
+
+
+# How big can a log file be
+log_size_limit: 65536
+
+# How many uncompressed old logs to keep
+logs_uncompressed: 2
+
+# How many old logs to keep 
+logs_total: 10
+
+# When to deal with old logs
+oldlogs_schedule: 1 4 * * *
+
+# When to run the  ONG bot
+ong_schedule: 0 * * * *
+
+# When to RESET EVERYTHING
+reset_schedule: 33 4 * * *
+
+cron_user: b
+
+
+website     : 1190.bicyclesonthemoon.info
+website_name: Bicycles on the Moon
+favicon_path: /img/favicon.png
+intf_date   : 28-Sep-2016 20:34
+coin_date   : 13-Nov-2016 22:15
+
+story_length    : 16
+firstpage_length: 4
+page_length     : 16
diff --git a/settings-bsta.txt b/settings-bsta.txt
new file mode 100644 (file)
index 0000000..ac27eae
--- /dev/null
@@ -0,0 +1,84 @@
+# In this file are defined values specific for the user's system
+
+
+# target name. settings file (THIS FILE) is "settings-TARGET_NAME.txt"
+# where TARGET_NAME is the value
+target: bsta
+
+name: bsta
+
+
+# Where the software will be located
+bin_path: /botm/bin/bsta
+
+# where the libraries will be located
+lib_path: /botm/lib/bsta
+
+# where the software  will remember data
+data_path: /botm/data/bsta
+
+#where the software will record logs
+log_path: /botm/log/bsta
+
+#for temporary fies
+tmp_path: /botm/tmp/bsta
+
+#for the www server
+www_path : /botm/www/1190/bsta
+cgi_path : /bsta
+conf_path: /botm/etc/www/conf/1190
+
+#cron files directory
+cron_path: /etc/cron.d
+
+path: /usr/local/bin:/usr/bin:/bin
+# The path environment variable. Must be overwritten if SETUID.
+# Otherwise launching programs may fail.
+# (Perl security...)
+
+
+#paths to software
+
+chmod: /usr/bin/chmod
+cp   : /usr/bin/cp
+gzip : /usr/bin/gzip
+mkdir: /usr/bin/mkdir
+mv   : /usr/bin/mv
+perl : /usr/bin/perl
+rm   : /usr/bin/rm
+sudo : /usr/bin/sudo
+
+CC: /usr/bin/gcc
+CF: -g -Wall
+
+
+# How big can a log file be
+log_size_limit: 65536
+
+# How many uncompressed old logs to keep
+logs_uncompressed: 2
+
+# How many old logs to keep 
+logs_total: 10
+
+# When to deal with old logs
+oldlogs_schedule: 0 4 * * *
+
+# When to run the  ONG bot
+ong_schedule: 0 * * * *
+
+# When to RESET EVERYTHING
+reset_schedule: #33 4 * * *
+
+cron_user: b
+
+
+website     : 1190.bicyclesonthemoon.info
+website_name: Bicycles on the Moon
+favicon_path: /img/favicon.png
+intf_date   : 28-Sep-2016 20:34
+coin_date   : 13-Nov-2016 22:15
+
+story_length    : 16
+firstpage_length: 4
+page_length     : 16
diff --git a/settings-debug.txt b/settings-debug.txt
new file mode 100644 (file)
index 0000000..7a8ed15
--- /dev/null
@@ -0,0 +1,84 @@
+# In this file are defined values specific for the user's system
+
+
+# target name. settings file (THIS FILE) is "settings-TARGET_NAME.txt"
+# where TARGET_NAME is the value
+target: debug
+
+name: test-bsta
+
+
+# Where the software will be located
+bin_path: /botm/bin/test-bsta
+
+# where the libraries will be located
+lib_path: /botm/lib/test-bsta
+
+# where the software  will remember data
+data_path: /botm/data/test-bsta
+
+#where the software will record logs
+log_path: /botm/log/test-bsta
+
+#for temporary fies
+tmp_path: /botm/tmp/test-bsta
+
+#for the www server
+www_path : /botm/www/1190/bstatest
+cgi_path : /bstatest
+conf_path: /botm/etc/www/conf/1190
+
+#cron files directory
+cron_path: /etc/cron.d
+
+path: /usr/local/bin:/usr/bin:/bin
+# The path environment variable. Must be overwritten if SETUID.
+# Otherwise launching programs may fail.
+# (Perl security...)
+
+
+#paths to software
+
+chmod: /usr/bin/chmod
+cp   : /usr/bin/cp
+gzip : /usr/bin/gzip
+mkdir: /usr/bin/mkdir
+mv   : /usr/bin/mv
+perl : /usr/bin/perl
+rm   : /usr/bin/rm
+sudo : /usr/bin/sudo
+
+CC: /usr/bin/gcc
+CF: -g -Wall
+
+
+# How big can a log file be
+log_size_limit: 65536
+
+# How many uncompressed old logs to keep
+logs_uncompressed: 2
+
+# How many old logs to keep 
+logs_total: 10
+
+# When to deal with old logs
+oldlogs_schedule: #0 4 * * *
+
+# When to run the  ONG bot
+ong_schedule: #0 * * * *
+
+# When to RESET EVERYTHING
+reset_schedule: #33 4 * * *
+
+cron_user: b
+
+
+website     : 1190.bicyclesonthemoon.info
+website_name: Bicycles on the Moon
+favicon_path: /img/favicon.png
+intf_date   : 28-Sep-2016 20:34
+coin_date   : 13-Nov-2016 22:15
+
+story_length    : 16
+firstpage_length: 4
+page_length     : 16
diff --git a/settings-tbst.txt b/settings-tbst.txt
new file mode 100644 (file)
index 0000000..ca7d30b
--- /dev/null
@@ -0,0 +1,84 @@
+# In this file are defined values specific for the user's system
+
+
+# target name. settings file (THIS FILE) is "settings-TARGET_NAME.txt"
+# where TARGET_NAME is the value
+target: tbst
+
+name: tbst
+
+
+# Where the software will be located
+bin_path: /botm/bin/tbst
+
+# where the libraries will be located
+lib_path: /botm/lib/tbst
+
+# where the software  will remember data
+data_path: /botm/data/tbst
+
+#where the software will record logs
+log_path: /botm/log/tbst
+
+#for temporary fies
+tmp_path: /botm/tmp/tbst
+
+#for the www server
+www_path : /botm/www/1190/tbst
+cgi_path : /tbst
+conf_path: /botm/etc/www/conf/1190
+
+#cron files directory
+cron_path: /etc/cron.d
+
+path: /usr/local/bin:/usr/bin:/bin
+# The path environment variable. Must be overwritten if SETUID.
+# Otherwise launching programs may fail.
+# (Perl security...)
+
+
+#paths to software
+
+chmod: /usr/bin/chmod
+cp   : /usr/bin/cp
+gzip : /usr/bin/gzip
+mkdir: /usr/bin/mkdir
+mv   : /usr/bin/mv
+perl : /usr/bin/perl
+rm   : /usr/bin/rm
+sudo : /usr/bin/sudo
+
+CC: /usr/bin/gcc
+CF: -g -Wall
+
+
+# How big can a log file be
+log_size_limit: 65536
+
+# How many uncompressed old logs to keep
+logs_uncompressed: 2
+
+# How many old logs to keep 
+logs_total: 10
+
+# When to deal with old logs
+oldlogs_schedule: #2 4 * * *
+
+# When to run the  ONG bot
+ong_schedule: #0 * * * *
+
+# When to RESET EVERYTHING
+reset_schedule: #33 4 * * *
+
+cron_user: b
+
+
+website     : 1190.bicyclesonthemoon.info
+website_name: Bicycles on the Moon
+favicon_path: /img/favicon.png
+intf_date   : 28-Sep-2016 20:34
+coin_date   : 13-Nov-2016 22:15
+
+story_length    : 16
+firstpage_length: 4
+page_length     : 16
diff --git a/settings-test b/settings-test
deleted file mode 100644 (file)
index 93bb2de..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-# settings
-# 19.11.2016
-#
-# In this file are defined values specific for the user's system
-# 
-#    Copyright (C) 2016  Balthasar Szczepański
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#all directory paths must end with '/' and must already exist.
-
-bin_path  = /eizm/bin/bstatest/  #Where the software will be located
-data_path = /eizm/data/bstatest/ #where the software  will remember data; subdir:
-                                  #group, groupsettings
-log_path  = /eizm/log/bstatest/  #where the software will remember data
-tmp_path  = /eizm/tmp/bstatest/  #for temporary fies
-www_path  = /eizm/www/time/tbst/  #for the www server
-lib_path  = /eizm/lib/bstatest/
-cgi_path  = /tbst/
-
-path    = /usr/local/bin:/usr/bin:/bin #The path environment variable. Must be
-                                       #overwritten if SETUID. Otherwise
-                                       #launching programs may fail. (Perl
-                                       #security...)
-
-
-#paths to software
-perl    = /usr/bin/perl
-chmod   = /bin/chmod
-cp      = /bin/cp
-mv      = /bin/mv
-rm      = /bin/rm
-gcc     = /usr/bin/gcc
-gzip    = /bin/gzip
-c_flags = -g -Wall
-
-log_size_limit    = 65536 # How big can a log file be
-logs_uncompressed =     2 # How many uncompressed old logs to keep
-logs_total        =    10 # How many old logs to keep 
-
-rm_access_crontab = 10 2 * * * # How often to remove leftover unlock info.
-oldlogs_crontab   =  0 2 * * * # How often to deal with old logs
-bot_crontab       = 20 2 * * * # How often to run the bot
-
-website = 1190.bicyclesonthemoon.info
-website_name = Bicycles on the Moon
-favicon_path = /img/favicon.png
-intf_date = 28-Sep-2016 20:34
-coin_date = 13-Nov-2016 22:15
-
-story_length = 16
-firstpage_length = 4
-page_length = 16
diff --git a/settings.txt b/settings.txt
new file mode 100644 (file)
index 0000000..d52dee8
--- /dev/null
@@ -0,0 +1,189 @@
+# settings.txt
+# 
+# Copyright (C) 2023  Balthasar Szczepański
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+_version: 1.0.0
+
+_SHEBANG: #!$0
+
+_PERL_STR: '@_ESCAPE($0,')'
+_PERL_USE_2: use $0 $1;
+_PERL_CONSTANT: use constant $0 => $1;
+_PERL_CONSTANT_STR: @_PERL_CONSTANT($0,@_PERL_STR($1))
+_PERL_OUR: our $0 = $1;
+_PERL_OUR_STR: @_PERL_OUR(\$$0,@_PERL_STR($1))
+
+
+_bin_path           = @_PATH( $bin_path,         )
+_bin_2words_path    = @_PATH( $bin_path, 2words  )
+_bin_attach_path    = @_PATH( $bin_path, attach  )
+_bin_bbcode_path    = @_PATH( $bin_path, bbcode  )
+_bin_coin_path      = @_PATH( $bin_path, chat    )
+_bin_frame_path     = @_PATH( $bin_path, frame   )
+_bin_goto_path      = @_PATH( $bin_path, goto    )
+_bin_info_path      = @_PATH( $bin_path, info    )
+_bin_oldlogs_path   = @_PATH( $bin_path, oldlogs )
+_bin_ong_path       = @_PATH( $bin_path, ong.pl  )
+_bin_reset_path     = @_PATH( $bin_path, reset.pl)
+_bin_viewer_path    = @_PATH( $bin_path, viewer  )
+
+_cgi_path           = @_PATH( $cgi_path,             )
+_cgi_2words_path    = @_PATH( $cgi_path, 2words      )
+_cgi_attach_path    = @_PATH( $cgi_path, a           )
+_cgi_bbcode_path    = @_PATH( $cgi_path, b           )
+_cgi_coin_path      = @_PATH( $cgi_path, coin        )
+_cgi_css_path       = @_PATH( $cgi_path, bsta.css    )
+_cgi_frame_path     = @_PATH( $cgi_path, f           )
+_cgi_goto_path      = @_PATH( $cgi_path, g           )
+_cgi_info_path      = @_PATH( $cgi_path, i           )
+_cgi_logo_path      = @_PATH( $cgi_path, botmlogo.png)
+_cgi_timer_path     = @_PATH( $cgi_path, timer.js    )
+_cgi_viewer_path    = @_PATH( $cgi_path, v           )
+
+_data_path          = @_PATH( $data_path,            )
+_data_chat_path     = @_PATH( $data_path, chat       )
+_data_coin_path     = @_PATH( $data_path, coincidence)
+_data_default_path  = @_PATH( $data_path, default    )
+_data_list_path     = @_PATH( $data_path, list       )
+_data_noaccess_path = @_PATH( $data_path, noaccess   )
+_data_settings_path = @_PATH( $data_path, settings   )
+_data_state_path    = @_PATH( $data_path, state      )
+_data_story_path    = @_PATH( $data_path, story      )
+
+_log_path           = @_PATH( $log_path,        )
+_log_ong_path       = @_PATH( $log_path, ong.log)
+
+_www_path           = @_PATH( $www_path,          )
+_www_index_path     = @_PATH( $www_path, index.htm)
+
+_conf_path = @_PATH($conf_path, $name\.conf)
+_cron_path = @_PATH($cron_path, $name)
+
+
+CONF_BIN        = $_bin_path
+CONF_BIN_2WORDS = $_bin_2words_path
+CONF_BIN_ATTACH = $_bin_attach_path
+CONF_BIN_BBCODE = $_bin_bbcode_path
+CONF_BIN_COIN   = $_bin_coin_path
+CONF_BIN_FRAME  = $_bin_frame_path
+CONF_BIN_GOTO   = $_bin_goto_path
+CONF_BIN_INFO   = $_bin_info_path
+CONF_BIN_VIEWER = $_bin_viewer_path
+
+CONF_CGI_2WORDS = $_cgi_2words_path
+CONF_CGI_ATTACH = $_cgi_attach_path
+CONF_CGI_BBCODE = $_cgi_bbcode_path
+CONF_CGI_COIN   = $_cgi_coin_path
+CONF_CGI_FRAME  = $_cgi_frame_path
+CONF_CGI_GOTO   = $_cgi_goto_path
+CONF_CGI_INFO   = $_cgi_info_path
+CONF_CGI_VIEWER = $_cgi_viewer_path
+
+
+CRON_ONG     = $_bin_ong_path
+CRON_OLDLOGS = $_bin_oldlogs_path
+CRON_RESET   = $_bin_reset_path
+
+CRON_USER    = $cron_user
+
+CRON_OLDLOGS_SCHEDULE = $oldlogs_schedule
+CRON_ONG_SCHEDULE     = $ong_schedule
+CRON_RESET_SCHEDULE   = $reset_schedule
+
+CRON_LOG_SIZE_LIMIT    = $log_size_limit
+CRON_LOGS_UNCOMPRESSED = $logs_uncompressed
+CRON_LOGS_TOTAL        = $logs_total
+
+CRON_LOG      = $_log_path
+CRON_ONG_LOG = $_log_ong_path
+
+
+MAKE_TARGET = TARGET = $target
+
+MAKE_CHMOD  = CHMOD=$chmod
+MAKE_CP     = CP   =$cp
+MAKE_MKDIR  = MKDIR=$mkdir
+MAKE_PERL   = PERL =$perl
+MAKE_RM     = RM   =$rm
+MAKE_SUDO   = SUDO =$sudo
+
+MAKE_CC    = CC   =$CC
+MAKE_CF    = CF   =$CF
+
+MAKE_CONF = CONF = $_conf_path
+MAKE_CRON = CRON = $_cron_path
+
+MAKE_BIN_PATH  = BIN_PATH  = $bin_path
+MAKE_DATA_PATH = DATA_PATH = $data_path
+MAKE_LIB_PATH  = LIB_PATH  = $lib_path
+MAKE_LOG_PATH  = LOG_PATH  = $log_path
+MAKE_TMP_PATH  = TMP_PATH  = $tmp_path
+MAKE_WWW_PATH  = WWW_PATH  = $www_path
+
+
+PERL_LIB = @_PERL_USE_2(lib, @_PERL_STR($lib_path))
+
+PERL_SET_PATH = \$ENV{'PATH'} = @_PERL_STR($path);
+
+PERL_EXPORT_VERSION    = @_PERL_OUR_STR( VERSION, $_version)
+
+PERL_CGI_PATH           = @_PERL_CONSTANT_STR( CGI_PATH       , $_cgi_path       )
+PERL_CGI_2WORDS_PATH    = @_PERL_CONSTANT_STR( CGI_2WORDS_PATH, $_cgi_2words_path)
+PERL_CGI_ATTACH_PATH    = @_PERL_CONSTANT_STR( CGI_ATTACH_PATH, $_cgi_attach_path)
+PERL_CGI_BBCODE_PATH    = @_PERL_CONSTANT_STR( CGI_BBCODE_PATH, $_cgi_bbcode_path)
+PERL_CGI_COIN_PATH      = @_PERL_CONSTANT_STR( CGI_COIN_PATH  , $_cgi_coin_path  )
+PERL_CGI_CSS_PATH       = @_PERL_CONSTANT_STR( CGI_CSS_PATH   , $_cgi_css_path   )
+PERL_CGI_FRAME_PATH     = @_PERL_CONSTANT_STR( CGI_FRAME_PATH , $_cgi_frame_path )
+PERL_CGI_GOTO_PATH      = @_PERL_CONSTANT_STR( CGI_GOTO_PATH  , $_cgi_goto_path  )
+PERL_CGI_INFO_PATH      = @_PERL_CONSTANT_STR( CGI_INFO_PATH  , $_cgi_info_path  )
+PERL_CGI_LOGO_PATH      = @_PERL_CONSTANT_STR( CGI_LOGO_PATH  , $_cgi_logo_path  )
+PERL_CGI_TIMER_PATH     = @_PERL_CONSTANT_STR( CGI_TIMER_PATH , $_cgi_timer_path )
+PERL_CGI_VIEWER_PATH    = @_PERL_CONSTANT_STR( CGI_VIEWER_PATH, $_cgi_viewer_path)
+
+PERL_DATA_PATH          = @_PERL_CONSTANT_STR( DATA_PATH         , $_data_path         )
+PERL_DATA_CHAT_PATH     = @_PERL_CONSTANT_STR( DATA_CHAT_PATH    , $_data_chat_path    )
+PERL_DATA_COIN_PATH     = @_PERL_CONSTANT_STR( DATA_COIN_PATH    , $_data_coin_path    )
+PERL_DATA_DEFAULT_PATH  = @_PERL_CONSTANT_STR( DATA_DEFAULT_PATH , $_data_default_path )
+PERL_DATA_LIST_PATH     = @_PERL_CONSTANT_STR( DATA_LIST_PATH    , $_data_list_path    )
+PERL_DATA_NOACCESS_PATH = @_PERL_CONSTANT_STR( DATA_NOACCESS_PATH, $_data_noaccess_path)
+PERL_DATA_SETTINGS_PATH = @_PERL_CONSTANT_STR( DATA_SETTINGS_PATH, $_data_settings_path)
+PERL_DATA_STATE_PATH    = @_PERL_CONSTANT_STR( DATA_STATE_PATH   , $_data_state_path   )
+PERL_DATA_STORY_PATH    = @_PERL_CONSTANT_STR( DATA_STORY_PATH   , $_data_story_path   )
+
+PERL_LOG_PATH           = @_PERL_CONSTANT_STR( LOG_PATH, $_log_path)
+
+PERL_WWW_PATH           = @_PERL_CONSTANT_STR( WWW_PATH      , $_www_path      )
+PERL_WWW_INDEX_PATH     = @_PERL_CONSTANT_STR( WWW_INDEX_PATH, $_www_index_path)
+
+PERL_WEBSITE            = @_PERL_CONSTANT_STR( WEBSITE     , $website     )
+PERL_WEBSITE_NAME       = @_PERL_CONSTANT_STR( WEBSITE_NAME, $website_name)
+PERL_FAVICON_PATH       = @_PERL_CONSTANT_STR( FAVICON_PATH, $favicon_path)
+
+PERL_COIN_DATE          = @_PERL_CONSTANT_STR( COIN_DATE, $coin_date)
+PERL_INTF_DATE          = @_PERL_CONSTANT_STR( INTF_DATE, $intf_date)
+
+PERL_GZIP               = @_PERL_CONSTANT_STR( GZIP, $gzip)
+
+PERL_LOG_SIZE_LIMIT     = @_PERL_CONSTANT(     LOG_SIZE_LIMIT   , $log_size_limit)
+PERL_LOGS_UNCOMPRESSED  = @_PERL_CONSTANT(     LOGS_UNCOMPRESSED, $logs_uncompressed)
+PERL_LOGS_TOTAL         = @_PERL_CONSTANT(     LOGS_TOTAL       , $logs_total)
+
+PERL_STORY_LENGTH       = @_PERL_CONSTANT(     STORY_LENGTH    , $story_length)
+PERL_PAGE_LENGTH        = @_PERL_CONSTANT(     PAGE_LENGTH     , $page_length)
+PERL_FIRSTPAGE_LENGTH   = @_PERL_CONSTANT(     FIRSTPAGE_LENGTH, $firstpage_length)
+
+
+RUN_PERL = @_SHEBANG($perl)
diff --git a/testhtml.pl b/testhtml.pl
deleted file mode 100644 (file)
index 97f72fb..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/perl
-use lib '/eizm/lib/bstatest/';
-use strict;
-use bsta_lib qw(failpage gethttpheader getcgi entityencode readdatafile writedatafile printdatafileht urlencode bb2ht bb2bb linehtml);
-
-my $bb;
-my $ht;
-
-$bb="[fq]<fq>[/fq][tq]<tq>[/tq][ni]<ni>[/ni][br]<br>[/br][po]<po>[/po][url=<url>]<url>[/url][i]<i>[/i]<teqt>\n";
-$ht=bb2bb($bb,1);
-print $ht."\n";
-$ht=bb2ht($bb,1);
-print $ht."\n";
-
-# print ht;
index 8e8e6a2b0e6c7a98e6472e4262784d1a07b9009f..1f3ff5e51205663b41e771dd78adbbacbf064bc8 100644 (file)
@@ -1,44 +1,39 @@
-###PERL;
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # updlist.pl is generated from updlist.1.pl.
-# 29.06.2017
 #
 # The framelist update bot
 #
-#    Copyright (C) 2016-2017  Balthasar Szczepański
+# Copyright (C) 2016, 2017, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 use bsta_lib qw(readdatafile writedatafile);
 use File::Copy;
 
-###DATA_PATH;
-###WWW_PATH;
-###SETTINGS_PATH;
-###STATE_PATH;
-###DEFAULT_PATH;
-###LIST_PATH;
+###PERL_DATA_PATH:      DATA_PATH      = /botm/data/bsta/
+###PERL_DATA_LIST_PATH: DATA_LIST_PATH = /botm/data/bsta/list
 
 my %framedata;
 my %gotolist;
 
 my $frame;
 
-%gotolist=readdatafile(LIST_PATH);
+%gotolist=readdatafile(DATA_LIST_PATH);
 
 for($frame=0; ; ++$frame) {
        %framedata=readdatafile(DATA_PATH.$frame);
@@ -52,4 +47,4 @@ for($frame=0; ; ++$frame) {
        $gotolist{'ongtime-'.$frame}=$framedata{'ongtime'};
 }
 
-writedatafile (LIST_PATH,%gotolist);
+writedatafile (DATA_LIST_PATH,%gotolist);
diff --git a/viewer.1.c b/viewer.1.c
deleted file mode 100644 (file)
index 2a3f1a6..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// viewer.c is generated from viewer.1.c
-// 20.08.2016
-// 
-// This is the wrapper for viewer.pl.
-// It's run with SETUID to have accesss to some files where the www server
-// should not. That's why it has a C wrapper. In modern systems running scripts
-// directly with SETUID is considered unsafe and not allowed.
-//
-//    Copyright (C) 2016  Balthasar Szczepański
-//
-//    This program is free software: you can redistribute it and/or modify
-//    it under the terms of the GNU Affero General Public License as
-//    published by the Free Software Foundation, either version 3 of the
-//    License, or (at your option) any later version.
-//
-//    This program is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//    GNU Affero General Public License for more details.
-//
-//    You should have received a copy of the GNU Affero General Public License
-//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-#include <unistd.h>
-#include <stdio.h>
-
-###VIEWER_PL;
-###VIEWER_PL_ERRLOG;
-
-int main(int argc, char *argv[], char *envp[])
-{
-       freopen(VIEWER_PL_ERRLOG,"at",stderr);
-       return execve(VIEWER_PL,argv,envp);
-}
index 7afe8a15e66d1ded7b0b2480e940bbadc850b9c4..8932569c24f7504a69fa38fc473ff32e32b91f89 100644 (file)
@@ -1,54 +1,56 @@
-###PERL;
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # /bsta/v
 # viewer is generated from viewer.1.pl.
-# 09.01.2023
 #
 # The viewer interface
 #
-#    Copyright (C) 2016-2017, 2019-2020, 2023  Balthasar Szczepański
+# Copyright (C) 2016-2017, 2019-2020, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 use bsta_lib qw(failpage gethttpheader getcgi entityencode readdatafile writedatafile printdatafileht urlencode bb2ht bb2bb linehtml);
 use File::Copy;
 
-###DATA_PATH;
-###DEFAULT_PATH;
-###SETTINGS_PATH;
-###STATE_PATH;
-###LOGO_PATH;
-###FAVICON_PATH;
-###WEBSITE;
-###WEBSITE_NAME;
-###CSS_PATH;
-###CGI_PATH;
-###FRAME_PATH;
-###VIEWER_PATH;
-###NOACCESS_PATH;
-###STORY_PATH;
-###WWW_PATH;
-###INDEX_PATH;
-###ATTACH_PATH;
-###INFO_PATH;
-###BBCODE_PATH;
-###GOTO_PATH;
-###LIST_PATH;
-###TIMER_PATH;
+###PERL_CGI_PATH:           CGI_PATH           = /bsta/
+###PERL_CGI_ATTACH_PATH:    CGI_ATTACH_PATH    = /bsta/a
+###PERL_CGI_BBCODE_PATH:    CGI_BBCODE_PATH    = /bsta/b
+###PERL_CGI_CSS_PATH:       CGI_CSS_PATH       = /bsta/bsta.css
+###PERL_CGI_FRAME_PATH:     CGI_FRAME_PATH     = /bsta/f
+###PERL_CGI_GOTO_PATH:      CGI_GOTO_PATH      = /bsta/g
+###PERL_CGI_INFO_PATH:      CGI_INFO_PATH      = /bsta/i
+###PERL_CGI_LOGO_PATH:      CGI_LOGO_PATH      = /bsta/botmlogo.png
+###PERL_CGI_TIMER_PATH:     CGI_TIMER_PATH     = /bsta/timer.js
+###PERL_CGI_VIEWER_PATH:    CGI_VIEWER_PATH    = /bsta/v
+
+###PERL_DATA_PATH:          DATA_PATH          = /botm/data/bsta/
+###PERL_DATA_DEFAULT_PATH:  DATA_DEFAULT_PATH  = /botm/data/bsta/default
+###PERL_DATA_LIST_PATH:     DATA_LIST_PATH     = /botm/data/bsta/list
+###PERL_DATA_NOACCESS_PATH: DATA_NOACCESS_PATH = /botm/data/bsta/noaccess
+###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
+###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
+###PERL_DATA_STORY_PATH:    DATA_STORY_PATH    = /botm/data/bsta/story
+
+###PERL_WWW_PATH:           WWW_PATH           = /botm/www/1190/bsta/
+###PERL_WWW_INDEX_PATH:     WWW_INDEX_PATH     = /botm/www/1190/bsta/index.htm
+
+###PERL_WEBSITE:            WEBSITE            = 1190.bicyclesonthemoon.info
+###PERL_WEBSITE_NAME:       WEBSITE_NAME       = Bicycles on the Moon
+###PERL_FAVICON_PATH:       FAVICON_PATH       = /img/favicon.png
 
 my %http;
 my %cgi;
@@ -78,7 +80,7 @@ my $ongtime;
 my $textmode;
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
 if ($ENV{'REQUEST_METHOD'} =~ /^(HEAD|GET|POST)$/) {
        $method=$1;
@@ -131,8 +133,8 @@ else {
 }
 # print "Content-type: text/plain\n\n";
 
-%settings=readdatafile(SETTINGS_PATH);
-%default=readdatafile(DEFAULT_PATH);
+%settings=readdatafile(DATA_SETTINGS_PATH);
+%default=readdatafile(DATA_DEFAULT_PATH);
 %framedata=readdatafile(DATA_PATH.$frame);
 if($password eq $settings{'password'}){
        $passwordOK = 1;
@@ -141,7 +143,7 @@ else{
        $passwordOK = 0;
 }
 
-if (open ($statefile,"+<",STATE_PATH)){
+if (open ($statefile,"+<",DATA_STATE_PATH)){
        if (flock($statefile,2)) {
                
                %state=readdatafile($statefile);
@@ -176,8 +178,8 @@ if (open ($statefile,"+<",STATE_PATH)){
                        my $inpath;
                        my $outpath;
                        
-                       %story = readdatafile(STORY_PATH);
-                       %gotolist=readdatafile(LIST_PATH);
+                       %story = readdatafile(DATA_STORY_PATH);
+                       %gotolist=readdatafile(DATA_LIST_PATH);
                        if(int($story{'state'}) == 17 && int($story{'pass'}) == 1) {
                                #ACTIVATE!
                                
@@ -202,9 +204,9 @@ if (open ($statefile,"+<",STATE_PATH)){
                                $gotolist{'ongtime-1'}=$framedata{'ongtime'};
                                
                                if(copy ($inpath, $outpath)) {
-                                       writeindex(INDEX_PATH);
+                                       writeindex(WWW_INDEX_PATH);
                                        writedatafile($statefile,%state);
-                                       writedatafile(LIST_PATH,%gotolist);
+                                       writedatafile(DATA_LIST_PATH,%gotolist);
                                }
                                else {
                                        $state{'state'} = 0;
@@ -261,7 +263,7 @@ if ($passwordOK || (int($state{'state'}) >= 1 && $frame <= int($state{'last'}) &
 }
 else {
        $access=0;
-       %framedata = readdatafile(NOACCESS_PATH);
+       %framedata = readdatafile(DATA_NOACCESS_PATH);
        foreach my $ind (keys %default) {
                unless(defined($framedata{$ind})){
                        $framedata{$ind}=$default{$ind};
@@ -326,21 +328,21 @@ unless($framedata{'title'} eq '' || $framedata{'title'} eq $settings{'story'}) {
 }
 print entityencode($settings{'story'}).' &bull; '.WEBSITE_NAME.'</title>'."\n";
 print '<link rel="icon" type="image/png" href="'.FAVICON_PATH.'">'."\n";
-print '<link rel="stylesheet" href="'.CSS_PATH.'">'."\n";
-print '<link rel="index" href="'.GOTO_PATH.($passwordOK?('?p='.urlencode($password)):'').'">'."\n";
-print '<link rel="start" href="'.VIEWER_PATH.'/0'.($passwordOK?('?p='.urlencode($password)):'').'">'."\n";
+print '<link rel="stylesheet" href="'.CGI_CSS_PATH.'">'."\n";
+print '<link rel="index" href="'.CGI_GOTO_PATH.($passwordOK?('?p='.urlencode($password)):'').'">'."\n";
+print '<link rel="start" href="'.CGI_VIEWER_PATH.'/0'.($passwordOK?('?p='.urlencode($password)):'').'">'."\n";
 if($frame>0 && $access) {
-       print '<link rel="prev" href="'.VIEWER_PATH.'/'.($frame - 1).($passwordOK?('?p='.urlencode($password)):'').'">'."\n";
+       print '<link rel="prev" href="'.CGI_VIEWER_PATH.'/'.($frame - 1).($passwordOK?('?p='.urlencode($password)):'').'">'."\n";
 }
 if ($passwordOK || $frame<int($state{'last'})) {
-       print '<link rel="next" href="'.VIEWER_PATH.'/'.($frame + 1).($passwordOK?('?p='.urlencode($password)):'').'">'."\n";
-       print '<link rel="prefetch" href="'.VIEWER_PATH.'/'.($frame + 1).($passwordOK?('?p='.urlencode($password)):'').'">'."\n";
+       print '<link rel="next" href="'.CGI_VIEWER_PATH.'/'.($frame + 1).($passwordOK?('?p='.urlencode($password)):'').'">'."\n";
+       print '<link rel="prefetch" href="'.CGI_VIEWER_PATH.'/'.($frame + 1).($passwordOK?('?p='.urlencode($password)):'').'">'."\n";
 }
 if($frame==int($state{'last'}) && int($state{'state'}) >= 1 && int($state{'state'}) < 3) {
-       print '<!-- <script src="'.TIMER_PATH.'"></script> -->'."\n";
+       print '<!-- <script src="'.CGI_TIMER_PATH.'"></script> -->'."\n";
 }
 print '</head><body>'."\n";
-print '<a href="/"><img id="botmlogo" src="'.LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
+print '<a href="/"><img id="botmlogo" src="'.CGI_LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
 print '<div id="all">'."\n";
 
 print '<div id="inst" class="ins">'."\n";
@@ -359,7 +361,7 @@ else {
                print CGI_PATH.sprintf($settings{'frame'},$frame,$framedata{'ext'});
        }
        else {
-               print FRAME_PATH.'/'.$frame.($passwordOK?('?p='.urlencode($password)):'');
+               print CGI_FRAME_PATH.'/'.$frame.($passwordOK?('?p='.urlencode($password)):'');
        }
        print '" id="frame" alt="'.$frame.'" title="'.entityencode($framedata{'title'}).'">'."\n";
 }
@@ -381,7 +383,7 @@ if($textmode==2){
 elsif($textmode==1){
        print '<div id="chat">'."\n";
        print '[quote][center][size=200]'.entityencode($framedata{'title'}).'[/size]<br>'."\n";
-       print '[url=http://'.WEBSITE.VIEWER_PATH.'/'.$frame.'][img]http://'.WEBSITE.CGI_PATH.($access?sprintf($settings{'frame'},$frame,$framedata{'ext'}):$framedata{'frame'}).'[/img][/url][/center]<br>'."\n";
+       print '[url=http://'.WEBSITE.CGI_VIEWER_PATH.'/'.$frame.'][img]http://'.WEBSITE.CGI_PATH.($access?sprintf($settings{'frame'},$frame,$framedata{'ext'}):$framedata{'frame'}).'[/img][/url][/center]<br>'."\n";
        print bb2bbf($framedata{'content'}).'[/quote]</div>'."\n";
 }
 elsif($framedata{'content'} ne ''){
@@ -417,12 +419,12 @@ if($frame==int($state{'last'}) && int($state{'state'}) >= 1 && int($state{'state
 }
 print '&gt;';
 if (!$access){
-       print '<a href="'.VIEWER_PATH.'/-1">'.entityencode($framedata{'command'}).'</a><br>'."\n";
+       print '<a href="'.CGI_VIEWER_PATH.'/-1">'.entityencode($framedata{'command'}).'</a><br>'."\n";
 }
 else {
        if ($passwordOK || $frame<int($state{'last'}) || (int($state{'state'}) >= 2 && $showcommand)) {
                if ($passwordOK || $frame<int($state{'last'})) {
-                       print '<a href="'.VIEWER_PATH.'/'.($frame + 1).($passwordOK?('?p='.urlencode($password)):'').'">';
+                       print '<a href="'.CGI_VIEWER_PATH.'/'.($frame + 1).($passwordOK?('?p='.urlencode($password)):'').'">';
                }
                if($nextframedata{'title'} ne '') {
                        print entityencode($nextframedata{'title'});
@@ -447,20 +449,20 @@ print '</div>'."\n";
 print '<div id="underlinks">'."\n";
 print '<a href="'.CGI_PATH.'">Once again</a>';
 if($frame>0 && $access) {
-       print ' | <a href="'.VIEWER_PATH.'/'.($frame-1).($passwordOK?('?p='.urlencode($password)):'').'">Before</a>';
+       print ' | <a href="'.CGI_VIEWER_PATH.'/'.($frame-1).($passwordOK?('?p='.urlencode($password)):'').'">Before</a>';
 }
 if($frame != int($state{'last'})) {
-       print ' | <a href="'.VIEWER_PATH.'/'.int($state{'last'}).($passwordOK?('?p='.urlencode($password)):'').'">Now</a>';
+       print ' | <a href="'.CGI_VIEWER_PATH.'/'.int($state{'last'}).($passwordOK?('?p='.urlencode($password)):'').'">Now</a>';
 }
-print ' | <a href="'.GOTO_PATH.($passwordOK?('?p='.urlencode($password)):'').'">GOTO</a>'."\n";
+print ' | <a href="'.CGI_GOTO_PATH.($passwordOK?('?p='.urlencode($password)):'').'">GOTO</a>'."\n";
 print '<span style="float: right;">'."\n";
 
 if ($textmode!=0) {
-       print '<a href="'.VIEWER_PATH.'/'.$frame.($passwordOK?('?p='.urlencode($password)):'').'">Without</a> | ';
+       print '<a href="'.CGI_VIEWER_PATH.'/'.$frame.($passwordOK?('?p='.urlencode($password)):'').'">Without</a> | ';
 }
 
-print '<a href="'.(($textmode==2)?(INFO_PATH.'/'.$frame.($passwordOK?('?p='.urlencode($password)):'')):(VIEWER_PATH.'/'.$frame.'?b=2'.($passwordOK?('&amp;p='.urlencode($password)):''))).'">Info</a>';
-print ' | <a href="'.(($textmode==1)?(BBCODE_PATH.'/'.$frame.($passwordOK?('?p='.urlencode($password)):'')):(VIEWER_PATH.'/'.$frame.'?b=1'.($passwordOK?('&amp;p='.urlencode($password)):''))).'">BB</a>';
+print '<a href="'.(($textmode==2)?(CGI_INFO_PATH.'/'.$frame.($passwordOK?('?p='.urlencode($password)):'')):(CGI_VIEWER_PATH.'/'.$frame.'?b=2'.($passwordOK?('&amp;p='.urlencode($password)):''))).'">Info</a>';
+print ' | <a href="'.(($textmode==1)?(CGI_BBCODE_PATH.'/'.$frame.($passwordOK?('?p='.urlencode($password)):'')):(CGI_VIEWER_PATH.'/'.$frame.'?b=1'.($passwordOK?('&amp;p='.urlencode($password)):''))).'">BB</a>';
 print "\n</span>\n";
 
 print '</div>'."\n";
@@ -493,7 +495,7 @@ sub writeindex {
        
        %framedata = readdatafile(DATA_PATH.0);
        %nextframedata = readdatafile(DATA_PATH.1);
-       %default=readdatafile(DEFAULT_PATH);
+       %default=readdatafile(DATA_DEFAULT_PATH);
        
        foreach my $ind (keys %default) {
                unless(defined($framedata{$ind})){
@@ -509,13 +511,13 @@ sub writeindex {
        print $indexfile '<meta http-equiv="Content-type" content="text/html; charset=UTF-8">'."\n";
        print $indexfile '<title>'.entityencode($settings{'story'}).' &bull; '.WEBSITE_NAME.'</title>'."\n";
        print $indexfile '<link rel="icon" type="image/png" href="'.FAVICON_PATH.'">'."\n";
-       print $indexfile '<link rel="stylesheet" href="'.CSS_PATH.'">'."\n";
-       print $indexfile '<link rel="index" href="'.GOTO_PATH.'">'."\n";
-       print $indexfile '<link rel="start" href="'.VIEWER_PATH.'/0">'."\n";
-       print $indexfile '<link rel="next" href="'.VIEWER_PATH.'/1">'."\n";
-       print $indexfile '<link rel="prefetch" href="'.VIEWER_PATH.'/1">'."\n";
+       print $indexfile '<link rel="stylesheet" href="'.CGI_CSS_PATH.'">'."\n";
+       print $indexfile '<link rel="index" href="'.CGI_GOTO_PATH.'">'."\n";
+       print $indexfile '<link rel="start" href="'.CGI_VIEWER_PATH.'/0">'."\n";
+       print $indexfile '<link rel="next" href="'.CGI_VIEWER_PATH.'/1">'."\n";
+       print $indexfile '<link rel="prefetch" href="'.CGI_VIEWER_PATH.'/1">'."\n";
        print $indexfile '</head><body>'."\n";
-       print $indexfile '<a href="/"><img id="botmlogo" src="'.LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
+       print $indexfile '<a href="/"><img id="botmlogo" src="'.CGI_LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
        print $indexfile '<div id="all">'."\n";
        
        print $indexfile '<div id="inst" class="ins">'."\n";
@@ -533,7 +535,7 @@ sub writeindex {
        print $indexfile '</div>'."\n";
        
        print $indexfile '<div id="command">'."\n";
-       print $indexfile '&gt;<a href="'.VIEWER_PATH.'/1">'.entityencode($nextframedata{'title'}).'</a>'."\n";
+       print $indexfile '&gt;<a href="'.CGI_VIEWER_PATH.'/1">'.entityencode($nextframedata{'title'}).'</a>'."\n";
        print $indexfile '</div>'."\n";
        
        print $indexfile '<div id="underlinks">'."\n";
@@ -541,8 +543,8 @@ sub writeindex {
        
        # <span style="float: right;"><a href="/bsta/v/0?b=2">Info</a> | <a href="/bsta/v/0?b=1">BB</a></span>
        
-       print $indexfile '<a href="'.VIEWER_PATH.'/-1">Now</a> | <a href="'.GOTO_PATH.'">GOTO</a>';
-       print $indexfile '<span style="float: right;"><a href="'.INFO_PATH.'/0?b=2">Info</a> | <a href="'.VIEWER_PATH.'/0?b=1">BB</a></span>'."\n";
+       print $indexfile '<a href="'.CGI_VIEWER_PATH.'/-1">Now</a> | <a href="'.CGI_GOTO_PATH.'">GOTO</a>';
+       print $indexfile '<span style="float: right;"><a href="'.CGI_INFO_PATH.'/0?b=2">Info</a> | <a href="'.CGI_VIEWER_PATH.'/0?b=1">BB</a></span>'."\n";
        print $indexfile '</div>'."\n";
        
        print $indexfile '</div>'."\n";
@@ -576,13 +578,13 @@ sub bb2htf {
                $posttext = substr ($bb,pos ($bb));
                
                if ($tagvalue =~ /^att&([0-9]+)$/) {
-                       $tagvalue = ATTACH_PATH.'/'.int($1).($passwordOK?('?p='.urlencode($password)):'');
+                       $tagvalue = CGI_ATTACH_PATH.'/'.int($1).($passwordOK?('?p='.urlencode($password)):'');
                }
                elsif ($tagvalue =~ /^vw&([0-9]+)$/) {
-                       $tagvalue = VIEWER_PATH.'/'.int($1).($passwordOK?('?p='.urlencode($password)):'');
+                       $tagvalue = CGI_VIEWER_PATH.'/'.int($1).($passwordOK?('?p='.urlencode($password)):'');
                }
                elsif ($tagvalue =~ /^fr&([0-9]+)$/) {
-                       $tagvalue = FRAME_PATH.'/'.int($1).($passwordOK?('?p='.urlencode($password)):'');
+                       $tagvalue = CGI_FRAME_PATH.'/'.int($1).($passwordOK?('?p='.urlencode($password)):'');
                }
                else {
                        $tagvalue = '';
@@ -608,13 +610,13 @@ sub bb2bbf {
                $posttext = substr ($bb,pos ($bb));
                
                if ($tagvalue =~ /^att&([0-9]+)$/) {
-                       $tagvalue = 'http://'.WEBSITE.ATTACH_PATH.'/'.int($1);
+                       $tagvalue = 'http://'.WEBSITE.CGI_ATTACH_PATH.'/'.int($1);
                }
                elsif ($tagvalue =~ /^vw&([0-9]+)$/) {
-                       $tagvalue = 'http://'.WEBSITE.VIEWER_PATH.'/'.int($1);
+                       $tagvalue = 'http://'.WEBSITE.CGI_VIEWER_PATH.'/'.int($1);
                }
                elsif ($tagvalue =~ /^fr&([0-9]+)$/) {
-                       $tagvalue = 'http://'.WEBSITE.FRAME_PATH.'/'.int($1);
+                       $tagvalue = 'http://'.WEBSITE.CGI_FRAME_PATH.'/'.int($1);
                }
                else {
                        $tagvalue = '';