title: How do I make this shell to parse the statement with quotes around them in C?
body: <p>I am trying to make this shell parse. How do I make the program implement parsing in a way so that commands that are in quotes will be parsed based on the starting and ending quotes and will consider it as one token? During the second while loop where I am printing out the tokens I think I need to put some sort of if statement, but I am not too sure. Any feedback/suggestions are greatly appreciated.</p>
  
  <pre><code>#include &lt;stdio.h&gt;               //printf
  #include &lt;unistd.h&gt;              //isatty
  #include &lt;string.h&gt;              //strlen,sizeof,strtok
  
  int main(int argc, char **argv[]){
  
      int MaxLength = 1024;         //size of buffer
      int inloop = 1;               //loop runs forever while 1
      char buffer[MaxLength];       //buffer
      bzero(buffer,sizeof(buffer)); //zeros out the buffer
      char *command;                //character pointer of strings
      char *token;                  //tokens
      const char s[] = "-,+,|, ";
  
      /* part 1 isatty */
      if (isatty(0))
      {
  
          while(inloop ==1)                // check if the standard input is from terminal
          {
              printf("$");
              command = fgets(buffer,sizeof(buffer),stdin);  //fgets(string of char pointer,size of,input from where
              token =  strtok(command,s);
  
              while (token !=NULL){
  
                  printf( " %s\n",token);
  
                  token = strtok(NULL, s);       //checks for elements       
              }
  
  
              if(strcmp(command,"exit\n")==0)
                  inloop =0;
  
          }      
  
      }
      else 
          printf("the standard input is NOT from a terminal\n");
  
      return 0;
  }
  </code></pre>