home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Utilities / Miscellaneous / CopyPaste 3.3.4 / CopyPaste Tools Sourcecode / Selection Sort.c / GetSelection.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-16  |  979 b   |  45 lines  |  [TEXT/KAHL]

  1. #include "ToolSort.h"
  2.  
  3. /*=========================================================================
  4. Module:        GetValidSel
  5.  
  6. Purpose:    Get a Selection and verify if Selection is correct type, 
  7.             correct format.
  8.             
  9. Returns:    Valid-Selection            
  10.  
  11. Functional Details:    
  12.  
  13.             Verify if Selection Type IS 'TEXT'
  14.             Check if last character of Selection is eol
  15.             Report errors to user
  16.  
  17. =========================================================================*/
  18.  
  19. void GetValidSel(validSel)
  20.     SelRec        *validSel;        /* Ptr to SelRec */
  21.     {
  22.     Handle        scrap;            /* Handle to scrap */
  23.     //Handle        selection;        /* Handle to scrap */
  24.     long        length;            /* Scrap length */
  25.     long     offset;                /* offset to start of data */
  26.     scrap = NewHandle(0L);
  27.     
  28.     length = GetScrap( scrap, 'TEXT', &offset);
  29.     if ( length > 0 )
  30.         {
  31.         if ( (*scrap)[length-1] != '\r' )
  32.             {
  33.             length=length+1;
  34.              SetHandleSize(scrap,length);
  35.             (*scrap)[length-1]='\r';
  36.             }
  37.         validSel->sel = scrap;
  38.         validSel->length = length;
  39.         }
  40.     
  41.     }
  42.     
  43.  
  44.     
  45.