home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / QWKLAY16.ZIP / QWK.TXT < prev   
Text File  |  1992-12-19  |  52KB  |  1,144 lines

  1.                      QWK Mail Packet File Layout
  2.                           by Patrick Y. Lee
  3.  
  4. Version 1.6 - December 19, 1992
  5.      Added off-line commands for QSO (door for TBBS), thanks to
  6.      message from Bob Hartman in the FidoNet Off-line echo.  All
  7.      8-bit characters have been replaced with either blanks or
  8.      equivalent 7-bit characters so I can send this file easily via
  9.      Internet email.  Line 9 of the CONTROL.DAT file seems to be
  10.      used by a few doors to indicate the NetMail conference.
  11. Version 1.5 - July 30, 1992
  12.      Added off-line commands for Cam-Mail door.  Fixed error in the
  13.      status flag section.  The descriptions for `*' and `+' are
  14.      incorrect.  Thanks to Bob Blaylock for bringing this up.
  15. Version 1.4 - July 18, 1992
  16.      Fixed a few minor mistakes in the documentation (thanks to
  17.      Cody Gibson).  Nothing really major.  Also completed the
  18.      Netmail section of the documentation.
  19. Version 1.3 - July 6, 1992
  20.      Added changes to the QWK format adopted by Qmail door.  Spe-
  21.      cifically line 10 of CONTROL.DAT file and bytes 126-127 of
  22.      MESSAGES.DAT file.  Please refer to the appropriate section
  23.      for the changes.
  24. Version 1.2 - May 31, 1992
  25.      Added a few items to the DOOR.ID file that is being supported
  26.      by Qmail DeLuxe2 version 1.25.
  27. Version 1.1 - March 15, 1992
  28.      Minor fixes here and there to make everything just right.
  29. Version 1.0 - February 23, 1992
  30.      First release.
  31.  
  32. This document is Copyright 1992 by Patrick Y. Lee.
  33.  
  34. The QWK-format is Copyright 1987 by Sparkware.
  35.  
  36. All program names mentioned in this document are either Copyright
  37. or Trademark of respective owners.
  38.  
  39. The author provides this file as-is without warranty of any kind,
  40. either expressed or implied.  You are using the information in this
  41. file at your own discretion.  The author assumes no responsibili-
  42. ties for damages, either physically or financially, from the use of
  43. this information.
  44.  
  45. This document may be freely distributed by any means (electronical-
  46. ly, paper, etc.), provided that it is distributed in its entirety. 
  47. Portions of this document may be reproduced without credit.
  48.  
  49. The latest version of this file can always be found on Aardvark BBS
  50. (New York, NY) at (212) 496-8324.  It can also be found in the Lu-
  51. natic Fringe BBS (Plano, TX) at (214) 422-2936 USR HST DS.  First
  52. time caller can download on both boards.  The file can also be sent
  53. via Internet email to anyone who asks.  Mail request to
  54. patlee@panix.com.
  55.  
  56.                     -=-=-=-=-=-=-<>-=-=-=-=-=-=-
  57.  
  58.                           Table of Contents
  59.  
  60. 1.  Introduction
  61.     1.1.  Intent
  62.     1.2.  History
  63.     1.3.  Questions, corrections, etc.
  64. 2.  Conventions & overview
  65.     2.1.  The BBS ID
  66.     2.2.  Packet compression
  67.     2.3.  Packet transfer & protocols
  68.     2.4.  Limitations
  69. 3.  QWK files
  70.     3.1.  Naming convention
  71.     3.2.  Control file (CONTROL.DAT)
  72.     3.3.  Welcome file
  73.     3.4.  Goodbye file
  74.     3.5.  News file
  75.     3.6.  Qmail DeLuxe2 menu file
  76.     3.7.  New uploads listing (NEWFILES.DAT)
  77.     3.8.  Bulletin file(s) (BLT-x.y)
  78.     3.9.  Message file (MESSAGES.DAT)
  79.     3.10.  Index files (*.NDX)
  80.         3.10.1.  Conference indices
  81.         3.10.2.  Personal index (PERSONAL.NDX)
  82.     3.11.  Pointer file
  83.     3.12.  SESSION.TXT
  84. 4.  REP files
  85.     4.1.  Naming convention
  86.     4.2.  Message file (BBSID.MSG)
  87.     4.3.  Door control messages
  88.     4.3.1.  DOOR.ID file
  89.     4.3.2.  Qmail
  90.     4.3.3.  MarkMail
  91.     4.3.4.  KMail
  92.     4.3.5.  RoseMail
  93.     4.3.6.  Complete Mail Door
  94.     4.3.7.  The MainMail System
  95.     4.3.8.  BGQWK
  96.     4.3.9.  UltraBBS
  97.     4.3.10.  TriMail
  98.     4.3.11.  Cam-Mail
  99.     4.3.12.  QSO
  100.     4.4.  Turning off the echo flag
  101.     4.5.  Tag-lines
  102. 5.  Net mail
  103. A.  Credits & contributions
  104. B.  Sample Turbo Pascal and C code
  105. C.  Sample message
  106. D.  Sample index file
  107.  
  108.                     -=-=-=-=-=-=-<>-=-=-=-=-=-=-
  109.  
  110. To search for a specific section, look for "[x.x]" using your edi-
  111. tor or viewer.  For example, to jump to the tag-lines portion of
  112. this file, search for "[4.5]" with your editor or text viewer.
  113.  
  114.                     -=-=-=-=-=-=-<>-=-=-=-=-=-=-
  115.  
  116. [1]  Introduction
  117.  
  118. [1.1]  Intent
  119.  
  120. This document is written to facilitate programmers who want to write
  121. QWK-format mail doors or readers.  It is intended to be a comprehen-
  122. sive reference covering all areas of QWK-format mail processing. 
  123. Detailed break down of each file is included, as are implementation
  124. information.  In addition, door and reader specific information may be
  125. included, when such information are available to me.
  126.  
  127. [1.2]  History
  128.  
  129. The QWK-format was invented by Mark "Sparky" Herring in 1987.  It was
  130. based on Clark Development Corporation's PCBoard version 12.0 message
  131. base format.  Off-line mail reading has become popular only in recent
  132. years.  Prior to summer of 1990, there were only two QWK-format off-
  133. line mail reader programs.  They were Qmail DeLuxe by Mark Herring and
  134. EZ-Reader by Eric Cockrell.  Similarly for the doors, there were only
  135. two -- Qmail by Mark Herring and MarkMail by Mark Turner.  They were
  136. both for PCBoard systems.
  137.  
  138. A lot has changed in both off-line reader and mail door markets since
  139. summer 1990.  Now, there are more than a dozen off-line mail readers
  140. for the PC.  Readers for the Macintosh, Amiga, and Atari exist as
  141. well.  There are over a half dozen doors for PCBoard, and QWK-format
  142. doors exist for virtually all of the popular BBS softwares.  All of
  143. these happened in less than two years!  More readers and doors are in
  144. development as I write this, keep up the excellent work.  In addition
  145. to doors, some BBS softwares has QWK-format mail facility built in.
  146.  
  147. Off-line mail reading is an integral part of BBS calling.  Conference
  148. traffic and selection on all networks have grown dramatically in re-
  149. cent years that on-line reading is a thing of the past.  Off-line mail
  150. reading offers an alternative to reading mail on-line -- It offers
  151. speed that cannot be achieved with on-line mail reading.
  152.  
  153. The reason why QWK-format readers and doors seem to have gained popu-
  154. larity is probably dued to its openness.  The format is readily avail-
  155. able to any programmer who wishes to write a program that utilize it. 
  156. Proprietary is a thing of the past, it does not work!  Openness is
  157. here to stay and QWK-format is a part of it.
  158.  
  159. [1.3]  Questions, corrections, etc.
  160.  
  161. Most of the message networks today have a conference/echo devoted to
  162. discussion of off-line readers and mail doors.  The ones I know are on
  163. FidoNet, ILink, Intelec, and RIME.  If you have questions after read-
  164. ing anything in here, feel free to drop by any of the above conference
  165. /echo and I am sure other QWK authors will try to help.
  166.  
  167. I can be reached at:
  168.  
  169. CompuServe: >INTERNET:patlee@panix.com
  170. FidoNet: Off-line echo
  171. ILink: Off-line conference
  172. Intelec: Off-line conference
  173. Internet: patlee@panix.com
  174. PlanoNet: Reviews conference
  175. RIME: ->RUNNINGB, Off-line, Common, Net Admin., Shareware, New Users,
  176. and Session Manager conferences
  177.  
  178. Any corrections, extensions, comments, and criticisms are welcomed. 
  179. Messages from Internet and RIME will probably be answered first.  But
  180. I do check mail on all other places at least once a week.
  181.  
  182. [2]  Conventions & overview
  183.  
  184. All offsets referenced in this document will be relative to 1.  I am
  185. not a computer, I start counting at one, not zero!
  186.  
  187. Words which are enclosed in quotes should be entered as-is.  The quo-
  188. tations are not part of the string unless noted.
  189.  
  190. You may have noticed I use the phrase "mail program" or "mail facili-
  191. ty" instead of mail doors.  This is because some BBS softwares offer
  192. the option of creating QWK-format mail packets right from the BBS. 
  193. With those, there is no need for an external mail door.
  194.  
  195. [2.1]  The BBS ID
  196.  
  197. The BBS ID (denoted as BBSID) is a 1-8 characters word that identifies
  198. a particular BBS.  This identifier should be obtained from line 5 of
  199. the CONTROL.DAT file (see section 3.2.1).
  200.  
  201. [2.2]  Packet compression
  202.  
  203. Most mail packets are compressed when created by the mail door in
  204. order to save download time and disk space.  However, many off-line
  205. reader programs allow the user to unarchive a mail packet outside of
  206. the reader program, so the reader will not have to unarchive it.  Upon
  207. exit, the reader will not call the archiver to save it.  It is up to
  208. the user to archive the replies.  This is useful if the user has lim-
  209. ited memory and cannot shell out to DOS to run the unarchive program. 
  210. For readers based on non-PC equipment, the user may be using less
  211. common compression program that does not have command line equivalent.
  212.  
  213. [2.3]  Packet transfer & protocols
  214.  
  215. There is no set rule on what transfer protocol should be used.  Howev-
  216. er, it would be nice for the mail program on the BBS to provide the
  217. Sysop with options as to what to offer.  This should be a configura-
  218. tion option for the user.
  219.  
  220. [2.4]  Specifications & limitations
  221.  
  222. There aren't many known limits in the QWK specification.  However,
  223. various networks seem to impose artificial limits.  On many of the PC-
  224. based networks, 99-lines appears to be the upper limit for some
  225. softwares.  However, most of the readers can handle more than that. 
  226. Reader authors reading this may want to offer the option to split
  227. replies into n lines each (the actual length should be user definable
  228. so when the network software permits, the user can increase this num-
  229. ber).
  230.  
  231. [3]  QWK files
  232.  
  233. [3.1]  Naming convention
  234.  
  235. Generally, the name of the mail packet is BBSID.QWK.  However, this
  236. does not have to be the case.  When the user downloads more than one
  237. mail packet at one time, either the mail program or the transfer pro-
  238. tocol program will rename the second and subsequent mail packets to
  239. other names.  They will either change the file extension or add a
  240. number to the end of the filename.  In either case, you should not
  241. rely on the name of the QWK file as the BBSID.  The BBSID, as men-
  242. tioned before, should be obtained from line 5 of the CONTROL.DAT file. 
  243. In addition, mail packets do not have to end with QWK extension ei-
  244. ther.  The user may choose to name them with other file extensions.
  245.  
  246. [3.2]  Control file (CONTROL.DAT)
  247.  
  248. The CONTROL.DAT file is a simple ASCII file.  Each line is terminated
  249. with a carriage return and line feed combination.  All lines should
  250. start on the first column.
  251.  
  252. Line #
  253.  1   My BBS                   BBS name
  254.  2   New York, NY             BBS city and state
  255.  3   212-555-1212             BBS phone number
  256.  4   John Doe, Sysop          BBS Sysop name
  257.  5   20052,MYBBS              Mail door registration #, BBSID
  258.  6   01-01-1991,23:59:59      Mail packet creation time
  259.  7   JANE DOE                 User name (upper case)
  260.  8                            Name of menu for Qmail, blank if none
  261.  9   0                        ? Seem to be always zero.  A few doors,
  262.                               such as DCQWK for TAG is using this
  263.                               field to indicate the conference where
  264.                               Fido NetMail should be placed.  This
  265.                               gives the reader program the ability
  266.                               easily send NetMail.
  267. 10   999                      Total number of messages in packet
  268. 11   121                      Total number of conference minus 1
  269. 12   0                        1st conf. number
  270. 13   Main Board               1st conf. name (13 characters or less)
  271. 14   1                        2nd conf. number
  272. 15   General                  2nd conf. name
  273. ..   3                        etc. onward until it hits max. conf.
  274. ..   123                      Last conf. number
  275. ..   Amiga_I                  Last conf. name
  276. ..   HELLO                    Welcome screen file
  277. ..   NEWS                     BBS news file
  278. ..   SCRIPT0                  Log off screen
  279.  
  280. Some mail doors, such as MarkMail, will send additional information
  281. about the user from here on.
  282.  
  283. 0                             ?
  284. 25                            Number of lines that follow this one
  285. JANE DOE                      User name in uppercase
  286. Jane                          User first name in mixed case
  287. NEW YORK, NY                  User city information
  288. 718 555-1212                  User data phone number
  289. 718 555-1212                  User home phone number
  290. 108                           Security level
  291. 00-00-00                      Expiration date
  292. 01-01-91                      Last log on date
  293. 23:59                         Last log on time
  294. 999                           Log on count
  295. 0                             Current conference number on the BBS
  296. 0                             Total KB downloaded
  297. 999                           Download count
  298. 0                             Total KB uploaded
  299. 999                           Upload count
  300. 999                           Minutes per day
  301. 999                           Minutes remaining today
  302. 999                           Minutes used this call
  303. 32767                         Max. download KB per day
  304. 32767                         Remaining KB today
  305. 0                             KB downloaded today
  306. 23:59                         Current time on BBS
  307. 01-01-91                      Current date on BBS
  308. My BBS                        BBS network tag-line
  309. 0                             ?
  310.  
  311. Some mail doors will offer the option of sending an abbreviated con-
  312. ference list.  That means the list will contain only conferences the
  313. user has selected.  This is done because some mail readers cannot
  314. handle more than n conferences at this time.  Users using those read-
  315. ers will need this option if the BBS they call have too many confer-
  316. ences.
  317.  
  318. [3.3]  Welcome file
  319.  
  320. This file usually contains the log on screen from the BBS.  The exact
  321. filename is specified in the CONTROL.DAT file, after the conference
  322. list.  This file may be in any format the Sysop chooses it be -- usu-
  323. ally either in plain ASCII or with ANSI screen control code.  Some
  324. Sysops (notably PCBoard Sysops) may use BBS-specific color change code
  325. in this file as well.  Current mail programs seem to handle the trans-
  326. lations between BBS-specific code to ANSI based screen control codes.
  327.  
  328. Even if the CONTROL.DAT file contains the filename of this file, it
  329. may not actually exist in the mail packet.  Sometimes, users will
  330. manually delete this file before entering the mail reader.  Some off-
  331. line readers offer the option to not display this welcome screen; some
  332. will display this file regardless.  Some doors, similarly, will offer
  333. option to the user to not send this file.
  334.  
  335. [3.4]  Goodbye file
  336.  
  337. Similar to the welcome file above, the filename to the goodbye file is
  338. in the CONTROL.DAT file.  This is the file the BBS displays when the
  339. user logs off the board.  It is optional, as always, to send this file
  340. or to display it.
  341.  
  342. [3.5]  News file
  343.  
  344. Many mail doors offer the option to send the news file from the BBS. 
  345. Most will only send this when it has been updated.  Like the welcome
  346. and goodbye files, the filename to the news file is found in the CON-
  347. TROL.DAT file.  It can be in any format the Sysop chooses, but usually
  348. in either ASCII or ANSI.  Like the welcome screen, current mail facil-
  349. ities seem to handle translation between BBS-specific control codes to
  350. ANSI screen control codes.
  351.  
  352. [3.6]  Qmail DeLuxe2 menu file
  353.  
  354. This file is of use only for Qmail DeLuxe2 mail reader by Sparkware. 
  355. The filename is found on line 8 of the CONTROL.DAT file.
  356.  
  357. [3.7]  New uploads listing (NEWFILES.DAT)
  358.  
  359. Most mail programs on the BBS will offer the option to scan new files
  360. uploaded to the BBS.  The result is found in a file named
  361. NEWFILES.DAT.  The mail program, if implementing this, should update
  362. the last file scan field in the user's profile, if there is such a
  363. field, as well as other information required by the BBS.  The mail
  364. program should, of course, scan new files only in those areas the user
  365. is allowed access.
  366.  
  367. [3.8]  Bulletin files (BLT-x.y)
  368.  
  369. Most mail programs will also offer the option to include updated bul-
  370. letin files found on the BBS in the mail packet.  The bulletins are
  371. named BLT-x.y, where x is the conference/echo the bulletin came from,
  372. and y the bulletin's actual number.  The mail program will have to
  373. take care of updating the last read date on the bulletins in the user
  374. record.
  375.  
  376. [3.9]  Message file (MESSAGES.DAT)
  377.  
  378. The MESSAGES.DAT file is the most important.  This is where all of the
  379. messages are contained in.  The QWK file format is based on PCBoard
  380. 12.0 message base format from Clark Development Corporation (maker of
  381. PCBoard BBS software).
  382.  
  383. The file has a logical record length of 128-bytes.  The first record
  384. of MESSAGES.DAT always contain a copyright notice saying "Produced by
  385. Qmail...Copyright (c) 1987 by Sparkware.  All Rights Reserved".  The
  386. rest of the record is space filled.  Actual messages consist of a 128-
  387. bytes header, plus one or more 128-bytes block with the message text. 
  388. Actual messages start in record 2.  The header block is layed out as
  389. follows:
  390.  
  391. Offset  Length  Description
  392. ------  ------  ----------------------------------------------------   
  393.     1       1   Message status flag (unsigned character)
  394.                 ' ' = public, unread
  395.                 '-' = public, read
  396.                 '*' = private, read by someone but not by intended
  397.                 recipient
  398.                 '+' = private, read by official recipient
  399.                 '~' = comment to Sysop, unread
  400.                 '`' = comment to Sysop, read
  401.                 '%' = sender password protected, unread
  402.                 '^' = sender password protected, read
  403.                 '!' = group password protected, unread
  404.                 '#' = group password protected, read
  405.                 '$' = group password protected to all
  406.     2       7   Message number (in ASCII)
  407.     9       8   Date (mm-dd-yy, in ASCII)
  408.    17       5   Time (24 hour hh:mm, in ASCII)
  409.    22      25   To (uppercase, left justified)
  410.    47      25   From (uppercase, left justified)
  411.    72      25   Subject of message (mixed case)
  412.    97      12   Password (space filled)
  413.   109       8   Reference message number (in ASCII)
  414.   117       6   Number of 128-bytes blocks in message (including the
  415.                 header, in ASCII; the lowest value should be 2, header
  416.                 plus one block message; this number may not be left
  417.                 flushed within the field)
  418.   123       1   Flag (ASCII 225 means message is active; ASCII 226
  419.                 means this message is to be killed)
  420.   124       2   Conference number (unsigned word)
  421.   126       2   Logical message number in the current packet; i.e.
  422.                 this number will be 1 for the first message, 2 for the
  423.                 second, and so on. (unsigned word)
  424.   128       1   Indicates whether the message has a network tag-line
  425.                 or not.  A value of '*' indicates that a network tag-
  426.                 line is present; a value of ' ' (space) indicates
  427.                 there isn't one.  Messages sent to readers (non-net-
  428.                 status) generally leave this as a space.  Only network
  429.                 softwares need this information.
  430.  
  431. Fields such as To, From, Subject, Message #, Reference #, and the like
  432. are space padded if they are shorter than the field's length.
  433.  
  434. The message text starts in the next record.  You can find out how many
  435. blocks make up one message by looking at the value of "Number of 128
  436. byte blocks".  Instead of carriage return and line feed combination,
  437. each line in the message end with an ASCII 227 (pi character) symbol. 
  438. There are reports that some (buggy) readers have problems with messag-
  439. es which do not end the last line in the message with an ASCII 227. 
  440. If a message does not completely occupy the 128-bytes block, the re-
  441. mainder of the block is padded with space or null.
  442.  
  443. Note that there seems to exist old doors which will use one byte to
  444. represent the conference number and pad the other one with an ASCII 32
  445. character.  The program reading this information will have to deter-
  446. mine whether the ASCII 32 in byte 125 of the header is a filler or
  447. part of the unsigned word.  One method is to look in the CONTROL.DAT
  448. file to determine the highest conference number.
  449.  
  450. Even though most mail programs will generate MESSAGES.DAT files that
  451. appear in conference order, this is not always the case.  Tomcat!
  452. (mail door for Wildcat! BBS) generates MESSAGES.DAT that is not in
  453. conference order.  This is due to how Wildcat! itself stores mail on
  454. the BBS.  Another known system that behaves this way is Auntie, which
  455. has its mail door QWiKer.
  456.  
  457. Note that some mail doors offer the option of sending a mail packet
  458. even though there may be no messages to send -- thus an empty MESSAG-
  459. ES.DAT file.  This was tested with Qmail 4.0 door and it sent a MES-
  460. SAGES.DAT file that contains a few empty 128-bytes blocks.  Other mail
  461. doors seem to be able to produce QWK files without the MESSAGES.DAT
  462. file at all!  Apparently, there was no standard established in this
  463. procedure.
  464.  
  465. [3.10]  Index files (*.NDX)
  466.  
  467. [3.10.1]  Conference indices
  468.  
  469. The index files contain a list of pointers pointing to the beginning
  470. of messages in the MESSAGES.DAT file.  The pointer is in terms of the
  471. 128-bytes block logical record that the MESSAGES.DAT file is in.  Each
  472. conference has its own xxx.NDX file, where xxx is the conference num-
  473. ber left padded with zeroes.  Some mail programs offer the user the
  474. option to not generate index files.  So the mail readers need to cre-
  475. ate the index files if they are missing.
  476.  
  477. EZ-Reader 1.xx versions will convert the NDX files from Microsoft MKS
  478. format into IEEE long integer format.  The bad part about this is that
  479. the user may store those index files back into the QWK file.  When
  480. another reader reads the index files, it will be very confused!
  481.  
  482. Special note for BBSes with more than 999 conferences: Index files for
  483. conferences with four digit conference numbers is named xxxx.NDX,
  484. where xxxx is the conference number (left padded with zeroes).  The
  485. filenames for three digit conferences are still named xxx.NDX on these
  486. boards.  I would assume filenames for conferences in the five digit
  487. range is xxxxx.NDX, but I have not seen a BBS with 10,000 or more
  488. conferences yet!
  489.  
  490. Each NDX file uses a five bytes logical record length and is formatted
  491. to:
  492.  
  493. Offset  Length  Description
  494. ------  ------  ------------------------------------------------------
  495.     1       4   Record number pointing to corresponding message in
  496.                 MESSAGES.DAT.  This number is in the Microsoft MKS$
  497.                 BASIC format.
  498.     5       1   Conference number of the message.  This byte should
  499.                 not be used because it duplicates both the filename of
  500.                 the index file and the conference # in the header.  It
  501.                 is also one byte long, which is insufficient to handle
  502.                 conferences over 255.
  503.  
  504. Please refer to appendix B for routines to deal with MKS numbers.
  505.  
  506. [3.10.2]  Personal index (PERSONAL.NDX)
  507.  
  508. There is a special index file named PERSONAL.NDX.  This file contains
  509. pointers to messages which are addressed to the user, i.e. personal
  510. messages.  Some mail door and utility programs also allow the selec-
  511. tion of other messages to be flagged as personal messages.
  512.  
  513. [3.11]  Pointer file
  514.  
  515. Pointer file is generally included so that the user can reset the last
  516. read pointers on the mail program, in case there is a crash on the BBS
  517. or some other mishaps.  There should be little reason for the reader
  518. program to access the pointer file.
  519.  
  520. The pointer files I have seen are:
  521.  
  522. KMail          BBSID.PNT
  523. MarkMail       BBSID.PNT
  524. Qmail          BBSID.PTR
  525. QWiKer         HMP.PTR
  526. SFMailQwk      BBSID.SFP
  527.  
  528. Additions to this list are welcomed.
  529.  
  530. [3.12]  SESSION.TXT
  531.  
  532. This file, if included, will contain the message scanning screen the
  533. user sees from the door.
  534.  
  535. [4]  REP files
  536.  
  537. [4.1]  Naming convention
  538.  
  539. The reply file is named BBSID.MSG, where BBSID is the ID code for the
  540. BBS found on line 5 of the CONTROL.DAT file.  Once this file has been
  541. created, the mail reader can archive it up into a file with REP exten-
  542. sion.
  543.  
  544. [4.2]  Message file (BBSID.MSG)
  545.  
  546. Replies use the same format as the MESSAGES.DAT file, except that
  547. message number field will contain the conference number instead.  In
  548. other words, the conference number will be placed in the two bytes
  549. (binary) starting at offset 124, as well as the message number field
  550. (ASCII) at offset 2.
  551.  
  552. A private message is indicated by '*' in the message status flag.  For
  553. some reason, most mail doors only accept '*' as a private message and
  554. not '+'.
  555.  
  556. The first 128-bytes record of the file is the header.  Instead of the
  557. copyright notice, it contains the BBSID of the BBS.  This 1-8 charac-
  558. ter BBSID must start at the very first byte and must match what the
  559. BBS has.  The rest of the record is space padded.  The replies start
  560. at record 2.  Each reply message will have a 128-bytes header, plus
  561. one or more for the message text; followed by another header, and so
  562. on.
  563.  
  564. The mail program must check to make sure the BBSID in the first block
  565. of the BBSID.MSG file matches what the BBS has!
  566.  
  567. [4.3]  Door control messages
  568.  
  569. These messages allow the user to change their setup on the BBS by
  570. simply entering a message.  The goal is to allow the user to be able
  571. to control most areas of the BBS via the mail door.  Different mail
  572. doors have different capabilities.  Most all of them offer the ability
  573. to add and drop a conference, as well as reset the last read pointers
  574. in a conference.
  575.  
  576. There are two trends being developed for door control messages.  The
  577. one being referred to as the "old" style accepts one command per mes-
  578. sage (command entered in the subject line); whereas the "new" style
  579. accepts multiple commands per message (commands entered in the message
  580. body).  The old style is by far the more popular but more and more
  581. doors are beginning to offer both.
  582.  
  583. [4.3.1]  DOOR.ID file
  584.  
  585. The DOOR.ID file was first introduced by Greg Hewgill with Tomcat!
  586. mail door and SLMR mail reader.  Since then, many other authors have
  587. picked up this idea and use the format.  This file provides the neces-
  588. sary identifiers a reader needs to send add, drop, etc. messages to
  589. the mail door.  It tells the reader who to address the message to and
  590. what can be put in the subject line.
  591.  
  592. DOOR = <doorname>             This is the name of the door that creat-
  593.                               ed the QWK packet, i.e. <doorname> =
  594.                               Tomcat.
  595. VERSION = <doorversion>       This is the version number of the door
  596.                               that created the packet, i.e.
  597.                               <doorversion> = 2.9.
  598. SYSTEM = <systemtype>         This is the underlying BBS system type
  599.                               and version, i.e. <systemtype> = Wildcat
  600.                               2.55.
  601. CONTROLNAME = <controlname>   This is the name to which the reader
  602.                               should send control messages, eg.
  603.                               <controlname> = TOMCAT.
  604. CONTROLTYPE = <controltype>   This can be one of ADD, DROP, REQUEST,
  605.                               or others.  ADD and DROP are pretty
  606.                               obvious (they work as in MarkMail), and
  607.                               REQUEST is for use with BBS systems that
  608.                               support file attachments.  Try out SLMR
  609.                               with CONTROLTYPE = REQUEST and use the Q
  610.                               function.  (This seems to be a Wildcat!
  611.                               BBS feature.)
  612. RECEIPT                       This flag indicates that the door/BBS is
  613.                               capable of return receipts when a mes-
  614.                               sage is received.  If the first three
  615.                               letters of the subject are RRR, then the
  616.                               door should strip the RRR and set the
  617.                               'return-receipt-requested' flag on the
  618.                               corresponding message.  When the ad-
  619.                               dressee reads this message, the BBS
  620.                               generates a message with the date/time
  621.                               it was read.
  622. MIXEDCASE = YES               If this line is found then the reader
  623.                               will let you use upper and lower case
  624.                               names and subjects.  This is first found
  625.                               in Qmail DeLuxe2 1.25 version.  Most
  626.                               other QWK readers permit the use of
  627.                               mixed case subject lines but force the
  628.                               names to upper case only.
  629. FIDOTAG = YES                 If this line is found then the reader
  630.                               will automatically use FidoNet compliant
  631.                               tag-lines.
  632.  
  633. None of the lines are actually required and they may appear in any
  634. order.  Of course, you would need a CONTROLNAME if you have any
  635. CONTROLTYPE lines.
  636.  
  637. [4.3.2]  Qmail
  638.  
  639. Qmail uses the "new" style of control message; therefore, send a mes-
  640. sage addressed to "QMAIL" with a subject of "CONFIG".  Then, enter any
  641. of the commands listed below inside the text of your message.  Remem-
  642. ber to use one command per line.
  643.  
  644. ADD <confnum>            Add a conference into the Qmail Door scanning
  645.                          list.  "YOURS" can also be added to the com-
  646.                          mand if the user wishes to receive messages
  647.                          only addressed them.  i.e. "ADD 1 YOURS". 
  648.                          "YOURS ALL" can be added to select a confer-
  649.                          ence for all mailed addressed to the user and
  650.                          to "ALL".
  651. DROP <confnum>           Drop a conference from the Qmail Door scan-
  652.                          ning list.
  653. RESET <confnum> <value>  Resets a conference to a particular value.
  654.                          The user can use "HIGH-xxx" to set the con-
  655.                          ference to the highest message in the base.
  656. CITY <value>             Changes the "city" field in the user's
  657.                          PCBoard entry.
  658. PASSWORD <value>         Changes the user's login password.
  659. BPHONE <value>           Business/data phone number
  660. HPHONE <value>           Home/voice phone number
  661. PCBEXPERT <on|off>       Turns the PCBoard expert mode ON or OFF.
  662. PCBPROT <value>          PCBoard file transfer protocol (A-Z).
  663. PAGELEN <value>          Set page length inside PCBoard.
  664. PCBCOMMENT <value>       Set user maintained comment.
  665. AUTOSTART <value>        Qmail Door autostart command.
  666. PROTOCOL <value>         Qmail Door file transfer protocol (A-Z).
  667. EXPERT <ON or OFF>       Turns the Qmail Door expert mode ON or OFF.
  668. MAXSIZE <value>          Maximum size of the user's .QWK packet (in
  669.                          bytes)
  670. MAXNUMBER <value>        Maximum number of messages per conference.
  671.  
  672. [4.3.3]  MarkMail
  673.  
  674. Send a message addressed to "MARKMAIL" with the subject line saying:
  675.  
  676. ADD [value]         in the conference you want to add
  677. DROP                in the conference you want to drop
  678. YOUR [value]        in the conference you want only your mail sent
  679. YA [value]          in the conference you want only your mail + mail
  680.                     addressed to "ALL"
  681. FILES ON or OFF     in any conference to tell MarkMail whether to scan
  682.                     for new files or not.
  683. BLTS ON or OFF      to turn on and off, respectively, of receiving
  684.                     bulletins.
  685. OWN ON or OFF       to turn on and off, respectively, of receiving
  686.                     messages you sent
  687. DELUXE ON or OFF    to turn on and off, respectively, of receiving
  688.                     DeLuxe menu
  689. LIMIT <size>        to set the maximum size of MESSAGES.DAT file can
  690.                     be, it cannot exceed what the Sysop has set up
  691.  
  692. An optional number can be added onto the commands "ADD", "YOUR", and
  693. "YA".  If this number is positive, then it will be treated as an abso-
  694. lute message number.  MarkMail will set your last read pointer to that
  695. number.  If it is negative, MarkMail will set your last read pointer
  696. to the highest minus that number.  For example: "ADD -50" will add the
  697. conference and set the last read pointer to the highest in the confer-
  698. ence minus 50.
  699.  
  700. [4.3.4]  KMail
  701.  
  702. Send a private message addressed to "KMAIL" in the conference that you
  703. want to add, drop, or reset.  The commands are "ADD", "DROP", and
  704. "RESET #", respectively.  The "#" is the message number you want your
  705. last read pointer in the conference be set to.
  706.  
  707. [4.3.5]  RoseMail
  708.  
  709. The RoseMail door allows configuration information be placed in either
  710. the subject line or message text.  The message must be addressed to
  711. "ROSEMAIL".  For only one command, it can be placed in the subject
  712. line.  For more than one changes, the subject line must say "CONFIG"
  713. and each change be placed in the message text.  Every line should be
  714. left justified.  Valid commands are:
  715.  
  716. Command                                           Example
  717. ------------------------------------------------- ------------------
  718. ADD <Conference> [<Message #>] [<Yours>]          ADD 2 -3 Y
  719. DROP <Conference>                                 DROP 2
  720. RESET <Conference> <Message #>                    RESET 12 5000
  721. PCBEXPERT <ON | OFF> - PCBoard expert mode        PCBEXPERT ON
  722. EXPERT <ON | OFF>    - RoseMail expert mode       EXPERT OFF
  723. PCBPROT <A - Z>      - PCBoard protocol           PCBPROT Z
  724. PROT <A - Z>         - RoseMail protocol          PROT G
  725. PAGELEN <Number>     - Page length                PAGELEN 20
  726. MAXSIZE <Kbytes>     - Max packet size in Kb      MAXSIZE 100
  727. MAXNUMBER <max msgs/conference>                   MAXNUMBER 100
  728. JUMPSTART <Sequence or OFF>                       JUMPSTART D;Y;Q
  729. MAXPACKET <max msgs/packet>                       MAXPACKET 500
  730. AUTOSTART <Sequence or OFF> - same as jumpstart   AUTOSTART OFF
  731. OPT <##> <ON | OFF>  - set door option            OPT 2 OFF
  732.  
  733. [4.3.6]  Complete Mail Door
  734.  
  735. Send message to "CMPMAIL", the commands are "ADD" and "DROP".  This
  736. message must be sent in the conference that you want to add or drop.
  737.  
  738. [4.3.7]  The MainMail System
  739.  
  740. Send a message addressed to "MAINMAIL" with the subject line saying:
  741.  
  742. ADD [value]         in the conference you want to add
  743. DROP                in the conference you want to drop
  744. YOURS [value]       in the conference you want only your mail sent
  745. YOURS ALL [value]   in the conference you want only your mail + mail
  746.                     addressed to "ALL"
  747.  
  748. The optional [value] parameter functions identically to the MarkMail
  749. door -- positive number indicates an absolute message number, negative
  750. number will set your last read pointer that many messages from the
  751. last message.
  752.  
  753. [4.3.8]  BGQWK
  754.  
  755. The BGQWK mail door for GT Power supports file request via message. 
  756. To request a file, simply enter a message:
  757.  
  758.      To: BGQWK
  759. Subject: DL:FILENAME.EXT
  760.  
  761. The FILENAME.EXT has to be exact name, wildcard is not supported.  The
  762. message text can be left blank.
  763.  
  764. The only limit on the file request feature is your time and/or your
  765. file ratio.  The transfer of the requested file(s) will start right
  766. after the QWK download is completed.  The only exception is when the
  767. user is using a bidirectional transfer protocol.  There, the REP and
  768. QWK are sent at the same time, hence, the file request cannot be pro-
  769. cessed until the QWK transfer is completed.
  770.  
  771. [4.3.9]  UltraBBS
  772.  
  773. Send a private message addressed to "ULTRABBS" in the conference that
  774. you want to add, drop, or reset.  The commands are "ADD", "DROP", and
  775. "RESET #", respectively.  The "#" is the message number you want your
  776. last read pointer in the conference be set to.  The QWK mail door for
  777. UltraBBS is built in and it generates the DOOR.ID file as well.
  778.  
  779. [4.3.10]  TriMail
  780.  
  781. TriMail is the QWK door for TriBBS.  This door will accept off-line
  782. configuration options sent to Qmail, MarkMail, or TriMail.  This means
  783. you can send the message to: "QMAIL", "MARKMAIL", or "TRIMAIL" in the
  784. appropriate conference and it will work.  The available options are:
  785.  
  786. BLTS ON             Turn bulletin scan on
  787. BLTS OFF            Turn bulletin scan off
  788. FILES ON            Turn new files scan on
  789. FILES OFF           Turn new files scan off
  790. RESET <value>       Reset last message read pointer
  791. DROP                Drop this conference
  792. ADD [value]         Add this conference.  The [value] is optional and
  793.                     will set the last message read pointer.
  794.  
  795. [4.3.11]  Cam-Mail
  796.  
  797. Address your message to either QMAIL or CAM-MAIL.  Then enter the
  798. command in the subject line.  Valid commands are:
  799.  
  800. Add                 Add conferences for scanning
  801. Bulletins On        Download all new bulletins in QWK packet
  802. Bulletins Off       Turn off download of new bulletins
  803. Color On            Download the QWK packet in color, if available
  804. Color Off           Turn off download in color
  805. Drop                Drop a conference from scanning
  806. Duplicates On       Turn on duplicate checking in REP files
  807. Duplicates Off      Turn off duplicate checking
  808. Files On            Download new files list in QWK packet
  809. Files Off           Turn off download of new files list
  810. Goodbye On          Send the Goodbye files with the QWK packet
  811. Goodbye Off         Does not send the Goodbye files
  812. Mailflags On        Notifies users they have mail
  813. Mailflags Off       Does not notify users of mail
  814. NDX On              Create NDX files for QWK packet
  815. NDX Off             Does not create NDX files
  816. Welcome On          Send the Welcome file with the QWK packet
  817. Welcome Off         Does not send the Welcome file
  818.  
  819. [4.3.12]  QSO
  820.  
  821. QSO supports both "old" and "new" style off-line configuration com-
  822. mands.  For the "old" style, message should be addressed to either
  823. QMAIL or QSO.  The message must be entered in the conference it af-
  824. fects, with the subject line containing:
  825.  
  826. ADD                 Add conference
  827. ADD -20             Add conference and set last read pointer to the
  828.                     highest number in conference minus 20
  829. ADD HIGH-20         Same as above
  830. ADD LOW+50          Add conference and set last read pointer to the
  831.                     lowest number in conference plus 50
  832. ADD 1234            Add conference and set last read pointer to a
  833.                     specific message number
  834. ADD YOURS           Add conference for messages addressed to you only;
  835.                     the YOURS keyword may appear before or after the
  836.                     message number; YOURS may be abbreviated as just Y
  837. DROP                Drop the conference
  838. RESET               Reset last read pointer to highest in conference
  839. RESET -20           Reset to highest number minus 20
  840. RESET HIGH-20       Same as above
  841. RESET LOW+50        Reset to lowest number plus 50
  842. RESET 1234          Reset last read pointer to specific number
  843.  
  844. For the "new" style message, enter the message addressed to either
  845. "QMAIL" or "QSO" with the subject line saying "CONFIG".  The message
  846. text should have commands similar to the ones listed above.  The only
  847. exception is that the conference number must be entered immediately
  848. after the first keyword.  For example:
  849.  
  850. ADD 15 -20          Add conference 15, reset pointer to high minus 20
  851. DROP 137            Drop conference 137
  852. ADD 20 HIGH-50 Y    Add conference 20 for mail addressed to user only,
  853.                     and set the pointer to highest minus 50
  854.  
  855. QSO supports file sending in the mail packet as well.  Attached files
  856. have the name EMnnnnn, where nnnnn is a five digit leading zero padded
  857. number indicating the message number in which the request was sent. 
  858. The plain text file ATTACHED.LST lists the real name of the file, and
  859. has the following format (one line per record):
  860.  
  861.      <conference #>, <message #>, <EMnnnnn filename>, <real name>
  862.  
  863. <conference #>      Conference where the request came from
  864. <message #>         Message number where request came from
  865. <EMnnnnn filename>  File as named inside the QWK file
  866. <real name>         Original filename as seen on the BBS
  867.  
  868. For messages that has an enclosed file, the last line of the message
  869. has the line: 
  870.  
  871. *Enclosed file: filename.ext
  872.  
  873. The reader program must send a request to obtain this file.  The re-
  874. quest is in the format similar to any other control messages:
  875.  
  876. To: QSO
  877. Subject: REQUEST nnnnn
  878.  
  879. where nnnnn is the message number that contains this attached file. 
  880. This message must be sent in the conference where that contains that
  881. message.  Alternatively, the "new" style can also be used.  With the
  882. line "REQUEST confnum nnnnn" in the message text.
  883.  
  884. To upload a file that is attached to a message, the file ATTXREF.DAT
  885. must be created.  The file is a plain text file with one line corre-
  886. sponding to each message in the reply file.  Blank lines must be in-
  887. cluded for those messages that do not have files attached to them.  A
  888. non-blank line has the following format to indicate a file is attached
  889. to that message:
  890.  
  891. <internal name>, <real name>
  892.  
  893. <internal name>     is any non-conflicting filename
  894. <real name>         the name as it should appear on the BBS
  895.  
  896. [4.4]  Turning off the echo flag
  897.  
  898. In order to send a non-echoed message (not send out to other BBSs), a
  899. user can enter "NE:" in front of the subject line.  This feature may
  900. not be offered in all mail doors.
  901.  
  902. Some mail doors strip out the "NE:" from the subject line.  However,
  903. that leaves the recipient with nothing to tell that the message was
  904. not echoed.  Therefore, it is better if "NE:" is not stripped.
  905.  
  906. [4.5]  Tag-lines
  907.  
  908. The most common format for a reader tag-line is:
  909.  
  910. ---
  911.  * My reader v1.00 * The rest of the tag-line.
  912.  
  913. (The asterisks above should be replaced by IBM extended character
  914. number 254 - a square block.)
  915.  
  916. The three dashes is called a tear-line.  The tag-line is appended to
  917. the end of the message and is usually one line only.  It is preferred
  918. that tag-lines conform to this format so that networking softwares
  919. such as QNet and RNet will not add another tearline to the message
  920. when they process it.
  921.  
  922. Softwares on FidoNet does not like mail readers adding a tear-line of
  923. their own, so if your mail reader offers a FidoNet mode, you will need
  924. to get rid of the tear-line.  Another item which differs between the
  925. FidoNet and PC-based networks is that FidoNet does not like extended
  926. ASCII characters.  So your reader may want to strip high ASCII if the
  927. user has FidoNet mode on.  Acceptable tag-line style, I believe, is
  928. just this:
  929.  
  930.  * My Reader v1.00 * The rest of the tag-line.
  931.  
  932. [5]  Net mail
  933.  
  934. QWK mail doors can be used along or in conjunction with QWK network
  935. softwares to operate a network.  Many such network exists.  A Net-
  936. Status packet (one that can be imported to BBS message base) is very
  937. similar to a normal mail packet users get.  The only difference is at
  938. the end of the MESSAGES.DAT file.  There, a series of 128 byte blocks
  939. are appended to indicate Net-Status.  
  940.  
  941. One byte represent one conference, in groups of 128.  A non-zero value
  942. means the user is allowed Net Mail status for that conference.  The
  943. number of Net Status blocks appended to the MESSAGES.DAT file only
  944. needs to cover the highest conference the user has access to.
  945.  
  946. The reason these packets have to be different?  Using QWK mail doors
  947. to send and receive messages require you to be able to send messages
  948. in other user's name as well as receive private messages in conferenc-
  949. es.  The Net-Status tells the mail door to import the messages even if
  950. they are from another name.
  951.  
  952. The only weird implementation here is that the block with the highest
  953. conference numbers come before the lower ones.  Hence, to illustrate:
  954.  
  955.        Conference 128
  956.        |  Conference 129
  957.        |  |
  958.       vv vv
  959. 0000  00 00 FF 00 00 00 00 00-00 00 00 00 00 00 00 00  Flags for
  960. 0010  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  conferences
  961. 0020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  128-255
  962. 0030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  963. 0040  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  964. 0050  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  965. 0060  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  966. 0070  00 00 00 00 00 00 00 00-00 00 00 00 00 00 FF 00
  967.  
  968.        Conference 0
  969.        |  Conference 1
  970.        |  |
  971.       vv vv
  972. 0080  00 FF 00 00 00 00 00 00-00 00 00 00 00 00 00 00  Flags for
  973. 0090  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  conferences
  974. 00A0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  0-127
  975. 00B0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  976. 00C0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  977. 00D0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  978. 00E0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
  979. 00F0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 FF
  980.  
  981. This example shows that this user has Net Status in conferences 1,
  982. 127, 130, and 254.
  983.  
  984. MarkMail and KMail doors (both for PCBoard) choos to implement things
  985. a little differently.  Instead of appending Net-Status blocks to the
  986. end of the MESSAGES.DAT file, they simply put "MarkMail" or "Kmail..."
  987. in the first 8 position of the file and the user is granted Net-Status
  988. in all conferences.
  989.  
  990.                      -=-=-=-=-=-=-<>-=-=-=-=-=-=-
  991.  
  992. [A]  Credits and Contributions
  993.  
  994. Mark "Sparky" Herring, who originated the QWK-format.
  995.  
  996. Tim Farley, who started this documentation back in the summer of 1990. 
  997. The general outline here is the work of Tim.  I filled in the blanks.
  998.  
  999. Jeffery Foy, who gave us the format for Microsoft single binary versus
  1000. IEEE format.
  1001.  
  1002. Greg Hewgill, who (if I remember correctly) wrote the Turbo Pascal
  1003. routines (included in here) to convert between MKS and TP LongInt.
  1004.  
  1005. Dennis McCunney, who is the host of the Off-line conference on RIME,
  1006. is very knowledgeable in off-line reading concept and programs.  His
  1007. goal is to have one reader that can read mail packet from any source.
  1008.  
  1009. Cody Gibson and Jeffery Foy, whose information on Net-Status packet
  1010. are included here.
  1011.  
  1012. All those who have been around the Off-line conferences on ILink (the
  1013. oldest of the four I participate), RIME, Fido, and Intelec, who have
  1014. provided great help over the past three years.  The bulk of the infor-
  1015. mation presented here are from messages in those conferences.  These
  1016. people include, but are no limited to, the followings: Dane Beko,
  1017. Joseph Carnage, Marcos Della, Joey Lizzi, Mark May, and Jim Smith.
  1018.  
  1019. [B]  Sample Turbo Pascal and C code
  1020.  
  1021. Here are a few routines in Turbo Pascal and C to convert Microsoft
  1022. BASIC MKS format to usable IEEE long integer.  These are collected
  1023. over the networks and there is no guarantee that they will work for
  1024. you!
  1025.  
  1026. Turbo Pascal (Greg Hewgill ?):
  1027.  
  1028. type
  1029.      bsingle = array [0..3] of byte;
  1030.  
  1031. { converts TP real to Microsoft 4 bytes single }
  1032.  
  1033. procedure real_to_msb (preal : real; var b : bsingle);
  1034. var
  1035.      r : array [0 .. 5] of byte absolute preal;
  1036. begin
  1037.      b [3] := r [0];
  1038.      move (r [3], b [0], 3);
  1039. end; { procedure real_to_msb }
  1040.  
  1041. { converts Microsoft 4 bytes single to TP real }
  1042.  
  1043. function msb_to_real (b : bsingle) : real;
  1044. var
  1045.      preal : real;
  1046.      r : array [0..5] of byte absolute preal;
  1047. begin
  1048.      r [0] := b [3];
  1049.      r [1] := 0;
  1050.      r [2] := 0;
  1051.      move (b [0], r [3], 3);
  1052.      msb_to_real := preal;
  1053. end; { function msb_to_real }
  1054.  
  1055. Another Turbo Pascal routine to convert Microsoft single to TP LongInt
  1056. (Marcos Della):
  1057.  
  1058. index := ((mssingle and not $ff000000) or $00800000) shr (24 -
  1059. ((mssingle shr 24) and $7f)) - 1;
  1060.  
  1061. C (identify yourself if you wrote this routine):
  1062.  
  1063. /* converts 4 bytes Microsoft MKS format to long integer */
  1064.  
  1065. unsigned long mbf_to_int (m1, m2, m3, exp)
  1066. unsigned int m1, m2, m3, exp;
  1067. {
  1068.      return (((m1 + ((unsigned long) m2 << 8) + ((unsigned long) m3 <<
  1069.      16)) | 0x800000L) >> (24 - (exp - 0x80)));
  1070. }
  1071.  
  1072. Microsoft binary (by Jeffery Foy):
  1073.  
  1074.    31 - 24    23     22 - 0        <-- bit position
  1075. +-----------------+----------+
  1076. | exponent | sign | mantissa |
  1077. +----------+------+----------+
  1078.  
  1079. IEEE (C/Pascal/etc.):
  1080.  
  1081.    31     30 - 23    22 - 0        <-- bit position
  1082. +----------------------------+
  1083. | sign | exponent | mantissa |
  1084. +------+----------+----------+
  1085.  
  1086. In both cases, the sign is one bit, the exponent is 8 bits, and the
  1087. mantissa is 23 bits.  You can write your own, optimized, routine to
  1088. convert between the two formats using the above bit layout.
  1089.  
  1090. [C]  Sample message
  1091.  
  1092. Here is a sample message in hex and ASCII format:
  1093.  
  1094. 019780  20 34 32 33 32 20 20 20 30 32 2D 31 35 2D 39 32   4232   02-15-92
  1095. 019790  31 33 3A 34 35 52 49 43 48 41 52 44 20 42 4C 41  13:45RICHARD BLA
  1096. 0197A0  43 4B 42 55 52 4E 20 20 20 20 20 20 20 20 53 54  CKBURN        ST
  1097. 0197B0  45 56 45 20 43 4F 4C 45 54 54 49 20 20 20 20 20  EVE COLETTI     
  1098. 0197C0  20 20 20 20 20 20 20 51 45 44 49 54 20 48 41 43         QEDIT HAC
  1099. 0197D0  4B 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  K               
  1100. 0197E0  20 20 20 20 20 20 20 20 20 20 20 20 34 30 33 36              4036
  1101. 0197F0  20 20 20 20 37 20 20 20 20 20 E1 0A 01 00 00 20      7           
  1102. 019800  2A 20 49 6E 20 61 20 6D 65 73 73 61 67 65 20 64  * In a message d
  1103. 019810  61 74 65 64 20 30 32 2D 30 39 2D 39 32 20 74 6F  ated 02-09-92 to
  1104. 019820  20 53 74 65 76 65 20 43 6F 6C 65 74 74 69 2C 20   Steve Coletti, 
  1105. 019830  52 69 63 68 61 72 64 20 42 6C 61 63 6B 62 75 72  Richard Blackbur
  1106. 019840  6E 20 73 61 69 64 3A E3 E3 52 42 3E 53 43 20 AF  n said:  RB>SC  
  1107. 019850  20 65 64 69 74 6F 72 20 69 6E 20 74 68 65 20 28   editor in the (
  1108. 019860  6D 61 69 6E 66 72 61 6D 65 29 20 56 4D 2F 43 4D  mainframe) VM/CM
  1109. 019870  53 20 70 72 6F 64 75 63 74 20 6C 69 6E 65 20 69  S product line i
  1110. [ etc. ]
  1111. 019A00  6E 6F 74 20 61 20 44 6F 63 74 6F 72 2C 20 62 75  not a Doctor, bu
  1112. 019A10  74 20 49 20 70 6C 61 79 20 6F 6E 65 20 61 74 20  t I play one at 
  1113. 019A20  74 68 65 20 48 6F 73 70 69 74 61 6C 2E E3 20 20  the Hospital.   
  1114. 019A30  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1115. 019A40  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1116. 019A50  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1117. 019A60  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1118. 019A70  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1119. 019A80  E3 50 43 52 65 6C 61 79 3A 4D 4F 4F 4E 44 4F 47   PCRelay:MOONDOG
  1120. 019A90  20 2D 3E 20 23 33 35 20 52 65 6C 61 79 4E 65 74   -> #35 RelayNet
  1121. 019AA0  20 28 74 6D 29 E3 34 2E 31 30 20 20 20 20 20 20   (tm) 4.10      
  1122. 019AB0  20 20 20 20 20 20 20 20 20 48 55 42 4D 4F 4F 4E           HUBMOON
  1123. 019AC0  2D 4D 6F 6F 6E 44 6F 67 20 42 42 53 2C 20 42 72  -MoonDog BBS, Br
  1124. 019AD0  6F 6F 6B 6C 79 6E 2C 4E 59 20 37 31 38 20 36 39  ooklyn,NY 718 69
  1125. 019AE0  32 2D 32 34 39 38 E3 20 20 20 20 20 20 20 20 20  2-2498          
  1126. 019AF0  20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
  1127.  
  1128. [D]  Sample index file
  1129.  
  1130. Here is a sample index file in hex format:
  1131.  
  1132. 000000  00 00 28 87 19 00 00 30 87 19 00 00 38 87 19 00
  1133. 000010  00 7E 87 19 00 00 07 88 19 00 00 0B 88 19 00 00
  1134. 000020  0F 88 19 00 00 14 88 19 00 00 19 88 19 00 00 1E
  1135. 000030  88 19 00 00 22 88 19 00 00 27 88 19 00 00 2C 88
  1136. 000040  19 00 00 31 88 19 00 00 3B 88 19 00 00 40 88 19
  1137. 000050  00 00 46 88 19 00 00 49 88 19 00 00 4D 88 19 00
  1138. 000060  00 52 88 19 00 00 55 88 19 00 00 59 88 19 00 00
  1139. 000070  60 88 19 00 00 66 88 19 00 00 70 88 19
  1140.  
  1141. This index file is for conference 25.  The values for the offset are as
  1142. follows: 84, 88, 92, 127, 135, 139, 143, 148, 153, 158, 162, 167, 172,
  1143. 177, 187, 192, 198, 201, 205 210, 213, 217, 224, 230, and 240.
  1144.