暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

main.rs 868B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. use std::env::args;
  2. use std::process;
  3. extern crate nix;
  4. use nix::unistd::{fork, getpid};
  5. use nix::sys::wait::wait;
  6. use nix::sys::wait::WaitStatus;
  7. use nix::unistd::ForkResult::{Child, Parent};
  8. fn main() {
  9. let arguments: Vec<String> = args().collect();
  10. if arguments.len() != 0 {
  11. let pid = fork();
  12. match pid {
  13. Ok(Child) => {
  14. println!("hello, I am child (pid:{})", getpid());
  15. }
  16. Ok(Parent { child }) => {
  17. if let Ok(ws) = wait() {
  18. if let WaitStatus::Exited(child_pid, exit_code) = ws {
  19. }
  20. }
  21. }
  22. Err(_) => {}
  23. }
  24. } else {
  25. println!("Correct usage: number number <number> ...");
  26. process::exit(1)
  27. }
  28. }
  29. fn concatenate_strings(){
  30. }
  31. fn split_into_strings(){
  32. }
  33. fn sum_strings(){
  34. }
  35. fn mul_strings(){
  36. }