fixup nifty routine

Jonathan Walther krooger@debian.org
Mon, 11 Sep 2000 23:19:22 -0700 (PDT)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--8323328-1521291557-968739562=:8234
Content-Type: TEXT/PLAIN; charset=US-ASCII

-----BEGIN PGP SIGNED MESSAGE-----

Oops.  Left a mem leak in there and forgot to initialize
something.  Fixed in the attached version.

On Mon, 11 Sep 2000, Jonathan Walther wrote:
> I hacked this up today to see if I understood function
> pointers, and also because my little CGI library needs
> I hope you enjoy it as much as I do.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv

iQCVAwUBOb3K68K9HT/YfGeBAQGRcgQAlzDYx0haElbEM1qzbiC7Uza6OJjJmdIi
ChGgch8TfpBnjfl+Sh+ipfR1Yx0m8WRPxTGiTiVv36BKPYxtmQwaberH+LOGRS6P
77ry0ONjAy5xptxe8H6uJgdoP+Te375QXIPxphGzoVTcEG0SNLyUuDgyJiytq5ku
MK6oKdVs4Bc=
=R6KN
-----END PGP SIGNATURE-----

--8323328-1521291557-968739562=:8234
Content-Type: TEXT/x-csrc; name="read_until.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.3.96.1000911231922.8234B@localhost>
Content-Description: read_until.c

I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3RkbGliLmg+DQoNCnR5
cGVkZWYgc3RydWN0IHsNCgljaGFyICAgICAgICAgICAqZGF0YTsNCglpbnQg
ICAgICAgICAgICAgbGVuOw0KfSAgICAgICAgICAgICAgIHJlYWRfdW50aWxf
dDsNCg0KZW51bSB7DQoJQ09OVElOVUUsIEVSUk9SLCBET05FDQp9Ow0KDQpy
ZWFkX3VudGlsX3QgICAqcmVhZF91bnRpbChpbnQsIGNoYXIgKiwgc2l6ZV90
LCBpbnQgKCopIChjaGFyICosIGludCkpOw0KDQovKg0KICogVGhlIHZhcmlh
YmxlICJzd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