Function returning "ENOTDIR", "EBUSY", etc. How are the lines?

Function

strerror () returns a short description of the error, given the error number as an argument. For example, if the argument is ENOTDIR, it will return “Not directory”, if the argument is EBUSY, it will return “Device or resource busy”, etc.

But is there a function returning "ENOTDIR" for the argument is equal to ENOTDIR, "EBUSY" for the argument EBUSY, etc.?

I just want to avoid writing a huge switch statement for this purpose.

+4
source share
2 answers

, , , . , , , script for, -, ( ) . , OS X, . A script, , , , .

+2

- , .

- switch, . errno , .

.

, , , , , , . GNU/Linux errno :

/usr/include/asm-generic/errno-base.h
/usr/include/asm-generic/errno.h

#define errno . . , , switch.

, ​​ , .

+3

Source: https://habr.com/ru/post/1654510/


All Articles