#include
#include
int main(void)
{
int retval;
retval = system("ls -l");
if(retval == 127)
{
fprintf(stderr,"/bin/sh not available");
exit(127);
}
else if(retval == -1)
{
perror("system");
exit(EXIT_FAILURE);
}
else if(retval != 0)
{
fprintf(stderr,"command returned %d\n",retval);
perror("ls");
}
else
{
puts("command successfully executed");
}
exit(EXIT_SUCCESS);
}
暂无评论,赶紧抢沙发吧