bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mapping text files


From: Bruce Korb
Subject: Mapping text files
Date: Sun, 17 Sep 2006 12:22:50 -0700
User-agent: Mozilla Thunderbird 1.0.7 (X11/20050923)

Hi,

It has always been an irritant that you cannot mmap a text file
and be sure that there is a terminating NUL, without going to a
lot of hassle.  The attached gnulib module goes to all the trouble
necessary.  It uses mmap(2) on all systems that have it and does
a malloc/open/read/close/free sequence for those that don't.

Using it, I am able to map a text file and run strlen() on the
data mapped in, even when the file size is an exact multiple
of the page size.  However, "make check" does not seem to do
anything for me.  Is there yet magic to be written?

For your amusement or incorporation. - Bruce

$ tar cvf - */*text-mmap* |gzip --best > text-mmap.tgz
lib/text-mmap.c
lib/text-mmap.h
m4/text-mmap.m4
modules/text-mmap
modules/text-mmap-tests
tests/test-text-mmap.c
tests/test-text-mmap.sh

Attachment: text-mmap.tgz
Description: application/compressed-tar


reply via email to

[Prev in Thread] Current Thread [Next in Thread]