TIP: Click on subject to list as thread! ANSI
echo: muffin
to: Bo Simonsen
from: William McBrine
date: 2003-08-13 23:51:14
subject: Re: QWK problem(s)

-=> Bo Simonsen wrote to Bob Jones <=-

 BS> The problem is that the entries in the .NDX file isn't sepperated
 BS> correctly.

NDX files are the hardest part of QWK to do correctly. I haven't gotten
around to looking at the QWK code in Maximus -- I've been meaning to -- but 
here's some sample, portable code I wrote for converting a standard long to 
the weird MSBIN float format used in NDX (a holdover from QBASIC):


/* ms is unsigned char ms[4] */

void longtoMSBIN(unsigned long index, unsigned char *ms)
{
        unsigned char exp = '\0';

        if (index) {
                while (!(index & 0x800000L)) {
                        exp++;
                        index <<= 1;
                }
                index &= 0x7fffffL;
        } else
                exp = 152;

        ms[0] = index & 0xff;
        ms[1] = (index >> 8) & 0xff;
        ms[2] = (index >> 16) & 0xff;
        ms[3] = 152 - exp;
}


Also available in Pascal, for those interested. I've placed this code in
the public domain. This (or something like it) is the only safe way to
convert; methods which involve actual floating point math get broken when
ported to machines/compilers with different internal representations of
floats.

Meanwhile, if you're using MultiMail, you can tell it to ignore bad NDX
files by starting it with the option "-ignorendx". (There's enough
information in MESSAGES.DAT to reconstruct the indices; it's just slightly
slower to open the packet.)

... Just the other day I... no, wait... that wasn't me.
--- MultiMail/Linux v0.45
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)
SEEN-BY: 633/267 270
@PATH: 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.