1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
/* $Id: common.c,v 0.5 2000/12/20 14:29:45 kjc Exp kjc $ */
/*
* Copyright (c) 1996-2000
* Sony Computer Science Laboratories, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms of parts of or the
* whole original or derived work are permitted provided that the above
* copyright notice is retained and the original work is properly
* attributed to the author. The name of the author may not be used to
* endorse or promote products derived from this software without
* specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* common.c -- globals and routines common to all ttt programs. */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "ttt.h"
#ifndef NULL
#define NULL 0
#endif
char *ttt_version = TTT_VERSION;
/* globals which can set by tcl */
int ttt_interval = 1000; /* 1 sec interval to update graph */
int ttt_nohostname = 0; /* don't lookup host names */
int ttt_filter = 0; /* trace filter */
/* only used at startup */
char *ttt_interface = NULL; /* interface name for packet capturing */
char *ttt_dumpfile = NULL; /* tcpdump file to replay */
int ttt_speed = 1; /* replay speed */
struct timeval ttt_dumptime;
char *ttt_viewname = NULL;
char *ttt_mcastif = NULL;
int ttt_portno = TTT_PORT; /* receiver's port number */
int ttt_yscale = 1000000; /* scale of y axis (Mbps by default) */
#include <stdio.h>
#include <errno.h>
/*#include <varargs.h>*/
#include <stdarg.h>
void fatal_error(const char * fmt, ...)
{
va_list ap;
if (errno != 0)
perror("fatal_error");
else
fprintf(stderr, "fatal_error: ");
va_start(ap, fmt);
/* fmt = va_arg(ap, char *);*/
vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, "\n");
exit(1);
}
|