Compare commits
16 Commits
6c558654f3
...
0.13.22
| Author | SHA1 | Date | |
|---|---|---|---|
|
e9058803d3
|
|||
|
a4a556a5b6
|
|||
|
e2c03842a3
|
|||
|
0fd66bff38
|
|||
|
0c4923016e
|
|||
|
e0c985f7ff
|
|||
|
4c81516742
|
|||
|
98c4d94f6d
|
|||
|
da190f713c
|
|||
|
10b7f7706b
|
|||
|
b1a4a1a2b9
|
|||
|
a693ced9d9
|
|||
|
1003c82d23
|
|||
|
baa75a2619
|
|||
|
d6d9c2088e
|
|||
|
ea2efdf5b9
|
2
Makefile
2
Makefile
@@ -19,7 +19,7 @@ PREFIX ?= /usr/local
|
|||||||
# for conditionally compiling OS features
|
# for conditionally compiling OS features
|
||||||
OS != uname
|
OS != uname
|
||||||
OS_INCLUDE != test -e include/$(OS).mk && printf 'include/$(OS).mk\n' \
|
OS_INCLUDE != test -e include/$(OS).mk && printf 'include/$(OS).mk\n' \
|
||||||
|| include/None.mk
|
|| printf '/dev/null\n'
|
||||||
|
|
||||||
# normalized prefix
|
# normalized prefix
|
||||||
PREFIX_N != dirname $(PREFIX)/.
|
PREFIX_N != dirname $(PREFIX)/.
|
||||||
|
|||||||
31
src/dj.c
31
src/dj.c
@@ -108,8 +108,10 @@ Io_write(struct Io *io) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
oserr(char *e, int n) {
|
oserr(char *e, int n) { /* program_name: [failing component:] error */
|
||||||
(void)fprintf(stderr, "%s: %s: %s\n", program_name, e, strerror(n));
|
(void)fprintf(stderr, "%s: ", program_name);
|
||||||
|
if (e != NULL) { (void)fprintf(stderr, "%s: ", e); }
|
||||||
|
(void)fprintf(stderr, "%s\n", strerror(n));
|
||||||
|
|
||||||
return EX_OSERR;
|
return EX_OSERR;
|
||||||
}
|
}
|
||||||
@@ -168,12 +170,6 @@ usage(char *argv0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
#ifdef __OpenBSD__
|
|
||||||
if (pledge("cpath rpath stdio unveil wpath", NULL) == -1) {
|
|
||||||
return oserr("pledge", errno);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int align; /* low 8b used, negative if no alignment is being done */
|
int align; /* low 8b used, negative if no alignment is being done */
|
||||||
int count; /* -1 if dj(1) runs until no more reads are possible */
|
int count; /* -1 if dj(1) runs until no more reads are possible */
|
||||||
char *fmt; /* set to fmt_asv (default) or fmt_human (-H) */
|
char *fmt; /* set to fmt_asv (default) or fmt_human (-H) */
|
||||||
@@ -181,6 +177,12 @@ int main(int argc, char *argv[]) {
|
|||||||
bool retry; /* false if exits on partial reads or writes */
|
bool retry; /* false if exits on partial reads or writes */
|
||||||
struct Io io[2 /* { in, out } */];
|
struct Io io[2 /* { in, out } */];
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
if (pledge("cpath rpath stdio unveil wpath", NULL) == -1) {
|
||||||
|
return oserr(NULL, errno);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set defaults. */
|
/* Set defaults. */
|
||||||
align = -1;
|
align = -1;
|
||||||
count = -1;
|
count = -1;
|
||||||
@@ -215,14 +217,10 @@ int main(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
char *perms = "wc";
|
if (unveil(optarg, i == 0 ? "r" : "wc") == -1) {
|
||||||
|
return oserr(NULL, errno);
|
||||||
/* modify perms in-place to read-only */
|
|
||||||
if (i == 0) { perms = "r"; }
|
|
||||||
|
|
||||||
if (unveil(optarg, perms) == -1) {
|
|
||||||
return oserr("unveil", errno);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -265,8 +263,9 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
if (unveil(NULL, NULL) == -1) { return oserr("unveil", errno); }
|
if (unveil(NULL, NULL) == -1) { return oserr(NULL, errno); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
assert(io->fd != STDIN_FILENO || io->fl == read_flags);
|
assert(io->fd != STDIN_FILENO || io->fl == read_flags);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023–2024 Emma Tebibyte <emma@tebibyte.media>
|
* Copyright (c) 2023–2024 Emma Tebibyte <emma@tebibyte.media>
|
||||||
|
* Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||||
* SPDX-License-Identifier: CC0
|
* SPDX-License-Identifier: CC0
|
||||||
*
|
*
|
||||||
* This work is marked with CC0 1.0. To view a copy of this license, visit
|
* This work is marked with CC0 1.0. To view a copy of this license, visit
|
||||||
@@ -10,7 +11,7 @@
|
|||||||
# include <unistd.h> /* pledge(2) */
|
# include <unistd.h> /* pledge(2) */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
pledge(NULL, NULL);
|
pledge(NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ use sysexits::EX_USAGE;
|
|||||||
#[cfg(target_os="openbsd")] use openbsd::{ Promises, pledge };
|
#[cfg(target_os="openbsd")] use openbsd::{ Promises, pledge };
|
||||||
#[cfg(target_os="openbsd")] use strerror::StrError;
|
#[cfg(target_os="openbsd")] use strerror::StrError;
|
||||||
|
|
||||||
|
|
||||||
fn usage(s: &str) -> ExitCode {
|
fn usage(s: &str) -> ExitCode {
|
||||||
eprintln!("Usage: {} [-egl] integer integer...", s);
|
eprintln!("Usage: {} [-egl] integer integer...", s);
|
||||||
ExitCode::from(EX_USAGE as u8)
|
ExitCode::from(EX_USAGE as u8)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
ffi::CString,
|
ffi::{ CString, c_char },
|
||||||
io::Error,
|
io::Error,
|
||||||
ptr::null,
|
ptr::null,
|
||||||
};
|
};
|
||||||
@@ -33,13 +33,13 @@ mod openbsd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Promises(*const i8);
|
pub struct Promises(*const c_char);
|
||||||
|
|
||||||
impl Promises {
|
impl Promises {
|
||||||
pub fn new(promises: &str) -> Self {
|
pub fn new(promises: &str) -> Self {
|
||||||
let p = CString::new(promises).unwrap();
|
let p = CString::new(promises).unwrap();
|
||||||
|
|
||||||
Promises(p.into_raw() as *const i8)
|
Promises(p.into_raw() as *const c_char)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,10 +81,10 @@ pub fn unveil(
|
|||||||
permissions: Option<UnveilPerms>,
|
permissions: Option<UnveilPerms>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let path_c = path.map(CString::new).map(Result::unwrap);
|
let path_c = path.map(CString::new).map(Result::unwrap);
|
||||||
let arg1 = path_c.map(|p| p.into_raw() as *const i8).unwrap_or(null());
|
let arg1 = path_c.map(|p| p.into_raw() as *const c_char).unwrap_or(null());
|
||||||
|
|
||||||
let arg2 = permissions
|
let arg2 = permissions
|
||||||
.map(|p| p.0.into_raw() as *const i8)
|
.map(|p| p.0.into_raw() as *const c_char)
|
||||||
.unwrap_or(null());
|
.unwrap_or(null());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|||||||
39
src/mm.rs
39
src/mm.rs
@@ -52,7 +52,7 @@ fn main() -> ExitCode {
|
|||||||
let usage = format!("Usage: {} [-aetu] [-i input] [-o output]", argv[0]);
|
let usage = format!("Usage: {} [-aetu] [-i input] [-o output]", argv[0]);
|
||||||
|
|
||||||
if cfg!(target_os="openbsd") {
|
if cfg!(target_os="openbsd") {
|
||||||
let promises = Promises::new("rpath stdio unveil");
|
let promises = Promises::new("cpath rpath stdio unveil wpath");
|
||||||
if let Err(e) = pledge(Some(promises), None) {
|
if let Err(e) = pledge(Some(promises), None) {
|
||||||
eprintln!("{}: {}", argv[0], e.strerror());
|
eprintln!("{}: {}", argv[0], e.strerror());
|
||||||
return ExitCode::from(EX_OSERR as u8);
|
return ExitCode::from(EX_OSERR as u8);
|
||||||
@@ -76,29 +76,11 @@ fn main() -> ExitCode {
|
|||||||
Ok("t") => t = false,
|
Ok("t") => t = false,
|
||||||
Ok("i") => { /* add inputs */
|
Ok("i") => { /* add inputs */
|
||||||
let input = opt.arg().unwrap();
|
let input = opt.arg().unwrap();
|
||||||
|
|
||||||
if cfg!(target_os="openbsd") {
|
|
||||||
let perms = UnveilPerms::new(vec!['r']);
|
|
||||||
if let Err(e) = unveil(Some(&input), Some(perms)) {
|
|
||||||
eprintln!("{}: {}", argv[0], e.strerror());
|
|
||||||
return ExitCode::from(EX_OSERR as u8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ins.push(input);
|
ins.push(input);
|
||||||
mode = Some(In); /* latest argument == -i */
|
mode = Some(In); /* latest argument == -i */
|
||||||
},
|
},
|
||||||
Ok("o") => { /* add output */
|
Ok("o") => { /* add output */
|
||||||
let output = opt.arg().unwrap();
|
let output = opt.arg().unwrap();
|
||||||
|
|
||||||
if cfg!(target_os="openbsd") {
|
|
||||||
let perms = UnveilPerms::new(vec!['w', 'c']);
|
|
||||||
if let Err(e) = unveil(Some(&output), Some(perms)) {
|
|
||||||
eprintln!("{}: {}", argv[0], e.strerror());
|
|
||||||
return ExitCode::from(EX_OSERR as u8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
outs.push(output);
|
outs.push(output);
|
||||||
mode = Some(Out); /* latest argument == -o */
|
mode = Some(Out); /* latest argument == -o */
|
||||||
},
|
},
|
||||||
@@ -125,6 +107,25 @@ fn main() -> ExitCode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if cfg!(target_os="openbsd") {
|
if cfg!(target_os="openbsd") {
|
||||||
|
|
||||||
|
for input in &ins {
|
||||||
|
let perms = UnveilPerms::new(vec!['r']);
|
||||||
|
|
||||||
|
if let Err(e) = unveil(Some(&input), Some(perms)) {
|
||||||
|
eprintln!("{}: {}", argv[0], e.strerror());
|
||||||
|
return ExitCode::from(EX_OSERR as u8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for output in &outs {
|
||||||
|
let perms = UnveilPerms::new(vec!['c', 'w']);
|
||||||
|
|
||||||
|
if let Err(e) = unveil(Some(&output), Some(perms)) {
|
||||||
|
eprintln!("{}: {}", argv[0], e.strerror());
|
||||||
|
return ExitCode::from(EX_OSERR as u8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Err(e) = unveil(None, None) {
|
if let Err(e) = unveil(None, None) {
|
||||||
eprintln!("{}: {}", argv[0], e.strerror());
|
eprintln!("{}: {}", argv[0], e.strerror());
|
||||||
return ExitCode::from(EX_OSERR as u8);
|
return ExitCode::from(EX_OSERR as u8);
|
||||||
|
|||||||
25
src/npc.c
25
src/npc.c
@@ -22,11 +22,6 @@
|
|||||||
#include <sysexits.h> /* EX_IOERR, EX_OK, EX_OSERR, EX_USAGE */
|
#include <sysexits.h> /* EX_IOERR, EX_OK, EX_OSERR, EX_USAGE */
|
||||||
#include <unistd.h> /* pledge(2), getopt(3) */
|
#include <unistd.h> /* pledge(2), getopt(3) */
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
|
||||||
# include <errno.h> /* errno */
|
|
||||||
# include <string.h> /* strerror(3) */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char *program_name = "npc";
|
char *program_name = "npc";
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -44,22 +39,20 @@ usage(char *argv0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
#ifdef __OpenBSD__
|
|
||||||
program_name = argv[0] == NULL ? program_name : argv[0];
|
|
||||||
|
|
||||||
if (pledge("stdio", NULL) == -1) {
|
|
||||||
(void)fprintf(stderr, "%s: %s\n", program_name, strerror(errno));
|
|
||||||
return EX_OSERR;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
int c;
|
int c;
|
||||||
char showend = 0; /* print a dollar sign before each newline */
|
char showend = 0; /* print a dollar sign before each newline */
|
||||||
char showtab = 0; /* prints tab characters in caret notation */
|
char showtab = 0; /* prints tab characters in caret notation */
|
||||||
|
|
||||||
if (argc > 0) {
|
#ifdef __OpenBSD__
|
||||||
#ifndef __OpenBSD__
|
if (pledge("stdio", NULL) == -1) {
|
||||||
program_name = argv[0];
|
perror(argv[0] == NULL ? program_name : argv[0]);
|
||||||
|
return EX_OSERR;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (argc > 0) {
|
||||||
|
program_name = argv[0];
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "et")) != -1) {
|
while ((c = getopt(argc, argv, "et")) != -1) {
|
||||||
switch (c){
|
switch (c){
|
||||||
case 'e': showend = 1; break;
|
case 'e': showend = 1; break;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
* along with this program. If not, see https://www.gnu.org/licenses/.
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h> /* assert(3) */
|
||||||
#include <stdio.h> /* fprintf(3), stderr, NULL */
|
#include <stdio.h> /* fprintf(3), stderr, NULL */
|
||||||
#include <stdlib.h> /* EXIT_FAILURE, EXIT_SUCCESS */
|
#include <stdlib.h> /* EXIT_FAILURE, EXIT_SUCCESS */
|
||||||
#include <string.h> /* memset(3), strchr(3) */
|
#include <string.h> /* memset(3), strchr(3) */
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
|
|
||||||
char *program_name = "scrut";
|
char *program_name = "scrut";
|
||||||
#define OPTS "bcdefgkprsuwxLS"
|
#define OPTS "bcdefgkprsuwxLS"
|
||||||
|
/* this is an array so main:sel's size can be known at compile time */
|
||||||
static char opts[] = OPTS;
|
static char opts[] = OPTS;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -58,7 +60,10 @@ int main(int argc, char *argv[]) {
|
|||||||
memset(sel, '\0', sizeof sel);
|
memset(sel, '\0', sizeof sel);
|
||||||
for (int c; (c = getopt(argc, argv, opts)) != -1;) {
|
for (int c; (c = getopt(argc, argv, opts)) != -1;) {
|
||||||
if ((p = strchr(opts, c)) == NULL) { return usage(argv[0]); }
|
if ((p = strchr(opts, c)) == NULL) { return usage(argv[0]); }
|
||||||
else { sel[p - opts] = c; }
|
else {
|
||||||
|
assert(p - opts < sizeof sel / sizeof *sel); /* bounds check */
|
||||||
|
sel[p - opts] = c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* straighten out selections; permute out nulls */
|
/* straighten out selections; permute out nulls */
|
||||||
@@ -73,7 +78,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
if (optind == argc) { return usage(argv[0]); }
|
if (optind == argc) { return usage(argv[0]); }
|
||||||
|
|
||||||
for (argv += optind ; *argv != NULL; ++argv) {
|
for (argv += optind ; *argv != NULL; argv = &argv[1]) {
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stddef.h> /* NULL */
|
#include <stddef.h> /* NULL */
|
||||||
#include <stdio.h> /* fprintf(3), perror(2) */
|
#include <stdio.h> /* fprintf(3), perror(3) */
|
||||||
#include <stdlib.h> /* size_t, EXIT_FAILURE */
|
#include <stdlib.h> /* size_t, EXIT_FAILURE */
|
||||||
#include <string.h> /* strcmp(3) */
|
#include <string.h> /* strcmp(3) */
|
||||||
#include <sysexits.h> /* EX_OSERR, EX_USAGE */
|
#include <sysexits.h> /* EX_OSERR, EX_USAGE */
|
||||||
|
|||||||
18
src/strcmp.c
18
src/strcmp.c
@@ -16,13 +16,25 @@
|
|||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/.
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h> /* fprintf(3), stderr */
|
#include <stdio.h> /* fprintf(3), perror(3), stderr */
|
||||||
#include <sysexits.h> /* EX_OK, EX_USAGE */
|
#include <sysexits.h> /* EX_OK, EX_OSERR, EX_USAGE */
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
# include <unistd.h> /* pledge(2) */
|
||||||
|
#endif
|
||||||
|
|
||||||
char *program_name = "strcmp";
|
char *program_name = "strcmp";
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
if (pledge("stdio", NULL) == -1) {
|
||||||
|
perror(argv[0] == NULL ? program_name : argv[0]);
|
||||||
|
|
||||||
|
return EX_OSERR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
(void)fprintf(
|
(void)fprintf(
|
||||||
|
|||||||
12
src/swab.rs
12
src/swab.rs
@@ -32,6 +32,10 @@ use getopt::GetOpt;
|
|||||||
use sysexits::{ EX_IOERR, EX_OK, EX_OSERR, EX_USAGE };
|
use sysexits::{ EX_IOERR, EX_OK, EX_OSERR, EX_USAGE };
|
||||||
use strerror::StrError;
|
use strerror::StrError;
|
||||||
|
|
||||||
|
#[cfg(target_os="openbsd")] extern crate openbsd;
|
||||||
|
#[cfg(target_os="openbsd")] use openbsd::{ Promises, pledge };
|
||||||
|
|
||||||
|
|
||||||
fn oserr(argv0: &str, e: Error) -> ExitCode {
|
fn oserr(argv0: &str, e: Error) -> ExitCode {
|
||||||
eprintln!("{}: {}", argv0, e.strerror());
|
eprintln!("{}: {}", argv0, e.strerror());
|
||||||
ExitCode::from(EX_OSERR as u8)
|
ExitCode::from(EX_OSERR as u8)
|
||||||
@@ -49,6 +53,14 @@ fn usage(s: &str) -> ExitCode {
|
|||||||
|
|
||||||
fn main() -> ExitCode {
|
fn main() -> ExitCode {
|
||||||
let argv = args().collect::<Vec<String>>();
|
let argv = args().collect::<Vec<String>>();
|
||||||
|
|
||||||
|
if cfg!(target_os="openbsd") {
|
||||||
|
let promises = Promises::new("stdio");
|
||||||
|
if let Err(e) = pledge(Some(promises), None) {
|
||||||
|
return oserr(&argv[0], e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut buf: Vec<u8> = Vec::new(); // holds the sequence getting swabbed
|
let mut buf: Vec<u8> = Vec::new(); // holds the sequence getting swabbed
|
||||||
let mut input = stdin();
|
let mut input = stdin();
|
||||||
let mut output = stdout().lock();
|
let mut output = stdout().lock();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023–2024 Emma Tebibyte <emma@tebibyte.media>
|
* Copyright (c) 2023–2024 Emma Tebibyte <emma@tebibyte.media>
|
||||||
|
* Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||||
* SPDX-License-Identifier: CC0
|
* SPDX-License-Identifier: CC0
|
||||||
*
|
*
|
||||||
* This work is marked with CC0 1.0. To view a copy of this license, visit
|
* This work is marked with CC0 1.0. To view a copy of this license, visit
|
||||||
@@ -10,7 +11,7 @@
|
|||||||
# include <unistd.h> /* pledge(2) */
|
# include <unistd.h> /* pledge(2) */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main() {
|
int main(void) {
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
pledge(NULL, NULL);
|
pledge(NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2024 E$(NAME)a Tebibyte <e$(NAME)a@tebibyte.media>
|
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||||
# SPDX-License-Identifier: FSFAP
|
# SPDX-License-Identifier: FSFAP
|
||||||
#
|
#
|
||||||
# Copying and distribution of this file, with or without modification, are
|
# Copying and distribution of this file, with or without modification, are
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
# notice are preserved. This file is offered as-is, without any warranty.
|
# notice are preserved. This file is offered as-is, without any warranty.
|
||||||
|
|
||||||
.PHONY: mm_tests
|
.PHONY: mm_tests
|
||||||
mm_tests: mm_args mm_help mm_stderr
|
mm_tests: mm_args mm_help mm_stderr mm_remaining
|
||||||
|
|
||||||
.PHONY: mm_none
|
.PHONY: mm_none
|
||||||
mm_none: $(BIN)/mm
|
mm_none: $(BIN)/mm
|
||||||
@@ -25,3 +25,10 @@ mm_help: $(BIN)/mm
|
|||||||
# check if stderr is empty upon specifying -e
|
# check if stderr is empty upon specifying -e
|
||||||
mm_stderr: $(BIN)/mm
|
mm_stderr: $(BIN)/mm
|
||||||
test "$$(printf 'test\n' | $(BIN)/mm -e 2>&1 >/dev/null )" = "test"
|
test "$$(printf 'test\n' | $(BIN)/mm -e 2>&1 >/dev/null )" = "test"
|
||||||
|
|
||||||
|
.PHONY: mm_remaining
|
||||||
|
# check to make sure remaining arguments are used
|
||||||
|
mm_remaining: $(BIN)/mm
|
||||||
|
test "$$($(BIN)/mm -i README COPYING)" = "$$(cat README COPYING)"
|
||||||
|
$(BIN)/mm -i README -o /tmp/mm_test0 /tmp/mm_test1
|
||||||
|
diff /tmp/mm_test0 /tmp/mm_test1
|
||||||
|
|||||||
Reference in New Issue
Block a user