C Shell to execute commands
<p>I have the following code:</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;unistd.h&gt;
#include &lt;sys/wait.h&gt;
#include &lt;string.h&gt;

void  passe(char *ligne, char **argv)
{
     while (*ligne != '\0')
     {
          while (*ligne == ' ' || *ligne == '\t' || *ligne == '\n')
               *ligne++ = '\0';
          *argv++ = ligne;
          while (*ligne != '\0' &amp;&amp; *ligne != ' ' &amp;&amp;  *ligne != '\t' &amp;&amp; *ligne != '\n') 
               ligne++;   
     }
     *argv = '\0';
}

void  executer(char **argv)
{
     pid_t  pid;
     int    status;

     if ((pid=fork()) == 0)
     {
          if (execvp(*argv, argv) &lt; 0) 
          {
               printf("*** ERREUR: exec echoué\n");
               exit(1);
          }
     }
     wait(&amp;status);
}

int  main(void)
{
     char  ligne[1024];
     char  *argv[64];

     while (1)
     {
          printf("Shell -&gt; ");
          scanf("%s",ligne);
          printf("\n");
          passe(ligne, argv);
          if (strcmp(argv[0], "exit") == 0)
               exit(0);
          executer(argv);
     }
     return 0;
}
</code></pre>

<p>The programme works fine, however when I parse something like "ps -f" it retunrs "execvp echoué", as the code removes the spaces. What should I exactly do to make it accept comands with options such as ps -f?</p>