Add /.args feature to Redbean/Lua/SQLite/Python/QuickJS

You now have some ability to truly make an executable yours, by adding a
`.args` file to the root of the zip structure. If this is specified,
then you'll be overriding the default CLI args.

This will be a great feature for folks who want to distribute their own
apps, using the interpreter executable, but have the executable appears
to be just your app rather than being the interpreter.
This commit is contained in:
Justine Tunney 2022-05-12 11:01:58 -07:00
parent 0f6251f4d2
commit 4499f98e76
19 changed files with 421 additions and 19 deletions

View file

@ -92,6 +92,8 @@
#include "libc/calls/calls.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/stat.macros.h"
#include "tool/args/args.h"
#include "tool/args/args.h"
#include "third_party/sqlite3/sqlite3.h"
typedef sqlite3_int64 i64;
@ -20563,12 +20565,7 @@ static char *cmdline_option_value(int argc, char **argv, int i){
# endif
#endif
#if SQLITE_SHELL_IS_UTF8
int SQLITE_CDECL main(int argc, char **argv){
#else
int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
char **argv;
#endif
char *zErrMsg = 0;
ShellState data;
const char *zInitFile = 0;
@ -20579,11 +20576,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
int nCmd = 0;
char **azCmd = 0;
const char *zVfs = 0; /* Value of -vfs command-line option */
#if !SQLITE_SHELL_IS_UTF8
char **argvToFree = 0;
int argcToFree = 0;
#endif
LoadZipArgs(&argc, &argv);
setBinaryMode(stdin, 0);
setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
setvbuf(stdin, (char *)NULL, _IONBF, BUFSIZ);