From c678cc34bc12325f8a5803984c7979fc12d8f56f Mon Sep 17 00:00:00 2001 From: b Date: Thu, 29 Sep 2022 21:50:45 +0000 Subject: [PATCH] no hardcode cmd name in system() --- bot2.1.awk | 12 +- index.1.c | 2 +- makefile | 25 +- makefile.1.mak | 25 +- mpview.1.c | 2 +- pm.1.awk | 13 +- post.1.awk | 18 +- re.awk | 618 ----------------------------------------- settings-release.txt | 2 +- settings.txt | 24 +- view.awk => view.1.awk | 15 +- 11 files changed, 75 insertions(+), 681 deletions(-) delete mode 100644 re.awk rename view.awk => view.1.awk (81%) diff --git a/bot2.1.awk b/bot2.1.awk index 4072fea..c455dea 100644 --- a/bot2.1.awk +++ b/bot2.1.awk @@ -2,7 +2,7 @@ # Copyright (C) 2014-2016, 2022 Balthasar Szczepański # bot2.awk (bothasar_t) automatically generated from bot2.1.awk # relinking, archiving avatars, attachments, images. -# 18.09.2020 +# 29.09.2022 # This file is part of OTT mirror. # @@ -37,7 +37,9 @@ BEGIN { ###AWK_wayback: wayback="http://web.archive.org/web/" ###AWK_fora: fora="http://forums.xkcd.com" ###AWK_wget: wget=/usr/bin/wget +###AWK_mkdir: mv=/usr/bin/mkdir ###AWK_mv: mv=/usr/bin/mv +###AWK_sleep: mv=/usr/bin/sleep if (wait=="") { @@ -170,7 +172,7 @@ BEGIN { { printf ("\nCOPY FAIL %s", arr2[2]) } - system("sleep " wait) + system(sleep " " wait) } else { @@ -275,7 +277,7 @@ BEGIN { printf ("\nCOPY FAIL %s", arr2[2]) exit 1 } - system ("sleep " wait) + system (sleep " " wait) } } } @@ -325,7 +327,7 @@ BEGIN { } if(ext!="") { - if ((system ("mkdir -p " imagepath imgdir))==0) + if ((system (mkdir " -p " imagepath imgdir))==0) { if ((system (mv " " tempfile " " imagepath imgdir imgname ext))==0) { @@ -342,7 +344,7 @@ BEGIN { printf ("\nMKDIR FAIL %s %s",arr[2], imagepath imgdir) } } - system ("sleep " wait) + system (sleep " " wait) } } } diff --git a/index.1.c b/index.1.c index 9ed0930..a83bac6 100644 --- a/index.1.c +++ b/index.1.c @@ -34,7 +34,7 @@ // ###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() +int main(int argc, char **argv) { s_cgi *cgi; pid_t sub; diff --git a/makefile b/makefile index 3921d4c..4eb8fd0 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,7 @@ # OTT mirror -# Copyright (C) 2020 Balthasar Szczepański +# Copyright (C) 2022 Balthasar Szczepański # "makefile" is automatically generated from "makefile.1.mak" -# find the latest page and number of posts. -# 24.09.2022 +# 29.09.2022 # This file is part of OTT mirror. # @@ -22,7 +21,6 @@ CC =gcc -CCPP =g++ CF =-g -Wall -Wno-format-truncation L_CGI=-lcgi # AI=mawk -f @@ -89,6 +87,7 @@ post.1.c\ posted.1.c\ preview.1.awk\ update.1.c\ +view.1.awk\ view.1.c TO_GENERATE=\ bot2.awk\ @@ -107,6 +106,7 @@ post.c\ posted.c\ preview.awk\ update.c\ +view.awk\ view.c C=\ @@ -115,10 +115,6 @@ bot3\ findpost\ image -CPP= - -CPP_CGI= - C_CGI=\ index\ mpview\ @@ -197,7 +193,7 @@ update.1.c\ upload.awk\ verify.awk\ view.1.c\ -view.awk\ +view.1.awk\ www @@ -226,7 +222,7 @@ HIDDEN_DIR=\ $(TMP_PATH)\ $(MEM_POST_PATH) -all: $(TO_GENERATE) $(C) $(CPP) $(C_CGI) $(CPP_CGI) +all: $(TO_GENERATE) $(C) $(C_CGI) makefile: makefile.1.mak $(CONFIGFILE) @@ -238,15 +234,9 @@ $(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE) $(C): %: %.c $(CC) $(CF) -o $@ $< -$(CPP): %: %.cpp - $(CCPP) $(CF) -o $@ $< - $(C_CGI): %: %.c $(CC) $(CF) -o $@ $< $(L_CGI) -$(CPP_CGI): %: %.cpp - $(CCPP) $(CF) -o $@ $< $(L_CGI) - setuid: $(SETUID) $(CHMOD) u+s,g+s $(SETUID) @@ -255,6 +245,7 @@ mktree: $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR) cp_bin: $(BIN) setuid | mktree + $(RM) -rf $(BIN_PATH)/* $(CP) -p $(BIN) $(BIN_PATH) cp_conf: ottmirror.conf @@ -277,7 +268,7 @@ install: cp_bin cp_www cp_www_desc cp_src cp_conf cp_cron clean: - $(RM) -f $(TO_GENERATE) $(C) $(CPP) $(C_CGI) $(CPP_CGI) + $(RM) -f $(TO_GENERATE) $(C) $(C_CGI) PHONY: all clean setuid mktree cp_bin co_conf cp_cron cp_src cp_www cp_www_desc install diff --git a/makefile.1.mak b/makefile.1.mak index 2c5bc6a..6b9bd55 100644 --- a/makefile.1.mak +++ b/makefile.1.mak @@ -1,8 +1,7 @@ # OTT mirror -# Copyright (C) 2020 Balthasar Szczepański +# Copyright (C) 2022 Balthasar Szczepański # "makefile" is automatically generated from "makefile.1.mak" -# find the latest page and number of posts. -# 24.09.2022 +# 29.09.2022 # This file is part of OTT mirror. # @@ -22,7 +21,6 @@ ###MAKE_CC: CC=gcc -###MAKE_CCPP: CCPP=g++ ###MAKE_CF: CF=-g -Wall ###MAKE_L_CGI: L_CGI=-lcgi # AI=mawk -f @@ -89,6 +87,7 @@ post.1.c\ posted.1.c\ preview.1.awk\ update.1.c\ +view.1.awk\ view.1.c TO_GENERATE=\ bot2.awk\ @@ -107,6 +106,7 @@ post.c\ posted.c\ preview.awk\ update.c\ +view.awk\ view.c C=\ @@ -115,10 +115,6 @@ bot3\ findpost\ image -CPP= - -CPP_CGI= - C_CGI=\ index\ mpview\ @@ -197,7 +193,7 @@ update.1.c\ upload.awk\ verify.awk\ view.1.c\ -view.awk\ +view.1.awk\ www @@ -226,7 +222,7 @@ HIDDEN_DIR=\ $(TMP_PATH)\ $(MEM_POST_PATH) -all: $(TO_GENERATE) $(C) $(CPP) $(C_CGI) $(CPP_CGI) +all: $(TO_GENERATE) $(C) $(C_CGI) makefile: makefile.1.mak $(CONFIGFILE) @@ -238,15 +234,9 @@ $(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE) $(C): %: %.c $(CC) $(CF) -o $@ $< -$(CPP): %: %.cpp - $(CCPP) $(CF) -o $@ $< - $(C_CGI): %: %.c $(CC) $(CF) -o $@ $< $(L_CGI) -$(CPP_CGI): %: %.cpp - $(CCPP) $(CF) -o $@ $< $(L_CGI) - setuid: $(SETUID) $(CHMOD) u+s,g+s $(SETUID) @@ -255,6 +245,7 @@ mktree: $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR) cp_bin: $(BIN) setuid | mktree + $(RM) -rf $(BIN_PATH)/* $(CP) -p $(BIN) $(BIN_PATH) cp_conf: ottmirror.conf @@ -277,7 +268,7 @@ install: cp_bin cp_www cp_www_desc cp_src cp_conf cp_cron clean: - $(RM) -f $(TO_GENERATE) $(C) $(CPP) $(C_CGI) $(CPP_CGI) + $(RM) -f $(TO_GENERATE) $(C) $(C_CGI) PHONY: all clean setuid mktree cp_bin co_conf cp_cron cp_src cp_www cp_www_desc install diff --git a/mpview.1.c b/mpview.1.c index aa79320..4a5f5a9 100644 --- a/mpview.1.c +++ b/mpview.1.c @@ -47,7 +47,7 @@ #define N_STRBUF 256 #define N_STRBUF_SH 32 -int main() +int main(int argc, char **argv) { s_cgi *cgi; pid_t sub; diff --git a/pm.1.awk b/pm.1.awk index 9434e2d..7ff90ae 100644 --- a/pm.1.awk +++ b/pm.1.awk @@ -2,7 +2,7 @@ # Copyright (C) 2014, 2022 Balthasar Szczepański # pm.awk automatically generated from pm.1.awk # send a PM. -# 24.09.2022 +# 29.09.2022 # This file is part of OTT mirror. # @@ -23,6 +23,7 @@ BEGIN{ FS="=" ###AWK_fora: fora="http://forums.xkcd.com" ###AWK_useragent_3: useragent="\"bothasar_p (http://1190.bicyclesonthemoon.info/ott/; Time thread post bot)\"" +###AWK_wget: wget=/usr/bin/wget 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" @@ -36,7 +37,7 @@ BEGIN{ 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")) + 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 @@ -52,7 +53,7 @@ END{ 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\"")) + 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 @@ -69,7 +70,7 @@ END{ } 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\"")) + 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 @@ -120,7 +121,7 @@ END{ 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\"")) + 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 @@ -157,7 +158,7 @@ END{ } } close(cookiefile) - if(system("wget -q -t 3 --connect-timeout=60 -U " useragent " -O " cookiefile " \"" fora "/ucp.php?mode=logout&sid=" SID"\"")) + if(system(wget " -q -t 3 --connect-timeout=60 -U " useragent " -O " cookiefile " \"" fora "/ucp.php?mode=logout&sid=" SID"\"")) { print "Logout fail." } diff --git a/post.1.awk b/post.1.awk index a6c23fb..f9e4fb7 100644 --- a/post.1.awk +++ b/post.1.awk @@ -2,7 +2,7 @@ # Copyright (C) 2014, 2015, 2022 Balthasar Szczepański # post.awk automatically generated from post.1.awk # send a post. -# 24.09.2022 +# 29.09.2022 # This file is part of OTT mirror. # @@ -21,15 +21,17 @@ BEGIN{ FS="=" -###AWK_fora: fora="http://forums.xkcd.com" +###AWK_fora: fora="http://forums.xkcd.com" ###AWK_useragent_3: useragent="\"bothasar_p (http://1190.bicyclesonthemoon.info/ott/; Time thread post bot)\"" +###AWK_sleep: sleep="/usr/bin/sleep" +###AWK_wget: wget="/usr/bin/wget" }; { 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")) + 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 @@ -45,7 +47,7 @@ END{ 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\"")) + 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 @@ -62,7 +64,7 @@ END{ } 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\"")) + 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 @@ -113,8 +115,8 @@ END{ 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\"")) + 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 @@ -151,7 +153,7 @@ END{ } } close(cookiefile) - if(system("wget -q -t 3 --connect-timeout=60 -U " useragent " -O " tempfile " \"" fora "/ucp.php?mode=logout&sid=" SID"\"")) + if(system(wget " -q -t 3 --connect-timeout=60 -U " useragent " -O " tempfile " \"" fora "/ucp.php?mode=logout&sid=" SID"\"")) { print "Logout fail." } diff --git a/re.awk b/re.awk deleted file mode 100644 index df4fe4f..0000000 --- a/re.awk +++ /dev/null @@ -1,618 +0,0 @@ -BEGIN{ -#set your paths here -#and remember about doubleescaping! - - - tmppath= "/eizm/tmp/ottmirror" - propath= "/eizm/pro/ottmirror" - mempath= "/eizm/mem/ottmirror" - logpath= "/eizm/log/ottmirror" - mirrpath= "/eizm/www/time/ott" - - wgetpath= "/usr/bin/wget" - mawkpath= "/usr/bin/mawk" - mvpath= "/bin/mv" - rmpath= "/bin/rm" - catpath= "/bin/cat" - lspath= "/bin/ls" - - useragent2="bothasar_t (http://1190.bicyclesonthemoon.info/ott/; Time thread mirror bot)" - useragent3="bothasar_p (http://1190.bicyclesonthemoon.info/ott/; Time thread post bot)" - - ictaddr= "http://forums.xkcd.com/viewforum.php?f=7" - ottaddr= "http://forums.xkcd.com/viewtopic.php?f=7&t=101043&start=" - foraaddr= "http://forums.xkcd.com" - waybaddr= "http://web.archive.org/web/" - - threadID= "101043" - links_regexp= "href=.http:\\/\\/((for(ums3?|a)\\.xkcd\\.com)|echochamber\\.me)\\/viewtopic\\.php" - prosilver_regexp= "((url.\\.)|(((href)|(src))=.http:\\/\\/((for(ums3?|a)\\.xkcd\\.com)|echochamber\\.me)))\\/styles\\/prosilver" - prosilver_regexp2="((\\.)|(http:\\/\\/((for(ums3?|a)\\.xkcd\\.com)|echochamber\\.me)))\\/styles\\/prosilver" - smiley_regexp= "((url.\\.)|(((href)|(src))=.http:\\/\\/((for(ums3?|a)\\.xkcd\\.com)|echochamber\\.me)))\\/images\\/smilies" - smiley_regexp2= "((\\.)|(http:\\/\\/((for(ums3?|a)\\.xkcd\\.com)|echochamber\\.me)))\\/images\\/smilies" - avatar_regexp= "((src)|(href))=.http:\\/\\/((for(ums3?|a)\\.xkcd\\.com)|echochamber\\.me)\\/download\\/file.php\\?avatar=" - 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_url_encoded= "http%3A%2F%2F1190.bicyclesonthemoon.info%2Fott" - bot3name_encoded= "bothasar_p" - default_subject= "Re: 1190: \\"Time\\"" - - - #don't touch anything below this line - - USERAGENT2="#define USERAGENT \"" useragent2 "\"" - USERAGENT3="#define USERAGENT \"" useragent3 "\"" - USERAGENT2a="\tuseragent=\"\\\""useragent2 "\\\"\"" - USERAGENT3a="\tuseragent=\"\\\""useragent3 "\\\"\"" - ICT_ADDRESS="#define ICT_ADDRESS \"" ictaddr "\"" - OTT_ADDRESS="#define OTT_ADDRESS \"" ottaddr "\"" - FORA_ADDRESS="#define FORA_ADDRESS \"" foraaddr "\"" - wayback ="\twayback=\"" waybaddr "\"" - fora ="\tfora=\"" foraaddr "\"" - - WGET_PATH="#define WGET_PATH \"" wgetpath "\"" - MAWK_PATH="#define MAWK_PATH \"" mawkpath "\"" - RM_PATH="#define RM_PATH \"" rmpath "\"" - MV_PATH="#define MV_PATH \"" mvpath "\"" - CAT_PATH="#define CAT_PATH \"" catpath "\"" - LS_PATH="#define LS_PATH \"" lspath "\"" - - LAST_PATH="#define LAST_PATH \"" mempath "/lasttime.\"" - NAME_PATH="#define NAME_PATH \"" mempath "/name\"" - LASTTIME_PATH="#define LASTTIME_PATH \"" mempath "/bot3last\"" - POST_PATH3="#define POST_PATH \"" mempath "/mpost/\"" - LIST_PATH3="#define LIST_PATH \"" mempath "/mlist/\"" - LAST_PATH3="#define LAST_PATH \"" mempath "/mlist/last\"" - OK_PATH3="#define OK_PATH \"" mempath "/mpost/ok/\"" - PM_PATH3="#define PM_PATH \"" mempath "/mpost/pm/\"" - FAIL_PATH3="#define FAIL_PATH \"" mempath "/mpost/fail/\"" - POSTLIST_PATH3="#define POSTLIST_PATH \"" mempath "/mlist/\"" - MPOST_PATH="#define MPOST_PATH \"" mempath "/mpost/\"" - MLIST_PATH="#define MLIST_PATH \"" mempath "/mlist/\"" - MLAST_PATH="#define MLAST_PATH \"" mempath "/mlist/last\"" - MSTD_LAST_PATH="#define MSTD_LAST_PATH \"" mempath "/mlist/last\"" - okpath="\tokpath=\"" mempath "/mpost/ok/\"" - pmpath="\tpmpath=\"" mempath "/mpost/pm/\"" - failpath="\tfailpath=\"" mempath "/mpost/fail/\"" - mpostpath="\tmpostpath=\"" mempath "/mpost/\"" - - LOG_PATH="#define LOG_PATH \"" logpath "/bot2.log.\"" - LOG_PATH3="#define LOG_PATH \"" logpath "/bot3.log\"" - - NP_PATH="#define NP_PATH \"" tmppath "/np.p0.\"" - NP_PATH_1="#define NP_PATH_1 \"" tmppath "/np.p1.\"" - NP_PATH_2="#define NP_PATH_2 \"" tmppath "/np.p2.\"" - NP_PATH_3="#define NP_PATH_3 \"" tmppath "/np.p3.\"" - STOP_PATH="#define STOP_PATH \"" tmppath "/fullstop.\"" - TEMPFILE_PATH="#define TEMPFILE_PATH \"" tmppath "/bot3temp\"" - POSTDATA_PATH="#define POSTDATA_PATH \"" tmppath "/bot3post\"" - COOKIE_PATH="#define COOKIE_PATH \"" tmppath "/bot3cook\"" - STOP_PATH3="#define STOP_PATH \"" tmppath "/bot3stop\"" - TEMP_PATH3v="#define TEMP_PATH \"" tmppath "/mview.\"" - TEMP_PATHp="#define TEMP_PATH \"" tmppath "/preview.\"" - TEMP_PATHv="#define TEMP_PATH \"" tmppath "/view.\"" - TEMP_PATHr="#define TEMP_PATH \"" tmppath "/posted.\"" - TEMP_PATHm="#define TEMP_PATH \"" tmppath "/mpview.\"" - - LIST_PATH="#define LIST_PATH \"" mirrpath "/postlist/\"" - SIG_PATH="#define SIG_PATH \"" mirrpath "/sig/\"" - INF_PATH="#define INF_PATH \"" mirrpath "/otterinf/\"" - UP_PATH="#define UP_PATH \"" mirrpath "/np/\"" - IND_PATH="#define IND_PATH \"" mirrpath "/ottfront\"" - TOP_PATH="#define TOP_PATH \"" mirrpath "/top\"" - END_PATH="#define END_PATH \"" mirrpath "/end\"" - AV_PATH="#define AV_PATH \"" mirrpath "/avatar/\"" - ATT_PATH="#define ATT_PATH \"" mirrpath "/attachment/\"" - IMG_PATH="#define IMG_PATH \"" mirrpath "/image/\"" - LAST_PAGE="#define LAST_PAGE \"" mirrpath "/np/last\"" - IND_PATH3="#define IND_PATH \"" mirrpath "/mfront\"" - POSTLIST_PATH="#define POSTLIST_PATH \"" mirrpath "/postlist/\"" - OTTFRONT_PATH="#define OTTFRONT_PATH \"" mirrpath "/ottfront\"" - MFRONT_PATH="#define MFRONT_PATH \"" mirrpath "/mfront\"" - NP_TOP_PATH="#define NP_TOP_PATH \"" mirrpath "/np/top\"" - NP_END_PATH="#define NP_END_PATH \"" mirrpath "/np/end\"" - INFO_PATH="#define INFO_PATH \"" mirrpath "/info.htm\"" - POST_PATH="#define POST_PATH \"" mirrpath "/post.htm\"" - NP_LAST_PATH="#define NP_LAST_PATH \"" mirrpath "/np/last\"" - SIG_PATHe="#define SIG_PATH \"sig=" mirrpath "/sig/\"" - INF_PATHe="#define INF_PATH \"otterinf=" mirrpath "/otterinf/\"" - - AWK_LATEST="#define AWK_LATEST \"" propath "/findlatest.awk\"" - AWK_LIST="#define AWK_LIST \"" propath "/list.awk\"" - AWK_BOT2="#define AWK_BOT2 \"" propath "/bot2.awk\"" - AWK_UPLOAD="#define AWK_UPLOAD \"" propath "/upload.awk\"" - AWK_INDEX="#define AWK_INDEX \"" propath "/index.awk\"" - AWK_POST="#define AWK_POST \"" propath "/post.awk\"" - AWK_PM="#define AWK_PM \"" propath "/pm.awk\"" - AWK_VIEW="#define AWK_VIEW \"" propath "/view.awk\"" - AWK_MVIEW="#define AWK_MVIEW \"" propath "/mview.awk\"" - AWK_PREVIEW="#define AWK_PREVIEW \"" propath "/preview.awk\"" - BOT_PATH="#define BOT_PATH \"" propath "/bot2\"" - AWK_B2H="#define AWK_B2H \"" propath "/bb2html.awk\"" - AWK_POSTED="#define AWK_POSTED \"" propath "/posted.awk\"" - AWK_VERIFY="#define AWK_VERIFY \"" propath "/verify.awk\"" - findpost_path="\tfindpost_path=\"" propath "/findpost\"" - imgformat_path="\timgformat_path=\"" propath "/image\"" - -}; -{ - gsub(/\r/,"",$0) - if($1 ~ /^###USERAGENT2$/) - { - print USERAGENT2 - next; - } - if($1 ~ /^###USERAGENT3$/) - { - print USERAGENT3 - next - } - if($1 ~ /^###USERAGENT2$/) - { - print USERAGENT2 - next; - } - if($1 ~ /^###ICT_ADDRESS$/) - { - print ICT_ADDRESS - next - } - if($1 ~ /^###OTT_ADDRESS$/) - { - print OTT_ADDRESS - next - } - if($1 ~ /^###FORA_ADDRESS$/) - { - print FORA_ADDRESS - next - } - if($1 ~ /^###USERAGENT2a$/) - { - print USERAGENT2a - next; - } - if($1 ~ /^###USERAGENT3a$/) - { - print USERAGENT3a - next; - } - if($1 ~ /^###wayback$/) - { - print wayback - next; - } - if($1 ~ /^###fora$/) - { - print fora - next; - } - - - - if($1 ~ /^###WGET_PATH$/) - { - print WGET_PATH - next - } - if($1 ~ /^###MAWK_PATH$/) - { - print MAWK_PATH - next - } - if($1 ~ /^###RM_PATH$/) - { - print RM_PATH - next - } - if($1 ~ /^###MV_PATH$/) - { - print MV_PATH - next - } - if($1 ~ /^###CAT_PATH$/) - { - print CAT_PATH - next - } - if($1 ~ /^###LS_PATH$/) - { - print LS_PATH - next - } - - - - if($1 ~ /^###LAST_PATH$/) - { - print LAST_PATH - next - } - if($1 ~ /^###NAME_PATH$/) - { - print NAME_PATH - next - } - if($1 ~ /^###LASTTIME_PATH$/) - { - print LASTTIME_PATH - next - } - if($1 ~ /^###POST_PATH3$/) - { - print POST_PATH3 - next - } - if($1 ~ /^###LIST_PATH3$/) - { - print LIST_PATH3 - next - } - if($1 ~ /^###LAST_PATH3$/) - { - print LAST_PATH3 - next - } - if($1 ~ /^###OK_PATH3$/) - { - print OK_PATH3 - next - } - if($1 ~ /^###PM_PATH3$/) - { - print PM_PATH3 - next - } - if($1 ~ /^###FAIL_PATH3$/) - { - print FAIL_PATH3 - next - } - if($1 ~ /^###POSTLIST_PATH3$/) - { - print POSTLIST_PATH3 - next - } - if($1 ~ /^###MPOST_PATH$/) - { - print MPOST_PATH - next - } - if($1 ~ /^###MLIST_PATH$/) - { - print MLIST_PATH - next - } - if($1 ~ /^###MLAST_PATH$/) - { - print MLAST_PATH - next - } - if($1 ~ /^###okpath$/) - { - print okpath - next - } - if($1 ~ /^###pmpath$/) - { - print pmpath - next - } - if($1 ~ /^###failpath$/) - { - print failpath - next - } - if($1 ~ /^###mpostpath$/) - { - print mpostpath - next - } - if($1 ~ /^###MSTD_LAST_PATH$/) - { - print MSTD_LAST_PATH - next - } - - - - if($1 ~ /^###LOG_PATH$/) - { - print LOG_PATH - next - } - if($1 ~ /^###LOG_PATH3$/) - { - print LOG_PATH3 - next - } - - - - if($1 ~ /^###NP_PATH$/) - { - print NP_PATH - next - } - if($1 ~ /^###NP_PATH_1$/) - { - print NP_PATH_1 - next - } - if($1 ~ /^###NP_PATH_2$/) - { - print NP_PATH_2 - next - } - if($1 ~ /^###NP_PATH_3$/) - { - print NP_PATH_3 - next - } - if($1 ~ /^###STOP_PATH$/) - { - print STOP_PATH - next - } - if($1 ~ /^###TEMPFILE_PATH$/) - { - print TEMPFILE_PATH - next - } - if($1 ~ /^###POSTDATA_PATH$/) - { - print POSTDATA_PATH - next - } - if($1 ~ /^###COOKIE_PATH$/) - { - print COOKIE_PATH - next - } - if($1 ~ /^###STOP_PATH3$/) - { - print STOP_PATH3 - next - } - if($1 ~ /^###TEMP_PATH3v$/) - { - print TEMP_PATH3v - next - } - if($1 ~ /^###TEMP_PATHp$/) - { - print TEMP_PATHp - next - } - if($1 ~ /^###TEMP_PATHv$/) - { - print TEMP_PATHv - next - } - if($1 ~ /^###TEMP_PATHr$/) - { - print TEMP_PATHr - next - } - if($1 ~ /^###TEMP_PATHm$/) - { - print TEMP_PATHm - next - } - - - - if($1 ~ /^###LIST_PATH$/) - { - print LIST_PATH - next - } - if($1 ~ /^###SIG_PATH$/) - { - print SIG_PATH - next - } - if($1 ~ /^###INF_PATH$/) - { - print INF_PATH - next - } - if($1 ~ /^###UP_PATH$/) - { - print UP_PATH - next - } - if($1 ~ /^###IND_PATH$/) - { - print IND_PATH - next - } - if($1 ~ /^###TOP_PATH$/) - { - print TOP_PATH - next - } - if($1 ~ /^###END_PATH$/) - { - print END_PATH - next - } - if($1 ~ /^###AV_PATH$/) - { - print AV_PATH - next - } - if($1 ~ /^###ATT_PATH$/) - { - print ATT_PATH - next - } - if($1 ~ /^###IMG_PATH$/) - { - print IMG_PATH - next - } - if($1 ~ /^###LAST_PAGE$/) - { - print LAST_PAGE - next - } - if($1 ~ /^###IND_PATH3$/) - { - print IND_PATH3 - next - } - if($1 ~ /^###POSTLIST_PATH$/) - { - print POSTLIST_PATH - next - } - if($1 ~ /^###OTTFRONT_PATH$/) - { - print OTTFRONT_PATH - next - } - if($1 ~ /^###MFRONT_PATH$/) - { - print MFRONT_PATH - next - } - if($1 ~ /^###NP_TOP_PATH$/) - { - print NP_TOP_PATH - next - } - if($1 ~ /^###NP_END_PATH$/) - { - print NP_END_PATH - next - } - if($1 ~ /^###INFO_PATH$/) - { - print INFO_PATH - next - } - if($1 ~ /^###POST_PATH$/) - { - print POST_PATH - next - } - if($1 ~ /^###NP_LAST_PATH$/) - { - print NP_LAST_PATH - next - } - if($1 ~ /^###SIG_PATHe$/) - { - print SIG_PATHe - next - } - if($1 ~ /^###INF_PATHe$/) - { - print INF_PATHe - next - } - - - - if($1 ~ /^###AWK_LATEST$/) - { - print AWK_LATEST - next - } - if($1 ~ /^###AWK_LIST$/) - { - print AWK_LIST - next - } - if($1 ~ /^###AWK_BOT2$/) - { - print AWK_BOT2 - next - } - if($1 ~ /^###AWK_UPLOAD$/) - { - print AWK_UPLOAD - next - } - if($1 ~ /^###AWK_INDEX$/) - { - print AWK_INDEX - next - } - if($1 ~ /^###AWK_POST$/) - { - print AWK_POST - next - } - if($1 ~ /^###AWK_PM$/) - { - print AWK_PM - next - } - if($1 ~ /^###AWK_VIEW$/) - { - print AWK_VIEW - next - } - if($1 ~ /^###AWK_MVIEW$/) - { - print AWK_MVIEW - next - } - if($1 ~ /^###AWK_B2H$/) - { - print AWK_B2H - next - } - if($1 ~ /^###AWK_PREVIEW$/) - { - print AWK_PREVIEW - next - } - if($1 ~ /^###AWK_POSTED$/) - { - print AWK_POSTED - next - } - if($1 ~ /^###AWK_VERIFY$/) - { - print AWK_VERIFY - next - } - if($1 ~ /^###BOT_PATH$/) - { - print BOT_PATH - next - } - if($1 ~ /^###findpost_path$/) - { - print findpost_path - next - } - if($1 ~ /^###imgformat_path$/) - { - print imgformat_path - next - } - - if($0 ~ /###[^#;]*;/) - { - gsub(/###threadID;/,threadID,$0) - gsub(/###links_regexp;/,links_regexp,$0) - gsub(/###prosilver_regexp;/,prosilver_regexp,$0) - gsub(/###prosilver_regexp2;/,prosilver_regexp2,$0) - gsub(/###smiley_regexp;/,smiley_regexp,$0) - gsub(/###smiley_regexp2;/,smiley_regexp2,$0) - gsub(/###avatar_regexp;/,avatar_regexp,$0) - gsub(/###attachment_regexp;/,attachment_regexp,$0) - gsub(/###own_image_regexp;/,own_image_regexp,$0) - gsub(/###foraaddr;/,foraaddr,$0) - gsub(/###own_url_encoded;/,own_url_encoded,$0) - gsub(/###bot3name_encoded;/,bot3name_encoded,$0) - gsub(/###default_subject;/,default_subject,$0) - - } - - print $0 -}; \ No newline at end of file diff --git a/settings-release.txt b/settings-release.txt index d8dddac..977583c 100644 --- a/settings-release.txt +++ b/settings-release.txt @@ -54,11 +54,11 @@ mkdir: /usr/bin/mkdir mv: /usr/bin/mv perl: /usr/bin/perl rm: /usr/bin/rm +sleep: /usr/bin/sleep sudo: sudo wget: /usr/bin/wget CC: gcc -CCPP: g++ CF: -g -Wall -Wno-format-truncation L_CGI: -lcgi diff --git a/settings.txt b/settings.txt index 625b1e5..8e61299 100644 --- a/settings.txt +++ b/settings.txt @@ -1,3 +1,23 @@ +# OTT mirror +# Copyright (C) 2022 Balthasar Szczepański +# settings.txt +# 29.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 . + _AWK_DEFINE_STR: $0="@_ESCAPE($1)" _C_DEFINE_STR: #define $0 "@_ESCAPE($1)" @@ -110,7 +130,6 @@ MAKE_RM = RM =$rm MAKE_SUDO = SUDO =$sudo MAKE_CC = CC =$CC -MAKE_CCPP = CCPP =$CCPP MAKE_CF = CF =$CF MAKE_L_CGI = L_CGI=$L_CGI @@ -152,15 +171,18 @@ CONF_view = $_bin_view_path CONF_www = $www_path +AWK_cat = \t@_AWK_DEFINE_STR(cat, $cat) AWK_default_subject_encoded= \t@_AWK_DEFINE_STR(default_subject_encoded,$_default_subject_encoded) AWK_failpath = \t@_AWK_DEFINE_STR(failpath, $_mem_fail_path_) 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_mkdir = \t@_AWK_DEFINE_STR(mkdir, $mkdir) AWK_mv = \t@_AWK_DEFINE_STR(mv, $mv) AWK_mpostpath = \t@_AWK_DEFINE_STR(mpostpath, $_mem_post_path_) AWK_okpath = \t@_AWK_DEFINE_STR(okpath, $_mem_ok_path_) AWK_pmpath = \t@_AWK_DEFINE_STR(pmpath, $_mem_pm_path_) +AWK_sleep = \t@_AWK_DEFINE_STR(sleep , $sleep) 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) diff --git a/view.awk b/view.1.awk similarity index 81% rename from view.awk rename to view.1.awk index c1c0a51..72b0448 100644 --- a/view.awk +++ b/view.1.awk @@ -1,8 +1,8 @@ # OTT mirror -# Copyright (C) 2014 Balthasar Szczepański -# view.awk +# Copyright (C) 2014, 2022 Balthasar Szczepański +# view.awk automatically generated from view.1.awk # insert content into a viewed page. -# 12.09.2014 +# 29.09.2022 # This file is part of OTT mirror. # @@ -19,16 +19,19 @@ # You should have received a copy of the GNU Affreo General Public License # along with OTT mirror. If not, see . +BEGIN{ +###AWK_cat: cat="/usr/bin/cat" +}; { if ($0 ~ /^###sig&/) { split ($0 ,arr,"&") - system("cat " sig arr[2]) + system(cat " " sig arr[2]) } else if ($0 ~ /^###inf&/) { split ($0 ,arr,"&") - system("cat " otterinf arr[2]) + system(cat " " otterinf arr[2]) } else if ($0 ~ /^###prev/) { @@ -40,7 +43,7 @@ } else if ($0 ~ /^###links/) { - system ("cat " links); + system (cat " " links); } else if ($0 ~ /^###info/) { -- 2.30.2