home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
STMAGAZIN
/
STMAGAZIN.MSA
/
ANWENDUN.GEN
/
COMMAND
/
COMMAND.LST
< prev
next >
Wrap
File List
|
1986-02-06
|
9KB
|
393 lines
Maxcmd%=23
Drv%=0
Dim Cmds$(Maxcmd%),Para$(20),Batch$(200)
Cmds:
Data "DIR","EXIT","CD","CLS","TYPE","MD","RD","ERA","VERSION","COPY"
Data "REN","ECHO","CHDIR","MKDIR","RMDIR","ERASE","DATE","TIME","HELP"
Data "GOTO","DUMP","PRINT",""
Rest%=Fre(0)
Hime%=Himem
Reserve &H8000
Restore Cmds
I%=0
Repeat
Read Cmds$(I%)
Inc I%
Until Cmds$(I%-1)=""
Maxcmd%=I%-1
Cold:
Drv%=Gemdos(25)
Cls
@Version
Print Xbios(3)-Himem;" Bytes free"
If Exist("AUTOEXEC.BAT")
Para$(0)="AUTOEXEC"
@Batch
Endif
Do
Hidem
Print Chr$(Drv%+65);">";
Form Input 78,Lin$
If Lin$<>""
Gosub Exe
Endif
Loop
Procedure Exe
@Getpara
I%=0
Repeat
Exit If Para$(0)=Cmds$(I%)
Inc I%
Until I%=Maxcmd%
On I%+1 Gosub Dir,End,Cd,Cls,Type,Md,Rd,Era,Version,Copy,Ren,Echo,Cd,Md,Rd
On I%+1-15 Gosub Era,Date,Time,Help,Goto,Dump,Lister,Nocmd
Return
Procedure Getpara ! Command-Line in Para$ zerstückeln
For I%=0 To 9
Para$(I%)=""
Next I%
Para%=0
Lin$=Upper$(Lin$)
If Instr(Lin$," ")
Do
Lx%=Instr(Lin$," ")
Exit If Lx%=0
Para$(Para%)=Left$(Lin$,Lx%-1)
Lin$=Right$(Lin$,Len(Lin$)-Lx%)
Inc Para%
Loop
Para$(Para%)=Lin$
Inc Para%
Else
Para$(0)=Lin$
Para%=1
Endif
Return
Procedure Nocmd ! Kein COMMAND ST Befehl
If Mid$(Para$(0),2,1)=":" ! vielleicht ist es PRG,TOS,TTP,BAT
Drv%=Asc(Left$(Para$(0),1)) And 15
Chdrive Drv%
Dec Drv%
Else
Showm
If Instr(Para$(0),".")
If Exec(0,Para$(0)," "+Para$(1),"")=-33
Print "Unbekannter Befehl"
Endif
Else
If Exist(Para$(0)+".BAT")
@Batch
Else
If Exec(0,Para$(0)+".PRG"," "+Para$(1),"")=-33
Hidem
Print Chr$(27);"e"
If Exec(0,Para$(0)+".TOS"," "+Para$(1),"")=-33
If Exec(0,Para$(0)+".TTP"," "+Para$(1),"")=-33
If Right$(Para$(0),1)<>":" ! IST ES EIN LABEL?
Print "Unbekannter Befehl"
Endif
Endif
Endif
Endif
Print Chr$(27);"f"
Endif
Endif
Endif
Return
Procedure Dir ! Directory ausgeben
Path$="*.*"
If Para%>1
Path$=Para$(1)
Endif
Print Chr$(Drv%+65);":";Dir$(0);"\";Path$
Files Path$
Return
Procedure End ! EXIT
Reserve Rest%-255
End
Return
Procedure Cd ! CD und CHDIR
If Para%>1
If Para$(1)=".."
Chdir "\"
Else
Lin$=Dir$(0)+"\"+Para$(1)
If Exist(Lin$+"\*.*")
Chdir Lin$
Else
Print "PFAD NICHT GEFUNDEN"
Endif
Endif
Else
Print Chr$(Drv%+65);":";Dir$(0)
Endif
Return
Procedure Cls ! CLS Bildschirm löschen
Cls
Return
Procedure Type ! TYPE
If Exist(Para$(1))
Open "I",#1,Para$(1)
If Left$(Para$(2),1)<>">"
Para$(2)=">CON:"
Endif
Open "O",#2,Right$(Para$(2),Len(Para$(2))-1)
Lo%=Lof(#1)
While Lo%-Loc(#1)>98
Print #2,Input$(99,#1);
If Inp?(2)
If Inp(2)=3
Goto Raus2
Endif
Void Inp(2)
Endif
If (Bios(11,-1) And 11) ! Lshift,Rshift oder Alternate
Pause 50
Endif
Wend
Print #2,Input$(Lo%-Loc(#1),#1)
Raus2:
Print #2
Close #1
Close #2
Endif
Return
Procedure Md ! MD MKDIR
If Para%>1
Mkdir Dir$(0)+"\"+Para$(1)
Else
Print Chr$(Drv%+65);":";Dir$(0)
Endif
Return
Procedure Rd ! RD RMDIR
If Para%>1
Rmdir Dir$(0)+"\"+Para$(1)
Else
Print Chr$(Drv%+65);":";Dir$(0)
Endif
Return
Procedure Era ! ERA ERASE
While Exist(Para$(1))
Kill Para$(1)
Wend
Return
Procedure Version ! VERSION
Print "CLI v1.2 © 8.2.1987 M.Bernards ";
Ver%=Gemdos(&H30) And &HFFFF
Print "TOS-Version ";Ver% And &HFF;".";Int(Ver%/256)
Return
Procedure Copy ! COPY
If Para%>2
Dta$=Space$(44)
Void Gemdos(&H1A,L:Varptr(Dta$))
Fehler%=Gemdos(&H4E,L:Varptr(Para$(1)),&H3F)
If Not Fehler%
Repeat
Quell$=Right$(Dta$,14)
If Right$(Para$(2),1)="\" Or Right$(Para$(2),1)=":"
Ziel$=Para$(2)+Quell$
Else
Ziel$=Para$(2)
Endif
Print "Copy ";Quell$;"to ";Ziel$
Open "I",#1,Quell$
Leng%=Lof(#1)
If Leng%>Xbios(3)-Himem-1000
Print "Speicherplatz reicht nicht aus"
Endif
Bget #1,Himem,Leng%
Close #1
Open "O",#1,Ziel$
Bput #1,Himem,Leng%
Close #1
Mid$(Dta$,31)=Space$(14)
Fehler%=Gemdos(&H4F)
Until Fehler%
Endif
Endif
Return
Procedure Ren ! Befehl REN
If Para%>2
Name Para$(1) As Para$(2)
Endif
Return
Procedure Echo ! ECHO
For I%=1 To Para%-1
Print Para$(I%);" ";
Next I%
Print
Return
Procedure Date ! DATE
If Para%>1
Settime Time$,Para$(1)
Else
Print Date$
Endif
Return
Procedure Time ! TIME
If Para%>1
Settime Para$(1),Date$
Else
Print Time$
Endif
Return
Procedure Help ! HELP
For I%=0 To Maxcmd%
Print " ";Cmds$(I%);Space$(19-Len(Cmds$(I%)));
Next I%
Print
Return
Procedure Batch ! Batchdateien laden und ausführen
Cnt%=0
Flag%=0
Open "I",#99,Para$(0)+".BAT"
While Not Eof(#99)
Inc Cnt%
Line Input #99,Batch$(Cnt%)
Wend
Close #99
For Ibatch%=1 To Cnt%
Lin$=Batch$(Ibatch%)
@Trimlen
@Insert_parameter
Print Lin$
@Exe
If Inp?(2)
If Inp(2)=3
Flag%=-1
Endif
Endif
Exit If Flag%
Next Ibatch%
Return
Procedure Goto ! GOTO
Local I%
For I%=1 To Cnt%
Exit If Batch$(I%)=Para$(1)+":"
Next I%
If I%<Cnt%
Ibatch%=I%
Endif
Return
Procedure Insert_parameter ! %n wird ersetzt durch CL-Parameter
Local I%
I%=1
In%=Instr(Lin$,"%")
While In%
I%=Val(Mid$(Lin$,In%+1,1))
Lin$=Left$(Lin$,In%-1)+Para$(I%)+Right$(Lin$,Len(Lin$)-In%-1)
In%=Instr(Lin$,"%")
Wend
Return
Procedure Trimlen ! Anhängende Leerzeichen löschen
While Right$(Lin$,1)=" "
Lin$=Left$(Lin$,Len(Lin$)-1)
Wend
Return
Procedure Dump ! DUMP
Local Byte$,Cnt%,Glcnt%,As$,Lod%
If Exist(Para$(1))
Open "I",#1,Para$(1)
Lod%=Lof(#1)
If Lod%>Xbios(3)-10000-Himem
Bget #1,Himem,Xbios(3)-10000-Himem
Else
Bget #1,Himem,Lod%
Endif
Close #1
If Left$(Para$(2),1)<>">"
Para$(2)=">CON:" ! Bildschirm
Endif
Open "O",#2,Right$(Para$(2),Len(Para$(2))-1)
Cnt%=0
Glcnt%=0
Print #2,"000000 ";
While Glcnt%<Lod%
Eing%=Peek(Himem+Glcnt%+Cnt%)
Byte$=Hex$(Eing%)
Bmove Himem+Glcnt%,As%,16
If Eing%<32
As$=As$+"."
Else
As$=As$+Chr$(Eing%)
Endif
If Len(Byte$)<2
Byte$=String$(2-Len(Byte$),"0")+Byte$
Endif
Print #2,Byte$;" ";
Inc Cnt%
If Cnt%=16
Cnt%=0
Print #2," ";As$
As$=""
Add Glcnt%,16
Byte$=Hex$(Glcnt%)
Print #2,String$(6-Len(Byte$),"0");Byte$;" ";
If Inp?(2)
If Inp(2)=3
Goto Raus ! ^C gedrückt ?
Endif
Void Inp(2)
Endif
If (Bios(11,-1) And 11)
Pause 50
Endif
Endif
Wend
Raus:
Print #2
Close #1
Close #2
Endif
Return
Procedure Lister ! PRINT
Local I%
Dta$=Space$(44)
Path$=Para$(1)
If Para%>2
Plen%=Val(Para$(2))
Else
Plen%=66
Endif
Void Gemdos(&H1A,L:Varptr(Dta$))
Fehler=Gemdos(&H4E,L:Varptr(Path$),&H2F)
If Not Fehler
Repeat
Cnt%=0
Seite%=2
Catalog$=Right$(Dta$,14)
For I%=Len(Path$) Downto 1
Exit If Mid$(Path$,I%,1)="\"
Next I%
If I%
Head$="Listing von "+Left$(Path$,I%)+Catalog$
Else
Head$="Listing von "+Dir$(0)+"\"+Catalog$
Endif
Open "I",#1,Catalog$
Lprint Head$;" Seite 1"
Lprint
While Not Eof(#1)
Line Input #1,Prlin$
If Len(Prlin$)>79
Inc Cnt%
Endif
Lprint Prlin$
Inc Cnt%
If Cnt%>=Plen%-2
Cnt%=0
Lprint Head$;" Seite ";Seite%
Lprint
Inc Seite%
Endif
Wend
Close #1
Mid$(Dta$,30)=Space$(15)
If Cnt%
Lprint Chr$(12);
Endif
Fehler=Gemdos(&H4F)
Until Fehler
Endif
Return