C で簡単なシェルをコーディングしようとしていますが、sys/wait.h を使用できません。私のコードはそれと同じです:
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
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
ここで何が問題なのですか?また、C または C++ で単純なシェルを作成するための提案があれば、リンクまたはコードを教えてください。ありがとう!