For this assignment write your own limited version of the st
Solution
#include<stdio.h>
#include<string.h>
#include<unistd.h>
int main(int argc, char ** argv)
{
if(strcmp(argv[0],\"./st\")==0 && argc == 1){
printf(\"Some sample Usages :\ ./st\ \\t displays synopsis message\ \");
printf(\"./st -a\ \\t displays all the settings in human readable format\ \");
printf(\"./st -echo\ \\t turns off the echoing of characters\ \");
printf(\"./st -iuclc\ \\t turns on translation of upper case characters typed appearing as lower case\ \");
return 0;
}
if(strcmp(argv[1],\"-a\")==0){
execlp(\"/bin/stty\",\"stty\", \"-a\", NULL);
}
if(strcmp(argv[1],\"-iuclc\")==0){
execlp(\"/bin/stty\",\"stty\", \"-iuclc\", NULL);
}
if(strcmp(argv[1],\"-ouclc\")==0){
execlp(\"/bin/stty\",\"stty\", \"-ouclc\", NULL);
}
if(strcmp(argv[1],\"-echo\")==0){
execlp(\"/bin/stty\",\"stty\", \"-echo\", NULL);
}
if(strcmp(argv[1],\"-icanon\")==0){
execlp(\"/bin/stty\",\"stty\", \"-icanon\", NULL);
}
else{
printf(\"-bash :%s command not found\ \",argv[1]);
return 0;
}
}

