summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey V.Kosteltsev <AKosteltsev@IBS.RU>2022-09-24 17:36:37 +0300
committerAndrey V.Kosteltsev <AKosteltsev@IBS.RU>2022-09-24 17:36:37 +0300
commit06476556a78fa9ed81948fcacdc07c808db39661 (patch)
tree81f73d8abb79dfcbf3f2965aba31c09df85730b4
parent2cb9fbfe059354d06c088e090b6af7238b4fa806 (diff)
downloadsila-shell-06476556a78fa9ed81948fcacdc07c808db39661.tar.xz
Add id command
-rw-r--r--src/commands.c9
-rw-r--r--src/commands.h1
-rw-r--r--src/main.c3
3 files changed, 13 insertions, 0 deletions
diff --git a/src/commands.c b/src/commands.c
index 64ea3e3..5418adc 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -59,6 +59,15 @@ int com_ls( char *arg )
return( system( syscom ) );
}
+int com_id( char *arg )
+{
+ if( !valid_argument( "id", arg ) )
+ return( 1 );
+
+ sprintf (syscom, "id %s", arg);
+ return( system( syscom ) );
+}
+
int com_more( char *arg )
{
if( !valid_argument( "more", arg ) )
diff --git a/src/commands.h b/src/commands.h
index c9d975d..76058c1 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -30,6 +30,7 @@ extern COMMAND_LIST users;
extern COMMAND_LIST *current;
+extern int com_id( char *arg );
extern int com_ls( char *arg );
extern int com_more( char *arg );
extern int com_vi( char *arg );
diff --git a/src/main.c b/src/main.c
index c950f40..885883a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -61,6 +61,7 @@ COMMAND shell_admin_list[] = {
{ "delete", com_delete, "Delete FILE" },
{ "list", com_ls, "List files in DIR" },
{ "ls", com_ls, "Synonym for `list'" },
+ { "id", com_id, "Print user identity" },
{ "ping", com_ping, "Ping some host" },
{ "pwd", com_pwd, "Print the current working directory" },
{ "rename", com_rename, "Rename FILE to NEWNAME" },
@@ -79,6 +80,7 @@ COMMAND shell_operator_list[] = {
{ "delete", com_delete, "Delete FILE" },
{ "list", com_ls, "List files in DIR" },
{ "ls", com_ls, "Synonym for `list'" },
+ { "id", com_id, "Print user identity" },
{ "ping", com_ping, "Ping some host" },
{ "pwd", com_pwd, "Print the current working directory" },
{ "rename", com_rename, "Rename FILE to NEWNAME" },
@@ -97,6 +99,7 @@ COMMAND shell_user_list[] = {
{ "delete", com_delete, "Delete FILE" },
{ "list", com_ls, "List files in DIR" },
{ "ls", com_ls, "Synonym for `list'" },
+ { "id", com_id, "Print user identity" },
{ "ping", com_ping, "Ping some host" },
{ "pwd", com_pwd, "Print the current working directory" },
{ "rename", com_rename, "Rename FILE to NEWNAME" },