added a TSM torture tool
[tridge/junkcode.git] / chmode.c
1 #include <stdio.h>
2 #include <sys/types.h>
3 #include <sys/stat.h>
4
5
6
7 int aoct_int(char *s)
8 {
9 int l = strlen(s);
10 int i;
11 int res=0;
12 for (i=0;i<l;i++)
13         {
14         int v;
15         char c = s[l-i-1];
16         if (c=='0') continue;
17         v = c-'1' + 1;
18         res |= (v<<(i*3));
19         }
20 return(res);
21 }
22
23
24 main(argc,argv)
25 int argc;
26 char *argv[];
27 {
28 if (argc>2) chmod(argv[2],aoct_int(argv[1]));
29 return(0);
30 }
31