Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <3A36A9A8.AE148FE0@ece.gatech.edu> Date: Tue, 12 Dec 2000 17:41:44 -0500 From: Charles Wilson X-Mailer: Mozilla 4.7 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: Jeff Lu CC: cygwin AT cygwin DOT com Subject: Re: Need some helps on using dbm functions References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Jeff Lu wrote: > > I've a small program that writes data using dbm calls > > here's a snapshot of code and how I compile it: > gcc -s -o /e/inetpub/wwwroot/cgi-bin/send.exe send.c > intrautil.c -DBM_STATIC -lgdbm The readme /usr/doc/Cygwin/gdbm-1.8.0.README clearly states that you must use "-DGDBM_STATIC" not "-DBM_STATIC" or some variant thereof. I sent a more explanatory answer but it appears that the mail server swallowed it. I will repeat that explanation here, but don't be surprised if the mailserver eventually disgorges the previous one and you see another message like this one. > When the program is run, info.pag gets created but dbm_open returns a NULL > file handle dbm_local. In Unix there is info.dir file that goes with > info.pag but I don't see one here in cygwin. Is this the way it's supposed > to be? Can some one tell me why this is happening? thanks. Normal ndbm databases consist of two files: foo.dir and foo.pag. gdbm databases consist of a single file "foo". When you use gdbm in its "ndbm emulation" to create a new "ndbm"-style database (e.g. by calling 'dbm_open("my non-existant database")' -- remember that 'dbm_open' is an ndbm-style entry point; true gdbm programs use 'gdbm_open') it first creates a gdbm-style database with the name "foo.pag". Then, it HARDLINKS the file "foo.dir" to that new foo.pag database. From that point on it only accesses foo.pag. However, the initial creation step fails on FAT drives and under Win9x -- because Win9X only supports FAT -- and hardlinks don't work on FAT drives. (No, we can't rewrite gdbm to use symlinks -- the hardlink is used to insure that the timestamps on both files are the same; symlinks do not inherit the timestamp of their target.) So, the short answer is: ndbm-emulation doesn't work on Win9x or FAT. Are you using either of those? --Chuck P.S. Note that the comments in the source file gdbm-1.8.0/dbm_open.c are wrong. It states "NOTE: the file foo.dir is ignored and will always have a size 0." That is incorrect, as inspection of the source code itself will show. I based my explanation above on the source code, not the (wrong) comments. -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com