When writing shell scripts for myself, I often found the need
to fork based on whether or not I was working in an emulated
environment like WinUAE or on a real Amiga. One way of doing
this is to check to see if a device is loaded or not.
This is the work of an hour or two to solve that problem. It
accomplishes the task I needed which is to do the following:
1. Allow me to specify any device name
2. Return 5 (WARN) if the device could not be found
3. Optionally quiet output for scripts
4. Have helpful usage information
The source is included. The software license is do whatever you
want with it.
Thanks to amitrans for pointing out that opening a device was
not the same as detecting the presence of the device in memory.
It took a little while for me to find the solve, but this should
do the trick.
I have an associated package on Aminet called HasDevice that
will receive an update and rename.
Enjoy!
- Brie
|