BSD Sysexits for Zig

feat: more explicit values

matrixfurry.com 4699dacf 1c0e3c42

verified
+15 -15
+15 -15
src/root.zig
··· 20 20 21 21 /// The command was used incorrectly (e.g. wrong number of arguments, 22 22 /// bad flag, bad syntax in a parameter, etc). 23 - pub const usage: u8 = metadata.base; 23 + pub const usage: u8 = 64; 24 24 25 25 /// The input data was incorrect in some way. This should only be used 26 26 /// for user's data and not system files (which should use `os_file` 27 27 /// instead). 28 - pub const data_err: u8 = metadata.base + 1; 28 + pub const data_err: u8 = 65; 29 29 30 30 /// An input file (not a system file, use `os_file` for that) did not 31 31 /// exist or was not readable. 32 - pub const no_input: u8 = metadata.base + 2; 32 + pub const no_input: u8 = 66; 33 33 34 34 /// The user specified did not exist. 35 - pub const no_user: u8 = metadata.base + 3; 35 + pub const no_user: u8 = 67; 36 36 37 37 /// The host specified did not exist. This is used in network requests. 38 - pub const no_host: u8 = metadata.base + 4; 38 + pub const no_host: u8 = 68; 39 39 40 40 /// A service is unavailable. This can occur if a support program or 41 41 /// file does not exist. This can also be used as a catchall message 42 42 /// when something you wanted to do doesn't work, but you don't know 43 43 /// why. 44 - pub const unavailable: u8 = metadata.base + 5; 44 + pub const unavailable: u8 = 69; 45 45 46 46 /// An internal software error has been detected. This should be limited 47 47 /// to non-operating system related errors if possible. 48 - pub const software: u8 = metadata.base + 6; 48 + pub const software: u8 = 70; 49 49 50 50 /// An operating system error has been detected. This is intended to be 51 51 /// used for such things as "cannot fork", "cannot create pipe", etc. 52 - pub const os_err: u8 = metadata.base + 7; 52 + pub const os_err: u8 = 71; 53 53 54 54 /// Some system file (e.g. /etc/passwd, /var/run/utmp, etc.) does not 55 55 /// exist, cannot be opened, or has some sort of error (e.g. syntax 56 56 /// error). 57 - pub const os_file: u8 = metadata.base + 8; 57 + pub const os_file: u8 = 72; 58 58 59 59 /// A user-specified output file cannot be created. 60 - pub const cant_create: u8 = metadata.base + 9; 60 + pub const cant_create: u8 = 73; 61 61 62 62 /// An error occurred while doing I/O on some file. 63 - pub const io_err: u8 = metadata.base + 10; 63 + pub const io_err: u8 = 74; 64 64 65 65 /// Temporary failure, indicating something that is not really an error. 66 66 /// For example, if a connection could not be created and should be 67 67 /// reattempted later. 68 - pub const temp_fail: u8 = metadata.base + 11; 68 + pub const temp_fail: u8 = 75; 69 69 70 70 /// The remote system returned something illegal during a protocol 71 71 /// exchange. 72 - pub const protocol: u8 = metadata.base + 12; 72 + pub const protocol: u8 = 76; 73 73 74 74 /// You did not have sufficient permission to perform the operation. 75 75 /// This is not intended for filesystem problems, which should use 76 76 /// `no_input` or `cant_create`. but rather for higher level 77 77 /// permissions. 78 - pub const no_permission: u8 = metadata.base + 13; 78 + pub const no_permission: u8 = 77; 79 79 80 80 /// Something was found in an unconfigured or misconfigured state. 81 - pub const config: u8 = metadata.base + 14; 81 + pub const config: u8 = 78; 82 82 83 83 test "metadata matches BSD sysexits" { 84 84 try testing.expectEqual(metadata.base, 64);