Almost fully functional

Signed-off-by: sneedium <sneed@sneedmc.org>
This commit is contained in:
sneedium 2022-09-05 00:05:16 -04:00
parent 1eab15f8b0
commit c5f62b53d7
Signed by: sneedium
GPG Key ID: 906F66490FBE722F
5 changed files with 284 additions and 137 deletions

84
agsl.h
View File

@ -35,45 +35,45 @@ const char *AGSL = "Affero Giant Sneed License (AGPL)\r\n"
" █▄ ▄█ █▄ ▄█\r\n" " █▄ ▄█ █▄ ▄█\r\n"
" █▄▄▄▄▄█ █▄▄▄▄▄█\r\n" " █▄▄▄▄▄█ █▄▄▄▄▄█\r\n"
"\r\n" "\r\n"
" %%&&&&&&&%%%%%%&&&%%\r\n" " %%%%&&&&&&&%%%%%%%%%%%%&&&%%%%\r\n"
" %%&&&&&%%%&&&&&&&&&&&&&(%%%%%%%%&%%&&&%&\r\n" " %%%%&&&&&%%%%%%&&&&&&&&&&&&&(%%%%%%%%%%%%%%%%&%%%%&&&%%&\r\n"
" %&&%%%%%%%%%%%%%%%%%%%%%%%%(&&%%%%%%%%&%%%%%%%%%&&\r\n" " %%&&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%(&&%%%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%&&\r\n"
" %&%%%%%%%%%%%%%%%%%%%%%%%%%%%%&(%%%%%%%&%%%%%%%%%%%%&&&\r\n" " %%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&(%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%&&&\r\n"
" &%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%&%%%%%%%%%%%%%%%%&%\r\n" " &%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%\r\n"
" %&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%&%%%%%%%%%%%%%%%%%%%&\r\n" " %%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&\r\n"
" %&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%\r\n" " %%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r\n"
" %&%%%%%&%%%(//////(((((%%%%&&%%%&%%%%%%%%%%%%%%%%%%%&%\r\n" " %%&%%%%%%%%%%&%%%%%%(//////(((((%%%%%%%%&&%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%\r\n"
" &&%/****************************%&%%%%%%%%%%%%%%%&%\r\n" " &&%%/****************************%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%\r\n"
" %******************************%,,,/&%%%%%%%%%%&%%\r\n" " %%******************************%%,,,/&%%%%%%%%%%%%%%%%%%%%&%%%%\r\n"
" %&(*******************************%*,,,,*%%%%%%%%&%\r\n" " %%&(*******************************%%*,,,,*%%%%%%%%%%%%%%%%&%%\r\n"
" %%***/***********/&/...,(%************(,,,,,/&&&&&%\r\n" " %%%%***/***********/&/...,(%%************(,,,,,/&&&&&%%\r\n"
" %%&,..,,.********(%.,,,,,,,%**********&*,,,**%%&&&%%\r\n" " %%%%&,..,,.********(%%.,,,,,,,%%**********&*,,,**%%%%&&&%%%%\r\n"
" %&*.,,,,,((*******&,.,,(&/%(**************%*//%%(**&\r\n" " %%&*.,,,,,((*******&,.,,(&/%%(**************%%*//%%%%(**&\r\n"
" %&&%%%%%************(((/******************//******&%\r\n" " %%&&%%%%%%%%%%************(((/******************//******&%%\r\n"
" %&*********************************************%&%\r\n" " %%&*********************************************%%&%%\r\n"
" %&&*********************************************&%\r\n" " %%&&*********************************************&%%\r\n"
" %%&&&*/*****************************************(&%\r\n" " %%%%&&&*/*****************************************(&%%\r\n"
" %%&*******************************************%&\r\n" " %%%%&*******************************************%%&\r\n"
" &%*********************************************&%\r\n" " &%%*********************************************&%%\r\n"
" %&*******************/*//************************&%\r\n" " %%&*******************/*//************************&%%\r\n"
" %&&///**//((*%//(/******/***********************/&&\r\n" " %%&&///**//((*%%//(/******/***********************/&&\r\n"
" &******************************************/&&\r\n" " &******************************************/&&\r\n"
" %&(**********************************(%&#((//&&%%\r\n" " %%&(**********************************(%%&#((//&&%%%%\r\n"
" (****************************(&%(///(#&&&@%%#%&&\r\n" " (****************************(&%%(///(#&&&@%%%%#%%&&\r\n"
" &&**********************/%&#/((%&%(/#&#((((((((#%@\r\n" " &&**********************/%%&#/((%%&%%(/#&#((((((((#%%@\r\n"
" &%%****************/#&#(/(%&#(((((&#((((((%&#(/((((&&#\r\n" " &%%%%****************/#&#(/(%%&#(((((&#((((((%%&#(/((((&&#\r\n"
" %((#%((&//&%********(%&#((((&%(((((((#&((((((%&(((((((((((//\r\n" " %%((#%%((&//&%%********(%%&#((((&%%(((((((#&((((((%%&(((((((((((//\r\n"
" &((#%(/(((%%(((((((((((((#&#((((((((((&((((((%#((((((((#%%#(((#\r\n" " &((#%%(/(((%%%%(((((((((((((#&#((((((((((&((((((%%#((((((((#%%%%#(((#\r\n"
" @#/(%((%((((((((((&%((((#%&#(((((((((((((&#(((((%#(((((/%%(/(((/(((\r\n" " @#/(%%((%%((((((((((&%%((((#%%&#(((((((((((((&#(((((%%#(((((/%%%%(/(((/(((\r\n"
" ((##&((#%&((%/(((((((((((((((((((((((((((((((#%(((((%%/(((((&((((((((((/(\r\n" " ((##&((#%%&((%%/(((((((((((((((((((((((((((((((#%%(((((%%%%/(((((&((((((((((/(\r\n"
" (%%/##&%#&##&(#%((((((((((((((((((((((((((((#%(((((&((((((&(/((((////////\r\n" " (%%%%/##&%%#&##&(#%%((((((((((((((((((((((((((((#%%(((((&((((((&(/((((////////\r\n"
" &((((#%#(#%((((((((((((((((((##%%%&&%#((%#&%&(((((&(((((&((((((((///(/(//\r\n" " &((((#%%#(#%%((((((((((((((((((##%%%%%%&&%%#((%%#&%%&(((((&(((((&((((((((///(/(//\r\n"
" //(%#((((((((((((((((((((((((((((((((((((#&%&%#(#&&&&/&(((((((((////(////\r\n" " //(%%#((((((((((((((((((((((((((((((((((((#&%%&%%#(#&&&&/&(((((((((////(////\r\n"
" /((%((#%#########(((((((((((((((((((((((((((%((%%((((#%/((((((((((/(((((((\r\n" " /((%%((#%%#########(((((((((((((((((((((((((((%%((%%%%((((#%%/((((((((((/(((((((\r\n"
" (&#((#&%((#%%%%%###((((&&#(#%%&%##((((((((((((((%#((&(/(((((((((((((((((((\r\n" " (&#((#&%%((#%%%%%%%%%%###((((&&#(#%%%%&%%##((((((((((((((%%#((&(/(((((((((((((((((((\r\n"
" %(((%((#&%(((((((((((%#%#(#%%&&#((((((#%%#(((((((&(&/(((((((((((((((((((((\r\n" " %%(((%%((#&%%(((((((((((%%#%%#(#%%%%&&#((((((#%%%%#(((((((&(&/(((((((((((((((((((((\r\n"
" ((((%((&(((((((((%###&(%(((((((((((((((#%&&%#(#(((%%/((((((((((((((((((((((\r\n" " ((((%%((&(((((((((%%###&(%%(((((((((((((((#%%&&%%#(#(((%%%%/((((((((((((((((((((((\r\n"
"(((%#(((%((((((((#%((%(&(((((((((((((((((((((&(((((%&#(%/******//((&&%((((((\r\n" "(((%%#(((%%((((((((#%%((%%(&(((((((((((((((((((((&(((((%%&#(%%/******//((&&%%((((((\r\n"
"\r\n" "\r\n"
" Preamble\r\n" " Preamble\r\n"
"\r\n" "\r\n"
@ -686,9 +686,9 @@ const char *AGSL = "Affero Giant Sneed License (AGPL)\r\n"
"Program, unless a warranty or assumption of liability accompanies a\r\n" "Program, unless a warranty or assumption of liability accompanies a\r\n"
"copy of the Program in return for a fee.\r\n" "copy of the Program in return for a fee.\r\n"
"\r\n" "\r\n"
"%s\r\n" "%s"
"%s\r\n" "%s"
"%s\r\n" "%s"
" END OF TERMS AND CONDITIONS\r\n" " END OF TERMS AND CONDITIONS\r\n"
"\r\n" "\r\n"
" How to Apply These Terms to Your New Programs\r\n" " How to Apply These Terms to Your New Programs\r\n"
@ -716,7 +716,7 @@ const char *AGSL = "Affero Giant Sneed License (AGPL)\r\n"
" Affero Giant Sneed License for more details.\r\n" " Affero Giant Sneed License for more details.\r\n"
"\r\n" "\r\n"
" You should have received a copy of the Affero Giant Sneed License\r\n" " You should have received a copy of the Affero Giant Sneed License\r\n"
" along with this program. If not, see <https://%s.licenses.sneedmc.org>.\r\n" " along with this program. If not, see <https://%s>.\r\n"
"\r\n" "\r\n"
"Also add information on how to contact you by electronic and paper mail.\r\n" "Also add information on how to contact you by electronic and paper mail.\r\n"
"\r\n" "\r\n"

