home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c023 / 1.img / PROGRAMS / BTPARCON.C < prev    next >
Encoding:
C/C++ Source or Header  |  1987-11-05  |  1.8 KB  |  67 lines

  1. /* (C) Copyright 1984,85,86,87 Walter L. Peacock   All Rights Reserved   */
  2.  
  3. /* THIS PROGRAM BELONGS TO WALTER L. PEACOCK.  IT IS CONSIDERED A TRADE */
  4. /* SECRET AND IS NOT TO BE DIVULGED OR USED BY PARTIES WHO HAVE NOT      */
  5. /* RECEIVED WRITTEN AUTHORIZATION FROM THE OWNER.                  */
  6.  
  7. /* b t p a r c o n . c      last mod: 01/24/85   */
  8. /*  parse btree and display keys and record locations on stdout. */
  9.  
  10. #include <stdio.h>
  11. #include "cbtree.h"
  12. /* btfio.h *must* be included when bt_open() is used */
  13. #include "btfio.h"
  14.  
  15. #if AmigaDOS & LC
  16. #define printf iprintf   /* use fast integer printf */
  17. #endif
  18.  
  19. void main(argc, argv)
  20. int argc;
  21. char **argv;
  22. {
  23.    extern FILE *fopen();
  24.    extern long  ftell(), getroot();
  25.    extern int   strcat(), strlen(), toupper(), tolower(), open(), close();
  26.    extern char *strcpy(), *calloc();
  27.    extern void  exit(), free();
  28.    extern int   btprint();
  29.    BTC  btindex;
  30.    long rootptr;
  31.    int  pwidth, fdidx;
  32.  
  33.    wopen("CON:0/0/640/200/Btparcon");
  34.  
  35.    scr_clr();
  36.    scr_curs(5, 20);
  37.    printf(" Parsing  B-Tree Index...\n");
  38.  
  39.    /*  M A I N  C O N T R O L  P R O G R A M */
  40.  
  41.    getbname(argc, argv, &btindex);
  42.  
  43.    if ((fdidx = bt_open(btindex.idxname, O_RDWR)) == ERR)
  44.    {
  45.       printf("\nBTPARCON: can't open file '%s'", btindex.idxname);
  46.       printf("\nBTPARCON: check BTSETUP.EXE or rebuild index.");
  47.       exit(0);
  48.    }
  49.  
  50.    printf("\nB+tree Name : %s", btindex.btname);
  51.    printf("\nIndex File Name : %s", btindex.idxname);
  52.  
  53.    pwidth = 77;         /* display width   */
  54.  
  55.    rootptr = getroot(fdidx, btindex.findroot);   /* get ptr to root node */
  56.  
  57.    btprint(fdidx, stdout, rootptr, pwidth, &btindex, argc == 3);
  58.  
  59.    close(fdidx);
  60.    btrterm(&btindex);
  61.  
  62.    wclose();   /* close Amiga window */
  63.  
  64.    printf("\n");
  65. }
  66.  
  67.