[Coco] Programming for DriveWire (Advanced)
Bill Pierce
ooogalapasooo at aol.com
Thu Oct 8 23:38:55 EDT 2020
William, yes there is a way, but it's tedious and for the most part, was unusable for my purposes in MShell. Aaron actually wrote a couple of new commands that were added into DW4 in 2013 that were geared to solve a problem I was having in parsing the PC directories (which is what I assume you are looking for). In those new commands, he omitted the file dates.
Also, the command you are looking for is not directly accessible from the cmd line and is more suited to use in programming. You are probably aware of the "DW" command set which IS accessible from the command line through the "dw" cmd included with almost all NitrOS9 distribution disk images. If you are not familiar with this cmd, just type "dw" and enter. If the cmd is present on your machine, you will get a list of possible "dw sub-cmds. Using these sub-cmds, and typing any of them in (complete with the previous cmd string), you will get either a new list of possible cmds for that cmd, or an error telling you what data is missing. Through these cmds you get the power embedded in DW4 that can open MANY doors, BUT... a lot of these cmds return string data, formatted for the Coco screen, with delimiters between each item (like | or -) and/or a bunch of spaces between stuff. This format makes it hard to use this in a program because you have to stop on each entry and sort through the strings to extract the particular info you're after which is not only a pain, but time consuming as well and time is something the Coco doesn't have and DW4 doesn't wait when sending these packets.
Now with all that said, we basically come to the conclusion that the dw cmd set is for listing stuff to the screen and not for extracting info data for program arrays.
This was my dilemma when I was first starting MShell and when inquiring to Aaron about it, he said "Why don't you use the "ui" cmd set?". Huh? "ui" cmd set?, what the hell is that? So he proceeds to tell me the ui cmd set returns more "machine friendly" data, mostly in binary or strings directly reflecting the info you're requesting. Ok, new cmd set, new info... After months of playing with this, it still ended up being formatted in such a way as to take forever to filter the returned strings to get the info you want. So, Aaron wrote 2 new commands specifically for the purpose of reading the PC dirs, but with almost no delimiters or spaces so I could filter things quickly, but as I said in the beginning, it didn't include the file dates, BUT the original ui cmd DID!
Here's something for you to try... on the tiny cmd line at the bottom of the DW4 console (not the Coco), and yes, that little blank space is a cmd line, type :
ui server file dir C:/ (or any drive on your system, I think you mentioned Linux, so you use that format for the drive name) or complete path to the dir of your choice and you get a complete listing of the contents of that folder. It looks a little odd because it is odd and that's what made it unusable for me. The return text format is (in ASCII text)
\|CompletePathAndFilename|Device|Size|LastModified|True/False IsDirectory?|True/False IsReadOnly?
Example:
ui server file dir c:/
\|C:\temp|c:\|4096|1602208286277|true|false
(I only did one returned entry out of over one hundred)
Each "|" is the separator for each item.
And this returns for each dir entry.
The "last modified" date is encoded and to be honest, I would have to look through all my notes to find the format (You may be able to figure that out). I want to say it's the binary equivalent of the date, but I'm not sure.
I have a couple of documents I will send you offlist since we can't attach things here. They explain the cmds and formats much better than I can in an email. Also, the method for RECEIVING the cmd response is tedious to say the least. I spent about 6 months just getting my head around it when Aaron would explain it to me, but I eventually got it and learned to use it. The "dw" cmd just spewed the received data to the Coco screen unless you piped it elsewhere. It will take either C or Asm programming to do this with any speed as the response text comes fast in about 222 char packets non stop and the Coco must be receiving and acknowledging the receipt on every packet or it will time out and error. Timing is critical. The bad this is, using the above format remember... PC (or Mac, or Linux" filenames/Dirnames can be extremely long and contain characters OS9 doesn't like, not to mention you get the complete pathlist which can be even longer based on how deep in your drive you're going LOL
Typing just ui in the DW4 cmd line box gives you the complete possible cmd list and going down the line you can get everything OR... you can type "dw server help show" or "ui server help show" and you can get ALL the cmd listings for both sets.
I will be sending you a personal email with some documents attached that will explain it better than this. These documents are my notes from 3 or 4 years of grilling Aaron almost daily for information. LMAO. And also from things I figured out.
Expect an email from "ooogalapasooo at aol.com" in the next 24 hours (I have to find all the documents).
Bill
-----Original Message-----
From: William Carlin <whcarlinjr at gmail.com>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Thu, Oct 8, 2020 8:52 pm
Subject: [Coco] Programming for DriveWire (Advanced)
Bill Pierce and other DriveWire 4 gurus,
I have a few questions about programming for DriveWire in C.
Is it possible to have DriveWire 4 check if a file exists and if it does,
get the last modified date/time and the file length as defined in the
Apache Commons specifications for the Class FileEntry. I want to be able
to point DriveWire 4 at a remote file system (CIFS, HTTP, or FTP),
determine if a file exists, and get the last modified date/time and the
length of the file.
I have noticed in MShell when viewing an OS9 RBF file system the
create/last modified dates and file size are listed in the file details
section at the bottom of the window. However, when viewing the PC file
system those details are not present. I was wondering if those details
were not yet implemented in MShell or if the details cannot be obtained by
the current DriveWire protocol.
Link to the Apache Commons Library Specification:
http://commons.apache.org/proper/commons-io/apidocs/index.html?org/apache/commons/io/package-summary.html
As always, thank you for your help and thank you for creating and sharing
MShell with the community,
William Carlin
--
Coco mailing list
Coco at maltedmedia.com
https://pairlist5.pair.net/mailman/listinfo/coco
More information about the Coco
mailing list