Hi,
here a little procedure which tests if a device is available in the systems
device list. Device means things like "DF0", "DH0", etc., but also devices
like "PIPE", "AUX" etc.
Parameter : name of the device to check for (e.g. "CON", "PAR" etc.).
Note: you don't have to add an ":" after the name
Returns : TRUE (-1) if the device is available, FALSE (0) if the device is
not present in the systems device list
Procedure.b CheckDevice(device$)
info.l=PeekL(PeekL(DosBase()+34)+24)*4 ; DosBase+34=root structure, root+24=info structure, *4 because it is a BCPL pointer
devinfo.l=PeekL(info+4)*4 ; pointer to deviceinfo structure
texte.l=PeekL(devinfo+40)*4 ; pointer to the name of the device
type.l=PeekL(devinfo+4) ; what type ? (0=device 1=directory 2=volume
While devinfo0 ; we search in all deviceinfo structures, 0= end of lists
IF type=0 ; type=device
text$=PeekS(texte+1) ; read out name of device (DF1 etc.), +1 because it is a BCPL string
IF text$=UCase(device$) ; is it the device we search for
ProcedureReturn -1 ; yes --> return TRUE
EndIf
EndIf
devinfo=PeekL(devinfo)*4 ; next device
texte=PeekL(devinfo+40)*4
type=PeekL(devinfo+4)
Wend
ProcedureReturn 0 ; not found --> return FALSE
EndProcedure
ok.b=CheckDevice("AWNPIPE")
if ok=-1
PrintN("Ok, AWNPIPE is available, we can use it!")
Else
PrintN("Hmm, AWNPIPE is not available, we use PIPE instead

EndIf
End
Greetings ..
Roxxler