mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-06 09:50:28 +00:00
Add GetRedbeanVersion to redbean (#97).
This commit is contained in:
parent
0b317523a0
commit
338c0e03bd
2 changed files with 13 additions and 1 deletions
|
@ -668,6 +668,11 @@ FUNCTIONS
|
||||||
Returns the request HTTP protocol version, which can be 9 for
|
Returns the request HTTP protocol version, which can be 9 for
|
||||||
HTTP/0.9, 10 for HTTP/1.0, or 11 for HTTP/1.1.
|
HTTP/0.9, 10 for HTTP/1.0, or 11 for HTTP/1.1.
|
||||||
|
|
||||||
|
GetRedbeanVersion() → int
|
||||||
|
Returns the Redbean version in the format 0xMMmmpp, with major (MM),
|
||||||
|
minor (mm), and patch (pp) versions encoded, so that version 1.4
|
||||||
|
would be represented as 0x010400.
|
||||||
|
|
||||||
GetZipPaths() → array[str]
|
GetZipPaths() → array[str]
|
||||||
Returns paths of all assets in the zip central directory, prefixed
|
Returns paths of all assets in the zip central directory, prefixed
|
||||||
by a slash.
|
by a slash.
|
||||||
|
|
|
@ -142,6 +142,7 @@
|
||||||
#define REDBEAN "redbean"
|
#define REDBEAN "redbean"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define VERSION 0x010400
|
||||||
#define HASH_LOAD_FACTOR /* 1. / */ 4
|
#define HASH_LOAD_FACTOR /* 1. / */ 4
|
||||||
#define read(F, P, N) readv(F, &(struct iovec){P, N}, 1)
|
#define read(F, P, N) readv(F, &(struct iovec){P, N}, 1)
|
||||||
#define write(F, P, N) writev(F, &(struct iovec){P, N}, 1)
|
#define write(F, P, N) writev(F, &(struct iovec){P, N}, 1)
|
||||||
|
@ -960,7 +961,7 @@ static void ProgramCache(long x) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetDefaults(void) {
|
static void SetDefaults(void) {
|
||||||
ProgramBrand(REDBEAN "/1.4");
|
ProgramBrand(gc(xasprintf("%s/%hhd.%hhd", REDBEAN, VERSION>>020, VERSION>>010)));
|
||||||
__log_level = kLogInfo;
|
__log_level = kLogInfo;
|
||||||
maxpayloadsize = 64 * 1024;
|
maxpayloadsize = 64 * 1024;
|
||||||
ProgramCache(-1);
|
ProgramCache(-1);
|
||||||
|
@ -4022,6 +4023,11 @@ static int LuaGetVersion(lua_State *L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int LuaGetRedbeanVersion(lua_State *L) {
|
||||||
|
lua_pushinteger(L, VERSION);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int LuaGetMethod(lua_State *L) {
|
static int LuaGetMethod(lua_State *L) {
|
||||||
if (msg.method) {
|
if (msg.method) {
|
||||||
lua_pushstring(L, kHttpMethod[msg.method]);
|
lua_pushstring(L, kHttpMethod[msg.method]);
|
||||||
|
@ -5199,6 +5205,7 @@ static const luaL_Reg kLuaFuncs[] = {
|
||||||
{"GetUrl", LuaGetUrl}, //
|
{"GetUrl", LuaGetUrl}, //
|
||||||
{"GetUser", LuaGetUser}, //
|
{"GetUser", LuaGetUser}, //
|
||||||
{"GetVersion", LuaGetVersion}, //
|
{"GetVersion", LuaGetVersion}, //
|
||||||
|
{"GetRedbeanVersion", LuaGetRedbeanVersion}, //
|
||||||
{"GetZipPaths", LuaGetZipPaths}, //
|
{"GetZipPaths", LuaGetZipPaths}, //
|
||||||
{"HasControlCodes", LuaHasControlCodes}, //
|
{"HasControlCodes", LuaHasControlCodes}, //
|
||||||
{"HasParam", LuaHasParam}, //
|
{"HasParam", LuaHasParam}, //
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue