Changeset 8f80e87 for test/test-event.c


Ignore:
Timestamp:
03/13/06 11:00:46 (16 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
3d4fb8f
Parents:
b51edf5
Message:

Tidy up the tools and tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/test-event.c

    r8a8e54b r8f80e87  
    4646#include <sys/socket.h>
    4747#include <string.h>
     48#include <unistd.h>
    4849#include "dagformat.h"
    4950#include "libtrace.h"
    5051
    5152struct libtrace_t *trace;
     53
     54void iferr(libtrace_t *trace)
     55{
     56        libtrace_err_t err = trace_get_err(trace);
     57        if (err.err_num==0)
     58                return;
     59        printf("Error: %s\n",err.problem);
     60        exit(1);
     61}
    5262
    5363int main(int argc, char *argv[]) {
     
    5969
    6070        trace = trace_create(uri);
     71        iferr(trace);
    6172
    6273        trace_start(trace);
     74        iferr(trace);
    6375       
    6476        packet=trace_create_packet();
     
    8698                        break;
    8799                }
     100                iferr(trace);
    88101        }
    89102        trace_destroy_packet(&packet);
     
    96109                }
    97110        } else {
    98                 printf("failure: %s\n",trace_get_err(trace).problem);
     111                iferr(trace);
    99112        }
    100113        trace_destroy(trace);
Note: See TracChangeset for help on using the changeset viewer.