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
6f84fb87
Commit
6f84fb87
authored
16 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Support 0xe0 (enhanced keyboard) doorway codes on input.
Add support for the abort key.
parent
16e2739d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/conio/ansi_cio.c
+32
-2
32 additions, 2 deletions
src/conio/ansi_cio.c
src/conio/ciolib.c
+14
-7
14 additions, 7 deletions
src/conio/ciolib.c
with
46 additions
and
9 deletions
src/conio/ansi_cio.c
+
32
−
2
View file @
6f84fb87
...
@@ -664,7 +664,37 @@ static void ansi_keyparse(void *par)
...
@@ -664,7 +664,37 @@ static void ansi_keyparse(void *par)
sem_wait
(
&
got_key
);
sem_wait
(
&
got_key
);
ch
=
ansi_raw_inch
;
ch
=
ansi_raw_inch
;
if
(
gotnull
)
{
if
(
ch
==-
2
)
{
ansi_inch
=
0x0100
;
sem_post
(
&
got_input
);
/* Two-byte code, need to post twice times and wait for one to
be received */
sem_wait
(
&
used_input
);
sem_wait
(
&
goahead
);
sem_post
(
&
got_input
);
sem_wait
(
&
used_input
);
}
if
(
gotnull
==
2
)
{
// 0xe0 enhanced keyboard key... translate to 0x00 key for now.
ansi_inch
=
ch
<<
8
;
// (ch<<8)|0xe0;
sem_post
(
&
got_input
);
/* Two-byte code, need to post twice times and wait for one to
be received */
sem_wait
(
&
used_input
);
sem_wait
(
&
goahead
);
sem_post
(
&
got_input
);
sem_wait
(
&
used_input
);
gotnull
=
0
;
continue
;
}
if
(
gotnull
==
1
)
{
if
(
ch
==
0xe0
)
{
gotnull
=
2
;
// Need another key... keep looping.
sem_post
(
&
goahead
);
continue
;
}
ansi_inch
=
ch
<<
8
;
ansi_inch
=
ch
<<
8
;
sem_post
(
&
got_input
);
sem_post
(
&
got_input
);
/* Two-byte code, need to post twice and wait for one to
/* Two-byte code, need to post twice and wait for one to
...
@@ -781,7 +811,7 @@ static void ansi_keythread(void *params)
...
@@ -781,7 +811,7 @@ static void ansi_keythread(void *params)
sem_getvalue
(
&
got_key
,
&
sval
);
sem_getvalue
(
&
got_key
,
&
sval
);
if
(
!
sval
)
{
if
(
!
sval
)
{
ansi_raw_inch
=
ciolib_ansi_readbyte_cb
();
ansi_raw_inch
=
ciolib_ansi_readbyte_cb
();
if
(
ansi_raw_inch
>=
0
)
if
(
ansi_raw_inch
>=
0
||
ansi_raw_inch
==-
2
)
sem_post
(
&
got_key
);
sem_post
(
&
got_key
);
else
else
SLEEP
(
1
);
SLEEP
(
1
);
...
...
This diff is collapsed.
Click to expand it.
src/conio/ciolib.c
+
14
−
7
View file @
6f84fb87
...
@@ -404,12 +404,13 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_getche(void)
...
@@ -404,12 +404,13 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_getche(void)
else
{
else
{
while
(
1
)
{
while
(
1
)
{
ch
=
ciolib_getch
();
ch
=
ciolib_getch
();
if
(
ch
)
{
if
(
ch
!=
0
&&
ch
!=
0xe0
)
{
ciolib_putch
(
ch
);
ciolib_putch
(
ch
);
return
(
ch
);
return
(
ch
);
}
}
/* Eat extended chars */
/* Eat extended chars - except ESC which is an abort */
ciolib_getch
();
if
(
ciolib_getch
()
==
1
)
return
(
EOF
);
}
}
}
}
}
}
...
@@ -466,8 +467,10 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_cgets(char *str)
...
@@ -466,8 +467,10 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_cgets(char *str)
maxlen
=*
(
unsigned
char
*
)
str
;
maxlen
=*
(
unsigned
char
*
)
str
;
while
((
ch
=
ciolib_getch
())
!=
'\n'
&&
ch
!=
'\r'
)
{
while
((
ch
=
ciolib_getch
())
!=
'\n'
&&
ch
!=
'\r'
)
{
switch
(
ch
)
{
switch
(
ch
)
{
case
0
:
/* Skip extended keys */
case
0
:
/* Skip extended keys */
ciolib_getche
();
case
0xe0
:
/* Skip extended keys */
if
(
ciolib_getche
()
==
1
)
goto
early_return
;
break
;
break
;
case
'\r'
:
/* Skip \r (ToDo: Should this be treated as a \n? */
case
'\r'
:
/* Skip \r (ToDo: Should this be treated as a \n? */
break
;
break
;
...
@@ -492,6 +495,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_cgets(char *str)
...
@@ -492,6 +495,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_cgets(char *str)
break
;
break
;
}
}
}
}
early_return
;
str
[
len
+
2
]
=
0
;
str
[
len
+
2
]
=
0
;
*
((
unsigned
char
*
)(
str
+
1
))
=
(
unsigned
char
)
len
;
*
((
unsigned
char
*
)(
str
+
1
))
=
(
unsigned
char
)
len
;
ciolib_putch
(
'\r'
);
ciolib_putch
(
'\r'
);
...
@@ -563,8 +567,10 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_getpass(const char *prompt)
...
@@ -563,8 +567,10 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_getpass(const char *prompt)
ciolib_cputs
((
char
*
)
prompt
);
ciolib_cputs
((
char
*
)
prompt
);
while
((
ch
=
ciolib_getch
())
!=
'\n'
)
{
while
((
ch
=
ciolib_getch
())
!=
'\n'
)
{
switch
(
ch
)
{
switch
(
ch
)
{
case
0
:
/* Skip extended keys */
case
0
:
/* Skip extended keys */
ciolib_getch
();
case
0xe0
:
/* Skip extended keys */
if
(
ciolib_getch
()
==
1
)
goto
early_return
;
break
;
break
;
case
'\r'
:
/* Skip \r (ToDo: Should this be treeated as a \n? */
case
'\r'
:
/* Skip \r (ToDo: Should this be treeated as a \n? */
break
;
break
;
...
@@ -583,6 +589,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_getpass(const char *prompt)
...
@@ -583,6 +589,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_getpass(const char *prompt)
break
;
break
;
}
}
}
}
early_return:
pass
[
len
]
=
0
;
pass
[
len
]
=
0
;
return
(
pass
);
return
(
pass
);
}
}
...
...
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