Merge from vendor branch LESS:
[dragonfly.git] / contrib / gperf / src / read-line.icc
1 /* Inline Functions for read-line.{h,cc}.
2
3    Copyright (C) 1989-1998 Free Software Foundation, Inc.
4    written by Douglas C. Schmidt (schmidt@ics.uci.edu)
5
6 This file is part of GNU GPERF.
7
8 GNU GPERF is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 1, or (at your option)
11 any later version.
12
13 GNU GPERF is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU GPERF; see the file COPYING.  If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA.  */
21
22 // This needs:
23 //#include <stdio.h>
24 //#include "trace.h"
25
26 /* Returns the ``next'' line, ignoring comments beginning with '#'. */
27 INLINE char *
28 Read_Line::get_line (void)
29 {
30   T (Trace t ("Read_Line::get_line");)
31   int c;
32
33   while ((c = getc (fp)) == '#')
34     {
35       while (c = getc (fp), c != EOF && c != '\n')
36         ;
37
38       if (c == EOF)
39         return (char *)0;
40     }
41
42   if (c == EOF)
43     return (char *)0;
44
45   ungetc (c, stdin);
46   return readln_aux (0);
47 }