<commit_before>// Copyright 2015 <NAME>. See the LICENSE file at the top-level
// directory of this distribution.

// An implementation of the cat(1) command in Rust.
// See http://man.cat-v.org/unix-6th/1/cat
use std::env;
use std::fs::File;
use std::io;
use std::path::Path;

fn cat(filename: &str) -> io::Result<u64> {
    let mut reader = if filename == "-" {
        Box::new(io::stdin()) as Box<io::Read>
    } else {
        Box::new(try!(File::open(Path::new(&filename)))) as Box<io::Read>
    };

    io::copy(& mut reader, & mut io::stdout())
}

fn main() {
    let mut args : Vec<_> = env::args().collect();

    if args.len() == 1 {
        args.push("-".to_string());
    }

    for arg in args.iter().skip(1) {
        match cat(&arg) {
            Ok(_) => {},
            Err(e) => {
                println!("{}: {}", arg, e);
            }
        };
    }
}<commit_msg>Write error message to standard error.<commit_after>// Copyright 2015 <NAME>. See the LICENSE file at the top-level
// directory of this distribution.

// An implementation of the cat(1) command in Rust.
// See http://man.cat-v.org/unix-6th/1/cat
use std::env;
use std::fs::File;
use std::io;
use std::io::Write;
use std::path::Path;

fn cat(filename: &str) -> io::Result<u64> {
    let mut reader = if filename == "-" {
        Box::new(io::stdin()) as Box<io::Read>
    } else {
        Box::new(try!(File::open(Path::new(&filename)))) as Box<io::Read>
    };

    io::copy(& mut reader, & mut io::stdout())
}

fn main() {
    let mut args : Vec<_> = env::args().collect();

    if args.len() == 1 {
        args.push("-".to_string());
    }

    for arg in args.iter().skip(1) {
        match cat(&arg) {
            Ok(_) => {},
            Err(e) => {
                let mut stderr = std::io::stderr();
                writeln!(&mut stderr, "{}: {}", arg, e).unwrap();
            }
        };
    }
}
{'fraction_non_alphanumeric': 0.20422163588390502, 'fraction_numerical': 0.011609498680738786, 'mean_word_length': 2.3089005235602094, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5150702', 'n_tokens_mistral': 660, 'n_tokens_neox': 638, 'n_words': 164}