olch@geocub.greco-prog.fr (Olivier Charrier) (01/15/90)
Hello, every one. I'm new to Usenet, so be indulgent about what follows. I've been developping these last months a 'find' utility for Amiga, and I've run over a problem that finally became a real obsession to me. It brought a lot of questions to which I was unable to answer. First, allow me to advertise my prog a little. Find's help banner looks roughly like this: find (v3.9b) Recursive search of files Usage: find -[acgsv] <dir> <pattern> -a: Don't stop at first occurence found -c: Don't ignore case -g: Do a CD to the directory found -s: Stop at first occurence, even if pattern invoked -v: Displays directories names while searching Wildcards: #, ? and * CTRL-C at any time to abort search Quite simple as you see. It works just fine and is only 2900 bytes long (it doesn't use any external library like arp. Could be even smaller if it did). It's gone through numerous versions and I think I can say it has become quite reliable by now. A four pages doc is included (BTW, any information about how to post it on the net would be welcome, if any one is interested). The bug concerns the -g option. This one is mostly used in scripts (for example, to delete all the .fastdir on a hard disk). The CD is effectively done (I use CurrentDir) but the bug is that the prompt isn't updated (if it includes %S, of course). Only a CD typed by the user does this. For example, here is what happens: RAM DISK:> find -g jh0: test.c jh0:cprg/test.c RAM DISK:> cd jh0:cprg> You see what I mean? This doesn't prevent the stuff from working but since it is the last known bug in find (so far :-) ), it is really getting on my nerves. Watch out, questions ahead! Does anyone know how the prompt can be changed? Is it only possible or can it only be done by the user and not from a program? And this brings a much more general question: how do handlers work? I have not the faintest idea about this and Commodore's documentation on this topic is *very* poor (not to say inexistent). I'd like to be sure not to miss any answer to my question, so I'd greatly appreciate if you could e-mail me everything you know about that at one of these following addresses (by the way, my name is Cedric Beust): gnu@cerisi.cerisi.fr (I prefer this one) or olch@geocub.greco-prog.fr Of course, you can put your answer on the net as well, I'll probably read it sooner or later. Thank you for listening. C.B.
walker@sas.UUCP (Doug Walker) (01/17/90)
In article <1577@geocub.greco-prog.fr> olch@geocub.greco-prog.fr (Olivier Charrier) writes: >.fastdir on a hard disk). The CD is effectively done (I use CurrentDir) but >the bug is that the prompt isn't updated (if it includes %S, of course). You need to update the cli_SetName field in the CLI structure associated with your process. To get this, do the following: #include <exec/types.h> #include <libraries/dosextens.h> Process = (struct Process *)FindTask(0L); CLI = (struct CommandLineInterface *)BADDR(Process->pr_CLI); cname = (unsigned char *)BADDR(cli->cli_SetName); if((len=strlen(cname)) > 254) len = 254; cname[0] = len; memcpy(cname, NewDirectoryName, len); The 'BADDR' macro converts a BCPL address to a normal C address. It's defined in some header file somewhere, probably as #define BADDR(xxx) ((APTR)((LONG)xxx)<<2) or some such thing. ***** =*|_o_o|\\=====Doug Walker, Software Distiller======================= *|. o.| || | o |// For all you do, this bug's for you! ====== usenet: ...mcnc!rti!sas!walker plink: dwalker bix: djwalker