Use correct win file open constants, per MinGW

This commit is contained in:
Brian Anderson 2011-07-21 18:10:11 -07:00
parent a0a2cee896
commit 06a6005447
2 changed files with 13 additions and 14 deletions

View File

@ -32,12 +32,12 @@ mod libc_constants {
fn O_RDONLY() -> int { ret 0; }
fn O_WRONLY() -> int { ret 1; }
fn O_RDWR() -> int { ret 2; }
fn O_APPEND() -> int { ret 1024; }
fn O_CREAT() -> int { ret 64; }
fn O_EXCL() -> int { ret 128; }
fn O_TRUNC() -> int { ret 512; }
fn O_TEXT() -> int { ret 16384; }
fn O_BINARY() -> int { ret 32768; }
fn O_APPEND() -> int { ret 0x0008; }
fn O_CREAT() -> int { ret 0x0100; }
fn O_EXCL() -> int { ret 0x0400; }
fn O_TRUNC() -> int { ret 0x0200; }
fn O_TEXT() -> int { ret 0x4000; }
fn O_BINARY() -> int { ret 0x8000; }
fn S_IRUSR() -> uint {
ret 256u; // really _S_IREAD in win32

View File

@ -1,20 +1,17 @@
// xfail-stage0
// xfail-stage1
// xfail-stage2
// -*- rust -*-
use std;
import std::io;
import std::str;
fn test_simple(str tmpfilebase) {
let str tmpfile = tmpfilebase + ".tmp";
fn test_simple() {
let str tmpfile = "test/run-pass/lib-io-test-simple.tmp";
log tmpfile;
let str frood = "A hoopy frood who really knows where his towel is.";
log frood;
{
let io::writer out = io::file_writer(tmpfile, [io::create]);
let io::writer out = io::file_writer(tmpfile, [io::create,
io::truncate]);
out.write_str(frood);
}
let io::reader inp = io::file_reader(tmpfile);
@ -23,4 +20,6 @@ fn test_simple(str tmpfilebase) {
assert (str::eq(frood, frood2));
}
fn main(vec[str] argv) { test_simple(argv.(0)); }
fn main() {
test_simple();
}