argued(1): re-write in Rust
This commit is contained in:
parent
3288dc5aa9
commit
fa5e320b41
4
Makefile
4
Makefile
@ -89,8 +89,8 @@ build/include/sysexits.h: build $(SYSEXITS)sysexits.h
|
|||||||
|
|
||||||
.PHONY: argued
|
.PHONY: argued
|
||||||
argued: build/bin/argued
|
argued: build/bin/argued
|
||||||
build/bin/argued: src/argued.c build
|
build/bin/argued: src/argued.rs build
|
||||||
$(CC) $(CFLAGS) -o $@ src/argued.c
|
$(RUSTC) $(RUSTFLAGS) -o $@ src/argued.rs
|
||||||
|
|
||||||
.PHONY: dj
|
.PHONY: dj
|
||||||
dj: build/bin/dj
|
dj: build/bin/dj
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2022–2024 DTB <trinity@trinity.moe>
|
|
||||||
* SPDX-License-Identifier: CC0
|
|
||||||
*
|
|
||||||
* This work is marked with CC0 1.0. To view a copy of this license, visit
|
|
||||||
* <http://creativecommons.org/publicdomain/zero/1.0>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]){ return !(argc > 1); }
|
|
28
src/argued.rs
Normal file
28
src/argued.rs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022_2024 DTB <trinity@trinity.moe>
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU Affero General Public License as published by the Free
|
||||||
|
* Software Foundation, either version 3 of the License, or (at your option) any
|
||||||
|
* later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use std::{ env::args, process::ExitCode };
|
||||||
|
|
||||||
|
fn main() -> ExitCode {
|
||||||
|
let argv = args().collect::<Vec<String>>();
|
||||||
|
|
||||||
|
match argv.len() {
|
||||||
|
0 | 1 => ExitCode::FAILURE,
|
||||||
|
_ => ExitCode::SUCCESS
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user