9 date 92.12.15.00.20.22; author jromine; state Exp;
14 date 92.01.31.21.58.55; author jromine; state Exp;
19 date 92.01.31.21.58.45; author jromine; state Exp;
33 @/* vfgets.c - virtual fgets */
35 static char ident[] = "@@(#)$Id: vfgets.c,v 1.2 1992/01/31 21:58:55 jromine Exp jromine $";
55 static char *pp = NULL;
58 if ((pp = malloc ((unsigned) (len = BUFSIZ))) == NULL)
59 adios (NULLCP, "unable to allocate string storage");
61 for (ep = (cp = pp) + len - 1;;) {
62 if (fgets (cp, ep - cp + 1, in) == NULL) {
67 return (ferror (in) && !feof (in) ? NOTOK : DONE);
70 if ((dp = cp + strlen (cp) - 2) < cp || *dp != QUOTE) {
73 adios (NULLCP, "vfgets() botch -- you lose big");
82 for (fp = dp - 1, toggle = 0; fp >= cp; fp--)
96 register int curlen = cp - pp;
98 if ((dp = realloc (pp, (unsigned) (len += BUFSIZ))) == NULL)
99 adios (NULLCP, "unable to allocate string storage");
101 cp = dp + curlen, ep = (pp = dp) + len - 1;
115 static char ident[] = "@@(#)$Id$";
128 *--dp = NULL, cp = dp;