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
ccf2879c
Commit
ccf2879c
authored
20 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Truncate all white-space chars off end of imported messages - allows for better
"empty netmail" detection and dupe-message detection.
parent
df42f5c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/sbbsecho.c
+11
-50
11 additions, 50 deletions
src/sbbs3/sbbsecho.c
with
11 additions
and
50 deletions
src/sbbs3/sbbsecho.c
+
11
−
50
View file @
ccf2879c
...
@@ -2209,8 +2209,6 @@ static short fmsgzone(char* p)
...
@@ -2209,8 +2209,6 @@ static short fmsgzone(char* p)
return
(
val
);
return
(
val
);
}
}
#if 1
/* Old way */
char
*
getfmsg
(
FILE
*
stream
,
ulong
*
outlen
)
char
*
getfmsg
(
FILE
*
stream
,
ulong
*
outlen
)
{
{
uchar
*
fbuf
;
uchar
*
fbuf
;
...
@@ -2221,69 +2219,32 @@ char* getfmsg(FILE *stream, ulong *outlen)
...
@@ -2221,69 +2219,32 @@ char* getfmsg(FILE *stream, ulong *outlen)
start
=
ftell
(
stream
);
/* Beginning of Message */
start
=
ftell
(
stream
);
/* Beginning of Message */
while
(
1
)
{
while
(
1
)
{
ch
=
fgetc
(
stream
);
/* Look for Terminating NULL */
ch
=
fgetc
(
stream
);
/* Look for Terminating NULL */
if
(
!
ch
||
ch
==
EOF
)
/* Found end of message */
if
(
ch
==
0
||
ch
==
EOF
)
/* Found end of message */
break
;
break
;
length
++
;
}
/* Increment the Length */
length
++
;
/* Increment the Length */
}
if
((
fbuf
=
(
char
*
)
malloc
(
length
+
1
))
==
NULL
)
{
if
((
fbuf
=
(
char
*
)
malloc
(
length
+
1
))
==
NULL
)
{
printf
(
"Unable to allocate %lu bytes for message.
\n
"
,
length
+
1
);
printf
(
"Unable to allocate %lu bytes for message.
\n
"
,
length
+
1
);
logprintf
(
"ERROR line %d allocating %lu bytes of memory"
,
__LINE__
,
length
+
1
);
logprintf
(
"ERROR line %d allocating %lu bytes of memory"
,
__LINE__
,
length
+
1
);
bail
(
1
);
}
bail
(
1
);
}
fseek
(
stream
,
start
,
SEEK_SET
);
fseek
(
stream
,
start
,
SEEK_SET
);
for
(
l
=
0
;
l
<
length
;
l
++
)
for
(
l
=
0
;
l
<
length
;
l
++
)
fbuf
[
l
]
=
fgetc
(
stream
);
fbuf
[
l
]
=
fgetc
(
stream
);
fbuf
[
length
]
=
0
;
if
(
ch
==
0
)
if
(
!
ch
)
fgetc
(
stream
);
/* Read NULL */
fgetc
(
stream
);
/* Read NULL */
if
(
outlen
)
*
outlen
=
length
;
return
(
fbuf
);
}
#else
while
(
length
&&
fbuf
[
length
-
1
]
<=
' '
)
/* truncate white-space */
length
--
;
#define FBUF_BLOCK 4096
fbuf
[
length
]
=
0
;
char
*
getfmsg
(
FILE
*
stream
)
{
uchar
*
fbuf
,
*
p
;
ulong
l
,
n
,
length
,
start
;
length
=
0L
;
start
=
ftell
(
stream
);
/* Beginning of Message */
if
((
fbuf
=
malloc
(
FBUF_BLOCK
))
==
NULL
)
return
(
fbuf
);
while
(
!
feof
(
stream
))
{
l
=
fread
(
fbuf
+
length
,
1
,
FBUF_BLOCK
,
stream
);
if
(
l
<
1
)
break
;
*
(
fbuf
+
length
+
l
)
=
0
;
n
=
strlen
(
fbuf
+
length
);
if
(
n
<
l
)
{
length
+=
(
n
+
1
);
break
;
}
printf
(
","
);
length
+=
l
;
if
(
l
<
FBUF_BLOCK
)
break
;
printf
(
"<"
);
if
((
p
=
REALLOC
(
fbuf
,
length
+
FBUF_BLOCK
+
1
))
==
NULL
)
{
free
(
fbuf
);
printf
(
"!"
);
fseek
(
stream
,
-
l
,
SEEK_CUR
);
return
(
NULL
);
}
fbuf
=
p
;
printf
(
">"
);
}
printf
(
"."
);
fseek
(
stream
,
start
+
length
,
SEEK_SET
);
if
(
outlen
)
*
outlen
=
length
;
return
(
fbuf
);
return
(
fbuf
);
}
}
#endif
#define MAX_TAILLEN 1024
#define MAX_TAILLEN 1024
/****************************************************************************/
/****************************************************************************/
...
...
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