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
fbd1f2b6
Commit
fbd1f2b6
authored
23 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Ported to Win32 (MSVC++ 6.0).
Better detection of corrupted SBL database entries.
parent
a54295c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xtrn/sbl/sblpack.c
+49
-35
49 additions, 35 deletions
xtrn/sbl/sblpack.c
with
49 additions
and
35 deletions
xtrn/sbl/sblpack.c
+
49
−
35
View file @
fbd1f2b6
...
...
@@ -7,49 +7,63 @@
/***************************************/
#include
<stdio.h>
#include
<stdlib.h>
/* exit() */
#include
<share.h>
#include
<time.h>
#include
<io.h>
#include
<fcntl.h>
#include
<sys/stat.h>
#include
"gen_defs.h"
#include
"xsdkwrap.h"
/* PLATFORM_DESC */
#include
"xsdkdefs.h"
#include
"sbldefs.h"
int
main
(
void
)
{
int
file
;
FILE
*
in
,
*
out
;
bbs_t
bbs
;
printf
(
"
\n
SBLPACK v1.00 Developed 1995-1997 Rob Swindell
\n\n
"
);
if
((
file
=
open
(
"SBL.DAB"
,
O_RDWR
|
O_BINARY
|
O_DENYNONE
|
O_CREAT
,
S_IWRITE
|
S_IREAD
))
==-
1
)
{
printf
(
"
\n\7
Error opening/creating SBL.DAB
\n
"
);
exit
(
1
);
}
if
((
in
=
fdopen
(
file
,
"w+b"
))
==
NULL
)
{
printf
(
"
\n\7
Error converting SBL.DAB file handle to stream
\n
"
);
exit
(
1
);
}
setvbuf
(
in
,
0L
,
_IOFBF
,
2048
);
if
((
out
=
fopen
(
"SBL.TMP"
,
"wb"
))
==
NULL
)
{
printf
(
"
\n\7
Error opening SBL.TMP file
\n
"
);
exit
(
1
);
}
while
(
!
feof
(
in
))
{
if
(
!
fread
(
&
bbs
,
sizeof
(
bbs_t
),
1
,
in
))
break
;
putchar
(
'.'
);
if
(
!
bbs
.
name
[
0
])
continue
;
fwrite
(
&
bbs
,
sizeof
(
bbs_t
),
1
,
out
);
}
fcloseall
();
putchar
(
'\n'
);
if
(
remove
(
"SBL.DAB"
))
{
printf
(
"
\n\7
Data file in use, can't remove.
\n
"
);
remove
(
"SBL.TMP"
);
exit
(
1
);
}
rename
(
"SBL.TMP"
,
"SBL.DAB"
);
printf
(
"
\n
Done.
\n
"
);
return
(
0
);
int
file
;
FILE
*
in
;
FILE
*
out
;
bbs_t
bbs
;
ulong
records
=
0
;
ulong
deleted
=
0
;
printf
(
"
\n
SBLPACK v1.10/%s Developed 1995-2001 Rob Swindell
\n\n
"
,
PLATFORM_DESC
);
if
((
file
=
sopen
(
"sbl.dab"
,
O_RDWR
|
O_BINARY
,
SH_DENYNO
))
==-
1
)
{
printf
(
"
\n\7
Error opening/creating sbl.dab
\n
"
);
exit
(
1
);
}
if
((
in
=
fdopen
(
file
,
"w+b"
))
==
NULL
)
{
printf
(
"
\n\7
Error converting sbl.dab file handle to stream
\n
"
);
exit
(
1
);
}
setvbuf
(
in
,
0L
,
_IOFBF
,
2048
);
if
((
out
=
fopen
(
"sbl.tmp"
,
"wb"
))
==
NULL
)
{
printf
(
"
\n\7
Error opening sbl.tmp file
\n
"
);
exit
(
1
);
}
while
(
!
feof
(
in
))
{
if
(
!
fread
(
&
bbs
,
sizeof
(
bbs_t
),
1
,
in
))
break
;
records
++
;
putchar
(
'.'
);
if
(
bbs
.
name
[
0
]
==
0
||
bbs
.
user
[
0
]
==
0
||
bbs
.
total_numbers
<
1
)
{
deleted
++
;
continue
;
}
fwrite
(
&
bbs
,
sizeof
(
bbs_t
),
1
,
out
);
}
fcloseall
();
putchar
(
'\n'
);
if
(
remove
(
"sbl.dab"
))
{
printf
(
"
\n\7
Data file in use, can't remove.
\n
"
);
remove
(
"sbl.tmp"
);
exit
(
1
);
}
rename
(
"sbl.tmp"
,
"sbl.dab"
);
printf
(
"
\n
Done.
\n
"
);
printf
(
"
\n
%lu records in original file, %lu deleted (packed), new total = %lu.
\n
"
,
records
,
deleted
,
records
-
deleted
);
return
(
0
);
}
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