source: rtems/cpukit/libmisc/shell/main_chmod.c @ 2649eef

4.104.115
Last change on this file since 2649eef 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 *  CHMOD 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_chmod(
31  int argc,
32  char *argv[]
33)
34{
35  int n;
36  mode_t mode;
37
38  if (argc > 2) {
39    mode = rtems_shell_str2int(argv[1]) & 0777;
40    n = 2;
41    while (n < argc)
42      chmod(argv[n++], mode);
43  }
44  return 0;
45}
46
47rtems_shell_cmd_t rtems_shell_CHMOD_Command = {
48  "chmod",                                      /* name */
49  "chmod 0777 n1 n2... # change filemode",      /* usage */
50  "files",                                      /* topic */
51  rtems_shell_main_chmod,                       /* command */
52  NULL,                                         /* alias */
53  NULL                                          /* next */
54};
Note: See TracBrowser for help on using the repository browser.