Commit 1b241ddc authored by Matt Mascarenhas's avatar Matt Mascarenhas

cinera.c: Add credentials and -v flag

README.md: Add dependency on curl
parent 1bb5cb03
Fair warning: This is all under development and not yet packaged up for easy
deployment
## cinera
## Cinera
### Download, and prepare the parser
......@@ -13,9 +13,13 @@ deployment
Note: For each parser update, remember to make and copy it into place
### Install Dependencies
1. curl
### Build
1. `zsh cinera.c` (replacing zsh with your shell as appropriate)
1. `$SHELL cinera.c`
### Run
......
......@@ -257,15 +257,29 @@ typedef struct
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"},
{ "miotatsu", "Mio Iwakura", "http://riscy.tv/", "cinera_sprite_patreon.png", "https://patreon.com/miotatsu"},
{ "nothings", "Sean Barrett", "https://nothings.org/", "", ""},
{ "cmuratori", "Casey Muratori", "https://handmadehero.org", "cinera_sprite_patreon.png", "https://patreon.com/cmuratori"},
{ "fierydrake", "Mike Tunnicliffe", "", "", ""},
{ "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"},
{ "/y_lee", "Yunsup Lee", "https://www.linkedin.com/in/yunsup-lee-385b692b/", "", ""},
{ "/a_waterman", "Andrew Waterman", "https://www.linkedin.com/in/andrew-waterman-76805788", "", ""},
{ "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"},
{ "nothings", "Sean Barrett", "https://nothings.org/", "", ""},
{ "philipbuuck", "Philip Buuck", "http://philipbuuck.com/", "", ""},
{ "quelsolaar", "Eskil Steenberg", "http://quelsolaar.com/", "", ""},
{ "rygorous", "Fabian Giesen", "https://fgiesen.wordpress.com/", "", ""},
{ "sssmcgrath", "Shawn McGrath", "http://www.dyadgame.com/", "", ""},
{ "thehappiecat", "Anne", "https://www.youtube.com/c/TheHappieCat", "cinera_sprite_patreon.png", "https://www.patreon.com/thehappiecat"},
{ "williamchyr", "William Chyr", "http://williamchyr.com/", "", ""},
{ "wonchun", "Won Chun", "https://twitter.com/won3d", "", ""},
};
typedef struct
......@@ -1592,6 +1606,8 @@ PrintUsage(char *BinaryLocation, config *DefaultConfig)
" -U <seconds>\n"
" Override default update interval (\"%d\")\n"
//" -c config location\n"
" -v\n"
" display version and exit\n"
" -h\n"
" display this help\n"
"\n"
......@@ -4029,6 +4045,20 @@ StripTrailingSlash(char *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
main(int ArgC, char **Args)
{
......@@ -4072,7 +4102,7 @@ main(int ArgC, char **Args)
}
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)
{
......@@ -4121,6 +4151,9 @@ main(int ArgC, char **Args)
case 'U':
Config.UpdateInterval = StringToInt(optarg);
break;
case 'v':
PrintVersions();
return RC_SUCCESS;
case 'x':
Config.TemplateIndexLocation = optarg;
Config.Mode = MODE_INTEGRATE;
......@@ -4128,7 +4161,7 @@ main(int ArgC, char **Args)
case 'h':
default:
PrintUsage(Args[0], &DefaultConfig);
return 1;
return RC_SUCCESS;
}
}
......@@ -4157,14 +4190,6 @@ main(int ArgC, char **Args)
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)
MemoryArena.Size = Megabytes(4);
if(!(MemoryArena.Location = calloc(MemoryArena.Size, 1)))
......@@ -4199,7 +4224,7 @@ main(int ArgC, char **Args)
buffers CollationBuffers;
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.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; };
*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 *IndexTemplate;
......@@ -4245,7 +4278,6 @@ main(int ArgC, char **Args)
//
// Integrating or not
curl_version_info_data *CurlVersion = curl_version_info(CURLVERSION_NOW);
if(Config.Edition == EDITION_PROJECT)
{
......@@ -4256,11 +4288,8 @@ main(int ArgC, char **Args)
#endif
// TODO(matt): Also log these startup messages?
printf( "Cinera: %d.%d.%d\n"
"Cinera DB: %d\n"
"hmmlib: %d.%d.%d\n"
"libcurl: %s\n"
"\n"
PrintVersions();
printf( "\n"
"Globals\n"
" Cache Directory:\t\t%s\n"
"\n"
......@@ -4271,10 +4300,6 @@ main(int ArgC, char **Args)
" CSS:\t\t\t%s\n"
" Images:\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.RootDir,
StringsDiffer(Config.RootURL, "") ? Config.RootURL : "[empty]",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment