clean up ifdefs; some errnos are mandatory anyway; add one of those

This commit is contained in:
tg 2015-10-09 15:38:36 +00:00
parent 59e7366036
commit e32f7d933b

16
shf.c
View File

@ -3,7 +3,7 @@
/*- /*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011,
* 2012, 2013, 2015 * 2012, 2013, 2015
* mirabilos <tg@mirbsd.org> * mirabilos <m@mirbsd.org>
* *
* Provided that these terms and disclaimer and all copyright notices * Provided that these terms and disclaimer and all copyright notices
* are retained or reproduced in an accompanying document, permission * are retained or reproduced in an accompanying document, permission
@ -25,7 +25,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.67 2015/09/05 19:19:11 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/shf.c,v 1.68 2015/10/09 15:38:36 tg Exp $");
/* flags to shf_emptybuf() */ /* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */ #define EB_READSW 0x01 /* about to switch to reading */
@ -1099,14 +1099,10 @@ cstrerror(int errnum)
switch (errnum) { switch (errnum) {
case 0: case 0:
return ("Undefined error: 0"); return ("Undefined error: 0");
#ifdef EPERM
case EPERM: case EPERM:
return ("Operation not permitted"); return ("Operation not permitted");
#endif
#ifdef ENOENT
case ENOENT: case ENOENT:
return ("No such file or directory"); return ("No such file or directory");
#endif
#ifdef ESRCH #ifdef ESRCH
case ESRCH: case ESRCH:
return ("No such process"); return ("No such process");
@ -1115,22 +1111,18 @@ cstrerror(int errnum)
case E2BIG: case E2BIG:
return ("Argument list too long"); return ("Argument list too long");
#endif #endif
#ifdef ENOEXEC
case ENOEXEC: case ENOEXEC:
return ("Exec format error"); return ("Exec format error");
#endif case EBADF:
return ("Bad file descriptor");
#ifdef ENOMEM #ifdef ENOMEM
case ENOMEM: case ENOMEM:
return ("Cannot allocate memory"); return ("Cannot allocate memory");
#endif #endif
#ifdef EACCES
case EACCES: case EACCES:
return ("Permission denied"); return ("Permission denied");
#endif
#ifdef ENOTDIR
case ENOTDIR: case ENOTDIR:
return ("Not a directory"); return ("Not a directory");
#endif
#ifdef EINVAL #ifdef EINVAL
case EINVAL: case EINVAL:
return ("Invalid argument"); return ("Invalid argument");