title: fgets doesn't stop reading user input
body: <p>I found some challenge on reddit to make a program which will sum up all DnD dice rolls. Number of throws is unlimited therefore I created this while loop.</p>
  
  <p>I used fgets to input the string,  (I can't input only integers because the input is for example 1d3, where 1 is number of dice thrown, and 3 is number of sides of the dice thrown.) </p>
  
  <p>When the user is prompted to input dice, fgets never stops reading user input.</p>
  
  <p>For example:</p>
  
  <pre><code>To end inputting dice type 0
  1d3 
  1d4
  1d5
  0
  0
  ^C
  </code></pre>
  
  <p>Main function:</p>
  
  <pre><code>int main(void)
  {
      char input[MAXSIZE];
      int sum = 0;
      printf("To end inputting dice type 0\n");
      while(*(input) != 0);
      {
          fgets(input, sizeof(input), stdin);
          printf("Debug: input = ");
          puts(input);
          printf("\n");
          sum += dice(input);
          printf("Debug: sum = %d\n", sum);
      }
      printf("Sum of dice rolls is %d.", sum);
      return 0;
  }
  </code></pre>