=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/m4/misc.c,v retrieving revision 1.14 retrieving revision 1.15 diff -c -r1.14 -r1.15 *** src/usr.bin/m4/misc.c 1999/11/17 15:34:13 1.14 --- src/usr.bin/m4/misc.c 2000/01/12 17:49:53 1.15 *************** *** 1,4 **** ! /* $OpenBSD: misc.c,v 1.14 1999/11/17 15:34:13 espie Exp $ */ /* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: misc.c,v 1.15 2000/01/12 17:49:53 espie Exp $ */ /* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */ /* *************** *** 41,47 **** #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; #else ! static char rcsid[] = "$OpenBSD: misc.c,v 1.14 1999/11/17 15:34:13 espie Exp $"; #endif #endif /* not lint */ --- 41,47 ---- #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; #else ! static char rcsid[] = "$OpenBSD: misc.c,v 1.15 2000/01/12 17:49:53 espie Exp $"; #endif #endif /* not lint */ *************** *** 295,297 **** --- 295,328 ---- exit(1); } + int + obtain_char(f) + struct input_file *f; + { + if (f->c == '\n') + f->lineno++; + + f->c = fgetc(f->file); + return f->c; + } + + void + set_input(f, real, name) + struct input_file *f; + FILE *real; + const char *name; + { + f->file = real; + f->lineno = 1; + f->c = 0; + f->name = xstrdup(name); + } + + void + release_input(f) + struct input_file *f; + { + if (f->file != stdin) + fclose(f->file); + free(f->name); + }