Switch to unified view

a/sc2src/log.h b/sc2src/log.h
1
/* Copyright (C) 2014 J.F.Dockes
1
/* Copyright (C) 2014 J.F.Dockes
2
 *   This program is free software; you can redistribute it and/or modify
2
 *   This program is free software; you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
3
 *   it under the terms of the GNU Lesser General Public License as published by
4
 *   the Free Software Foundation; either version 2 of the License, or
4
 *   the Free Software Foundation; either version 2.1 of the License, or
5
 *   (at your option) any later version.
5
 *   (at your option) any later version.
6
 *
6
 *
7
 *   This program is distributed in the hope that it will be useful,
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
10
 *   GNU Lesser General Public License for more details.
11
 *
11
 *
12
 *   You should have received a copy of the GNU General Public License
12
 *   You should have received a copy of the GNU Lesser General Public License
13
 *   along with this program; if not, write to the
13
 *   along with this program; if not, write to the
14
 *   Free Software Foundation, Inc.,
14
 *   Free Software Foundation, Inc.,
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16
 */
16
 */
17
/* Copyright (C) 2006-2016 J.F.Dockes
17
/* Copyright (C) 2006-2016 J.F.Dockes
...
...
191
#else
191
#else
192
#define LOGFAT(X)
192
#define LOGFAT(X)
193
#endif
193
#endif
194
#define LOGFATAL LOGFAT
194
#define LOGFATAL LOGFAT
195
195
196
#if defined(sun) || defined(_WIN32)
197
#define LOGSYSERR(who, what, arg) {                                     \
198
        LOGERR(who << ": " << what << "("  << arg << "): errno " << errno << \
199
               ": " << strerror(errno) << std::endl);                   \
200
    }
201
#else // !WINDOWS->
196
#if (_POSIX_C_SOURCE >= 200112L) && !  _GNU_SOURCE
202
#if (_POSIX_C_SOURCE >= 200112L) && !  _GNU_SOURCE
197
#define LOGSYSERR(who, what, arg) {                                     \
203
#define LOGSYSERR(who, what, arg) {                                     \
198
        char buf[200]; buf[0] = 0; strerror_r(errno, buf, 200);         \
204
        char buf[200]; buf[0] = 0; strerror_r(errno, buf, 200);         \
199
        LOGERR(who << ": " << what << "("  << arg << "): errno " << errno << \
205
        LOGERR(who << ": " << what << "("  << arg << "): errno " << errno << \
200
               ": " << buf << std::endl);                               \
206
               ": " << buf << std::endl);                               \
...
...
204
        char buf[200]; buf[0] = 0;                                      \
210
        char buf[200]; buf[0] = 0;                                      \
205
        LOGERR(who << ": " << what << "("  << arg << "): errno " << errno << \
211
        LOGERR(who << ": " << what << "("  << arg << "): errno " << errno << \
206
               ": " << strerror_r(errno, buf, 200) << std::endl);       \
212
               ": " << strerror_r(errno, buf, 200) << std::endl);       \
207
    }
213
    }
208
#endif
214
#endif
215
#endif // not windows
216
209
#endif /* _LOG_H_X_INCLUDED_ */
217
#endif /* _LOG_H_X_INCLUDED_ */