home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.whtech.com
/
ftp.whtech.com.tar
/
ftp.whtech.com
/
club100
/
txt
/
hdsort.ba
< prev
next >
Wrap
Text File
|
2006-10-19
|
1KB
|
26 lines
0 'CLUB 100 Library - 415/939-1246 BBS, 937-5039 NEWSLETTER, 932-8856 VOICE
1 'HDSORT.BA - by Phil Wheeler
2 CLS:CLEAR2000:FILES:A$="Which file to sort: ":GOSUB14:INPUTF$:IFMID$(F$,LEN(F$)-2,1)<>"."THENF$=F$+".DO"
3 A$="Lines in Header ":GOSUB14:INPUTM: OPENF$FORINPUTAS1:FORJ=1TOM+1:LINEINPUT#1,Z$:EXT
4 CLS:PRINT"----.----1----.----2----.----3----.----4";:PRINTZ$
5 A$="Begin at position: ":GOSUB14:INPUTB:IFB=0THEN5
6 A$="End at position: ":GOSUB14:INPUTE:N=M+1:CLS:PRINT@170,"Sorting...."
7 N=N+1:LINEINPUT#1,Z$:IFEOF(1)THENGOTO9
8 GOTO7
9 CLOSE:DIMD$(N):DIMY$(M):OPENF$FORINPUTAS1:IFM=0THENGOTO11
10 FORJ=1TOM:LINEINPUT#1,Y$(J):NEXT
11 FORI=M+1TON:LINEINPUT#1,D$(I):NEXT:CLOSE1:GOSUB15:KILLF$:OPENF$FOROUTPUTAS1:IFM=0THENGOTO13
12 FORJ=1TOM:PRINT#1,Y$(J):NEXT
13 FORI=M+1TON:PRINT#1,D$(I):NEXTI:CLOSE:MENU
14 PRINT@240,STRING$(40,32);:PRINT@240,A$;:RETURN
15 Z5=N
16 Z5=INT(Z5/2):IFZ5=0THEN24
17 Z2=1:Z3=N-Z5
18 Z1=Z2
19 Z4=Z1+Z5:IF(MID$(D$(Z1),B,(E-B)+1))<(MID$(D$(Z4),B,(E-B)+1))THEN22ELSE20
20 Z6$=D$(Z1):D$(Z1)=D$(Z4):D$(Z4)=Z6$:Z1=Z1-Z5:IFZ1<1THEN22
21 GOTO19
22 Z2=Z2+1:IFZ2>Z3THEN16
23 GOTO18
24 RETURN