Code:
void RunShellLoop(struct prompt *pr)
{
   Bool stillGoing = TRUE;
   Bool execvp_worked = FALSE; 
   ssize_t readReturn = 0;
   char *input = NULL;
   char *lastCommand = NULL;
   char **Inputs = NULL;
   char *old_command = NULL;
   char command_search;
   size_t bufLen = 0;
   int rows = 0;
   int old_col = 0;
   int col = 0;
   int x = 0;
   int i = 0;
   int len_old_command = 0;
   int num_of_inputs = 0;

   while(stillGoing)
   {
      /* The buffer will contain the new line character and the null char */
      readReturn = getline(&input, &bufLen, stdin);
      
      /* Get rid of any new line that may be there. */
      for(x = 0; x < strlen(input) + 1; ++x)
      {
         if(input[x] == '\n')
         {
            input[x] = '\0';
         }
      }

      
      if(readReturn == -1)
      {
         stillGoing = FALSE;
         printf("\n");
      }
      else if(strncmp(input, "exit", 4) == 0)
      {
         stillGoing = FALSE;
         break;
      }
      else if(execute_command(input) != TRUE)
      {
         addNode(input);
         if(readReturn == 3 && strncmp(input, "!!", 2) == 0)
         {
            printf("You typed: %s\n", lastCommand);
         }
         else if(strncmp(input, "!", 1) == 0)
         {
	    for(cptr=tptr; cptr != NULL; cptr=cptr->next)
	    {
	        if(cptr->x[0] == input[1])
	        {
	           printf("You typed: %s\n", cptr->x);
                   break;
                }
            }
            PrintPrompt(pr);
         }
   
	 else 
         {
            /*lastCommand = realloc(lastCommand, strlen(input) + 1);
	     strncpy(lastCommand, input, strlen(input) + 1);*/
            for(cptr=tptr; cptr != NULL; cptr=cptr->next)
	    {
	       if(cptr->next == NULL)
	       {
                  printf("You typed: %s\n", cptr->x);
               }
            }
            PrintPrompt(pr);          
         }
      }
      else
	PrintPrompt(pr);

      input = NULL;
   }
   
   for(cptr = tptr; cptr != NULL; cptr = cptr->next)
   {
     printf("%s\n", cptr->x);
     }
 
   for(cptr = tptr; cptr != NULL; )
   {
      struct node *tempptr;
      tempptr = cptr->next;
      free(cptr); 
      cptr = tempptr;
   }     

   free(input);
   free(lastCommand);
   
}
If I enter input 3 times, I have to type exit three times to get the function to exit. If I type exit on the first input it exits on the first try. Anyone have any idea why?