shithub: mc

Download patch

ref: 2f8a4d4228222a227c4022478bd8e2e64596af52
parent: 42a818c93ff5762836fe6951692fb8165e8fd284
author: Ori Bernstein <[email protected]>
date: Tue Dec 23 10:39:18 EST 2014

We want the mode bits to be ints.

--- a/libstd/sys+plan9-x64.myr
+++ b/libstd/sys+plan9-x64.myr
@@ -17,23 +17,23 @@
 	const Orclose	: fdopt = 64
 	const Oexcl	: fdopt = 0x1000
 
-	const Qtdir	: int64  = 0x80
-	const Qtappend	: int64  = 0x40
-	const Qtexcl	: int64  = 0x20
-	const Qtmount	: int64  = 0x10
-	const Qtauth	: int64  = 0x08
-	const Qttmp	: int64  = 0x04
-	const Qtfile	: int64  = 0x00
+	const Qtdir	: int  = 0x80
+	const Qtappend	: int  = 0x40
+	const Qtexcl	: int  = 0x20
+	const Qtmount	: int  = 0x10
+	const Qtauth	: int  = 0x08
+	const Qttmp	: int  = 0x04
+	const Qtfile	: int  = 0x00
 
-	const Dmdir	: int64 = 0x8000000
-	const Dmappend	: int64 = 0x4000000
-	const Dmexcl	: int64 = 0x2000000
-	const Dmmount	: int64 = 0x1000000
-	const Dmauth	: int64 = 0x0800000
-	const Dmtmp	: int64 = 0x0400000
-	const Dmread	: int64 = 0x4
-	const Dmwrite	: int64 = 0x2
-	const Dmexec	: int64 = 0x1
+	const Dmdir	: int = 0x8000000
+	const Dmappend	: int = 0x4000000
+	const Dmexcl	: int = 0x2000000
+	const Dmmount	: int = 0x1000000
+	const Dmauth	: int = 0x0800000
+	const Dmtmp	: int = 0x0400000
+	const Dmread	: int = 0x4
+	const Dmwrite	: int = 0x2
+	const Dmexec	: int = 0x1
 
 	const Syssysr1		: scno = 0
 	const Sys_errstr	: scno = 1
--- a/libstd/syswrap+plan9.myr
+++ b/libstd/syswrap+plan9.myr
@@ -41,14 +41,14 @@
 /* fd stuff */
 const open	= {path, opts;	-> openmode(path, opts, 0o777)}
 const openmode	= {path, opts, mode;
-	if opts & Ocreat
-		sys.create(path, opts castto(sys.fdopt), mode) castto(fd)
+	if opts & Ocreat != 0
+		-> sys.create(path, opts castto(sys.fdopt), mode) castto(fd)
 	else
-		sys.open(path, opts castto(sys.fdopt)) castto(fd)
+		-> sys.open(path, opts castto(sys.fdopt)) castto(fd)
 	;;
 }
-const close	= {fd;		-> sys.close(fd castto(sys.fd))}
-const creat	= {path, mode;	-> sys.create(path, opts, mode) castto(fd)}
+const close	= {fd;		-> sys.close(fd castto(sys.fd)) castto(int64)}
+const creat	= {path, mode;	-> sys.create(path, sys.Owronly | sys.Otrunc, mode) castto(fd)}
 const read	= {fd, buf;	-> sys.read(fd castto(sys.fd), buf) castto(size)}
 const write	= {fd, buf;	-> sys.write(fd castto(sys.fd), buf) castto(size)}
 const pipe	= {fds;		-> sys.pipe(fds castto(sys.fd[2]#))}