| 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 |
#ifdef HAVE_LIBKPATHSEA2 |
| 97 |
kpse_set_progname(progname); /* */ |
| 98 |
#else |
| 99 |
kpse_set_program_name(progname, "bibtool"); /* */ |
| 100 |
#endif |
| 101 |
#endif |
| 102 |
/* */ |
| 103 |
init_type(); /* */ |
| 104 |
init_symbols(); /* */ |
| 105 |
init_entries(); /* */ |
| 106 |
init_read(); /* */ |
| 107 |
/* */ |
| 108 |
set_rsc_path(rsc_v_rsc); /* */ |
| 109 |
/* */ |
| 110 |
init_macros(); /* */ |
| 111 |
init_read(); /* */ |
| 112 |
} /*------------------------*/ |