Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/src/cmd/unix/u9fs/dirmodeconv.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <plan9.h>
2
#include <fcall.h>
3
 
4
static char *modes[] =
5
{
6
	"---",
7
	"--x",
8
	"-w-",
9
	"-wx",
10
	"r--",
11
	"r-x",
12
	"rw-",
13
	"rwx",
14
};
15
 
16
static void
17
rwx(long m, char *s)
18
{
19
	strncpy(s, modes[m], 3);
20
}
21
 
22
int
23
dirmodeconv(va_list *arg, Fconv *f)
24
{
25
	static char buf[16];
26
	ulong m;
27
 
28
	m = va_arg(*arg, ulong);
29
 
30
	if(m & DMDIR)
31
		buf[0]='d';
32
	else if(m & DMAPPEND)
33
		buf[0]='a';
34
	else
35
		buf[0]='-';
36
	if(m & DMEXCL)
37
		buf[1]='l';
38
	else
39
		buf[1]='-';
40
	rwx((m>>6)&7, buf+2);
41
	rwx((m>>3)&7, buf+5);
42
	rwx((m>>0)&7, buf+8);
43
	buf[11] = 0;
44
 
45
	strconv(buf, f);
46
	return 0;
47
}