Код: Выделить всё
#include
#include
#include
#include
int main(void) {
char command[BUFSIZ];
int status;
pid_t pid;
for(;;) {
printf("simpsh: ");
if(fgets(command, sizeof(command), stdin) == NULL) {
printf("\n");
return 0;
}
command[strlen(command) - 1] = '\0';
if((pid = fork()) == 0)
execlp(command, command, 0);
while(wait(&status) != pid)
continue;
printf("\n");
}
Я использую dev-C++, и результат:
Код: Выделить всё
[Error] sys/wait.h: No such file or directory
Подробнее здесь: https://stackoverflow.com/questions/180 ... -directory
Мобильная версия