Add cat binary
This commit is contained in:
		
							parent
							
								
									0115c6ba2a
								
							
						
					
					
						commit
						fa177d0e73
					
				
					 2 changed files with 20 additions and 0 deletions
				
			
		
							
								
								
									
										6
									
								
								cat/Cargo.toml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								cat/Cargo.toml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | [package] | ||||||
|  | name = "cat" | ||||||
|  | version = "0.1.0" | ||||||
|  | authors = ["Eryn Wells <eryn@erynwells.me>"] | ||||||
|  | 
 | ||||||
|  | [dependencies] | ||||||
							
								
								
									
										14
									
								
								cat/src/main.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								cat/src/main.rs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,14 @@ | ||||||
|  | use std::io; | ||||||
|  | use std::io::Read; | ||||||
|  | use std::io::Write; | ||||||
|  | 
 | ||||||
|  | fn main() { | ||||||
|  |     let mut buffer = String::new(); | ||||||
|  |     match io::stdin().read_to_string(&mut buffer) { | ||||||
|  |         Ok(_) => match io::stdout().write(&buffer.as_bytes()) { | ||||||
|  |             Ok(_) => {} | ||||||
|  |             Err(err) => println!("Error writing: {:?}", err), | ||||||
|  |         }, | ||||||
|  |         Err(err) => println!("Error reading: {:?}", err), | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue