eep(1) #103
9
Makefile
9
Makefile
|
@ -29,7 +29,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: dj eep 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
|
||||||
|
@ -118,6 +118,13 @@ scrut: build/bin/scrut
|
||||||
build/bin/scrut: src/scrut.c build
|
build/bin/scrut: src/scrut.c build
|
||||||
$(CC) $(CFLAGS) -o $@ src/scrut.c
|
$(CC) $(CFLAGS) -o $@ src/scrut.c
|
||||||
|
|
||||||
|
.PHONY: eep
|
||||||
|
eep: build/bin/eep
|
||||||
|
build/bin/eep: src/eep.rs build rustlibs
|
||||||
|
$(RUSTC) $(RUSTFLAGS) \
|
||||||
|
--extern sysexits=build/o/libsysexits.rlib \
|
||||||
|
|||||||
|
-o $@ src/eep.rs
|
||||||
|
|
||||||
.PHONY: str
|
.PHONY: str
|
||||||
str: build/bin/str
|
str: build/bin/str
|
||||||
build/bin/str: src/str.c build
|
build/bin/str: src/str.c build
|
||||||
|
|
43
docs/eep.1
Normal file
43
docs/eep.1
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
.\" Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||||
|
.\" Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||||
|
.\"
|
||||||
|
.\" 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 EEP 1
|
||||||
|
.SH NAME
|
||||||
|
eep \(en wait a moment
|
||||||
|
.\"
|
||||||
|
.SH SYNOPSIS
|
||||||
|
|
||||||
|
eep
|
||||||
|
.RB [ seconds ]
|
||||||
|
.\"
|
||||||
|
.SH DESCRIPTION
|
||||||
|
|
||||||
|
Wait a specified number of seconds before exiting.
|
||||||
|
.\"
|
||||||
|
.SH DIAGNOSTICS
|
||||||
emma marked this conversation as resolved
Outdated
emma
commented
> `Eep waits a given number of seconds`
|
|||||||
|
|
||||||
|
If the specified time fails to elapse or in the case of incorrect invocation,
|
||||||
|
the program will exit unsuccessfully. In the latter scenario, a debug message
|
||||||
|
will be printed.
|
||||||
|
.\"
|
||||||
|
.SH CAVEATS
|
||||||
|
|
||||||
|
User may still be tired after invocation.
|
||||||
|
.\"
|
||||||
|
.SH AUTHOR
|
||||||
|
|
||||||
|
Written by DTB
|
||||||
|
.MT trinity@trinity.moe
|
||||||
|
.ME .
|
||||||
|
.\"
|
||||||
|
.SH COPYRIGHT
|
||||||
|
|
||||||
|
Copyright \(co 2024 DTB. License AGPLv3+: GNU AGPL version 3 or later
|
||||||
|
<https://gnu.org/licenses/gpl.html>.
|
||||||
|
.\"
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR sleep (3p)
|
||||||
|
.BR sleep (1p)
|
47
src/eep.rs
Normal file
47
src/eep.rs
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 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,
|
||||||
|
thread::sleep,
|
||||||
|
time::Duration
|
||||||
|
};
|
||||||
|
|
||||||
|
extern crate sysexits;
|
||||||
|
use sysexits::EX_USAGE;
|
||||||
|
|
||||||
|
fn usage(s: &str) -> ExitCode {
|
||||||
|
eprintln!("Usage: {} [seconds]", s);
|
||||||
emma
commented
> `"Usage: {} seconds"`
|
|||||||
|
ExitCode::from(EX_USAGE as u8)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() -> ExitCode {
|
||||||
|
let argv = args().collect::<Vec<String>>();
|
||||||
|
|
||||||
|
if argv.len() == 2 {
|
||||||
|
if let Ok(s) = argv[1].parse::<u64>() {
|
||||||
|
sleep(Duration::from_secs(s));
|
||||||
|
ExitCode::SUCCESS
|
||||||
|
} else {
|
||||||
|
usage(&argv[0])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
usage(&argv[0])
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user
This is unnecessary due to the merge-in of the main branch:
$(RUSTLIBS)
was introduced.