diff options
Diffstat (limited to 'usr/src/mei/pwd')
-rw-r--r-- | usr/src/mei/pwd/Cargo.toml | 12 | ||||
-rw-r--r-- | usr/src/mei/pwd/src/main.rs | 42 |
2 files changed, 54 insertions, 0 deletions
diff --git a/usr/src/mei/pwd/Cargo.toml b/usr/src/mei/pwd/Cargo.toml new file mode 100644 index 0000000..99a986f --- /dev/null +++ b/usr/src/mei/pwd/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "pwd" +version = "0.0.1" +edition = "2021" + +[[bin]] +name = "pwd" +path = "src/main.rs" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/usr/src/mei/pwd/src/main.rs b/usr/src/mei/pwd/src/main.rs new file mode 100644 index 0000000..051f5bc --- /dev/null +++ b/usr/src/mei/pwd/src/main.rs @@ -0,0 +1,42 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2023 Ren Kararou All rights reserved. + * Use is subject to license terms. + */ + +use std::process::exit; +use std::env::current_dir; + +fn main() { + match current_dir() { + Ok(buf) => { + println!("{}", buf.to_str().unwrap()); + exit(0); + }, + Err(_) => { + eprintln!("pwd: cannot determine current directory!"); + exit(2); + }, + } +} |