Update to use the new format! macro

This commit is contained in:
Jordi Boggiano 2013-10-19 16:02:38 +02:00
parent 6e6d4bf14b
commit cdc435f008
3 changed files with 6 additions and 6 deletions

View file

@ -46,7 +46,7 @@ fn main() {
println("cat 1.0.0"); println("cat 1.0.0");
println(""); println("");
println("Usage:"); println("Usage:");
println(fmt!(" %s [OPTION]... [FILE]...", program)); println(format!(" {0:s} [OPTION]... [FILE]...", program));
println(""); println("");
print(groups::usage("Concatenate FILE(s), or standard input, to standard output.", opts)); print(groups::usage("Concatenate FILE(s), or standard input, to standard output.", opts));
println(""); println("");
@ -116,7 +116,7 @@ pub fn exec(files: ~[~str], number: NumberingMode, show_nonprint: bool, show_end
let buf = reader.read_bytes(2); let buf = reader.read_bytes(2);
for byte in buf.iter() { for byte in buf.iter() {
if at_line_start && (number == NumberAll || (number == NumberNonEmpty && !is_newline_char(*byte))) { if at_line_start && (number == NumberAll || (number == NumberNonEmpty && !is_newline_char(*byte))) {
writer.write_str(fmt!("%6u ", counter)); writer.write_str(format!("{0:6u} ", counter));
counter += 1; counter += 1;
at_line_start = false; at_line_start = false;
} }
@ -178,7 +178,7 @@ fn open(path: ~str) -> Option<@Reader> {
match std::io::file_reader(&std::path::Path::new(path.as_slice())) { match std::io::file_reader(&std::path::Path::new(path.as_slice())) {
Ok(fd) => return Some(fd), Ok(fd) => return Some(fd),
Err(e) => { Err(e) => {
stderr().write_line(fmt!("cat: %s: %s", path, e)); stderr().write_line(format!("cat: {0:s}: {1:s}", path, e));
os::set_exit_status(1); os::set_exit_status(1);
} }
} }

View file

@ -38,7 +38,7 @@ fn main() {
println("printenv 1.0.0"); println("printenv 1.0.0");
println(""); println("");
println("Usage:"); println("Usage:");
println(fmt!(" %s [VARIABLE]... [OPTION]...", program)); println(format!(" {0:s} [VARIABLE]... [OPTION]...", program));
println(""); println("");
print(groups::usage("Prints the given environment VARIABLE(s), otherwise prints them all.", opts)); print(groups::usage("Prints the given environment VARIABLE(s), otherwise prints them all.", opts));
return; return;
@ -59,7 +59,7 @@ pub fn exec(args: ~[~str], separator: &str) {
if args.is_empty() { if args.is_empty() {
let vars = os::env(); let vars = os::env();
for (env_var, value) in vars.move_iter() { for (env_var, value) in vars.move_iter() {
print(fmt!("%s=%s", env_var, value)); print(format!("{0:s}={1:s}", env_var, value));
print(separator); print(separator);
} }
return; return;

View file

@ -37,7 +37,7 @@ fn main() {
println("yes 1.0.0"); println("yes 1.0.0");
println(""); println("");
println("Usage:"); println("Usage:");
println(fmt!(" %s [STRING]... [OPTION]...", program)); println(format!(" {0:s} [STRING]... [OPTION]...", program));
println(""); println("");
print(groups::usage("Repeatedly output a line with all specified STRING(s), or 'y'.", opts)); print(groups::usage("Repeatedly output a line with all specified STRING(s), or 'y'.", opts));
return; return;