[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-readline] Fwd: [PATCH] readline: rltty.c: Declare ioctl() expli
From: |
Chen Gang |
Subject: |
Re: [Bug-readline] Fwd: [PATCH] readline: rltty.c: Declare ioctl() explicitly. |
Date: |
Wed, 22 Apr 2015 03:38:22 +0800 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 4/20/15 08:06, Chet Ramey wrote:
> On 4/19/15 1:46 PM, Chen Gang wrote:
>>
>> Under Darwin, ioctl() is declared in "sys/ioctl.h", but except for some
>> special control commands, we do not want to include "sys/ioctl.h". So
>> declare it explicitly, the related warning:
>
> I suppose I could add that for Darwin/Mac OS X, but the supplied
> declaration is not correct for all systems (e.g., Solaris 10, HP-UX,
> AIX). That's why I don't declare it, and probably why autoconf doesn't
> have a test for it. Why not just include <sys/ioctl.h> there and see
> what happens?
>
Just include <sys/ioctl.h> will be OK under Darwin:
---------------------------- diff begin -------------------------------
bash-3.2# git diff
diff --git a/readline/rltty.c b/readline/rltty.c
index d237b1c..5074e1f 100644
--- a/readline/rltty.c
+++ b/readline/rltty.c
@@ -37,7 +37,7 @@
#include "rldefs.h"
-#if defined (GWINSZ_IN_SYS_IOCTL)
+#if defined (GWINSZ_IN_SYS_IOCTL) || defined (__DARWIN_C_LEVEL)
# include <sys/ioctl.h>
#endif /* GWINSZ_IN_SYS_IOCTL */
---------------------------- diff end -------------------------------
Originally, I was not sure whether it is suitable to add architecture
specific information in C source code, but at present, for me, there is
the only way for it (it is not a good way, but another ways are worse).
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed