source: rtems/cpukit/libmisc/shell/main_whoami.c @ 031deada

4.104.115
Last change on this file since 031deada was 031deada, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/02/09 at 13:04:13

Add attribute((unused)) to unused function args.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  WHOAMI Shell Command Implmentation
3 *
4 *  Author: Fernando RUIZ CASAS
5 *  Work: fernando.ruiz@ctv.es
6 *  Home: correo@fernando-ruiz.com
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#ifdef HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <stdio.h>
20#include <unistd.h>
21#include <string.h>
22#include <errno.h>
23#include <pwd.h>
24
25#include <rtems.h>
26#include <rtems/shell.h>
27#include "internal.h"
28
29int rtems_shell_main_whoami(
30  int   argc __attribute__((unused)),
31  char *argv[] __attribute__((unused))
32)
33{
34  struct passwd *pwd;
35
36  pwd = getpwuid(geteuid());
37  printf( "%s\n", (pwd) ? pwd->pw_name : "nobody");
38  return 0;
39}
40
41rtems_shell_cmd_t rtems_shell_WHOAMI_Command = {
42  "whoami",                                   /* name */
43  "show current user",                        /* usage */
44  "misc",                                     /* topic */
45  rtems_shell_main_whoami,                    /* command */
46  NULL,                                       /* alias */
47  NULL                                        /* next */
48};
Note: See TracBrowser for help on using the repository browser.