Changeset 1421

Show
Ignore:
Timestamp:
10/15/07 09:39:05 (11 months ago)
Author:
till
Message:

nebula
- names of input files can be passed as command line arguments

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nebula/trunk/src/nebula.c

    r1419 r1421  
    5858        int             i, qsize; 
    5959        u_char          time_sort, *content, *tmpbuf; 
    60         char            option, *dirname
     60        char            option, *dirname, *filename
    6161        hash            *tmp_hash; 
    6262        qelem           *cur_hq, *tmp_hq; 
     
    214214 
    215215        for (n=0; n<total_files; n++) { 
    216                 bstr = bstr_map(namelist[n]->d_name); 
     216                filename = (dirname ? namelist[n]->d_name : argv[n+i]); 
     217 
     218                bstr = bstr_map(filename); 
    217219                num_of_files++; 
    218220#ifdef PROFILE 
     
    221223#endif 
    222224 
    223                 if (verbose) printf("  processing file %s.\n", namelist[n]->d_name); 
     225                if (verbose) printf("  processing file %s.\n", filename); 
    224226                else if (show_progress) { 
    225227                        printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); 
     
    257259                        ((hash*)t->data)->cnt++; 
    258260                        // set filename 
    259                         if ((((hash*)t->data)->filename = strdup(namelist[n]->d_name)) == NULL) { 
     261                        if ((((hash*)t->data)->filename = strdup(filename)) == NULL) { 
    260262                                fprintf(stderr, "Error - Unable to allocate memory: %m.\n"); 
    261263                                exit(EXIT_FAILURE);