[comp.sys.amiga.programmer] How do I update the CLI prompt from AL ?

amuser@cutmcvax.cs.curtin.edu.au (Bill Sharp-Smith AUG) (05/17/91)

For a club member (Brian Scott):

In an assembly language program, I am using lock/unlock, examine, exnext
and currentdir from the DOS library to change directories, but the shell
prompt showing the current directory won't update.

What other functions should I use to update the prompt ?


Amiga Users Group of Western Australia

jesup@cbmvax.commodore.com (Randell Jesup) (05/20/91)

In article <amuser.674447972@cutmcvax> amuser@cutmcvax.cs.curtin.edu.au (Bill Sharp-Smith AUG) writes:
>In an assembly language program, I am using lock/unlock, examine, exnext
>and currentdir from the DOS library to change directories, but the shell
>prompt showing the current directory won't update.

	Under 2.0, use SetCurrentDirName().  Under 1.3 and before, you
must modify it directly.  Note this can be dangerous, since it has a maximum
length, so limit the number of characters stuffed into it under 1.3 to
79.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com  BIX: rjesup  
Disclaimer: Nothing I say is anything other than my personal opinion.
Thus spake the Master Ninjei: "To program a million-line operating system
is easy, to change a man's temperament is more difficult."
(From "The Zen of Programming")  ;-)

beust@taloa.unice.fr (Cedric Beust) (05/21/91)

: In article <amuser.674447972@cutmcvax> amuser@cutmcvax.cs.curtin.edu.au (Bill Sharp-Smith AUG) writes:
:In an assembly language program, I am using lock/unlock, examine, exnext
:and currentdir from the DOS library to change directories, but the shell
:prompt showing the current directory won't update.
: 

  You'll have to write the value yourself. Something like that should
do the trick:

void
Update_Prompt(char *currentdir)
/* Update the concerned field with the new current dir                 */
/* This routine is for users of wshell or such, thar display this name */
/* as the shell prompt.                                                */
{
  struct Process *pr = (struct Process *) FindTask(0L);
  struct CommandLineInterface *cli =
    (struct CommandLineInterface *) (pr -> pr_CLI) << 2;
  char *p = (char *) (cli -> cli_SetName) << 2;

  *p++ = strlen(currentdir);          /* it is a BSTR, so length first */
  while (*currentdir) *p++ = *currentdir++;  /* don't add '\0' */
}


  Really ugly, eh?

NOTE: This is extracted from ccd.c in the file
      incoming/amiga/ccd20.lzh on ab20.

+------------------------------------------------------------------------+
| Cedric BEUST                                     University of Nice    |
| INET: beust@taloa.unice.fr                       $whoami               |
| UUCP: llaor.unice.fr!arkonis!beust               god (personal alias)  |
|                   -- "To be, or not to be...",                         |
|                      That is illogical, captain!                       |
|                                     -- Spock                           |
+------------------------------------------------------------------------+