1 : //=============================================================================
2 : // File <$/src/cpp/prod/tool/Error.cpp>
3 : // This file is part of YaOrb : Yet Another Object Request Broker,
4 : // Copyright (c) 2000-2003, Marc Alff.
5 : //
6 : // This program is free software; you can redistribute it and/or
7 : // modify it under the terms of the GNU General Public License
8 : // as published by the Free Software Foundation; either version 2
9 : // of the License, or (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License
17 : // along with this program; if not, write to the Free Software
18 : // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 : //
20 : //=============================================================================
21 :
22 : // Portability
23 : #include "yaorb/config.h"
24 : #include "src/cpp/prod/port/port_stdc.h"
25 :
26 : #include <stdio.h>
27 :
28 : #include "src/cpp/prod/tool/Error.h"
29 : #include "src/cpp/prod/tool/String.h"
30 :
31 : void Error(
32 : const char* file,
33 : const int line,
34 : const char* text,
35 8 : int err)
36 : {
37 8 : const char* str = strerror(err) ;
38 : char buf[80] ;
39 :
40 8 : sprintf(buf, " - Line = %d\n", line) ;
41 :
42 8 : String message ;
43 8 : message = "An error occured :\n" ;
44 8 : message += " - File = " ;
45 8 : message += file ;
46 8 : message += "\n" ;
47 8 : message += buf ;
48 8 : message += " - Operating system error = " ;
49 8 : message += str ;
50 8 : message += "\n" ;
51 8 : message += " - Comments = " ;
52 8 : message += text ;
53 8 : message += "\n" ;
54 :
55 8 : const char* msg = message ;
56 :
57 8 : fprintf(stderr, msg) ;
58 :
59 0 : return ;
60 : }
61 :
|