4.104.115
Last change
on this file since 0893220 was
48751ab,
checked in by Joel Sherrill <joel.sherrill@…>, on 07/23/09 at 14:32:34
|
2009-07-23 Joel Sherrill <joel.sherrill@…>
- libmisc/Makefile.am, libmisc/shell/main_chmod.c,
libmisc/shell/main_mdump.c, libmisc/shell/main_medit.c,
libmisc/shell/main_mfill.c, libmisc/shell/main_mmove.c,
libmisc/shell/main_msdosfmt.c, libmisc/shell/main_mwdump.c,
libmisc/shell/main_sleep.c, libmisc/shell/main_umask.c,
libmisc/shell/shell_script.c, libmisc/stringto/stringto.h,
libmisc/stringto/stringto_template.h: Convert return type from bool
to rtems_status_code and add rtems_string_to_pointer. Perform
associated clean up and changes for return type change.
- libmisc/stringto/stringtopointer.c: New file.
|
-
Property mode set to
100644
|
File size:
1.4 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 <rtems/stringto.h> |
---|
29 | #include "internal.h" |
---|
30 | |
---|
31 | int rtems_shell_main_umask( |
---|
32 | int argc, |
---|
33 | char *argv[] |
---|
34 | ) |
---|
35 | { |
---|
36 | unsigned long tmp; |
---|
37 | mode_t msk = umask(0); |
---|
38 | |
---|
39 | if (argc == 2) { |
---|
40 | if ( rtems_string_to_unsigned_long(argv[1], &tmp, NULL, 0) ) { |
---|
41 | printf( "Mask argument (%s) is not a number\n", argv[1] ); |
---|
42 | return -1; |
---|
43 | } |
---|
44 | msk = (mode_t) tmp; |
---|
45 | |
---|
46 | } |
---|
47 | umask(msk); |
---|
48 | |
---|
49 | msk = umask(0); |
---|
50 | printf("0%o\n", (unsigned int) msk); |
---|
51 | umask(msk); |
---|
52 | return 0; |
---|
53 | } |
---|
54 | |
---|
55 | rtems_shell_cmd_t rtems_shell_UMASK_Command = { |
---|
56 | "umask", /* name */ |
---|
57 | "umask [new_umask]", /* usage */ |
---|
58 | "misc", /* topic */ |
---|
59 | rtems_shell_main_umask, /* command */ |
---|
60 | NULL, /* alias */ |
---|
61 | NULL /* next */ |
---|
62 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.