1 /*-----------------------------------------------------------------------
2 
3 File  : cio_initio.c
4 
5 Author: Stephan Schulz (schulz@eprover.org)
6 
7 Contents
8 
9   Trivial initialization code.
10 
11   Copyright 2005 by the author.
12   This code is released under the GNU General Public Licence and
13   the GNU Lesser General Public License.
14   See the file COPYING in the main E directory for details..
15   Run "eprover -h" for contact information.
16 
17 Changes
18 
19 <1> Thu Mar 17 11:27:30 UYT 2005
20     New
21 
22 -----------------------------------------------------------------------*/
23 
24 #include "cio_initio.h"
25 
26 
27 /*---------------------------------------------------------------------*/
28 /*                        Global Variables                             */
29 /*---------------------------------------------------------------------*/
30 
31 
32 char* TPTP_dir = NULL;
33 
34 /*---------------------------------------------------------------------*/
35 /*                      Forward Declarations                           */
36 /*---------------------------------------------------------------------*/
37 
38 
39 /*---------------------------------------------------------------------*/
40 /*                         Internal Functions                          */
41 /*---------------------------------------------------------------------*/
42 
43 
44 
45 /*---------------------------------------------------------------------*/
46 /*                         Exported Functions                          */
47 /*---------------------------------------------------------------------*/
48 
49 
50 /*-----------------------------------------------------------------------
51 //
52 // Function: InitIO()
53 //
54 //   Initialize I/O. Bundles a number of other initializations in one
55 //   call.
56 //
57 // Global Variables: TPTP_dir
58 //
59 // Side Effects    : -
60 //
61 /----------------------------------------------------------------------*/
62 
InitIO(char * progname)63 void InitIO(char* progname)
64 {
65    char* tmp;
66 
67    InitOutput();
68    InitError(progname);
69 
70    tmp = getenv("TPTP");
71    if(tmp)
72    {
73       DStr_p tmpstr = DStrAlloc();
74 
75       DStrAppendStr(tmpstr, tmp);
76       if(DStrLen(tmpstr) && DStrLastChar(tmpstr)!='/')
77       {
78          DStrAppendChar(tmpstr, '/');
79       }
80       TPTP_dir = DStrCopy(tmpstr);
81 
82       DStrFree(tmpstr);
83    }
84 }
85 
86 
87 /*-----------------------------------------------------------------------
88 //
89 // Function: ExitIO()
90 //
91 //   Clear up (variables)
92 //
93 // Global Variables: TPTP_dir
94 //
95 // Side Effects    : -
96 //
97 /----------------------------------------------------------------------*/
98 
99 
ExitIO(void)100 void ExitIO(void)
101 {
102    if(TPTP_dir)
103    {
104       FREE(TPTP_dir);
105       TPTP_dir = NULL;
106    }
107 }
108 
109 
110 /*---------------------------------------------------------------------*/
111 /*                        End of File                                  */
112 /*---------------------------------------------------------------------*/
113 
114 
115