Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
double-fault committed Jan 14, 2017
2 parents ba656ec + 59ee6d5 commit 4828471
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 213 deletions.
41 changes: 20 additions & 21 deletions apps/sh/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,30 @@ volatile struct typed_cmd cmd_active;

struct cmd_t *cmds[] =
{
&cmd_clear,
&cmd_boneos_logo,
&cmd_help,
&cmd_sleep,
&cmd_echo,
&cmd_cursor,
&cmd_reboot,
&cmd_poweroff,
&cmd_boneshell,
&cmd_exit,
&cmd_pwd,
&cmd_logname,
&cmd_uname,
&cmd_date
,0
&cmd_clear,
&cmd_boneos_logo,
&cmd_help,
&cmd_sleep,
&cmd_echo,
&cmd_cursor,
&cmd_reboot,
&cmd_poweroff,
&cmd_boneshell,
&cmd_exit,
&cmd_pwd,
&cmd_logname,
&cmd_uname,
&cmd_date,
0
};

void init_terminal()
{
assertkm(device_initalized(KBD_DRIVER_INDEX) , "Keyboard not intalized for starting shell!");
TERMINAL_MODE=true;
//cmds[CMD_BONEOS_LOGO_INDEX]->handler("boneos_logo");
cmds [CMD_CLEAR_INDEX]->handler("clear");
cmds[CMD_BONESHELL_INDEX]->handler("boneshell");
TERMINAL_MODE=false;
assertkm(device_initalized(KBD_DRIVER_INDEX) , "Keyboard not intalized for starting shell!");
TERMINAL_MODE=true;
cmds [CMD_CLEAR_INDEX]->handler("clear");
cmds[CMD_BONESHELL_INDEX]->handler("boneshell");
TERMINAL_MODE=false;
}


Expand Down
40 changes: 31 additions & 9 deletions bin/boneos_logo/boneos_logo.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
** along with BoneOS. If not, see <http://www.gnu.org/licenses/>.
**
** @main_author : Amanuel Bogale
**
**
** @contributors:
** Amanuel Bogale <amanuel2> : start
**/
** Ashish Ahuja <Fortunate-MAN>
**/

#include <stdio/stdio.h>
#include <misc/status_codes.h>
Expand All @@ -29,7 +30,7 @@
#include <boneos_logo/opts/main_boneos_logo.h>
#include <boneos_logo/opts/boneos_logo_color.h>

struct cmd_opt_t* cmd_boneos_logo_opts[] =
struct cmd_opt_t* cmd_boneos_logo_opts[] =
{
&cmd_boneos_logo_opt_color
,0
Expand All @@ -40,23 +41,44 @@ int boneos_logo_handler(char* cmd)
size_t num_opts = get_opt_count(cmd);
if(num_opts == 1)
{
printk("*********** ********** * * ******* ********** *********\n");
/*printk("*********** ********** * * ******* ********** *********\n");
printk("* * * * * * * * * * *\n");
printk("* * * * * * * * * * *\n");
printk("* ******* * * * * * ******* * * *********\n");
printk("* * * * * * * * * * *\n");
printk("* * * * * ** * * * *\n");
printk("*********** ********** * * ******* ********** *********\n");
printk("*********** ********** * * ******* ********** *********\n"); */
printk (
" myooooohhyso++//////////++osyhhoooooym\n"
" myoooooooo//////////////////////ooooooooy\n"
" myooooooooo////////////////////////oooooooooym\n"
" yoooooooooo+////////////////////////+ooooooooooy\n"
"soooooooooo+//////////////////////////+oooooooooos\n"
"hooooooooo+////////////////////////////+oooooooooh\n"
" doooooooo////####//////////////####////ooooooood\n"
" dsooooo////######////////////######////ooooosd\n"
" msooo+/////####////:----:////####/////+ooosm\n"
" ysd////////////:-......-:////////////dsy\n"
" +//////////:..........://////////+\n"
" y/////////-..-:####:-..-/////////y\n"
" /(....)/:-...########...-://(...)\n"
" / /:.....########.....:/ / \n"
" | /......-####-....../ | \n"
" | |..................| |\n"
" | //..................// | \n"
" | | \n"
" | .######++++++++#######. |\n"
" (______) (______)\n");
return STATUS_OK;
}


main_boneos_opt_handler(cmd);

return STATUS_OK;
}

