DCL 3.7.4
Loading...
Searching...
No Matches
_stdlib.cpp File Reference
#include <dcl/Config.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <dcl/_stdlib.h>
#include <dcl/Object.h>
#include "__strumbs.h"

Go to the source code of this file.

Functions

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

Function Documentation

◆ __getenv()

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

Definition at line 57 of file _stdlib.cpp.

58{
59 STRTOMBS_ER(_name, name);
60 char* s = getenv(name);
61 if (s) {
62 MBSTOSTR_ER(s, (size_t) -1, _value);
63 return 0;
64 }
65 errno = ENOENT;
66 return -1;
67}
#define STRTOMBS_ER(str, mbs)
Definition __strumbs.h:33
#define MBSTOSTR_ER(mbs, nmbs, str)
Definition __strumbs.h:19

◆ __realpath()

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

Definition at line 83 of file _stdlib.cpp.

84{
85 char resolved[PATH_MAX + 1];
86 STRTOMBS_ER(_path, path);
87 char* s = ::realpath(path, resolved);
88 if (s) {
89 MBSTOSTR_ER(s, (size_t)-1, _resolved);
90 return 0;
91 }
92 return -1;
93}

◆ __setenv()

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

Definition at line 69 of file _stdlib.cpp.

70{
71 STRTOMBS_ER(_name, name);
72 STRTOMBS_ER(_value, value);
73 return setenv(name, value, _overwrite ? 1 : 0);
74}

◆ __unsetenv()

int __unsetenv ( const String & _name)

Definition at line 76 of file _stdlib.cpp.

77{
78 STRTOMBS_ER(_name, name);
79 return unsetenv(name);
80}