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-pcap-bpf.c

    r8a8e54b r8f80e87  
    5151struct libtrace_t *trace;
    5252
     53void iferr(libtrace_t *trace)
     54{
     55        libtrace_err_t err = trace_get_err(trace);
     56        if (err.err_num==0)
     57                return;
     58        printf("Error: %s\n",err.problem);
     59        exit(1);
     60}
     61
    5362int main(int argc, char *argv[]) {
    5463        char *uri = "pcap:traces/100_packets.pcap";
     
    6069
    6170        trace = trace_create(uri);
    62         if (!trace) {
    63                 printf("ERROR: %s\n",trace_get_err(trace).problem);
    64                 return 1;
    65         }
     71        iferr(trace);
    6672
    6773        trace_config(trace,TRACE_OPTION_FILTER,filter);
     74        iferr(trace);
    6875
    6976        if (trace_start(trace)==-1) {
    70                 printf("ERROR: %s\n",trace_get_err(trace).problem);
    71                 return 1;
     77                iferr(trace);
    7278        }
    7379       
     
    9399                }
    94100        } else {
    95                 printf("failure: %s\n",trace_get_err(trace).problem);
     101                iferr(trace);
    96102        }
    97103        trace_destroy(trace);
Note: See TracChangeset for help on using the changeset viewer.