mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:07:45 +00:00
Implement sys$getcwd properly.
Also fixed broken strcpy that didn't copy the null terminator.
This commit is contained in:
parent
8e640539ef
commit
0f20be05a6
5 changed files with 18 additions and 27 deletions
|
@ -164,7 +164,11 @@ int main(int, char**)
|
|||
printf("failed to open /dev/keyboard :(\n");
|
||||
return 1;
|
||||
}
|
||||
g->cwd = "/";
|
||||
{
|
||||
char cwdbuf[1024];
|
||||
getcwd(cwdbuf, sizeof(cwdbuf));
|
||||
g->cwd = cwdbuf;
|
||||
}
|
||||
prompt();
|
||||
for (;;) {
|
||||
char keybuf[16];
|
||||
|
@ -173,12 +177,6 @@ int main(int, char**)
|
|||
printf("failed to read :(\n");
|
||||
return 2;
|
||||
}
|
||||
if (nread > 2)
|
||||
printf("read %u bytes\n", nread);
|
||||
if (nread > (ssize_t)sizeof(keybuf)) {
|
||||
printf("read() overran the buffer i gave it!\n");
|
||||
return 3;
|
||||
}
|
||||
for (ssize_t i = 0; i < nread; ++i) {
|
||||
putchar(keybuf[i]);
|
||||
if (keybuf[i] != '\n') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue