// OTT mirror
-// Copyright (C) 2014 Balthasar Szczepański
-// bot2.cpp (bothasar_t)
+// Copyright (C) 2014, 2022 Balthasar Szczepański
+// bot2.cpp (bothasar_t) automatically generated from bot2.1.cpp
// the mirror bot.
-// 12.09.2014
+// 24.09.2022
//
// This file is part of OTT mirror.
//
#define LINE_LIMIT 16000
-###USERAGENT2
+// ###C_USERAGENT_2: #define USERAGENT "bothasar_t (http://1190.bicyclesonthemoon.info/ott/; Time thread mirror bot)"
-###ICT_ADDRESS
-###OTT_ADDRESS
-###FORA_ADDRESS
+// ###C_ICT_ADDRESS: #define ICT_ADDRESS "http://forums.xkcd.com/viewforum.php?f=7"
+// ###C_OTT_ADDRESS: #define OTT_ADDRESS "http://forums.xkcd.com/viewtopic.php?f=7&t=101043&start="
+// ###C_FORA_ADDRESS: #define FORA_ADDRESS "http://forums.xkcd.com"
-###LAST_PATH
-###LOG_PATH
-###NP_PATH
-###NP_PATH_1
-###NP_PATH_2
-###NP_PATH_3
-###STOP_PATH
-###LIST_PATH
-###SIG_PATH
-###INF_PATH
-###UP_PATH
-###IND_PATH
-###TOP_PATH
-###END_PATH
-###AV_PATH
-###ATT_PATH
-###IMG_PATH
-###LAST_PAGE
+// ###C_LAST_PATH: #define LAST_PATH "/eizm/mem/ottmirror/lasttime."
+// ###C_LOG_PATH_2: #define LOG_PATH "/eizm/log/ottmirror/bot2.log."
+// ###C_NP_PATH_0: #define NP_PATH "/eizm/tmp/ottmirror/np.p0."
+// ###C_NP_PATH_1: #define NP_PATH_1 "/eizm/tmp/ottmirror/np.p1."
+// ###C_NP_PATH_2: #define NP_PATH_2 "/eizm/tmp/ottmirror/np.p2."
+// ###C_NP_PATH_3: #define NP_PATH_3 "/eizm/tmp/ottmirror/np.p3."
+// ###C_STOP_PATH: #define STOP_PATH "/eizm/tmp/ottmirror/fullstop."
+// ###C_LIST_PATH: #define LIST_PATH "/eizm/www/time/ott/postlist/"
+// ###C_SIG_PATH: #define SIG_PATH "/eizm/www/time/ott/sig/"
+// ###C_INF_PATH: #define INF_PATH "/eizm/www/time/ott/otterinf/"
+// ###C_UP_PATH: #define UP_PATH "/eizm/www/time/ott/np/"
+// ###C_IND_PATH: #define IND_PATH "/eizm/www/time/ott/ottfront"
+// ###C_TOP_PATH: #define TOP_PATH "/eizm/www/time/ott/top"
+// ###C_END_PATH: #define END_PATH "/eizm/www/time/ott/end"
+// ###C_AV_PATH: #define AV_PATH "/eizm/www/time/ott/avatar/"
+// ###C_ATT_PATH: #define ATT_PATH "/eizm/www/time/ott/attachment/"
+// ###C_IMG_PATH: #define IMG_PATH "/eizm/www/time/ott/image/"
+// ###C_LAST_PAGE: #define LAST_PAGE "/eizm/www/time/ott/np/last"
-###WGET_PATH
-###MAWK_PATH
-###RM_PATH
-###AWK_LATEST
-###AWK_LIST
-###AWK_BOT2
-###AWK_UPLOAD
-###AWK_INDEX
+// ###C_WGET_PATH: #define WGET_PATH "/usr/bin/wget"
+// ###C_MAWK_PATH: #define MAWK_PATH "/usr/bin/mawk"
+// ###C_RM_PATH: #define RM_PATH "/bin/rm"
+// ###C_AWK_LATEST: #define AWK_LATEST "/eizm/pro/ottmirror/findlatest.awk"
+// ###C_AWK_LIST: #define AWK_LIST "/eizm/pro/ottmirror/list.awk"
+// ###C_AWK_BOT2: #define AWK_BOT2 "/eizm/pro/ottmirror/bot2.awk"
+// ###C_AWK_UPLOAD: #define AWK_UPLOAD "/eizm/pro/ottmirror/upload.awk"
+// ###C_AWK_INDEX: #define AWK_INDEX "/eizm/pro/ottmirror/index.awk"
FILE *cwfile;
FILE *stopfile;
// OTT mirror
-// Copyright (C) 2014 Balthasar Szczepański
-// bot3.cpp (bothasar_p)
+// Copyright (C) 2014, 2022 Balthasar Szczepański
+// bot3.cpp (bothasar_p) automatically generated from bot3.1.cpp
// the post bot.
-// 12.09.2014
+// 24.09.2022
//
// This file is part of OTT mirror.
//
#define STOP_MSTD 4
#define NAME_MSTD 5
-###USERAGENT3
-###NAME_PATH
-###LASTTIME_PATH
-###LOG_PATH3
-###TEMPFILE_PATH
-###POSTDATA_PATH
-###COOKIE_PATH
-###STOP_PATH3
-###POST_PATH3
-###LIST_PATH3
-###LAST_PATH3
-###IND_PATH3
-###OK_PATH3
-###PM_PATH3
-###FAIL_PATH3
+// ###C_USERAGENT_3: #define USERAGENT "bothasar_p (http://1190.bicyclesonthemoon.info/ott/; Time thread post bot)"
+// ###C_NAME_PATH: #define NAME_PATH "/eizm/mem/ottmirror/name"
+// ###C_LASTTM_PATH_3: #define LASTTIME_PATH "/eizm/mem/ottmirror/bot3last"
+// ###C_LOG_PATH_3: #define LOG_PATH "/eizm/log/ottmirror/bot3.log"
+// ###C_TEMPFILE_PATH_3: #define TEMPFILE_PATH "/eizm/tmp/ottmirror/bot3temp"
+// ###C_POSTDATA_PATH_3: #define POSTDATA_PATH "/eizm/tmp/ottmirror/bot3post"
+// ###C_COOKIE_PATH_3: #define COOKIE_PATH "/eizm/tmp/ottmirror/bot3cook"
+// ###C_STOP_PATH_3: #define STOP_PATH "/eizm/tmp/ottmirror/bot3stop"
+// ###C_POST_PATH_3: #define POST_PATH "/eizm/mem/ottmirror/mpost/"
+// ###C_LIST_PATH_3: #define LIST_PATH "/eizm/mem/ottmirror/mlist/"
+// ###C_LAST_PATH_3: #define LAST_PATH "/eizm/mem/ottmirror/mlist/last"
+// ###C_IND_PATH_3: #define IND_PATH "/eizm/www/time/ott/mfront"
+// ###C_OK_PATH_3: #define OK_PATH "/eizm/mem/ottmirror/mpost/ok/"
+// ###C_PM_PATH_3: #define PM_PATH "/eizm/mem/ottmirror/mpost/pm/"
+// ###C_FAIL_PATH_3: #define FAIL_PATH "/eizm/mem/ottmirror/mpost/fail/"
-###WGET_PATH
-###MAWK_PATH
-###RM_PATH
-###MV_PATH
-###AWK_POST
-###AWK_PM
+// ###C_WGET_PATH: #define WGET_PATH "/usr/bin/wget"
+// ###C_MAWK_PATH: #define MAWK_PATH "/usr/bin/mawk"
+// ###C_RM_PATH: #define RM_PATH "/bin/rm"
+// ###C_MV_PATH: #define MV_PATH "/bin/mv"
+// ###C_AWK_POST: #define AWK_POST "/eizm/pro/ottmirror/post.awk"
+// ###C_AWK_PM: #define AWK_PM "/eizm/pro/ottmirror/pm.awk"
FILE *cwfile;
FILE *stopfile;
// OTT mirror
-// Copyright (C) 2014 Balthasar Szczepański
-// findpost.cpp
+// Copyright (C) 2014, 2022 Balthasar Szczepański
+// findpost.cpp automatically generated from findpost.1.cpp
// find a post by ID.
-// 12.09.2014
+// 24.09.2022
//
// This file is part of OTT mirror.
//
// You should have received a copy of the GNU Affreo General Public License
// along with OTT mirror. If not, see <http://www.gnu.org/licenses/>.
-###POSTLIST_PATH
+// ###C_LIST_PATH: #define LIST_PATH "/eizm/www/time/ott/postlist/"
#include <stdio.h>
for(short i=31;i>=0;--i)
{
pagenumber2 = pagenumber + (1L << i);
- sprintf(path,"%s%lu",POSTLIST_PATH,pagenumber2);
+ sprintf(path,"%s%lu",LIST_PATH,pagenumber2);
file=fopen(path,"rt");
if(file==NULL)
continue;
printf("0\n");
return 0;
}
- sprintf(path,"%s%lu",POSTLIST_PATH,pagenumber);
+ sprintf(path,"%s%lu",LIST_PATH,pagenumber);
file=fopen(path,"rt");
if(file==NULL)
{
}
}
fclose(file);
- sprintf(path,"%s%lu",POSTLIST_PATH,pagenumber-1);
+ sprintf(path,"%s%lu",LIST_PATH,pagenumber-1);
file=fopen(path,"rt");
if(file==NULL)
{
printf("0\n");
fclose(file);
return 0;
-}
\ No newline at end of file
+}
# OTT mirror
-# Copyright (C) 2014, 2016 Balthasar Szczepański
-# index.awk
+# Copyright (C) 2014, 2016, 2022 Balthasar Szczepański
+# index.awk automatically generated from index.1.awk
# separate the topic from index page.
-# 31.03.2016
+# 24.09.2022
# This file is part of OTT mirror.
#
else if ($0 ~ /<li/ && where==1)
++level
- if ($0 ~ /t=###threadID;/)
+ if ($0 ~ /t=###AWK_thread_id;/)
{
related=0
}
// OTT mirror
-// Copyright (C) 2014 Balthasar Szczepański
-// index.cpp
+// Copyright (C) 2014, 2022 Balthasar Szczepański
+// index.cpp automatically generated from index.1.cpp
// view the front page.
-// 12.09.2014
+// 24.09.2022
//
// This file is part of OTT mirror.
//
#include <unistd.h>
#include <sys/wait.h>
-###RM_PATH
-###CAT_PATH
+// ###C_RM_PATH: #define RM_PATH "/bin/rm"
+// ###C_CAT_PATH: #define CAT_PATH "/bin/cat"
-###TOP_PATH
-###OTTFRONT_PATH
-###MFRONT_PATH
-###END_PATH
+// ###C_TOP_PATH: #define TOP_PATH "/eizm/www/time/ott/top"
+// ###C_IND_PATH: #define IND_PATH "/eizm/www/time/ott/ottfront"
+// ###C_IND_PATH_3_: #define IND_PATH_3 "/eizm/www/time/ott/mfront"
+// ###C_END_PATH: #define END_PATH "/eizm/www/time/ott/end"
int main()
{
sub=fork();
if(sub==0)
{
- r=execl(CAT_PATH,CAT_PATH,OTTFRONT_PATH,(char *)0);
+ r=execl(CAT_PATH,CAT_PATH,IND_PATH,(char *)0);
exit(r);
}
waitpid(sub,&r,0);
sub=fork();
if(sub==0)
{
- r=execl(CAT_PATH,CAT_PATH,MFRONT_PATH,(char *)0);
+ r=execl(CAT_PATH,CAT_PATH,IND_PATH_3,(char *)0);
exit(r);
}
waitpid(sub,&r,0);
# Copyright (C) 2020 Balthasar Szczepański
# "makefile" is automatically generated from "makefile.1.mak"
# find the latest page and number of posts.
-# 18.09.2020
+# 24.09.2022
# This file is part of OTT mirror.
#
CONFIGURE = /botm/bin/config/configure.pl
CONFIGURE_CMD = $(PERL) $(CONFIGURE) $(CONFIGFILE)
-all:
+# keep these lists in the same order!:
+TO_GENERATE = bot2.awk bot2.cpp bot3.cpp findpost.cpp index.awk index.cpp mpview.cpp mview.cpp pm.awk post.awk post.cpp posted.cpp preview.awk
+GENERATE_FROM = bot2.1.awk bot2.1.cpp bot3.1.cpp findpost.1.cpp index.1.awk index.1.cpp mpview.1.cpp mview.1.cpp pm.1.awk post.1.awk post.1.cpp posted.1.cpp preview.1.awk
+
+all: $(TO_GENERATE)
makefile: makefile.1.mak $(CONFIGFILE)
$(CONFIGURE_CMD) < makefile.1.mak > makefile
-bot2.awk: bot2.1.awk $(CONFIGFILE)
- $(CONFIGURE_CMD) < bot2.1.awk > bot2.awk
-
-bot2.cpp: bot2.1.cpp $(CONFIGFILE)
- $(CONFIGURE_CMD) < bot2.1.cpp > bot2.cpp
+$(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE)
+ $(CONFIGURE_CMD) --in $(GENERATE_FROM) --out $(TO_GENERATE)
clean:
- $(RM) -f bot2.awk
+ $(RM) -f $(TO_GENERATE)
PHONY: all clean
# Copyright (C) 2020 Balthasar Szczepański
# "makefile" is automatically generated from "makefile.1.mak"
# find the latest page and number of posts.
-# 18.09.2020
+# 24.09.2022
# This file is part of OTT mirror.
#
CONFIGURE = /botm/bin/config/configure.pl ###MAKE_CONFIGURE:
CONFIGURE_CMD = $(PERL) $(CONFIGURE) $(CONFIGFILE)
-all:
+# keep these lists in the same order!:
+TO_GENERATE = bot2.awk bot2.cpp bot3.cpp findpost.cpp index.awk index.cpp mpview.cpp mview.cpp pm.awk post.awk post.cpp posted.cpp preview.awk
+GENERATE_FROM = bot2.1.awk bot2.1.cpp bot3.1.cpp findpost.1.cpp index.1.awk index.1.cpp mpview.1.cpp mview.1.cpp pm.1.awk post.1.awk post.1.cpp posted.1.cpp preview.1.awk
+
+all: $(TO_GENERATE)
makefile: makefile.1.mak $(CONFIGFILE)
$(CONFIGURE_CMD) < makefile.1.mak > makefile
-bot2.awk: bot2.1.awk $(CONFIGFILE)
- $(CONFIGURE_CMD) < bot2.1.awk > bot2.awk
-
-bot2.cpp: bot2.1.cpp $(CONFIGFILE)
- $(CONFIGURE_CMD) < bot2.1.cpp > bot2.cpp
+$(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE)
+ $(CONFIGURE_CMD) --in $(GENERATE_FROM) --out $(TO_GENERATE)
clean:
- $(RM) -f bot2.awk
+ $(RM) -f $(TO_GENERATE)
PHONY: all clean
// OTT mirror
-// Copyright (C) 2014 Balthasar Szczepański
-// mpview.cpp
+// Copyright (C) 2014, 2022 Balthasar Szczepański
+// mpview.cpp automatically generated from mpview.1.cpp
// view a post from the mirror.
-// 02.09.2014
+// 24.09.2022
//
// This file is part of OTT mirror.
//
#include <unistd.h>
#include <sys/wait.h>
-###RM_PATH
-###CAT_PATH
-###MAWK_PATH
+// ###C_RM_PATH: #define RM_PATH "/bin/rm"
+// ###C_CAT_PATH: #define CAT_PATH "/bin/cat"
+// ###C_MAWK_PATH: #define MAWK_PATH "/usr/bin/mawk"
-###NP_TOP_PATH
-###NP_END_PATH
-###INFO_PATH
-###POST_PATH3
-###OK_PATH3
-###PM_PATH3
-###FAIL_PATH3
+// ###C_NP_TOP_PATH: #define NP_TOP_PATH "/eizm/www/time/ott/np/top"
+// ###C_NP_END_PATH: #define NP_END_PATH "/eizm/www/time/ott/np/end"
+// ###C_INFO_PATH: #define INFO_PATH "/eizm/www/time/ott/info.htm"
+// ###C_POST_PATH_3: #define POST_PATH "/eizm/mem/ottmirror/mpost/"
+// ###C_OK_PATH_3: #define OK_PATH "/eizm/mem/ottmirror/mpost/ok/"
+// ###C_PM_PATH_3: #define PM_PATH "/eizm/mem/ottmirror/mpost/pm/"
+// ###C_FAIL_PATH_3: #define FAIL_PATH "/eizm/mem/ottmirror/mpost/fail/"
// ###POSTLIST_PATH3
// ###LAST_PATH3
-###AWK_VIEW
-###AWK_MVIEW
-###TEMP_PATHm
+// ###C_AWK_VIEW: #define AWK_VIEW "/eizm/pro/ottmirror/view.awk"
+// ###C_AWK_MVIEW: #define AWK_MVIEW "/eizm/pro/ottmirror/mview.awk"
+// ###TEMP_PATHm
int main()
{
// OTT mirror
-// Copyright (C) 2014 Balthasar Szczepański
-// mview.cpp
+// Copyright (C) 2014, 2022 Balthasar Szczepański
+// mview.cpp automatically generated from mview.1.cpp
// view posts from the mirror.
-// 12.09.2014
+// 24.09.2022
//
// This file is part of OTT mirror.
//
#include <unistd.h>
#include <sys/wait.h>
-###RM_PATH
-###CAT_PATH
-###MAWK_PATH
+// ###C_RM_PATH: #define RM_PATH "/bin/rm"
+// ###C_CAT_PATH: #define CAT_PATH "/bin/cat"
+// ###C_MAWK_PATH: #define MAWK_PATH "/usr/bin/mawk"
-###NP_TOP_PATH
-###NP_END_PATH
-###INFO_PATH
-###POST_PATH3
-###POSTLIST_PATH3
-###LAST_PATH3
+// ###C_NP_TOP_PATH: #define NP_TOP_PATH "/eizm/www/time/ott/np/top"
+// ###C_NP_END_PATH: #define NP_END_PATH "/eizm/www/time/ott/np/end"
+// ###C_INFO_PATH: #define INFO_PATH "/eizm/www/time/ott/info.htm"
+// ###C_POST_PATH_3: #define POST_PATH "/eizm/mem/ottmirror/mpost/"
+// ###C_LIST_PATH_3: #define LIST_PATH "/eizm/mem/ottmirror/mlist/"
+// ###C_LAST_PATH_3: #define LAST_PATH "/eizm/mem/ottmirror/mlist/last"
-###AWK_VIEW
-###AWK_MVIEW
-###TEMP_PATH3v
+// ###C_AWK_VIEW: AWK_VIEW "/eizm/pro/ottmirror/view.awk"
+// ###C_AWK_MVIEW: AWK_MVIEW "/eizm/pro/ottmirror/mview.awk"
+// ###TEMP_PATH3v
unsigned long p2np(unsigned long p)
{
for(short i=31;i>=0;--i)
{
np2 = np + (1L << i);
- sprintf(path,"%s%lu",POSTLIST_PATH,np2);
+ sprintf(path,"%s%lu",LIST_PATH,np2);
file=fopen(path,"rt");
if(file==NULL)
continue;
}
if(np==0)
return 1L;
- sprintf(path,"%s%lu",POSTLIST_PATH,np);
+ sprintf(path,"%s%lu",LIST_PATH,np);
file=fopen(path,"rt");
if(file==NULL)
return 1L;
}
fclose(file);
--np;
- sprintf(path,"%s%lu",POSTLIST_PATH,np);
+ sprintf(path,"%s%lu",LIST_PATH,np);
file=fopen(path,"rt");
if(file==NULL)
return 1L;
if(r)
printf("<p>Ch*rpin* M*stard</p>");
- sprintf(path2,"%s%lu",POSTLIST_PATH,np);
+ sprintf(path2,"%s%lu",LIST_PATH,np);
file=fopen(path2,"rt");
if(file!=NULL)
{
-# OTT mirror\r
-# Copyright (C) 2014 Balthasar Szczepański\r
-# pm.awk\r
-# send a PM.\r
-# 12.09.2014\r
-\r
-# This file is part of OTT mirror.\r
-#\r
-# OTT mirror is free software: you can redistribute it and/or modify\r
-# it under the terms of the GNU Affreo General Public License as published by\r
-# the Free Software Foundation, either version 3 of the License, or\r
-# (at your option) any later version.\r
-# \r
-# OTT mirror is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU Affreo General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU Affreo General Public License\r
-# along with OTT mirror. If not, see <http://www.gnu.org/licenses/>.\r
-\r
-BEGIN{\r
- FS="="\r
-###fora\r
-###USERAGENT3a\r
- prefix1="This%20is%20an%20automaticly%20generated%20message%20from%20the%20%5Burl%3D###own_url_encoded;%5D%D0%AFO%D0%AF%D0%AFIM%20TTO%5B%2Furl%5D.%0AYour%20post%20couldn%27t%20be%20posted.%0AThe%20%5Burl%3D###own_url_encoded;%2Flog%2Fbot3.log%5Dlog%5B%2Furl%5D%20may%20help%20you%20determine%20the%20reasons%20for%20this.%5Bquote%3D%22%5Bcolor%3D%230000FF%5D"\r
- prefix2="%5B%2Fcolor%5D%22%5D"\r
- postfix="%5B%2Fquote%5D%5Bright%5D%5Bsize%3D85%5D--%20posted%20by%20###bot3name_encoded;%5B%2Fsize%5D%5B%2Fright%5D"\r
- OK=0\r
- MUSTARD=1\r
- INDELIVERABLE=2\r
-};\r
-{\r
- eq=index($0,"=")\r
- argtab[substr($0,1,eq-1)]=substr($0,eq+1)\r
-};\r
-END{\r
- if(system("wget -q -t 3 --connect-timeout=60 --save-cookies=" cookiefile " -U " useragent " -O " tempfile " " fora "/ucp.php?mode=login"))\r
- {\r
- print "Pre-login fail."\r
- exit MUSTARD\r
- }\r
- while((getline cookie < cookiefile)>0)\r
- {\r
- if(cookie ~ /_sid/)\r
- {\r
- split(cookie,arr,"_sid[ \t]*")\r
- SID=arr[2]\r
- }\r
- }\r
- close(cookiefile)\r
- print "username=" name "&password=" pass "&sid=" SID "&login=Login" > postfile\r
- close(postfile)\r
- if(system("wget -q -t 3 --connect-timeout=60 --save-cookies=" cookiefile " --post-file=" postfile " -U " useragent " -O " tempfile " \"" fora "/ucp.php?mode=login\""))\r
- {\r
- print "Login fail."\r
- exit MUSTARD\r
- }\r
- \r
- while((getline temp < tempfile)>0)\r
- {\r
- if (temp ~ /<div class=.error/)\r
- {\r
- print temp\r
- print "LOGIN IMPOSSIBLE!"\r
- exit INDELIVERABLE\r
- }\r
- }\r
- close(tempfile)\r
- \r
- if(system("wget -q -t 3 --connect-timeout=60 --load-cookies=" cookiefile " --save-cookies=" cookiefile " -U " useragent " -O " tempfile " \"" fora "/ucp.php?i=pm&mode=compose&action=post&username_list=" argtab["username"] "&add_to=Add\""))\r
- {\r
- print "NewPM fail."\r
- exit MUSTARD\r
- }\r
- \r
- while((getline temp < tempfile)>0)\r
- {\r
- if(temp ~ /name=\"form_token/)\r
- #\"#"\r
- {\r
- split(temp,arr,"(value=\")|(\" ?/>)")\r
- argtab["form_token"]=arr[2]\r
- }\r
- if(temp ~ /name=\"creation_time/)\r
- #\"#"\r
- {\r
- split(temp,arr,"(value=\")|(\" ?/>)")\r
- argtab["creation_time"]=arr[2]\r
- }\r
- if(temp ~ /name=\"address_list/)\r
- #\"#"\r
- {\r
- split(temp,arr,"(address_list\[u\]\[)|(\]\")")\r
- argtab["address_list"]=arr[2]\r
- }\r
- if (temp ~ /<p class=\"error/)\r
- #\"#"\r
- {\r
- print temp\r
- print "NOBODY WITH THAT NAME"\r
- exit INDELIVERABLE\r
- }\r
- }\r
- close(tempfile)\r
- \r
- printf ("icon=10")>postfile\r
- printf ("&subject=Mirrorpost%%20failed")>postfile\r
- if("&addbbcode20" in argtab)\r
- printf ("&addbbcode20=%s",argtab["addbbcode20"])>>postfile\r
- printf ("&message=%s%s%%3A%%20%s%s%s%s",prefix1,argtab["timenumber"],argtab["subject"],prefix2,argtab["message"],postfix)>>postfile\r
- printf ("&address_list%%5Bu%%5D%%5B%s%%5D=to",argtab["address_list"])>>postfile\r
- printf ("&post=Submit")>postfile\r
- if("disable_smilies" in argtab)\r
- printf ("&disable_smilies=%s",argtab["disable_smilies"])>>postfile\r
- if("disable_magic_url" in argtab)\r
- printf ("&disable_magic_url=%s",argtab["disable_magic_url"])>>postfile\r
- printf ("&creation_time=%s",argtab["creation_time"])>>postfile\r
- printf ("&form_token=%s",argtab["form_token"])>>postfile\r
- close(postfile)\r
- \r
- if(system("wget -q -t 3 --connect-timeout=60 --load-cookies=" cookiefile " --save-cookies=" cookiefile " --post-file=" postfile " -U " useragent " -O " tempfile " \""fora "/ucp.php?i=pm&mode=compose&action=post\""))\r
- {\r
- print "Submit fail."\r
- exit MUSTARD\r
- }\r
- \r
- while((getline temp < tempfile)>0)\r
- {\r
- if (temp ~ /<p class=.error/)\r
- {\r
- print temp\r
- print "POST IMPOSSIBLE!"\r
- exit INDELIVERABLE\r
- }\r
- if (tolower(temp) ~ /<h2>information/)\r
- {\r
- success=1\r
- }\r
- }\r
- close(tempfile)\r
- \r
- if (success!=1)\r
- {\r
- print "Sent back to preview!"\r
- exit INDELIVERABLE\r
- }\r
- \r
- while((getline cookie < cookiefile)>0)\r
- {\r
- if(cookie ~ /_sid/)\r
- {\r
- split(cookie,arr,"_sid[ \t]*")\r
- SID=arr[2]\r
- break\r
- }\r
- }\r
- close(cookiefile)\r
- if(system("wget -q -t 3 --connect-timeout=60 -U " useragent " -O " cookiefile " \"" fora "/ucp.php?mode=logout&sid=" SID"\""))\r
- {\r
- print "Logout fail."\r
- } \r
-}\r
+# OTT mirror
+# Copyright (C) 2014, 2022 Balthasar Szczepański
+# pm.awk automatically generated from pm.1.awk
+# send a PM.
+# 24.09.2022
+
+# This file is part of OTT mirror.
+#
+# OTT mirror is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affreo General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# OTT mirror 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 Affreo General Public License for more details.
+#
+# You should have received a copy of the GNU Affreo General Public License
+# along with OTT mirror. If not, see <http://www.gnu.org/licenses/>.
+
+BEGIN{
+ FS="="
+###AWK_fora: fora="http://forums.xkcd.com"
+###AWK_useragent_3: useragent="\"bothasar_p (http://1190.bicyclesonthemoon.info/ott/; Time thread post bot)\""
+
+ prefix1="This%20is%20an%20automaticly%20generated%20message%20from%20the%20%5Burl%3D###AWK_own_url_encoded;%5D%D0%AFO%D0%AF%D0%AFIM%20TTO%5B%2Furl%5D.%0AYour%20post%20couldn%27t%20be%20posted.%0AThe%20%5Burl%3D###AWK_own_url_encoded;%2Flog%2Fbot3.log%5Dlog%5B%2Furl%5D%20may%20help%20you%20determine%20the%20reasons%20for%20this.%5Bquote%3D%22%5Bcolor%3D%230000FF%5D"
+ prefix2="%5B%2Fcolor%5D%22%5D"
+ postfix="%5B%2Fquote%5D%5Bright%5D%5Bsize%3D85%5D--%20posted%20by%20###AWK_bot3name_encoded;%5B%2Fsize%5D%5B%2Fright%5D"
+ OK=0
+ MUSTARD=1
+ INDELIVERABLE=2
+};
+{
+ eq=index($0,"=")
+ argtab[substr($0,1,eq-1)]=substr($0,eq+1)
+};
+END{
+ if(system("wget -q -t 3 --connect-timeout=60 --save-cookies=" cookiefile " -U " useragent " -O " tempfile " " fora "/ucp.php?mode=login"))
+ {
+ print "Pre-login fail."
+ exit MUSTARD
+ }
+ while((getline cookie < cookiefile)>0)
+ {
+ if(cookie ~ /_sid/)
+ {
+ split(cookie,arr,"_sid[ \t]*")
+ SID=arr[2]
+ }
+ }
+ close(cookiefile)
+ print "username=" name "&password=" pass "&sid=" SID "&login=Login" > postfile
+ close(postfile)
+ if(system("wget -q -t 3 --connect-timeout=60 --save-cookies=" cookiefile " --post-file=" postfile " -U " useragent " -O " tempfile " \"" fora "/ucp.php?mode=login\""))
+ {
+ print "Login fail."
+ exit MUSTARD
+ }
+
+ while((getline temp < tempfile)>0)
+ {
+ if (temp ~ /<div class=.error/)
+ {
+ print temp
+ print "LOGIN IMPOSSIBLE!"
+ exit INDELIVERABLE
+ }
+ }
+ close(tempfile)
+
+ if(system("wget -q -t 3 --connect-timeout=60 --load-cookies=" cookiefile " --save-cookies=" cookiefile " -U " useragent " -O " tempfile " \"" fora "/ucp.php?i=pm&mode=compose&action=post&username_list=" argtab["username"] "&add_to=Add\""))
+ {
+ print "NewPM fail."
+ exit MUSTARD
+ }
+
+ while((getline temp < tempfile)>0)
+ {
+ if(temp ~ /name=\"form_token/)
+ #\"#"
+ {
+ split(temp,arr,"(value=\")|(\" ?/>)")
+ argtab["form_token"]=arr[2]
+ }
+ if(temp ~ /name=\"creation_time/)
+ #\"#"
+ {
+ split(temp,arr,"(value=\")|(\" ?/>)")
+ argtab["creation_time"]=arr[2]
+ }
+ if(temp ~ /name=\"address_list/)
+ #\"#"
+ {
+ split(temp,arr,"(address_list\[u\]\[)|(\]\")")
+ argtab["address_list"]=arr[2]
+ }
+ if (temp ~ /<p class=\"error/)
+ #\"#"
+ {
+ print temp
+ print "NOBODY WITH THAT NAME"
+ exit INDELIVERABLE
+ }
+ }
+ close(tempfile)
+
+ printf ("icon=10")>postfile
+ printf ("&subject=Mirrorpost%%20failed")>postfile
+ if("&addbbcode20" in argtab)
+ printf ("&addbbcode20=%s",argtab["addbbcode20"])>>postfile
+ printf ("&message=%s%s%%3A%%20%s%s%s%s",prefix1,argtab["timenumber"],argtab["subject"],prefix2,argtab["message"],postfix)>>postfile
+ printf ("&address_list%%5Bu%%5D%%5B%s%%5D=to",argtab["address_list"])>>postfile
+ printf ("&post=Submit")>postfile
+ if("disable_smilies" in argtab)
+ printf ("&disable_smilies=%s",argtab["disable_smilies"])>>postfile
+ if("disable_magic_url" in argtab)
+ printf ("&disable_magic_url=%s",argtab["disable_magic_url"])>>postfile
+ printf ("&creation_time=%s",argtab["creation_time"])>>postfile
+ printf ("&form_token=%s",argtab["form_token"])>>postfile
+ close(postfile)
+
+ if(system("wget -q -t 3 --connect-timeout=60 --load-cookies=" cookiefile " --save-cookies=" cookiefile " --post-file=" postfile " -U " useragent " -O " tempfile " \""fora "/ucp.php?i=pm&mode=compose&action=post\""))
+ {
+ print "Submit fail."
+ exit MUSTARD
+ }
+
+ while((getline temp < tempfile)>0)
+ {
+ if (temp ~ /<p class=.error/)
+ {
+ print temp
+ print "POST IMPOSSIBLE!"
+ exit INDELIVERABLE
+ }
+ if (tolower(temp) ~ /<h2>information/)
+ {
+ success=1
+ }
+ }
+ close(tempfile)
+
+ if (success!=1)
+ {
+ print "Sent back to preview!"
+ exit INDELIVERABLE
+ }
+
+ while((getline cookie < cookiefile)>0)
+ {
+ if(cookie ~ /_sid/)
+ {
+ split(cookie,arr,"_sid[ \t]*")
+ SID=arr[2]
+ break
+ }
+ }
+ close(cookiefile)
+ if(system("wget -q -t 3 --connect-timeout=60 -U " useragent " -O " cookiefile " \"" fora "/ucp.php?mode=logout&sid=" SID"\""))
+ {
+ print "Logout fail."
+ }
+}
-# OTT mirror\r
-# Copyright (C) 2014 Balthasar Szczepański\r
-# post.awk\r
-# send a post.\r
-# 20.03.2015\r
-\r
-# This file is part of OTT mirror.\r
-#\r
-# OTT mirror is free software: you can redistribute it and/or modify\r
-# it under the terms of the GNU Affreo General Public License as published by\r
-# the Free Software Foundation, either version 3 of the License, or\r
-# (at your option) any later version.\r
-# \r
-# OTT mirror is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU Affreo General Public License for more details.\r
-# \r
-# You should have received a copy of the GNU Affreo General Public License\r
-# along with OTT mirror. If not, see <http://www.gnu.org/licenses/>.\r
-\r
-BEGIN{\r
- FS="="\r
-###fora\r
-###USERAGENT3a\r
-};\r
-{\r
- eq=index($0,"=")\r
- argtab[substr($0,1,eq-1)]=substr($0,eq+1)\r
-};\r
-END{\r
- if(system("wget -q -t 3 --connect-timeout=60 --save-cookies=" cookiefile " -U " useragent " -O " tempfile " " fora "/ucp.php?mode=login"))\r
- {\r
- print "Pre-login fail."\r
- exit 1\r
- }\r
- while((getline cookie < cookiefile)>0)\r
- {\r
- if(cookie ~ /_sid/)\r
- {\r
- split(cookie,arr,"_sid[ \t]*")\r
- SID=arr[2]\r
- }\r
- }\r
- close(cookiefile)\r
- print "username=" argtab["username"] "&password=" argtab["password"] "&sid=" SID "&login=Login" > postfile\r
- close(postfile)\r
- if(system("wget -q -t 3 --connect-timeout=60 --save-cookies=" cookiefile " --post-file=" postfile " -U " useragent " -O " tempfile " \"" fora "/ucp.php?mode=login\""))\r
- {\r
- print "Login fail."\r
- exit 1\r
- }\r
- \r
- while((getline temp < tempfile)>0)\r
- {\r
- if (temp ~ /<div class=.error/)\r
- {\r
- print temp\r
- print "LOGIN IMPOSSIBLE!"\r
- exit 2\r
- }\r
- }\r
- close(tempfile)\r
- \r
- if(system("wget -q -t 3 --connect-timeout=60 --load-cookies=" cookiefile " --save-cookies=" cookiefile " -U " useragent " -O " tempfile " \"" fora "/posting.php?mode=reply&f=7&t=101043\""))\r
- {\r
- print "Postreply fail."\r
- exit 1\r
- }\r
- \r
- while((getline temp < tempfile)>0)\r
- {\r
- if(temp ~ /name=\"form_token/)\r
- #\"#"\r
- {\r
- temp=substr(temp, index(temp, "value=\"")+7)\r
- temp=substr(temp, 1, index(temp, "\"")-1)\r
- argtab["form_token"]=urlencode(entitydecode(temp))\r
- }\r
- if(temp ~ /name=\"creation_time/)\r
- #\"#"\r
- {\r
- temp=substr(temp, index(temp, "value=\"")+7)\r
- temp=substr(temp, 1, index(temp, "\"")-1)\r
- argtab["creation_time"]=urlencode(entitydecode(temp))\r
- }\r
- if (tolower(temp) ~ /<h2>information/)\r
- {\r
- print "Unexpected h2: information\n"\r
- getline temp < tempfile\r
- print temp\r
- exit 1\r
- }\r
- }\r
- close(tempfile)\r
- \r
- printf ("subject=%s",argtab["subject"])>postfile\r
- if("&addbbcode20" in argtab)\r
- printf ("&addbbcode20=%s",argtab["addbbcode20"])>>postfile\r
- printf ("&message=%s",argtab["message"])>>postfile\r
- printf ("&post=%s","Submit")>>postfile\r
- if("disable_bbcode" in argtab)\r
- printf ("&disable_bbcode=%s",argtab["disable_bbcode"])>>postfile\r
- if("disable_smilies" in argtab)\r
- printf ("&disable_smilies=%s",argtab["disable_smilies"])>>postfile\r
- if("disable_magic_url" in argtab)\r
- printf ("&disable_magic_url=%s",argtab["disable_magic_url"])>>postfile\r
- if("attach_sig" in argtab)\r
- printf ("&attach_sig=%s",argtab["attach_sig"])>>postfile\r
- if("notify" in argtab)\r
- printf ("¬ify=%s",argtab["notify"])>>postfile\r
- printf ("&creation_time=%s",argtab["creation_time"])>>postfile\r
- printf ("&form_token=%s",argtab["form_token"])>>postfile\r
- close(postfile)\r
- \r
- system("sleep 1")\r
- if(system("wget -q -t 3 --connect-timeout=60 --load-cookies=" cookiefile " --save-cookies=" cookiefile " --post-file=" postfile " -U " useragent " -O " tempfile " \""fora "/posting.php?mode=reply&f=7&t=101043\""))\r
- {\r
- print "Submit fail."\r
- exit 1\r
- }\r
- \r
- while((getline temp < tempfile)>0)\r
- {\r
- if (temp ~ /<p class=.error/)\r
- {\r
- print temp\r
- print "POST IMPOSSIBLE!"\r
- exit 2\r
- }\r
- if (tolower(temp) ~ /<h2>information/)\r
- {\r
- success=1\r
- }\r
- }\r
- close(tempfile)\r
- \r
- if (success!=1)\r
- {\r
- print "Sent back to preview!"\r
- exit INDELIVERABLE\r
- }\r
- \r
- while((getline cookie < cookiefile)>0)\r
- {\r
- if(cookie ~ /_sid/)\r
- {\r
- split(cookie,arr,"_sid[ \t]*")\r
- SID=arr[2]\r
- break\r
- }\r
- }\r
- close(cookiefile)\r
- if(system("wget -q -t 3 --connect-timeout=60 -U " useragent " -O " tempfile " \"" fora "/ucp.php?mode=logout&sid=" SID"\""))\r
- {\r
- print "Logout fail."\r
- }\r
- \r
- \r
-}\r
-function urlencode(name,all, len,iii,escaped,ch)\r
-{\r
- len=length(name)\r
- escaped=""\r
- for(iii=1;iii<=len;++iii)\r
- {\r
- ch=substr(name,iii,1);\r
- if ((ch ~ /[a-zA-Z0-9\.\-_~]/)&&(all==""))\r
- escaped = escaped ch\r
- else\r
- escaped = escaped "%" ch2hex[ch]\r
- }\r
- return escaped\r
-}function entitydecode(ht ,i,j,un,num)\r
-# quot, amp, lt, gt, nbsp, and decimal numbered.\r
-{\r
- while ((i=match(ht, /&((#[0-9]+)|([a-zA-Z]+));/))!=0)#\r
- {\r
- un=un substr(ht, 1, i-1)\r
- ht=substr(ht, i)\r
- j=index(ht, ";")\r
- \r
- if(ht~/^&#/)\r
- {\r
- num=int(substr(ht, 3, j-3))\r
- un=un sprintf("%c",num)\r
- }\r
- else\r
- {\r
- num=tolower(substr(ht, 2, j-2))\r
- if(num == "quot")\r
- un=un "\""\r
- else if(num == "amp")\r
- un=un "&"\r
- else if(num == "lt")\r
- un=un "<"\r
- else if(num == "gt")\r
- un=un ">"\r
- else if(num == "nbsp")\r
- un=un "\xA0"\r
- else\r
- un = un ht\r
- }\r
- ht=substr(ht, j+1)\r
- }\r
- un=un ht\r
- return un\r
-}\r
+# OTT mirror
+# Copyright (C) 2014, 2015, 2022 Balthasar Szczepański
+# post.awk automatically generated from post.1.awk
+# send a post.
+# 24.09.2022
+
+# This file is part of OTT mirror.
+#
+# OTT mirror is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affreo General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# OTT mirror 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 Affreo General Public License for more details.
+#
+# You should have received a copy of the GNU Affreo General Public License
+# along with OTT mirror. If not, see <http://www.gnu.org/licenses/>.
+
+BEGIN{
+ FS="="
+###AWK_fora: fora="http://forums.xkcd.com"
+###AWK_useragent_3: useragent="\"bothasar_p (http://1190.bicyclesonthemoon.info/ott/; Time thread post bot)\""
+};
+{
+ eq=index($0,"=")
+ argtab[substr($0,1,eq-1)]=substr($0,eq+1)
+};
+END{
+ if(system("wget -q -t 3 --connect-timeout=60 --save-cookies=" cookiefile " -U " useragent " -O " tempfile " " fora "/ucp.php?mode=login"))
+ {
+ print "Pre-login fail."
+ exit 1
+ }
+ while((getline cookie < cookiefile)>0)
+ {
+ if(cookie ~ /_sid/)
+ {
+ split(cookie,arr,"_sid[ \t]*")
+ SID=arr[2]
+ }
+ }
+ close(cookiefile)
+ print "username=" argtab["username"] "&password=" argtab["password"] "&sid=" SID "&login=Login" > postfile
+ close(postfile)
+ if(system("wget -q -t 3 --connect-timeout=60 --save-cookies=" cookiefile " --post-file=" postfile " -U " useragent " -O " tempfile " \"" fora "/ucp.php?mode=login\""))
+ {
+ print "Login fail."
+ exit 1
+ }
+
+ while((getline temp < tempfile)>0)
+ {
+ if (temp ~ /<div class=.error/)
+ {
+ print temp
+ print "LOGIN IMPOSSIBLE!"
+ exit 2
+ }
+ }
+ close(tempfile)
+
+ if(system("wget -q -t 3 --connect-timeout=60 --load-cookies=" cookiefile " --save-cookies=" cookiefile " -U " useragent " -O " tempfile " \"" fora "/posting.php?mode=reply&f=7&t=101043\""))
+ {
+ print "Postreply fail."
+ exit 1
+ }
+
+ while((getline temp < tempfile)>0)
+ {
+ if(temp ~ /name=\"form_token/)
+ #\"#"
+ {
+ temp=substr(temp, index(temp, "value=\"")+7)
+ temp=substr(temp, 1, index(temp, "\"")-1)
+ argtab["form_token"]=urlencode(entitydecode(temp))
+ }
+ if(temp ~ /name=\"creation_time/)
+ #\"#"
+ {
+ temp=substr(temp, index(temp, "value=\"")+7)
+ temp=substr(temp, 1, index(temp, "\"")-1)
+ argtab["creation_time"]=urlencode(entitydecode(temp))
+ }
+ if (tolower(temp) ~ /<h2>information/)
+ {
+ print "Unexpected h2: information\n"
+ getline temp < tempfile
+ print temp
+ exit 1
+ }
+ }
+ close(tempfile)
+
+ printf ("subject=%s",argtab["subject"])>postfile
+ if("&addbbcode20" in argtab)
+ printf ("&addbbcode20=%s",argtab["addbbcode20"])>>postfile
+ printf ("&message=%s",argtab["message"])>>postfile
+ printf ("&post=%s","Submit")>>postfile
+ if("disable_bbcode" in argtab)
+ printf ("&disable_bbcode=%s",argtab["disable_bbcode"])>>postfile
+ if("disable_smilies" in argtab)
+ printf ("&disable_smilies=%s",argtab["disable_smilies"])>>postfile
+ if("disable_magic_url" in argtab)
+ printf ("&disable_magic_url=%s",argtab["disable_magic_url"])>>postfile
+ if("attach_sig" in argtab)
+ printf ("&attach_sig=%s",argtab["attach_sig"])>>postfile
+ if("notify" in argtab)
+ printf ("¬ify=%s",argtab["notify"])>>postfile
+ printf ("&creation_time=%s",argtab["creation_time"])>>postfile
+ printf ("&form_token=%s",argtab["form_token"])>>postfile
+ close(postfile)
+
+ system("sleep 1")
+ if(system("wget -q -t 3 --connect-timeout=60 --load-cookies=" cookiefile " --save-cookies=" cookiefile " --post-file=" postfile " -U " useragent " -O " tempfile " \""fora "/posting.php?mode=reply&f=7&t=101043\""))
+ {
+ print "Submit fail."
+ exit 1
+ }
+
+ while((getline temp < tempfile)>0)
+ {
+ if (temp ~ /<p class=.error/)
+ {
+ print temp
+ print "POST IMPOSSIBLE!"
+ exit 2
+ }
+ if (tolower(temp) ~ /<h2>information/)
+ {
+ success=1
+ }
+ }
+ close(tempfile)
+
+ if (success!=1)
+ {
+ print "Sent back to preview!"
+ exit INDELIVERABLE
+ }
+
+ while((getline cookie < cookiefile)>0)
+ {
+ if(cookie ~ /_sid/)
+ {
+ split(cookie,arr,"_sid[ \t]*")
+ SID=arr[2]
+ break
+ }
+ }
+ close(cookiefile)
+ if(system("wget -q -t 3 --connect-timeout=60 -U " useragent " -O " tempfile " \"" fora "/ucp.php?mode=logout&sid=" SID"\""))
+ {
+ print "Logout fail."
+ }
+
+
+}
+function urlencode(name,all, len,iii,escaped,ch)
+{
+ len=length(name)
+ escaped=""
+ for(iii=1;iii<=len;++iii)
+ {
+ ch=substr(name,iii,1);
+ if ((ch ~ /[a-zA-Z0-9\.\-_~]/)&&(all==""))
+ escaped = escaped ch
+ else
+ escaped = escaped "%" ch2hex[ch]
+ }
+ return escaped
+}function entitydecode(ht ,i,j,un,num)
+# quot, amp, lt, gt, nbsp, and decimal numbered.
+{
+ while ((i=match(ht, /&((#[0-9]+)|([a-zA-Z]+));/))!=0)#
+ {
+ un=un substr(ht, 1, i-1)
+ ht=substr(ht, i)
+ j=index(ht, ";")
+
+ if(ht~/^&#/)
+ {
+ num=int(substr(ht, 3, j-3))
+ un=un sprintf("%c",num)
+ }
+ else
+ {
+ num=tolower(substr(ht, 2, j-2))
+ if(num == "quot")
+ un=un "\""
+ else if(num == "amp")
+ un=un "&"
+ else if(num == "lt")
+ un=un "<"
+ else if(num == "gt")
+ un=un ">"
+ else if(num == "nbsp")
+ un=un "\xA0"
+ else
+ un = un ht
+ }
+ ht=substr(ht, j+1)
+ }
+ un=un ht
+ return un
+}
// OTT mirror
-// Copyright (C) 2014 Balthasar Szczepański
-// post.cpp
+// Copyright (C) 2014, 2022 Balthasar Szczepański
+// post.cpp automatically generated from post.1.cpp
// write posts from the mirror.
-// 31.08.2015
+// 24.09.2022
//
// This file is part of OTT mirror.
//
#include <string.h>
#include <sys/wait.h>
-###RM_PATH
-###MV_PATH
-###CAT_PATH
-###MAWK_PATH
+// ###C_RM_PATH: #define RM_PATH "/bin/rm"
+// ###C_MV_PATH: #define MV_PATH "/bin/mv"
+// ###C_CAT_PATH: #define CAT_PATH "/bin/cat"
+// ###C_MAWK_PATH: #define MAWK_PATH "/usr/bin/mawk"
-###POST_PATH
-###INFO_PATH
-###MPOST_PATH
-###MLIST_PATH
-###MLAST_PATH
-###MFRONT_PATH
+// ###C_POST_PATH: #define POST_PATH "/eizm/www/time/ott/post.htm"
+// ###C_INFO_PATH: #define INFO_PATH "/eizm/www/time/ott/info.htm"
+// ###C_MPOST_PATH: #define MPOST_PATH "/eizm/mem/ottmirror/mpost/"
+// ###C_MLIST_PATH: #define MLIST_PATH "/eizm/mem/ottmirror/mlist/"
+// ###C_MLAST_PATH: #define MLAST_PATH "/eizm/mem/ottmirror/mlist/last"
+// ###C_MFRONT_PATH: #define MFRONT_PATH "/eizm/www/time/ott/mfront"
-###AWK_PREVIEW
-###AWK_VIEW
-###TEMP_PATHp
-###AWK_B2H
-###AWK_VERIFY
+// ###C_AWK_PREVIEW: AWK_PREVIEW "/eizm/pro/ottmirror/preview.awk"
+// ###C_AWK_VIEW: AWK_VIEW "/eizm/pro/ottmirror/view.awk"
+// ###TEMP_PATHp
+// ###C_AWK_B2H: AWK_B2H "/eizm/pro/ottmirror/bb2html.awk"
+// ###C_AWK_VERIFY: AWK_VERIFY "/eizm/pro/ottmirror/verify.awk"
+
+// ###C_BOT3NAME_ENCODED: #define BOT3NAME_ENCODED "bothasar_p"
+// ###C_BOT3_URL: #define BOT3_URL "http://1190.bicyclesonthemoon.info/bothasar_p/"
s_cgi *cgi;
pid_t sub;
for(unsigned long i=((lastpage>5)?(lastpage-2):1);i<lastpage;++i)
fprintf(tempfile,"<a href=\"/ott/mview?np=%lu\" >%lu</a><span class=\"page-sep\" >, </span>",i,i);
fprintf(tempfile,"<a href=\"/ott/mview?np=%lu\" >%lu</a>",lastpage,lastpage);
- fprintf(tempfile,"</span></strong><img src=\"/ott/prosilver/imageset/icon_topic_attach.gif\" width=\"7\" height=\"10\" alt=\"Attachment(s)\" title=\"Attachment(s)\" /> by <a href=\"http://1190.bicyclesonthemoon.info/bothasar_p/\" >bothasar_p</a> » Sat Apr 05, 2014 9:40 pm UTC</dt>\n");
+ fprintf(tempfile,"</span></strong><img src=\"/ott/prosilver/imageset/icon_topic_attach.gif\" width=\"7\" height=\"10\" alt=\"Attachment(s)\" title=\"Attachment(s)\" /> by <a href=\"%s\" >%s</a> » Sat Apr 05, 2014 9:40 pm UTC</dt>\n", BOT3_URL, BOT3NAME_ENCODED);
fprintf(tempfile,"<dd class=\"posts\" >%lu <dfn>Replies</dfn></dd>\n",(unsigned long)((lastpage-1)*40+postslast));
fprintf(tempfile,"<dd class=\"views\" >NaN <dfn>Views</dfn></dd>\n");
fprintf(tempfile,"<dd class=\"lastpost\" ><span><dfn>Last post </dfn>by <a href=\"#\" >");
// OTT mirror\r
-// Copyright (C) 2014 Balthasar Szczepański\r
-// posted.cpp\r
+// Copyright (C) 2014, 2022 Balthasar Szczepański\r
+// posted.cpp automatically generated from posted.1.cpp\r
// posts recently sent from the mirror.\r
-// 23.11.2014\r
+// 24.09.2022\r
//\r
// This file is part of OTT mirror.\r
//\r
// #include <string.h>\r
#include <sys/wait.h>\r
\r
-###TEMP_PATHr\r
-###OK_PATH3\r
-###PM_PATH3\r
-###FAIL_PATH3\r
-###LS_PATH\r
-###RM_PATH\r
-###MAWK_PATH\r
-###AWK_POSTED\r
+// ###TEMP_PATHr\r
+// ###C_OK_PATH_3: #define OK_PATH "/eizm/mem/ottmirror/mpost/ok/"\r
+// ###C_PM_PATH_3: #define PM_PATH "/eizm/mem/ottmirror/mpost/pm/"\r
+// ###C_FAIL_PATH_3: #define FAIL_PATH "/eizm/mem/ottmirror/mpost/fail/"\r
+// ###C_LS_PATH: #define LS_PATH "/bin/ls"\r
+// ###C_RM_PATH: #define RM_PATH "/bin/rm"\r
+// ###C_MAWK_PATH: #define MAWK_PATH "/usr/bin/mawk"\r
+// ###C_AWK_POSTED: #define AWK_POSTED "/eizm/pro/ottmirror/posted.awk"\r
+\r
+// ###C_OWN_DOMAIN_ENCODED: #define \13 "1190.bicyclesonthemoon.info"\r
\r
s_cgi *cgi;\r
pid_t sub;\r
printf("<meta http-equiv=\"Content-type\" content=\"text/html; charset=UTF-8\">\n");\r
printf("<link rel=\"icon\" type=\"image/png\" href=\"/img/favicon.png\">\n");\r
printf("<link rel=\"stylesheet\" href=\"/css/botm.css\">\n");\r
- printf("</head><body><a href=\"/\"><img src=\"/img/botmlogo2.png\" alt=\"1190.bicyclesonthemoon.info\" border=\"0\"></a>\n");\r
+ printf("</head><body><a href=\"/\"><img src=\"/img/botmlogo2.png\" alt=\"%s\" border=\"0\"></a>\n", OWN_DOMAIN_ENCODED);\r
printf("<h1>Posted from the ЯOЯЯIM TTO</h1>\n");\r
\r
fflush(stdout);\r
printf("</table><br>\n");\r
}\r
printf("<a href=\"/ott\">back to the ЯOЯЯIM TTO</a><br><br>\n");\r
- printf("<a href=\"/\">1190.bicyclesonthemoon.info</a></body></html>\n");\r
+ printf("<a href=\"/\">%s</a></body></html>\n", OWN_DOMAIN_ENCODED);\r
\r
fflush(stdout);\r
sub=fork();\r
# OTT mirror\r
-# Copyright (C) 2014 Balthasar Szczepañski\r
+# Copyright (C) 2014 Balthasar Szczepański\r
# posted.awk\r
# one post recently sent from the mirror\r
# 2.08.2014\r
configure: /botm/bin/config/configure.pl
useragent2: bothasar_t (http://1190.bicyclesonthemoon.info/ott/; Time thread mirror bot)
+useragent3: bothasar_p (http://1190.bicyclesonthemoon.info/ott/; Time thread post bot)
+
bin_path: /botm/bin/ottmirror
+log_path: /botm/log/ottmirror
+mem_path: /botm/data/ottmirror
+tmp_path: /botm/tmp/ottmirror
+www_path: /botm/www/1190/ott
-#ictaddr= "http://forums.xkcd.com/viewforum.php?f=7"
-#ottaddr= "http://forums.xkcd.com/viewtopic.php?f=7&t=101043&start="
+ict_addr: http://forums.xkcd.com/viewforum.php?f=7
+ott_addr: http://forums.xkcd.com/viewtopic.php?f=7&t=101043&start=
fora_addr: http://forums.xkcd.com
wayback_addr: http://web.archive.org/web/
attachment_regexp: ((src)|(href))=.http:\/\/(www\.)?((for(ums3?|a)\.xkcd\.com)|echochamber\.me)\/download\/file.php\?(mode=view\&)?id=
own_image_regexp: ((1190.bicyclesonthemoon.(dnsd.)?info)|(1190-botm.dnsdynamic.com))\/ott\/image\/
+own_domain: 1190.bicyclesonthemoon.info
+own_url: http://1190.bicyclesonthemoon.info/ott
+bot3name: bothasar_p
+bot3_url: http://1190.bicyclesonthemoon.info/bothasar_p/
+cat: /usr/bin/cat
mv: /usr/bin/mv
perl: /usr/bin/perl
rm: /usr/bin/rm
-wget: /usr/bin/wget
\ No newline at end of file
+ls: /usr/bin/ls
+wget: /usr/bin/wget
+awk: /usr/bin/mawk
_AWK_DEFINE_STR: $0="@_ESCAPE($1)"
+_C_DEFINE_STR: #define $0 "@_ESCAPE($1)"
+
+_bot3name_encoded = @_URL_ENCODE($bot3name)
+_own_domain_encoded = @_URL_ENCODE($own_domain)
+_own_url_encoded = @_URL_ENCODE($own_url)
+
+_bin_awk_b2h_path = @_PATH($bin_path, bb2html.awk)
+_bin_awk_bot2_path = @_PATH($bin_path, bot2.awk)
+_bin_awk_index_path = @_PATH($bin_path, index.awk)
+_bin_awk_latest_path = @_PATH($bin_path, findlatest.awk)
+_bin_awk_list_path = @_PATH($bin_path, list.awk)
+_bin_awk_mview_path = @_PATH($bin_path, mview.awk)
+_bin_awk_pm_path = @_PATH($bin_path, pm.awk)
+_bin_awk_post_path = @_PATH($bin_path, post.awk)
+_bin_awk_posted_path = @_PATH($bin_path, posted.awk)
+_bin_awk_preview_path= @_PATH($bin_path, preview.awk)
+_bin_awk_upload_path = @_PATH($bin_path, upload.awk)
+_bin_awk_verify_path = @_PATH($bin_path, verify.awk)
+_bin_awk_view_path = @_PATH($bin_path, view.awk)
+_bin_findpost_path = @_PATH($bin_path, findpost)
+_bin_image_path = @_PATH($bin_path, image)
+
+_log_bot2_path = @_PATH($log_path, bot2.log.)
+_log_bot3_path = @_PATH($log_path, bot3.log)
+
+_mem_last_path = @_PATH($mem_path, lasttime.)
+_mem_lasttm_path_3 = @_PATH($mem_path, bot3last)
+_mem_list_path = @_PATH($mem_path, mlist)
+_mem_name_path = @_PATH($mem_path, name)
+_mem_post_path = @_PATH($mem_path, mpost)
+
+_mem_fail_path = @_PATH($_mem_post_path, fail)
+_mem_last_path_3 = @_PATH($_mem_list_path, last)
+_mem_ok_path = @_PATH($_mem_post_path, ok)
+_mem_pm_path = @_PATH($_mem_post_path, pm)
+
+_mem_fail_path_ = @_PATH($_mem_fail_path,)
+_mem_list_path_ = @_PATH($_mem_list_path,)
+_mem_ok_path_ = @_PATH($_mem_ok_path,)
+_mem_pm_path_ = @_PATH($_mem_pm_path,)
+_mem_post_path_ = @_PATH($_mem_post_path,)
+
+_tmp_bot3cook_path = @_PATH($tmp_path, bot3cook)
+_tmp_bot3post_path = @_PATH($tmp_path, bot3post)
+_tmp_bot3stop_path = @_PATH($tmp_path, bot3stop)
+_tmp_bot3temp_path = @_PATH($tmp_path, bot3temp)
+_tmp_np_path_0 = @_PATH($tmp_path, np.p0.)
+_tmp_np_path_1 = @_PATH($tmp_path, np.p1.)
+_tmp_np_path_2 = @_PATH($tmp_path, np.p2.)
+_tmp_np_path_3 = @_PATH($tmp_path, np.p3.)
+_tmp_stop_path = @_PATH($tmp_path, fullstop.)
+
+_www_att_path = @_PATH($www_path, attachment)
+_www_av_path = @_PATH($www_path, avatar)
+_www_end_path = @_PATH($www_path, end)
+_www_img_path = @_PATH($www_path, image)
+_www_ind_path = @_PATH($www_path, ottfront)
+_www_ind_path_3 = @_PATH($www_path, mfront)
+_www_inf_path = @_PATH($www_path, otterinf)
+_www_info_path = @_PATH($www_path, info.htm)
+_www_list_path = @_PATH($www_path, postlist)
+_www_post_path = @_PATH($www_path, post.htm)
+_www_sig_path = @_PATH($www_path, sig)
+_www_top_path = @_PATH($www_path, top)
+_www_up_path = @_PATH($www_path, np)
+
+_www_last_path = @_PATH($_www_up_path, last)
+_www_np_top_path = @_PATH($_www_up_path, top)
+_www_np_end_path = @_PATH($_www_up_path, end)
+
+_www_att_path_ = @_PATH($_www_att_path,)
+_www_av_path_ = @_PATH($_www_av_path,)
+_www_img_path_ = @_PATH($_www_img_path,)
+_www_inf_path_ = @_PATH($_www_inf_path,)
+_www_list_path_ = @_PATH($_www_list_path,)
+_www_sig_path_ = @_PATH($_www_sig_path,)
+_www_up_path_ = @_PATH($_www_up_path,)
-_bin_findpost_path = @_PATH($bin_path, findpost)
-_bin_image_path = @_PATH($bin_path, image)
MAKE_CONFIGURE = CONFIGURE = $configure
MAKE_TARGET = TARGET = $target
MAKE_PERL = PERL = $perl
MAKE_RM = RM = $rm
-AWK_useragent_2 = \t@_AWK_DEFINE_STR(useragent, "$useragent2")
+
AWK_findpost_path = \t@_AWK_DEFINE_STR(findpost_path, $_bin_findpost_path)
+AWK_fora = \t@_AWK_DEFINE_STR(fora, $fora_addr)
AWK_imgformat_path = \t@_AWK_DEFINE_STR(imgformat_path, $_bin_image_path)
+AWK_mv = \t@_AWK_DEFINE_STR(mv, $mv)
+AWK_useragent_2 = \t@_AWK_DEFINE_STR(useragent, "$useragent2")
+AWK_useragent_3 = \t@_AWK_DEFINE_STR(useragent, "$useragent3")
AWK_wayback = \t@_AWK_DEFINE_STR(wayback, $wayback_addr)
-AWK_fora = \t@_AWK_DEFINE_STR(fora, $fora_addr)
AWK_wget = \t@_AWK_DEFINE_STR(wget, $wget)
-AWK_mv = \t@_AWK_DEFINE_STR(mv, $mv)
+AWK_attachment_regexp = /$attachment_regexp/
+AWK_avatar_regexp = /$avatar_regexp/
+AWK_bot3name_encoded = $_bot3name_encoded
AWK_links_regexp = /$links_regexp/
+AWK_own_image_regexp = /$own_image_regexp/
+AWK_own_url_encoded = $_own_url_encoded
AWK_prosilver_regexp = /$prosilver_regexp/
AWK_prosilver_regexp2 = /$prosilver_regexp2/
AWK_smiley_regexp = /$smiley_regexp/
AWK_smiley_regexp2 = /$smiley_regexp2/
-AWK_avatar_regexp = /$avatar_regexp/
-AWK_attachment_regexp = /$attachment_regexp/
-AWK_own_image_regexp = /$own_image_regexp/
-AWK_thread_id = $thread_id
\ No newline at end of file
+AWK_thread_id = $thread_id
+
+# data
+C_BOT3NAME_ENCODED = @_C_DEFINE_STR(BOT3NAME_ENCODED, $_bot3name_encoded)
+C_OWN_DOMAIN_ENCODED = @_C_DEFINE_STR(OWN_DOMAIN_ENCODED, $_own_domain_encoded)
+C_USERAGENT_2 = @_C_DEFINE_STR(USERAGENT, $useragent2)
+C_USERAGENT_3 = @_C_DEFINE_STR(USERAGENT, $useragent3)
+
+# URL
+C_BOT3_URL = @_C_DEFINE_STR(BOT3_URL, $bot3_url)
+C_FORA_ADDRESS = @_C_DEFINE_STR(FORA_ADDRESS, $fora_addr)
+C_ICT_ADDRESS = @_C_DEFINE_STR(ICT_ADDRESS, $ict_addr)
+C_OTT_ADDRESS = @_C_DEFINE_STR(OTT_ADDRESS, $ott_addr)
+C_OTT_ADDRESS = @_C_DEFINE_STR(OTT_ADDRESS, $ott_addr)
+
+# dir-log
+C_LOG_PATH_2 = @_C_DEFINE_STR(LOG_PATH, $_log_bot2_path)
+C_LOG_PATH_3 = @_C_DEFINE_STR(LOG_PATH, $_log_bot3_path)
+
+# dir-mem
+C_FAIL_PATH_3 = @_C_DEFINE_STR(FAIL_PATH, $_mem_fail_path_)
+C_LAST_PATH = @_C_DEFINE_STR(LAST_PATH, $_mem_last_path)
+C_LAST_PATH_3 = @_C_DEFINE_STR(LAST_PATH, $_mem_last_path_3)
+C_LASTTM_PATH_3 = @_C_DEFINE_STR(LASTTIME_PATH, $_mem_lasttm_path_3)
+C_LIST_PATH_3 = @_C_DEFINE_STR(LIST_PATH, $_mem_list_path_)
+C_MLAST_PATH = @_C_DEFINE_STR(MLAST_PATH, $_mem_last_path_3)
+C_MLIST_PATH = @_C_DEFINE_STR(MLIST_PATH, $_mem_list_path_)
+C_MPOST_PATH = @_C_DEFINE_STR(MPOST_PATH, $_mem_post_path_)
+C_NAME_PATH = @_C_DEFINE_STR(NAME_PATH, $_mem_name_path)
+C_OK_PATH_3 = @_C_DEFINE_STR(OK_PATH, $_mem_ok_path_)
+C_PM_PATH_3 = @_C_DEFINE_STR(PM_PATH, $_mem_pm_path_)
+C_POST_PATH_3 = @_C_DEFINE_STR(POST_PATH, $_mem_post_path_)
+
+# dir-tmp
+C_COOKIE_PATH_3 = @_C_DEFINE_STR(COOKIE_PATH, $_tmp_bot3cook_path)
+C_NP_PATH_0 = @_C_DEFINE_STR(NP_PATH, $_tmp_np_path_0)
+C_NP_PATH_1 = @_C_DEFINE_STR(NP_PATH_1, $_tmp_np_path_1)
+C_NP_PATH_2 = @_C_DEFINE_STR(NP_PATH_2, $_tmp_np_path_2)
+C_NP_PATH_3 = @_C_DEFINE_STR(NP_PATH_3, $_tmp_np_path_3)
+C_POSTDATA_PATH_3 = @_C_DEFINE_STR(POSTDATA_PATH, $_tmp_bot3post_path)
+C_STOP_PATH = @_C_DEFINE_STR(STOP_PATH, $_tmp_stop_path)
+C_STOP_PATH_3 = @_C_DEFINE_STR(STOP_PATH, $_tmp_bot3stop_path)
+C_TEMPFILE_PATH_3 = @_C_DEFINE_STR(TEMPFILE_PATH, $_tmp_bot3temp_path)
+
+# dir-www
+C_ATT_PATH = @_C_DEFINE_STR(ATT_PATH, $_www_att_path_)
+C_AV_PATH = @_C_DEFINE_STR(AV_PATH, $_www_av_path_)
+C_END_PATH = @_C_DEFINE_STR(END_PATH, $_www_end_path)
+C_IMG_PATH = @_C_DEFINE_STR(IMG_PATH, $_www_img_path_)
+C_IND_PATH = @_C_DEFINE_STR(IND_PATH, $_www_ind_path)
+C_IND_PATH_3 = @_C_DEFINE_STR(IND_PATH, $_www_ind_path_3)
+C_IND_PATH_3_ = @_C_DEFINE_STR(IND_PATH_3, $_www_ind_path_3)
+C_INF_PATH = @_C_DEFINE_STR(INF_PATH, $_www_inf_path_)
+C_INFO_PATH = @_C_DEFINE_STR(INFO_PATH, $_www_info_path)
+C_LAST_PAGE = @_C_DEFINE_STR(LAST_PAGE, $_www_last_path)
+C_LIST_PATH = @_C_DEFINE_STR(LIST_PATH, $_www_list_path_)
+C_MFRONT_PATH = @_C_DEFINE_STR(MFRONT_PATH, $_www_ind_path_3)
+C_NP_TOP_PATH = @_C_DEFINE_STR(NP_TOP_PATH, $_www_np_top_path)
+C_NP_END_PATH = @_C_DEFINE_STR(NP_END_PATH, $_www_np_end_path)
+C_POST_PATH = @_C_DEFINE_STR(POST_PATH, $_www_post_path)
+C_SIG_PATH = @_C_DEFINE_STR(SIG_PATH, $_www_sig_path_)
+C_TOP_PATH = @_C_DEFINE_STR(TOP_PATH, $_www_top_path)
+C_UP_PATH = @_C_DEFINE_STR(UP_PATH, $_www_up_path_)
+
+# tool
+C_CAT_PATH = @_C_DEFINE_STR(CAT_PATH, $cat)
+C_LS_PATH = @_C_DEFINE_STR(LS_PATH, $ls)
+C_MAWK_PATH = @_C_DEFINE_STR(MAWK_PATH, $awk)
+C_MV_PATH = @_C_DEFINE_STR(MV_PATH, $mv)
+C_RM_PATH = @_C_DEFINE_STR(RM_PATH, $rm)
+C_WGET_PATH = @_C_DEFINE_STR(WGET_PATH, $wget)
+
+# bin
+C_AWK_B2H = @_C_DEFINE_STR(AWK_B2H, $_bin_awk_b2h_path)
+C_AWK_BOT2 = @_C_DEFINE_STR(AWK_BOT2, $_bin_awk_bot2_path)
+C_AWK_INDEX = @_C_DEFINE_STR(AWK_INDEX, $_bin_awk_index_path)
+C_AWK_LATEST = @_C_DEFINE_STR(AWK_LATEST, $_bin_awk_latest_path)
+C_AWK_LIST = @_C_DEFINE_STR(AWK_LIST, $_bin_awk_list_path)
+C_AWK_MVIEW = @_C_DEFINE_STR(AWK_MVIEw, $_bin_awk_mview_path)
+C_AWK_PM = @_C_DEFINE_STR(AWK_INDEX, $_bin_awk_pm_path)
+C_AWK_POST = @_C_DEFINE_STR(AWK_POST, $_bin_awk_post_path)
+C_AWK_POSTED = @_C_DEFINE_STR(AWK_POSTED, $_bin_awk_posted_path)
+C_AWK_PREVIEW = @_C_DEFINE_STR(AWK_PREVIEW, $_bin_awk_preview_path)
+C_AWK_UPLOAD = @_C_DEFINE_STR(AWK_UPLOAD, $_bin_awk_upload_path)
+C_AWK_VERIFY = @_C_DEFINE_STR(AWK_VERIFY, $_bin_awk_verify_path)
+C_AWK_VIEW = @_C_DEFINE_STR(AWK_VIEW, $_bin_awk_view_path)
+
+C_ = @_C_DEFINE_STR(uvw, $xyz)