diff --git a/basename/basename.rs b/basename/basename.rs index dd1434097..882c966ba 100644 --- a/basename/basename.rs +++ b/basename/basename.rs @@ -85,8 +85,8 @@ fn main() { println(name.as_slice()); } -fn strip_dir(fullname: &str) -> StrBuf { - let mut name = StrBuf::new(); +fn strip_dir(fullname: &str) -> String { + let mut name = String::new(); for c in fullname.chars().rev() { if c == '/' || c == '\\' { @@ -98,7 +98,7 @@ fn strip_dir(fullname: &str) -> StrBuf { return name.as_slice().chars().rev().collect(); } -fn strip_suffix(name: &str, suffix: &str) -> StrBuf { +fn strip_suffix(name: &str, suffix: &str) -> String { if name == suffix { return name.into_strbuf(); } diff --git a/cat/cat.rs b/cat/cat.rs index 41003714b..beb5a3cd6 100644 --- a/cat/cat.rs +++ b/cat/cat.rs @@ -96,7 +96,7 @@ fn is_newline_char(byte: u8) -> bool { byte == LF } -pub fn exec(files: Vec, number: NumberingMode, show_nonprint: bool, show_ends: bool, show_tabs: bool, squeeze_blank: bool) { +pub fn exec(files: Vec, number: NumberingMode, show_nonprint: bool, show_ends: bool, show_tabs: bool, squeeze_blank: bool) { if NumberNone != number || show_nonprint || show_ends || show_tabs || squeeze_blank { let mut counter: uint = 1; diff --git a/comm/comm.rs b/comm/comm.rs index 238e859af..031c8365a 100644 --- a/comm/comm.rs +++ b/comm/comm.rs @@ -21,8 +21,8 @@ use std::path::Path; static NAME : &'static str = "comm"; static VERSION : &'static str = "1.0.0"; -fn mkdelim(col: uint, opts: &getopts::Matches) -> StrBuf { - let mut s = StrBuf::new(); +fn mkdelim(col: uint, opts: &getopts::Matches) -> String { + let mut s = String::new(); let delim = match opts.opt_str("output-delimiter") { Some(d) => d.clone(), None => "\t".to_strbuf(), diff --git a/common/c_types.rs b/common/c_types.rs index d96999ba9..55f64809a 100644 --- a/common/c_types.rs +++ b/common/c_types.rs @@ -73,7 +73,7 @@ extern { pub fn getgrgid(gid: uid_t) -> *c_group; } -pub fn get_pw_from_args(free: &Vec) -> Option { +pub fn get_pw_from_args(free: &Vec) -> Option { if free.len() == 1 { let username = free.get(0).as_slice(); diff --git a/du/du.rs b/du/du.rs index 3c18cdfd9..c663d401e 100644 --- a/du/du.rs +++ b/du/du.rs @@ -32,7 +32,7 @@ static VERSION: &'static str = "1.0.0"; struct Options { all: bool, - program_name: StrBuf, + program_name: String, max_depth: Option, total: bool, separate_dirs: bool, @@ -268,7 +268,7 @@ ers of 1000).", None => 1024 }; - let convert_size = |size: u64| -> StrBuf { + let convert_size = |size: u64| -> String { if matches.opt_present("human-readable") || matches.opt_present("si") { if size > MB { format!("{:.1f}M", (size as f64) / (MB as f64)) diff --git a/env/env.rs b/env/env.rs index ed7afb63b..c8f74eaed 100644 --- a/env/env.rs +++ b/env/env.rs @@ -16,9 +16,9 @@ struct options { ignore_env: bool, null: bool, - unsets: Vec, - sets: Vec<(StrBuf, StrBuf)>, - program: Vec + unsets: Vec, + sets: Vec<(String, String)>, + program: Vec } fn usage(prog: &str) { diff --git a/fold/fold.rs b/fold/fold.rs index ffc597c9a..5c1b63bd1 100644 --- a/fold/fold.rs +++ b/fold/fold.rs @@ -82,8 +82,8 @@ fn main() { } } -fn handle_obsolete(args: &[StrBuf]) -> (Vec, Option) { - let mut args = Vec::::from_slice(args); +fn handle_obsolete(args: &[String]) -> (Vec, Option) { + let mut args = Vec::::from_slice(args); let mut i = 0; while i < args.len() { if args.get(i).as_slice().char_at(0) == '-' && args.get(i).len() > 1 && args.get(i).as_slice().char_at(1).is_digit() { @@ -95,7 +95,7 @@ fn handle_obsolete(args: &[StrBuf]) -> (Vec, Option) { (args, None) } -fn fold(filenames: Vec, bytes: bool, spaces: bool, width: uint) { +fn fold(filenames: Vec, bytes: bool, spaces: bool, width: uint) { for filename in filenames.iter() { let filename: &str = filename.as_slice(); let buffer = BufferedReader::new( @@ -137,7 +137,7 @@ fn fold_file(file: BufferedReader, bytes: bool, spaces: bool, i += slice.len(); } } else { - let mut output = StrBuf::new(); + let mut output = String::new(); let mut count = 0; for (i, ch) in line.chars().enumerate() { match ch { diff --git a/head/head.rs b/head/head.rs index 6b3dbb035..150732bd5 100644 --- a/head/head.rs +++ b/head/head.rs @@ -96,8 +96,8 @@ fn main () { // // In case is found, the options vector will get rid of that object so that // getopts works correctly. -fn obsolete (options: &[StrBuf]) -> (Vec, Option) { - let mut options: Vec = Vec::from_slice(options); +fn obsolete (options: &[String]) -> (Vec, Option) { + let mut options: Vec = Vec::from_slice(options); let mut a = 0; let b = options.len(); diff --git a/hostid/hostid.rs b/hostid/hostid.rs index 4951940ab..59ffd3dcf 100644 --- a/hostid/hostid.rs +++ b/hostid/hostid.rs @@ -50,7 +50,7 @@ extern { } fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let opts = [ optflag("", "help", "display this help and exit"), @@ -87,7 +87,7 @@ fn version() { println!("{} {}", NAME, VERSION); } -fn get_help_text(progname: &str, usage: &str) -> StrBuf { +fn get_help_text(progname: &str, usage: &str) -> String { format!("Usage: \n {0} {1}", progname, usage) } diff --git a/hostname/hostname.rs b/hostname/hostname.rs index b09c6084d..9aac3ca18 100644 --- a/hostname/hostname.rs +++ b/hostname/hostname.rs @@ -77,7 +77,7 @@ fn help_menu(program: &str, options: &[getopts::OptGroup]) { print!("{:s}", usage("Print or set the system's host name.", options)); } -fn xgethostname() -> StrBuf { +fn xgethostname() -> String { let namelen = 256u; let mut name = Vec::from_elem(namelen, 0u8); diff --git a/kill/kill.rs b/kill/kill.rs index df7010f27..5f7de6698 100644 --- a/kill/kill.rs +++ b/kill/kill.rs @@ -149,14 +149,14 @@ fn print_signals() { } } -fn list(arg: Option) { +fn list(arg: Option) { match arg { Some(x) => print_signal(x.as_slice()), None => print_signals(), }; } -fn get_help_text(progname: &str, usage: &str) -> StrBuf { +fn get_help_text(progname: &str, usage: &str) -> String { format!("Usage: \n {0} {1}", progname, usage) } @@ -177,7 +177,7 @@ fn signal_by_name_or_value(signal_name_or_value: &str) -> Option { return None; } -fn kill(signalname: &str, pids: std::vec::Vec) { +fn kill(signalname: &str, pids: std::vec::Vec) { let optional_signal_value = signal_by_name_or_value(signalname); let signal_value = match optional_signal_value { Some(x) => x, diff --git a/logname/logname.rs b/logname/logname.rs index f543d9083..d6b36219a 100644 --- a/logname/logname.rs +++ b/logname/logname.rs @@ -30,7 +30,7 @@ extern { pub fn getlogin() -> *libc::c_char; } -unsafe fn get_userlogin() -> StrBuf { +unsafe fn get_userlogin() -> String { let login: *libc::c_char = getlogin(); str::raw::from_c_str(login) diff --git a/md5sum/md5sum.rs b/md5sum/md5sum.rs index ba4305979..ff1fdc7ea 100644 --- a/md5sum/md5sum.rs +++ b/md5sum/md5sum.rs @@ -28,7 +28,7 @@ static NAME: &'static str = "md5sum"; static VERSION: &'static str = "1.0.0"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); @@ -76,7 +76,7 @@ fn main() { } } -fn md5sum(files: Vec, binary: bool, check: bool, tag: bool, status: bool, quiet: bool, strict: bool, warn: bool) { +fn md5sum(files: Vec, binary: bool, check: bool, tag: bool, status: bool, quiet: bool, strict: bool, warn: bool) { let mut md5 = crypto::md5::Md5::new(); let bytes = md5.output_bits() / 4; let mut bad_format = 0; @@ -145,7 +145,7 @@ fn md5sum(files: Vec, binary: bool, check: bool, tag: bool, status: bool } } -fn calc_sum(md5: &mut crypto::md5::Md5, file: &mut Reader, binary: bool) -> StrBuf { +fn calc_sum(md5: &mut crypto::md5::Md5, file: &mut Reader, binary: bool) -> String { let data = if binary { (safe_unwrap!(file.read_to_end())) diff --git a/mkdir/mkdir.rs b/mkdir/mkdir.rs index 6755b02fd..60a6b6016 100644 --- a/mkdir/mkdir.rs +++ b/mkdir/mkdir.rs @@ -29,7 +29,7 @@ static VERSION: &'static str = "1.0.0"; * Handles option parsing */ fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let opts = ~[ // Linux-specific options, not implemented @@ -95,7 +95,7 @@ fn print_help(opts: &[getopts::OptGroup]) { /** * Create the list of new directories */ -fn exec(dirs: Vec, mk_parents: bool, mode: FilePermission, verbose: bool) { +fn exec(dirs: Vec, mk_parents: bool, mode: FilePermission, verbose: bool) { let mut parent_dirs = Vec::new(); if mk_parents { for dir in dirs.iter() { diff --git a/paste/paste.rs b/paste/paste.rs index 0a33fe5c7..e7099ae6d 100644 --- a/paste/paste.rs +++ b/paste/paste.rs @@ -24,7 +24,7 @@ static NAME: &'static str = "paste"; static VERSION: &'static str = "1.0.0"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); let opts = ~[ @@ -56,7 +56,7 @@ fn main() { } } -fn paste(filenames: Vec, serial: bool, delimiters: &str) { +fn paste(filenames: Vec, serial: bool, delimiters: &str) { let mut files: Vec>> = filenames.move_iter().map(|name| io::BufferedReader::new( if name.as_slice() == "-" { @@ -66,11 +66,11 @@ fn paste(filenames: Vec, serial: bool, delimiters: &str) { } ) ).collect(); - let delimiters: Vec = delimiters.chars().map(|x| x.to_str()).collect(); + let delimiters: Vec = delimiters.chars().map(|x| x.to_str()).collect(); let mut delim_count = 0; if serial { for file in files.mut_iter() { - let mut output = StrBuf::new(); + let mut output = String::new(); loop { match file.read_line() { Ok(line) => { diff --git a/printenv/printenv.rs b/printenv/printenv.rs index fe3871827..0c57c8444 100644 --- a/printenv/printenv.rs +++ b/printenv/printenv.rs @@ -25,7 +25,7 @@ mod util; static NAME: &'static str = "printenv"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); let opts = ~[ getopts::optflag("0", "null", "end each output line with 0 byte rather than newline"), @@ -59,7 +59,7 @@ fn main() { exec(matches.free, separator); } -pub fn exec(args: Vec, separator: &str) { +pub fn exec(args: Vec, separator: &str) { if args.is_empty() { let vars = os::env(); for (env_var, value) in vars.move_iter() { diff --git a/pwd/pwd.rs b/pwd/pwd.rs index c8182828b..31eff1419 100644 --- a/pwd/pwd.rs +++ b/pwd/pwd.rs @@ -24,7 +24,7 @@ static NAME: &'static str = "pwd"; static VERSION: &'static str = "1.0.0"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); let opts = ~[ getopts::optflag("", "help", "display this help and exit"), diff --git a/rm/rm.rs b/rm/rm.rs index 468eb2127..b8c8cef21 100644 --- a/rm/rm.rs +++ b/rm/rm.rs @@ -30,7 +30,7 @@ enum InteractiveMode { static NAME: &'static str = "rm"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); // TODO: make getopts support -R in addition to -r @@ -120,7 +120,7 @@ fn main() { } // TODO: implement one-file-system -fn remove(files: Vec, force: bool, interactive: InteractiveMode, one_fs: bool, preserve_root: bool, recursive: bool, dir: bool, verbose: bool) { +fn remove(files: Vec, force: bool, interactive: InteractiveMode, one_fs: bool, preserve_root: bool, recursive: bool, dir: bool, verbose: bool) { for filename in files.iter() { let filename = filename.as_slice(); let file = Path::new(filename); diff --git a/rmdir/rmdir.rs b/rmdir/rmdir.rs index 0fdccaebb..9ddd36424 100644 --- a/rmdir/rmdir.rs +++ b/rmdir/rmdir.rs @@ -23,7 +23,7 @@ mod util; static NAME: &'static str = "rmdir"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); let opts = ~[ @@ -61,7 +61,7 @@ fn main() { } } -fn remove(dirs: Vec, ignore: bool, parents: bool, verbose: bool) { +fn remove(dirs: Vec, ignore: bool, parents: bool, verbose: bool) { for dir in dirs.iter() { let path = Path::new(dir.as_slice()); if path.exists() { diff --git a/seq/seq.rs b/seq/seq.rs index e73efd8b3..ca67e21e7 100644 --- a/seq/seq.rs +++ b/seq/seq.rs @@ -21,20 +21,20 @@ fn print_usage(opts: ~[getopts::OptGroup]) { println!("{:s}", getopts::usage("Print sequences of numbers", opts)); } -fn parse_float(s: &str) -> Result{ +fn parse_float(s: &str) -> Result{ match from_str(s) { Some(n) => Ok(n), None => Err(format!("seq: invalid floating point argument: {:s}", s)) } } -fn escape_sequences(s: &str) -> StrBuf { +fn escape_sequences(s: &str) -> String { s.replace("\\n", "\n"). replace("\\t", "\t") } fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let opts = ~[ getopts::optopt("s", "separator", "Separator character (defaults to \\n)", ""), getopts::optopt("t", "terminator", "Terminator character (defaults to separator)", ""), @@ -96,7 +96,7 @@ fn done_printing(next: f32, step: f32, last: f32) -> bool { } } -fn print_seq(first: f32, step: f32, last: f32, separator: StrBuf, terminator: StrBuf, pad: bool) { +fn print_seq(first: f32, step: f32, last: f32, separator: String, terminator: String, pad: bool) { let mut i = first; let maxlen = first.max(last).to_str().len(); while !done_printing(i, step, last) { diff --git a/sleep/sleep.rs b/sleep/sleep.rs index f85ab8faf..1feb2fa9f 100644 --- a/sleep/sleep.rs +++ b/sleep/sleep.rs @@ -24,7 +24,7 @@ mod util; static NAME: &'static str = "sleep"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); let opts = ~[ @@ -62,7 +62,7 @@ specified by the sum of their values.", opts).as_slice()); } } -fn sleep(args: Vec) { +fn sleep(args: Vec) { let sleep_time = args.iter().fold(0.0, |result, arg| { let (arg, suffix_time) = match match_suffix(arg.as_slice()) { Ok(m) => m, @@ -86,7 +86,7 @@ fn sleep(args: Vec) { timer::sleep((sleep_time * 1000.0) as u64); } -fn match_suffix(arg: &str) -> Result<(StrBuf, int), StrBuf> { +fn match_suffix(arg: &str) -> Result<(String, int), String> { let result = match (arg).char_at_reverse(0) { 's' | 'S' => 1, 'm' | 'M' => 60, diff --git a/tac/tac.rs b/tac/tac.rs index c2642a354..ef783fb40 100644 --- a/tac/tac.rs +++ b/tac/tac.rs @@ -24,7 +24,7 @@ static NAME: &'static str = "tac"; static VERSION: &'static str = "1.0.0"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); let opts = ~[ @@ -69,7 +69,7 @@ fn main() { } } -fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { +fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { for filename in filenames.move_iter() { let mut file = io::BufferedReader::new( if filename.as_slice() == "-" { @@ -87,7 +87,7 @@ fn tac(filenames: Vec, before: bool, _: bool, separator: &str) { data = buf.into_owned(); } let split_vec: Vec<&str> = data.as_slice().split_str(separator).collect(); - let rev: StrBuf = split_vec.iter().rev().fold(StrBuf::new(), |mut a, &b| { + let rev: String = split_vec.iter().rev().fold(String::new(), |mut a, &b| { if before { a.push_str(separator); a.push_str(b); diff --git a/tee/tee.rs b/tee/tee.rs index 08174dc2a..fc13df3c5 100644 --- a/tee/tee.rs +++ b/tee/tee.rs @@ -32,14 +32,14 @@ fn main() { } struct Options { - program: StrBuf, + program: String, append: bool, ignore_interrupts: bool, - print_and_exit: Option, + print_and_exit: Option, files: Box> } -fn options(args: &[StrBuf]) -> Result { +fn options(args: &[String]) -> Result { let opts = ~[ optflag("a", "append", "append to the given FILEs, do not overwrite"), optflag("i", "ignore-interrupts", "ignore interrupt signals"), @@ -47,7 +47,7 @@ fn options(args: &[StrBuf]) -> Result { optflag("V", "version", "output version information and exit"), ]; - let args: Vec = args.iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = args.iter().map(|x| x.to_strbuf()).collect(); getopts(args.tail(), opts).map_err(|e| e.to_err_msg()).and_then(|m| { let version = format!("{} {}", NAME, VERSION); @@ -58,7 +58,7 @@ fn options(args: &[StrBuf]) -> Result { let help = format!("{}\n\nUsage:\n {} {}\n\n{}\n{}", version, program, arguments, usage(brief, opts), comment); - let names = m.free.clone().move_iter().collect::>().append_one("-".to_strbuf()); + let names = m.free.clone().move_iter().collect::>().append_one("-".to_strbuf()); let to_print = if m.opt_present("help") { Some(help) } else if m.opt_present("version") { Some(version) } else { None }; diff --git a/tr/tr.rs b/tr/tr.rs index cddbc14ba..d0b6cfc88 100644 --- a/tr/tr.rs +++ b/tr/tr.rs @@ -147,7 +147,7 @@ fn usage(opts: &[OptGroup]) { } pub fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let opts = [ getopts::optflag("c", "complement", "use the complement of SET1"), getopts::optflag("C", "", "same as -c"), diff --git a/truncate/truncate.rs b/truncate/truncate.rs index 26b9f449c..d2db4ee50 100644 --- a/truncate/truncate.rs +++ b/truncate/truncate.rs @@ -47,7 +47,7 @@ enum TruncateMode { static NAME: &'static str = "truncate"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); let opts = ~[ @@ -108,7 +108,7 @@ file based on its current size: } } -fn truncate(no_create: bool, _: bool, reference: Option, size: Option, filenames: Vec) { +fn truncate(no_create: bool, _: bool, reference: Option, size: Option, filenames: Vec) { let (refsize, mode) = match reference { Some(rfilename) => { let rfile = match File::open(&Path::new(rfilename.clone())) { diff --git a/tty/tty.rs b/tty/tty.rs index a5502c101..6cde0c8db 100644 --- a/tty/tty.rs +++ b/tty/tty.rs @@ -35,7 +35,7 @@ extern { static NAME: &'static str = "tty"; fn main () { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let options = [ optflag("s", "silent", "print nothing, only return an exit status") diff --git a/uname/uname.rs b/uname/uname.rs index b9d90ac19..1d94feec6 100644 --- a/uname/uname.rs +++ b/uname/uname.rs @@ -27,11 +27,11 @@ use c_types::utsname; #[path = "../common/c_types.rs"] mod c_types; struct utsrust { - sysname: StrBuf, - nodename: StrBuf, - release: StrBuf, - version: StrBuf, - machine: StrBuf + sysname: String, + nodename: String, + release: String, + version: String, + machine: String } extern { @@ -52,7 +52,7 @@ unsafe fn getuname() -> utsrust { static NAME: &'static str = "uname"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).as_slice(); let opts = ~[ getopts::optflag("h", "help", "display this help and exit"), @@ -78,7 +78,7 @@ fn main() { return; } let uname = unsafe { getuname() }; - let mut output = StrBuf::new(); + let mut output = String::new(); if matches.opt_present("sysname") || matches.opt_present("all") || !matches.opts_present(["nodename".to_strbuf(), "release".to_strbuf(), "version".to_strbuf(), "machine".to_strbuf()]) { output.push_str(uname.sysname.as_slice()); diff --git a/unlink/unlink.rs b/unlink/unlink.rs index d0375f096..042f475be 100644 --- a/unlink/unlink.rs +++ b/unlink/unlink.rs @@ -27,7 +27,7 @@ mod util; static NAME: &'static str = "unlink"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); let opts = ~[ getopts::optflag("h", "help", "display this help and exit"), diff --git a/uptime/uptime.rs b/uptime/uptime.rs index 12650d24d..8cb097f31 100644 --- a/uptime/uptime.rs +++ b/uptime/uptime.rs @@ -48,7 +48,7 @@ extern { } fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); let opts = ~[ getopts::optflag("v", "version", "output version information and exit"), diff --git a/users/users.rs b/users/users.rs index ab5a4b730..ea9229072 100644 --- a/users/users.rs +++ b/users/users.rs @@ -48,7 +48,7 @@ extern { static NAME: &'static str = "users"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).as_slice(); let opts = ~[ getopts::optflag("h", "help", "display this help and exit"), diff --git a/wc/wc.rs b/wc/wc.rs index 53be97909..caf7e8fde 100644 --- a/wc/wc.rs +++ b/wc/wc.rs @@ -23,7 +23,7 @@ use getopts::Matches; mod util; struct Result { - filename: StrBuf, + filename: String, bytes: uint, chars: uint, lines: uint, @@ -34,7 +34,7 @@ struct Result { static NAME: &'static str = "wc"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); let opts = ~[ getopts::optflag("c", "bytes", "print the byte counts"), @@ -87,7 +87,7 @@ fn is_word_seperator(byte: u8) -> bool { byte == SPACE || byte == TAB || byte == CR || byte == SYN || byte == FF } -pub fn wc(files: Vec, matches: &Matches) { +pub fn wc(files: Vec, matches: &Matches) { let mut total_line_count: uint = 0; let mut total_word_count: uint = 0; let mut total_char_count: uint = 0; @@ -222,7 +222,7 @@ fn print_stats(filename: &str, line_count: uint, word_count: uint, char_count: u } } -fn open(path: StrBuf) -> Option>> { +fn open(path: String) -> Option>> { if "-" == path.as_slice() { let reader = box stdin() as Box; return Some(BufferedReader::new(reader)); diff --git a/whoami/whoami.rs b/whoami/whoami.rs index 56e04b3b8..c553b59d9 100644 --- a/whoami/whoami.rs +++ b/whoami/whoami.rs @@ -30,7 +30,7 @@ extern { pub fn geteuid() -> libc::c_int; } -unsafe fn getusername() -> StrBuf { +unsafe fn getusername() -> String { let passwd: *c_passwd = getpwuid(geteuid()); let pw_name: *libc::c_char = (*passwd).pw_name; @@ -42,7 +42,7 @@ unsafe fn getusername() -> StrBuf { static NAME: &'static str = "whoami"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).as_slice(); let opts = ~[ getopts::optflag("h", "help", "display this help and exit"), diff --git a/yes/yes.rs b/yes/yes.rs index 004be59f0..e6a217186 100644 --- a/yes/yes.rs +++ b/yes/yes.rs @@ -25,7 +25,7 @@ mod util; static NAME: &'static str = "yes"; fn main() { - let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); + let args: Vec = os::args().iter().map(|x| x.to_strbuf()).collect(); let program = args.get(0).clone(); let opts = ~[ getopts::optflag("h", "help", "display this help and exit"),