home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / msj / msjv4_5 / wfinder / wfinder.c next >
Encoding:
C/C++ Source or Header  |  1989-06-22  |  19.8 KB  |  685 lines

  1. /*
  2.  * WINDOWS FILE FINDER UTILITY - SOURCE
  3.  *
  4.  * LANGUAGE : Microsoft C 5.1
  5.  * TOOLKIT  : Windows 2.10 SDK
  6.  * MODEL    : Small
  7.  * STATUS   : Operational
  8.  *
  9.  * Eikon Systems, Inc.
  10.  * 989 East Hillsdale Blvd, Suite 260
  11.  * Foster City, California 94404
  12.  *
  13.  * 07/20/88 - Kevin P. Welch - initial creation.
  14.  *
  15.  */
  16.  
  17. #include <windows.h>
  18. #include <process.h>
  19. #include <string.h>
  20. #include <dos.h>
  21.  
  22. #include "finder.h"
  23.  
  24. char     szApp[64];        /* name of selected application */
  25. char     szPath[128];      /* path & name of selected file */
  26.  
  27. /* */
  28.  
  29. /*
  30.  * WinMain( hInst, hPrevInst, lpszCmdLine, wCmdShow ) : int
  31.  *
  32.  *    hInst          handle of current instance
  33.  *    hPrevInst      handle to previous instance (if any)
  34.  *    lpszCmdLine    pointer to command line arguments
  35.  *    wCmdShow       initial ShowWindow command
  36.  *
  37.  * This function is the system entry point for the application
  38.  * and is responsible for defining the appropriate window 
  39.  * classes and for processing all the messages.  Note how
  40.  * the dialog box manager is responsible for the operation of
  41.  * the file finder window.
  42.  *
  43.  */
  44.  
  45. int PASCAL WinMain(
  46.    HANDLE         hInst,
  47.    HANDLE         hPrevInst,
  48.    LPSTR          lpszCmdLine,
  49.    WORD           wCmdShow )
  50. {
  51.    /* local variables */
  52.    FARPROC        lpProc;          
  53.  
  54.    lpProc = MakeProcInstance( (FARPROC)FinderDlgFn, hInst );
  55.    DialogBox( hInst, "Finder", NULL, lpProc );
  56.    FreeProcInstance( lpProc );
  57.  
  58.    /* end program */
  59.    return( FALSE );
  60.  
  61. }
  62.  
  63. /* */
  64.  
  65. /*
  66.  * FinderDlgFn( hWnd, wMsg, wParam, lParam ) : BOOL 
  67.  *
  68.  *    hWnd              handle to palette window
  69.  *    wMsg              message number
  70.  *    wParam            single word parameter
  71.  *    lParam            double word parameter
  72.  *
  73.  * This function is responsible for processing all the messages
  74.  * which relate to the file finder dialog box.  This mainly
  75.  * involves the definition and retrieval of the various
  76.  * events generated by the user.
  77.  *
  78.  */
  79.  
  80. BOOL FAR PASCAL FinderDlgFn(
  81.    HWND        hDlg,
  82.    WORD        wMsg,
  83.    WORD        wParam,
  84.    LONG        lParam )
  85. {
  86.    /* local variables */
  87.    BOOL        bResult; 
  88.  
  89.    /* initialization */
  90.    bResult = TRUE;
  91.    
  92.    /* process messages */
  93.    switch( wMsg )
  94.       {
  95.    case WM_INITDIALOG : /* initialize dialog box */
  96.       {
  97.          WORD     wItem;               
  98.          WORD     wNumber;             
  99.          HWND     hSysMenu;            
  100.          HWND     hListBox;            
  101.          char     szDrive[12];         
  102.    
  103.          /* center dialog box */
  104.          CenterPopup( hDlg, NULL );
  105.             
  106.          /* define search pattern & initial drive list */
  107.          SetDlgItemText( hDlg, ID_PATTERN, "*.*" );
  108.          DlgDirList( hDlg, "*.*", ID_DRIVES, NULL, 0xC000 );
  109.       
  110.          /* select all fixed drives */
  111.          hListBox = GetDlgItem( hDlg, ID_DRIVES );
  112.          wNumber = (WORD)SendMessage( hListBox, LB_GETCOUNT, 0, 0L );
  113.          for ( wItem=0; wItem<wNumber; wItem++ ) {
  114.             SendMessage( hListBox, LB_GETTEXT, wItem, (LONG)(LPSTR)szDrive );
  115.             if ( strcmp(szDrive,"[-C-]") >= 0 )
  116.                SendMessage( hListBox, LB_SETSEL, TRUE, (LONG)wItem );
  117.          }
  118.       
  119.          /* define icon for dialog box */
  120.          SetClassWord( 
  121.             hDlg, 
  122.             GCW_HICON, 
  123.             LoadIcon( INSTANCE(hDlg), (LPSTR)"Icon" )
  124.          );
  125.                
  126.          /* add about box to system menu */
  127.          hSysMenu = GetSystemMenu( hDlg, FALSE );
  128.          ChangeMenu( hSysMenu, NULL, NULL, NULL, MF_SEPARATOR|MF_APPEND );
  129.          ChangeMenu( hSysMenu, NULL, "&About...", SC_ABOUT, MF_APPEND );
  130.  
  131.       }
  132.       break;
  133.    case WM_SYSCOMMAND : /* system command */
  134.       
  135.       /* process sub-messages */
  136.       switch( wParam )
  137.          {
  138.       case SC_CLOSE : /* destroy dialog box */
  139.          EndDialog( hDlg, TRUE );
  140.          break;
  141.       case SC_ABOUT : /* display about box */
  142.          Dialog( hDlg, "About", AboutDlgFn );
  143.          break;
  144.       default :
  145.          bResult = FALSE;
  146.          break;
  147.       }
  148.       
  149.       break;
  150.    case WM_COMMAND : /* window command */
  151.       
  152.       /* process sub-message */
  153.       switch( wParam )
  154.          {
  155.       case ID_PATTERN : /* pattern specified */
  156.          
  157.          /* enable-disable search button */
  158.          if ( HIWORD(lParam) == EN_CHANGE ) 
  159.             EnableWindow(
  160.                GetDlgItem(hDlg,ID_SEARCH),
  161.                (WORD)SendMessage(LOWORD(lParam),WM_GETTEXTLENGTH,0,0L)
  162.             );
  163.          
  164.          break;
  165.       case ID_FILES : /* file selected */
  166.          {
  167.             int      nItem;
  168.             PSTR     pszExt;
  169.             BOOL     bEnable;
  170.             char     szExt[16];
  171.             char     szDir[64];
  172.             char     szFile[64];
  173.             char     szProg[64];
  174.  
  175.             /* process listbox notification code */
  176.             switch( HIWORD(lParam) )
  177.                {
  178.             case LBN_SELCHANGE : /* selection is changing */
  179.          
  180.                /* initialization */
  181.                bEnable = FALSE;
  182.             
  183.                /* retrieve index to selected item */
  184.                nItem = SendMessage( LOWORD(lParam), LB_GETCURSEL, 0, 0L );
  185.                if ( nItem >= 0 ) {
  186.    
  187.                   /* retrieve text of selected item */
  188.                   SendMessage(
  189.                      LOWORD(lParam), 
  190.                      LB_GETTEXT, 
  191.                      nItem, 
  192.                      (LONG)(LPSTR)szFile
  193.                   );
  194.  
  195.                   /* continue if file name selected */
  196.                   if ( szFile[0] == ' ' ) {
  197.  
  198.                      /* retrieve current directory */
  199.                      do {
  200.                         SendMessage(
  201.                            GetDlgItem(hDlg,ID_FILES), 
  202.                            LB_GETTEXT, 
  203.                            --nItem, 
  204.                            (LONG)(LPSTR)szDir
  205.                         );
  206.                      } while( szDir[0] == ' ' );
  207.  
  208.                      /* define full path name */
  209.                      sprintf( 
  210.                         szPath, 
  211.                         "%s\\%s", 
  212.                         szDir, 
  213.                         strtok(&szFile[2]," ")
  214.                      );
  215.                      
  216.                      /* check if extension defined */
  217.                      if ( strrchr(szPath,'.') ) {
  218.  
  219.                         /* retrieve extension */
  220.                         strcpy( szExt, strrchr(szPath,'.')+1 );
  221.  
  222.                         /* retrieve list of program extensions */
  223.                         GetProfileString(
  224.                            "windows",
  225.                            "programs",
  226.                            "",
  227.                            szProg,
  228.                            sizeof(szProg)
  229.                         );
  230.  
  231.                         /* continue verification if not a program */
  232.                         if ( !Present(szProg,szExt) ) {
  233.  
  234.                            /* retrieve extension profile string */
  235.                            GetProfileString(
  236.                               "extensions",
  237.                               szExt,
  238.                               "",
  239.                               szApp,
  240.                               sizeof(szApp)
  241.                            );
  242.  
  243.                            /* check if extension listed */
  244.                            if ( szApp[0] ) {
  245.                               bEnable = TRUE;
  246.                               *strchr(szApp,' ') = 0;
  247.                            }
  248.                            
  249.                         } else {
  250.                            bEnable = TRUE;
  251.                            strcpy( szApp, szPath );
  252.                            szPath[0] = 0;
  253.                         }
  254.                      
  255.                      } 
  256.  
  257.                   }
  258.  
  259.                }
  260.          
  261.                /* enable run button */
  262.                EnableWindow( GetDlgItem(hDlg,ID_RUN), bEnable );
  263.  
  264.                break;
  265.             case LBN_DBLCLK : /* double-click */
  266.                
  267.                /* perform run if button enabled */
  268.                if ( IsWindowEnabled(GetDlgItem(hDlg,ID_RUN)) ) 
  269.                   if ( spawnl(P_NOWAIT,szApp,szApp,szPath,NULL) >= 0 )
  270.                      ShowWindow( hDlg, SW_MINIMIZE );
  271.             
  272.                break;
  273.             default : /* something else */
  274.                break;
  275.             }
  276.  
  277.          }
  278.          break;
  279.       case ID_SEARCH : /* search using path */
  280.       case IDOK :
  281.          {
  282.             WORD     wItem;            
  283.             WORD     wNumber;          
  284.             HWND     hListBox;         
  285.             BOOL     bContinue;        
  286.             HCURSOR  hOldCursor;       
  287.             char     szDrive[8];       
  288.             char     szPattern[64];    
  289.             char     szFileSpec[64];   
  290.          
  291.             /* disable run button & change cursor to hourglass */
  292.             EnableWindow( GetDlgItem(hDlg,ID_RUN), FALSE );
  293.             hOldCursor = SetCursor( LoadCursor(NULL,IDC_WAIT) );
  294.             
  295.             /* retrieve search pattern & erase current file list */
  296.             GetDlgItemText( hDlg, ID_PATTERN, szPattern, sizeof(szPattern) );
  297.             
  298.             SendMessage( GetDlgItem(hDlg,ID_FILES), WM_SETREDRAW, FALSE, 0L );
  299.             SendMessage( GetDlgItem(hDlg,ID_FILES), LB_RESETCONTENT, 0, 0L );
  300.  
  301.             /* perform search on each selected drive */
  302.             bContinue = TRUE;
  303.             hListBox = GetDlgItem( hDlg, ID_DRIVES );
  304.             wNumber = (WORD)SendMessage( hListBox, LB_GETCOUNT, 0, 0L );
  305.             
  306.             for ( wItem=0; (bContinue)&&(wItem<wNumber); wItem++ ) 
  307.                if ( SendMessage(hListBox,LB_GETSEL,wItem,0L) ) {
  308.                   
  309.                   /* define file specification */
  310.                   SendMessage( hListBox, LB_GETTEXT, wItem, (LONG)(LPSTR)szDrive );
  311.                   sprintf( szFileSpec, "%c:\\%s", szDrive[2], szPattern );
  312.                   
  313.                   /* create directory listing using pattern */
  314.                   bContinue = Directory( szFileSpec, _A_NORMAL, GetDlgItem(hDlg,ID_FILES) );
  315.                   
  316.                }
  317.             
  318.             /* activate redrawing */
  319.             SendMessage( GetDlgItem(hDlg,ID_FILES), WM_SETREDRAW, TRUE, 0L );
  320.  
  321.             /* check for null search operation */
  322.             if ( SendMessage( GetDlgItem(hDlg,ID_FILES), LB_GETCOUNT, 0, 0L ) == 0L )
  323.                MessageBox( hDlg, "No files found matching criteria!", "File Finder", MB_OK|MB_ICONHAND );
  324.                
  325.             /* restore cursor & repaint display */
  326.             SetCursor( hOldCursor );
  327.             InvalidateRect( GetDlgItem(hDlg,ID_FILES), NULL, TRUE );
  328.  
  329.          }
  330.          break;
  331.       case ID_RUN : /* run selection */
  332.  
  333.          /* start application & make finder iconic */
  334.          if ( spawnl(P_NOWAIT,szApp,szApp,szPath,NULL) >= 0 )
  335.             ShowWindow( hDlg, SW_MINIMIZE );
  336.  
  337.          break;
  338.       case ID_QUIT : /* close dialog */
  339.       case IDCANCEL :
  340.          EndDialog( hDlg, TRUE );
  341.          break;
  342.       default : /* something else */
  343.          break;
  344.       }
  345.       
  346.       break;
  347.    default :
  348.       bResult = FALSE;
  349.       break;
  350.    }  
  351.    
  352.    /* return result */
  353.    return( bResult );
  354.  
  355. }
  356.  
  357. /* */
  358.  
  359. /*
  360.  * AboutDlgFn( hDlg, wMsg, wParam, lParam ) : BOOL ;
  361.  *
  362.  *    hDlg           handle to dialog box
  363.  *    wMsg           message or event
  364.  *    wParam         word portion of message
  365.  *    lParam         long portion of message
  366.  *
  367.  * This function is responsible for processing all the messages
  368.  * that relate to the About dialog box.  About the only useful actions
  369.  * this function performs is to center the dialog box and to wait for
  370.  * the OK button to be pressed.
  371.  *
  372.  */
  373.  
  374. BOOL FAR PASCAL AboutDlgFn(
  375.    HWND        hDlg,
  376.    WORD        wMsg,
  377.    WORD        wParam,
  378.    LONG        lParam )
  379. {
  380.    BOOL        bResult;
  381.  
  382.    /* process message */
  383.    switch( wMsg )
  384.       {
  385.    case WM_INITDIALOG :
  386.       bResult = TRUE;
  387.       CenterPopup( hDlg, GetParent(hDlg) );
  388.       break;
  389.    case WM_COMMAND :
  390.  
  391.       /* process sub-message */
  392.       if ( wParam == IDOK ) {
  393.          bResult = TRUE;
  394.          EndDialog( hDlg, TRUE );
  395.       } else
  396.          bResult = FALSE;
  397.  
  398.       break;
  399.    default :
  400.       bResult = FALSE;
  401.       break;
  402.    }
  403.  
  404.    /* return final result */
  405.    return( bResult );
  406.  
  407. }
  408.  
  409. /* */
  410.  
  411. /*
  412.  * Dialog( hParentWnd, lpszTemplate, lpfnDlgProc ) : BOOL
  413.  *
  414.  *    hParentWnd        handle to parent window
  415.  *    lpszTemplate      dialog box template
  416.  *    lpfnDlgProc       dialog window function
  417.  *
  418.  * This utility function displays the specified dialog box, using the
  419.  * template provided.  It automatically makes a new instance of the
  420.  * dialog box function.  Note that this function will NOT work
  421.  * correctly if an invalid or NULL parent window handle is provided.
  422.  *
  423.  */
  424.  
  425. BOOL FAR PASCAL Dialog( hParentWnd, lpszTemplate, lpfnDlgProc )
  426.    HWND        hParentWnd;
  427.    LPSTR       lpszTemplate;
  428.    FARPROC     lpfnDlgProc;
  429. {
  430.    /* local variables */
  431.    BOOL           bResult;
  432.    FARPROC        lpProc;                 
  433.       
  434.    /* display palette dialog box */
  435.    lpProc = MakeProcInstance( lpfnDlgProc, INSTANCE(hParentWnd) );
  436.    bResult = DialogBox( INSTANCE(hParentWnd), lpszTemplate, hParentWnd, lpProc );
  437.    FreeProcInstance( lpProc );
  438.  
  439.    /* return result */
  440.    return( bResult );
  441.  
  442. }
  443.  
  444. /* */
  445.  
  446. /*
  447.  * Directory( szFileSpec, wAttributes, hListBox ) : BOOL
  448.  *
  449.  *    szFileSpec        file search specification
  450.  *    wAttributes       file attributes to search for
  451.  *    hListBox          handle to listbox for directory
  452.  *
  453.  * This function searches the disk for files of the specified type
  454.  * and appends the results found to the list box whose handle is
  455.  * provided.  An error is generated and the process aborted if
  456.  * insufficient memory is available for the search.
  457.  *
  458.  * A value of TRUE is returned if the directory operation was
  459.  * successful.
  460.  *
  461.  */
  462.  
  463. BOOL FAR PASCAL Directory(
  464.    PSTR     szFileSpec,
  465.    WORD     wAttributes,
  466.    HWND     hListBox )
  467. {
  468.    BOOL     bContinue;           
  469.    BOOL     bDirOutput;          
  470.    
  471.    WORD     wEntry;              
  472.    WORD     wDirEntries;         
  473.    
  474.    struct find_t     DirEntry;   
  475.    
  476.    char     szPath[64];          
  477.    char     szSpec[64];          
  478.    char     szEntry[64];         
  479.  
  480.    /* initialization */
  481.    bContinue = TRUE;
  482.    bDirOutput = FALSE;
  483.  
  484.    wDirEntries = 0;
  485.  
  486.    /* separate file spec into path and wildcards */
  487.    for (wEntry=strlen(szFileSpec)-1; szFileSpec[wEntry]!='\\'; wEntry-- );
  488.    
  489.    strcpy( szPath, szFileSpec );
  490.    szPath[wEntry] = 0;
  491.    
  492.    strcpy( szSpec, &szFileSpec[wEntry+1] );
  493.       
  494.    /* perform search for normal files */
  495.    if ( _dos_findfirst(szFileSpec,wAttributes,&DirEntry) == 0 ) {
  496.    
  497.       /* repeat until all entries exhausted */
  498.       do {
  499.       
  500.          /* output current directory if not done */
  501.          if ( bDirOutput == FALSE ) {
  502.             bDirOutput = TRUE;
  503.             if ( SendMessage(hListBox,LB_INSERTSTRING,-1,(LONG)(LPSTR)szPath) < LB_OKAY ) {
  504.                MessageBox( GetParent(hListBox), "Insufficient Memory!", "File Finder", MB_OK|MB_ICONHAND );
  505.                return( FALSE );
  506.             }
  507.          }     
  508.  
  509.          /* output current file name */
  510.          sprintf(
  511.             szEntry, 
  512.             "  %-12s %7ld  %2u/%02u/%02u  %2u:%02u",
  513.             DirEntry.name,
  514.             DirEntry.size,
  515.             (DirEntry.wr_date&0x01E0) >> 5,
  516.             DirEntry.wr_date&0x001F,
  517.             ((DirEntry.wr_date&0xFE00) >> 9)+80,
  518.             (DirEntry.wr_time&0xF800) >> 11,
  519.             (DirEntry.wr_time&0x07E0) >> 5
  520.          );
  521.                
  522.          /* add entry to file list box */
  523.          if ( SendMessage(hListBox,LB_INSERTSTRING,-1,(LONG)(LPSTR)szEntry) < LB_OKAY ) {
  524.             MessageBox( GetParent(hListBox), "Insufficient Memory!", "File Finder", MB_OK|MB_ICONHAND );
  525.             return( FALSE );
  526.          }
  527.          
  528.       } while ( _dos_findnext(&DirEntry) == 0 );
  529.       
  530.    } 
  531.    
  532.    /* perform search for sub-directories */
  533.    sprintf( szEntry, "%s\\*.*", szPath );
  534.    if ( _dos_findfirst(szEntry,_A_SUBDIR,&DirEntry) == 0 ) {
  535.    
  536.       /* repeat until all entries exhausted */
  537.       do {
  538.       
  539.          /* eliminate special directory entries */
  540.          if ( (DirEntry.attrib==_A_SUBDIR) && (DirEntry.name[0]!='.') ) {
  541.             sprintf( szEntry, "%s\\%s\\%s", szPath, DirEntry.name, szSpec );
  542.             bContinue = Directory( szEntry, wAttributes, hListBox );
  543.          }
  544.          
  545.       } while ( (bContinue)&&(_dos_findnext(&DirEntry) == 0) );
  546.       
  547.    }        
  548.    
  549.    /* return final result */
  550.    return( bContinue );
  551.  
  552. }
  553.  
  554. /* */
  555.  
  556. /*
  557.  * CenterPopup( hWnd, hParentWnd ) : BOOL
  558.  *
  559.  *    hWnd              window handle
  560.  *    hParentWnd        parent window handle
  561.  *
  562.  * This routine centers the popup window in the screen or display
  563.  * using the window handles provided.  The window is centered over
  564.  * the parent if the parent window is valid.  Special provision
  565.  * is made for the case when the popup would be centered outside
  566.  * the screen - in this case it is positioned at the appropriate
  567.  * border.
  568.  *
  569.  */
  570.  
  571. BOOL FAR PASCAL CenterPopup( 
  572.       HWND     hWnd,
  573.       HWND     hParentWnd
  574.    )
  575. {
  576.    /* local variables */
  577.    int      xPopup;   
  578.    int      yPopup;   
  579.    int      cxPopup;  
  580.    int      cyPopup;  
  581.    int      cxScreen; 
  582.    int      cyScreen; 
  583.    int      cxParent; 
  584.    int      cyParent; 
  585.    RECT     rcWindow; 
  586.  
  587.    /* retrieve main display dimensions */
  588.    cxScreen = GetSystemMetrics( SM_CXSCREEN );
  589.    cyScreen = GetSystemMetrics( SM_CYSCREEN );
  590.  
  591.    /* retrieve popup rectangle  */
  592.    GetWindowRect( hWnd, (LPRECT)&rcWindow );
  593.  
  594.    /* calculate popup extents */
  595.    cxPopup = rcWindow.right - rcWindow.left;
  596.    cyPopup = rcWindow.bottom - rcWindow.top;
  597.  
  598.    /* calculate bounding rectangle */
  599.    if ( hParentWnd ) {
  600.  
  601.       /* retrieve parent rectangle */
  602.       GetWindowRect( hParentWnd, (LPRECT)&rcWindow );
  603.  
  604.       /* calculate parent extents */
  605.       cxParent = rcWindow.right - rcWindow.left;
  606.       cyParent = rcWindow.bottom - rcWindow.top;
  607.  
  608.       /* center within parent window */
  609.       xPopup = rcWindow.left + ((cxParent - cxPopup)/2);
  610.       yPopup = rcWindow.top + ((cyParent - cyPopup)/2);
  611.  
  612.       /* adjust popup x-location for screen size */
  613.       if ( xPopup+cxPopup > cxScreen )
  614.          xPopup = cxScreen - cxPopup;
  615.  
  616.       /* adjust popup y-location for screen size */
  617.       if ( yPopup+cyPopup > cyScreen )
  618.          yPopup = cyScreen - cyPopup;
  619.  
  620.    } else {
  621.  
  622.       /* center within entire screen */
  623.       xPopup = (cxScreen - cxPopup) / 2;
  624.       yPopup = (cyScreen - cyPopup) / 2;
  625.  
  626.    }
  627.  
  628.    /* move window to new location & display */
  629.    MoveWindow(
  630.       hWnd,
  631.       ( xPopup > 0 ) ? xPopup : 0,
  632.       ( yPopup > 0 ) ? yPopup : 0,
  633.       cxPopup,
  634.       cyPopup,
  635.       TRUE
  636.    );
  637.  
  638.    /* normal return */
  639.    return( TRUE );
  640.  
  641. }
  642.  
  643. /* */
  644.  
  645. /*
  646.  * Present( pszList, pszToken ) : BOOL
  647.  *
  648.  *    pszList        list of tokens
  649.  *    pszToken       search token
  650.  *
  651.  * This function searches for a particular token from a list tokens.  It
  652.  * takes into account spaces and other delimiting characters.  A value
  653.  * of TRUE is returned if the specified token was found in the list
  654.  * provided.
  655.  *
  656.  * Note that this function produces a side-effect in that it breaks up
  657.  * the token list into individual components.
  658.  *
  659.  */
  660.  
  661. BOOL FAR PASCAL Present(
  662.    PSTR     pszList,
  663.    PSTR     pszToken )
  664. {
  665.    BOOL     bFound;
  666.    PSTR     pszEntry;
  667.  
  668.    /* initialization */
  669.    bFound = FALSE;
  670.    pszEntry = strtok( pszList, " " );
  671.  
  672.    /* search for token in list */
  673.    while ( (!bFound)&&(pszEntry) ) 
  674.       if ( stricmp(pszEntry,pszToken) )
  675.          pszEntry = strtok( NULL, " " );
  676.       else
  677.          bFound = TRUE;
  678.  
  679.    return( bFound );
  680.  
  681. }
  682.  
  683.  
  684.