1 /* Version information */
16 #include "intl/gettext/libintl.h"
17 #include "main/module.h"
18 #include "main/version.h"
19 #include "terminal/terminal.h"
20 #include "util/error.h"
21 #include "util/memory.h"
22 #include "util/string.h"
27 add_module_to_string(struct string
*string
, struct module
*module
,
28 struct terminal
*term
)
30 struct module
*submodule
;
33 if (module
->name
) add_to_string(string
, _(module
->name
, term
));
35 if (!module
->submodules
) return;
37 add_to_string(string
, " (");
39 foreach_module (submodule
, module
->submodules
, i
) {
40 if (i
> 0) add_to_string(string
, ", ");
41 add_module_to_string(string
, submodule
, term
);
44 add_to_string(string
, ")");
48 add_modules_to_string(struct string
*string
, struct terminal
*term
)
50 struct module
*module
;
51 int i
, last_split
= 0;
52 unsigned char *last_newline
= strrchr(string
->source
, '\n');
55 last_split
= last_newline
- string
->source
;
57 foreach_module (module
, builtin_modules
, i
) {
58 if (i
> 0) add_to_string(string
, ", ");
59 if (string
->length
- last_split
> 70) {
60 add_char_to_string(string
, '\n');
61 last_split
= string
->length
;
63 add_module_to_string(string
, module
, term
);
67 /* @more will add more information especially for info box. */
69 get_dyn_full_version(struct terminal
*term
, int more
)
71 static const unsigned char comma
[] = ", ";
74 if (!init_string(&string
)) return NULL
;
76 add_format_to_string(&string
, "ELinks %s", VERSION_STRING
);
78 add_format_to_string(&string
, " (%s)", build_id
);
80 add_to_string(&string
, "\n");
81 add_format_to_string(&string
, _("Built on %s %s", term
),
82 build_date
, build_time
);
83 add_to_string(&string
, "\n\n");
84 add_to_string(&string
, _("Text WWW browser", term
));
86 add_format_to_string(&string
, _(" (built on %s %s)", term
),
87 build_date
, build_time
);
90 string_concat(&string
,
92 _("Features:", term
), "\n",
99 comma
, _("Fastmem", term
),
101 #ifdef CONFIG_OWN_LIBC
102 comma
, _("Own Libc Routines", term
),
104 #ifndef CONFIG_BACKTRACE
105 comma
, _("No Backtrace", term
),
117 comma
, _("No mouse", term
),
123 add_modules_to_string(&string
, term
);
125 return string
.source
;
128 /* This one is used to prevent usage of straconcat() at backtrace time. */
130 init_static_version(void)
132 unsigned char *s
= get_dyn_full_version((struct terminal
*) NULL
, 0);
135 safe_strncpy(full_static_version
, s
, sizeof(full_static_version
));