📄 errnos-tmpl.c
字号:
/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.This file is part of the GNU C Library.The GNU C Library is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.The GNU C Library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with the GNU C Library; see the file COPYING. If not, write tothe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */#include <errno.h>static char iferrno[] = "#ifdef _ERRNO_H";static char endiferrno[] = "#endif /* <errno.h> included. */";static char ifEmath[] = "#if !defined(__Emath_defined) && \ (defined(_ERRNO_H) || defined(__need_Emath))";static char endifEmath[] = "#endif /* Emath not defined and <errno.h> \included or need Emath. */";static int biggest_value = 0;static int done_ENOSYS = 0;static int done_ERANGE = 0, done_EDOM = 0;static voidDO(name, value) char *name; int value;{ int is_ERANGE = !done_ERANGE && !strcmp(name, "ERANGE"); int is_EDOM = !done_EDOM && !strcmp(name, "EDOM"); int is_Emath = is_ERANGE || is_EDOM; if (is_Emath) { puts(endiferrno); puts(ifEmath); } if (!strcmp (name, "EWOULDBLOCK")) { puts ("#define EWOULDBLOCK EAGAIN /* Translated in glibc. */"); name = "EWOULDBLOCK_sys /* Value actually returned by kernel. */"; } printf ("#define %s %d\n", name, value); if (is_Emath) { puts(endifEmath); puts(iferrno); } if (value > biggest_value) biggest_value = value; if (is_ERANGE) done_ERANGE = 1; else if (is_EDOM) done_EDOM = 1; else if (!done_ENOSYS && !strcmp(name, "ENOSYS")) done_ENOSYS = 1;}intmain(){ puts(iferrno); ERRNOS; if (!done_EDOM || !done_ERANGE) { puts(endiferrno); puts(ifEmath); if (!done_EDOM) printf("#define EDOM %d\n", ++biggest_value); if (!done_ERANGE) printf("#define ERANGE %d\n", ++biggest_value); puts(endifEmath); } if (!done_ENOSYS) printf("#define ENOSYS %d\n", ++biggest_value); puts(endiferrno); puts("#undef __need_Emath"); puts("#ifndef __Emath_defined\n#define __Emath_defined 1\n#endif"); exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -