add exit description array

This commit is contained in:
Diego Fernando Carrión 2022-11-01 12:51:26 +01:00
parent a3e02f6243
commit c824df3cb2
No known key found for this signature in database
GPG Key ID: 811EF2E03998BFC4

View File

@ -28,3 +28,33 @@ const (
EX_ABORT ExitT = 134
)
var exitDescs = [^ExitT(0)]string{}
func init() {
exitDescs[EX_OK] = "successful termination"
exitDescs[EX_USAGE] = "command line usage error"
exitDescs[EX_DATAERR] = "data format error"
exitDescs[EX_NOINPUT] = "cannot open input"
exitDescs[EX_NOUSER] = "addressee unknown"
exitDescs[EX_NOHOST] = "host name unknown"
exitDescs[EX_UNAVAILABLE] = "service unavailable"
exitDescs[EX_SOFTWARE] = "internal software error"
exitDescs[EX_OSERR] = "system error" // e.g. can't fork
exitDescs[EX_OSFILE] = "critical OS file missing"
exitDescs[EX_CANTCREAT] = "can't create (user) output file"
exitDescs[EX_IOERR] = "input/output error"
exitDescs[EX_TEMPFAIL] = "temp failure; user is invited to retry"
exitDescs[EX_PROTOCOL] = "remote error in protocol"
exitDescs[EX_NOPERM] = "permission denied"
exitDescs[EX_CONFIG] = "configuration error"
exitDescs[EX_ABORT] = "process aborted"
}
func (e ExitT) Desc() string {
return exitDescs[e]
}
func GetAllExitCodeDescriptions() [^ExitT(0)]string {
return exitDescs
}