1 /***********************************************************************
2 *
3 *               *****   ***    ***
4 *                  *   *   *  *   *
5 *                 *     ***    ***
6 *                *     *   *  *   *
7 *               *****   ***    ***
8 *
9 * A FREE Finite Elements Analysis Program in ANSI C for the UNIX and
10 * the Windows OS.
11 *
12 * Composed and edited and copyright by
13 * Professor Dr.-Ing. Frank Rieg, University of Bayreuth, Germany
14 *
15 * eMail:
16 * frank.rieg@uni-bayreuth.de
17 * dr.frank.rieg@t-online.de
18 *
19 * V15.0  November 18, 2015
20 *
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 2, or (at your option)
24 * any later version.
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29 * GNU General Public License for more details.
30 *
31 * You should have received a copy of the GNU General Public License
32 * along with this program; see the file COPYING.  If not, write to
33 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
34 ***********************************************************************/
35 /***********************************************************************
36 *  function lan88h liest z88.dyn aus und stellt Sprache fest
37 *  hier werden die Files Z88H.LOG und Z88.DYN geoeffnet
38 *  16.7.2011 Rieg
39 ***********************************************************************/
40 
41 /***********************************************************************
42 * Fuer UNIX
43 ***********************************************************************/
44 #ifdef FR_UNIX
45 #include <z88h.h>
46 #include <stdio.h>   /* FILE,NULL,fopen,fclose,fgets,sscanf */
47                      /* rewind                              */
48 #include <string.h>  /* strstr */
49 #endif
50 
51 /***********************************************************************
52 * Fuer Windows
53 ***********************************************************************/
54 #ifdef FR_WIN
55 #include <z88h.h>
56 #include <stdio.h>   /* FILE,NULL,fopen,fclose,fgets,sscanf */
57                      /* rewind                              */
58 #include <string.h>  /* strstr */
59 #endif
60 
61 /***********************************************************************
62 *  Functions
63 ***********************************************************************/
64 int wlog88h(FR_INT4,int);
65 
66 /***********************************************************************
67 *  hier beginnt Function lan88h
68 ***********************************************************************/
lan88h(void)69 int lan88h(void)
70 {
71 extern FILE *fdyn, *fwlo;
72 extern char cdyn[];
73 extern char clgd[];
74 
75 extern FR_INT4 LANG;
76 
77 char cline[256];
78 
79 /*----------------------------------------------------------------------
80 *  Log- Datei z88h.log oeffnen, erste Eintragungen
81 *---------------------------------------------------------------------*/
82 fwlo= fopen(clgd, "w+");
83 if(fwlo == NULL)
84   return(AL_NOLOG);
85 
86 rewind(fwlo);
87 
88 wlog88h(0,LOG_BZ88);
89 
90 /*----------------------------------------------------------------------
91 *  dyn- datei z88.dyn oeffnen
92 *---------------------------------------------------------------------*/
93 wlog88h(0,LOG_OPENDYN);
94 
95 fdyn= fopen(cdyn,"r");
96 if(fdyn == NULL)
97   {
98   wlog88h(0,LOG_NODYN);
99   fclose(fwlo);
100   return(AL_NODYN);
101   }
102 
103 rewind(fdyn);
104 
105 /*----------------------------------------------------------------------
106 *  dyn- datei z88.dyn lesen
107 *---------------------------------------------------------------------*/
108 fgets(cline,256,fdyn);
109 
110 if( (strstr(cline,"DYNAMIC START"))!= NULL)         /* Lesen File */
111   {
112   do
113     {
114     fgets(cline,256,fdyn);
115     if( (strstr(cline,"GERMAN"))!= NULL) LANG = 1;
116     if( (strstr(cline,"ENGLISH"))!= NULL) LANG = 2;
117     }
118   while( (strstr(cline,"DYNAMIC END"))== NULL);
119   }                                                 /* end if DYNAMIC START */
120 else
121   {
122   LANG = 2;                                         /* Englisch */
123   wlog88h(0,LOG_WRONGDYN);
124   fclose(fwlo);
125   return(AL_WRONGDYN);
126   }
127 
128 /*----------------------------------------------------------------------
129 *  korrekt gelesen, file fdyn schliessen
130 *---------------------------------------------------------------------*/
131 fclose(fdyn);
132 
133 /*----------------------------------------------------------------------
134 *  sicherheitshalber englisch einstellen
135 *---------------------------------------------------------------------*/
136 if(LANG == 0) LANG = 2;
137 
138 return(0);
139 }
140 
141