removed c-main dep
This commit is contained in:
parent
e3e1807656
commit
f33c18a2b3
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -30,15 +30,6 @@ version = "1.3.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "c-main"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "797bbff8bd2bcddb7f0ee638b55398686adac15174689a86da5ffc0f51219f75"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cexpr"
|
name = "cexpr"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
@ -214,7 +205,6 @@ dependencies = [
|
|||||||
name = "tomcat"
|
name = "tomcat"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"c-main",
|
|
||||||
"toml",
|
"toml",
|
||||||
"yacexits",
|
"yacexits",
|
||||||
]
|
]
|
||||||
|
@ -6,6 +6,5 @@ license = "AGPL-3.0-or-later"
|
|||||||
authors = [ "Emma Tebibyte <emma@tebibyte.media>" ]
|
authors = [ "Emma Tebibyte <emma@tebibyte.media>" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
c-main = "1.0.1"
|
|
||||||
toml = "0.5.9"
|
toml = "0.5.9"
|
||||||
yacexits = "0.1.2"
|
yacexits = "0.1.2"
|
||||||
|
17
src/main.rs
17
src/main.rs
@ -16,9 +16,8 @@
|
|||||||
* along with this program. If not, see https://www.gnu.org/licenses/.
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#![no_main]
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
|
env::args,
|
||||||
fs::File,
|
fs::File,
|
||||||
io::Read,
|
io::Read,
|
||||||
iter::Peekable,
|
iter::Peekable,
|
||||||
@ -27,7 +26,6 @@ use std::{
|
|||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
|
|
||||||
use c_main::Args;
|
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
use yacexits::*;
|
use yacexits::*;
|
||||||
|
|
||||||
@ -67,8 +65,8 @@ fn parse_toml(
|
|||||||
},
|
},
|
||||||
Value::Table(table) => {
|
Value::Table(table) => {
|
||||||
if tabkey.peek().is_some() {
|
if tabkey.peek().is_some() {
|
||||||
root = toml::Value::Table(table.to_owned());
|
root = toml::Value::Table(table.to_owned());
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
@ -99,9 +97,8 @@ fn parse_toml(
|
|||||||
Ok(out)
|
Ok(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
fn main() {
|
||||||
fn rust_main(args: Args) {
|
let argv: Vec<String> = args().collect();
|
||||||
let argv: Vec<&str> = args.into_iter().collect();
|
|
||||||
let usage_info = format!("Usage: {} [table.]key[[index]] [file...]", argv[0]);
|
let usage_info = format!("Usage: {} [table.]key[[index]] [file...]", argv[0]);
|
||||||
|
|
||||||
if argv.len() <= 1 {
|
if argv.len() <= 1 {
|
||||||
@ -109,11 +106,11 @@ fn rust_main(args: Args) {
|
|||||||
exit(EX_USAGE);
|
exit(EX_USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
let input = argv.get(2).unwrap_or(&"");
|
let input = argv.get(2).unwrap_or(&"".to_owned()).to_owned();
|
||||||
|
|
||||||
let mut content = Vec::new();
|
let mut content = Vec::new();
|
||||||
|
|
||||||
match input.to_owned() {
|
match input.as_str() {
|
||||||
"-" | "" => unsafe { File::from_raw_fd(0) },
|
"-" | "" => unsafe { File::from_raw_fd(0) },
|
||||||
_ => {
|
_ => {
|
||||||
File::open(Path::new(&input)).unwrap_or_else(|_| {
|
File::open(Path::new(&input)).unwrap_or_else(|_| {
|
||||||
|
Loading…
Reference in New Issue
Block a user