home *** CD-ROM | disk | FTP | other *** search
- /* (C) Copyright 1984,85,86,87 Walter L. Peacock All Rights Reserved */
-
- /* THIS PROGRAM BELONGS TO WALTER L. PEACOCK. IT IS CONSIDERED A TRADE */
- /* SECRET AND IS NOT TO BE DIVULGED OR USED BY PARTIES WHO HAVE NOT */
- /* RECEIVED WRITTEN AUTHORIZATION FROM THE OWNER. */
-
- /* b t r p a r a l l . c last mod: 11/23/84 */
- /* parse btree and print keys and record locations on the printer. */
-
- #include <stdio.h>
- #include "cbtree.h"
- /* btfio.h *must* be included when bt_open() is used */
- #include "btfio.h"
-
- void main(argc, argv)
- int argc;
- char **argv;
- {
- extern long getroot(), atol();
- extern int bt_ltoa(); /* custom cbtree routine: see ltoa.c */
- extern char *strcpy(), *calloc();
- extern void free();
- extern FILE *fopen();
- long rootptr;
- struct btcommo btindex;
- FILE *fprn;
- int fdidx, pwidth;
- char inpc[8];
-
- if( (fprn = fopen(PRINTER,"w") ) == NULL) /* see cbtrdef.h */
- {
- puts("Can't fopen printer");
- exit(ERR);
- }
- scr_clr();
- scr_curs(5, 20);
- printf(" Parsing B-Tree... ");
-
- /* M A I N C O N T R O L P R O G R A M */
-
- getbname(argc, argv, &btindex);
-
- if((fdidx = bt_open(btindex.idxname,O_RDWR)) == ERR)
- {
- printf("\nBTPARALL: can't open file '%s'", btindex.idxname);
- printf("\nBTPARALL: re-run BTSETUP.EXE\n");
- exit(0);
- }
-
- printf("\nB+tree Name : %s ", btindex.btname);
- printf("\nIndex File Name : %s ", btindex.idxname);
-
- repeat
- {
- printf("\n\nEnter the width of your paper ==>");
- gets(inpc);
- pwidth = atoi(inpc);
- }
- until( pwidth >= 40 && pwidth < 256 );
-
- rootptr = getroot(fdidx, btindex.findroot); /* get ptr to idx root node */
-
- btprint(fdidx, fprn, rootptr, pwidth, &btindex, 1);
-
- close(fdidx);
- btrterm(&btindex);
- fprintf(fprn,"\n");
- fclose(fprn);
- printf("\n");
- }
-
-