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
a15e0fa0
Commit
a15e0fa0
authored
22 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Now starts up web server.
parent
60c47c23
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/sbbscon.c
+77
-2
77 additions, 2 deletions
src/sbbs3/sbbscon.c
with
77 additions
and
2 deletions
src/sbbs3/sbbscon.c
+
77
−
2
View file @
a15e0fa0
...
@@ -82,6 +82,10 @@ BOOL run_services=TRUE;
...
@@ -82,6 +82,10 @@ BOOL run_services=TRUE;
BOOL
services_running
=
FALSE
;
BOOL
services_running
=
FALSE
;
BOOL
services_stopped
=
FALSE
;
BOOL
services_stopped
=
FALSE
;
services_startup_t
services_startup
;
services_startup_t
services_startup
;
BOOL
run_web
=
TRUE
;
BOOL
web_running
=
FALSE
;
BOOL
web_stopped
=
FALSE
;
web_startup_t
web_startup
;
uint
thread_count
=
1
;
uint
thread_count
=
1
;
uint
socket_count
=
0
;
uint
socket_count
=
0
;
uint
client_count
=
0
;
uint
client_count
=
0
;
...
@@ -607,6 +611,60 @@ static int event_lputs(char *str)
...
@@ -607,6 +611,60 @@ static int event_lputs(char *str)
return
(
strlen
(
logline
)
+
1
);
return
(
strlen
(
logline
)
+
1
);
}
}
/****************************************************************************/
/* web local/log print routine */
/****************************************************************************/
static
int
web_lputs
(
char
*
str
)
{
char
logline
[
512
];
char
tstr
[
64
];
time_t
t
;
struct
tm
*
tm_p
;
#ifdef __unix__
if
(
is_daemon
)
{
if
(
str
==
NULL
)
return
(
0
);
if
(
std_facilities
)
syslog
(
LOG_INFO
|
LOG_DAEMON
,
"%s"
,
str
);
else
syslog
(
LOG_INFO
,
"srvc %s"
,
str
);
return
(
strlen
(
str
));
}
#endif
t
=
time
(
NULL
);
tm_p
=
localtime
(
&
t
);
if
(
tm_p
==
NULL
)
tstr
[
0
]
=
0
;
else
sprintf
(
tstr
,
"%d/%d %02d:%02d:%02d "
,
tm_p
->
tm_mon
+
1
,
tm_p
->
tm_mday
,
tm_p
->
tm_hour
,
tm_p
->
tm_min
,
tm_p
->
tm_sec
);
sprintf
(
logline
,
"%shttp %.*s"
,
tstr
,(
int
)
sizeof
(
logline
)
-
32
,
str
);
truncsp
(
logline
);
lputs
(
logline
);
return
(
strlen
(
logline
)
+
1
);
}
static
void
web_started
(
void
)
{
web_running
=
TRUE
;
web_stopped
=
FALSE
;
#ifdef _THREAD_SUID_BROKEN
do_seteuid
(
FALSE
);
do_setuid
();
#endif
}
static
void
web_terminated
(
int
code
)
{
web_running
=
FALSE
;
web_stopped
=
TRUE
;
}
#ifdef __unix__
#ifdef __unix__
...
@@ -619,7 +677,7 @@ void _sighandler_quit(int sig)
...
@@ -619,7 +677,7 @@ void _sighandler_quit(int sig)
#ifdef JAVASCRIPT
#ifdef JAVASCRIPT
services_terminate
();
services_terminate
();
#endif
#endif
while
(
bbs_running
||
ftp_running
||
mail_running
||
services_running
)
while
(
bbs_running
||
ftp_running
||
web_running
||
mail_running
||
services_running
)
mswait
(
1
);
mswait
(
1
);
if
(
is_daemon
)
if
(
is_daemon
)
unlink
(
SBBS_PID_FILE
);
unlink
(
SBBS_PID_FILE
);
...
@@ -709,6 +767,19 @@ int main(int argc, char** argv)
...
@@ -709,6 +767,19 @@ int main(int argc, char** argv)
strcpy
(
ftp_startup
.
index_file_name
,
"00index"
);
strcpy
(
ftp_startup
.
index_file_name
,
"00index"
);
strcpy
(
ftp_startup
.
ctrl_dir
,
ctrl_dir
);
strcpy
(
ftp_startup
.
ctrl_dir
,
ctrl_dir
);
/* Initialize Web Server startup structure */
memset
(
&
web_startup
,
0
,
sizeof
(
web_startup
));
web_startup
.
size
=
sizeof
(
web_startup
);
web_startup
.
lputs
=
web_lputs
;
web_startup
.
started
=
web_started
;
web_startup
.
terminated
=
web_terminated
;
web_startup
.
thread_up
=
thread_up
;
web_startup
.
socket_open
=
socket_open
;
#ifdef __unix__
web_startup
.
seteuid
=
do_seteuid
;
#endif
strcpy
(
web_startup
.
ctrl_dir
,
ctrl_dir
);
/* Initialize Mail Server startup structure */
/* Initialize Mail Server startup structure */
memset
(
&
mail_startup
,
0
,
sizeof
(
mail_startup
));
memset
(
&
mail_startup
,
0
,
sizeof
(
mail_startup
));
mail_startup
.
size
=
sizeof
(
mail_startup
);
mail_startup
.
size
=
sizeof
(
mail_startup
);
...
@@ -787,6 +858,7 @@ int main(int argc, char** argv)
...
@@ -787,6 +858,7 @@ int main(int argc, char** argv)
sbbs_read_ini
(
fp
,
sbbs_read_ini
(
fp
,
&
run_bbs
,
&
bbs_startup
,
&
run_bbs
,
&
bbs_startup
,
&
run_ftp
,
&
ftp_startup
,
&
run_ftp
,
&
ftp_startup
,
&
run_web
,
&
web_startup
,
&
run_mail
,
&
mail_startup
,
&
run_mail
,
&
mail_startup
,
&
run_services
,
&
services_startup
);
&
run_services
,
&
services_startup
);
...
@@ -1173,6 +1245,8 @@ int main(int argc, char** argv)
...
@@ -1173,6 +1245,8 @@ int main(int argc, char** argv)
if
(
run_services
)
if
(
run_services
)
_beginthread
((
void
(
*
)(
void
*
))
services_thread
,
0
,
&
services_startup
);
_beginthread
((
void
(
*
)(
void
*
))
services_thread
,
0
,
&
services_startup
);
#endif
#endif
if
(
run_web
)
_beginthread
((
void
(
*
)(
void
*
))
web_server
,
0
,
&
web_startup
);
#ifdef __unix__
#ifdef __unix__
// Set up QUIT-type signals so they clean up properly.
// Set up QUIT-type signals so they clean up properly.
...
@@ -1195,6 +1269,7 @@ int main(int argc, char** argv)
...
@@ -1195,6 +1269,7 @@ int main(int argc, char** argv)
while
(
!
bbs_stopped
&&
!
ftp_stopped
&&
!
mail_stopped
&&
!
services_stopped
while
(
!
bbs_stopped
&&
!
ftp_stopped
&&
!
mail_stopped
&&
!
services_stopped
&&
((
run_bbs
&&
!
bbs_running
)
&&
((
run_bbs
&&
!
bbs_running
)
||
(
run_ftp
&&
!
ftp_running
)
||
(
run_ftp
&&
!
ftp_running
)
||
(
web_ftp
&&
!
web_running
)
||
(
run_mail
&&
!
mail_running
)
||
(
run_mail
&&
!
mail_running
)
||
(
run_services
&&
!
services_running
)))
||
(
run_services
&&
!
services_running
)))
mswait
(
1
);
mswait
(
1
);
...
@@ -1288,7 +1363,7 @@ int main(int argc, char** argv)
...
@@ -1288,7 +1363,7 @@ int main(int argc, char** argv)
services_terminate
();
services_terminate
();
#endif
#endif
while
(
bbs_running
||
ftp_running
||
mail_running
||
services_running
)
while
(
bbs_running
||
ftp_running
||
web_running
||
mail_running
||
services_running
)
SLEEP
(
1
);
SLEEP
(
1
);
/* erase the prompt */
/* erase the prompt */
...
...
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