Ignore:
Timestamp:
03/03/06 17:26:25 (7 years ago)
Author:
perry
Message:

Port to the newer libtrace, add manpage and test case

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/tracemerge/tracemerge.c

    r551 r640  
    4747        } 
    4848 
    49         if (optind+2<argc) 
     49        if (optind+2>argc) 
    5050                usage(argv[0]); 
    5151 
    5252        output=trace_create_output(argv[optind]); 
    53         if (!output) { 
    54                 fprintf(stderr,"Unable to open output file %s\n",argv[optind]); 
     53        if (trace_is_err_output(output)) { 
     54                trace_perror_output(output,"trace_create"); 
     55                return 1; 
     56        } 
     57        if (trace_start_output(output)==-1) { 
     58                trace_perror_output(output,"trace_start"); 
    5559                return 1; 
    5660        } 
     
    6367                struct libtrace_packet_t *p; 
    6468                f=trace_create(argv[i+optind]); 
     69                if (trace_is_err(f)) { 
     70                        trace_perror(f,"trace_create"); 
     71                        return 1; 
     72                } 
     73                if (trace_start(f)==-1) { 
     74                        trace_perror(f,"trace_start"); 
     75                        return 1; 
     76                } 
    6577                p=trace_create_packet(); 
    6678                input[i]=f; 
    6779                packet[i]=p; 
    68                 if (!input[i]) { 
    69                         fprintf(stderr,"Could not read %s\n",argv[i+optind]); 
    70                         return 1; 
    71                 } 
    7280                trace_read_packet(f,p); 
    7381        } 
Note: See TracChangeset for help on using the changeset viewer.