Browse Source

sh should read from fd 0 (stdin) instead of /dev/keyboard.

Andreas Kling 6 years ago
parent
commit
7a85384e47
1 changed files with 1 additions and 6 deletions
  1. 1 6
      Userland/sh.cpp

+ 1 - 6
Userland/sh.cpp

@@ -159,11 +159,6 @@ int main(int, char**)
     int linedx = 0;
     int linedx = 0;
     linebuf[0] = '\0';
     linebuf[0] = '\0';
 
 
-    int fd = 0; // open("/dev/keyboard", O_RDONLY);
-    if (fd == -1) {
-        printf("failed to open /dev/keyboard :(\n");
-        return 1;
-    }
     {
     {
         char cwdbuf[1024];
         char cwdbuf[1024];
         getcwd(cwdbuf, sizeof(cwdbuf));
         getcwd(cwdbuf, sizeof(cwdbuf));
@@ -172,7 +167,7 @@ int main(int, char**)
     prompt();
     prompt();
     for (;;) {
     for (;;) {
         char keybuf[16];
         char keybuf[16];
-        ssize_t nread = read(fd, keybuf, sizeof(keybuf));
+        ssize_t nread = read(0, keybuf, sizeof(keybuf));
         if (nread < 0) {
         if (nread < 0) {
             printf("failed to read :(\n");
             printf("failed to read :(\n");
             return 2;
             return 2;