source: rtems/cpukit/libmisc/shell/shell_getprompt.c @ 0893220

4.104.115
Last change on this file since 0893220 was 0893220, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/29/09 at 12:12:39

Whitespace removal.

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