GCC Wikia
Advertisement

このページを編集する際は,編集に関する方針に従ってください.[]

概要[]

引数[]

  • int errnum

実装[]

   51: /* Like strerror, but result is never a null pointer.  */
52: 
53: char *
54: xstrerror (int errnum)
55: {
56:   char *errstr;
~
   strerroを呼び出す
57: #ifdef VMS
58:   char *(*vmslib_strerror) (int,...);
59: 
   60:   /* Override any possibly-conflicting declaration from system header.  */
61:   vmslib_strerror = (char *(*) (int,...)) strerror;
   62:   /* Second argument matters iff first is EVMSERR, but it's simpler to
   63:      pass it unconditionally.  `vaxc$errno' is declared in <errno.h>
   64:      and maintained by the run-time library in parallel to `errno'.
   65:      We assume that `errnum' corresponds to the last value assigned to
   66:      errno by the run-time library, hence vaxc$errno will be relevant.  */
67:   errstr = (*vmslib_strerror) (errnum, vaxc$errno);
68: #else
69:   errstr = strerror (errnum);
70: #endif
71: 
~
   strerroがnullを返した場合は代替文字列を返す
   72:   /* If `errnum' is out of range, result might be NULL.  We'll fix that.  */
73:   if (!errstr)
74:     {
75:       sprintf (xstrerror_buf, ERRSTR_FMT, errnum);
76:       errstr = xstrerror_buf;
77:     }
~
78:   return errstr;
79: }


リンク元

Advertisement