BSD Sysexits for Zig
Files
README.md

SysExits for Zig #

Support me on Ko-Fi <3

This library provides the SysExit constants from BSD sysexits.h

If you're enjoying this library, please consider donating. Your donation will allow me to:

  • improve the Linux VR ecosystem and software support
  • keep this software up-to-date and secure
  • continue developing high-quality software

Add to your project #

Add the package to your build.zig.zon:

zig fetch --save git+https://tangled.org/did:plc:ees4lejcv6zjj3lz3ctj3djs

Import the package in your build.zig:

const sysexits = b.dependency("sysexits", .{}).module("sysexits");

exe.root_module.addImport("sysexits", sysexits);

Usage #

Use the constants provided by this library:

const sysexits = @import("sysexits");

pub fn main() !u8 {
    // Oh no, the command was used incorrectly!
    return sysexits.usage;

    // Yay, everything worked correctly!
    return sysexits.ok;
}

Or with std.process.exit():

const std = @import("std");
const sysexits = @import("sysexits");

pub fn main() !void {
    // Oh no, the command was used incorrectly!
    std.process.exit(sysexits.usage);

    // Yay, everything worked correctly!
    std.process.exit(sysexits.ok);
}