forked from ashwin417/Terminal_Simulator_Program-C
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathterminal_modified.c
More file actions
78 lines (77 loc) · 2.8 KB
/
Copy pathterminal_modified.c
File metadata and controls
78 lines (77 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
char str[100],name[100],name1[100],us1[10];;
printf("Enter the username(without spaces):");
scanf("%s",name);
strcpy(name1,name);
label: printf("\n\n\t\t\tWelcome to OS of ASH!!!\n\n\nLogging in as %s..... \n.\n.\n.\nSuccessfully Logined as %s!\n\n\n\t\t-->ASH Terminal Will be Appearing Below!<-- \n\n",name,name);
printf(" __________________________________________________________________________________________________________________________________________\n|__________________________________________________________________________________________________________________________________________|\n\n\t\t\t\t \t\t\t\tWelcome to ASH TERMINAL!!!\n __________________________________________________________________________________________________________________________________________\n|__________________________________________________________________________________________________________________________________________|\n\n\n");
do
{
printf("-----%s@ashOS$: ",name);
scanf("%s", str);
if(strcmp(str,"whoami")==0)
{
printf("\t->You are %s!\n",name);
}
else if(strcmp(str,"ls")==0)
{
printf("\t->There is nothing here\n");
}
else if(strcmp(str,"exit")==0)
{
printf("\t->Okay Thank you %s!\n\tSee you in my next janmam!\n\n\n",name);
exit(0);
}
else if(strcmp(str,"whoisash")==0)
{
printf("\t->Ash is the creater of this funny program!!!\n");
}
else if(strcmp(str,"adduser")==0)
{
printf("\t->Name: ");
scanf("%s",us1);
printf("\n\t\t\t **** User %s is created successfully ****\n",us1);
}
else if(strcmp(str,"helpcom")==0)
{
printf("->\n\n \tls: Shows contents\n\n \twhoami: Shows name of current user\n\n \tadduser: Create new user\n\n \tswitchuser: Switch to another user\n\n \tresetuser: Reset to default user\n\n \tclear: Clear screen\n\n \tversion: Shows terminal version \n\n \trestart: Restart terminal \n\n \texit: Exit from terminal\n\n\n Enter a command and enjoy your session!!!\n\n");
}
else if(strcmp(str,"clear")==0)
{
printf("\e[1;1H\e[2J");
}
else if(strcmp(str,"version")==0)
{
printf("\t->AshOS S VERSION 1.0\n\t\t->Created By R A for fun!!!\n\t\tProgramming Language Used is C\n");
}
else if(strcmp(str,"restart")==0)
{
printf("\e[1;1H\e[2J");
printf("\n.....Terminal Cleared.....\n\n.....Restarting Ash.....\n\n");
goto label;
}
else if(strcmp(str,"switchuser")==0)
{
if(us1!="\0"){
strcpy(name,us1);
printf("User switched to %s\n",us1);}
else
{
printf("No user found");
}
}
else if(strcmp(str,"resetuser")==0)
{
strcpy(name,name1);
printf("User set to %s\n",name1);
}
else
{
printf("\t\tWrong Command!!!!!!!\n\t\t 'helpcom' to list the available commands \n");
}
}while(1);
}