Changeset 73878c1 in mainline


Ignore:
Timestamp:
2009-06-03T19:30:19Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cbff4c2
Parents:
36b8100a
Message:

bdsh: sync with I/O changes, block until spawned task exits

Location:
uspace/app/bdsh
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/kcon/kcon.c

    r36b8100a r73878c1  
    3131#include <stdio.h>
    3232#include <stdlib.h>
    33 #include <console.h>
     33#include <io/console.h>
    3434#include "config.h"
    3535#include "util.h"
     
    6666        }
    6767
    68         console_kcon_enable();
     68        console_kcon_enable(fphone(stdout));
    6969
    7070        return CMD_SUCCESS;
  • uspace/app/bdsh/exec.c

    r36b8100a r73878c1  
    124124                cli_error(CL_EEXEC, "Cannot spawn `%s'.", cmd);
    125125                return 1;
    126         } else {
    127                 return 0;
    128126        }
     127       
     128        task_wait(tid);
     129        return 0;
    129130}
  • uspace/app/bdsh/input.c

    r36b8100a r73878c1  
    3333#include <stdlib.h>
    3434#include <string.h>
    35 #include <io/stream.h>
    36 #include <console.h>
    37 #include <kbd/kbd.h>
    38 #include <kbd/keycode.h>
     35#include <io/console.h>
     36#include <io/keycode.h>
     37#include <io/style.h>
    3938#include <errno.h>
    4039#include <bool.h>
     
    101100static void read_line(char *buffer, int n)
    102101{
    103         kbd_event_t ev;
     102        console_event_t ev;
    104103        size_t offs, otmp;
    105104        wchar_t dec;
     
    108107        while (true) {
    109108                fflush(stdout);
    110                 if (kbd_get_event(&ev) < 0)
     109                if (!console_get_event(fphone(stdin), &ev))
    111110                        return;
    112                 if (ev.type == KE_RELEASE)
     111               
     112                if (ev.type != KEY_PRESS)
    113113                        continue;
    114 
     114               
    115115                if (ev.key == KC_ENTER || ev.key == KC_NENTER)
    116116                        break;
     
    132132                }
    133133                if (ev.c >= ' ') {
    134                         //putchar(ev.c);
    135134                        if (chr_encode(ev.c, buffer, &offs, n - 1) == EOK)
    136                                 console_putchar(ev.c);
     135                                putchar(ev.c);
    137136                }
    138137        }
     
    148147        char line[INPUT_MAX];
    149148
    150         console_set_style(STYLE_EMPHASIS);
     149        console_set_style(fphone(stdout), STYLE_EMPHASIS);
    151150        printf("%s", usr->prompt);
    152         console_set_style(STYLE_NORMAL);
     151        console_set_style(fphone(stdout), STYLE_NORMAL);
    153152
    154153        read_line(line, INPUT_MAX);
Note: See TracChangeset for help on using the changeset viewer.