Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <wait.h>
- #include <sys/types.h>
- #include <string.h>
- #include <unistd.h>
- #define SIZE_BUFF 127
- void main(int argc, char const *argv[])
- {
- char str[SIZE_BUFF];
- char *arg[3];
- arg[2] = NULL;
- char *name_prog = NULL;
- char *options = NULL;
- int i = 0;
- pid_t pid;
- int status = 0;
- while(1){
- printf("%s$", getenv("USER"));
- fgets(str, 10, stdin);
- if(strlen(str) > SIZE_BUFF){
- printf("ERROR!n");
- continue;
- }
- if(!strcmp(str, "stop"))
- exit(0);
- for(i = 0; (str[i] != ' ') && (str[i] != '