Skip to content

Commit

Permalink
Control + N support #159
Browse files Browse the repository at this point in the history
  • Loading branch information
double-fault authored and srifqi committed Jan 18, 2017
1 parent fc546c1 commit d200c8e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bin/boneshell/boneshell.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ struct cmd_opt_t* cmd_boneshell_opts[] =

int __found = 0;
volatile bool exit_set__shell = false;
volatile bool new_set__shell = false;
volatile bool tab_multiple_opts = false;
volatile bool tab_one_opt = false;
volatile bool tab_zero_opt = false;
volatile bool exit_shell = false;
bool executed_internally=false;

void removeSpaces(char* source)
Expand Down Expand Up @@ -120,7 +120,7 @@ void loop_terminal()
scank (true, true, "%s", cmd_active.value + (strlen (cmd_active.value)));
}

if(strcmp(cmd_active.value, "exit")==0 || exit_set__shell == true)
if(strcmp(cmd_active.value, "exit") == 0 || exit_set__shell == true)
//if (exit_set__shell == true)
{
shell_instance_cnt--;
Expand All @@ -130,6 +130,13 @@ void loop_terminal()
goto end_shell;
}

if (new_set__shell == true)
{
new_set__shell = false;
loop_terminal();
goto start_shell;
}

for(int i=0; cmds[i]; i++)
{
if(termcmp(cmds[i]->name, cmd_active.value)==0)
Expand Down
1 change: 1 addition & 0 deletions include/bin/boneshell/boneshell.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <unistd/unistd.h>

extern volatile bool new_set__shell;
extern struct cmd_t cmd_boneshell;
extern volatile bool exit_shell;

Expand Down
8 changes: 8 additions & 0 deletions platform/pc/drv/ps2/kbd/kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ void key_handler_util(int key)
key_handler();
kbd_info.key = ' ';
return;
}
else if (key == 'n' || key == 'N')
{
new_set__shell = true;
kbd_info.key = KBD_ENTER_PRESS_ID;
key_handler();
kbd_info.key = ' ';
return;
}
}

Expand Down

0 comments on commit d200c8e

Please sign in to comment.