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
28a7c47c
Commit
28a7c47c
authored
11 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Clean up the help functions per Coverity by checking the return values of
f*().
parent
78468dd3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/uifc/uifc32.c
+50
-41
50 additions, 41 deletions
src/uifc/uifc32.c
src/uifc/uifcx.c
+36
-22
36 additions, 22 deletions
src/uifc/uifcx.c
with
86 additions
and
63 deletions
src/uifc/uifc32.c
+
50
−
41
View file @
28a7c47c
...
...
@@ -2702,13 +2702,10 @@ static void help(void)
_setcursortype
(
_NOCURSOR
);
if
(
api
->
helpbuf
!=
NULL
)
strcpy
(
hbuf
,
api
->
helpbuf
);
else
{
if
((
fp
=
fopen
(
api
->
helpixbfile
,
"rb"
))
==
NULL
)
{
sprintf
(
hbuf
,
"
\2
ERROR
\2
Cannot open help index:
\r\n
%s"
if
(
!
api
->
helpbuf
)
{
if
((
fp
=
fopen
(
api
->
helpixbfile
,
"rb"
))
==
NULL
)
sprintf
(
hbuf
,
"ERROR: Cannot open help index: %s"
,
api
->
helpixbfile
);
}
else
{
p
=
strrchr
(
helpfile
,
'/'
);
if
(
p
==
NULL
)
...
...
@@ -2719,33 +2716,45 @@ static void help(void)
p
++
;
l
=-
1L
;
while
(
!
feof
(
fp
))
{
if
(
!
fread
(
str
,
12
,
1
,
fp
))
if
(
fread
(
str
,
12
,
1
,
fp
)
!=
1
)
break
;
str
[
12
]
=
0
;
fread
(
&
line
,
sizeof
(
line
)
,
1
,
fp
);
if
(
fread
(
&
line
,
2
,
1
,
fp
)
!=
1
)
;
if
(
stricmp
(
str
,
p
)
||
line
!=
helpline
)
{
fseek
(
fp
,
sizeof
(
l
),
SEEK_CUR
);
if
(
fseek
(
fp
,
4
,
SEEK_CUR
)
==
0
)
break
;
continue
;
}
fread
(
&
l
,
sizeof
(
l
),
1
,
fp
);
if
(
fread
(
&
l
,
4
,
1
,
fp
)
!=
1
)
l
=-
1L
;
break
;
}
fclose
(
fp
);
if
(
l
==-
1L
)
sprintf
(
hbuf
,
"
\2
ERROR
\2
Cannot locate help key (%s:%u) in:
\r\n
"
"
%s"
,
p
,
helpline
,
api
->
helpixbfile
);
sprintf
(
hbuf
,
"ERROR
:
Cannot locate help key (%s:%u) in:
%s
"
,
p
,
helpline
,
api
->
helpixbfile
);
else
{
if
((
fp
=
fopen
(
api
->
helpdatfile
,
"rb"
))
==
NULL
)
sprintf
(
hbuf
,
"
\2
ERROR
\2
Cannot open help file:
\r\n
%s"
sprintf
(
hbuf
,
"ERROR
:
Cannot open help file: %s"
,
api
->
helpdatfile
);
else
{
fseek
(
fp
,
l
,
SEEK_SET
)
;
fread
(
hbuf
,
HELPBUF_SIZE
,
1
,
fp
);
fclose
(
fp
);
if
(
fseek
(
fp
,
l
,
SEEK_SET
)
!=
0
)
{
sprintf
(
hbuf
,
"ERROR: Cannot seek to help key (%s:%u) at %ld in: %s"
,
p
,
helpline
,
l
,
api
->
helpixbfile
);
}
else
{
if
(
fread
(
hbuf
,
1
,
HELPBUF_SIZE
,
fp
)
<
1
)
{
sprintf
(
hbuf
,
"ERROR: Cannot read help key (%s:%u) at %ld in: %s"
,
p
,
helpline
,
l
,
api
->
helpixbfile
);
}
}
fclose
(
fp
);
}
}
}
showbuf
(
WIN_MID
|
WIN_HLP
,
0
,
0
,
76
,
api
->
scrn_len
,
"Online Help"
,
hbuf
,
NULL
,
NULL
);
}
else
{
showbuf
(
WIN_MID
|
WIN_HLP
,
0
,
0
,
76
,
api
->
scrn_len
,
"Online Help"
,
api
->
helpbuf
,
NULL
,
NULL
);
}
}
This diff is collapsed.
Click to expand it.
src/uifc/uifcx.c
+
36
−
22
View file @
28a7c47c
...
...
@@ -411,15 +411,19 @@ void help()
p
++
;
l
=-
1L
;
while
(
!
feof
(
fp
))
{
if
(
!
fread
(
str
,
12
,
1
,
fp
))
if
(
fread
(
str
,
12
,
1
,
fp
)
!=
1
)
break
;
str
[
12
]
=
0
;
fread
(
&
line
,
2
,
1
,
fp
);
if
(
fread
(
&
line
,
2
,
1
,
fp
)
!=
1
)
;
if
(
stricmp
(
str
,
p
)
||
line
!=
helpline
)
{
fseek
(
fp
,
4
,
SEEK_CUR
);
continue
;
}
fread
(
&
l
,
4
,
1
,
fp
);
break
;
}
if
(
fseek
(
fp
,
4
,
SEEK_CUR
)
==
0
)
break
;
continue
;
}
if
(
fread
(
&
l
,
4
,
1
,
fp
)
!=
1
)
l
=-
1L
;
break
;
}
fclose
(
fp
);
if
(
l
==-
1L
)
sprintf
(
hbuf
,
"ERROR: Cannot locate help key (%s:%u) in: %s"
...
...
@@ -429,21 +433,31 @@ void help()
sprintf
(
hbuf
,
"ERROR: Cannot open help file: %s"
,
api
->
helpdatfile
);
else
{
fseek
(
fp
,
l
,
SEEK_SET
)
;
fread
(
hbuf
,
HELPBUF_SIZE
,
1
,
fp
);
fclose
(
fp
);
if
(
fseek
(
fp
,
l
,
SEEK_SET
)
!=
0
)
{
sprintf
(
hbuf
,
"ERROR: Cannot seek to help key (%s:%u) at %ld in: %s"
,
p
,
helpline
,
l
,
api
->
helpixbfile
);
}
else
{
if
(
fread
(
hbuf
,
1
,
HELPBUF_SIZE
,
fp
)
<
1
)
{
sprintf
(
hbuf
,
"ERROR: Cannot read help key (%s:%u) at %ld in: %s"
,
p
,
helpline
,
l
,
api
->
helpixbfile
);
}
}
fclose
(
fp
);
}
}
}
else
strcpy
(
hbuf
,
api
->
helpbuf
);
uputs
(
hbuf
);
if
(
strlen
(
hbuf
)
>
200
)
{
printf
(
"Hit enter"
);
getstr
(
str
,
sizeof
(
str
)
-
1
);
}
}
else
{
uputs
(
api
->
helpbuf
);
if
(
strlen
(
api
->
helpbuf
)
>
200
)
{
printf
(
"Hit enter"
);
getstr
(
str
,
sizeof
(
str
)
-
1
);
}
}
}
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