Changeset 1561

Show
Ignore:
Timestamp:
12/03/04 13:07:12 (4 years ago)
Author:
whmoseley
Message:

Logic error caught by Paul Loner

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/swish-e/src/swish.c

    r1553 r1561  
    294294    printf("         -R : next param is Rank Scheme number (0 to 1)  [0].\n"); 
    295295#ifdef USE_BTREE 
    296        printf("         -r : remove: remove files from index\n"); 
     296        printf("         -r : remove: remove files from index\n"); 
    297297#endif 
    298298 
     
    345345 
    346346 
    347 /*  
    348   -- init swish structure  
     347/* 
     348  -- init swish structure 
    349349*/ 
    350350 
     
    672672            case 'd':  /* old-style custom delimiter */ 
    673673            case 'o':  /* don't use pre-sorted indexes */ 
    674            case 'R':  /* Ranking Scheme -- default is 1 */ 
     674            case 'R':  /* Ranking Scheme -- default is 1 */ 
    675675                argv = fetch_search_params( sw, argv, params, c ); 
    676676                break; 
     
    711711                    progerr(" '-k' requires a character (or '*')."); 
    712712 
    713                 if ( strlen( w ) != 1 )                 
     713                if ( strlen( w ) != 1 ) 
    714714                    progerr(" '-k' requires a character (or '*')."); 
    715715 
     
    846846        { 
    847847            if ( !is_another_param( argv ) ) 
    848                 progerr(" '-i' requires a list of index files."); 
    849  
    850             if((params->run_mode != MODE_UPDATE) || 
    851                (params->run_mode != MODE_REMOVE))   /* Preserve update mode */ 
     848                progerr(" '-i' requires a list of things to index."); 
     849 
     850            /* Set run_mode to index, unless in update/remove mode */ 
     851 
     852            if ( (params->run_mode != MODE_UPDATE) && (params->run_mode != MODE_REMOVE) ) 
    852853                params->run_mode = MODE_INDEX; 
    853854 
     
    892893 
    893894            if((params->run_mode != MODE_UPDATE) || 
    894                (params->run_mode != MODE_REMOVE))  /* Preserve update mode */  
     895               (params->run_mode != MODE_REMOVE))  /* Preserve update mode */ 
    895896                params->run_mode = MODE_INDEX; 
    896897 
     
    11491150                params->disp_props = addswline( params->disp_props, w); 
    11501151 
    1151             break;                 
     1152            break; 
    11521153        } 
    11531154 
     
    12171218 
    12181219 
    1219        /* Ranking Scheme */ 
    1220         case 'R':                
    1221            sw->RankScheme = get_param_number( &argv, switch_char ); 
    1222            break; 
     1220        /* Ranking Scheme */ 
     1221        case 'R': 
     1222            sw->RankScheme = get_param_number( &argv, switch_char ); 
     1223            break; 
    12231224 
    12241225        /* Ignore sorted indexes */ 
     
    12601261 
    12611262/************************************************************************* 
    1262 *   Dumps the index file(s)  
     1263*   Dumps the index file(s) 
    12631264* 
    12641265**************************************************************************/ 
     
    13371338        sw->TotalWords = sw->indexlist->header.totalwords; 
    13381339        sw->TotalFiles = sw->indexlist->header.totalfiles; 
    1339        sw->TotalWordPos = sw->indexlist->header.total_word_positions; 
     1340        sw->TotalWordPos = sw->indexlist->header.total_word_positions; 
    13401341 
    13411342        /* Adjust filenum to totalfiles */ 
     
    14681469 
    14691470    OutputKeyChar(sw, (int) (unsigned char) params->keychar); 
    1470 }     
     1471} 
    14711472 
    14721473 
     
    14891490 
    14901491 
    1491     /* Open index files */         
    1492  
    1493     if ( !SwishAttach(sw) )  
     1492    /* Open index files */ 
     1493 
     1494    if ( !SwishAttach(sw) ) 
    14941495        SwishAbortLastError( sw ); 
    14951496 
     
    15621563        resultHeaderOut(sw, 1, ".\n"); 
    15631564    } 
    1564     else  
     1565    else 
    15651566        resultHeaderOut(sw, 1, "err: no results\n.\n"); 
    15661567 
     
    15881589    struct swline *cur_line; 
    15891590 
    1590        /* Coalesce all remaining locations */ 
     1591        /* Coalesce all remaining locations */ 
    15911592    coalesce_all_word_locations(sw, sw->indexlist); 
    15921593