~ubuntu-branches/ubuntu/hardy/nast/hardy

« back to all changes in this revision

Viewing changes to error.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2004-02-17 22:14:21 UTC
  • Revision ID: james.westby@ubuntu.com-20040217221421-f1h39tzviblbp2lh
Tags: upstream-0.2.0
ImportĀ upstreamĀ versionĀ 0.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    nast - Network analyzer sniffer tool
 
3
 
 
4
    This program is free software; you can redistribute it and/or modify
 
5
    it under the terms of the GNU General Public License as published by
 
6
    the Free Software Foundation; either version 2 of the License, or
 
7
    (at your option) any later version.
 
8
 
 
9
    This program is distributed in the hope that it will be useful,
 
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
    GNU General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU General Public License
 
15
    along with this program; if not, write to the Free Software
 
16
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 
 
18
*/
 
19
 
 
20
/*  fatal error = 1
 
21
non-fatal error = 0
 
22
*/
 
23
 
 
24
#include "include/nast.h"
 
25
#include <stdarg.h>
 
26
 
 
27
int w_error(int fatal, char *err, ...);
 
28
 
 
29
int w_error(int fatal, char *err, ...)
 
30
{
 
31
   char error[100];
 
32
   int n,ris;
 
33
   va_list ap;
 
34
   ris = 0;
 
35
 
 
36
   va_start(ap, err);
 
37
   n = vsnprintf(error, 100, err, ap);
 
38
   va_end(ap);
 
39
 
 
40
#ifdef HAVE_LIBNCURSES
 
41
   if(graph){
 
42
     n_error(error, fatal);
 
43
     return -1;/*it returns -1 only if the error isn't fatal! */
 
44
     }
 
45
#endif
 
46
 
 
47
   fprintf(stderr, "\n%s\n\n", error);
 
48
   exit(-1);
 
49
}
 
50