1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-31 21:17:46 +00:00

Update for new coercion rules

This commit is contained in:
Michael Gehring 2014-11-19 21:55:25 +01:00
parent cd409c6d3f
commit 09f223fdb1
62 changed files with 152 additions and 152 deletions

View file

@ -44,7 +44,7 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("h", "help", "display this help text and exit"),
optflag("V", "version", "output version information and exit")
];
let matches = match getopts(args.tail(), opts) {
let matches = match getopts(args.tail(), &opts) {
Ok(m) => m,
Err(e) => {
error!("error: {}", e);
@ -53,7 +53,7 @@ pub fn uumain(args: Vec<String>) -> int {
};
let progname = args[0].clone();
let usage = usage("Base64 encode or decode FILE, or standard input, to standard output.", opts);
let usage = usage("Base64 encode or decode FILE, or standard input, to standard output.", &opts);
let mode = if matches.opt_present("help") {
Mode::Help
} else if matches.opt_present("version") {

View file

@ -32,7 +32,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "Invalid options\n{}", f)
};
@ -43,7 +43,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Print NAME with any leading directory components removed.");
println!("If specified, also remove a trailing SUFFIX.");
print(getopts::usage("", opts).as_slice());
print(getopts::usage("", &opts).as_slice());
return 0;
}

View file

@ -36,7 +36,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => panic!("Invalid options\n{}", f)
};
@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!(" {0:s} [OPTION]... [FILE]...", program);
println!("");
print(getopts::usage("Concatenate FILE(s), or standard input, to \
standard output.", opts).as_slice());
standard output.", &opts).as_slice());
println!("");
println!("With no FILE, or when FILE is -, read standard input.");
return 0;
@ -64,11 +64,11 @@ pub fn uumain(args: Vec<String>) -> int {
if matches.opt_present("b") {
number_mode = NumberingMode::NumberNonEmpty;
}
let show_nonprint = matches.opts_present(["A".to_string(), "e".to_string(),
let show_nonprint = matches.opts_present(&["A".to_string(), "e".to_string(),
"t".to_string(), "v".to_string()]);
let show_ends = matches.opts_present(["E".to_string(), "A".to_string(),
let show_ends = matches.opts_present(&["E".to_string(), "A".to_string(),
"e".to_string()]);
let show_tabs = matches.opts_present(["A".to_string(), "T".to_string(),
let show_tabs = matches.opts_present(&["A".to_string(), "T".to_string(),
"t".to_string()]);
let squeeze_blank = matches.opt_present("s");
let mut files = matches.free;
@ -104,7 +104,7 @@ fn write_lines(files: Vec<String>, number: NumberingMode, squeeze_blank: bool,
let mut writer = UnsafeWriter::new(out_buf.as_mut_slice(), stdout_raw());
let mut at_line_start = true;
loop {
let n = match reader.read(in_buf) {
let n = match reader.read(&mut in_buf) {
Ok(n) if n != 0 => n,
_ => break,
};
@ -180,7 +180,7 @@ fn write_bytes(files: Vec<String>, number: NumberingMode, squeeze_blank: bool,
let mut writer = UnsafeWriter::new(out_buf.as_mut_slice(), stdout_raw());
let mut at_line_start = true;
loop {
let n = match reader.read(in_buf) {
let n = match reader.read(&mut in_buf) {
Ok(n) if n != 0 => n,
_ => break,
};
@ -228,8 +228,8 @@ fn write_bytes(files: Vec<String>, number: NumberingMode, squeeze_blank: bool,
_ => byte,
};
match byte {
0 ... 31 => writer.write(['^' as u8, byte + 64]),
127 => writer.write(['^' as u8, byte - 64]),
0 ... 31 => writer.write(&['^' as u8, byte + 64]),
127 => writer.write(&['^' as u8, byte - 64]),
_ => writer.write_u8(byte),
}
} else {
@ -251,7 +251,7 @@ fn write_fast(files: Vec<String>) {
};
loop {
match reader.read(in_buf) {
match reader.read(&mut in_buf) {
Ok(n) if n != 0 => {
// This interface is completely broken.
writer.write(in_buf.slice_to(n)).unwrap();

View file

@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit")
];
// TODO: sanitize input for - at beginning (e.g. chmod -x testfile). Solution is to add a to -x, making a-x
let mut matches = match getopts::getopts(args.tail(), opts) {
let mut matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
crash!(1, "{}", f)
@ -66,7 +66,7 @@ Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'.",
name = NAME, version = VERSION, program = program,
usage = getopts::usage("Change the mode of each FILE to MODE. \
With --reference, change the mode of \
each FILE to that of RFILE.", opts));
each FILE to that of RFILE.", &opts));
} else if matches.opt_present("version") {
println!("{} v{}", NAME, VERSION);
} else if matches.free.is_empty() && matches.opt_present("reference") || matches.free.len() < 2 {

View file

@ -51,17 +51,17 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("V", "version", "Show program's version")
];
let opts = match getopts(args.tail(), options) {
let opts = match getopts(args.tail(), &options) {
Ok(m) => m,
Err(f) => {
show_error!("{}", f);
help_menu(program.as_slice(), options);
help_menu(program.as_slice(), &options);
return 1
}
};
if opts.opt_present("V") { version(); return 0 }
if opts.opt_present("h") { help_menu(program.as_slice(), options); return 0 }
if opts.opt_present("h") { help_menu(program.as_slice(), &options); return 0 }
if opts.free.len() == 0 {
println!("Missing operand: NEWROOT");

View file

@ -61,7 +61,7 @@ fn cksum(fname: &str) -> IoResult<(u32, uint)> {
let mut bytes: [u8, ..1024 * 1024] = unsafe { mem::uninitialized() };
loop {
match rd.read(bytes) {
match rd.read(&mut bytes) {
Ok(num_bytes) => {
for &b in bytes.slice_to(num_bytes).iter() {
crc = crc_update(crc, b);
@ -80,7 +80,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(err) => panic!("{}", err),
};

View file

@ -117,7 +117,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(err) => panic!("{}", err),
};

View file

@ -36,7 +36,7 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("h", "help", "display this help and exit"),
optflag("", "version", "output version information and exit"),
];
let matches = match getopts(args.tail(), opts) {
let matches = match getopts(args.tail(), &opts) {
Ok(m) => m,
Err(e) => {
error!("error: {}", e);
@ -45,7 +45,7 @@ pub fn uumain(args: Vec<String>) -> int {
};
let progname = &args[0];
let usage = usage("Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.", opts);
let usage = usage("Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.", &opts);
let mode = if matches.opt_present("version") {
Mode::Version
} else if matches.opt_present("help") {

View file

@ -127,7 +127,7 @@ fn cut_bytes<R: Reader>(reader: R,
}
buf_read.consume_line();
out.write([b'\n']).unwrap();
out.write(&[b'\n']).unwrap();
}
0
@ -262,7 +262,7 @@ fn cut_fields_delimiter<R: Reader>(reader: R,
if ! only_delimited {
out.write(line.as_slice()).unwrap();
if line[line.len() - 1] != b'\n' {
out.write([b'\n']).unwrap();
out.write(&[b'\n']).unwrap();
}
}
@ -344,7 +344,7 @@ fn cut_fields<R: Reader>(reader: R,
if ! opts.only_delimited {
out.write(line.as_slice()).unwrap();
if line[line.len() - 1] != b'\n' {
out.write([b'\n']).unwrap();
out.write(&[b'\n']).unwrap();
}
}
@ -460,7 +460,7 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("", "version", "output version information and exit"),
];
let matches = match getopts(args.tail(), opts) {
let matches = match getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
show_error!("Invalid options\n{}", f)
@ -472,7 +472,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0} OPTION... [FILE]...", args[0]);
println!("");
print(usage("Print selected parts of lines from each FILE to standard output.", opts).as_slice());
print(usage("Print selected parts of lines from each FILE to standard output.", &opts).as_slice());
println!("");
println!("Use one, and only one of -b, -c or -f. Each LIST is made up of one");
println!("range, or many ranges separated by commas. Selected input is written");

View file

@ -23,7 +23,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => panic!("Invalid options\n{}", f)
};
@ -36,7 +36,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("");
print(getopts::usage("Output each NAME with its last non-slash component and trailing slashes
removed; if NAME contains no /'s, output '.' (meaning the current
directory).", opts).as_slice());
directory).", &opts).as_slice());
return 0;
}

View file

@ -157,7 +157,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
show_error!("Invalid options\n{}", f);
@ -184,7 +184,7 @@ Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (pow
ers of 1000).",
program = program,
version = VERSION,
usage = getopts::usage("Summarize disk usage of each FILE, recursively for directories.", opts));
usage = getopts::usage("Summarize disk usage of each FILE, recursively for directories.", &opts));
return 0;
} else if matches.opt_present("version") {
println!("{} version: {}", program, VERSION);

View file

@ -142,7 +142,7 @@ fn print_help(program: &String) {
println!(" {0:s} [SHORT-OPTION]... [STRING]...", *program);
println!(" {0:s} LONG-OPTION", *program);
println!("");
println(getopts::usage("Echo the STRING(s) to standard output.", opts).as_slice());
println(getopts::usage("Echo the STRING(s) to standard output.", &opts).as_slice());
println("If -e is in effect, the following sequences are recognized:
\\\\ backslash

View file

@ -82,7 +82,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "{}", f)
};
@ -91,7 +91,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage: {:s} [OPTION]... [FILE]...", NAME);
io::print(getopts::usage(
"Convert tabs in each FILE to spaces, writing to standard output.\n\
With no FILE, or when FILE is -, read standard input.", opts).as_slice());
With no FILE, or when FILE is -, read standard input.", &opts).as_slice());
return 0;
}

View file

@ -69,7 +69,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("v", "version", "print the version and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "Invalid options\n{}", f)
};
@ -82,7 +82,7 @@ pub fn uumain(args: Vec<String>) -> int {
\t{program} [OPTION]\n\
\n\
{usage}", program = program, version = VERSION, usage = getopts::usage("Print the prime factors of the given number(s). \
If none are specified, read from standard input.", opts));
If none are specified, read from standard input.", &opts));
return 1;
}
if matches.opt_present("version") {

View file

@ -36,7 +36,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit")
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "{}", f)
};
@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {} [OPTION]... [FILE]...", program);
println!("");
print!("{}", getopts::usage("Writes each file (or standard input if no files are given) to standard output whilst breaking long lines", opts));
print!("{}", getopts::usage("Writes each file (or standard input if no files are given) to standard output whilst breaking long lines", &opts));
} else if matches.opt_present("V") {
println!("{} v{}", NAME, VERSION);
} else {

View file

@ -33,7 +33,7 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("V", "version", "display version information and exit")
];
let matches = match getopts(args.tail(), options) {
let matches = match getopts(args.tail(), &options) {
Ok(m) => { m },
Err(f) => {
show_error!("{}", f);
@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> int {
print!("{} v{}\n\n\
Usage:\n \
{} [OPTION]... [USER]...\n\n\
{}", NAME, VERSION, program, usage("Prints the groups a user is in to standard output.", options));
{}", NAME, VERSION, program, usage("Prints the groups a user is in to standard output.", &options));
} else {
group(get_pw_from_args(&matches.free), true);
}

View file

@ -273,7 +273,7 @@ fn digest_reader(digest: &mut Box<Digest>, reader: &mut Reader, binary: bool) ->
let mut vec = Vec::with_capacity(524288);
let mut looking_for_newline = false;
loop {
match reader.read(buffer) {
match reader.read(&mut buffer) {
Ok(0) => {},
Ok(nread) => {
if windows && !binary {

View file

@ -46,16 +46,16 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("V", "version", "version")
];
let given_options = match getopts(args.as_slice(), possible_options) {
let given_options = match getopts(args.as_slice(), &possible_options) {
Ok (m) => { m }
Err(_) => {
println!("{:s}", usage(NAME, possible_options));
println!("{:s}", usage(NAME, &possible_options));
return 1;
}
};
if given_options.opt_present("h") {
println!("{:s}", usage(NAME, possible_options));
println!("{:s}", usage(NAME, &possible_options));
return 0;
}
if given_options.opt_present("V") { version(); return 0 }

View file

@ -54,10 +54,10 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("", "version", "output version information and exit"),
];
let usage = usage("[options]", opts);
let usage = usage("[options]", &opts);
let matches = match getopts(args.tail(), opts) {
let matches = match getopts(args.tail(), &opts) {
Ok(m) => m,
Err(e) => {
show_error!("{}\n{}", e, get_help_text(NAME, usage.as_slice()));

View file

@ -53,13 +53,13 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("V", "version", "Show program's version")
];
let matches = match getopts(args.tail(), options) {
let matches = match getopts(args.tail(), &options) {
Ok(m) => { m }
_ => { help_menu(program.as_slice(), options); return 0; }
_ => { help_menu(program.as_slice(), &options); return 0; }
};
if matches.opt_present("h") {
help_menu(program.as_slice(), options);
help_menu(program.as_slice(), &options);
return 0
}
if matches.opt_present("V") { version(); return 0 }
@ -110,7 +110,7 @@ pub fn uumain(args: Vec<String>) -> int {
}
}
1 => xsethostname(matches.free.last().unwrap().as_slice()),
_ => help_menu(program.as_slice(), options)
_ => help_menu(program.as_slice(), &options)
};
0

View file

@ -100,16 +100,16 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("u", "", "Display the effective user ID as a number")
];
let matches = match getopts(args_t, options) {
let matches = match getopts(args_t, &options) {
Ok(m) => { m },
Err(_) => {
println!("{:s}", usage(NAME, options));
println!("{:s}", usage(NAME, &options));
return 1;
}
};
if matches.opt_present("h") {
println!("{:s}", usage(NAME, options));
println!("{:s}", usage(NAME, &options));
return 0;
}

View file

@ -61,11 +61,11 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("L", "table", "list all signal names in a nice table"),
];
let usage = usage("[options] <pid> [...]", opts);
let usage = usage("[options] <pid> [...]", &opts);
let (args, obs_signal) = handle_obsolete(args);
let matches = match getopts(args.tail(), opts) {
let matches = match getopts(args.tail(), &opts) {
Ok(m) => m,
Err(e) => {
show_error!("{}\n{}", e, get_help_text(NAME, usage.as_slice()));

View file

@ -27,7 +27,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(err) => panic!("{}", err),
};

View file

@ -53,7 +53,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "Invalid options\n{}", f)
};
@ -64,7 +64,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {:s}", program);
println!("");
print(getopts::usage("print user's login name", opts).as_slice());
print(getopts::usage("print user's login name", &opts).as_slice());
return 0;
}
if matches.opt_present("version") {

View file

@ -41,7 +41,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "display this version")
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
crash!(1, "Invalid options\n{}", f);
@ -49,7 +49,7 @@ pub fn uumain(args: Vec<String>) -> int {
};
if args.len() == 1 || matches.opt_present("help") {
print_help(opts);
print_help(&opts);
return 0;
}
if matches.opt_present("version") {

View file

@ -30,7 +30,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(err) => panic!("{}", err),
};

View file

@ -79,14 +79,14 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("V", "version", "output version information and exit"),
];
let matches = match getopts(args.tail(), opts) {
let matches = match getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
show_error!("Invalid options\n{}", f);
return 1;
}
};
let usage = usage("Move SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.", opts);
let usage = usage("Move SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.", &opts);
/* This does not exactly match the GNU implementation:
* The GNU mv defaults to Force, but if more than one of the

View file

@ -106,17 +106,17 @@ pub fn uumain(args: Vec<String>) -> int {
number_separator: String::from_str("\t"),
};
let given_options = match getopts(args.tail(), possible_options) {
let given_options = match getopts(args.tail(), &possible_options) {
Ok (m) => { m }
Err(f) => {
show_error!("{}", f);
print_usage(possible_options);
print_usage(&possible_options);
return 1
}
};
if given_options.opt_present("help") {
print_usage(possible_options);
print_usage(&possible_options);
return 0;
}
if given_options.opt_present("version") { version(); return 0; }

View file

@ -79,17 +79,17 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("V", "version", "Show version and exit"),
];
let opts = match getopts(args.tail(), options) {
let opts = match getopts(args.tail(), &options) {
Ok(m) => m,
Err(f) => {
show_error!("{}", f);
show_usage(program.as_slice(), options);
show_usage(program.as_slice(), &options);
return 1
}
};
if opts.opt_present("V") { version(); return 0 }
if opts.opt_present("h") { show_usage(program.as_slice(), options); return 0 }
if opts.opt_present("h") { show_usage(program.as_slice(), &options); return 0 }
if opts.free.len() == 0 {
show_error!("Missing operand: COMMAND");

View file

@ -29,7 +29,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(err) => {
show_error!("{}", err);
@ -48,7 +48,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {} [OPTIONS] NAME...", NAME);
println!("");
print!("{}", getopts::usage("Print the number of cores available to the current process.", opts));
print!("{}", getopts::usage("Print the number of cores available to the current process.", &opts));
return 0;
}

View file

@ -31,7 +31,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit")
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "{}", f)
};
@ -41,7 +41,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [OPTION]... [FILE]...", program);
println!("");
print!("{}", getopts::usage("Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output.", opts));
print!("{}", getopts::usage("Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output.", &opts));
} else if matches.opt_present("version") {
println!("{} {}", NAME, VERSION);
} else {

View file

@ -31,7 +31,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
crash!(1, "Invalid options\n{}", f)
@ -43,7 +43,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [VARIABLE]... [OPTION]...", program);
println!("");
print(getopts::usage("Prints the given environment VARIABLE(s), otherwise prints them all.", opts).as_slice());
print(getopts::usage("Prints the given environment VARIABLE(s), otherwise prints them all.", &opts).as_slice());
return 0;
}
if matches.opt_present("version") {

View file

@ -29,7 +29,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
crash!(1, "Invalid options\n{}", f)
@ -42,14 +42,14 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [OPTION] NAME...", program);
println!("");
print(getopts::usage("Print the full filename of the current working directory.", opts).as_slice());
print(getopts::usage("Print the full filename of the current working directory.", &opts).as_slice());
} else if matches.opt_present("version") {
println!("pwd version: {}", VERSION);
return 0;
} else {
let cwd = std::os::getcwd();
println!("{}", cwd.display());
println!("{}", cwd.unwrap().display());
return 0;
}

View file

@ -30,17 +30,17 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("q", "quiet", "Do not print warnings for invalid paths"),
];
let opts = match getopts(args.tail(), options) {
let opts = match getopts(args.tail(), &options) {
Ok(m) => m,
Err(f) => {
show_error!("{}", f);
show_usage(program.as_slice(), options);
show_usage(program.as_slice(), &options);
return 1
}
};
if opts.opt_present("V") { version(); return 0 }
if opts.opt_present("h") { show_usage(program.as_slice(), options); return 0 }
if opts.opt_present("h") { show_usage(program.as_slice(), &options); return 0 }
if opts.free.len() == 0 {
show_error!("Missing operand: FILENAME, at least one is required");

View file

@ -28,17 +28,17 @@ pub fn uumain(args: Vec<String>) -> int {
optopt("d", "", "If any of FROM and TO is not subpath of DIR, output absolute path instead of relative", "DIR"),
];
let opts = match getopts(args.tail(), options) {
let opts = match getopts(args.tail(), &options) {
Ok(m) => m,
Err(f) => {
show_error!("{}", f);
show_usage(program.as_slice(), options);
show_usage(program.as_slice(), &options);
return 1
}
};
if opts.opt_present("V") { version(); return 0 }
if opts.opt_present("h") { show_usage(program.as_slice(), options); return 0 }
if opts.opt_present("h") { show_usage(program.as_slice(), &options); return 0 }
if opts.free.len() == 0 {
show_error!("Missing operand: TO");

View file

@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit")
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
crash!(1, "{}", f)
@ -59,7 +59,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [OPTION]... [FILE]...", program);
println!("");
print(getopts::usage("Remove (unlink) the FILE(s).", opts).as_slice());
print(getopts::usage("Remove (unlink) the FILE(s).", &opts).as_slice());
println!("");
println!("By default, rm does not remove directories. Use the --recursive (-r)");
println!("option to remove each listed directory, too, along with all of its contents");

View file

@ -32,7 +32,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "print this help and exit"),
getopts::optflag("V", "version", "output version information and exit")
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
show_error!("{}", f);
@ -46,7 +46,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [OPTION]... DIRECTORY...", program);
println!("");
print(getopts::usage("Remove the DIRECTORY(ies), if they are empty.", opts).as_slice());
print(getopts::usage("Remove the DIRECTORY(ies), if they are empty.", &opts).as_slice());
} else if matches.opt_present("version") {
println!("rmdir 1.0.0");
} else if matches.free.is_empty() {

View file

@ -136,7 +136,7 @@ fn print_help(program: &String) {
];
println!("seq 1.0.0\n");
println!("Usage:\n {} [-w] [-s string] [-t string] [first [step]] last\n", *program);
println!("{:s}", getopts::usage("Print sequences of numbers", opts));
println!("{:s}", getopts::usage("Print sequences of numbers", &opts));
}
fn print_version() {

View file

@ -48,7 +48,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit")
];
let mut matches = match getopts::getopts(args.tail(), opts) {
let mut matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
crash!(1, "{}", f)
@ -64,7 +64,7 @@ Usage:
{usage}
With no FILE, or when FILE is -, read standard input.",
name = NAME, version = VERSION, prog = program,
usage = getopts::usage("Write a random permutation of the input lines to standard output.", opts));
usage = getopts::usage("Write a random permutation of the input lines to standard output.", &opts));
} else if matches.opt_present("version") {
println!("{} v{}", NAME, VERSION);
} else {

View file

@ -33,7 +33,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit")
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
show_error!("{}", f);
@ -53,7 +53,7 @@ pub fn uumain(args: Vec<String>) -> int {
'm' for minutes, 'h' for hours or 'd' for days. Unlike most implementations
that require NUMBER be an integer, here NUMBER may be an arbitrary floating
point number. Given two or more arguments, pause for the amount of time
specified by the sum of their values.", opts).as_slice());
specified by the sum of their values.", &opts).as_slice());
} else if matches.opt_present("version") {
println!("sleep 1.0.0");
} else if matches.free.is_empty() {

View file

@ -35,7 +35,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "Invalid options\n{}", f)
};
@ -43,7 +43,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage: {0:s} [OPTION]... [FILE]...", program);
println!("Write the sorted concatenation of all FILE(s) to standard output.");
println!("");
print(getopts::usage("Mandatory arguments for long options are mandatory for short options too.", opts).as_slice());
print(getopts::usage("Mandatory arguments for long options are mandatory for short options too.", &opts).as_slice());
println!("");
println!("With no FILE, or when FILE is -, read standard input.");
return 0;

View file

@ -36,7 +36,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "{}", f)
};
@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [OPTION]... [INPUT [PREFIX]]", NAME);
println!("");
io::print(getopts::usage("Output fixed-size pieces of INPUT to PREFIXaa, PREFIX ab, ...; default size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is -, read standard input." , opts).as_slice());
io::print(getopts::usage("Output fixed-size pieces of INPUT to PREFIXaa, PREFIX ab, ...; default size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is -, read standard input." , &opts).as_slice());
return 0;
}

View file

@ -27,7 +27,7 @@ fn bsd_sum(mut reader: Box<Reader>) -> (uint, u16) {
let mut blocks_read = 0;
let mut checksum: u16 = 0;
loop {
match reader.read(buf) {
match reader.read(&mut buf) {
Ok(n) if n != 0 => {
blocks_read += 1;
for &byte in buf.slice_to(n).iter() {
@ -48,7 +48,7 @@ fn sysv_sum(mut reader: Box<Reader>) -> (uint, u16) {
let mut ret = 0;
loop {
match reader.read(buf) {
match reader.read(&mut buf) {
Ok(n) if n != 0 => {
blocks_read += 1;
for &byte in buf.slice_to(n).iter() {
@ -84,7 +84,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("v", "version", "print the version and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "Invalid options\n{}", f)
};
@ -95,7 +95,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [OPTION]... [FILE]...", program);
println!("");
print(getopts::usage("checksum and count the blocks in a file", opts).as_slice());
print(getopts::usage("checksum and count the blocks in a file", &opts).as_slice());
println!("");
println!("With no FILE, or when FILE is -, read standard input.");
return 0;

View file

@ -148,13 +148,13 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("V", "version", "output version information and exit")
];
let matches = match getopts(args.tail(), options) {
let matches = match getopts(args.tail(), &options) {
Ok(m) => { m }
_ => { help(program.as_slice(), options); return 1 }
_ => { help(program.as_slice(), &options); return 1 }
};
if matches.opt_present("h") {
help(program.as_slice(), options);
help(program.as_slice(), &options);
return 0
}

View file

@ -32,7 +32,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit")
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "{}", f)
};
@ -42,7 +42,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [OPTION]... [FILE]...", program);
println!("");
print!("{}", getopts::usage("Write each file to standard output, last line first.", opts));
print!("{}", getopts::usage("Write each file to standard output, last line first.", &opts));
} else if matches.opt_present("version") {
println!("tac {}", VERSION);
} else {

View file

@ -54,16 +54,16 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("V", "version", "version"),
];
let given_options = match getopts(args.as_slice(), possible_options) {
let given_options = match getopts(args.as_slice(), &possible_options) {
Ok (m) => { m }
Err(_) => {
println!("{:s}", usage(NAME, possible_options));
println!("{:s}", usage(NAME, &possible_options));
return 1;
}
};
if given_options.opt_present("h") {
println!("{:s}", usage(NAME, possible_options));
println!("{:s}", usage(NAME, &possible_options));
return 0;
}
if given_options.opt_present("V") { version(); return 0 }

View file

@ -50,14 +50,14 @@ fn options(args: &[String]) -> Result<Options, ()> {
let args: Vec<String> = args.iter().map(|x| x.to_string()).collect();
getopts(args.tail(), opts).map_err(|e| format!("{}", e)).and_then(|m| {
getopts(args.tail(), &opts).map_err(|e| format!("{}", e)).and_then(|m| {
let version = format!("{} {}", NAME, VERSION);
let program = args[0].as_slice();
let arguments = "[OPTION]... [FILE]...";
let brief = "Copy standard input to each FILE, and also to standard output.";
let comment = "If a FILE is -, copy again to standard output.";
let help = format!("{}\n\nUsage:\n {} {}\n\n{}\n{}",
version, program, arguments, usage(brief, opts),
version, program, arguments, usage(brief, &opts),
comment);
let mut names = m.free.clone().into_iter().collect::<Vec<String>>();
names.push("-".to_string());

View file

@ -46,7 +46,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit")
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
crash!(ERR_EXIT_STATUS, "{}", f)
@ -58,7 +58,7 @@ pub fn uumain(args: Vec<String>) -> int {
Usage:
{} [OPTION] DURATION COMMAND [ARG]...
{}", NAME, VERSION, program, getopts::usage("Start COMMAND, and kill it if still running after DURATION.", opts));
{}", NAME, VERSION, program, getopts::usage("Start COMMAND, and kill it if still running after DURATION.", &opts));
} else if matches.opt_present("version") {
println!("{} v{}", NAME, VERSION);
} else if matches.free.len() < 2 {

View file

@ -39,7 +39,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(e) => panic!("Invalid options\n{}", e)
};
@ -55,16 +55,16 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage: {:s} [OPTION]... FILE...", NAME);
println!("");
println!("{:s}", getopts::usage("Update the access and modification times of \
each FILE to the current time.", opts));
each FILE to the current time.", &opts));
if matches.free.is_empty() {
return 1;
}
return 0;
}
if matches.opt_present("date") && matches.opts_present(["reference".to_string(), "t".to_string()]) ||
matches.opt_present("reference") && matches.opts_present(["date".to_string(), "t".to_string()]) ||
matches.opt_present("t") && matches.opts_present(["date".to_string(), "reference".to_string()]) {
if matches.opt_present("date") && matches.opts_present(&["reference".to_string(), "t".to_string()]) ||
matches.opt_present("reference") && matches.opts_present(&["date".to_string(), "t".to_string()]) ||
matches.opt_present("t") && matches.opts_present(&["date".to_string(), "reference".to_string()]) {
panic!("Invalid options: cannot specify reference time from more than one source");
}
@ -73,7 +73,7 @@ pub fn uumain(args: Vec<String>) -> int {
let path = Path::new(matches.opt_str("reference").unwrap().to_string());
let stat = stat(&path, !matches.opt_present("no-dereference"));
(stat.accessed, stat.modified)
} else if matches.opts_present(["date".to_string(), "t".to_string()]) {
} else if matches.opts_present(&["date".to_string(), "t".to_string()]) {
let timestamp = if matches.opt_present("date") {
parse_date(matches.opt_str("date").unwrap().as_slice())
} else {
@ -91,7 +91,7 @@ pub fn uumain(args: Vec<String>) -> int {
if !path.exists() {
// no-dereference included here for compatibility
if matches.opts_present(["no-create".to_string(), "no-dereference".to_string()]) {
if matches.opts_present(&["no-create".to_string(), "no-dereference".to_string()]) {
continue;
}
@ -101,14 +101,14 @@ pub fn uumain(args: Vec<String>) -> int {
};
// Minor optimization: if no reference time was specified, we're done.
if !matches.opts_present(["date".to_string(), "reference".to_string(), "t".to_string()]) {
if !matches.opts_present(&["date".to_string(), "reference".to_string(), "t".to_string()]) {
continue;
}
}
// If changing "only" atime or mtime, grab the existing value of the other.
// Note that "-a" and "-m" may be passed together; this is not an xor.
if matches.opts_present(["a".to_string(), "m".to_string(), "time".to_string()]) {
if matches.opts_present(&["a".to_string(), "m".to_string(), "time".to_string()]) {
let stat = stat(&path, !matches.opt_present("no-dereference"));
let time = matches.opt_strs("time");

View file

@ -154,7 +154,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(err) => {
show_error!("{}", err);
@ -163,7 +163,7 @@ pub fn uumain(args: Vec<String>) -> int {
};
if matches.opt_present("help") {
usage(opts);
usage(&opts);
return 0;
}
@ -173,12 +173,12 @@ pub fn uumain(args: Vec<String>) -> int {
}
if matches.free.len() == 0 {
usage(opts);
usage(&opts);
return 1;
}
let dflag = matches.opt_present("d");
let cflag = matches.opts_present(["c".to_string(), "C".to_string()]);
let cflag = matches.opts_present(&["c".to_string(), "C".to_string()]);
let sets = matches.free;
if cflag && !dflag {

View file

@ -44,7 +44,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit")
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
crash!(1, "{}", f)
@ -57,7 +57,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [OPTION]... FILE...", program);
println!("");
print!("{}", getopts::usage("Shrink or extend the size of each file to the specified size.", opts));
print!("{}", getopts::usage("Shrink or extend the size of each file to the specified size.", &opts));
print!("
SIZE is an integer with an optional prefix and optional unit.
The available units (K, M, G, T, P, E, Z, and Y) use the following format:

View file

@ -30,7 +30,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "{}", f)
};
@ -41,7 +41,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {} [OPTIONS] FILE", NAME);
println!("");
io::print(getopts::usage("Topological sort the strings in FILE. Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline). If FILE is not passed in, stdin is used instead.", opts).as_slice());
io::print(getopts::usage("Topological sort the strings in FILE. Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline). If FILE is not passed in, stdin is used instead.", &opts).as_slice());
return 0;
}

View file

@ -39,7 +39,7 @@ pub fn uumain(args: Vec<String>) -> int {
optflag("s", "silent", "print nothing, only return an exit status")
];
let silent = match getopts(args.tail(), options) {
let silent = match getopts(args.tail(), &options) {
Ok(m) => {
m.opt_present("s")
},

View file

@ -64,7 +64,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("s", "sysname", "print the operating system name."),
getopts::optflag("v", "version", "print the operating system version."),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "{}", f),
};
@ -74,13 +74,13 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {:s}", program);
println!("");
print(getopts::usage("The uname utility writes symbols representing one or more system characteristics to the standard output.", opts).as_slice());
print(getopts::usage("The uname utility writes symbols representing one or more system characteristics to the standard output.", &opts).as_slice());
return 0;
}
let uname = unsafe { getuname() };
let mut output = String::new();
if matches.opt_present("sysname") || matches.opt_present("all")
|| !matches.opts_present(["nodename".to_string(), "release".to_string(), "version".to_string(), "machine".to_string()]) {
|| !matches.opts_present(&["nodename".to_string(), "release".to_string(), "version".to_string(), "machine".to_string()]) {
output.push_str(uname.sysname.as_slice());
output.push_str(" ");
}

View file

@ -84,7 +84,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "{}", f)
};
@ -93,7 +93,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage: {:s} [OPTION]... [FILE]...", NAME);
io::print(getopts::usage(
"Convert blanks in each FILE to tabs, writing to standard output.\n\
With no FILE, or when FILE is -, read standard input.", opts).as_slice());
With no FILE, or when FILE is -, read standard input.", &opts).as_slice());
return 0;
}

View file

@ -138,7 +138,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit")
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "{}", f)
};
@ -150,7 +150,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!(" {0:s} [OPTION]... [FILE]...", program);
println!("");
print!("{}", getopts::usage("Filter adjacent matching lines from INPUT (or standard input),\n\
writing to OUTPUT (or standard output).", opts));
writing to OUTPUT (or standard output).", &opts));
println!("");
println!("Note: '{0}' does not detect repeated lines unless they are adjacent.\n\
You may want to sort the input first, or use 'sort -u' without '{0}'.\n", program);

View file

@ -32,7 +32,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
crash!(1, "invalid options\n{}", f)
@ -45,7 +45,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [FILE]... [OPTION]...", program);
println!("");
print(getopts::usage("Unlink the file at [FILE].", opts).as_slice());
print(getopts::usage("Unlink the file at [FILE].", &opts).as_slice());
return 0;
}

View file

@ -58,7 +58,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("v", "version", "output version information and exit"),
getopts::optflag("h", "help", "display this help and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "Invalid options\n{}", f)
};
@ -72,7 +72,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("");
print(getopts::usage("Print the current time, the length of time the system has been up,\n\
the number of users on the system, and the average number of jobs\n\
in the run queue over the last 1, 5 and 15 minutes.", opts).as_slice());
in the run queue over the last 1, 5 and 15 minutes.", &opts).as_slice());
return 0;
}

View file

@ -59,7 +59,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => panic!("{}", f),
};
@ -70,7 +70,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {:s} [OPTION]... [FILE]", program);
println!("");
print(getopts::usage("Output who is currently logged in according to FILE.", opts).as_slice());
print(getopts::usage("Output who is currently logged in according to FILE.", &opts).as_slice());
return 0;
}

View file

@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
crash!(1, "Invalid options\n{}", f)
@ -58,7 +58,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [OPTION]... [FILE]...", program);
println!("");
print(getopts::usage("Print newline, word and byte counts for each FILE", opts).as_slice());
print(getopts::usage("Print newline, word and byte counts for each FILE", &opts).as_slice());
println!("");
println!("With no FILE, or when FILE is -, read standard input.");
return 0;

View file

@ -72,7 +72,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => crash!(1, "{}", f),
};
@ -82,7 +82,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {:s}", program);
println!("");
print(getopts::usage("print effective userid", opts).as_slice());
print(getopts::usage("print effective userid", &opts).as_slice());
return 0;
}
if matches.opt_present("version") {

View file

@ -29,7 +29,7 @@ pub fn uumain(args: Vec<String>) -> int {
getopts::optflag("h", "help", "display this help and exit"),
getopts::optflag("V", "version", "output version information and exit"),
];
let matches = match getopts::getopts(args.tail(), opts) {
let matches = match getopts::getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
crash!(1, "invalid options\n{}", f)
@ -41,7 +41,7 @@ pub fn uumain(args: Vec<String>) -> int {
println!("Usage:");
println!(" {0:s} [STRING]... [OPTION]...", program);
println!("");
print(getopts::usage("Repeatedly output a line with all specified STRING(s), or 'y'.", opts).as_slice());
print(getopts::usage("Repeatedly output a line with all specified STRING(s), or 'y'.", &opts).as_slice());
return 0;
}
if matches.opt_present("version") {