diff --git a/apps/sh/shell.c b/apps/sh/shell.c
index a70b5a5..b4339cf 100644
--- a/apps/sh/shell.c
+++ b/apps/sh/shell.c
@@ -15,11 +15,11 @@
** along with BoneOS. If not, see .
**
** @main_author : Amanuel Bogale
- **
+ **
** @contributors:
** Amanuel Bogale : start
- **/
+ **/
#include
@@ -31,7 +31,8 @@
#include
#include
#include
-#include
+#include
+#include
#include
#include
#include
@@ -55,7 +56,7 @@ volatile struct typed_cmd cmd_active;
-struct cmd_t *cmds[] =
+struct cmd_t *cmds[] =
{
&cmd_clear,
&cmd_boneos_logo,
@@ -66,7 +67,8 @@ struct cmd_t *cmds[] =
&cmd_reboot,
&cmd_poweroff,
&cmd_boneshell,
- &cmd_exit
+ &cmd_exit,
+ &cmd_pwd
,0
};
diff --git a/bin/Makefile b/bin/Makefile
index 4c63ace..1c475a1 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -16,6 +16,7 @@ CSRCS = \
echo/opts/main_echo.c \
cursor/cursor.c \
cursor/opts/main_cursor.c \
+ pwd/pwd.c \
boneshell/boneshell.c
LIBNAME := bin
diff --git a/bin/pwd/pwd.c b/bin/pwd/pwd.c
new file mode 100644
index 0000000..20f119f
--- /dev/null
+++ b/bin/pwd/pwd.c
@@ -0,0 +1,66 @@
+/**
+ ** 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 .
+ **
+ ** @main_author : Ashish Ahuja
+ **
+ ** @contributors:
+
+ ** Ashish Ahuja: start
+ **/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+struct cmd_opt_t* cmd_pwd_opts[] =
+{
+ 0
+};
+
+int cmd_pwd_handler (char *cmd)
+{
+ size_t num_opts = get_opt_count (cmd);
+ if (num_opts > 2)
+ {
+ printk(cmd_pwd.invalid_use_msg);
+ return STATUS_OK;
+ }
+ printk ("%s", VAR_PWD);
+ printk ("\n");
+ return STATUS_OK;
+}
+
+struct cmd_t cmd_pwd =
+{
+ .name = "pwd",
+ .usage ="pwd",
+ .help = "pwd(1) \t\t\t\t BoneOS Terminal Manual \n"
+ "NAME : \n "
+ "\tpwd\n"
+ "SYNOPSIS : \n "
+ "\tpwd\n"
+ "DESCRIPTION : \n "
+ "\tPrints out the current working directory.\n",
+ .cmd_opts = cmd_pwd_opts,
+ .handler = &cmd_pwd_handler,
+ .invalid_use_msg = "Invalid use of pwd command.\n"
+ "Type in pwd --help for more help.\n",
+ .privilege = USER
+};
diff --git a/include/bin/pwd/pwd.h b/include/bin/pwd/pwd.h
new file mode 100644
index 0000000..e9b7075
--- /dev/null
+++ b/include/bin/pwd/pwd.h
@@ -0,0 +1 @@
+extern struct cmd_t cmd_pwd;