home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR2 / CNAMES10.ZIP / CNAMES.PAS < prev    next >
Pascal/Delphi Source File  |  1993-11-25  |  12KB  |  346 lines

  1. {    CNAMES.TPU   - Beta Copy - Rev 11/25/93 Version 1.0                 }
  2.  
  3.        { CNAMES  UNIT by Steve Horrighs, Copyright (C)1993   }
  4.        {                               All rights reserved   }
  5.        { If you use this unit in your own programming, I ask }
  6.        { only that you give me credit in your documentation. }
  7.        { I do ask however, if you modify the Code please let }
  8.        { me know so i can improve my methods as well :)      }
  9.  
  10. {  Some portions where provided by Clark Development Company             }
  11.  
  12. Unit Cnames;
  13.  
  14. InterFace
  15.  
  16. Const CNamesVersion = 'CNames Unit v. 1.0';
  17. Type PCBCnamesRec = Record
  18.                       Name        : Array [1..14] of Char;
  19.                       PublicConf  : Boolean;
  20.                       AutoReJoin  : Boolean;
  21.                       ViewMembers : Boolean;
  22.                       PrivUplds   : Boolean;
  23.                       PrivMsgs    : Boolean;
  24.                       EchoMail    : Boolean;
  25.                       ReqSecLevel : Word;
  26.                       AddSec      : Word;
  27.                       AddTime     : Word;
  28.                       MsgBlocks   : Char;
  29.                       MsgFile     : Array  [1..32] of Char;
  30.                       UserMenu    : Array  [1..32] of Char;
  31.                       SysopMenu   : Array  [1..32] of Char;
  32.                       NewsFile    : Array  [1..32] of Char;
  33.                       PubUpldSort : Char;
  34.                       UpldDir     : Array  [1..29] of Char;
  35.                       PubUpldLoc  : Array  [1..26] of Char;
  36.                       PrvUpldSort : Char;
  37.                       PrivDir     : Array  [1..29] of Char;
  38.                       PrvUpldLoc  : Array  [1..26] of Char;
  39.                       DrsMenu     : Array  [1..29] of Char;
  40.                       DrsFile     : Array  [1..33] of Char;
  41.                       BltMenu     : Array  [1..29] of Char;
  42.                       BltNameLoc  : Array  [1..33] of Char;
  43.                       ScrMenu     : Array  [1..29] of Char;
  44.                       ScrNameLoc  : Array  [1..33] of Char;
  45.                       DirMenu     : Array  [1..29] of Char;
  46.                       DirNameLoc  : Array  [1..33] of Char;
  47.                       PthNameLoc  : Array  [1..33] of Char;
  48.                     end;
  49.      PCBCnamesRecStr = Record
  50.                        Name        : String [14];
  51.                        PublicConf  : Boolean;
  52.                        AutoReJoin  : Boolean;
  53.                        ViewMembers : Boolean;
  54.                        PrivUplds   : Boolean;
  55.                        PrivMsgs    : Boolean;
  56.                        EchoMail    : Boolean;
  57.                        ReqSecLevel : Word;
  58.                        AddSec      : Word;
  59.                        AddTime     : Word;
  60.                        MsgBlocks   : Byte;
  61.                        MsgFile     : String  [32];
  62.                        UserMenu    : String  [32];
  63.                        SysopMenu   : String  [32];
  64.                        NewsFile    : String  [32];
  65.                        PubUpldSort : Byte;
  66.                        UpldDir     : String  [29];
  67.                        PubUpldLoc  : String  [26];
  68.                        PrvUpldSort : Byte;
  69.                        PrivDir     : String  [29];
  70.                        PrvUpldLoc  : String  [26];
  71.                        DrsMenu     : String  [29];
  72.                        DrsFile     : String  [33];
  73.                        BltMenu     : String  [29];
  74.                        BltNameLoc  : String  [33];
  75.                        ScrMenu     : String  [29];
  76.                        ScrNameLoc  : String  [33];
  77.                        DirMenu     : String  [29];
  78.                        DirNameLoc  : String  [33];
  79.                        PthNameLoc  : String  [33];
  80.                     end;
  81.      Str32 = String [32];
  82.  
  83. Procedure GetCnamesRec(CnamesPath: Str32; RecNum: Longint;Var Rec:PCBCnamesRec);
  84. Procedure GetCnamesRecStr(CnamesPath: Str32;RecNum:Longint;Var Rec:PCBCnamesRecStr);
  85. Procedure ClearCnamesRecStr(Var Rec:PCBCnamesRecStr);
  86. Procedure ClearCnamesRec(Var Rec:PCBCnamesRec);
  87.  
  88. implementation
  89. Uses totMISC,Crt;
  90.  
  91. Procedure GetCnamesRec(CnamesPath: Str32;RecNum:Longint;Var Rec:PCBCnamesRec);
  92. Var CnamesFile : File;
  93.     Sizeof     : Word;
  94.     Jumpto     : Longint;
  95. Begin
  96. Sizeof:= 0;
  97. assign(CnamesFile,CnamesPath); FileMode:=0;
  98. Reset(CnamesFile,1); FileMode:=2;
  99. BlockRead(CnamesFile,Sizeof,2);
  100. Jumpto:= RecNum * Sizeof;
  101. Seek(CnamesFile,(Jumpto)+2);
  102. Blockread(CnamesFile,Rec,Sizeof);
  103. close(CnamesFile);
  104. end;
  105.  
  106. Procedure GetCnamesRecStr(CnamesPath: Str32;RecNum:Longint;Var Rec:PCBCnamesRecStr);
  107. Var CnamesFile : File;
  108.     Sizeof     : Word;
  109.     Jumpto     : Longint;
  110.     RecF       : PCBCnamesRec;
  111.     Temp       : String;
  112. Begin
  113. Sizeof:= 0;
  114. ClearCnamesRecStr(Rec);
  115. ClearCnamesRec(RecF);
  116. assign(CnamesFile,CnamesPath); FileMode:=0;
  117. Reset(CnamesFile,1); FileMode:=2;
  118. BlockRead(CnamesFile,Sizeof,2);
  119. Jumpto:= RecNum * Sizeof;
  120. Seek(CnamesFile,(Jumpto)+2);
  121. Blockread(CnamesFile,RecF,Sizeof);
  122. close(CnamesFile);
  123. For Jumpto := 1 to 14 do
  124.   begin
  125.     if RecF.Name[Jumpto] = #00 then
  126.       begin
  127.         Rec.Name[0] := chr(Jumpto-1);
  128.         Jumpto := 14;
  129.       end;
  130.       Rec.Name[JumpTo] := RecF.Name[Jumpto];
  131.     end;
  132. For Jumpto := 1 to 32 do
  133.   begin
  134.     if RecF.Msgfile[Jumpto]   = #00 then
  135.       begin
  136.         Rec.MsgFile[0] := chr(Jumpto-1);
  137.         Jumpto := 32;
  138.       end;
  139.       Rec.MsgFile[JumpTo] := RecF.MsgFile[Jumpto];
  140.     end;
  141. For Jumpto := 1 to 32 do
  142.   begin
  143.     if RecF.UserMenu[Jumpto]   = #00 then
  144.       begin
  145.         Rec.UserMenu[0] := chr(Jumpto-1);
  146.         Jumpto := 32;
  147.       end;
  148.       Rec.UserMenu[JumpTo] := RecF.UserMenu[Jumpto];
  149.     end;
  150. For Jumpto := 1 to 32 do
  151.   begin
  152.     if RecF.SysopMenu[Jumpto]   = #00 then
  153.       begin
  154.         Rec.SysopMenu[0] := chr(Jumpto-1);
  155.         Jumpto := 32;
  156.       end;
  157.       Rec.SysopMenu[JumpTo] := RecF.SysopMenu[Jumpto];
  158.     end;
  159. For Jumpto := 1 to 32 do
  160.   begin
  161.     if RecF.NewsFile[Jumpto]   = #00 then
  162.       begin
  163.         Rec.NewsFile[0] := chr(Jumpto-1);
  164.         Jumpto := 32;
  165.       end;
  166.       Rec.NewsFile[JumpTo] := RecF.NewsFile[Jumpto];
  167.     end;
  168. if RecF.PubUpldSort = #0 then Rec.PubUpldSort := 0;
  169. if RecF.PubUpldSort = #1 then Rec.PubUpldSort := 1;
  170. if RecF.PubUpldSort = #2 then Rec.PubUpldSort := 2;
  171. if RecF.PubUpldSort = #3 then Rec.PubUpldSort := 3;
  172. if RecF.PubUpldSort = #4 then Rec.PubUpldSort := 4;
  173. if RecF.MsgBlocks = #0 then Rec.MsgBlocks := 0;
  174. if RecF.MsgBlocks = #1 then Rec.MsgBlocks := 1;
  175. if RecF.MsgBlocks = #2 then Rec.MsgBlocks := 2;
  176. if RecF.MsgBlocks = #3 then Rec.MsgBlocks := 3;
  177. if RecF.MsgBlocks = #4 then Rec.MsgBlocks := 4;
  178. For Jumpto := 1 to 29 do
  179.   begin
  180.     if RecF.UpldDir[Jumpto]   = #00 then
  181.       begin
  182.         Rec.UpldDir[0] := chr(Jumpto-1);
  183.         Jumpto := 29;
  184.       end;
  185.       Rec.UpldDir[JumpTo] := RecF.UpldDir[Jumpto];
  186.     end;
  187. For Jumpto := 1 to 26 do
  188.   begin
  189.     if RecF.PubUpldLoc[Jumpto]   = #00 then
  190.       begin
  191.         Rec.PubUpldLoc[0] := chr(Jumpto-1);
  192.         Jumpto := 26;
  193.       end;
  194.       Rec.PubUpldLoc[JumpTo] := RecF.PubUpldLoc[Jumpto];
  195.     end;
  196. if RecF.PrvUpldSort = #0 then Rec.PrvUpldSort := 0;
  197. if RecF.PrvUpldSort = #1 then Rec.PrvUpldSort := 1;
  198. if RecF.PrvUpldSort = #2 then Rec.PrvUpldSort := 2;
  199. if RecF.PrvUpldSort = #3 then Rec.PrvUpldSort := 3;
  200. if RecF.PrvUpldSort = #4 then Rec.PrvUpldSort := 4;
  201. For Jumpto := 1 to 29 do
  202.   begin
  203.     if RecF.PrivDir[Jumpto]   = #00 then
  204.       begin
  205.         Rec.PrivDir[0] := chr(Jumpto-1);
  206.         Jumpto := 29;
  207.       end;
  208.       Rec.PrivDir[JumpTo] := RecF.PrivDir[Jumpto];
  209.     end;
  210. For Jumpto := 1 to 26 do
  211.   begin
  212.     if RecF.PrvUpldLoc[Jumpto]   = #00 then
  213.       begin
  214.         Rec.PrvUpldLoc[0] := chr(Jumpto-1);
  215.         Jumpto := 26;
  216.       end;
  217.       Rec.PrvUpldLoc[JumpTo] := RecF.PrvUpldLoc[Jumpto];
  218.     end;
  219. For Jumpto := 1 to 29 do
  220.   begin
  221.     if RecF.DrsMenu[Jumpto]   = #00 then
  222.       begin
  223.         Rec.DrsMenu[0] := chr(Jumpto-1);
  224.         Jumpto := 29;
  225.       end;
  226.       Rec.DrsMenu[JumpTo] := RecF.DrsMenu[Jumpto];
  227.     end;
  228. For Jumpto := 1 to 33 do
  229.   begin
  230.     if RecF.DrsFile[Jumpto]   = #00 then
  231.       begin
  232.         Rec.DrsFile[0] := chr(Jumpto-1);
  233.         Jumpto := 33;
  234.       end;
  235.       Rec.DrsFile[JumpTo] := RecF.DrsFile[Jumpto];
  236.     end;
  237. For Jumpto := 1 to 29 do
  238.   begin
  239.     if RecF.BltMenu[Jumpto]   = #00 then
  240.       begin
  241.         Rec.BltMenu[0] := chr(Jumpto-1);
  242.         Jumpto := 29;
  243.       end;
  244.       Rec.BltMenu[JumpTo] := RecF.BltMenu[Jumpto];
  245.     end;
  246. For Jumpto := 1 to 33 do
  247.   begin
  248.     if RecF.BltNameLoc[Jumpto]   = #00 then
  249.       begin
  250.         Rec.BltNameLoc[0] := chr(Jumpto-1);
  251.         Jumpto := 33;
  252.       end;
  253.       Rec.BltNameLoc[JumpTo] := RecF.BltNameLoc[Jumpto];
  254.     end;
  255. For Jumpto := 1 to 29 do
  256.   begin
  257.     if RecF.ScrMenu[Jumpto]   = #00 then
  258.       begin
  259.         Rec.ScrMenu[0] := chr(Jumpto-1);
  260.         Jumpto := 29;
  261.       end;
  262.       Rec.ScrMenu[JumpTo] := RecF.ScrMenu[Jumpto];
  263.     end;
  264. For Jumpto := 1 to 33 do
  265.   begin
  266.     if RecF.ScrNameLoc[Jumpto]   = #00 then
  267.       begin
  268.         Rec.ScrNameLoc[0] := chr(Jumpto-1);
  269.         Jumpto := 33;
  270.       end;
  271.       Rec.ScrNameLoc[JumpTo] := RecF.ScrNameLoc[Jumpto];
  272.     end;
  273. For Jumpto := 1 to 29 do
  274.   begin
  275.     if RecF.DirMenu[Jumpto]   = #00 then
  276.       begin
  277.         Rec.DirMenu[0] := chr(Jumpto-1);
  278.         Jumpto := 29;
  279.       end;
  280.       Rec.DirMenu[JumpTo] := RecF.DirMenu[Jumpto];
  281.     end;
  282. For Jumpto := 1 to 33 do
  283.   begin
  284.     if RecF.DirNameLoc[Jumpto]   = #00 then
  285.       begin
  286.         Rec.DirNameLoc[0] := chr(Jumpto-1);
  287.         Jumpto := 33;
  288.       end;
  289.       Rec.DirNameLoc[JumpTo] := RecF.DirNameLoc[Jumpto];
  290.     end;
  291. For Jumpto := 1 to 33 do
  292.   begin
  293.     if RecF.PthNameLoc[Jumpto]   = #00 then
  294.       begin
  295.         Rec.PthNameLoc[0] := chr(Jumpto-1);
  296.         Jumpto := 33;
  297.       end;
  298.       Rec.PthNameLoc[JumpTo] := RecF.PthNameLoc[Jumpto];
  299.     end;
  300. end;
  301.  
  302. Procedure ClearCnamesRecStr(Var Rec:PCBCnamesRecStr);
  303. Begin
  304. with Rec do
  305. begin
  306. Name:='';PublicConf:=FALSE;AutoReJoin:=FALSE;ViewMembers:=FALSE;DrsFile:='';
  307. PrivUplds:=FALSE;PrivMsgs:=FALSE;EchoMail:=FALSE;ReqSecLevel:=0;BltMenu:='';
  308. AddSec:=0;AddTime:=0;MsgBlocks:=0;MsgFile:='';UserMenu:='';SysopMenu:='';
  309. NewsFile:='';PubUpldSort:=0;UpldDir:='';PubUpldLoc:='';PrvUpldSort:=0;
  310. PrivDir:='';PrvUpldLoc:='';DrsMenu:='';BltNameLoc:='';ScrMenu:='';
  311. ScrNameLoc:='';DirMenu:='';DirNameLoc:='';PthNameLoc:='';
  312. end;
  313. end;
  314.  
  315. Procedure ClearCnamesRec(Var Rec:PCBCnamesRec);
  316. Var X : byte;
  317. Begin
  318. with Rec do
  319. begin
  320. PublicConf:=FALSE;AutoReJoin:=FALSE;ViewMembers:=FALSE;PrivUplds:=FALSE;
  321. PrivMsgs:=FALSE;EchoMail:=FALSE;ReqSecLevel:=0;AddSec:=0;AddTime:=0;
  322. MsgBlocks:=#0;PubUpldSort:=#0;PrvUpldSort:=#0;
  323. For x := 1 to 14 do name[x] := #0;
  324. For x := 1 to 32 do MsgFile[x] := #0;
  325. For x := 1 to 32 do UserMenu[x] := #0;
  326. For x := 1 to 32 do SysopMenu[x] := #0;
  327. For x := 1 to 32 do NewsFile[x] := #0;
  328. For x := 1 to 29 do UpldDir[x] := #0;
  329. For x := 1 to 26 do PubUpldLoc[x] := #0;
  330. For x := 1 to 29 do PrivDir[x] := #0;
  331. For x := 1 to 26 do PrvUpldLoc[x] := #0;
  332. For x := 1 to 29 do DrsMenu[x] := #0;
  333. For x := 1 to 33 do DrsFile[x] := #0;
  334. For x := 1 to 29 do BltMenu[x] := #0;
  335. For x := 1 to 33 do BltNameLoc[x] := #0;
  336. For x := 1 to 29 do ScrMenu[x] := #0;
  337. For x := 1 to 33 do ScrNameLoc[x] := #0;
  338. For x := 1 to 29 do DirMenu[x] := #0;
  339. For x := 1 to 33 do DirNameLoc[x] := #0;
  340. For x := 1 to 33 do PthNameLoc[x] := #0;
  341. end;
  342. end;
  343.  
  344. Begin
  345. end.
  346.