Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
fa5e320b41
|
|||
| 3288dc5aa9 | |||
| e0b192bd4b |
14
.helix/languages.toml
Normal file
14
.helix/languages.toml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[[language]]
|
||||||
|
file-types = ["c"]
|
||||||
|
indent.unit = "\t"
|
||||||
|
indent.tab-width = 4
|
||||||
|
language-id = "c"
|
||||||
|
name = "c"
|
||||||
|
roots = ["Makefile"]
|
||||||
|
scope = "source.c"
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "rust"
|
||||||
|
auto-format = false
|
||||||
|
indent.unit = "\t"
|
||||||
|
indent.tab-width = 4
|
||||||
7
Makefile
7
Makefile
@@ -32,7 +32,7 @@ RUSTLIBS = --extern getopt=build/o/libgetopt.rlib \
|
|||||||
CFLAGS += -I$(SYSEXITS)
|
CFLAGS += -I$(SYSEXITS)
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: dj false fop hru intcmp mm npc rpn scrut str strcmp swab true
|
all: argued dj false fop hru intcmp mm npc rpn scrut str strcmp swab true
|
||||||
|
|
||||||
# keep build/include until bindgen(1) has stdin support
|
# keep build/include until bindgen(1) has stdin support
|
||||||
# https://github.com/rust-lang/rust-bindgen/issues/2703
|
# https://github.com/rust-lang/rust-bindgen/issues/2703
|
||||||
@@ -87,6 +87,11 @@ build/o/libsysexits.rlib: build/include/sysexits.h
|
|||||||
build/include/sysexits.h: build $(SYSEXITS)sysexits.h
|
build/include/sysexits.h: build $(SYSEXITS)sysexits.h
|
||||||
printf '\043define EXIT_FAILURE 1\n' | cat - $(SYSEXITS)sysexits.h > $@
|
printf '\043define EXIT_FAILURE 1\n' | cat - $(SYSEXITS)sysexits.h > $@
|
||||||
|
|
||||||
|
.PHONY: argued
|
||||||
|
argued: build/bin/argued
|
||||||
|
build/bin/argued: src/argued.rs build
|
||||||
|
$(RUSTC) $(RUSTFLAGS) -o $@ src/argued.rs
|
||||||
|
|
||||||
.PHONY: dj
|
.PHONY: dj
|
||||||
dj: build/bin/dj
|
dj: build/bin/dj
|
||||||
build/bin/dj: src/dj.c build
|
build/bin/dj: src/dj.c build
|
||||||
|
|||||||
28
docs/argued.1
Normal file
28
docs/argued.1
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
.\" Copyright (c) 2022–2024 DTB <trinity@trinity.moe>
|
||||||
|
.\"
|
||||||
|
.\" This work is licensed under CC BY-SA 4.0. To see a copy of this license,
|
||||||
|
.\" visit <http://creativecommons.org/licenses/by-sa/4.0/>.
|
||||||
|
.\"
|
||||||
|
.TH ARGUED 1 2024-07-23 "Harakit-overgrown X.X.X"
|
||||||
|
.SH NAME
|
||||||
|
argued \(en check for arguments
|
||||||
|
.\"
|
||||||
|
.SH DESCRIPTION
|
||||||
|
|
||||||
|
.BR argued (1)
|
||||||
|
exits successfully if any arguments are provided, and unsuccessfully
|
||||||
|
otherwise.
|
||||||
|
.\"
|
||||||
|
.SH AUTHOR
|
||||||
|
|
||||||
|
Written by DTB
|
||||||
|
.MT trinity@trinity.moe
|
||||||
|
.ME .
|
||||||
|
.\"
|
||||||
|
.SH COPYRIGHT
|
||||||
|
|
||||||
|
This work is marked with CC0 1.0. To see a copy of this license, visit
|
||||||
|
<http://creativecommons.org/publicdomain/zero/1.0>.
|
||||||
|
.\"
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR test (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
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user