CompuServe Thread

#Code to ASSIGN (OS1.2)

4 messages in this thread
#41270From: Frank StaudteJun 1, 1994 12:48 PM
Hi Murray, one easy way to accomplish this is to call the amiga-dos program "assign" from your source. This has the same affect as if you called it before starting your program from the shell/cli. To do this, call the Dos function: Execute ("assign c: dh1:c",NULL,NULL); To change the dos library structure is not a good way to go. As far as I know this is read only. If you do a lot of 1.2 only programming, I would suggest you to get a copy of the PD library "arp.library" (somewhere on Fish and/or Compuserve). It includes functions for dos commands as well as file requesters and so on. Drop me a note if you need more help. Frank 100325,106
#41280From: Murray DowlingJun 1, 1994 10:26 PM
Thanks for your reply. > function: Execute ("assign c: dh1:c",NULL,NULL); This is what I am doing at the moment. My application is to convert my Startup-Sequence to C to make it faster (it boots from floppy & loads the HD drivers). Also it satisfies a strange desire that I have had since first getting the Amiga to write my own "Assign"! Consider it an academic exercise. The HD I am using is very slow, and calling assign multiple times is a bit painful. I am also trying to avoid loading libraries (like arp) to conserve memory (some programs on the HD only just work with 1 Meg & HD loaded). > If you do a lot of 1.2 only programming, No I don't. The cheapest way for me to upgrade my 1.2 Amiga is to buy a new one. This still leaves me with a 1.2 machine for my wife! My next attempt at "Assign" (persistent, eh?) is to send messages to the file system handler pointed to by the DevInfo structure.
#41331From: John Toebes/SYSOPJun 4, 1994 11:10 AM
To actually do an assign is a bit of a task under 1.2, but if you want to you can take the following route: 1. Create a lock on the item that you want to assign using Lock() 2. Create a DosList structure using a DosAllocMem function (the length in longwords needs to be immediately before the data) 3. Create a Bstr (out of DosAllocMemed memory) with the name of the assign – IGNORE the colon. 4. Fill in the fields with dol_Lock=your lock, dol_Type = DLT_DIRECTORY, dol_Task = deviceproc of the lock , dol_Name=namebstr. 5. Add it to the list of devices. To get to this, you DosBase as your starting point. It will point to dl_Root which is a RootNode. The BPTR rn_Info points to a struct DosInfo. In there, di_Devices is a BPTR to the start of the list. Add your node at the head of the list. Of course, you should check for error conditions (like it is already in the list, not enough memory, bad locks, …) Enjoy. P.S. Allways program with the buddy system. You never know when one of those bugs will zap you 🙂
#41350From: Murray DowlingJun 6, 1994 4:57 AM
> To actually do an assign is a bit of a task under 1.2, but if you want > to you can take the following route: Just when I thought nobody knew the answer, along comes a knight in shining armour! Your answer was along the lines that I was working on. Where I am getting stuck is working out what to do with the structure that already is assigning the name I want to re-assign. Presumably I can't just delete it (even after calling Forbid() and UnLocking the lock) as somebody may be using that assign or the handler may need some shutdown code. Thank's for your very thorough reply though. At the very least I know I am on the right track!