get_line modification

From: StormeRider (silk@ICI.NET)
Date: 04/27/98


Hmmm. Got a minor little problem with get_line, and my mind is a little
fried at the moment.
Ok, here's the code:

/*
 * get_line reads the next non-blank line off of the input stream.
 * The newline character is removed from the input.  Lines which begin
 * with '*' are considered to be comments.
 *
 * Returns the number of lines advanced in the file.
 */
int get_line(FILE * fl, char *buf)
{
  char temp[256];
  int lines = 0;

  do {
    lines++;
    fgets(temp, 256, fl);
    if (*temp)
      temp[strlen(temp) - 1] = '\0';
  } while (!feof(fl) && (*temp == '*' || !*temp));

  if (feof(fl))
    return 0;
  else {
    strcpy(buf, temp);
    return lines;
  }
}

Ok, I want to take out the part about skipping *'s. Also, I noticed that it
skips blank lines, and I'm not sure how its doing that.

Any ideas? I'm getting old and rusty.


StormeRider                  --- http://www.windsofstorm.net/wos/
silk@ici.net                 --- telnet://cmoo.com:4004


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST