C++ Library containing a lot of needful things: Stack Trace, Command Line Parser, Resource Handling, Configuration Files, Unix Command Execution, Directories, Regular Expressions, Tokenizer, Function Trace, Standard Extensions.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.6 KiB
62 lines
1.6 KiB
20 years ago
|
/** @file
|
||
|
|
||
|
$Id$
|
||
|
|
||
|
$Date$
|
||
|
$Author$
|
||
|
@copy © Marc Wäckerlin
|
||
|
@license LGPL, see file <a href="license.html">COPYING</a>
|
||
|
|
||
|
$Log$
|
||
20 years ago
|
Revision 1.3 2005/02/28 07:29:18 marc
|
||
|
added ifdef for non glibc (Solaris)
|
||
|
|
||
20 years ago
|
Revision 1.2 2005/02/18 15:53:07 marc
|
||
|
I'm so stupid, there's strerror for mapping errno to a string...
|
||
|
|
||
20 years ago
|
Revision 1.1 2005/02/08 12:30:22 marc
|
||
|
new in release 1.8.0
|
||
|
|
||
|
|
||
|
1 2 3 4 5 6 7 8
|
||
|
5678901234567890123456789012345678901234567890123456789012345678901234567890
|
||
|
*/
|
||
|
|
||
13 years ago
|
#include <mrw/errno.hxx>
|
||
|
#include <mrw/string.hxx>
|
||
|
#include <mrw/stdext.hxx>
|
||
20 years ago
|
#include <errno.h>
|
||
20 years ago
|
#include <string.h>
|
||
20 years ago
|
|
||
18 years ago
|
mrw::Errno::Errno() throw(): _errnoxxx(errno) {}
|
||
20 years ago
|
|
||
|
mrw::Errno::operator std::string() const throw(std::bad_exception) {
|
||
18 years ago
|
return *this;
|
||
20 years ago
|
}
|
||
|
|
||
|
std::string mrw::Errno::string() const throw(std::bad_exception) {
|
||
18 years ago
|
char* pos(0);
|
||
20 years ago
|
char error[1024];
|
||
18 years ago
|
#ifdef __GLIBC__
|
||
|
# if defined __USE_XOPEN2K && !defined __USE_GNU
|
||
|
return strerror_r(errno=_errnoxxx, error, 1024)!=-1
|
||
|
? error+std::string(" errno=")+_errnoxxx
|
||
|
: std::string("errno=")+_errnoxxx;
|
||
|
# else
|
||
|
return (pos=strerror_r(errno=_errnoxxx, error, 1024))
|
||
|
? pos+std::string(" errno=")+_errnoxxx
|
||
|
: std::string("errno=")+_errnoxxx;
|
||
|
# endif
|
||
20 years ago
|
#else
|
||
18 years ago
|
# if defined __USE_XOPEN2K && !defined __USE_GNU
|
||
|
return strerror_r(errno=_errnoxxx, error, 1024)!=-1
|
||
|
? error+std::string(" errno=")+_errnoxxx
|
||
|
: std::string("errno=")+_errnoxxx;
|
||
|
# else
|
||
|
return (pos=strerror(errno=_errnoxxx))
|
||
|
? error+std::string(" errno=")+_errnoxxx
|
||
|
: std::string("errno=")+_errnoxxx;
|
||
|
# endif
|
||
20 years ago
|
#endif
|
||
20 years ago
|
}
|