rachamp@mbunix.mitre.org (Richard A. Champeaux) (06/27/89)
I'm trouble using getenv() from inside a handler. If I call getenv() before 'set' has been executed, the system hangs. It doesn't matter what variable has been set, just so long as set is executed before the getenv() is called. I tried calling setenv() to set a dummy variable immediately before calling getenv(), but then it crashes on the setenv(). I have no trouble calling these routines from a regular program. I have a feeling that it has something to do with the handler being at a higher priority than a regular program would be, which I guess keeps the enviroment from being initialized. Any ideas? Also, I had thought about scapping support of Manx enviroment variables, and just use the AmigaDOS ones. But, my God, they sure are hard to get at from inside a handler. You can't use Open(), Read(), or Close() from inside a handller, so you have to build the packets and send them yourself. That sure is a lot of code and effort just to get at an enviroment variable. Especially, since the RKM doesn't give enough info to figure it out, and trying to piece together 2 or 3 example programs ain't too much fun. Did Commodore write functions to read and write enviroment variables? If not, they should have. Is there anyone out there that has written such a thing? Better yet, is there anyone out there who has written, or is willing to write, replacements for Open(),Read(), etc., that don't use the process's message port? Any help would be greatly appreciated. Especially if it's example code on how to create a packet and send it to a handler. I've dealt with packets from the handler's side, but there's not much to do there; just play with the arguments and call returnpkt() when your done. Thanks, Rich Champeaux (rachamp@mbunix.mitre.org)
jesup@cbmvax.UUCP (Randell Jesup) (07/01/89)
In article <57878@linus.UUCP> rachamp@mbunix.mitre.org (Champeaux) writes: > > I'm trouble using getenv() from inside a handler. If I call getenv() >before 'set' has been executed, the system hangs. It doesn't matter what >variable has been set, just so long as set is executed before the >getenv() is called. I tried calling setenv() to set a dummy variable >immediately before calling getenv(), but then it crashes on the setenv(). This is because the "enviroment.library" that manx uses doesn't exist (it SHOULDN'T have been a library), and OpenLibrary tries to load it from disk (doing Dos calls, of course). > Also, I had thought about scapping support of Manx enviroment variables, >and just use the AmigaDOS ones. But, my God, they sure are hard to get at >from inside a handler. You can't use Open(), Read(), or Close() from inside >a handller, so you have to build the packets and send them yourself. Yup. Standard trick is to spawn off a subroutine as a process, and have it read the variable and send your handler the value. >Any help would be greatly appreciated. Especially if it's example code on how >to create a packet and send it to a handler. I've dealt with packets from >the handler's side, but there's not much to do there; just play with the >arguments and call returnpkt() when your done. Important thing when writing a handler: dp_Port MUST be set to your process message port by replypkt() - some programs use this to "ping-pong" packets. When queuing packets to a handler, dp_Port must be set to your reply port (usually your process message port). -- Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup
peter@sugar.hackercorp.com (Peter da Silva) (07/02/89)
I think it's long past time thet a replacement for dos.library taht didn't require you to be a 'process' showed up. Here's my ideas: (1) FileHandle has all the stuff you need to indicate a file (pretty much what a file handle currently has) PLUS A MESSAGE PORT. I/O is done via that message port. (2) Add a routine MessagePort(fh) which returns the port, so you can do asynchronous I/O that works well with synchronous I/O. This would have to have a new name. :-<, but there's so much stuff that's dependent on certain brain-damaged aspects of the old dos.library. -- Peter "Have you hugged your wolf today" da Silva `-_-' ...texbell!sugar!peter, or peter@sugar.hackercorp.com 'U`