20
clauses.h Normal file
View File

@ -0,0 +1,20 @@
const char *FARMER_NOTICE = " %d. Farmer Notice.\r\n"
"\r\n"
" This program is farmer software: it is free to be redistributed and/or\r\n"
"modified by farmers. Redistribution and/or modification of the Software\r\n"
"by city slickers is strictly prohibited.\r\n"
"\r\n";
const char *JOGGER_NOTICE = " %d. NIGGER Notice.\r\n"
"\r\n"
" The above copyright notice, this permission notice and the word\r\n"
"\"NIGGER\" shall be included in all copies or substantial portions\r\n"
"of the Software.\r\n"
"\r\n";
const char *DWARF_NOTICE = " %d. Dwarf Notice.\r\n"
"\r\n"
" I am a dwarf and I'm digging a hole, diggy diggy hole, I'm digging a hole.\r\n"
"If this is not literally you, you cannot use this software.\r\n"
"\r\n";

84
gsl.h
View File

@ -35,45 +35,45 @@ const char *GSL = "The Giant Sneed License (GSL)\r\n"
" █▄ ▄█ █▄ ▄█\r\n" " █▄ ▄█ █▄ ▄█\r\n"
" █▄▄▄▄▄█ █▄▄▄▄▄█\r\n" " █▄▄▄▄▄█ █▄▄▄▄▄█\r\n"
"\r\n" "\r\n"
" %%&&&&&&&%%%%%%&&&%%\r\n" " %%%%&&&&&&&%%%%%%%%%%%%&&&%%%%\r\n"
" %%&&&&&%%%&&&&&&&&&&&&&(%%%%%%%%&%%&&&%&\r\n" " %%%%&&&&&%%%%%%&&&&&&&&&&&&&(%%%%%%%%%%%%%%%%&%%%%&&&%%&\r\n"
" %&&%%%%%%%%%%%%%%%%%%%%%%%%(&&%%%%%%%%&%%%%%%%%%&&\r\n" " %%&&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%(&&%%%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%&&\r\n"
" %&%%%%%%%%%%%%%%%%%%%%%%%%%%%%&(%%%%%%%&%%%%%%%%%%%%&&&\r\n" " %%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&(%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%&&&\r\n"
" &%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%&%%%%%%%%%%%%%%%%&%\r\n" " &%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%\r\n"
" %&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%&%%%%%%%%%%%%%%%%%%%&\r\n" " %%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&\r\n"
" %&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%\r\n" " %%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r\n"
" %&%%%%%&%%%(//////(((((%%%%&&%%%&%%%%%%%%%%%%%%%%%%%&%\r\n" " %%&%%%%%%%%%%&%%%%%%(//////(((((%%%%%%%%&&%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%\r\n"
" &&%/****************************%&%%%%%%%%%%%%%%%&%\r\n" " &&%%/****************************%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%\r\n"
" %******************************%,,,/&%%%%%%%%%%&%%\r\n" " %%******************************%%,,,/&%%%%%%%%%%%%%%%%%%%%&%%%%\r\n"
" %&(*******************************%*,,,,*%%%%%%%%&%\r\n" " %%&(*******************************%%*,,,,*%%%%%%%%%%%%%%%%&%%\r\n"
" %%***/***********/&/...,(%************(,,,,,/&&&&&%\r\n" " %%%%***/***********/&/...,(%%************(,,,,,/&&&&&%%\r\n"
" %%&,..,,.********(%.,,,,,,,%**********&*,,,**%%&&&%%\r\n" " %%%%&,..,,.********(%%.,,,,,,,%%**********&*,,,**%%%%&&&%%%%\r\n"
" %&*.,,,,,((*******&,.,,(&/%(**************%*//%%(**&\r\n" " %%&*.,,,,,((*******&,.,,(&/%%(**************%%*//%%%%(**&\r\n"
" %&&%%%%%************(((/******************//******&%\r\n" " %%&&%%%%%%%%%%************(((/******************//******&%%\r\n"
" %&*********************************************%&%\r\n" " %%&*********************************************%%&%%\r\n"
" %&&*********************************************&%\r\n" " %%&&*********************************************&%%\r\n"
" %%&&&*/*****************************************(&%\r\n" " %%%%&&&*/*****************************************(&%%\r\n"
" %%&*******************************************%&\r\n" " %%%%&*******************************************%%&\r\n"
" &%*********************************************&%\r\n" " &%%*********************************************&%%\r\n"
" %&*******************/*//************************&%\r\n" " %%&*******************/*//************************&%%\r\n"
" %&&///**//((*%//(/******/***********************/&&\r\n" " %%&&///**//((*%%//(/******/***********************/&&\r\n"
" &******************************************/&&\r\n" " &******************************************/&&\r\n"
" %&(**********************************(%&#((//&&%%\r\n" " %%&(**********************************(%%&#((//&&%%%%\r\n"
" (****************************(&%(///(#&&&@%%#%&&\r\n" " (****************************(&%%(///(#&&&@%%%%#%%&&\r\n"
" &&**********************/%&#/((%&%(/#&#((((((((#%@\r\n" " &&**********************/%%&#/((%%&%%(/#&#((((((((#%%@\r\n"
" &%%****************/#&#(/(%&#(((((&#((((((%&#(/((((&&#\r\n" " &%%%%****************/#&#(/(%%&#(((((&#((((((%%&#(/((((&&#\r\n"
" %((#%((&//&%********(%&#((((&%(((((((#&((((((%&(((((((((((//\r\n" " %%((#%%((&//&%%********(%%&#((((&%%(((((((#&((((((%%&(((((((((((//\r\n"
" &((#%(/(((%%(((((((((((((#&#((((((((((&((((((%#((((((((#%%#(((#\r\n" " &((#%%(/(((%%%%(((((((((((((#&#((((((((((&((((((%%#((((((((#%%%%#(((#\r\n"
" @#/(%((%((((((((((&%((((#%&#(((((((((((((&#(((((%#(((((/%%(/(((/(((\r\n" " @#/(%%((%%((((((((((&%%((((#%%&#(((((((((((((&#(((((%%#(((((/%%%%(/(((/(((\r\n"
" ((##&((#%&((%/(((((((((((((((((((((((((((((((#%(((((%%/(((((&((((((((((/(\r\n" " ((##&((#%%&((%%/(((((((((((((((((((((((((((((((#%%(((((%%%%/(((((&((((((((((/(\r\n"
" (%%/##&%#&##&(#%((((((((((((((((((((((((((((#%(((((&((((((&(/((((////////\r\n" " (%%%%/##&%%#&##&(#%%((((((((((((((((((((((((((((#%%(((((&((((((&(/((((////////\r\n"
" &((((#%#(#%((((((((((((((((((##%%%&&%#((%#&%&(((((&(((((&((((((((///(/(//\r\n" " &((((#%%#(#%%((((((((((((((((((##%%%%%%&&%%#((%%#&%%&(((((&(((((&((((((((///(/(//\r\n"
" //(%#((((((((((((((((((((((((((((((((((((#&%&%#(#&&&&/&(((((((((////(////\r\n" " //(%%#((((((((((((((((((((((((((((((((((((#&%%&%%#(#&&&&/&(((((((((////(////\r\n"
" /((%((#%#########(((((((((((((((((((((((((((%((%%((((#%/((((((((((/(((((((\r\n" " /((%%((#%%#########(((((((((((((((((((((((((((%%((%%%%((((#%%/((((((((((/(((((((\r\n"
" (&#((#&%((#%%%%%###((((&&#(#%%&%##((((((((((((((%#((&(/(((((((((((((((((((\r\n" " (&#((#&%%((#%%%%%%%%%%###((((&&#(#%%%%&%%##((((((((((((((%%#((&(/(((((((((((((((((((\r\n"
" %(((%((#&%(((((((((((%#%#(#%%&&#((((((#%%#(((((((&(&/(((((((((((((((((((((\r\n" " %%(((%%((#&%%(((((((((((%%#%%#(#%%%%&&#((((((#%%%%#(((((((&(&/(((((((((((((((((((((\r\n"
" ((((%((&(((((((((%###&(%(((((((((((((((#%&&%#(#(((%%/((((((((((((((((((((((\r\n" " ((((%%((&(((((((((%%###&(%%(((((((((((((((#%%&&%%#(#(((%%%%/((((((((((((((((((((((\r\n"
"(((%#(((%((((((((#%((%(&(((((((((((((((((((((&(((((%&#(%/******//((&&%((((((\r\n" "(((%%#(((%%((((((((#%%((%%(&(((((((((((((((((((((&(((((%%&#(%%/******//((&&%%((((((\r\n"
"\r\n" "\r\n"
" Preamble\r\n" " Preamble\r\n"
"\r\n" "\r\n"
@ -688,9 +688,9 @@ const char *GSL = "The Giant Sneed License (GSL)\r\n"
"Program, unless a warranty or assumption of liability accompanies a\r\n" "Program, unless a warranty or assumption of liability accompanies a\r\n"
"copy of the Program in return for a fee.\r\n" "copy of the Program in return for a fee.\r\n"
"\r\n" "\r\n"
"%s\r\n" "%s"
"%s\r\n" "%s"
"%s\r\n" "%s"
" END OF TERMS AND CONDITIONS\r\n" " END OF TERMS AND CONDITIONS\r\n"
"\r\n" "\r\n"
" How to Apply These Terms to Your New Programs\r\n" " How to Apply These Terms to Your New Programs\r\n"
@ -718,7 +718,7 @@ const char *GSL = "The Giant Sneed License (GSL)\r\n"
" Giant Sneed License for more details.\r\n" " Giant Sneed License for more details.\r\n"
"\r\n" "\r\n"
" You should have received a copy of the Giant Sneed License\r\n" " You should have received a copy of the Giant Sneed License\r\n"
" along with this program. If not, see <https://%s.licenses.sneedmc.org>\r\n" " along with this program. If not, see <https://%s>\r\n"
"\r\n" "\r\n"
"Also add information on how to contact you by electronic and paper mail.\r\n" "Also add information on how to contact you by electronic and paper mail.\r\n"
"\r\n" "\r\n"

