(root)/
man-db-2.12.0/
libdb/
db_storage.h
       1  /*
       2   * db_storage.h: define mandata structure, some macros and prototypes
       3   *
       4   * Copyright (C) 1994, 1995 Graeme W. Wilford. (Wilf.)
       5   * Copyright (C) 2002, 2003, 2007, 2008 Colin Watson.
       6   *
       7   * This file is part of man-db.
       8   *
       9   * man-db is free software; you can redistribute it and/or modify it
      10   * under the terms of the GNU General Public License as published by
      11   * the Free Software Foundation; either version 2 of the License, or
      12   * (at your option) any later version.
      13   *
      14   * man-db is distributed in the hope that it will be useful, but
      15   * WITHOUT ANY WARRANTY; without even the implied warranty of
      16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17   * GNU General Public License for more details.
      18   *
      19   * You should have received a copy of the GNU General Public License
      20   * along with man-db; if not, write to the Free Software Foundation,
      21   * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
      22   *
      23   * Sat Oct 29 13:09:31 GMT 1994  Wilf. (G.Wilford@ee.surrey.ac.uk)
      24   */
      25  
      26  #ifndef DB_STORAGE_H
      27  #define DB_STORAGE_H
      28  
      29  #include <stdbool.h>
      30  
      31  #include "gl_list.h"
      32  
      33  /* These definitions give an inherent precedence to each particular type
      34     of manual page:
      35  
      36     ULT_MAN:	ultimate manual page, the full source nroff file.
      37     SO_MAN:	source nroff file containing .so request to an ULT_MAN.
      38     WHATIS_MAN:	virtual `whatis referenced' page pointing to an ULT_MAN.
      39     STRAY_CAT:	pre-formatted manual page with no source.
      40     WHATIS_CAT:  virtual `whatis referenced' page pointing to a STRAY_CAT. */
      41  
      42  /* WHATIS_MAN and WHATIS_CAT are deprecated. */
      43  
      44  #define ULT_MAN		'A'
      45  #define SO_MAN		'B'
      46  #define WHATIS_MAN	'C'
      47  #define STRAY_CAT	'D'
      48  #define WHATIS_CAT	'E'
      49  
      50  #define FIELDS  10      /* No of fields in each database page `content' */
      51  
      52  #include "filenames.h"
      53  
      54  #include "mydbm.h"
      55  
      56  struct name_ext {
      57  	const char *name;
      58  	const char *ext;
      59  };
      60  
      61  /* used by the world */
      62  extern gl_list_t dblookup_all (MYDBM_FILE dbf, const char *page,
      63  			       const char *section, bool match_case);
      64  extern struct mandata *dblookup_exact (MYDBM_FILE dbf, const char *page,
      65  				       const char *section, bool match_case);
      66  extern gl_list_t dblookup_pattern (MYDBM_FILE dbf, const char *page,
      67  				   const char *section, bool match_case,
      68  				   bool pattern_regex, bool try_descriptions);
      69  extern int dbstore (MYDBM_FILE dbf, struct mandata *in, const char *base);
      70  extern int dbdelete (MYDBM_FILE dbf, const char *name, struct mandata *in);
      71  extern void dbprintf (const struct mandata *info);
      72  extern struct mandata *split_content (MYDBM_FILE dbf, char *cont_ptr);
      73  extern int compare_ids (char a, char b, bool promote_links);
      74  
      75  /* local to db routines */
      76  extern void gripe_lock (const char *filename);
      77  extern void gripe_corrupt_data (MYDBM_FILE dbf);
      78  extern datum make_multi_key (const char *page, const char *ext);
      79  
      80  extern char *name_to_key (const char *name);
      81  bool name_ext_equals (const void *elt1, const void *elt2);
      82  int name_ext_compare (const void *elt1, const void *elt2);
      83  /* Returns a list of struct name_ext. */
      84  extern gl_list_t list_extensions (char *data);
      85  extern void gripe_replace_key (MYDBM_FILE dbf, const char *data);
      86  extern const char *dash_if_unset (const char *str);
      87  
      88  #endif