updates to extended version info

This commit is contained in:
nhmall
2019-11-28 20:20:04 -05:00
parent 8ac2ae3a64
commit 954ffd11d3
+55 -23
View File
@@ -135,14 +135,38 @@ doversion()
int int
doextversion() doextversion()
{ {
#if defined(OPTIONS_AT_RUNTIME) || defined(CROSSCOMPILE_TARGET)
const char *rtbuf;
int rtcontext = 0; int rtcontext = 0;
#else const char *rtbuf;
dlb *f; dlb *f = (dlb *) 0;
#endif
char buf[BUFSZ], *p = 0; char buf[BUFSZ], *p = 0;
winid win = create_nhwindow(NHW_TEXT); winid win = create_nhwindow(NHW_TEXT);
boolean use_dlb = TRUE,
keepgoing = TRUE,
done_rt = FALSE,
done_dlb = FALSE,
prolog;
const char *lua_info[] = {
"About Lua: Copyright (c) 1994-2019 Lua.org, PUC-Rio.",
/* 1 2 3 4 5 6 7
1234567890123456789012345678901234567890123456789012345678901234567890123456789
*/
" \"Permission is hereby granted, free of charge, to any person obtaining",
" a copy of this software and associated documentation files (the ",
" \"Software\"), to deal in the Software without restriction including",
" without limitation the rights to use, copy, modify, merge, publish,",
" distribute, sublicense, and/or sell copies of the Software, and to ",
" permit persons to whom the Software is furnished to do so, subject to",
" the following conditions:",
" The above copyright notice and this permission notice shall be",
" included in all copies or substantial portions of the Software.\"",
(const char *) 0
};
#if defined(OPTIONS_AT_RUNTIME) || defined(CROSSCOMPILE_TARGET)
use_dlb = FALSE;
#else
done_rt = TRUE;
#endif
/* instead of using ``display_file(OPTIONS_USED,TRUE)'' we handle /* instead of using ``display_file(OPTIONS_USED,TRUE)'' we handle
the file manually so we can include dynamic version info */ the file manually so we can include dynamic version info */
@@ -161,15 +185,15 @@ doextversion()
putstr(win, 0, p); putstr(win, 0, p);
} }
#if defined(OPTIONS_AT_RUNTIME) || defined(CROSSCOMPILE_TARGET) if (use_dlb) {
#else
f = dlb_fopen(OPTIONS_USED, "r"); f = dlb_fopen(OPTIONS_USED, "r");
if (!f) { if (!f) {
putstr(win, 0, ""); putstr(win, 0, "");
Sprintf(buf, "[Configuration '%s' not available?]", OPTIONS_USED); Sprintf(buf, "[Configuration '%s' not available?]", OPTIONS_USED);
putstr(win, 0, buf); putstr(win, 0, buf);
} else { done_dlb = TRUE;
#endif }
}
/* /*
* already inserted above: * already inserted above:
* + outdented program name and version plus build date and time * + outdented program name and version plus build date and time
@@ -189,17 +213,31 @@ doextversion()
* - blank-line * - blank-line
* - EOF * - EOF
*/ */
boolean prolog = TRUE; /* to skip indented program name */
#if defined(OPTIONS_AT_RUNTIME) || defined(CROSSCOMPILE_TARGET) prolog = TRUE; /* to skip indented program name */
while ((rtbuf = do_runtime_info(&rtcontext))) { while (keepgoing) {
if (use_dlb && !done_dlb) {
if (!dlb_fgets(buf, BUFSZ, f)) {
done_dlb = TRUE;
continue;
}
} else if (!done_rt) {
if (!(rtbuf = do_runtime_info(&rtcontext))) {
done_rt = TRUE;
continue;
} else {
if ((int) strlen(rtbuf) >= (BUFSZ - 1)) if ((int) strlen(rtbuf) >= (BUFSZ - 1))
continue; continue;
Strcpy(buf, rtbuf); Strcpy(buf, rtbuf);
#else }
while (dlb_fgets(buf, BUFSZ, f)) { } else {
(void) strip_newline(buf); if (!(rtbuf = lua_info[rtcontext++])) {
#endif keepgoing = FALSE;
break;
} else {
Strcpy(buf, rtbuf);
}
}
if (index(buf, '\t') != 0) if (index(buf, '\t') != 0)
(void) tabexpand(buf); (void) tabexpand(buf);
@@ -219,16 +257,10 @@ doextversion()
if (*buf) if (*buf)
putstr(win, 0, buf); putstr(win, 0, buf);
} }
#if defined(OPTIONS_AT_RUNTIME) || defined(CROSSCOMPILE_TARGET) if (use_dlb)
#else
(void) dlb_fclose(f); (void) dlb_fclose(f);
#endif
display_nhwindow(win, FALSE); display_nhwindow(win, FALSE);
destroy_nhwindow(win); destroy_nhwindow(win);
#if defined(OPTIONS_AT_RUNTIME) || defined(CROSSCOMPILE_TARGET)
#else
}
#endif
return 0; return 0;
} }