Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
8a23ff0b
Commit
8a23ff0b
authored
5 years ago
by
James R.
Browse files
Options
Downloads
Patches
Plain Diff
Handle log file in parent properly
parent
553ad46c
No related branches found
No related tags found
2 merge requests
!734
Rebase Keycodes only branch.
,
!530
Handle signals correctly on linux
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/doomdef.h
+1
-0
1 addition, 0 deletions
src/doomdef.h
src/sdl/i_main.c
+7
-5
7 additions, 5 deletions
src/sdl/i_main.c
src/sdl/i_system.c
+14
-1
14 additions, 1 deletion
src/sdl/i_system.c
with
22 additions
and
6 deletions
src/doomdef.h
+
1
−
0
View file @
8a23ff0b
...
@@ -127,6 +127,7 @@
...
@@ -127,6 +127,7 @@
#ifdef LOGMESSAGES
#ifdef LOGMESSAGES
extern
FILE
*
logstream
;
extern
FILE
*
logstream
;
extern
char
logfilename
[
1024
];
#endif
#endif
//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
...
...
This diff is collapsed.
Click to expand it.
src/sdl/i_main.c
+
7
−
5
View file @
8a23ff0b
...
@@ -47,6 +47,7 @@ extern int SDL_main(int argc, char *argv[]);
...
@@ -47,6 +47,7 @@ extern int SDL_main(int argc, char *argv[]);
#ifdef LOGMESSAGES
#ifdef LOGMESSAGES
FILE
*
logstream
=
NULL
;
FILE
*
logstream
=
NULL
;
char
logfilename
[
1024
];
#endif
#endif
#ifndef DOXYGEN
#ifndef DOXYGEN
...
@@ -116,7 +117,6 @@ int main(int argc, char **argv)
...
@@ -116,7 +117,6 @@ int main(int argc, char **argv)
#endif
#endif
{
{
const
char
*
logdir
=
NULL
;
const
char
*
logdir
=
NULL
;
char
logfile
[
MAX_WADPATH
];
myargc
=
argc
;
myargc
=
argc
;
myargv
=
argv
;
/// \todo pull out path to exe from this string
myargv
=
argv
;
/// \todo pull out path to exe from this string
...
@@ -141,7 +141,7 @@ int main(int argc, char **argv)
...
@@ -141,7 +141,7 @@ int main(int argc, char **argv)
timeinfo
=
localtime
(
&
my_time
);
timeinfo
=
localtime
(
&
my_time
);
strftime
(
buf
,
26
,
"%Y-%m-%d %H-%M-%S"
,
timeinfo
);
strftime
(
buf
,
26
,
"%Y-%m-%d %H-%M-%S"
,
timeinfo
);
strcpy
(
logfile
,
va
(
"log-%s.txt"
,
buf
));
strcpy
(
logfile
name
,
va
(
"log-%s.txt"
,
buf
));
#ifdef DEFAULTDIR
#ifdef DEFAULTDIR
if
(
logdir
)
if
(
logdir
)
...
@@ -149,14 +149,16 @@ int main(int argc, char **argv)
...
@@ -149,14 +149,16 @@ int main(int argc, char **argv)
// Create dirs here because D_SRB2Main() is too late.
// Create dirs here because D_SRB2Main() is too late.
I_mkdir
(
va
(
"%s%s"
DEFAULTDIR
,
logdir
,
PATHSEP
),
0755
);
I_mkdir
(
va
(
"%s%s"
DEFAULTDIR
,
logdir
,
PATHSEP
),
0755
);
I_mkdir
(
va
(
"%s%s"
DEFAULTDIR
"%slogs"
,
logdir
,
PATHSEP
,
PATHSEP
),
0755
);
I_mkdir
(
va
(
"%s%s"
DEFAULTDIR
"%slogs"
,
logdir
,
PATHSEP
,
PATHSEP
),
0755
);
logstream
=
fopen
(
va
(
"%s%s"
DEFAULTDIR
"%slogs%s%s"
,
logdir
,
PATHSEP
,
PATHSEP
,
PATHSEP
,
logfile
),
"wt"
);
strcpy
(
logfilename
,
va
(
"%s%s"
DEFAULTDIR
"%slogs%s%s"
,
logdir
,
PATHSEP
,
PATHSEP
,
PATHSEP
,
logfile
name
)
);
}
}
else
else
#endif
#endif
{
{
I_mkdir
(
"."
PATHSEP
"logs"
PATHSEP
,
0755
);
I_mkdir
(
"."
PATHSEP
"logs"
PATHSEP
,
0755
);
logstream
=
fopen
(
va
(
"."
PATHSEP
"logs"
PATHSEP
"%s"
,
logfile
),
"wt"
);
strcpy
(
logfilename
,
va
(
"."
PATHSEP
"logs"
PATHSEP
"%s"
,
logfile
name
)
);
}
}
logstream
=
fopen
(
logfilename
,
"wt"
);
}
}
#endif
#endif
...
@@ -187,7 +189,7 @@ int main(int argc, char **argv)
...
@@ -187,7 +189,7 @@ int main(int argc, char **argv)
D_SRB2Main
();
D_SRB2Main
();
#ifdef LOGMESSAGES
#ifdef LOGMESSAGES
if
(
!
M_CheckParm
(
"-nolog"
))
if
(
!
M_CheckParm
(
"-nolog"
))
CONS_Printf
(
"Logfile: %s
\n
"
,
logfile
);
CONS_Printf
(
"Logfile: %s
\n
"
,
logfile
name
);
#endif
#endif
CONS_Printf
(
"Entering main game loop...
\n
"
);
CONS_Printf
(
"Entering main game loop...
\n
"
);
// never return
// never return
...
...
This diff is collapsed.
Click to expand it.
src/sdl/i_system.c
+
14
−
1
View file @
8a23ff0b
...
@@ -2192,6 +2192,7 @@ static void I_Fork(void)
...
@@ -2192,6 +2192,7 @@ static void I_Fork(void)
int
child
;
int
child
;
int
status
;
int
status
;
int
signum
;
int
signum
;
int
c
;
child
=
fork
();
child
=
fork
();
...
@@ -2203,7 +2204,19 @@ static void I_Fork(void)
...
@@ -2203,7 +2204,19 @@ static void I_Fork(void)
case
0
:
case
0
:
break
;
break
;
default:
default:
if
(
wait
(
&
status
)
==
-
1
)
if
(
logstream
)
fclose
(
logstream
);
/* the child has this */
c
=
wait
(
&
status
);
#ifdef LOGMESSAGES
/* By the way, exit closes files. */
logstream
=
fopen
(
logfilename
,
"at"
);
#else
logstream
=
0
;
#endif
if
(
c
==
-
1
)
{
{
kill
(
child
,
SIGKILL
);
kill
(
child
,
SIGKILL
);
newsignalhandler_Warn
(
"wait()"
);
newsignalhandler_Warn
(
"wait()"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment