Author Topic: Any standard on exit codes?  (Read 625 times)

Alfredo Fernández Díaz

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Any standard on exit codes?
« on: April 30, 2024, 12:54:24 am »
Hi everyone,
I am writing a few tools that can report a number of different conditions, e.g. "target file does not exist," "file can't be read," "wrong file type," "parameter out of range," etc. While well-chosen error messages are the best you can give users, when tools are to be chained, it is better to pass along different numeric return codes. Now the question is, in order to cooperate most properly, every tool must know at least the error codes of the previous one, so I wondered whether we have any kind of standard or guidelines regarding this, instead of having a plethora of necessarily arbitrary values.
Thank you in advance.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4871
  • Karma: +103/-1
    • View Profile
Re: Any standard on exit codes?
« Reply #1 on: April 30, 2024, 01:26:36 am »
The "Control Programming Guide and Reference", installed by the toolkit as cp2.inf has a detailed list of error codes, about 64K different ones including reserved.
For GCC/Libc errors, see @unixroot/usr/include/sys/errno.h