-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1ef878
commit eda34f6
Showing
9 changed files
with
185 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** | ||
** This file is part of BoneOS. | ||
** | ||
** BoneOS is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 3 of the License, or | ||
** (at your option) any later version. | ||
** BoneOS is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
** GNU General Public License for more details. | ||
** You should have received a copy of the GNU General Public License | ||
** along with BoneOS. If not, see <http://www.gnu.org/licenses/>. | ||
** | ||
** @main_author : Ashish Ahuja | ||
** | ||
** @contributors: | ||
** Ashish Ahuja<Fortunate-MAN>: start | ||
**/ | ||
|
||
#include <misc/status_codes.h> | ||
#include <sh/shell.h> | ||
#include <sh/values.h> | ||
#include <drv/video/video.h> | ||
#include <unistd/unistd.h> | ||
#include <stdio/stdio.h> | ||
#include <string/string.h> | ||
#include <sh/values.h> | ||
#include <uname/uname.h> | ||
|
||
int main_uname_opt_handler (char *cmd) | ||
{ | ||
size_t num_opts = get_opt_count(cmd); | ||
str_t opts[num_opts]; | ||
get_opt(cmd,opts); | ||
|
||
if (num_opts == 1) | ||
{ | ||
printk ("%s\n", VAR_OSNAME); | ||
return STATUS_OK; | ||
} | ||
else if (num_opts > 1) | ||
{ | ||
if (strcmp (opts [1].str, "--help") == 0) | ||
{ | ||
printk (cmd_uname.help); | ||
return STATUS_OK; | ||
} | ||
else if (strcmp (opts [1].str, "-a") == 0) | ||
{ | ||
printk ("%s %s %s\n", VAR_OSNAME, VAR_RELEASE, VAR_PLATFORM); | ||
return STATUS_OK; | ||
} | ||
else if (strcmp (opts [1].str, "-p") == 0) | ||
{ | ||
printk ("%s\n", VAR_PLATFORM); | ||
return STATUS_OK; | ||
} | ||
else if (strcmp (opts [1].str, "-r") == 0) | ||
{ | ||
printk ("%s\n", VAR_RELEASE); | ||
return STATUS_OK; | ||
} | ||
else if (strcmp (opts [1].str, "-n") == 0) | ||
{ | ||
printk ("%s\n", VAR_OSNAME); | ||
return STATUS_OK; | ||
} | ||
else | ||
{ | ||
printk (cmd_uname.invalid_use_msg); | ||
return STATUS_OK; | ||
} | ||
} | ||
|
||
return STATUS_OK; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
** This file is part of BoneOS. | ||
** | ||
** BoneOS is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 3 of the License, or | ||
** (at your option) any later version. | ||
** BoneOS is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
** GNU General Public License for more details. | ||
** You should have received a copy of the GNU General Public License | ||
** along with BoneOS. If not, see <http://www.gnu.org/licenses/>. | ||
** | ||
** @main_author : Ashish Ahuja | ||
** | ||
** @contributors: | ||
** Ashish Ahuja<Fortunate-MAN>: start | ||
**/ | ||
|
||
#include <misc/status_codes.h> | ||
#include <sh/shell.h> | ||
#include <drv/video/video.h> | ||
#include <unistd/unistd.h> | ||
#include <stdio/stdio.h> | ||
#include <string/string.h> | ||
#include <sh/values.h> | ||
#include <uname/uname.h> | ||
#include <uname/opts/main_uname.h> | ||
|
||
struct cmd_opt_t* cmd_uname_opts[] = | ||
{ | ||
0 | ||
}; | ||
|
||
int cmd_uname_handler (char *cmd) | ||
{ | ||
main_uname_opt_handler (cmd); | ||
return STATUS_OK; | ||
} | ||
|
||
struct cmd_t cmd_uname = | ||
{ | ||
.name = "uname", | ||
.usage ="uname", | ||
.help = "uname(1) \t\t\t\t BoneOS Terminal Manual \n" | ||
"NAME : \n " | ||
"\tuname\n" | ||
"SYNOPSIS : \n " | ||
"\tuname [option]\n" | ||
"DESCRIPTION : \n " | ||
"\tPrints out information about the OS.\n" | ||
"OPTIONS : \n " | ||
"\t Option Summary \n " | ||
"\t\t [-n] : prints the OS name\n " | ||
"\t\t [-a] : prints all the options\n " | ||
"\t\t [-r] : prints the current release\n " | ||
"\t\t [-p] : prints the current hardware platform\n", | ||
.cmd_opts = cmd_uname_opts, | ||
.handler = &cmd_uname_handler, | ||
.invalid_use_msg = "Invalid use of uname command.\n" | ||
"Type in uname --help for more help.\n", | ||
.privilege = USER | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef _BIN_UNAME_MAINOPT_H_ | ||
#define _BIN_UNAME_MAINOPT_H_ | ||
|
||
int main_uname_opt_handler (char *cmd); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef _BIN_UNAME_H_ | ||
#define _BIN_UNAME_H_ | ||
|
||
extern struct cmd_t cmd_uname; | ||
|
||
#endif |