1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1982-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * David Korn <dgk@research.att.com> *
19 ***********************************************************************/
38 # define SH_DICT "libshell"
41 int b_umask(int argc
,char *argv
[],void *extra
)
44 register int flag
= 0, sflag
= 0;
46 while((argc
= optget(argv
,sh_optumask
))) switch(argc
)
52 errormsg(SH_DICT
,2, "%s", opt_info
.arg
);
55 errormsg(SH_DICT
,ERROR_usage(2), "%s",opt_info
.arg
);
59 errormsg(SH_DICT
,ERROR_usage(2),"%s",optusage((char*)0));
60 argv
+= opt_info
.index
;
69 flag
= (flag
<<3) + (c
-'0');
71 errormsg(SH_DICT
,ERROR_exit(1),e_number
,*argv
);
78 c
= strperm(cp
,&cp
,~flag
&0777);
82 errormsg(SH_DICT
,ERROR_exit(1),e_format
,mask
);
92 sfprintf(sfstdout
,"%s\n",fmtperm(~flag
&0777));
94 sfprintf(sfstdout
,"%0#4o\n",flag
);