fn and_execute(&self, stdout: &mut StdoutLock, stderr: &mut Stderr) -> i32 {
        let stdin = io::stdin();
        let line_count = &mut 0usize;
        let flags_enabled = self.number || self.number_nonblank || self.show_ends || self.show_tabs ||
                            self.squeeze_blank || self.show_nonprinting;

        if self.paths.is_empty() && flags_enabled {
            self.cat(&mut stdin.lock(), line_count, stdout, stderr);
        } else if self.paths.is_empty() {
            self.simple_cat(&mut stdin.lock(), stdout, stderr);
        } else {
            for path in &self.paths {
                if flags_enabled && path == "-" {
                    self.cat(&mut stdin.lock(), line_count, stdout, stderr);
                } else if path == "-" {
                    // Copy the standard input directly to the standard output.
                    self.simple_cat(&mut stdin.lock(), stdout, stderr);
                } else if fs::metadata(&path).map(|m| m.is_dir()).unwrap_or(false) {
                    stderr.write(path.as_bytes()).try(stderr);
                    stderr.write(b": Is a directory\n").try(stderr);
                    stderr.flush().try(stderr);
                    self.exit_status.set(1i32);
                } else if flags_enabled {
                    fs::File::open(&path)
                        // Open the file and copy the file's contents to standard output based input arguments.
                        .map(|file| self.cat(&mut BufReader::new(file), line_count, stdout, stderr))
                        // If an error occurred, print the error and set the exit status.
                        .unwrap_or_else(|message| {
                            stderr.write(path.as_bytes()).try(stderr);
                            stderr.write(b": ").try(stderr);
                            stderr.write(message.description().as_bytes()).try(stderr);
                            stderr.write(b"\n").try(stderr);
                            stderr.flush().try(stderr);
                            self.exit_status.set(1i32);
                        });
                } else {
                    // Open a file and copy the contents directly to standard output.
                    fs::File::open(&path).map(|ref mut file| { self.simple_cat(file, stdout, stderr); })
                        // If an error occurs, print the error and set the exit status.
                        .unwrap_or_else(|message| {
                            stderr.write(path.as_bytes()).try(stderr);
                            stderr.write(b": ").try(stderr);
                            stderr.write(message.description().as_bytes()).try(stderr);
                            stderr.write(b"\n").try(stderr);
                            stderr.flush().try(stderr);
                            self.exit_status.set(1i32);
                        });
                }
            }
        }
        self.exit_status.get()
    }
/// Execute the parameters given to the program.
Execute the parameters given to the program.
Execute the parameters given to the program .
fn and_execute(&self, stdout: &mut StdoutLock, stderr: &mut Stderr) -> i32 {
        let stdin = io::stdin();
        let line_count = &mut 0usize;
        let flags_enabled = self.number || self.number_nonblank || self.show_ends || self.show_tabs ||
                            self.squeeze_blank || self.show_nonprinting;
        if self.paths.is_empty() && flags_enabled {
            self.cat(&mut stdin.lock(), line_count, stdout, stderr);
        } else if self.paths.is_empty() {
            self.simple_cat(&mut stdin.lock(), stdout, stderr);
        } else {
            for path in &self.paths {
                if flags_enabled && path == "-" {
                    self.cat(&mut stdin.lock(), line_count, stdout, stderr);
                } else if path == "-" {
                    // Copy the standard input directly to the standard output.
                    self.simple_cat(&mut stdin.lock(), stdout, stderr);
                } else if fs::metadata(&path).map(|m| m.is_dir()).unwrap_or(false) {
                    stderr.write(path.as_bytes()).try(stderr);
                    stderr.write(b": Is a directory\n").try(stderr);
                    stderr.flush().try(stderr);
                    self.exit_status.set(1i32);
                } else if flags_enabled {
                    fs::File::open(&path)
                        // Open the file and copy the file's contents to standard output based input arguments.
                        .map(|file| self.cat(&mut BufReader::new(file), line_count, stdout, stderr))
                        // If an error occurred, print the error and set the exit status.
                        .unwrap_or_else(|message| {
                            stderr.write(path.as_bytes()).try(stderr);
                            stderr.write(b": ").try(stderr);
                            stderr.write(message.description().as_bytes()).try(stderr);
                            stderr.write(b"\n").try(stderr);
                            stderr.flush().try(stderr);
                            self.exit_status.set(1i32);
                        });
                } else {
                    // Open a file and copy the contents directly to standard output.
                    fs::File::open(&path).map(|ref mut file| { self.simple_cat(file, stdout, stderr); })
                        // If an error occurs, print the error and set the exit status.
                        .unwrap_or_else(|message| {
                            stderr.write(path.as_bytes()).try(stderr);
                            stderr.write(b": ").try(stderr);
                            stderr.write(message.description().as_bytes()).try(stderr);
                            stderr.write(b"\n").try(stderr);
                            stderr.flush().try(stderr);
                            self.exit_status.set(1i32);
                        });
                }
            }
        }
        self.exit_status.get()
    }
