Thursday, November 10, 2011

Your own Command.Com shell using C Language

Your own Command.Com shell using C Language
I made this customized COMMAND.COM file. You can add more commands. If you want updated version.  Comment here. I will post the updated version.

#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<process.h>
 char str[20];
 void play(char []);
 void process(char []);
 void quit();
 void help();
 void clear();
 void dir();

 struct lost
 {
char text[20];
void (*f)();
 }los[]={"EXIT",quit,
"HELP",help,
"CLEAR",clear,
"DIR",dir};
 void main()
 {
while(1)
{
printf("\nCommand¯¯");
scanf("%s",str);
process(str);
play(str);
}
 }
 void play(char ar[])
 {
int c=0;
while(c<2)
{
if(strcmp(los[c].text,ar)==0)
{
los[c].f();
}
c++;
}
 }
 void process(char ar[])
 {
int c=0;
while(ar[c]!=NULL)
{
ar[c]=toupper(ar[c]);
c+=1;
}
 }
 void quit()
 {
exit(0);
 }
 void help()
 {
printf("Created by Debarghya Mukherjee.......\nDated 20.11.04\nEmail-debarghya_mkr@yahoo.com");
 };
 void clear()
 {
clrscr();
 }
 void dir()
 {
 }

0 comments:

Post a Comment

You are most welcome for making comments here. I will consider your view and will reply you soon.