On Sat, Dec 06, 2008 at 10:22:44AM -0500, Joseph Smith wrote:
Hello, For the Paraflasher project I would like to setup a function to automatically detect the presence of the PC's parallel ports and their base addresses. This way it doesn't need to be hard-coded into the program. I was thinking of using /proc/ioports to do this but I am not really sure how to do this in C. Here is what I am thinking:
- First use grep -c paraport /proc/ioports to check if we have multiple
parallel ports and maybe setup loop for it. 2. Then grep paraport /proc/ioports again to get the base address of each parallel port detected. This is where I am stuck. I just need to turn the first 4 characters (base address) into a variable. Can anyone help???
Would an environment variable be ok? Sed/awk should be able to do that for you.
Thanks, Ward.