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
1 changed files with 4 additions and 12 deletions

16
shf.c
View File

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