1 // Copyright (C) 1999,2000 Bruce Guenter <bruceg@em.ca>
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16 
17 #include <config.h>
18 #include "fdbuf/fdbuf.h"
19 #include <stdlib.h>
20 #include "cli++.h"
21 
22 extern const char* argv0;
23 
cli_error(int exit_value,const char * a,const char * b,const char * c,const char * d)24 void cli_error(int exit_value,
25 	       const char* a,
26 	       const char* b,
27 	       const char* c,
28 	       const char* d)
29 {
30   cli_warning(a,b,c,d);
31   exit(exit_value);
32 }
33 
cli_warning(const char * a,const char * b,const char * c,const char * d)34 void cli_warning(const char* a,
35 	       const char* b,
36 	       const char* c,
37 	       const char* d)
38 {
39   ferr << cli_program << ": " << a;
40   if(b) ferr << b;
41   if(c) ferr << c;
42   if(d) ferr << d;
43   ferr << endl;
44 }
45