mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[version] Defined some getname functions
Now --version also display versions of some modules.
This commit is contained in:
parent
541303cbff
commit
9f1792e9c3
@ -73,14 +73,19 @@
|
||||
/*** Global methods */
|
||||
|
||||
|
||||
static char mujs_version[32];
|
||||
|
||||
static const char *
|
||||
get_name_mujs(struct module *xxx)
|
||||
{
|
||||
static char mujs_version[32];
|
||||
snprintf(mujs_version, 31, "MuJS %d.%d.%d", JS_VERSION_MAJOR, JS_VERSION_MINOR, JS_VERSION_PATCH);
|
||||
|
||||
return mujs_version;
|
||||
}
|
||||
|
||||
static void
|
||||
mujs_init(struct module *module)
|
||||
{
|
||||
snprintf(mujs_version, 31, "MuJS %d.%d.%d", JS_VERSION_MAJOR, JS_VERSION_MINOR, JS_VERSION_PATCH);
|
||||
module->name = mujs_version;
|
||||
|
||||
map_attrs = attr_create_new_map();
|
||||
map_attributes = attr_create_new_map();
|
||||
map_rev_attributes = attr_create_new_map();
|
||||
@ -453,5 +458,5 @@ struct module mujs_module = struct_module(
|
||||
/* data: */ NULL,
|
||||
/* init: */ mujs_init,
|
||||
/* done: */ mujs_done,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_mujs
|
||||
);
|
||||
|
@ -73,10 +73,8 @@
|
||||
|
||||
/*** Global methods */
|
||||
|
||||
static char quickjs_version[32];
|
||||
|
||||
static void
|
||||
quickjs_get_version(void)
|
||||
quickjs_get_version(char *quickjs_version)
|
||||
{
|
||||
char *ptr = NULL;
|
||||
size_t size = 0;
|
||||
@ -108,15 +106,22 @@ quickjs_get_version(void)
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_name_quickjs(struct module *xxx)
|
||||
{
|
||||
static char quickjs_version[32];
|
||||
|
||||
quickjs_get_version(quickjs_version);
|
||||
|
||||
return quickjs_version;
|
||||
}
|
||||
|
||||
static void
|
||||
quickjs_init(struct module *module)
|
||||
{
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||
#endif
|
||||
quickjs_get_version();
|
||||
module->name = quickjs_version;
|
||||
|
||||
map_attrs = attr_create_new_attrs_map();
|
||||
map_attributes = attr_create_new_attributes_map();
|
||||
map_rev_attributes = attr_create_new_attributes_map_rev();
|
||||
@ -563,5 +568,5 @@ struct module quickjs_module = struct_module(
|
||||
/* data: */ NULL,
|
||||
/* init: */ quickjs_init,
|
||||
/* done: */ quickjs_done,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_quickjs
|
||||
);
|
||||
|
@ -134,14 +134,9 @@ reported:
|
||||
JS_ClearPendingException(ctx);
|
||||
}
|
||||
|
||||
static char spidermonkey_version[32];
|
||||
|
||||
static void
|
||||
spidermonkey_init(struct module *module)
|
||||
{
|
||||
snprintf(spidermonkey_version, 31, "mozjs %s", JS_GetImplementationVersion());
|
||||
module->name = spidermonkey_version;
|
||||
|
||||
js_module_init_ok = spidermonkey_runtime_addref();
|
||||
}
|
||||
|
||||
@ -152,6 +147,15 @@ spidermonkey_done(struct module *xxx)
|
||||
spidermonkey_runtime_release();
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_name_spidermonkey(struct module *module)
|
||||
{
|
||||
static char spidermonkey_version[32];
|
||||
|
||||
snprintf(spidermonkey_version, 31, "mozjs %s", JS_GetImplementationVersion());
|
||||
return spidermonkey_version;
|
||||
}
|
||||
|
||||
static JSObject*
|
||||
CompileExampleModule(JSContext* cx, const char* filename, const char* code, size_t len)
|
||||
{
|
||||
@ -707,5 +711,5 @@ struct module spidermonkey_module = struct_module(
|
||||
/* data: */ NULL,
|
||||
/* init: */ spidermonkey_init,
|
||||
/* done: */ spidermonkey_done,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_spidermonkey
|
||||
);
|
||||
|
@ -54,7 +54,11 @@ add_module_to_string(struct string *string, struct module *module,
|
||||
struct module *submodule;
|
||||
int i;
|
||||
|
||||
if (module->name) add_to_string(string, _(module->name, term));
|
||||
if (module->getname) {
|
||||
add_to_string(string, module->getname(module));
|
||||
} else if (module->name) {
|
||||
add_to_string(string, _(module->name, term));
|
||||
}
|
||||
|
||||
if (!module->submodules) return;
|
||||
|
||||
|
@ -85,7 +85,6 @@ socket_SSL_ex_data_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,
|
||||
return 1; /* allow SSL_dup() */
|
||||
}
|
||||
|
||||
static char opensslversion[64];
|
||||
|
||||
#ifdef CONFIG_OS_DOS
|
||||
|
||||
@ -170,8 +169,15 @@ init_openssl(struct module *module)
|
||||
NULL,
|
||||
socket_SSL_ex_data_dup,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_name_openssl(struct module *xxx)
|
||||
{
|
||||
static char opensslversion[64];
|
||||
strncpy(opensslversion, SSLeay_version(OPENSSL_VERSION), 63);
|
||||
module->name = opensslversion;
|
||||
|
||||
return opensslversion;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -239,7 +245,7 @@ static struct module openssl_module = struct_module(
|
||||
/* data: */ NULL,
|
||||
/* init: */ init_openssl,
|
||||
/* done: */ done_openssl,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_openssl
|
||||
);
|
||||
|
||||
#elif defined(CONFIG_GNUTLS)
|
||||
@ -260,8 +266,6 @@ const static int cipher_priority[16] = {
|
||||
const static int cert_type_priority[16] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 };
|
||||
#endif
|
||||
|
||||
static char gnutlsversion[64];
|
||||
|
||||
static void
|
||||
init_gnutls(struct module *module)
|
||||
{
|
||||
@ -309,9 +313,15 @@ init_gnutls(struct module *module)
|
||||
client_cert, client_cert, GNUTLS_X509_FMT_PEM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_name_gnutls(struct module *xxx)
|
||||
{
|
||||
static char gnutlsversion[64];
|
||||
snprintf(gnutlsversion, 63, "GnuTLS %s", gnutls_check_version(NULL));
|
||||
module->name = gnutlsversion;
|
||||
|
||||
return gnutlsversion;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -387,7 +397,7 @@ static struct module gnutls_module = struct_module(
|
||||
/* data: */ NULL,
|
||||
/* init: */ init_gnutls,
|
||||
/* done: */ done_gnutls,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_gnutls
|
||||
);
|
||||
|
||||
#endif /* USE_OPENSSL or CONFIG_GNUTLS */
|
||||
|
@ -59,13 +59,14 @@
|
||||
#if defined(CONFIG_FTP) || defined(CONFIG_SFTP)
|
||||
|
||||
#ifdef CONFIG_FTP
|
||||
static char el_curlversion[256];
|
||||
|
||||
static void
|
||||
init_ftpes(struct module *module)
|
||||
static const char *
|
||||
get_name_ftpes(struct module *module)
|
||||
{
|
||||
static char el_curlversion[256];
|
||||
snprintf(el_curlversion, 255, "FTPES(%s)", curl_version());
|
||||
module->name = el_curlversion;
|
||||
|
||||
return el_curlversion;
|
||||
}
|
||||
|
||||
struct module ftpes_protocol_module = struct_module(
|
||||
@ -74,9 +75,9 @@ struct module ftpes_protocol_module = struct_module(
|
||||
/* hooks: */ NULL,
|
||||
/* submodules: */ NULL,
|
||||
/* data: */ NULL,
|
||||
/* init: */ init_ftpes,
|
||||
/* init: */ NULL,
|
||||
/* done: */ NULL,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_ftpes
|
||||
);
|
||||
#endif
|
||||
|
||||
|
@ -36,13 +36,14 @@
|
||||
#include "util/memory.h"
|
||||
#include "util/string.h"
|
||||
|
||||
static char elsmbversion[32];
|
||||
|
||||
static void
|
||||
init_smb(struct module *module)
|
||||
get_name_smb(struct module *module)
|
||||
{
|
||||
static char elsmbversion[32];
|
||||
snprintf(elsmbversion, 31, "SMB(%s)", smbc_version());
|
||||
module->name = elsmbversion;
|
||||
|
||||
return elsmbversion;
|
||||
}
|
||||
|
||||
struct module smb_protocol_module = struct_module(
|
||||
@ -51,9 +52,9 @@ struct module smb_protocol_module = struct_module(
|
||||
/* hooks: */ NULL,
|
||||
/* submodules: */ NULL,
|
||||
/* data: */ NULL,
|
||||
/* init: */ init_smb,
|
||||
/* init: */ NULL,
|
||||
/* done: */ NULL,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_smb
|
||||
);
|
||||
|
||||
static FILE *header_out, *data_out;
|
||||
|
@ -39,9 +39,6 @@
|
||||
/* c_bind_key */
|
||||
/* c_xdialog */
|
||||
|
||||
|
||||
static char elguileversion[32];
|
||||
|
||||
void
|
||||
init_guile(struct module *module)
|
||||
{
|
||||
@ -51,9 +48,6 @@ init_guile(struct module *module)
|
||||
|
||||
scm_init_guile();
|
||||
|
||||
snprintf(elguileversion, 31, "Guile %s", scm_to_locale_string(scm_version()));
|
||||
module->name = elguileversion;
|
||||
|
||||
if (!xdg_config_home) return;
|
||||
|
||||
/* Remember the current module. */
|
||||
|
@ -11,6 +11,14 @@
|
||||
#include "scripting/guile/core.h"
|
||||
#include "scripting/guile/hooks.h"
|
||||
|
||||
static const char *
|
||||
get_name_guile(struct module *xxx)
|
||||
{
|
||||
static char elguileversion[32];
|
||||
snprintf(elguileversion, 31, "Guile %s", scm_to_locale_string(scm_version()));
|
||||
|
||||
return elguileversion;
|
||||
}
|
||||
|
||||
struct module guile_scripting_module = struct_module(
|
||||
/* name: */ N_("Guile"),
|
||||
@ -20,5 +28,5 @@ struct module guile_scripting_module = struct_module(
|
||||
/* data: */ NULL,
|
||||
/* init: */ init_guile,
|
||||
/* done: */ NULL,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_guile
|
||||
);
|
||||
|
@ -719,7 +719,6 @@ do_hooks_file(LS, const char *prefix, const char *filename)
|
||||
mem_free(file);
|
||||
}
|
||||
|
||||
static char elluaversion[32];
|
||||
|
||||
void
|
||||
init_lua(struct module *module)
|
||||
@ -753,9 +752,6 @@ init_lua(struct module *module)
|
||||
|
||||
do_hooks_file(L, CONFDIR, LUA_HOOKS_FILENAME);
|
||||
if (xdg_config_home) do_hooks_file(L, xdg_config_home, LUA_HOOKS_FILENAME);
|
||||
strncpy(elluaversion, LUA_RELEASE, 31);
|
||||
|
||||
module->name = elluaversion;
|
||||
}
|
||||
|
||||
static void free_lua_console_history_entries(void);
|
||||
|
@ -11,6 +11,15 @@
|
||||
#include "scripting/lua/core.h"
|
||||
#include "scripting/lua/hooks.h"
|
||||
|
||||
static const char *
|
||||
get_name_lua(struct module *xxx)
|
||||
{
|
||||
static char elluaversion[32];
|
||||
strncpy(elluaversion, LUA_RELEASE, 31);
|
||||
|
||||
return elluaversion;
|
||||
}
|
||||
|
||||
|
||||
struct module lua_scripting_module = struct_module(
|
||||
/* name: */ N_("Lua"),
|
||||
@ -20,5 +29,5 @@ struct module lua_scripting_module = struct_module(
|
||||
/* data: */ NULL,
|
||||
/* init: */ init_lua,
|
||||
/* done: */ cleanup_lua,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_lua
|
||||
);
|
||||
|
@ -83,8 +83,6 @@ xs_init(pTHX)
|
||||
newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
|
||||
}
|
||||
|
||||
static char elperlversion[32];
|
||||
|
||||
void
|
||||
init_perl(struct module *module)
|
||||
{
|
||||
@ -126,9 +124,6 @@ init_perl(struct module *module)
|
||||
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
|
||||
#endif
|
||||
|
||||
snprintf(elperlversion, 31, "Perl %s", PERL_VERSION_STRING);
|
||||
module->name = elperlversion;
|
||||
|
||||
if (!err) err = perl_run(my_perl);
|
||||
if (err) precleanup_perl(module);
|
||||
}
|
||||
|
@ -11,6 +11,14 @@
|
||||
#include "scripting/perl/core.h"
|
||||
#include "scripting/perl/hooks.h"
|
||||
|
||||
static const char *
|
||||
get_name_perl(struct module *xxx)
|
||||
{
|
||||
static char elperlversion[32];
|
||||
snprintf(elperlversion, 31, "Perl %s", PERL_VERSION_STRING);
|
||||
|
||||
return elperlversion;
|
||||
}
|
||||
|
||||
struct module perl_scripting_module = struct_module(
|
||||
/* name: */ N_("Perl"),
|
||||
@ -20,5 +28,5 @@ struct module perl_scripting_module = struct_module(
|
||||
/* data: */ NULL,
|
||||
/* init: */ init_perl,
|
||||
/* done: */ cleanup_perl,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_perl
|
||||
);
|
||||
|
@ -380,7 +380,6 @@ python_error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char elpythonversion[32];
|
||||
|
||||
void
|
||||
init_python(struct module *module)
|
||||
@ -390,8 +389,6 @@ init_python(struct module *module)
|
||||
}
|
||||
PyImport_AppendInittab("elinks", PyInit_elinks);
|
||||
Py_Initialize();
|
||||
snprintf(elpythonversion, 31, "Python %s", PY_VERSION);
|
||||
module->name = elpythonversion;
|
||||
|
||||
if (!hooks_module_exists()) {
|
||||
return;
|
||||
|
@ -14,6 +14,15 @@
|
||||
#include "scripting/python/hooks.h"
|
||||
|
||||
|
||||
static const char *
|
||||
get_name_python(struct module *xxx)
|
||||
{
|
||||
static char elpythonversion[32];
|
||||
snprintf(elpythonversion, 31, "Python %s", PY_VERSION);
|
||||
|
||||
return elpythonversion;
|
||||
}
|
||||
|
||||
struct module python_scripting_module = struct_module(
|
||||
/* name: */ N_("Python"),
|
||||
/* options: */ NULL,
|
||||
@ -22,5 +31,5 @@ struct module python_scripting_module = struct_module(
|
||||
/* data: */ NULL,
|
||||
/* init: */ init_python,
|
||||
/* done: */ cleanup_python,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_python
|
||||
);
|
||||
|
@ -219,9 +219,6 @@ init_erb_module(void)
|
||||
rb_define_module_function(erb_module, "p", (VALUE (*)(ANYARGS))erb_stdout_p, -1);
|
||||
}
|
||||
|
||||
|
||||
static char elrubyversion[32];
|
||||
|
||||
void
|
||||
init_ruby(struct module *module)
|
||||
{
|
||||
@ -241,9 +238,6 @@ init_ruby(struct module *module)
|
||||
/* Set up the ELinks module interface. */
|
||||
init_erb_module();
|
||||
|
||||
snprintf(elrubyversion, 31, "Ruby %s", ruby_version);
|
||||
module->name = elrubyversion;
|
||||
|
||||
if (xdg_config_home) {
|
||||
path = straconcat(xdg_config_home, RUBY_HOOKS_FILENAME,
|
||||
(char *) NULL);
|
||||
|
@ -11,6 +11,14 @@
|
||||
#include "scripting/ruby/core.h"
|
||||
#include "scripting/ruby/hooks.h"
|
||||
|
||||
static const char *
|
||||
get_name_ruby(struct module *xxx)
|
||||
{
|
||||
static char elrubyversion[32];
|
||||
snprintf(elrubyversion, 31, "Ruby %s", ruby_version);
|
||||
|
||||
return elrubyversion;
|
||||
}
|
||||
|
||||
struct module ruby_scripting_module = struct_module(
|
||||
/* name: */ N_("Ruby"),
|
||||
@ -20,5 +28,5 @@ struct module ruby_scripting_module = struct_module(
|
||||
/* data: */ NULL,
|
||||
/* init: */ init_ruby,
|
||||
/* done: */ NULL,
|
||||
/* getname: */ NULL
|
||||
/* getname: */ get_name_ruby
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user