SCP: Expose version information in environment variables
This commit is contained in:
parent
c60c151b4e
commit
e994a4aeda
1 changed files with 14 additions and 1 deletions
15
scp.c
15
scp.c
|
@ -5639,17 +5639,28 @@ fprintf (st, "%s", sprint_capac (dptr, uptr));
|
|||
t_stat show_version (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr)
|
||||
{
|
||||
int32 vmaj = SIM_MAJOR, vmin = SIM_MINOR, vpat = SIM_PATCH, vdelt = SIM_DELTA;
|
||||
char vmaj_s[12], vmin_s[12], vpat_s[12], vdelt_s[12];
|
||||
const char *cpp = "";
|
||||
const char *build = "";
|
||||
const char *arch = "";
|
||||
|
||||
if (cptr && (*cptr != 0))
|
||||
return SCPE_2MARG;
|
||||
sprintf (vmaj_s, "%d", vmaj);
|
||||
setenv ("SIM_MAJOR", vmaj_s, 1);
|
||||
sprintf (vmin_s, "%d", vmin);
|
||||
setenv ("SIM_MINOR", vmin_s, 1);
|
||||
sprintf (vpat_s, "%d", vpat);
|
||||
setenv ("SIM_PATCH", vpat_s, 1);
|
||||
fprintf (st, "%s simulator V%d.%d-%d", sim_name, vmaj, vmin, vpat);
|
||||
if (vdelt)
|
||||
if (vdelt) {
|
||||
sprintf (vdelt_s, "%d", vdelt);
|
||||
setenv ("SIM_DELTA", vdelt_s, 1);
|
||||
fprintf (st, " delta %d", vdelt);
|
||||
}
|
||||
#if defined (SIM_VERSION_MODE)
|
||||
fprintf (st, " %s", SIM_VERSION_MODE);
|
||||
setenv ("SIM_VERSION_MODE", SIM_VERSION_MODE, 1);
|
||||
#endif
|
||||
if (flag) {
|
||||
t_bool idle_capable;
|
||||
|
@ -5819,7 +5830,9 @@ if (flag) {
|
|||
#define S_xstr(a) S_str(a)
|
||||
#define S_str(a) #a
|
||||
fprintf (st, "%sgit commit id: %8.8s", flag ? "\n " : " ", S_xstr(SIM_GIT_COMMIT_ID));
|
||||
setenv ("SIM_GIT_COMMIT_ID", S_xstr(SIM_GIT_COMMIT_ID), 1);
|
||||
#if defined(SIM_GIT_COMMIT_TIME)
|
||||
setenv ("SIM_GIT_COMMIT_TIME", S_xstr(SIM_GIT_COMMIT_TIME), 1);
|
||||
if (flag)
|
||||
fprintf (st, "%sgit commit time: %s", "\n ", S_xstr(SIM_GIT_COMMIT_TIME));
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue