| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- use std::env::args;
- use std::process;
-
- extern crate nix;
-
- use nix::unistd::{fork, getpid};
- use nix::sys::wait::wait;
- use nix::sys::wait::WaitStatus;
- use nix::unistd::ForkResult::{Child, Parent};
-
- fn main() {
-
- let arguments: Vec<String> = args().collect();
-
- if arguments.len() != 0 {
-
-
- let pid = fork();
- match pid {
- Ok(Child) => {
- println!("hello, I am child (pid:{})", getpid());
- }
-
- Ok(Parent { child }) => {
- if let Ok(ws) = wait() {
- if let WaitStatus::Exited(child_pid, exit_code) = ws {
-
- }
- }
- }
-
- Err(_) => {}
- }
-
-
-
- } else {
- println!("Correct usage: number number <number> ...");
- process::exit(1)
- }
-
- }
-
- fn concatenate_strings(){
- }
-
- fn split_into_strings(){
- }
-
- fn sum_strings(){
- }
-
- fn mul_strings(){
- }
|