home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume20 / index-db / part01 / defs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-23  |  2.2 KB  |  90 lines

  1. /*
  2.  * $Header: /u5/davy/progs/index/RCS/defs.h,v 1.1 89/08/09 11:06:09 davy Exp $
  3.  *
  4.  * defs.h - definitions for the index program.
  5.  *
  6.  * David A. Curry
  7.  * Research Institute for Advanced Computer Science
  8.  * Mail Stop 230-5
  9.  * NASA Ames Research Center
  10.  * Moffett Field, CA 94035
  11.  * davy@riacs.edu
  12.  *
  13.  * $Log:    defs.h,v $
  14.  * Revision 1.1  89/08/09  11:06:09  davy
  15.  * Initial revision
  16.  * 
  17.  */
  18. #define PATCHLEVEL    0        /* level of patches applied    */
  19.  
  20. #define MAXDBFILES    64        /* max. no. of database files    */
  21. #define MAXDBLINES    16        /* max. no. of fields in dbase    */
  22.  
  23. #define EDITOR        "/usr/ucb/vi"    /* editor to use when creating    */
  24.  
  25. #define INDEXDIR    ".index"    /* directory where stuff is    */
  26. #define DBFILE_SUFFIX    ".db"        /* database file suffix        */
  27. #define FMTFILE_SUFFIX    ".fmt"        /* format program suffix    */
  28. #define IDXFILE_SUFFIX    ".idx"        /* index definition suffix    */
  29.  
  30. /*
  31.  * Values for db_flag.
  32.  */
  33. #define DB_VALID    0x01
  34. #define DB_PRINT    0x02
  35.  
  36. /*
  37.  * For 4.2 curses.
  38.  */
  39. #ifndef cbreak
  40. #define cbreak() crmode()
  41. #endif
  42. #ifndef nocbreak
  43. #define nocbreak() nocrmode()
  44. #endif
  45.  
  46. /*
  47.  * Usually defined in ttychars.h.
  48.  */
  49. #ifndef CTRL
  50. #define CTRL(c)        ('c' & 037)
  51. #endif
  52.  
  53. /*
  54.  * Structure to hold the contents of the index definition.
  55.  */
  56. struct idxfile {
  57.     int    idx_maxlen;        /* longest field length        */
  58.     int    idx_nlines;        /* number of lines per entry    */
  59.     char    idx_search[MAXDBLINES];    /* non-zero if field searchable    */
  60.     char    *idx_lines[MAXDBLINES];    /* strings naming the fields    */
  61. };
  62.  
  63. /*
  64.  * Structure to hold a database entry.
  65.  */
  66. struct dbfile {
  67.     int    db_flag;        /* flag, see above        */
  68.     int    db_lens[MAXDBLINES];    /* lengths of line contents    */
  69.     char    *db_lines[MAXDBLINES];    /* lines in the entry        */
  70. };
  71.  
  72. extern char    *pname;            /* program name            */
  73.  
  74. extern int    dbsize;            /* size of db array        */
  75. extern int    igncase;        /* non-zero if -i switch given    */
  76. extern int    verbose;        /* non-zero if -v switch given    */
  77. extern int    dbentries;        /* number of entries in db    */
  78. extern int    dbmodified;        /* non-zero if db needs saving    */
  79.  
  80. extern char    dbasedir[];        /* path to the INDEXDIR        */
  81.  
  82. extern struct    dbfile *db;        /* database entries array    */
  83. extern struct    idxfile idx;        /* index definition structure    */
  84.  
  85. char        *savestr();
  86. char        *select_db();
  87.  
  88. int        byebye();
  89. int        dbsort();
  90.