Skip to content

Commit fcca280

Browse files
committed
syndicatfx: Separate function for log setup
1 parent ceecf66 commit fcca280

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

src/main.c

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,41 @@ run_intro (int argc, char **argv)
100100
system(intro_cmdline);
101101
}
102102

103+
static TbBool setup_log(void)
104+
{
105+
const char *rel_kind;
106+
107+
# ifdef DEBUG
108+
rel_kind = "debug";
109+
# else
110+
rel_kind = "standard";
111+
# endif
112+
113+
#if !defined(PACKAGE_NAME)
114+
# error PACKAGE_NAME is not defined, config.h needs to be included
115+
#endif
116+
117+
printf(PACKAGE_NAME" ver "VERSION" (%s release)\n"
118+
"Web site: https://github.com/swfans/syndwarsfx/\n",
119+
rel_kind);
120+
121+
122+
if (LbErrorLogSetup(NULL, NULL, Lb_ERROR_LOG_NEW) != Lb_SUCCESS) {
123+
printf("Execution log setup failed\n");
124+
return false;
125+
}
126+
127+
LbSyncLog("Application: "PACKAGE" ver "VERSION" (%s release)\n", rel_kind);
128+
129+
return true;
130+
}
131+
132+
static void reset_log(void)
133+
{
134+
LbSyncLog("Application: "PACKAGE" ver "VERSION" closing\n");
135+
LbErrorLogReset();
136+
}
137+
103138
static void
104139
print_help (const char *argv0)
105140
{
@@ -252,8 +287,7 @@ int main (int argc, char **argv)
252287
cheats_speedup = 0;
253288
cheats_mission = 0;
254289

255-
if (LbErrorLogSetup(NULL, NULL, Lb_ERROR_LOG_NEW) != Lb_SUCCESS)
256-
printf("Execution log setup failed\n");
290+
setup_log();
257291

258292
process_options(&argc, &argv);
259293

@@ -325,7 +359,7 @@ int main (int argc, char **argv)
325359
#endif
326360

327361
display_free_vga_buffer();
328-
LbErrorLogReset();
362+
reset_log();
329363
LbMemoryReset();
330364
game_quit();
331365

0 commit comments

Comments
 (0)