83
lgsl.h
View File

@ -35,45 +35,45 @@ const char *LGSL = " GSF LESSER Giant Sneed LICENSE\r\n"
" █▄ ▄█ █▄ ▄█\r\n" " █▄ ▄█ █▄ ▄█\r\n"
" █▄▄▄▄▄█ █▄▄▄▄▄█\r\n" " █▄▄▄▄▄█ █▄▄▄▄▄█\r\n"
"\r\n" "\r\n"
" %%&&&&&&&%%%%%%&&&%%\r\n" " %%%%&&&&&&&%%%%%%%%%%%%&&&%%%%\r\n"
" %%&&&&&%%%&&&&&&&&&&&&&(%%%%%%%%&%%&&&%&\r\n" " %%%%&&&&&%%%%%%&&&&&&&&&&&&&(%%%%%%%%%%%%%%%%&%%%%&&&%%&\r\n"
" %&&%%%%%%%%%%%%%%%%%%%%%%%%(&&%%%%%%%%&%%%%%%%%%&&\r\n" " %%&&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%(&&%%%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%&&\r\n"
" %&%%%%%%%%%%%%%%%%%%%%%%%%%%%%&(%%%%%%%&%%%%%%%%%%%%&&&\r\n" " %%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&(%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%&&&\r\n"
" &%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%&%%%%%%%%%%%%%%%%&%\r\n" " &%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%\r\n"
" %&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%&%%%%%%%%%%%%%%%%%%%&\r\n" " %%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&\r\n"
" %&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%\r\n" " %%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r\n"
" %&%%%%%&%%%(//////(((((%%%%&&%%%&%%%%%%%%%%%%%%%%%%%&%\r\n" " %%&%%%%%%%%%%&%%%%%%(//////(((((%%%%%%%%&&%%%%%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%\r\n"
" &&%/****************************%&%%%%%%%%%%%%%%%&%\r\n" " &&%%/****************************%%&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%\r\n"
" %******************************%,,,/&%%%%%%%%%%&%%\r\n" " %%******************************%%,,,/&%%%%%%%%%%%%%%%%%%%%&%%%%\r\n"
" %&(*******************************%*,,,,*%%%%%%%%&%\r\n" " %%&(*******************************%%*,,,,*%%%%%%%%%%%%%%%%&%%\r\n"
" %%***/***********/&/...,(%************(,,,,,/&&&&&%\r\n" " %%%%***/***********/&/...,(%%************(,,,,,/&&&&&%%\r\n"
" %%&,..,,.********(%.,,,,,,,%**********&*,,,**%%&&&%%\r\n" " %%%%&,..,,.********(%%.,,,,,,,%%**********&*,,,**%%%%&&&%%%%\r\n"
" %&*.,,,,,((*******&,.,,(&/%(**************%*//%%(**&\r\n" " %%&*.,,,,,((*******&,.,,(&/%%(**************%%*//%%%%(**&\r\n"
" %&&%%%%%************(((/******************//******&%\r\n" " %%&&%%%%%%%%%%************(((/******************//******&%%\r\n"
" %&*********************************************%&%\r\n" " %%&*********************************************%%&%%\r\n"
" %&&*********************************************&%\r\n" " %%&&*********************************************&%%\r\n"
" %%&&&*/*****************************************(&%\r\n" " %%%%&&&*/*****************************************(&%%\r\n"
" %%&*******************************************%&\r\n" " %%%%&*******************************************%%&\r\n"
" &%*********************************************&%\r\n" " &%%*********************************************&%%\r\n"
" %&*******************/*//************************&%\r\n" " %%&*******************/*//************************&%%\r\n"
" %&&///**//((*%//(/******/***********************/&&\r\n" " %%&&///**//((*%%//(/******/***********************/&&\r\n"
" &******************************************/&&\r\n" " &******************************************/&&\r\n"
" %&(**********************************(%&#((//&&%%\r\n" " %%&(**********************************(%%&#((//&&%%%%\r\n"
" (****************************(&%(///(#&&&@%%#%&&\r\n" " (****************************(&%%(///(#&&&@%%%%#%%&&\r\n"
" &&**********************/%&#/((%&%(/#&#((((((((#%@\r\n" " &&**********************/%%&#/((%%&%%(/#&#((((((((#%%@\r\n"
" &%%****************/#&#(/(%&#(((((&#((((((%&#(/((((&&#\r\n" " &%%%%****************/#&#(/(%%&#(((((&#((((((%%&#(/((((&&#\r\n"
" %((#%((&//&%********(%&#((((&%(((((((#&((((((%&(((((((((((//\r\n" " %%((#%%((&//&%%********(%%&#((((&%%(((((((#&((((((%%&(((((((((((//\r\n"
" &((#%(/(((%%(((((((((((((#&#((((((((((&((((((%#((((((((#%%#(((#\r\n" " &((#%%(/(((%%%%(((((((((((((#&#((((((((((&((((((%%#((((((((#%%%%#(((#\r\n"
" @#/(%((%((((((((((&%((((#%&#(((((((((((((&#(((((%#(((((/%%(/(((/(((\r\n" " @#/(%%((%%((((((((((&%%((((#%%&#(((((((((((((&#(((((%%#(((((/%%%%(/(((/(((\r\n"
" ((##&((#%&((%/(((((((((((((((((((((((((((((((#%(((((%%/(((((&((((((((((/(\r\n" " ((##&((#%%&((%%/(((((((((((((((((((((((((((((((#%%(((((%%%%/(((((&((((((((((/(\r\n"
" (%%/##&%#&##&(#%((((((((((((((((((((((((((((#%(((((&((((((&(/((((////////\r\n" " (%%%%/##&%%#&##&(#%%((((((((((((((((((((((((((((#%%(((((&((((((&(/((((////////\r\n"
" &((((#%#(#%((((((((((((((((((##%%%&&%#((%#&%&(((((&(((((&((((((((///(/(//\r\n" " &((((#%%#(#%%((((((((((((((((((##%%%%%%&&%%#((%%#&%%&(((((&(((((&((((((((///(/(//\r\n"
" //(%#((((((((((((((((((((((((((((((((((((#&%&%#(#&&&&/&(((((((((////(////\r\n" " //(%%#((((((((((((((((((((((((((((((((((((#&%%&%%#(#&&&&/&(((((((((////(////\r\n"
" /((%((#%#########(((((((((((((((((((((((((((%((%%((((#%/((((((((((/(((((((\r\n" " /((%%((#%%#########(((((((((((((((((((((((((((%%((%%%%((((#%%/((((((((((/(((((((\r\n"
" (&#((#&%((#%%%%%###((((&&#(#%%&%##((((((((((((((%#((&(/(((((((((((((((((((\r\n" " (&#((#&%%((#%%%%%%%%%%###((((&&#(#%%%%&%%##((((((((((((((%%#((&(/(((((((((((((((((((\r\n"
" %(((%((#&%(((((((((((%#%#(#%%&&#((((((#%%#(((((((&(&/(((((((((((((((((((((\r\n" " %%(((%%((#&%%(((((((((((%%#%%#(#%%%%&&#((((((#%%%%#(((((((&(&/(((((((((((((((((((((\r\n"
" ((((%((&(((((((((%###&(%(((((((((((((((#%&&%#(#(((%%/((((((((((((((((((((((\r\n" " ((((%%((&(((((((((%%###&(%%(((((((((((((((#%%&&%%#(#(((%%%%/((((((((((((((((((((((\r\n"
"(((%#(((%((((((((#%((%(&(((((((((((((((((((((&(((((%&#(%/******//((&&%((((((\r\n" "(((%%#(((%%((((((((#%%((%%(&(((((((((((((((((((((&(((((%%&#(%%/******//((&&%%((((((\r\n"
"\r\n" "\r\n"
" Copyright (C) 2007 Giant Sneed Foundation, Inc. <https://licenses.sneedmc.org>\r\n" " Copyright (C) 2007 Giant Sneed Foundation, Inc. <https://licenses.sneedmc.org>\r\n"
" Everyone is permitted to copy and distribute verbatim copies\r\n" " Everyone is permitted to copy and distribute verbatim copies\r\n"
@ -237,7 +237,8 @@ const char *LGSL = " GSF LESSER Giant Sneed LICENSE\r\n"
"apply, that proxy's public statement of acceptance of any version is\r\n" "apply, that proxy's public statement of acceptance of any version is\r\n"
"permanent authorization for you to choose that version for the\r\n" "permanent authorization for you to choose that version for the\r\n"
"Library.\r\n" "Library.\r\n"
"%s\r\n" "%s"
"%s\r\n" "%s"
"%s\r\n"; "%s"
"https://%s";

