Skip to content
This repository has been archived by the owner on Dec 9, 2018. It is now read-only.

implement env::args #71

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ main() {
fi

local examples=(
args
create
format
format
Expand All @@ -22,6 +23,11 @@ main() {
)

for example in ${examples[@]}; do
# FIXME(redox-os/ralloc#{44,45})
if [ $example = args ]; then
continue
fi

cross run --target $TARGET --example $example
done

Expand Down
7 changes: 7 additions & 0 deletions examples/args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use std::env;

fn main() {
for arg in env::args_os() {
println!("{:?}", arg);
}
}
19 changes: 19 additions & 0 deletions examples/stat.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use std::fs;
use std::fs::File;
use std::io::Write;
use std::process;

pub fn main() {
let path = "/target/stat";
let content = b"Test stat\n";
let size = content.len() as u64;
let file = File::create(path).unwrap();
(&file).write_all(b"Test stat\n").unwrap();
let f = file.metadata().unwrap();
let s = fs::metadata(path).unwrap();
let l = fs::symlink_metadata(path).unwrap();
println!("{} {} {} {}", size, f.len(), s.len(), l.len());
if f.len() != size || s.len() != size || l.len() != size {
process::exit(1);
}
}
Loading