Index: doc/tex/cliprompt.tex =================================================================== --- doc/tex/cliprompt.tex (revision 134004) +++ doc/tex/cliprompt.tex (working copy) @@ -12,6 +12,8 @@ \item \%h - Full hostname \item \%H - Short hostname \item \%t - Time + \item \%u - Username + \item \%g - Groupname \item \%\% - Percent sign \item \%\# - '\#' if Asterisk is run in console mode, '$>$' if running as remote console \item \%Cn[;n] - Change terminal foreground (and optional background) color to specified Index: main/asterisk.c =================================================================== --- main/asterisk.c (revision 134004) +++ main/asterisk.c (working copy) @@ -1999,6 +1999,8 @@ char *pfmt; int color_used = 0; char term_code[20]; + struct passwd *pw; + struct group *gr; if ((pfmt = getenv("ASTERISK_PROMPT"))) { char *t = pfmt, *p = prompt; @@ -2088,6 +2090,16 @@ if (ast_localtime(&ts, &tm, NULL)) ast_strftime(p, sizeof(prompt) - strlen(prompt), "%H:%M:%S", &tm); break; + case 'u': /* username */ + pw = getpwuid(getuid()); + if (pw) + strncat(p, pw->pw_name, sizeof(prompt) - strlen(prompt) -1); + break; + case 'g': /* group */ + gr = getgrgid(getgid()); + if (gr) + strncat(p, gr->gr_name, sizeof(prompt) - strlen(prompt) - 1); + break; case '#': /* process console or remote? */ if (!ast_opt_remote) strncat(p, "#", sizeof(prompt) - strlen(prompt) - 1);