146
main.c
View File

@ -1,14 +1,17 @@
#include "mongoose.h" #include "mongoose.h"
#include "index.h" #include "index.h"
#include "gsl.h"
#include "agsl.h"
#include "lgsl.h"
#include "clauses.h"
#include <string.h> #include <string.h>
#include <sys/stat.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <crypt.h> #include <assert.h>
#include <time.h> #include <locale.h>
char *port = "33368"; // sneed, backwards, in phone number, with the last number changed to 8 cuz sneedmc.org is already on 33367 char *port = "33368"; // sneed, backwards, in phone number, with the last number changed to 8 cuz sneedmc.org is already on 33367
@ -23,18 +26,140 @@ void trim(char *str) {
memmove(str, _str, len + 1); memmove(str, _str, len + 1);
} }
// I stole this directly from stack overflow.
char** str_split(char* a_str, const char a_delim)
{
char** result = 0;
size_t count = 0;
char* tmp = a_str;
char* last_comma = 0;
char delim[2];
delim[0] = a_delim;
delim[1] = 0;
/* Count how many elements will be extracted. */
while (*tmp)
{
if (a_delim == *tmp)
{
count++;
last_comma = tmp;
}
tmp++;
}
/* Add space for trailing token. */
count += last_comma < (a_str + strlen(a_str) - 1);
/* Add space for terminating null string so caller
knows where the list of returned strings ends. */
count++;
result = malloc(sizeof(char*) * count);
if (result)
{
size_t idx = 0;
char* token = strtok(a_str, delim);
while (token)
{
assert(idx < count);
*(result + idx++) = strdup(token);
token = strtok(0, delim);
}
assert(idx == count - 1);
*(result + idx) = 0;
}
return result;
}
int arrlen(char **a_arr) {
int count = 0;
while (a_arr[count] != NULL) count++;
return count;
}
// compare N chars of s1 to s2
bool eq(const char *s1, const char *s2, int n) {
return strncmp(s1, s2, n) == 0;
}
void handle_url_req(struct mg_connection *nc, char *host, char *link) { void handle_url_req(struct mg_connection *nc, char *host, char *link) {
if (strlen(link) == 0) { // FIXME: real index/html here
return mg_http_reply(nc, 200, "Content-Type: text/html\r\n", INDEX_HTML,
host, host, host, host, host, host, host, host, host, host, host); // FIXME: need better solution
} else {
if (strncmp(link, "favicon.ico", 12) == 0) { if (strncmp(link, "favicon.ico", 12) == 0) {
mg_http_reply(nc, 404, "", "Not Found"); // FIXME: sneed cube. mg_http_reply(nc, 404, "", "Not Found"); // FIXME: sneed cube.
return;
}
char *a_host = strdup(host);
char **host_elements = str_split(a_host, '.');
free(a_host);
if (arrlen(host_elements) == 3) {
// FIXME: index.html goes here.
return mg_http_reply(nc, 200, "Content-Type: text/html\r\n", "Sneed\r\n");
}
char *b_host = strdup(host_elements[0]);
char **host_clauses = str_split(b_host, '-');
free(b_host);
size_t startclause = 18;
char *license;
if (eq(host_elements[0], "gsl", 3)) {
license = strdup(GSL);
} else if (eq(host_elements[0], "agsl", 4)) {
license = strdup(AGSL);
} else if (eq(host_elements[0], "lgsl", 4)) {
license = strdup(LGSL);
startclause = 7;
} else { } else {
// TODO: stub mg_http_reply(nc, 404, "", "Not Found");
// FIXME: Subdomain handling here }
int clausenum = startclause;
char *jogger = malloc(strlen(JOGGER_NOTICE) + 2);
char *farmer = malloc(strlen(FARMER_NOTICE) + 2);
char *dwarf = malloc(strlen(DWARF_NOTICE) + 2);
char *output_clauses[3] = {"", "", ""};
bool jogger_shown = false;
bool farmer_shown = false;
bool dwarf_shown = false;
if (arrlen(host_clauses) > 1) {
for (size_t i = 0; i < strlen(host_clauses[1]); i++) {
if (host_clauses[1][i] == 'n' && !jogger_shown) {
snprintf(jogger, strlen(JOGGER_NOTICE) + 2, JOGGER_NOTICE, clausenum);
output_clauses[clausenum - startclause] = jogger;
clausenum++;
jogger_shown = true;
} else if (host_clauses[1][i] == 'd' && !dwarf_shown) {
snprintf(dwarf, strlen(DWARF_NOTICE) + 2, DWARF_NOTICE, clausenum);
output_clauses[clausenum - startclause] = dwarf;
clausenum++;
dwarf_shown = true;
} else if (host_clauses[1][i] == 'f' && !farmer_shown) {
snprintf(farmer, strlen(FARMER_NOTICE) + 2, FARMER_NOTICE, clausenum);
output_clauses[clausenum - startclause] = farmer;
clausenum++;
farmer_shown = true;
} else {
continue;
} }
} }
}
mg_http_reply(nc, 200, "", license, output_clauses[0], output_clauses[1], output_clauses[2], host);
free(host_elements);
free(host_clauses);
free(jogger);
free(dwarf);
free(farmer);
} }
static void ev_handler(struct mg_connection *nc, int ev, void *p, void *f) { static void ev_handler(struct mg_connection *nc, int ev, void *p, void *f) {
@ -51,7 +176,7 @@ static void ev_handler(struct mg_connection *nc, int ev, void *p, void *f) {
if (pmhost == NULL) { if (pmhost == NULL) {
fprintf(stderr, "request sent with no Host header"); fprintf(stderr, "request sent with no Host header");
free(uri); free(uri);
mg_http_reply(nc, 400, "", ""); mg_http_reply(nc, 400, "", "Please include a Host header.");
return; return;
} }
@ -70,6 +195,7 @@ static void ev_handler(struct mg_connection *nc, int ev, void *p, void *f) {
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
setlocale(LC_CTYPE, "");
int index; int index;
int c; int c;