Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
summeros
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
Byron Lathi
summeros
Commits
c0229ed9
Commit
c0229ed9
authored
3 years ago
by
Byron Lathi
Browse files
Options
Downloads
Patches
Plain Diff
add a null character when stopped early
parent
fd4d7595
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kernel/Devices/terminal.c
+13
-1
13 additions, 1 deletion
kernel/Devices/terminal.c
with
13 additions
and
1 deletion
kernel/Devices/terminal.c
+
13
−
1
View file @
c0229ed9
#include
<types.h>
#include
<lib.h>
#include
<Devices/keyboard.h>
#include
"terminal.h"
int32_t
terminal_read
(
int32_t
fd
,
void
*
buf
,
int32_t
nbytes
){
return
-
1
;
int
bytes_read
=
0
;
while
(
bytes_read
<
nbytes
)
{
uint8_t
key
=
keyboard_get_key
();
if
(
key
==
'\n'
)
{
*
((
uint8_t
*
)
buf
+
bytes_read
)
=
'\0'
;
break
;
}
*
((
uint8_t
*
)
buf
+
bytes_read
)
=
key
;
bytes_read
++
;
}
return
0
;
}
int32_t
terminal_write
(
int32_t
fd
,
const
void
*
buf
,
int32_t
nbytes
)
...
...
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