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
0c0469a0
Commit
0c0469a0
authored
21 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
inkey() now support additional (optional) timeout value.
parent
8effc6ac
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/js_console.cpp
+20
-13
20 additions, 13 deletions
src/sbbs3/js_console.cpp
with
20 additions
and
13 deletions
src/sbbs3/js_console.cpp
+
20
−
13
View file @
0c0469a0
...
...
@@ -252,16 +252,19 @@ static JSBool
js_inkey
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
{
char
key
[
2
];
long
mode
=
0
;
int32
mode
=
0
;
int32
timeout
=
0
;
sbbs_t
*
sbbs
;
JSString
*
js_str
;
if
((
sbbs
=
(
sbbs_t
*
)
JS_GetContextPrivate
(
cx
))
==
NULL
)
return
(
JS_FALSE
);
if
(
argc
&&
JSVAL_IS_INT
(
argv
[
0
]))
mode
=
JSVAL_TO_INT
(
argv
[
0
]);
key
[
0
]
=
sbbs
->
inkey
(
mode
);
if
(
argc
)
JS_ValueToInt32
(
cx
,
argv
[
0
],
&
mode
);
if
(
argc
>
1
)
JS_ValueToInt32
(
cx
,
argv
[
1
],
&
timeout
);
key
[
0
]
=
sbbs
->
inkey
(
mode
,
timeout
);
key
[
1
]
=
0
;
if
((
js_str
=
JS_NewStringCopyZ
(
cx
,
key
))
==
NULL
)
...
...
@@ -275,15 +278,15 @@ static JSBool
js_getkey
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
{
char
key
[
2
];
long
mode
=
0
;
int32
mode
=
0
;
sbbs_t
*
sbbs
;
JSString
*
js_str
;
if
((
sbbs
=
(
sbbs_t
*
)
JS_GetContextPrivate
(
cx
))
==
NULL
)
return
(
JS_FALSE
);
if
(
argc
&&
JSVAL_IS_INT
(
argv
[
0
])
)
mode
=
JSVAL_TO_INT
(
argv
[
0
]);
if
(
argc
)
JS_ValueToInt32
(
cx
,
argv
[
0
]
,
&
mode
);
key
[
0
]
=
sbbs
->
getkey
(
mode
);
key
[
1
]
=
0
;
...
...
@@ -1047,20 +1050,24 @@ js_telnet_cmd(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
static
jsMethodSpec
js_console_functions
[]
=
{
{
"inkey"
,
js_inkey
,
0
,
JSTYPE_STRING
,
JSDOCSTR
(
"[number mode]"
)
,
JSDOCSTR
(
"get a single key, no wait"
)
{
"inkey"
,
js_inkey
,
0
,
JSTYPE_STRING
,
JSDOCSTR
(
"[number mode] [,number timeout]"
)
,
JSDOCSTR
(
"get a single key with optional <i>timeout</i> in milliseconds (defaults to 0, for no wait), "
"see <tt>K_*</tt> in <tt>sbbsdefs.js</tt> for <i>mode</i> bits"
)
},
{
"getkey"
,
js_getkey
,
0
,
JSTYPE_STRING
,
JSDOCSTR
(
"[number mode]"
)
,
JSDOCSTR
(
"get a single key, with wait"
)
,
JSDOCSTR
(
"get a single key, with wait, "
"see <tt>K_*</tt> in <tt>sbbsdefs.js</tt> for <i>mode</i> bits"
)
},
{
"getstr"
,
js_getstr
,
0
,
JSTYPE_STRING
,
JSDOCSTR
(
"[string][,maxlen][,mode]"
)
,
JSDOCSTR
(
"get a string"
)
,
JSDOCSTR
(
"get a text string from the user, "
"see <tt>K_*</tt> in <tt>sbbsdefs.js</tt> for <i>mode</i> bits"
)
},
{
"getnum"
,
js_getnum
,
0
,
JSTYPE_NUMBER
,
JSDOCSTR
(
"[maxnum]"
)
,
JSDOCSTR
(
"get a number"
)
,
JSDOCSTR
(
"get a number
between 1 and <i>maxnum</i> from the user
"
)
},
{
"getkeys"
,
js_getkeys
,
1
,
JSTYPE_NUMBER
,
JSDOCSTR
(
"string keys [,maxnum]"
)
,
JSDOCSTR
(
"get one of a list of keys"
)
,
JSDOCSTR
(
"get one key from of a list of valid command <i>keys</i>, "
"or a number between 1 and <i>maxnum</i>"
)
},
{
"gettemplate"
,
js_gettemplate
,
1
,
JSTYPE_STRING
,
JSDOCSTR
(
"format [,string] [,mode]"
)
,
JSDOCSTR
(
"get a string based on template"
)
...
...
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