OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
radioss_set_env_variable.c
Go to the documentation of this file.
1//Copyright> OpenRadioss
2//Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3//Copyright>
4//Copyright> This program is free software: you can redistribute it and/or modify
5//Copyright> it under the terms of the GNU Affero General Public License as published by
6//Copyright> the Free Software Foundation, either version 3 of the License, or
7//Copyright> (at your option) any later version.
8//Copyright>
9//Copyright> This program is distributed in the hope that it will be useful,
10//Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11//Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12//Copyright> GNU Affero General Public License for more details.
13//Copyright>
14//Copyright> You should have received a copy of the GNU Affero General Public License
15//Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16//Copyright>
17//Copyright>
18//Copyright> Commercial Alternative: Altair Radioss Software
19//Copyright>
20//Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21//Copyright> software under a commercial license. Contact Altair to discuss further if the
22//Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23#include <stdio.h>
24#include <string.h>
25#include <stdlib.h>
26#include <math.h>
27#include <fcntl.h>
28
29#ifdef _WIN64
30#include <windows.h>
31#include <process.h>
32#include <io.h>
33#include <sys\types.h>
34#include <sys/stat.h>
35#elif 1
36#include <sys/resource.h>
37#include <sys/types.h>
38#include <time.h>
39#include <sys/stat.h>
40#include <unistd.h>
41#include <dlfcn.h>
42#endif
43
44#define _FCALL
45
46void radioss_set_env_variable(char *variable,char * value, int *len_value)
47{
48 int result;
49 char *path_name ;
50 path_name = (char *) calloc(*len_value+1, sizeof (char));
51
52#ifdef _WIN64
53 char env_string[10192];
54 size_t len=10192;
55
56 env_string[0]='\0';
57 strcat_s(env_string,len,variable);
58 strcat_s(env_string,len,"=");
59 strcat_s(env_string,len,value);
60 _putenv(env_string);
61
62#elif 1
63 strncpy(path_name,value, *len_value);
64 result=setenv(variable,path_name,1);
65#endif
66}
67
68void _FCALL RADIOSS_SET_ENV_VARIABLE(char *value , int *len_value)
69{
70 char *variable="TMPDIR";
71 radioss_set_env_variable(variable,value,len_value);
72}
73
74void radioss_set_env_variable_(char *value, int *len_value)
75{
76 char *variable="TMPDIR";
77 radioss_set_env_variable(variable,value,len_value);
78}
79
80void radioss_set_env_variable__(char *value, int *len_value)
81{
82 char *variable="TMPDIR";
83 radioss_set_env_variable(variable,value,len_value);
84}
85
86
87//void rad_test_env_(){
88// char *tmpdir="/work/roguic/sortie_tmp";
89// char *variable="TMPDIR";
90// radioss_set_env_variable(variable,tmpdir);
91//}
92
93
94
#define _FCALL
void _FCALL RADIOSS_SET_ENV_VARIABLE(char *value, int *len_value)
void radioss_set_env_variable__(char *value, int *len_value)
void radioss_set_env_variable(char *variable, char *value, int *len_value)
void radioss_set_env_variable_(char *value, int *len_value)