blob: 51777f78c039c9f05a8087c5e0e0e22ec709f441 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* Dynamically build the shell prompt
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <time.h>
#include <rtems.h>
#include <rtems/error.h>
#include <rtems/libio.h>
#include <rtems/libio_.h>
#include <rtems/system.h>
#include <rtems/shell.h>
#include "internal.h"
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <pwd.h>
void rtems_shell_get_prompt(
rtems_shell_env_t *shell_env,
char *prompt,
size_t size
)
{
char buf[256];
char *cwd;
/* XXX: show_prompt user adjustable */
cwd = getcwd(buf,sizeof(buf));
cwd = cwd != NULL ? cwd : "?";
snprintf(prompt, size - 1, "%s%s[%s] %c ",
((shell_env->taskname) ? shell_env->taskname : ""),
((shell_env->taskname) ? " " : ""),
cwd,
geteuid()?'$':'#');
}
|