File indexing completed on 2025-05-11 08:24:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifdef HAVE_CONFIG_H
0016 #include "config.h"
0017 #endif
0018
0019 #include <stdio.h>
0020 #include <unistd.h>
0021 #include <string.h>
0022 #include <errno.h>
0023 #include <sys/types.h>
0024 #include <sys/stat.h>
0025
0026 #include <rtems.h>
0027 #include <rtems/shell.h>
0028 #include <rtems/stringto.h>
0029 #include "internal.h"
0030
0031 static int rtems_shell_main_umask(
0032 int argc,
0033 char *argv[]
0034 )
0035 {
0036 unsigned long tmp;
0037 mode_t msk = umask(0);
0038
0039 if (argc == 2) {
0040 if ( rtems_string_to_unsigned_long(argv[1], &tmp, NULL, 0) ) {
0041 printf( "Mask argument (%s) is not a number\n", argv[1] );
0042 return -1;
0043 }
0044 msk = (mode_t) tmp;
0045
0046 }
0047 umask(msk);
0048
0049 msk = umask(0);
0050 printf("0%o\n", (unsigned int) msk);
0051 umask(msk);
0052 return 0;
0053 }
0054
0055 rtems_shell_cmd_t rtems_shell_UMASK_Command = {
0056 "umask",
0057 "umask [new_umask]",
0058 "misc",
0059 rtems_shell_main_umask,
0060 NULL,
0061 NULL
0062 };