title: Catch arrow keys using TermCaps
body: <p>I am currently working on a complete shell built in C.</p>
  
  <p>I want to implement a bash history and navigation using arrows keys through my double linked list but I am having some troubles with TermCaps and properly 
  setting up <code>read()</code> function.</p>
  
  <p>Here is how I set up my terminal :</p>
  
  <pre><code>static int      set_terminal_mode(t_shell *shell, const int mode)
   {
     char          *term_name;
  
     if (mode == 0)
       {
         if ((term_name = getenv("TERM")) == NULL)
           return (-1);
         ioctl(0, TCGETS, &amp;shell-&gt;term);
         shell-&gt;term.c_lflag &amp;= ~ICANON;
         shell-&gt;term.c_cc[VMIN] = 1;
         shell-&gt;term.c_cc[VTIME] = 0;                                         
         ioctl(0, TCGETS, &amp;shell-&gt;term_save);
         ioctl(0, TCSETS, &amp;shell-&gt;term);
       }
     if (mode == 1)
       ioctl(0, TCSETS, &amp;shell-&gt;term_save);
     return (0);
   }
  </code></pre>
  
  <p>I can catch when left or right key is pressed and then I use <code>\r</code> to erase the line (which doesn't really work) but the main problem is that I cannot use the return key anymore (only display <code>^?</code>)
  How can I fix this?</p>