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 lan88x liest z88.dyn aus und stellt Sprache fest
37 *  hier werden die Files Z88X.LOG und Z88.DYN geoeffnet
38 *  30.7.2011 Rieg
39 ***********************************************************************/
40 
41 /***********************************************************************
42 * Fuer UNIX
43 ***********************************************************************/
44 #ifdef FR_UNIX
45 #include <z88x.h>
46 #include <stdio.h>   /* FILE,NULL,fopen,fclose,fgets,sscanf */
47 #include <string.h>  /* strstr */
48 #endif
49 
50 /***********************************************************************
51 * Fuer Windows
52 ***********************************************************************/
53 #ifdef FR_WIN
54 #include <z88x.h>
55 #include <stdio.h>   /* FILE,NULL,fopen,fclose,fgets,sscanf */
56 #include <string.h>  /* strstr */
57 #endif
58 
59 /***********************************************************************
60 *  Functions
61 ***********************************************************************/
62 int wlog88x(FR_INT4,int);
63 
64 /***********************************************************************
65 *  hier beginnt Function lan88x
66 ***********************************************************************/
lan88x(void)67 int lan88x(void)
68 {
69 extern FILE *fdyn, *fwlo;
70 extern char cdyn[];
71 extern char clgd[];
72 
73 extern FR_INT4 LANG;
74 
75 char cline[256];
76 
77 /*----------------------------------------------------------------------
78 *  Log-Datei z88x.log oeffnen, erste Eintragungen
79 *---------------------------------------------------------------------*/
80 fwlo= fopen(clgd, "w+");
81 if(fwlo == NULL)
82   return(AL_NOLOG);
83 
84 rewind(fwlo);
85 
86 wlog88x(0,LOG_BZ88X);
87 
88 /*----------------------------------------------------------------------
89 *  dyn-datei z88.dyn oeffnen
90 *---------------------------------------------------------------------*/
91 wlog88x(0,LOG_OPENZ88DYN);
92 
93 fdyn= fopen(cdyn,"r");
94 if(fdyn == NULL)
95   {
96   wlog88x(0,LOG_NODYN);
97   fclose(fwlo);
98   return(AL_NODYN);
99   }
100 
101 rewind(fdyn);
102 
103 /*----------------------------------------------------------------------
104 *  dyn-datei z88.dyn lesen
105 *---------------------------------------------------------------------*/
106 fgets(cline,256,fdyn);
107 
108 if( (strstr(cline,"DYNAMIC START"))!= NULL)         /* Lesen File */
109   {
110   do
111     {
112     fgets(cline,256,fdyn);
113     if( (strstr(cline,"GERMAN"))!= NULL)  LANG = 1;
114     if( (strstr(cline,"ENGLISH"))!= NULL) LANG = 2;
115     }
116   while( (strstr(cline,"DYNAMIC END"))== NULL);
117   }                                                 /* end if DYNAMIC START */
118 else
119   {
120   LANG = 2;                                         /* Englisch */
121   wlog88x(0,LOG_WRONGDYN);
122   fclose(fwlo);
123   return(AL_WRONGDYN);
124   }
125 
126 /*----------------------------------------------------------------------
127 *  korrekt gelesen, file fdyn schliessen
128 *---------------------------------------------------------------------*/
129 fclose(fdyn);
130 
131 /*----------------------------------------------------------------------
132 *  sicherheitshalber englisch einstellen
133 *---------------------------------------------------------------------*/
134 if(LANG == 0) LANG = 2;
135 
136 return(0);
137 }
138 
139