fop(1), hru(1), intcmp(1), mm(1), rpn(1), swab(1): fixes conditional compilation

This commit is contained in:
Emma Tebibyte 2024-08-17 01:51:25 -06:00
parent e2c03842a3
commit 821f5d09e9
Signed by: emma
GPG Key ID: 06FA419A1698C270
6 changed files with 9 additions and 9 deletions

View File

@ -39,7 +39,7 @@ fn main() {
let mut d = '\u{1E}'.to_string(); /* ASCII record separator */ let mut d = '\u{1E}'.to_string(); /* ASCII record separator */
let mut optind = 1; let mut optind = 1;
if cfg!(target_os="openbsd") { #[cfg(target_os="openbsd")] {
let promises = Promises::new("stdio proc exec"); let promises = Promises::new("stdio proc exec");
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());

View File

@ -86,7 +86,7 @@ fn main() -> ExitCode {
return ExitCode::from(EX_USAGE as u8); return ExitCode::from(EX_USAGE as u8);
} }
if cfg!(target_os="openbsd") { #[cfg(target_os="openbsd")] {
let promises = Promises::new("stdio"); let promises = Promises::new("stdio");
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());

View File

@ -42,7 +42,7 @@ 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") { #[cfg(target_os="openbsd")] {
let promises = Promises::new("stdio"); let promises = Promises::new("stdio");
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());

View File

@ -51,7 +51,7 @@ fn main() -> ExitCode {
let argv = args().collect::<Vec<_>>(); let argv = args().collect::<Vec<_>>();
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") { #[cfg(target_os="openbsd")] {
let promises = Promises::new("rpath stdio unveil"); let promises = Promises::new("rpath stdio unveil");
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());
@ -77,7 +77,7 @@ fn main() -> ExitCode {
Ok("i") => { /* add inputs */ Ok("i") => { /* add inputs */
let input = opt.arg().unwrap(); let input = opt.arg().unwrap();
if cfg!(target_os="openbsd") { #[cfg(target_os="openbsd")] {
let perms = UnveilPerms::new(vec!['r']); let perms = UnveilPerms::new(vec!['r']);
if let Err(e) = unveil(Some(&input), Some(perms)) { if let Err(e) = unveil(Some(&input), Some(perms)) {
eprintln!("{}: {}", argv[0], e.strerror()); eprintln!("{}: {}", argv[0], e.strerror());
@ -91,7 +91,7 @@ fn main() -> ExitCode {
Ok("o") => { /* add output */ Ok("o") => { /* add output */
let output = opt.arg().unwrap(); let output = opt.arg().unwrap();
if cfg!(target_os="openbsd") { #[cfg(target_os="openbsd")] {
let perms = UnveilPerms::new(vec!['w', 'c']); let perms = UnveilPerms::new(vec!['w', 'c']);
if let Err(e) = unveil(Some(&output), Some(perms)) { if let Err(e) = unveil(Some(&output), Some(perms)) {
eprintln!("{}: {}", argv[0], e.strerror()); eprintln!("{}: {}", argv[0], e.strerror());
@ -124,7 +124,7 @@ fn main() -> ExitCode {
} }
} }
if cfg!(target_os="openbsd") { #[cfg(target_os="openbsd")] {
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);

View File

@ -198,7 +198,7 @@ fn round_precise(value: &f64, precision: usize) -> f64 {
fn main() -> ExitCode { fn main() -> ExitCode {
let argv = args().collect::<Vec<String>>(); let argv = args().collect::<Vec<String>>();
if cfg!(target_os="openbsd") { #[cfg(target_os="openbsd")] {
let promises = Promises::new("stdio"); let promises = Promises::new("stdio");
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());

View File

@ -54,7 +54,7 @@ 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") { #[cfg(target_os="openbsd")] {
let promises = Promises::new("stdio"); let promises = Promises::new("stdio");
if let Err(e) = pledge(Some(promises), None) { if let Err(e) = pledge(Some(promises), None) {
return oserr(&argv[0], e); return oserr(&argv[0], e);