home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume14 / ngdump / part01 next >
Encoding:
Text File  |  1990-08-03  |  16.7 KB  |  720 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v14i044: Norton database dump prog (pascal)
  3. from: asperen@hroeur5.bitnet
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 14, Issue 44
  7. Submitted-by: asperen@hroeur5.bitnet
  8. Archive-name: ngdump/part01
  9.  
  10. [Forwarded from comp.binaries.ibm.pc.  ++bsa]
  11.  
  12. #!/bin/sh
  13. # shar:    Shell Archiver  (v1.27)
  14. #
  15. #    Run the following text with /bin/sh to create:
  16. #      bufio.pas
  17. #      ngdump.pas
  18. #      readme
  19. #
  20. sed 's/^X//' << 'SHAR_EOF' > bufio.pas &&
  21. X{$R+,I+}
  22. X{$M 45000,0,655360}
  23. Xunit BufIO;
  24. X
  25. Xinterface
  26. X
  27. Xprocedure bread(var f:file; var buf; count:word; var result:word);
  28. Xprocedure bskip(var f:file; n:longint);
  29. Xprocedure bseek(var f:file; p:longint);
  30. Xfunction  bpos(var f:file):longint;
  31. X
  32. Ximplementation
  33. X
  34. X{$define Buffered}
  35. X
  36. X{$ifdef Buffered}
  37. X
  38. Xconst MaxFbuf = 1024;
  39. X
  40. Xvar   fbuf   : array [1..MaxFbuf] of byte;
  41. X      inbuf  : 0..MaxFbuf;
  42. X      curbuf : 1..MaxFbuf+1;
  43. X
  44. Xprocedure bread( var f:file; var buf; count:word; var result:word);
  45. Xtype ByteArray = array [1..maxint] of byte;
  46. Xvar done,n:word;
  47. X    abuf : ByteArray absolute buf;
  48. Xbegin
  49. X  result := 0;
  50. X  if (count > inbuf) or (inbuf = 0) then begin
  51. X     if (inbuf > 0)
  52. X      then move(fbuf[curbuf], buf, inbuf);
  53. X     done := inbuf;
  54. X     while (done < count) do begin
  55. X        blockread(f, fbuf, MaxFbuf, result);
  56. X        inbuf := result;
  57. X        if (inbuf < 1) then begin
  58. X{           writeln('BufIO.bread: unexpected eof.'); }
  59. X           FillChar(buf, count, 0);
  60. X           result := 0;
  61. X           exit;
  62. X        end;
  63. X        curbuf := 1;
  64. X        n := count - done;
  65. X        if (n > inbuf) then n := inbuf;
  66. X        move(fbuf[curbuf], abuf[done+1], n);
  67. X        inc(done, n);
  68. X        dec(inbuf, n);
  69. X        inc(curbuf, n);
  70. X     end;
  71. X  end
  72. X  else begin
  73. X     move(fbuf[curbuf], buf, count);
  74. X     dec(inbuf, count);
  75. X     inc(curbuf);
  76. X  end;
  77. X  result := count;
  78. Xend;
  79. X
  80. Xprocedure bseek(var f:file; p:longint);
  81. Xbegin
  82. X  seek(f, p);
  83. X  inbuf := 0; curbuf := 1;       { flush buffer }
  84. Xend;
  85. X
  86. Xfunction bpos(var f:file):longint;
  87. Xbegin
  88. X  bpos := filepos(f) - inbuf;
  89. Xend;
  90. X
  91. Xprocedure bskip(var f:file; n:longint);
  92. Xbegin
  93. X  if (n < inbuf) then begin
  94. X     dec(inbuf, n);
  95. X     inc(curbuf, n);
  96. X  end
  97. X  else begin
  98. X     bseek(f, bpos(f)+n);
  99. X  end;
  100. Xend;
  101. X
  102. X{$else}
  103. X
  104. Xprocedure bread( var f:file; var buf; count:word; var result:word);
  105. Xbegin
  106. X  blockread(f, buf, count, result);
  107. X  if (result < 1) then begin
  108. X     writeln('BufIO.bread: unexpected eof.');
  109. X  end;
  110. Xend;
  111. X
  112. Xprocedure bseek(var f:file; p:longint);
  113. Xbegin
  114. X  seek(f, p);
  115. Xend;
  116. X
  117. Xfunction bpos(var f:file):longint;
  118. Xbegin
  119. X  bpos := filepos(f);
  120. Xend;
  121. X
  122. Xprocedure bskip(var f:file; n:longint);
  123. Xbegin
  124. X  bseek(f, filepos(f)+n);
  125. Xend;
  126. X
  127. X{$endif}
  128. X
  129. X(*
  130. Xvar SaveExitProc : Pointer;
  131. X
  132. X{$F+} procedure MyExitProc; {$F-}
  133. Xbegin
  134. X  ExitProc := SaveExitProc;
  135. Xend;
  136. X*)
  137. X
  138. Xbegin
  139. X{$ifdef Buffered}
  140. X  inbuf := 0;
  141. X  curbuf := 1;
  142. X{$endif}
  143. Xend.
  144. SHAR_EOF
  145. chmod 0644 bufio.pas || echo "restore of bufio.pas fails"
  146. sed 's/^X//' << 'SHAR_EOF' > ngdump.pas &&
  147. X{$R+,I+,V-}
  148. X
  149. Xprogram ngdump;
  150. X
  151. Xuses crt, dos,
  152. X     BufIO;
  153. X
  154. Xconst progname = 'NGDUMP';
  155. X      version  = 'V1.0';
  156. X      copyright = 'Copyright 1989 J.P.Pedersen, 1990 E.v.Asperen';
  157. X
  158. X      MaxNameLen = 40;
  159. X      MaxLineLen = 160;
  160. X
  161. Xtype gentry = record                    {General entry type}
  162. X                filptr:longint;
  163. X                name:string[MaxNameLen];
  164. X              end;
  165. X     line   = string[MaxLineLen];
  166. X
  167. Xvar
  168. X     mennu:array[0..3,0..8] of gentry;  {Buffer to hold variable part of guide menu structure}
  169. X     itemlist:array[0..3] of byte;               {Menu structure info}
  170. X     errorinfo:array[3..6] of string[14];        {Buffer for error messages}
  171. X     f:file;                                                                                    {The guide file}
  172. X     propath,homedir,streng:string;              {String variables, mostly for path and file use}
  173. X     erro,
  174. X        seealsonum,
  175. X        menuantal,
  176. X        menunr : byte;                           {Byte variables}
  177. X     entrytype : (et_misc, et_short, et_long);
  178. X     guidename : line;
  179. X
  180. Xconst MaxLevel = 10;
  181. X      OutBufSize   = 4096;
  182. X
  183. Xtype FileBuffer = array [1..OutBufSize] of byte;
  184. X
  185. Xvar  outf    : array [1..MaxLevel] of text;
  186. X     flevel  : 1..MaxLevel;
  187. X     OutBuf  : array [1..MaxLevel] of ^FileBuffer;
  188. X     Nfiles  : word;
  189. X     numentries : longint;
  190. X
  191. X
  192. X
  193. Xprocedure threenitvars;                 {Initialize variables}
  194. Xbegin
  195. X    menunr := 0;
  196. Xend;
  197. X
  198. Xprocedure twonitvars;                   {Initialize variables}
  199. Xbegin
  200. X    threenitvars;
  201. Xend;
  202. X
  203. Xprocedure initvars;                     {Initialize variables}
  204. Xvar str5:string;
  205. Xbegin
  206. X    twonitvars;
  207. X    errorinfo[3] := 'File not found';
  208. X    errorinfo[4] := 'Not an NG file';
  209. X    errorinfo[5] := 'Unexpected EOF';
  210. X    errorinfo[6] := 'Corrupted file';
  211. X    str5 := '';propath := paramstr(0);
  212. X    while (pos('\',propath) > 0) do begin
  213. X        str5 := str5+copy(propath,1,pos('\',propath));
  214. X        propath := copy(propath,pos('\',propath)+1,length(propath)-(pos('\',propath)+1));
  215. X    end;
  216. X    propath := str5;
  217. Xend;
  218. X
  219. Xvar attr, startattr : byte;
  220. X
  221. Xprocedure WriteNgString(var outf:text; s:string);
  222. Xvar i,j:byte;
  223. X    c:char;
  224. Xbegin
  225. X    i := 1;
  226. X    attr := startattr;
  227. X    while (i <= length(s)) do begin
  228. X        c := s[i];
  229. X        if c = #255 then begin
  230. X            {Expand spaces}
  231. X            inc(i);
  232. X            c := s[i];
  233. X            for j := 1 to ord(c) do begin
  234. X                write(outf, ' ');
  235. X            end;
  236. X        end
  237. X        else begin
  238. X            if (c = '!') and (i = 1) then write(outf, c);
  239. X            write(outf, c);
  240. X        end;
  241. X        inc(i);
  242. X    end;
  243. X
  244. X    writeln(outf);
  245. Xend;
  246. X
  247. Xprocedure WriteString(s:string);
  248. Xbegin
  249. X  WriteNgString(outf[flevel], s);
  250. Xend;
  251. X
  252. Xconst Fx = 10; Fy = 2;
  253. X      Gx = 10; Gy = 3;
  254. X      Mx = 10; My = 5;
  255. X      Cx = 10; Cy = 7;
  256. X      Lx = 10; Ly = 8;
  257. X      Sx = 10; Sy = 10;
  258. X
  259. X
  260. Xprocedure ShowShort(s:string);
  261. Xbegin
  262. X  gotoxy(Sx, Sy);  ClrEol;
  263. X  gotoxy(1, Sy+1); ClrEol;
  264. X  gotoxy(Sx, Sy);  WriteNgString(Output, s);
  265. Xend;
  266. X
  267. Xprocedure ShowLong(n:longint);
  268. Xbegin
  269. X  gotoxy(Lx, Ly); write(n:7);
  270. Xend;
  271. X
  272. Xprocedure ShowEndLong;
  273. Xbegin
  274. X  gotoxy(Lx, Ly); ClrEol;
  275. Xend;
  276. X
  277. Xprocedure ShowFile(s:string);
  278. Xbegin
  279. X  gotoxy(Fx, Fy); ClrEol; write(s);
  280. Xend;
  281. X
  282. Xprocedure ShowGuide(s:string);
  283. Xbegin
  284. X  gotoxy(Gx, Gy); ClrEol; write(s);
  285. Xend;
  286. X
  287. Xprocedure ShowCount(n:longint);
  288. Xbegin
  289. X  gotoxy(Cx, Cy); write(n:7);
  290. Xend;
  291. X
  292. Xprocedure ShowMenu(s:string);
  293. Xbegin
  294. X  gotoxy(Mx, My); ClrEol; WriteNgString(output, s);
  295. Xend;
  296. X
  297. Xprocedure ScreenInit;
  298. Xbegin
  299. X  ClrScr;
  300. X  gotoxy(Fx-8, Fy); write(' file:');
  301. X  gotoxy(Gx-8, Gy); write('guide:');
  302. X  gotoxy(Mx-8, My); write(' menu:');
  303. X  gotoxy(Cx-8, Cy); write('count:');
  304. X  gotoxy(Lx-8, Ly); write('lines:');
  305. X  gotoxy(Sx-8, Sy); write('entry:');
  306. Xend;
  307. X
  308. Xprocedure ScreenExit;
  309. Xbegin
  310. X  gotoxy(1, Sy+3); ClrScr;
  311. Xend;
  312. X
  313. Xprocedure Usage;                        {Write usage info}
  314. Xbegin
  315. X  writeln;
  316. X  writeln('usage:        ngdump filename');
  317. X  writeln;
  318. X  Halt(1);
  319. Xend;
  320. X
  321. Xprocedure slutlort(b:byte);  {Exit on error and display relevant error message}
  322. Xbegin
  323. X  if b > 3 then close(f);
  324. X  if b > 2 then begin
  325. X     writeln('NGDUMP ERROR #', b, ': '+errorinfo[b]+', cannot proceed');
  326. X  end;
  327. X  if b < 3 then usage;
  328. X  halt(0);
  329. Xend;
  330. X
  331. Xprocedure sllut(b:byte); {Error handler without exit, just indicating the error type}
  332. Xvar sl:byte;
  333. Xbegin
  334. X  sl := 0;
  335. X  if b > 3 then close(f);
  336. X  writeln(' ',errorinfo[b],' - Press any key');
  337. X  erro := 1;
  338. Xend;
  339. X
  340. Xfunction decrypt(b:byte):byte;          {Decrypt byte from NG format}
  341. Xbegin
  342. X(*
  343. X  if ((b mod 32)>=16) then b := b-16 else b := b+16;
  344. X  if ((b mod 16)>=8) then b := b-8 else b := b+8;
  345. X  if ((b mod 4)>=2) then b := b-2 else b := b+2;
  346. X  decrypt := b;
  347. X*)
  348. X  decrypt := b xor (16+8+2);   { this is somewhat more efficient... EVAS}
  349. Xend;
  350. X
  351. Xfunction read_byte:byte;                {Read and decrypt byte}
  352. Xvar tb:byte;
  353. X    numread:word;
  354. Xbegin
  355. X  bread(f, tb, 1, numread);
  356. X  read_byte := tb xor 26;
  357. Xend;
  358. X
  359. Xfunction read_word:word;                {Read and decrypt word}
  360. Xvar tb:byte;
  361. Xbegin
  362. X  tb := read_byte;
  363. X  read_word := word(tb) or (word(read_byte) shl 8);
  364. Xend;
  365. X
  366. Xfunction read_long:longint;             {Read and decrypt longint}
  367. Xvar tw:word;
  368. Xbegin
  369. X  tw := read_word;
  370. X  read_long := longint(tw) or (longint(read_word) shl 16);
  371. Xend;
  372. X
  373. Xtype BigStr = string[255];
  374. X
  375. Xprocedure read_string(maxlen:byte; var s:BigStr);
  376. Xvar c,j:byte;
  377. Xbegin
  378. X  j := 0;
  379. X  repeat
  380. X    c := read_byte;
  381. X    inc(j);
  382. X    s[j] := chr(c);
  383. X  until (c = 0) or (j = maxlen);
  384. X  s[0] := chr(j-1);
  385. Xend;
  386. X
  387. Xprocedure read_menu;             {Read a menu structure into the menu buffer}
  388. Xvar items,i,j:word;
  389. Xbegin
  390. X  mennu[menunr,0].filptr := bpos(f)-2;
  391. X  bskip(f, 2);
  392. X  items := read_word;
  393. X  itemlist[menunr] := items;
  394. X  bskip(f, 20);
  395. X  for i := 1 to items-1 do begin
  396. X    mennu[menunr,i].filptr := read_long;
  397. X  end;
  398. X  bskip(f, items * 8);
  399. X  for i := 0 to items-1 do begin
  400. X     with mennu[menunr, i] do begin
  401. X        read_string( 40, name );
  402. X     end;
  403. X  end;
  404. X  bskip(f, 1);
  405. Xend;
  406. X
  407. Xprocedure skip_short_long;       {Skip procedure for the initial menu bseek}
  408. Xvar length:word;
  409. Xbegin
  410. X  length := read_word;
  411. X  bskip(f, length + 22);
  412. Xend;
  413. X
  414. Xprocedure read_header(modf:byte); {Read NG file header and enter the guide name in the screen template}
  415. Xvar buf       : array[0..377] of byte;
  416. X    i,numread : word;
  417. Xbegin
  418. X  bread(f, buf, sizeof(buf), numread);
  419. X  if ((buf[0]<>ord('N')) or (buf[1]<>ord('G'))) then begin
  420. X     {If the two first characters in the file are not 'NG', the file is no guide}
  421. X     if modf = 0
  422. X      then slutlort(4)
  423. X      else sllut(4);
  424. X  end;
  425. X
  426. X  menuantal := buf[6];
  427. X  i := 0;
  428. X  repeat
  429. X    guidename[i+1] := chr(buf[i+8]);
  430. X    inc(i);
  431. X  until (buf[i+8] = 0);
  432. X  guidename[0] := chr(i);
  433. X
  434. X  ShowGuide( guidename );
  435. X  bseek(f, 378);
  436. Xend;
  437. X
  438. Xprocedure read_menus(modf:boolean);  {Initial menu bseek, indexing the whole file}
  439. Xvar id : word;
  440. Xbegin
  441. X  repeat
  442. X    id := read_word;
  443. X    if (id < 2) then begin
  444. X       skip_short_long
  445. X    end
  446. X    else if (id = 2) then begin
  447. X       read_menu;
  448. X       inc(menunr);
  449. X    end
  450. X    else if (id <> 5) then begin
  451. X       if (filesize(f) <> bpos(f)) then begin
  452. X          if (not modf)
  453. X           then slutlort(5)
  454. X           else sllut(5);        {NG file error}
  455. X       end
  456. X       else id := 5;
  457. X    end;
  458. X  until (id = 5);
  459. X
  460. X  if (menunr <> menuantal) then begin
  461. X     if (not modf)
  462. X      then slutlort(6)
  463. X      else sllut(6);                {Incomplete file}
  464. X  end;
  465. Xend;
  466. X
  467. Xfunction MakeName:Dos.PathStr;
  468. Xvar fname:Dos.PathStr;
  469. Xbegin
  470. X  inc(Nfiles);
  471. X  str(Nfiles, fname);
  472. X  MakeName := fname;
  473. Xend;
  474. X
  475. Xprocedure OpenOutFile(n:word; s:Dos.PathStr);
  476. Xbegin
  477. X  assign(outf[n], s); rewrite(outf[n]);
  478. X  SetTextBuf(outf[n], OutBuf[n]^, OutBufSize);
  479. Xend;
  480. X
  481. Xprocedure read_entry(level:byte; fp:longint); forward;
  482. X
  483. Xprocedure read_short_entry(level:byte);
  484. X{Read short entry from file and wring some information out of it}
  485. Xvar i, items: word;
  486. X    subject : line;
  487. X    entrypos, subj_pos, p0, p   : longint;
  488. Xbegin
  489. X  bskip(f, 2);
  490. X  items := read_word;
  491. X  bskip(f, 20);
  492. X  p0 := bpos(f);
  493. X  subj_pos := p0 + longint(items) * 6;
  494. X  for i := 1 to items do begin
  495. X    bskip(f, 2);
  496. X    entrypos := read_long;
  497. X    p := bpos(f);
  498. X    bseek(f, subj_pos);
  499. X    read_string( MaxLineLen, subject );
  500. X    subj_pos := bpos(f);
  501. X    write(outf[flevel], '!short:'); WriteString(subject);
  502. X{}  ShowShort(subject);
  503. X    read_entry(level+1, entrypos);
  504. X    bseek(f, p);
  505. X  end;
  506. Xend;
  507. X
  508. Xprocedure read_long_entry;
  509. X{Read long entry information}
  510. Xconst MaxSeeAlso = 20;
  511. Xvar i, linens, dlength, seealso_num : word;
  512. X    s : line;
  513. Xbegin
  514. X  bskip(f, 2);
  515. X  linens := read_word;
  516. X  dlength := read_word;
  517. X{} ShowLong(linens);
  518. X  bskip(f, 18);       { 10 + links to prev/next entry (long's) }
  519. X  for i := 1 to linens do begin
  520. X    read_string( MaxLineLen, s );
  521. X    WriteString(s);
  522. X  end;
  523. X
  524. X  if dlength <> 0 then begin            {If there are seealso entries, read them}
  525. X     seealso_num := read_word;
  526. X     { skip the offsets for the SeeAlso-items; }
  527. X     bskip(f, seealso_num * 4);
  528. X     { read the items; }
  529. X     for i := 1 to seealso_num do begin
  530. X        if i <= MaxSeeAlso then begin
  531. X           read_string( MaxLineLen, s );
  532. X           writeln(outf[flevel], '!seealso: "', s, '"');
  533. X        end;
  534. X     end;
  535. X  end;
  536. X{} ShowEndLong;
  537. Xend;
  538. X
  539. Xprocedure read_entry(level:byte; fp:longint); {Read some kind of file entry}
  540. Xvar id:word; fname:dos.pathstr;
  541. Xbegin
  542. X  inc(numentries); ShowCount(numentries);
  543. X  bseek(f, fp);
  544. X  id := read_word;
  545. X  case id of
  546. X   0: begin
  547. X        if (level > 0) then begin
  548. X           fname := MakeName;
  549. X           writeln(outf[flevel], '!file: ',fname+'.NGO');
  550. X           inc(flevel);
  551. X{$ifdef Debug}
  552. X           assign(outf[flevel], 'CON'); rewrite(outf[flevel]);
  553. X{$else}
  554. X           OpenOutFile(flevel, fname+'.DAT');
  555. X{$endif}
  556. X           read_short_entry(level);
  557. X           close(outf[flevel]);
  558. X           dec(flevel);
  559. X        end
  560. X        else begin
  561. X           read_short_entry(level);
  562. X        end;
  563. X      end;
  564. X   1: begin
  565. X(*
  566. X        if (level > 0) and (not odd(level)) then begin
  567. X           fname := MakeName;
  568. X           writeln(outf[flevel], '!long: ',fname+'.NGO');
  569. X           inc(flevel);
  570. X{$ifdef Debug}
  571. X           assign(outf[flevel], 'CON'); rewrite(outf[flevel]);
  572. X{$else}
  573. X           OpenOutFile(flevel, fname+'.DAT');
  574. X{$endif}
  575. X           read_long_entry;
  576. X           close(outf[flevel]);
  577. X           dec(flevel);
  578. X        end
  579. X        else begin
  580. X           read_long_entry;
  581. X        end;
  582. X*)
  583. X        read_long_entry;
  584. X      end;
  585. X  end;
  586. Xend;
  587. X
  588. X
  589. Xprocedure Main;
  590. Xlabel Next;
  591. Xvar i,j,k:word;
  592. X    linkf : text;
  593. X    fname : Dos.PathStr;
  594. Xbegin
  595. X  numentries := 0;
  596. X
  597. X  { create Menu Link Control File; }
  598. X  assign(linkf, 'GUIDE.LCF'); rewrite(linkf);
  599. X  writeln(linkf, '!name:'^i, guidename);
  600. X  writeln(linkf);
  601. X
  602. X  for i := 0 to menuantal-1 do begin
  603. X     writeln(linkf, '!menu:'^i, mennu[i,0].name);
  604. X     ShowMenu(mennu[i,0].name);
  605. X     for j := 1 to itemlist[i]-1 do begin
  606. X        close(outf[flevel]);
  607. X        fname := MakeName;
  608. X        OpenOutFile(flevel, fname+'.dat');
  609. X        ShowMenu(mennu[i,j].name);
  610. X        writeln(linkf, ^i, mennu[i,j].name, ^i, fname+'.ngo');
  611. X        read_entry( 0, mennu[i,j].filptr );
  612. XNext:
  613. X     end;
  614. X  end;
  615. X
  616. X  close(linkf);
  617. X
  618. X  { write a makefile; }
  619. X  assign(linkf, 'MAKEGUID'); rewrite(linkf);
  620. X  writeln(linkf, '.dat.ngo:');
  621. X  writeln(linkf, ^i'ngc $<');
  622. X  writeln(linkf);
  623. X  write(linkf, 'OBJECTS=');
  624. X  j := 0;
  625. X  for i := 1 to Nfiles do begin
  626. X     str(i, fname);
  627. X     fname := fname + '.ngo ';
  628. X     write(linkf, fname);
  629. X     inc(j, length(fname));
  630. X     if (j > 65) then begin
  631. X        write(linkf, '\'^m^j^i);
  632. X        j := 0;
  633. X     end;
  634. X  end;
  635. X  writeln(linkf);
  636. X  writeln(linkf);
  637. X  writeln(linkf, 'guide.ng:    $(OBJECTS)');
  638. X  writeln(linkf, ^i'ngml guide.lcf');
  639. X  close(linkf);
  640. Xend;
  641. X
  642. Xvar i:byte;
  643. Xbegin                        {Main loop and command-line parser}
  644. X  flevel := 1;
  645. X  Nfiles := 0;
  646. X  for i := 1 to MaxLevel do begin
  647. X    new(OutBuf[i]);
  648. X  end;
  649. X
  650. X{$ifndef Debug}
  651. X  assign(outf[flevel], 'CON');
  652. X{$else}
  653. X  assign(outf[flevel], 'GUIDE.DAT');
  654. X{$endif}
  655. X  rewrite(outf[flevel]);
  656. X  SetTextBuf(outf[flevel], OutBuf[flevel]^, OutBufSize);
  657. X
  658. X  writeln(progname,' ',version,'. ',copyright,'.');
  659. X  initvars; {Initialize global variables}
  660. X
  661. X  if ((paramstr(1)='/?') or (paramstr(1)='/h') or (paramstr(1)='/H')) then begin
  662. X     Usage;
  663. X  end;
  664. X
  665. X  if (ParamCount <> 1) then begin
  666. X     Usage;
  667. X  end;
  668. X
  669. X  streng := paramstr(1);
  670. X
  671. X  if pos('.',streng)=0
  672. X   then streng := streng+'.NG';        {Expand file name}
  673. X
  674. X  assign(f, streng);
  675. X{$I-}
  676. X  reset(f, 1);
  677. X  if ioresult<>0 then slutlort(3);   {If file does not exist, terminate and write cause of death}
  678. X{$I+}
  679. X
  680. X  ScreenInit;
  681. X  ShowFile(streng);
  682. X  ShowMenu('reading menu-info...');
  683. X  read_header(0);
  684. X  read_menus(False);
  685. X  Main;
  686. X
  687. X  close(f);
  688. X  close(outf[flevel]);
  689. X  ScreenExit;
  690. Xend.
  691. SHAR_EOF
  692. chmod 0644 ngdump.pas || echo "restore of ngdump.pas fails"
  693. sed 's/^X//' << 'SHAR_EOF' > readme &&
  694. X21/06/1990
  695. X
  696. X
  697. XThis is the README for NGDUMP, a decompiler for Norton Guides Database
  698. Xfiles. NGDUMP is based on NG_CLONE, a clone of the NG program I found
  699. Xon SIMTEL (<msdos.txtutl>ng_clone.zip). I modified the program to emit
  700. Xsource code for the NG compiler.
  701. X
  702. Xusage:        ngdump databasefile[.ng]
  703. X
  704. XNGDUMP creates numbered data-files (1.dat, 2.dat, etc.) with the text,
  705. Xa NG linker control file (GUIDE.LCF), and a makefile (MAKEGUID).
  706. X
  707. XEnjoy
  708. X
  709. XEelco van Asperen
  710. Xevas@cs.eur.nl (asperen@hroeur5.bitnet)
  711. XErasmus University Rotterdam, The Netherlands
  712. SHAR_EOF
  713. chmod 0644 readme || echo "restore of readme fails"
  714. exit 0
  715.  
  716. -- 
  717. bill davidsen    (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
  718.             "Stupidity, like virtue, is its own reward" -me
  719.  
  720.