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
e9a2e9ff
Commit
e9a2e9ff
authored
24 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Changed sbbs_t::fnopen to straight c and moved it from main.cpp to misc.c.
parent
27283cd4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sbbs3/misc.c
+40
-0
40 additions, 0 deletions
src/sbbs3/misc.c
src/sbbs3/sbbs.h
+1
-1
1 addition, 1 deletion
src/sbbs3/sbbs.h
with
41 additions
and
1 deletion
src/sbbs3/misc.c
+
40
−
0
View file @
e9a2e9ff
...
...
@@ -58,6 +58,46 @@ int nopen(char *str, int access)
mswait
(
55
);
return
(
file
);
}
/****************************************************************************/
/* This function performs an nopen, but returns a file stream with a buffer */
/* allocated. */
/****************************************************************************/
FILE
*
fnopen
(
int
*
fd
,
char
*
str
,
int
access
)
{
char
mode
[
128
];
int
file
;
FILE
*
stream
;
if
((
file
=
nopen
(
str
,
access
))
==-
1
)
return
(
NULL
);
if
(
fd
!=
NULL
)
*
fd
=
file
;
if
(
access
&
O_APPEND
)
{
if
(
access
&
O_RDONLY
)
strcpy
(
mode
,
"a+"
);
else
strcpy
(
mode
,
"a"
);
}
else
if
(
access
&
O_CREAT
)
{
if
(
access
&
O_TRUNC
)
strcpy
(
mode
,
"w"
);
else
strcpy
(
mode
,
"w+"
);
}
else
{
if
(
access
&
O_WRONLY
||
(
access
&
O_RDWR
)
==
O_RDWR
)
strcpy
(
mode
,
"r+"
);
else
strcpy
(
mode
,
"r"
);
}
stream
=
fdopen
(
file
,
mode
);
if
(
stream
==
NULL
)
{
close
(
file
);
return
(
NULL
);
}
setvbuf
(
stream
,
NULL
,
_IOFBF
,
FNOPEN_BUF_SIZE
);
return
(
stream
);
}
/****************************************************************************/
/* Returns the number of characters in 'str' not counting ctrl-ax codes */
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/sbbs.h
+
1
−
1
View file @
e9a2e9ff
...
...
@@ -492,7 +492,6 @@ public:
/* misc.cpp */
int
nopen
(
char
*
str
,
int
access
);
FILE
*
fnopen
(
int
*
file
,
char
*
str
,
int
access
);
void
errormsg
(
int
line
,
char
*
file
,
char
action
,
char
*
object
,
ulong
access
,
char
*
extinfo
=
NULL
);
int
mv
(
char
*
src
,
char
*
dest
,
char
copy
);
/* fast file move/copy function */
...
...
@@ -726,6 +725,7 @@ extern "C" {
/* misc.c */
int
nopen
(
char
*
str
,
int
access
);
FILE
*
fnopen
(
int
*
file
,
char
*
str
,
int
access
);
int
bstrlen
(
char
*
str
);
void
strip_ctrl
(
char
*
str
);
void
strip_exascii
(
char
*
str
);
...
...
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