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
4b438dd6
Commit
4b438dd6
authored
9 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Set standard input mode to raw.
parent
54533435
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/jsexec.c
+30
-4
30 additions, 4 deletions
src/sbbs3/jsexec.c
with
30 additions
and
4 deletions
src/sbbs3/jsexec.c
+
30
−
4
View file @
4b438dd6
...
...
@@ -42,6 +42,7 @@
#ifdef __unix__
#define _WITH_GETLINE
#include
<signal.h>
#include
<termios.h>
#endif
#include
"sbbs.h"
...
...
@@ -273,6 +274,10 @@ static BOOL winsock_startup(void)
#endif
#ifdef __unix__
struct
termios
orig_term
;
#endif
static
int
do_bail
(
int
code
)
{
#if defined(_WINSOCKAPI_)
...
...
@@ -287,6 +292,10 @@ static int do_bail(int code)
if
(
code
)
fprintf
(
statfp
,
"
\n
Returning error code: %d
\n
"
,
code
);
#ifdef __unix__
if
(
isatty
(
fileno
(
stdin
)))
tcsetattr
(
STDIN_FILENO
,
TCSANOW
,
&
orig_term
);
#endif
return
(
code
);
}
...
...
@@ -1019,6 +1028,14 @@ int parseLogLevel(const char* p)
return
DEFAULT_LOG_LEVEL
;
}
#ifdef __unix__
void
raw_input
(
struct
termios
*
t
)
{
t
->
c_iflag
&=
~
(
IMAXBEL
|
IGNBRK
|
BRKINT
|
PARMRK
|
ISTRIP
|
INLCR
|
IGNCR
|
ICRNL
|
IXON
);
t
->
c_lflag
&=
~
(
ECHO
|
ECHONL
|
ICANON
|
ISIG
|
IEXTEN
);
}
#endif
/*********************/
/* Entry point (duh) */
/*********************/
...
...
@@ -1038,14 +1055,23 @@ int main(int argc, char **argv, char** environ)
confp
=
stdout
;
errfp
=
stderr
;
if
(
isatty
(
fileno
(
stdin
)))
{
#ifdef __unix__
struct
termios
term
;
tcgetattr
(
fileno
(
stdin
),
&
orig_term
);
term
=
orig_term
;
raw_input
(
&
term
);
tcsetattr
(
fileno
(
stdin
),
TCSANOW
,
&
term
);
#endif
statfp
=
stderr
;
}
else
/* if redirected, don't send status messages to stderr */
statfp
=
nulfp
;
if
((
nulfp
=
fopen
(
_PATH_DEVNULL
,
"w+"
))
==
NULL
)
{
perror
(
_PATH_DEVNULL
);
return
(
do_bail
(
-
1
));
}
if
(
isatty
(
fileno
(
stderr
)))
statfp
=
stderr
;
else
/* if redirected, don't send status messages to stderr */
statfp
=
nulfp
;
cb
.
limit
=
JAVASCRIPT_TIME_LIMIT
;
cb
.
yield_interval
=
JAVASCRIPT_YIELD_INTERVAL
;
...
...
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