1 Debian patch touch this file
| 1 | /*** init.c ******************************************************************* |
| 2 | ** |
| 3 | ** This file is part of BibTool. |
| 4 | ** It is distributed under the GNU General Public License. |
| 5 | ** See the file COPYING for details. |
| 6 | ** |
| 7 | ** (c) 1996-2020 Gerd Neugebauer |
| 8 | ** |
| 9 | ** Net: [email protected] |
| 10 | ** |
| 11 | ** This program is free software; you can redistribute it and/or modify |
| 12 | ** it under the terms of the GNU General Public License as published by |
| 13 | ** the Free Software Foundation; either version 2, or (at your option) |
| 14 | ** any later version. |
| 15 | ** |
| 16 | ** This program is distributed in the hope that it will be useful, |
| 17 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | ** GNU General Public License for more details. |
| 20 | ** |
| 21 | ** You should have received a copy of the GNU General Public License |
| 22 | ** along with this program; if not, write to the Free Software |
| 23 | ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 24 | ** |
| 25 | **----------------------------------------------------------------------------- |
| 26 | ** Description: |
| 27 | ** This module contains the global initialization function which |
| 28 | ** has to be called before any modules in \BibTool{} are |
| 29 | ** activated. This is for convenience, thus nobody has to call |
| 30 | ** the various initialization functions for the different modules |
| 31 | ** by hand. |
| 32 | ******************************************************************************/ |
| 33 | |
| 34 | #include <bibtool/general.h> |
| 35 | #include <bibtool/rsc.h> |
| 36 | #include <bibtool/key.h> |
| 37 | #include <bibtool/entry.h> |
| 38 | #include <bibtool/symbols.h> |
| 39 | #include <bibtool/macros.h> |
| 40 | #include <bibtool/parse.h> |
| 41 | #include <bibtool/sbuffer.h> |
| 42 | #include "config.h" |
| 43 | #ifdef HAVE_LIBKPATHSEA |
| 44 | #ifdef __STDC__ |
| 45 | #define HAVE_PROTOTYPES |
| 46 | #endif |
| 47 | #include <kpathsea/proginit.h> |
| 48 | #include <kpathsea/progname.h> |
| 49 | #endif |
| 50 | |
| 51 | /*****************************************************************************/ |
| 52 | /* Internal Programs */ |
| 53 | /*===========================================================================*/ |
| 54 | |
| 55 | /*****************************************************************************/ |
| 56 | /* External Programs */ |
| 57 | /*===========================================================================*/ |
| 58 | |
| 59 | /*---------------------------------------------------------------------------*/ |
| 60 | |
| 61 | |
| 62 | /*----------------------------------------------------------------------------- |
| 63 | ** Function: init_bibtool() |
| 64 | ** Purpose: Perform any initializations necessary for \BibTool. |
| 65 | ** |
| 66 | ** |
| 67 | ** Arguments: |
| 68 | ** progname Name of the program for |KPATHSEA|. |
| 69 | ** Returns: nothing |
| 70 | **___________________________________________________ */ |
| 71 | void init_bibtool(progname) /* */ |
| 72 | char * progname; /* */ |
| 73 | { /* */ |
| 74 | #ifdef EMTEX_LIKE_PATH |
| 75 | static StringBuffer *sb_rsc; /* */ |
| 76 | static StringBuffer *sb_bibtex; /* */ |
| 77 | /* */ |
| 78 | { char *emtexdir = getenv(EMTEXDIR); /* */ |
| 79 | if ( emtexdir == NULL ) emtexdir = EMTEXTDIR_DEFAULT;/* */ |
| 80 | sb_rsc = sbopen(); /* */ |
| 81 | sbputs(".;",sb_rsc); /* */ |
| 82 | sbputs(emtexdir,sb_rsc); /* */ |
| 83 | sbputs(EMTEXT_RESOURCE,sb_rsc); /* */ |
| 84 | rsc_v_rsc = sbflush(sb_rsc); /* */ |
| 85 | sb_bibtex = sbopen(); /* */ |
| 86 | sbputs(".;",sb_bibtex); /* */ |
| 87 | sbputs(emtexdir,sb_bibtex); /* */ |
| 88 | sbputs(EMTEXT_BIBTEX,sb_bibtex); /* */ |
| 89 | rsc_v_bibtex = sbflush(sb_bibtex); /* */ |
| 90 | } /* */ |
| 91 | #endif |
| 92 | /* */ |
| 93 | POSSIBLY_UNUSED(progname); /* */ |
| 94 | /* */ |
| 95 | #ifdef HAVE_LIBKPATHSEA |
| 96 | kpse_set_program_name(progname, "bibtool"); /* */ |
| 97 | #endif |
| 98 | /* */ |
| 99 | init_type(); /* */ |
| 100 | init_symbols(); /* */ |
| 101 | init_entries(); /* */ |
| 102 | init_read(); /* */ |
| 103 | /* */ |
| 104 | set_rsc_path(rsc_v_rsc); /* */ |
| 105 | /* */ |
| 106 | init_macros(); /* */ |
| 107 | init_read(); /* */ |
| 108 | } /*------------------------*/ |