I'm currently writing a shell, I have several functions implemented but I want to make the Ctrl-D (EOF character) obsolete pretty much. Or at least switch it to a very high number before it actually quits. I'm not really sure how to implement that though. Right now I have:
while(!feof(stdin))
{
if(fgets (buf, MAX_BUFFER, stdin)) {
arg = args;
*arg++ = strtok(buf, SEPERATORS);
while ((*arg++ = strtok(NULL, SEPERATORS)));
if (arg[0]) {
if(!strcmp(args[0], "clr"))
{
clr();
continue;
}
//// more commands follow
}
I thought maybe just saying somewhere in the loop:
if(feof(stdin))
continue;
thinking that would just skip it and continue on but that did not work. Any suggestions on how i can get ctrl-d to be ignored? Thanks