Skip to content

Commit

Permalink
Merge pull request #2751 from heeplr/ini-banner
Browse files Browse the repository at this point in the history
better ini-banner also for shcom
  • Loading branch information
andypugh authored Nov 21, 2023
2 parents bf719c8 + f818fc8 commit 83de850
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/src/config/ini-config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Do _not_ use a file extension of '.ini' for included files.
[[sub:ini:sec:emc]]
=== [EMC] Section(((INI File,Sections,[EMC] Section)))

* `VERSION = 1.1` - The version number for the configuration.
* `VERSION = 1.1` - The format version of this configuration.
Any value other than 1.1 will cause the configuration checker to run and try to update the configuration to the new style joint axes type of configuration.
* `MACHINE = My Controller` - This is the name of the controller, which is printed out at the top of most graphical interfaces.
You can put whatever you want here as long as you make it a single line long.
Expand Down
5 changes: 2 additions & 3 deletions src/emc/task/emcsvr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ static int iniLoad(const char *filename)
}
}

strncpy(version, "unknown", LINELEN-1);
if (NULL != (inistring = inifile.Find("VERSION", "EMC"))) {
if(sscanf(inistring, "$Revision: %s", version) != 1) {
strncpy(version, "unknown", LINELEN-1);
}
strncpy(version, inistring, LINELEN-1);
}

if (NULL != (inistring = inifile.Find("MACHINE", "EMC"))) {
Expand Down
6 changes: 2 additions & 4 deletions src/emc/task/emctaskmain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3111,11 +3111,9 @@ static int iniLoad(const char *filename)
}
}


strncpy(version, "unknown", LINELEN-1);
if (NULL != (inistring = inifile.Find("VERSION", "EMC"))) {
if(sscanf(inistring, "$Revision: %s", version) != 1) {
strncpy(version, "unknown", LINELEN-1);
}
strncpy(version, inistring, LINELEN-1);
}

if (NULL != (inistring = inifile.Find("MACHINE", "EMC"))) {
Expand Down
6 changes: 3 additions & 3 deletions src/emc/usr_intf/halui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1433,12 +1433,12 @@ static int iniLoad(const char *filename)
}
}

strncpy(version, "unknown", LINELEN-1);
if (NULL != (inistring = inifile.Find("VERSION", "EMC"))) {
if(sscanf(inistring, "$Revision: %s", version) != 1) {
strncpy(version, "unknown", LINELEN-1);
}
strncpy(version, inistring, LINELEN-1);
}


if (NULL != (inistring = inifile.Find("MACHINE", "EMC"))) {
strncpy(machine, inistring, LINELEN-1);
} else {
Expand Down
13 changes: 9 additions & 4 deletions src/emc/usr_intf/shcom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1262,18 +1262,23 @@ int iniLoad(const char *filename)
}
}

strncpy(version, "unknown", LINELEN-1);
if (NULL != (inistring = inifile.Find("VERSION", "EMC"))) {
if(sscanf(inistring, "$Revision: %s", version) != 1) {
strncpy(version, "unknown", LINELEN-1);
}
strncpy(version, inistring, LINELEN-1);
}


if (NULL != (inistring = inifile.Find("MACHINE", "EMC"))) {
strncpy(machine, inistring, LINELEN-1);
} else {
strncpy(machine, "unknown", LINELEN-1);
}
rcs_print("task: machine: '%s' version '%s'\n", machine, version);

extern char *program_invocation_short_name;
rcs_print(
"%s (%d) shcom: machine '%s' version '%s'\n",
program_invocation_short_name, getpid(), machine, version
);

if (NULL != (inistring = inifile.Find("NML_FILE", "EMC"))) {
// copy to global
Expand Down

0 comments on commit 83de850

Please sign in to comment.