Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
42e7d5fb
Commit
42e7d5fb
authored
2 years ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
fwritelog() will now auto-close a log file when it reaches the max size
parent
cff51443
No related branches found
No related tags found
1 merge request
!463
MRC mods by Codefenix (2024-10-20)
Pipeline
#3221
passed
2 years ago
Stage: build
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/sbbs3/ctrl/MainFormUnit.cpp
+1
-1
1 addition, 1 deletion
src/sbbs3/ctrl/MainFormUnit.cpp
src/sbbs3/nopen.c
+8
-2
8 additions, 2 deletions
src/sbbs3/nopen.c
src/sbbs3/nopen.h
+1
-1
1 addition, 1 deletion
src/sbbs3/nopen.h
with
10 additions
and
4 deletions
src/sbbs3/ctrl/MainFormUnit.cpp
+
1
−
1
View file @
42e7d5fb
...
...
@@ -417,7 +417,7 @@ static void event_log_msg(log_msg_t* msg)
if
(
msg
->
repeated
)
Line
+=
" [x"
+
AnsiString
(
msg
->
repeated
+
1
)
+
"]"
;
Line
+=
"
\n
"
;
fwritelog
(
AnsiString
(
Line
).
c_str
(),
Line
.
Length
(),
LogStream
);
fwritelog
(
&
MainForm
->
cfg
,
AnsiString
(
Line
).
c_str
(),
Line
.
Length
(),
&
LogStream
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/nopen.c
+
8
−
2
View file @
42e7d5fb
...
...
@@ -237,9 +237,15 @@ FILE* fopenlog(scfg_t* cfg, const char* path)
return
fp
;
}
size_t
fwritelog
(
void
*
buf
,
size_t
size
,
FILE
*
fp
)
// Write to a log file and may close it if reached max size
size_t
fwritelog
(
scfg_t
*
cfg
,
void
*
buf
,
size_t
size
,
FILE
**
fp
)
{
return
fwrite
(
buf
,
1
,
size
,
fp
);
size_t
result
=
fwrite
(
buf
,
1
,
size
,
*
fp
);
if
(
cfg
->
max_log_size
&&
ftell
(
*
fp
)
>=
(
off_t
)
cfg
->
max_log_size
)
{
fclose
(
*
fp
);
*
fp
=
NULL
;
}
return
result
;
}
void
fcloselog
(
FILE
*
fp
)
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/nopen.h
+
1
−
1
View file @
42e7d5fb
...
...
@@ -37,7 +37,7 @@ BOOL fmutex(const char* fname, const char* text, long max_age);
BOOL
fcompare
(
const
char
*
fn1
,
const
char
*
fn2
);
BOOL
backup
(
const
char
*
org
,
int
backup_level
,
BOOL
ren
);
FILE
*
fopenlog
(
scfg_t
*
,
const
char
*
path
);
size_t
fwritelog
(
void
*
buf
,
size_t
size
,
FILE
*
);
size_t
fwritelog
(
scfg_t
*
,
void
*
buf
,
size_t
size
,
FILE
*
*
);
void
fcloselog
(
FILE
*
);
#ifdef __cplusplus
...
...
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