Skip to content

Commit

Permalink
Added logapp
Browse files Browse the repository at this point in the history
  • Loading branch information
lebarsfa committed Dec 10, 2023
1 parent f179ac4 commit 483a838
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
403
Added logapp.

402
Added regsettowall command.

Expand Down
25 changes: 24 additions & 1 deletion Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
#endif // _MSC_VER
#endif // _WIN32

int UxVCtrl_version = 403;

int main(int argc, char* argv[])
{
int i = 0;
Expand Down Expand Up @@ -215,6 +217,10 @@ int main(int argc, char* argv[])
THREAD_IDENTIFIER MissionArgThreadId;
#endif // !DISABLE_MISSIONARG_THREAD
CHRONO chrono_GNSS;
FILE* logappfile = NULL;
char logappfilename[MAX_BUF_LEN];
char* username = NULL;
char hostname[MAX_BUF_LEN];

INIT_DEBUG;

Expand All @@ -227,9 +233,24 @@ int main(int argc, char* argv[])

srand(GetTickCount());

printf("\nUxVCtrl V402\n");
printf("\nUxVCtrl V%d\n", UxVCtrl_version);
fflush(stdout);

sprintf(logappfilename, LOG_FOLDER"logapp_%.64s.log", strtimeex_fns());
logappfile = fopen(logappfilename, "w");
if (logappfile == NULL)
{
printf("Unable to create log file.\n");
}
else
{
username = getenv("USERNAME");
memset(hostname, 0, sizeof(hostname));
gethostname(hostname, sizeof(hostname));
fprintf(logappfile, "UxVCtrl V%d (%.255s on %.255s)\n", UxVCtrl_version, username, hostname);
fflush(logappfile);
}

// Will launch a mission file if specified as argument.
if (argc == 2) bMissionAtStartup = TRUE;
else if (argc > 2) {
Expand Down Expand Up @@ -712,6 +733,8 @@ int main(int argc, char* argv[])
ReleaseGlobals();
UnloadEnv();

if (logappfile) fclose(logappfile);

if (ExitCode == EXIT_SUCCESS)
{
unlink(LOG_FOLDER"CurLbl.txt");
Expand Down

0 comments on commit 483a838

Please sign in to comment.