• Reading an NDX file in an QWK packet using PHP

    From Sam Alexander@VERT to All on Mon Jan 4 19:13:22 2010
    Hi,

    I'm trying to create a basic QWK reader in PHP, but I can't find anyway to
    read the NDX file using PHP. After some research I've seen it's an old-school MSBIN format which needs to be converted to IEEE floating point format.
    Here's a link to a Pascal program that supposedly does this, but I have no
    clue how to transpose this to PHP.

    http://www.bsdg.org/swag/MAIL/0025.pas.html

    Thanks for any suggestions... I've been testing a few scenarios to make it work, but nothing has worked.

    Thanks again --

    Sam

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Sam Alexander@VERT to Sam Alexander on Tue Jan 5 14:54:23 2010
    Quick update...

    After more research I've found this format is also commonly called MBF or Microsoft Binary Format which was used in QBasic, GWBasic, and some of the older Microsoft programming languages for DOS. I guess the original QWK application was written in one of these in the MS-DOS hay-days. Microsoft does have an old KB entry here - http://support.microsoft.com/kb/140520 - with more info, so I'm looking into this now. I really want to keep the entire process
    in PHP without hitting external applications, so I may just move forward with ASCII in the NDX files instead of the MS Binary format, which unfortunately would make it incompatible with the QWK format used by existing readers and BBSes.
    For those more experienced with QWK than I, is it possible to use ASCII in the NDX files and still have it compatible with QWK readers? Or are there other options?

    Thanks,

    Sam

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Digital Man@VERT to Sam Alexander on Tue Jan 5 16:20:33 2010
    Re: Re: Reading an NDX file in an QWK packet using PHP
    By: Sam Alexander to Sam Alexander on Tue Jan 05 2010 02:54 pm

    Quick update...

    After more research I've found this format is also commonly called MBF or Microsoft Binary Format which was used in QBasic, GWBasic, and some of the older Microsoft programming languages for DOS. I guess the original QWK application was written in one of these in the MS-DOS hay-days. Microsoft does have an old KB entry here - http://support.microsoft.com/kb/140520 - with more info, so I'm looking into this now. I really want to keep the entire process in PHP without hitting external applications, so I may just move forward with ASCII in the NDX files instead of the MS Binary format, which unfortunately would make it incompatible with the QWK format used by existing readers and BBSes.
    For those more experienced with QWK than I, is it possible to use ASCII in the NDX files and still have it compatible with QWK readers? Or are there other options?

    A reader may (but is not required) to read the NDX files, but it doesn't create them. I'm not sure what you're proposing for the use of ASCII, but it definitely sounds like it wouldn't work.

    You don't have to use the NDX files at all - you could just parse the MESSAGES.DAT file. Synchronet-created QWK packets also contain a HEADERS.DAT file which contains RFC-822 style headers for each message. So long as you're creating a reader, it'd be nice if you supported the HEADERS.DAT file as well. Synchronet has other QWK extension (mostly for QWK networking), but with the introduction of the HEADERS.DAT file (in 2008?), most of the other Synchronet extensions are now obsolete (see ftp://vert.synchro.net/main/SBBSDOCS/syncqnet.txt for details).

    digital man

    Snapple "Real Fact" #169:
    The first human-made object to break the sound barrier was a whip.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Sam Alexander@VERT to Digital Man on Wed Jan 6 14:59:01 2010
    Re: Re: Reading an NDX file in an QWK packet using PHP
    By: Sam Alexander to Sam Alexander on Tue Jan 05 2010 02:54 pm

    A reader may (but is not required) to read the NDX files, but it doesn't create them. I'm not sure what you're proposing for the use of ASCII, but
    it definitely sounds like it wouldn't work.

    You don't have to use the NDX files at all - you could just parse the MESSAGES.DAT file. Synchronet-created QWK packets also contain a
    HEADERS.DAT file which contains RFC-822 style headers for each message. So long as you're creating a reader, it'd be nice if you supported the HEADERS.DAT file as well. Synchronet has other QWK extension (mostly for
    QWK networking), but with the introduction of the HEADERS.DAT file (in 2008?), most of the other Synchronet extensions are now obsolete (see ftp://vert.synchro.net/main/SBBSDOCS/syncqnet.txt for details).


    Thanks DM for the reply and the link... it helps tremendously! I've been
    using the QWK specs posted on Textfiles.com and a few other places, and that's what talked about the NDX files. If the same info is in the Headers.dat I'll run that way and not mess with the NDX files since opening those is the showstopper thus far.

    I've been wanting to tackle a PHP project for some time though and this seemed like a fun project to put together. If I ever get something going I'll post the code.

    Thanks again and take care --

    Sam

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Shadow@VERT/ARENA to Sam Alexander on Fri Jan 8 23:18:00 2010
    Re: Re: Reading an NDX file i
    By: Sam Alexander to Digital Man on Wed Jan 06 2010 02:59 pm

    You don't have to use the NDX files at all - you could just parse the MESSAGES.DAT file. Synchronet-created QWK packets also contain a HEADERS.DAT file which contains RFC-822 style headers for each message.

    Thanks DM for the reply and the link... it helps tremendously! I've been using the QWK specs posted on Textfiles.com and a few other places, and that's what talked about the NDX files. If the same info is in the Headers.dat I'll run that way and not mess with the NDX files since opening those is the showstopper thus far.

    Man, it's been a long time since I've messed with any of this stuff (and I just realized how much I missed it). Anyway...

    If I remember correctly, the NDX files are merely pointers to the locations of the individual messages in the MESSAGES.DAT file. I would imagine their usefulness stems from the need to be performance and memory efficient (not really as much a concern these days).

    Hopefully someone will correct me if I'm wrong.


    Randy Schad


    ---
    ■ Synchronet ■ The Arena BBS ■ Bryan, OH ■ telnet: arena.ourhobby.com
  • From John Guillory@VERT/MAINLINE to Sam Alexander on Tue Mar 2 03:45:51 2010
    Re: Re: Reading an NDX file in an QWK packet using PHP
    By: Sam Alexander to Sam Alexander on Tue Jan 05 2010 02:54 pm

    entire process in PHP without hitting external applications, so I may just move forward with ASCII in the NDX files instead of the MS Binary format, which unfortunately would make it incompatible with the QWK format used by existing readers and BBSes.
    For those more experienced with QWK than I, is it possible to use ASCII in the NDX files and still have it compatible with QWK readers? Or are there other options?
    If your making a 'READER', then you can generate your own INDEX files, you
    don't have to use the ones in the QWK file. I've had QWK readers do this
    for the simple fact that not all mail reader doors are created equally.
    If your wanting to generate a QWK packet for the user via PHP, then you
    will want to do everything as compatible as can be. As far as converting
    MS Binary, it's been a long time since I have converted it. It's not
    complicated, just it's been a long time since I've done PHP, and I'm not
    really sure if they give you a way of mapping a variable such that you
    can access two different variable names but both point to the same
    memory location. If it does, not a problem, you point one to a floating
    point variable, the other to an array of byte, and use the array of byte
    to move the bytes into the right order, then use the floating point name
    to access the value. Much like a C "Union".


    ---
    ■ Synchronet ■ Roach Guts - roachguts.com