DCL 4.0
Loading...
Searching...
No Matches
_stdlib.h File Reference
#include <dcl/Config.h>
#include <stdlib.h>

Go to the source code of this file.

Macros

#define __DCL_STDLIB_H__   20110918

Functions

DCLCAPI int __getenv (const String &_name, String &_value)
DCLCAPI int __setenv (const String &_name, const String &_value, bool _overwrite=true)
DCLCAPI int __unsetenv (const String &_name)
DCLCAPI int __realpath (const String &_path, String &_resolved)

Macro Definition Documentation

◆ __DCL_STDLIB_H__

#define __DCL_STDLIB_H__   20110918

Definition at line 2 of file _stdlib.h.

Function Documentation

◆ __getenv()

DCLCAPI int __getenv ( const String & _name,
String & _value )
Returns
== NULL or -1, see errno 환경변수에서 일치하는 것이 없으면 errno를 ENOENT로 설정하고 -1을 반환한다

Definition at line 40 of file _stdlib.cpp.

41{
42 STRTOMBS_ER(_name, name);
43 char* s = ::getenv(name);
44 if (s) {
45 MBSTOSTR_ER(s, (size_t) -1, _value);
46 return 0;
47 }
48 errno = ENOENT;
49 return -1;
50}
#define STRTOMBS_ER(str, mbs)
Definition __strumbs.h:33
#define MBSTOSTR_ER(mbs, nmbs, str)
Definition __strumbs.h:19

◆ __realpath()

DCLCAPI int __realpath ( const String & _path,
String & _resolved )

Definition at line 65 of file _stdlib.cpp.

66{
67 char resolved[PATH_MAX + 1];
68 STRTOMBS_ER(_path, path);
69 char* s = ::realpath(path, resolved);
70 if (s) {
71 MBSTOSTR_ER(s, (size_t)-1, _resolved);
72 return 0;
73 }
74 return -1;
75}

◆ __setenv()

DCLCAPI int __setenv ( const String & _name,
const String & _value,
bool _overwrite = true )

Definition at line 52 of file _stdlib.cpp.

53{
54 STRTOMBS_ER(_name, name);
55 STRTOMBS_ER(_value, value);
56 return ::setenv(name, value, _overwrite ? 1 : 0);
57}

◆ __unsetenv()

DCLCAPI int __unsetenv ( const String & _name)

Definition at line 59 of file _stdlib.cpp.

60{
61 STRTOMBS_ER(_name, name);
62 return ::unsetenv(name);
63}