source: rtems/cpukit/libmisc/shell/main_umask.c @ e4a3d93

4.104.115
Last change on this file since e4a3d93 was 00a2d366, checked in by Joel Sherrill <joel.sherrill@…>, on 07/17/08 at 15:43:56

2008-07-17 Joel Sherrill <joel.sherrill@…>

  • libmisc/monitor/mon-monitor.c, libmisc/monitor/mon-object.c, libmisc/monitor/monitor.h, libmisc/shell/main_chmod.c, libmisc/shell/main_tty.c, libmisc/shell/main_umask.c, libmisc/shell/main_whoami.c: Add pthread command to monitor when POSIX is enabled. Remove include of rtems/monitor.h from files not related.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  UMASK 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 <sys/types.h>
24#include <sys/stat.h>
25
26#include <rtems.h>
27#include <rtems/shell.h>
28#include "internal.h"
29
30int rtems_shell_main_umask(
31  int   argc,
32  char *argv[]
33)
34{
35  mode_t msk = umask(0);
36
37  if (argc == 2)
38    msk = rtems_shell_str2int(argv[1]);
39  umask(msk);
40
41  msk = umask(0);
42  printf("0%o\n", (unsigned int) msk);
43  umask(msk);
44  return 0;
45}
46
47rtems_shell_cmd_t rtems_shell_UMASK_Command = {
48  "umask",                                    /* name */
49  "umask [new_umask]",                        /* usage */
50  "misc",                                     /* topic */
51  rtems_shell_main_umask,                     /* command */
52  NULL,                                       /* alias */
53  NULL                                        /* next */
54};
Note: See TracBrowser for help on using the repository browser.