HDR2BBS.PAS 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. Uses Dos;
  2. Var
  3. ConfigFile,BBSfile,HdrFile : text;
  4. files : SearchRec;
  5. temp,RealName : string;
  6. LenOfSpace : byte;
  7. path1 : string;
  8. spaces : string;
  9. i : byte;
  10. err : integer;
  11. Procedure MakeFiles(path : string);
  12. Begin
  13. FindFirst(path+'*.Hdr',AnyFile,files);
  14. err := doserror;
  15. if err = 0 then
  16. begin
  17. Assign(BBSFile,path+'files.bbs')
  18. {$I-};
  19. Append(BBSFile);
  20. If IOResult <> 0 then Rewrite(BBSFile);
  21. {$I+}
  22. while DOSError = 0 do
  23. begin
  24. Assign(HDRfile,path+files.name);
  25. Reset(HDRFile);
  26. for i := 1 to 4 do readln(HDRFILE,temp);
  27. ReadLn(HDRFile,RealName);
  28. delete(temp,1,8);
  29. delete(RealName,1,8);
  30. close(HdrFile);
  31. erase(HdrFile);
  32. LenOfSpace := Pos(' ',RealName);
  33. Delete(RealName,LenOfSpace,Length(RealName)-LenOfSpace+1);
  34. spaces := '';
  35. for i := 1 to 13-length(files.name) do spaces := spaces + ' ';
  36. WriteLn(BBSFile,RealName,spaces,'[00] ',temp);
  37. FindNext(files)
  38. end;
  39. close(BBSFile);
  40. WriteLn('Files.bbs § ¯®«­¥­® ᮤ¥à¦ ­¨¥¬ HDR ä ©«®¢',' ',path);
  41. end
  42. else case err of
  43. 2: writeln('File not found',' ',path);
  44. 3: WriteLN('Path not found',' ',path);
  45. 5: WriteLN('Access denied',' ',path);
  46. 6: WriteLN('Invalid handle',' ',path);
  47. 8: WriteLN('Not enough memory',' ',path);
  48. 10: WriteLN('Invalid environment',' ',path);
  49. 11: WriteLN('Invalid format',' ',path);
  50. 18: WriteLN('No more files',' ',path)
  51. end
  52. End;
  53. Begin
  54. path1 := ParamStr(0);
  55. FindFirst('hdr2bbs.cfg',AnyFile,files);
  56. if DosError = 0 then
  57. begin
  58. Assign(configfile,files.name);
  59. Reset(configfile);
  60. repeat
  61. ReadLn(configfile,path1);
  62. makefiles(path1);
  63. until EOF(configfile);
  64. close(configfile)
  65. end;
  66. End.