1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

os::args returns Vec<~str> now

This commit is contained in:
Michael Gehring 2014-05-16 10:32:58 +02:00
parent ac72c6925f
commit 4b9c8279ce
25 changed files with 30 additions and 30 deletions

View file

@ -55,7 +55,7 @@ fn main() {
}
};
let progname = args[0].clone();
let progname = args.get(0).clone();
let usage = usage("Base64 encode or decode FILE, or standard input, to standard output.", opts);
let mode = if matches.opt_present("help") {
Help

View file

@ -25,7 +25,7 @@ static VERSION: &'static str = "1.0.0";
fn main() {
let args = os::args();
let program = strip_dir(&args[ 0 ].clone());
let program = strip_dir(args.get(0));
//
// Argument parsing
@ -64,7 +64,7 @@ fn main() {
}
// too many arguments
else if args.len() > 3 {
println(program + ": extra operand `" + args[ 3 ] + "'");
println(program + ": extra operand `" + args.get(3).clone() + "'");
println("Try `" + program + " --help' for more information.");
return;
}
@ -73,12 +73,12 @@ fn main() {
// Main Program Processing
//
let fullname = args[ 1 ].clone();
let fullname = args.get(1).clone();
let mut name = strip_dir(&fullname);
if args.len() > 2 {
let suffix = args[ 2 ].clone();
let suffix = args.get(2).clone();
name = strip_suffix(&name, &suffix);
}

View file

@ -21,7 +21,7 @@ use std::io::{BufferedWriter};
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("A", "show-all", "equivalent to -vET"),
getopts::optflag("b", "number-nonblank", "number nonempty output lines, overrides -n"),

View file

@ -18,7 +18,7 @@ static VERSION: &'static str = "1.0.0";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("z", "zero", "separate output with NUL rather than newline"),
getopts::optflag("", "help", "display this help and exit"),

View file

@ -88,7 +88,7 @@ fn du(path: &Path, mut my_stat: FileStat,
fn main() {
let args = os::args();
let program = args[0].as_slice();
let program = args.get(0).as_slice();
let opts = ~[
// In task
getopts::optflag("a", "all", " write counts for all files, not just directories"),

View file

@ -71,7 +71,7 @@ fn convert_str(string: &str, index: uint, base: uint) -> (char, int) {
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("n", "", "do not output the trailing newline"),
getopts::optflag("e", "", "enable interpretation of backslash escapes"),

View file

@ -29,9 +29,9 @@ static VERSION: &'static str = "1.0.0";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let (args, obs_width) = handle_obsolete(args);
let (args, obs_width) = handle_obsolete(args.as_slice().to_owned());
let opts = [
getopts::optflag("b", "bytes", "count using bytes rather than columns (meaning control characters such as newline are not treated specially)"),

View file

@ -25,7 +25,7 @@ extern {
fn main () {
let args = os::args();
let program = args[0].to_owned();
let program = args.get(0).to_owned();
let options = [
optflag("f", "full", "Default option to show full name"),

View file

@ -45,7 +45,7 @@ fn version() {
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
//
// Argument parsing

View file

@ -30,7 +30,7 @@ static VERSION: &'static str = "1.0.0";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = [
getopts::optflag("b", "binary", "read in binary mode"),

View file

@ -25,7 +25,7 @@ static VERSION: &'static str = "1.0.0";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("s", "serial", "paste one file at a time instead of in parallel"),

View file

@ -26,7 +26,7 @@ static NAME: &'static str = "printenv";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("0", "null", "end each output line with 0 byte rather than newline"),
getopts::optflag("h", "help", "display this help and exit"),

View file

@ -25,7 +25,7 @@ static VERSION: &'static str = "1.0.0";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("", "help", "display this help and exit"),
getopts::optflag("", "version", "output version information and exit"),

View file

@ -31,7 +31,7 @@ static NAME: &'static str = "rm";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
// TODO: make getopts support -R in addition to -r
let opts = ~[

View file

@ -24,7 +24,7 @@ static NAME: &'static str = "rmdir";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("", "ignore-fail-on-non-empty", "ignore each failure that is solely because a directory is non-empty"),

View file

@ -25,7 +25,7 @@ static NAME: &'static str = "sleep";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("h", "help", "display this help and exit"),

View file

@ -25,7 +25,7 @@ static VERSION: &'static str = "1.0.0";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("b", "before", "attach the separator before instead of after"),

View file

@ -25,7 +25,7 @@ static NAME: &'static str = "tee";
static VERSION: &'static str = "1.0.0";
fn main() {
match options(args()).and_then(exec) {
match options(args().as_slice()).and_then(exec) {
Ok(_) => set_exit_status(0),
Err(_) => set_exit_status(1)
}
@ -149,5 +149,5 @@ fn with_path<T>(path: &Path, cb: || -> IoResult<T>) -> IoResult<T> {
}
fn warn(message: &str) {
error!("{}: {}", args()[0], message);
error!("{}: {}", args().get(0), message);
}

View file

@ -48,7 +48,7 @@ static NAME: &'static str = "truncate";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("c", "no-create", "do not create files that do not exist"),

View file

@ -53,7 +53,7 @@ static NAME: &'static str = "uname";
fn main() {
let args = os::args();
let program = args[0].as_slice();
let program = args.get(0).as_slice();
let opts = ~[
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("a", "all", "Behave as though all of the options -mnrsv were specified."),

View file

@ -49,7 +49,7 @@ extern {
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("v", "version", "output version information and exit"),
getopts::optflag("h", "help", "display this help and exit"),

View file

@ -49,7 +49,7 @@ static NAME: &'static str = "users";
fn main() {
let args = os::args();
let program = args[0].as_slice();
let program = args.get(0).as_slice();
let opts = ~[
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit"),

View file

@ -35,7 +35,7 @@ static NAME: &'static str = "wc";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("c", "bytes", "print the byte counts"),
getopts::optflag("m", "chars", "print the character counts"),

View file

@ -43,7 +43,7 @@ static NAME: &'static str = "whoami";
fn main() {
let args = os::args();
let program = args[0].as_slice();
let program = args.get(0).as_slice();
let opts = ~[
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit"),

View file

@ -26,7 +26,7 @@ static NAME: &'static str = "yes";
fn main() {
let args = os::args();
let program = args[0].clone();
let program = args.get(0).clone();
let opts = ~[
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit"),