Ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5ad0e4688e963d9de019557c78feed9)
strerror.c
Go to the documentation of this file.
1/* public domain rewrite of strerror(3) */
2
3#include "ruby/missing.h"
4
5extern int sys_nerr;
6extern char *sys_errlist[];
7
8static char msg[50];
9
10char *
12{
13 if (error <= sys_nerr && error > 0) {
14 return sys_errlist[error];
15 }
16 snprintf(msg, sizeof(msg), "Unknown error (%d)", error);
17 return msg;
18}
const rb_iseq_t const char * error
int snprintf(char *__restrict__, size_t, const char *__restrict__,...) __attribute__((__format__(__printf__
char * strerror(int error)
Definition: strerror.c:11
char * sys_errlist[]
int sys_nerr