struct cmd_t cmd_boneos_logo =
struct cmd_t cmd_boneos_logo =
{
.name = "boneos_logo",
.usage = "boneos_logo [--help] [-color <fg-color> <bg-color>] [-color --def] [-color <--help>] ",
Expand Down
42 changes: 32 additions & 10 deletions bin/boneos_logo/opts/boneos_logo_color.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
** along with BoneOS. If not, see <http://www.gnu.org/licenses/>.
**
** @main_author : Amanuel Bogale
**
**
** @contributors:
** Amanuel Bogale <amanuel2> : start
**/
**/

#include <stddef.h>
#include <stdint.h>
Expand All @@ -37,29 +37,51 @@ int cmd_boneos_logo_color_handler(char* cmd)
size_t num_opts = get_opt_count(cmd);
str_t opts[num_opts];
get_opt(cmd,opts);

int _FG = strtoi((char*)opts[2].str, 0, 16);
int _BG = strtoi((char*)opts[3].str, 0, 16);
int __STORE_FG = video_drivers[VGA_VIDEO_DRIVER_INDEX]->fg;
int __STORE_BG = video_drivers[VGA_VIDEO_DRIVER_INDEX]->bg;
video_drivers[VGA_VIDEO_DRIVER_INDEX]->fg = _FG;
video_drivers[VGA_VIDEO_DRIVER_INDEX]->bg = _BG;
printk("*********** ********** * * ******* ********** *********\n");

/*printk("*********** ********** * * ******* ********** *********\n");
printk("* * * * * * * * * * *\n");
printk("* * * * * * * * * * *\n");
printk("* ******* * * * * * ******* * * *********\n");
printk("* * * * * * * * * * *\n");
printk("* * * * * ** * * * *\n");
printk("*********** ********** * * ******* ********** *********\n");

printk("*********** ********** * * ******* ********** *********\n");*/
printk ("MMMMMMMMmysyNMMMMMMMMNNNNNNNNMMMMMMMMNysymMMMMMMMM\n"
"MMMMMMmyooooohhyso++//////////++osyhhoooooymMMMMMM\n"
"MMMMmyoooooooo//////////////////////ooooooooymMMMM\n"
"MMmyooooooooo////////////////////////oooooooooymMM\n"
"Nyoooooooooo+////////////////////////+ooooooooooyN"
"soooooooooo+//////////////////////////+oooooooooos\n"
"hooooooooo+////////////////////////////+oooooooooh\n"
"Mdoooooooo////+sso//////////////oss+////oooooooodM\n"
"MMdsooooo////+ddddo////////////odddd+////ooooosdMM\n"
"MMMmsooo+/////shhy////:----:////yhhs/////+ooosmMMM\n"
"MMMMNysd////////////:-......-:////////////dsyNMMMM\n"
"MMMMMMMM+//////////:..........://////////+MMMMMMMM\n"
"MMMMMMMMy/////////-..-:++++:-..-/////////yMMMMMMMM\n"
"MMMMMMMds-..-://:-...yddddddy...-://:-...ohNMMMMMM\n"
"MMMMMN/` `:.....ohddddh+.....:.` `-dMMMMM\n"
"MMMMMh `......-:oo:-......` /MMMMM\n"
"MMMMMM/ ..................`````````-mMMMMM\n"
"MMMMMm.````````````.....`.......```````````.yMMMMM\n"
"MMMMMh``````````````````````````````````````+MMMMM\n"
"MMMMMMy-``````:dNNmyo++++++++oymNNNo.`````.oNMMMMM\n"
"MMMMMMMMmhyydNMMMMMMMMMMMMMMMMMMMMMMNdhyydNMMMMMMM\n"
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n");

video_drivers[VGA_VIDEO_DRIVER_INDEX]->fg = __STORE_FG;
video_drivers[VGA_VIDEO_DRIVER_INDEX]->bg = __STORE_BG;

return STATUS_OK;
}

struct cmd_opt_t cmd_boneos_logo_opt_color =
struct cmd_opt_t cmd_boneos_logo_opt_color =
{
.help = "boneos_logo(1) \t\t\t\t BoneOS Terminal Manual \n"
"NAME : \n "
Expand All @@ -81,7 +103,7 @@ struct cmd_opt_t cmd_boneos_logo_opt_color =
"\t\t 5 = Purple\t D = Light Purple\n "
"\t\t 6 = Yellow\t E = Light Yellow\n "
"\t\t 7 = White \t F = Bright White\n "
"\t\t--def : Clears to default (BG : 0x7 , FG : 0x0)\n ",
"\t\t--def : Clears to default (BG : 0x7 , FG : 0x0)\n ",
.cmd_opt_name = "-color" ,
.handler = &cmd_boneos_logo_color_handler,
.invalid_use_msg = "Invalid Use of -color option. Use command boneos_logo -color --help for\n"
Expand Down
36 changes: 29 additions & 7 deletions bin/boneos_logo/opts/main_boneos_logo.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
** along with BoneOS. If not, see <http://www.gnu.org/licenses/>.
**
** @main_author : Amanuel Bogale
**
**
** @contributors:
** Amanuel Bogale <amanuel2> : start
**/
**/

#include <misc/status_codes.h>
#include <string/string.h>
#include <unistd/unistd.h>
Expand All @@ -37,7 +37,7 @@ int main_boneos_opt_handler(char *cmd)
size_t num_opts = get_opt_count(cmd);
str_t opts[num_opts];
get_opt(cmd,opts);

if(strcmp(opts[1].str, "-color")==0)
{
if(strcmp(opts[2].str, "--help")==0)
Expand All @@ -48,19 +48,41 @@ int main_boneos_opt_handler(char *cmd)
{
video_drivers[VGA_VIDEO_DRIVER_INDEX]->fg = 0x7;
video_drivers[VGA_VIDEO_DRIVER_INDEX]->bg = 0x0;
printk("*********** ********** * * ******* ********** *********\n");
/*printk("*********** ********** * * ******* ********** *********\n");
printk("* * * * * * * * * * *\n");
printk("* * * * * * * * * * *\n");
printk("* ******* * * * * * ******* * * *********\n");
printk("* * * * * * * * * * *\n");
printk("* * * * * ** * * * *\n");
printk("*********** ********** * * ******* ********** *********\n");
printk("*********** ********** * * ******* ********** *********\n");*/
printk ("MMMMMMMMmysyNMMMMMMMMNNNNNNNNMMMMMMMMNysymMMMMMMMM\n"
"MMMMMMmyooooohhyso++//////////++osyhhoooooymMMMMMM\n"
"MMMMmyoooooooo//////////////////////ooooooooymMMMM\n"
"MMmyooooooooo////////////////////////oooooooooymMM\n"
"Nyoooooooooo+////////////////////////+ooooooooooyN"
"soooooooooo+//////////////////////////+oooooooooos\n"
"hooooooooo+////////////////////////////+oooooooooh\n"
"Mdoooooooo////+sso//////////////oss+////oooooooodM\n"
"MMdsooooo////+ddddo////////////odddd+////ooooosdMM\n"
"MMMmsooo+/////shhy////:----:////yhhs/////+ooosmMMM\n"
"MMMMNysd////////////:-......-:////////////dsyNMMMM\n"
"MMMMMMMM+//////////:..........://////////+MMMMMMMM\n"
"MMMMMMMMy/////////-..-:++++:-..-/////////yMMMMMMMM\n"
"MMMMMMMds-..-://:-...yddddddy...-://:-...ohNMMMMMM\n"
"MMMMMN/` `:.....ohddddh+.....:.` `-dMMMMM\n"
"MMMMMh `......-:oo:-......` /MMMMM\n"
"MMMMMM/ ..................`````````-mMMMMM\n"
"MMMMMm.````````````.....`.......```````````.yMMMMM\n"
"MMMMMh``````````````````````````````````````+MMMMM\n"
"MMMMMMy-``````:dNNmyo++++++++oymNNNo.`````.oNMMMMM\n"
"MMMMMMMMmhyydNMMMMMMMMMMMMMMMMMMMMMMNdhyydNMMMMMMM\n"
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n");
}
else if(opts[2].str[0] == '\0' || opts[3].str[0] == '\0')
{
printk(cmd_boneos_logo_opt_color.invalid_use_msg);
}
else
else
{
cmd_boneos_logo_opt_color.handler(cmd);
}
Expand Down
18 changes: 9 additions & 9 deletions bin/boneshell/boneshell.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,16 @@ int boneshell_handler(char* cmd)
else if(num_opts==1)
loop_terminal();
else
printk(cmd_boneshell.invalid_use_msg);
printk(cmd_boneshell.invalid_use_msg);

return STATUS_OK;
}

struct cmd_t cmd_boneshell =
{
.name = "boneshell",
.usage = "boneshell [--help] ",
.help = "boneshell(1) \t\t\t\t BoneOS Terminal Manual \n"
.name = "boneshell",
.usage = "boneshell [--help] ",
.help = "boneshell(1) \t\t\t\t BoneOS Terminal Manual \n"
"NAME : \n "
"\tboneshell\n"
"SYNOPSIS : \n "
Expand All @@ -176,11 +176,11 @@ struct cmd_t cmd_boneshell =
"\tthe child of the previous parent shell process.\n "
"\tcommand exit used to stop this child shell process.\n "
"\ttype exit --help for more on exit command\n ",
.cmd_opts = cmd_boneshell_opts,
.handler = &boneshell_handler,
.invalid_use_msg = "Invalid use of boneshell command.\n"
"Type in boneshell --help for more help.\n",
.privilege = USER
.cmd_opts = cmd_boneshell_opts,
.handler = &boneshell_handler,
.invalid_use_msg = "Invalid use of boneshell command.\n"
"Type in boneshell --help for more help.\n",
.privilege = USER
};


Expand Down
32 changes: 15 additions & 17 deletions include/apps/sh/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,35 @@
#include <stdbool.h>

typedef enum
{
ROOT,
USER
{
ROOT,
USER
}exec_prv;

struct cmd_opt_t
{
char* help;
char* cmd_opt_name;
char* invalid_use_msg;
int(*handler)(char* cmd);
char* help;
char* cmd_opt_name;
char* invalid_use_msg;
int(*handler)(char* cmd);
};

struct cmd_t
{
char* name;
char* usage;
char* help;
char* invalid_use_msg;
exec_prv privilege;
struct cmd_opt_t** cmd_opts;
int(*handler)(char* cmd);
char* name;
char* usage;
char* help;
char* invalid_use_msg;
exec_prv privilege;
struct cmd_opt_t** cmd_opts;
int(*handler)(char* cmd);
};

struct typed_cmd
{
char* value;
char* value;
};



#define CMD_CLEAR_INDEX 0
#define CMD_BONEOS_LOGO_INDEX 1
#define CMD_HELP_INDEX 2
Expand Down
Loading

0 comments on commit 4828471

Please sign in to comment.