Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wrapper for wtoPrintf3 #99

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ struct {

} zl_context = {.config = {.debug_mode = false}, .userid = "(NONE)"} ;

// Wrapper for wtoPrintf3
static void printf_wto(const char *formatString, ...) {
va_list argPointer;
va_start(argPointer, formatString);
wtoPrintf3(formatString, argPointer);
va_end(argPointer);
}

static void set_sys_messages(ConfigManager *configmgr) {
Json *env;
int cfgGetStatus = cfgGetAnyC(configmgr, ZOWE_CONFIG_NAME, &env, 2, "zowe", "sysMessages");
Expand Down Expand Up @@ -220,7 +228,7 @@ static void check_for_and_print_sys_message(const char* fmt, ...) {
for (int i = 0; i < count; i++) {
const char *sys_message_id = jsonArrayGetString(zl_context.sys_messages, i);
if (sys_message_id && strstr(input_string, sys_message_id)) {
wtoPrintf3(input_string); // Print our match to the syslog
printf_wto(input_string); // Print our match to the syslog
break;
}
}
Expand Down Expand Up @@ -1619,15 +1627,15 @@ int main(int argc, char **argv) {
}

INFO(MSG_LAUNCHER_START);
wtoPrintf3(MSG_LAUNCHER_START); // Manual sys log print (messages not set here yet)
printf_wto(MSG_LAUNCHER_START); // Manual sys log print (messages not set here yet)

zl_config_t config = read_config(argc, argv);
zl_context.config = config;

LoggingContext *logContext = makeLoggingContext();
if (!logContext) {
ERROR(MSG_NO_LOG_CONTEXT);
wtoPrintf3(MSG_NO_LOG_CONTEXT); // Manual sys log print (messages not set here yet)
printf_wto(MSG_NO_LOG_CONTEXT); // Manual sys log print (messages not set here yet)
exit(EXIT_FAILURE);
}
logConfigureStandardDestinations(logContext);
Expand All @@ -1638,7 +1646,7 @@ int main(int argc, char **argv) {
cfgSetTraceLevel(configmgr, zl_context.config.debug_mode ? 2 : 0);
if (init_context(argc, argv, &config, configmgr)) {
ERROR(MSG_CTX_INIT_FAILED);
wtoPrintf3(MSG_CTX_INIT_FAILED); // Manual sys log print (messages not set here yet)
printf_wto(MSG_CTX_INIT_FAILED); // Manual sys log print (messages not set here yet)
exit(EXIT_FAILURE);
}

Expand All @@ -1650,13 +1658,13 @@ int main(int argc, char **argv) {

if (cfgLoadConfiguration(configmgr, ZOWE_CONFIG_NAME) != 0){
ERROR(MSG_CFG_LOAD_FAIL);
wtoPrintf3(MSG_CFG_LOAD_FAIL); // Manual sys log print (messages not set here yet)
printf_wto(MSG_CFG_LOAD_FAIL); // Manual sys log print (messages not set here yet)
exit(EXIT_FAILURE);
}

if (setup_signal_handlers()) {
ERROR(MSG_SIGNAL_ERR);
wtoPrintf3(MSG_SIGNAL_ERR); // Manual sys log print (messages not set here yet)
printf_wto(MSG_SIGNAL_ERR); // Manual sys log print (messages not set here yet)
exit(EXIT_FAILURE);
}

Expand Down
Loading