Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <sys/types.h>
- #include <unistd.h>
- #include <sys/wait.h>
- #include <string.h>
- #include <stdlib.h>
- int main(int argc, char **args){
- while (1){
- char linia[50];
- char **args[50];
- for(int i=0; i<50; i++)
- linia[i]=' ';
- printf("%s\n",">");
- fgets(linia,50,stdin);
- while (args != NULL)
- {
- printf("%s\n", args);
- args = strtok(NULL, " , ");
- }
- if(strcmp(args[0],"exit")==0){
- exit(0);
- }
- if (fork() !=0){
- waitpid(-1, &status,0);}
- else {
- execvp(args[0],args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement