cinera.c: Add credentials and -v flag
README.md: Add dependency on curl
This commit is contained in:
parent
1bb5cb034b
commit
1b241ddcfe
|
@ -1,7 +1,7 @@
|
||||||
Fair warning: This is all under development and not yet packaged up for easy
|
Fair warning: This is all under development and not yet packaged up for easy
|
||||||
deployment
|
deployment
|
||||||
|
|
||||||
## cinera
|
## Cinera
|
||||||
|
|
||||||
### Download, and prepare the parser
|
### Download, and prepare the parser
|
||||||
|
|
||||||
|
@ -13,9 +13,13 @@ deployment
|
||||||
|
|
||||||
Note: For each parser update, remember to make and copy it into place
|
Note: For each parser update, remember to make and copy it into place
|
||||||
|
|
||||||
|
### Install Dependencies
|
||||||
|
|
||||||
|
1. curl
|
||||||
|
|
||||||
### Build
|
### Build
|
||||||
|
|
||||||
1. `zsh cinera.c` (replacing zsh with your shell as appropriate)
|
1. `$SHELL cinera.c`
|
||||||
|
|
||||||
### Run
|
### Run
|
||||||
|
|
||||||
|
|
|
@ -257,15 +257,29 @@ typedef struct
|
||||||
|
|
||||||
credential_info Credentials[] =
|
credential_info Credentials[] =
|
||||||
{
|
{
|
||||||
|
{ "/a_waterman", "Andrew Waterman", "https://www.linkedin.com/in/andrew-waterman-76805788", "", ""},
|
||||||
|
{ "/y_lee", "Yunsup Lee", "https://www.linkedin.com/in/yunsup-lee-385b692b/", "", ""},
|
||||||
|
{ "BretHudson", "Bret Hudson", "http://www.brethudson.com/", "cinera_sprite_patreon.png", "https://www.patreon.com/indieFunction"},
|
||||||
|
{ "ChronalDragon", "Andrew Chronister", "http://chronal.net/", "", ""},
|
||||||
|
{ "Kelimion", "Jeroen van Rijn", "https://handmade.network/home", "", ""},
|
||||||
{ "Miblo", "Matt Mascarenhas", "http://miblodelcarpio.co.uk", "cinera_sprite_patreon.png", "https://patreon.com/miblo"},
|
{ "Miblo", "Matt Mascarenhas", "http://miblodelcarpio.co.uk", "cinera_sprite_patreon.png", "https://patreon.com/miblo"},
|
||||||
|
{ "Mr4thDimention", "Allen Webster", "http://www.4coder.net/", "cinera_sprite_patreon.png", "https://www.patreon.com/mr4thdimention"},
|
||||||
|
{ "abnercoimbre", "Abner Coimbre", "https://handmade.network/m/abnercoimbre", "cinera_sprite_patreon.png", "https://patreon.com/handmade_dev"},
|
||||||
|
{ "brianwill", "Brian Will", "http://brianwill.net/blog/", "", ""},
|
||||||
|
{ "cmuratori", "Casey Muratori", "https://handmadehero.org", "cinera_sprite_patreon.png", "https://patreon.com/cmuratori"},
|
||||||
|
{ "debiatan", "Miguel Lechón", "http://blog.debiatan.net/", "", ""},
|
||||||
|
{ "fierydrake", "Mike Tunnicliffe", "", "", ""},
|
||||||
|
{ "garlandobloom", "Matthew VanDevander", "https://lowtideproductions.com/", "cinera_sprite_patreon.png", "https://www.patreon.com/mv"},
|
||||||
|
{ "jon", "Jonathan Blow", "http://the-witness.net/news/", "", ""},
|
||||||
{ "miotatsu", "Mio Iwakura", "http://riscy.tv/", "cinera_sprite_patreon.png", "https://patreon.com/miotatsu"},
|
{ "miotatsu", "Mio Iwakura", "http://riscy.tv/", "cinera_sprite_patreon.png", "https://patreon.com/miotatsu"},
|
||||||
{ "nothings", "Sean Barrett", "https://nothings.org/", "", ""},
|
{ "nothings", "Sean Barrett", "https://nothings.org/", "", ""},
|
||||||
{ "cmuratori", "Casey Muratori", "https://handmadehero.org", "cinera_sprite_patreon.png", "https://patreon.com/cmuratori"},
|
{ "philipbuuck", "Philip Buuck", "http://philipbuuck.com/", "", ""},
|
||||||
{ "fierydrake", "Mike Tunnicliffe", "", "", ""},
|
{ "quelsolaar", "Eskil Steenberg", "http://quelsolaar.com/", "", ""},
|
||||||
{ "abnercoimbre", "Abner Coimbre", "https://handmade.network/m/abnercoimbre", "cinera_sprite_patreon.png", "https://patreon.com/handmade_dev"},
|
{ "rygorous", "Fabian Giesen", "https://fgiesen.wordpress.com/", "", ""},
|
||||||
{ "/y_lee", "Yunsup Lee", "https://www.linkedin.com/in/yunsup-lee-385b692b/", "", ""},
|
{ "sssmcgrath", "Shawn McGrath", "http://www.dyadgame.com/", "", ""},
|
||||||
{ "/a_waterman", "Andrew Waterman", "https://www.linkedin.com/in/andrew-waterman-76805788", "", ""},
|
{ "thehappiecat", "Anne", "https://www.youtube.com/c/TheHappieCat", "cinera_sprite_patreon.png", "https://www.patreon.com/thehappiecat"},
|
||||||
{ "debiatan", "Miguel Lechón", "http://blog.debiatan.net/", "", ""},
|
{ "williamchyr", "William Chyr", "http://williamchyr.com/", "", ""},
|
||||||
|
{ "wonchun", "Won Chun", "https://twitter.com/won3d", "", ""},
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -1592,6 +1606,8 @@ PrintUsage(char *BinaryLocation, config *DefaultConfig)
|
||||||
" -U <seconds>\n"
|
" -U <seconds>\n"
|
||||||
" Override default update interval (\"%d\")\n"
|
" Override default update interval (\"%d\")\n"
|
||||||
//" -c config location\n"
|
//" -c config location\n"
|
||||||
|
" -v\n"
|
||||||
|
" display version and exit\n"
|
||||||
" -h\n"
|
" -h\n"
|
||||||
" display this help\n"
|
" display this help\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -4029,6 +4045,20 @@ StripTrailingSlash(char *String)
|
||||||
return String;
|
return String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PrintVersions()
|
||||||
|
{
|
||||||
|
curl_version_info_data *CurlVersion = curl_version_info(CURLVERSION_NOW);
|
||||||
|
printf("Cinera: %d.%d.%d\n"
|
||||||
|
"Cinera DB: %d\n"
|
||||||
|
"hmmlib: %d.%d.%d\n"
|
||||||
|
"libcurl: %s\n",
|
||||||
|
CINERA_APP_VERSION.Major, CINERA_APP_VERSION.Minor, CINERA_APP_VERSION.Patch,
|
||||||
|
CINERA_DB_VERSION,
|
||||||
|
hmml_version.Major, hmml_version.Minor, hmml_version.Patch,
|
||||||
|
CurlVersion->version);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int ArgC, char **Args)
|
main(int ArgC, char **Args)
|
||||||
{
|
{
|
||||||
|
@ -4072,7 +4102,7 @@ main(int ArgC, char **Args)
|
||||||
}
|
}
|
||||||
|
|
||||||
char CommandLineArg;
|
char CommandLineArg;
|
||||||
while((CommandLineArg = getopt(ArgC, Args, "b:c:d:fhi:j:l:m:o:p:r:u:t:U:x:")) != -1)
|
while((CommandLineArg = getopt(ArgC, Args, "b:c:d:fhi:j:l:m:o:p:r:u:t:U:vx:")) != -1)
|
||||||
{
|
{
|
||||||
switch(CommandLineArg)
|
switch(CommandLineArg)
|
||||||
{
|
{
|
||||||
|
@ -4121,6 +4151,9 @@ main(int ArgC, char **Args)
|
||||||
case 'U':
|
case 'U':
|
||||||
Config.UpdateInterval = StringToInt(optarg);
|
Config.UpdateInterval = StringToInt(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'v':
|
||||||
|
PrintVersions();
|
||||||
|
return RC_SUCCESS;
|
||||||
case 'x':
|
case 'x':
|
||||||
Config.TemplateIndexLocation = optarg;
|
Config.TemplateIndexLocation = optarg;
|
||||||
Config.Mode = MODE_INTEGRATE;
|
Config.Mode = MODE_INTEGRATE;
|
||||||
|
@ -4128,7 +4161,7 @@ main(int ArgC, char **Args)
|
||||||
case 'h':
|
case 'h':
|
||||||
default:
|
default:
|
||||||
PrintUsage(Args[0], &DefaultConfig);
|
PrintUsage(Args[0], &DefaultConfig);
|
||||||
return 1;
|
return RC_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4157,14 +4190,6 @@ main(int ArgC, char **Args)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE(matt): Templating
|
|
||||||
//
|
|
||||||
// Config will contain paths of multiple templates
|
|
||||||
// App is running all the time, and picking up changes to the config as we go
|
|
||||||
// If we find a new template, we first of all validate it
|
|
||||||
// In our case here, we just want to straight up validate a template if Config.Mode == MODE_INTEGRATE
|
|
||||||
// And, in that same state, we gotta keep a Template buffer around
|
|
||||||
|
|
||||||
// NOTE(matt): Init MemoryArena (it is global)
|
// NOTE(matt): Init MemoryArena (it is global)
|
||||||
MemoryArena.Size = Megabytes(4);
|
MemoryArena.Size = Megabytes(4);
|
||||||
if(!(MemoryArena.Location = calloc(MemoryArena.Size, 1)))
|
if(!(MemoryArena.Location = calloc(MemoryArena.Size, 1)))
|
||||||
|
@ -4199,7 +4224,7 @@ main(int ArgC, char **Args)
|
||||||
|
|
||||||
buffers CollationBuffers;
|
buffers CollationBuffers;
|
||||||
if(ClaimBuffer(&CollationBuffers.IncludesPlayer, "IncludesPlayer", Kilobytes(1)) == RC_ARENA_FULL) { goto RIP; };
|
if(ClaimBuffer(&CollationBuffers.IncludesPlayer, "IncludesPlayer", Kilobytes(1)) == RC_ARENA_FULL) { goto RIP; };
|
||||||
if(ClaimBuffer(&CollationBuffers.Menus, "Menus", Kilobytes(24)) == RC_ARENA_FULL) { goto RIP; };
|
if(ClaimBuffer(&CollationBuffers.Menus, "Menus", Kilobytes(32)) == RC_ARENA_FULL) { goto RIP; };
|
||||||
if(ClaimBuffer(&CollationBuffers.Player, "Player", Kilobytes(256)) == RC_ARENA_FULL) { goto RIP; };
|
if(ClaimBuffer(&CollationBuffers.Player, "Player", Kilobytes(256)) == RC_ARENA_FULL) { goto RIP; };
|
||||||
if(ClaimBuffer(&CollationBuffers.ScriptPlayer, "ScriptPlayer", Kilobytes(8)) == RC_ARENA_FULL) { goto RIP; };
|
if(ClaimBuffer(&CollationBuffers.ScriptPlayer, "ScriptPlayer", Kilobytes(8)) == RC_ARENA_FULL) { goto RIP; };
|
||||||
|
|
||||||
|
@ -4209,6 +4234,14 @@ main(int ArgC, char **Args)
|
||||||
if(ClaimBuffer(&CollationBuffers.ScriptIndex, "ScriptIndex", 256) == RC_ARENA_FULL) { goto RIP; };
|
if(ClaimBuffer(&CollationBuffers.ScriptIndex, "ScriptIndex", 256) == RC_ARENA_FULL) { goto RIP; };
|
||||||
*CollationBuffers.Title = '\0';
|
*CollationBuffers.Title = '\0';
|
||||||
|
|
||||||
|
// NOTE(matt): Templating
|
||||||
|
//
|
||||||
|
// Config will contain paths of multiple templates
|
||||||
|
// App is running all the time, and picking up changes to the config as we go
|
||||||
|
// If we find a new template, we first of all validate it
|
||||||
|
// In our case here, we just want to straight up validate a template if Config.Mode == MODE_INTEGRATE
|
||||||
|
// And, in that same state, we gotta keep a Template buffer around
|
||||||
|
|
||||||
template *PlayerTemplate;
|
template *PlayerTemplate;
|
||||||
template *IndexTemplate;
|
template *IndexTemplate;
|
||||||
|
|
||||||
|
@ -4245,7 +4278,6 @@ main(int ArgC, char **Args)
|
||||||
//
|
//
|
||||||
// Integrating or not
|
// Integrating or not
|
||||||
|
|
||||||
curl_version_info_data *CurlVersion = curl_version_info(CURLVERSION_NOW);
|
|
||||||
if(Config.Edition == EDITION_PROJECT)
|
if(Config.Edition == EDITION_PROJECT)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -4256,11 +4288,8 @@ main(int ArgC, char **Args)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO(matt): Also log these startup messages?
|
// TODO(matt): Also log these startup messages?
|
||||||
printf( "Cinera: %d.%d.%d\n"
|
PrintVersions();
|
||||||
"Cinera DB: %d\n"
|
printf( "\n"
|
||||||
"hmmlib: %d.%d.%d\n"
|
|
||||||
"libcurl: %s\n"
|
|
||||||
"\n"
|
|
||||||
"Globals\n"
|
"Globals\n"
|
||||||
" Cache Directory:\t\t%s\n"
|
" Cache Directory:\t\t%s\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -4271,10 +4300,6 @@ main(int ArgC, char **Args)
|
||||||
" CSS:\t\t\t%s\n"
|
" CSS:\t\t\t%s\n"
|
||||||
" Images:\t\t\t%s\n"
|
" Images:\t\t\t%s\n"
|
||||||
" JS:\t\t\t%s\n",
|
" JS:\t\t\t%s\n",
|
||||||
CINERA_APP_VERSION.Major, CINERA_APP_VERSION.Minor, CINERA_APP_VERSION.Patch,
|
|
||||||
CINERA_DB_VERSION,
|
|
||||||
hmml_version.Major, hmml_version.Minor, hmml_version.Patch,
|
|
||||||
CurlVersion->version,
|
|
||||||
Config.CacheDir,
|
Config.CacheDir,
|
||||||
Config.RootDir,
|
Config.RootDir,
|
||||||
StringsDiffer(Config.RootURL, "") ? Config.RootURL : "[empty]",
|
StringsDiffer(Config.RootURL, "") ? Config.RootURL : "[empty]",
|
||||||
|
|
Loading…
Reference in New Issue