fn and_execute ( & self , stdout : & mut StdoutLock , stderr : & mut Stderr ) -> i32 { let stdin = io :: stdin ( ) ; let line_count = & mut 0usize ; let flags_enabled = self . number || self . number_nonblank || self . show_ends || self . show_tabs || self . squeeze_blank || self . show_nonprinting ; if self . paths . is_empty ( ) && flags_enabled { self . cat ( & mut stdin . lock ( ) , line_count , stdout , stderr ) ; } else if self . paths . is_empty ( ) { self . simple_cat ( & mut stdin . lock ( ) , stdout , stderr ) ; } else { for path in & self . paths { if flags_enabled && path == " " { self . cat ( & mut stdin . lock ( ) , line_count , stdout , stderr ) ; } else if path == " " { // Copy the standard input directly to the standard output. self . simple_cat ( & mut stdin . lock ( ) , stdout , stderr ) ; } else if fs :: metadata ( & path ) . map ( | m | m . is_dir ( ) ) . unwrap_or ( false ) { stderr . write ( path . as_bytes ( ) ) . try ( stderr ) ; stderr . write ( b" \n " ) . try ( stderr ) ; stderr . flush ( ) . try ( stderr ) ; self . exit_status . set ( 1i32 ) ; } else if flags_enabled { fs :: File :: open ( & path ) // Open the file and copy the file's contents to standard output based input arguments. . map ( | file | self . cat ( & mut BufReader :: new ( file ) , line_count , stdout , stderr ) ) // If an error occurred, print the error and set the exit status. . unwrap_or_else ( | message | { stderr . write ( path . as_bytes ( ) ) . try ( stderr ) ; stderr . write ( b" " ) . try ( stderr ) ; stderr . write ( message . description ( ) . as_bytes ( ) ) . try ( stderr ) ; stderr . write ( b" \n " ) . try ( stderr ) ; stderr . flush ( ) . try ( stderr ) ; self . exit_status . set ( 1i32 ) ; } ) ; } else { // Open a file and copy the contents directly to standard output. fs :: File :: open ( & path ) . map ( | ref mut file | { self . simple_cat ( file , stdout , stderr ) ; } ) // If an error occurs, print the error and set the exit status. . unwrap_or_else ( | message | { stderr . write ( path . as_bytes ( ) ) . try ( stderr ) ; stderr . write ( b" " ) . try ( stderr ) ; stderr . write ( message . description ( ) . as_bytes ( ) ) . try ( stderr ) ; stderr . write ( b" \n " ) . try ( stderr ) ; stderr . flush ( ) . try ( stderr ) ; self . exit_status . set ( 1i32 ) ; } ) ; } } } self . exit_status . get ( ) }
Execute the parameters given to the program.
Execute the parameters given to the program .
&self
stdout
&mut StdoutLock
stderr
&mut Stderr