home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / COMM / TELSORT2.ZIP / TSORT.PRG < prev    next >
Text File  |  1992-02-20  |  2KB  |  78 lines

  1. ***********************************************************
  2. **                                                       **
  3. **  Another cheezy hack from The Animation Station Inc.  **
  4. **                                                       **
  5. **  The Animation Station Inc.                           **
  6. **  150 Graydon Hall Drive, Suite 2602                   **
  7. **  Don Mills, ON, M3A 3B3                               **
  8. **  416-443-8670                                         **
  9. **                                                       **
  10. **  Or leave mail to Ken Rockson on CRS.                 **
  11. **                                                       **
  12. ***********************************************************
  13.  
  14. use tsortdef
  15. fon=tpath
  16. igthe=ignore_the
  17. remthe=remove_the
  18. clear
  19. @ 11,17 say "Path To Telix Files:" get fon picture "@!"
  20. @ 12,17 say "Ignore 'The'? (Y/N):" get igthe picture "!" valid igthe$"YN"
  21. @ 13,17 say "Remove 'The'? (Y/N):" get remthe picture "!" valid remthe$"YN"
  22. read
  23. if lastkey()=27
  24.   quit
  25. endif
  26. if igthe!=ignore_the .or. remthe!=remove_the .or. fon!=tpath
  27.   replace tpath with fon, remove_the with remthe, ignore_the with igthe
  28. endif
  29. use
  30. fon=trim(fon)
  31. copy file &fon.telix.fon to &fon.\telix.fn2
  32. fon=fon+"telix.fon"
  33. hand=fopen(fon,0)
  34. ?"reading"
  35. flen=fseek(hand,0,2)
  36. rex=(flen-64)/86
  37. declare a[rex],key[rex]
  38. ?"filling array"
  39. fseek(hand,0)
  40. head=space(64)
  41. fread(hand,@head,64)
  42. s=space(86)
  43. for x=0 to rex-1
  44.   fseek(hand,64+(86*x))
  45.   s=space(86)
  46.   fread(hand,@s,86)
  47.   if remthe=="Y" .and. upper(left(s,4))=="THE "
  48.     a[x+1]=substr(s,5,21)+space(4)+substr(s,26,61)
  49.   else
  50.     a[x+1]=s
  51.   endif
  52.   if upper(left(s,4))=="THE " .and. igthe=="Y"
  53.     key[x+1]=upper(substr(s,5,21))
  54.   else
  55.     key[x+1]=upper(left(s,25))
  56.   endif
  57. next x
  58. ?"outputting"
  59. fclose(hand)
  60. hand=fcreate(fon)
  61. fwrite(hand,head,64)
  62. z="zzzzzzzzzzzzzzzzzzzzzzzzz"
  63. y=0
  64. for x=1 to rex
  65.   s=z
  66.   for w=1 to rex
  67.     if key[w]<s
  68.       y=w
  69.       s=key[w]
  70.     endif
  71.   next w
  72.   fwrite(hand,a[y],86)
  73.   ? left(key[y],25)
  74.   key[y]=z
  75. next x
  76. fclose(hand)
  77.  
  78.