forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmisc.cpp
37 lines (32 loc) · 955 Bytes
/
misc.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "misc.hpp"
FILE* port_open(const char* command, const char* type) {
#ifdef _WIN32
return _popen(command, type);
#elif defined(__linux) || defined(__EMSCRIPTEN__) || defined(__APPLE__)
return popen(command, type);
#endif
}
int port_close(FILE* stream) {
#ifdef _WIN32
return _pclose(stream);
#elif defined(__linux) || defined(__EMSCRIPTEN__) || defined(__APPLE__)
return pclose(stream);
#endif
}
int set_environment(const char* name, const char* value, int overwrite) {
#ifdef _WIN32
return _putenv_s(name, value);
#elif defined(__linux) || defined(__EMSCRIPTEN__) || defined(__APPLE__)
return setenv(name, value, overwrite);
#endif
}
int unset_environment(const char* name) {
#ifdef _WIN32
return _putenv_s(name, "");
#elif defined(__linux) || defined(__EMSCRIPTEN__) || defined(__APPLE__)
return unsetenv(name);
#endif
}