jstrerro.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 132 行

C
132
字号
/****************************************************************************
*
*                            Open Watcom Project
*
*    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
*  ========================================================================
*
*    This file contains Original Code and/or Modifications of Original
*    Code as defined in and that are subject to the Sybase Open Watcom
*    Public License version 1.0 (the 'License'). You may not use this file
*    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
*    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
*    provided with the Original Code and Modifications, and is also
*    available at www.sybase.com/developer/opensource.
*
*    The Original Code and all software distributed under the License are
*    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
*    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
*    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
*    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
*    NON-INFRINGEMENT. Please see the License for the specific language
*    governing rights and limitations under the License.
*
*  ========================================================================
*
* Description:  WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
*               DESCRIBE IT HERE!
*
****************************************************************************/


#include "variety.h"
#include <jstring.h>
#include <stdio.h>
#include <stdlib.h>

/**
*
*  Name:        jstrerror -- 僄儔乕儊僢僙乕僕偺昞帵
*
*  Synopsis:    string = jstrerror( errnum );
*
*               unsigned char *string;  僄儔乕儊僢僙乕僕傊偺億僀儞僞
*               int errnum;             ( errno 偵懳墳偡傞)僄儔乕斣崋
*
*  Description: 偙偺娭悢偼 errno 偵擖偭偰偄傞僄儔乕僐乕僪懳墳偡傞
*               僄儔乕儊僢僙乕僕傊偺億僀儞僞傪曉偡丅
*
*
*  Name:        jstrerror -- print error message
*
*  Synopsis:    string = jstrerror( errnum );
*
*               unsigned char *string;  pointer to error message
*               int errnum;             error number (corresponds to errno)
*
*  Description: This function returns a pointer to an error
*               message corresponding to the error code in errno.
*
**/


unsigned char *jsys_errlist[] = {
/* 0    EZERO           *///"No error",
                            "奩摉偡傞僄儔乕僐乕僪偑偁傝傑偣傫",
/* 1    ENOENT          *///"No such file or directory",
                            "偙偺傛偆側僼傽僀儖傑偨偼僨傿儗僋僩儕偼偁傝傑偣傫",
/* 2    E2BIG           *///"Arg list too big",
                            "堷悢儕僗僩偑挿偡偓傑偡",
/* 3    ENOEXEC         *///"Exec format error",
                            "幚峴宍幃僄儔乕偱偡",
/* 4    EBADF           *///"Bad file number",
                            "僼傽僀儖斣崋偑晄揔摉偱偡",
/* 5    ENOMEM          *///"Not enough memory",
                            "儊儌儕偑晄懌偱偡",
/* 6    EACCES          *///"Permission denied",
                            "傾僋僙僗偑嬛巭偝傟偰偄傑偡",
/* 7    EEXIST          *///"File exists",
                            "僼傽僀儖偑偡偱偵懚嵼偟傑偡",
/* 8    EXDEV           *///"Cross-device link",
                            "儕儞僋偑僨僶僀僗傪傑偨偑偭偰偄傑偡",
/* 9    EINVAL          *///"Invalid argument",
                            "堷悢偑娫堘偭偰偄傑偡",
/* 10   ENFILE          *///"File table overflow",
                            "偙傟埲忋僼傽僀儖傪僆乕僾儞偱偒傑偣傫",
/* 11   EMFILE          *///"Too many open files",
                            "偙偺僾儘僙僗偱偼偙傟埲忋僼傽僀儖傪僆乕僾儞偱偒傑偣傫",
/* 12   ENOSPC          *///"No space left on device",
                            "僨僶僀僗偵梋抧偑偁傝傑偣傫",
/* 13   EDOM            *///"Argument too large",
                            "悢抣墘嶼娭悢偺堷悢偑僄儔乕偱偡",
/* 14   ERANGE          *///"Result too large",
                            "悢抣墘嶼娭悢偺寢壥偑斖埻傪墇偊偰偄傑偡",
/* 15   EDEADLK         */  "Resource deadlock would occur",
/* 16   EINTR           */  "System call interrupted",
/* 17   ECHILD          */  "Child does not exist",
/* 18   EAGAIN          */  "Resource unavailable, try again",
/* 19   EBUSY           */  "Device or resource busy",
/* 20   EFBIG           */  "File too large",
/* 21   EIO             */  "I/O error",
/* 22   EISDIR          */  "Is a directory",
/* 23   ENOTDIR         */  "Not a directory",
/* 24   EMLINK          */  "Too many links",
/* 25   ENOTBLK         */  "Block device required",
/* 26   ENOTTY          */  "Not a character device",
/* 27   ENXIO           */  "No such device or address",
/* 28   EPERM           */  "Not owner",
/* 29   EPIPE           */  "Broken pipe",
/* 30   EROFS           */  "Read-only file system",
/* 31   ESPIPE          */  "Illegal seek",
/* 32   ESRCH           */  "No such process",
/* 33   ETXTBSY         */  "Text file busy",
/* 34   EFAULT          */  "Bad address",
/* 35   ENAMETOOLONG    */  "Filename too long",
/* 36   ENODEV          */  "No such device",
/* 37   ENOLCK          */  "No locks available in system",
/* 38   ENOSYS          */  "Unknown system call",
/* 39   ENOTEMPTY       */  "Directory not empty",
/* 40   EILSEQ          */  "Illegal multibyte sequence"
};

int jsys_nerr = 40;

_WCRTLINK unsigned char *jstrerror( int errnum )
{
    if( errnum < 0 || errnum > jsys_nerr ) {
        errnum = 0;
    }
    return( jsys_errlist[errnum] );
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?