Skip to content

Commit

Permalink
task and user_intf: make debug messages require debug flag
Browse files Browse the repository at this point in the history
  • Loading branch information
snowgoer540 committed Feb 8, 2025
1 parent 78654f1 commit de88a59
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 41 deletions.
24 changes: 13 additions & 11 deletions src/emc/task/emcsvr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,19 @@ static int iniLoad(const char *filename)
}
}

inistring = inifile.Find("VERSION", "EMC");
strncpy(version, inistring.value_or("unknown"), LINELEN-1);

inistring = inifile.Find("MACHINE", "EMC");
strncpy(machine, inistring.value_or("unknown"), LINELEN-1);

extern char *program_invocation_short_name;
rcs_print(
"%s (%d) emcsvr: machine '%s' version '%s'\n",
program_invocation_short_name, getpid(), machine, version
);
if (emc_debug & EMC_DEBUG_CONFIG) {
inistring = inifile.Find("VERSION", "EMC");
strncpy(version, inistring.value_or("unknown"), LINELEN-1);

inistring = inifile.Find("MACHINE", "EMC");
strncpy(machine, inistring.value_or("unknown"), LINELEN-1);

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

if ((inistring = inifile.Find("NML_FILE", "EMC"))) {
// copy to global
Expand Down
22 changes: 12 additions & 10 deletions src/emc/task/emctaskmain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3163,16 +3163,18 @@ static int iniLoad(const char *filename)
}
}

inistring = inifile.Find("VERSION", "EMC");
rtapi_strlcpy(version, inistring.value_or("unknown"), LINELEN-1);

inistring = inifile.Find("MACHINE", "EMC");
rtapi_strlcpy(machine, inistring.value_or("unknown"), LINELEN-1);
extern char *program_invocation_short_name;
rcs_print(
"%s (%d) task: machine '%s' version '%s'\n",
program_invocation_short_name, getpid(), machine, version
);
if (emc_debug & EMC_DEBUG_CONFIG) {
inistring = inifile.Find("VERSION", "EMC");
rtapi_strlcpy(version, inistring.value_or("unknown"), LINELEN-1);

inistring = inifile.Find("MACHINE", "EMC");
rtapi_strlcpy(machine, inistring.value_or("unknown"), LINELEN-1);
extern char *program_invocation_short_name;
rcs_print(
"%s (%d) task: machine '%s' version '%s'\n",
program_invocation_short_name, getpid(), machine, version
);
}

if ((inistring = inifile.Find("NML_FILE", "EMC"))) {
// copy to global
Expand Down
21 changes: 11 additions & 10 deletions src/emc/usr_intf/halui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1452,19 +1452,20 @@ static int iniLoad(const char *filename)
strncpy(version, *inistring, LINELEN-1);
}

if (emc_debug & EMC_DEBUG_CONFIG) {
if ((inistring = inifile.Find("MACHINE", "EMC"))) {
strncpy(machine, *inistring, LINELEN-1);
} else {
strncpy(machine, "unknown", LINELEN-1);
}

if ((inistring = inifile.Find("MACHINE", "EMC"))) {
strncpy(machine, *inistring, LINELEN-1);
} else {
strncpy(machine, "unknown", LINELEN-1);
extern char *program_invocation_short_name;
rcs_print(
"%s (%d) halui: machine '%s' version '%s'\n",
program_invocation_short_name, getpid(), machine, version
);
}

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

if ((inistring = inifile.Find("NML_FILE", "EMC"))) {
// copy to global
rtapi_strxcpy(emc_nmlfile, *inistring);
Expand Down
21 changes: 11 additions & 10 deletions src/emc/usr_intf/shcom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1324,19 +1324,20 @@ int iniLoad(const char *filename)
strncpy(version, *inistring, LINELEN-1);
}

if (emc_debug & EMC_DEBUG_CONFIG) {
if ((inistring = inifile.Find("MACHINE", "EMC"))) {
strncpy(machine, *inistring, LINELEN-1);
} else {
strncpy(machine, "unknown", LINELEN-1);
}

if ((inistring = inifile.Find("MACHINE", "EMC"))) {
strncpy(machine, *inistring, LINELEN-1);
} else {
strncpy(machine, "unknown", LINELEN-1);
extern char *program_invocation_short_name;
rcs_print(
"%s (%d) shcom: machine '%s' version '%s'\n",
program_invocation_short_name, getpid(), 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 ((inistring = inifile.Find("NML_FILE", "EMC"))) {

// copy to global
Expand Down

0 comments on commit de88a59

Please sign in to comment.