dtksh: HACKY fix for compilation on later linux C library where FILE definition has...
authorPeter Howkins <flibble@users.sf.net>
Fri, 23 Mar 2018 01:51:39 +0000 (01:51 +0000)
committerPeter Howkins <flibble@users.sf.net>
Fri, 23 Mar 2018 01:51:39 +0000 (01:51 +0000)
12 files changed:
cde/programs/dtksh/ksh93/src/cmd/ksh93/sh/init.c
cde/programs/dtksh/ksh93/src/cmd/ksh93/sh/macro.c
cde/programs/dtksh/ksh93/src/lib/libast/include/ast.h
cde/programs/dtksh/ksh93/src/lib/libast/include/sfio.h
cde/programs/dtksh/ksh93/src/lib/libast/include/stdio.h
cde/programs/dtksh/ksh93/src/lib/libast/string/fmtfs.c
cde/programs/dtksh/ksh93/src/lib/libast/string/fmtgid.c
cde/programs/dtksh/ksh93/src/lib/libast/string/fmtuid.c
cde/programs/dtksh/ksh93/src/lib/libast/string/strgid.c
cde/programs/dtksh/ksh93/src/lib/libast/string/strmatch.c
cde/programs/dtksh/ksh93/src/lib/libast/string/struid.c
cde/programs/dtksh/ksh93/src/lib/libcmd/id.c

index 43b6fe386269be3ce4cb70fa1ed7334097e81e49..23b3922449432ecddecee9785cb807255a54011d 100644 (file)
 #include       "national.h"
 
 #if _hdr_wchar && _lib_wctype && _lib_iswctype
+/* on linux wchar.h can include FILE without stdio.h which clashes with sfio_t */
+#if defined(linux)
+ #ifndef __FILE_defined
+  #define __FILE_defined 1
+ #endif
+#endif
 #   include <wchar.h>
 #   undef  isalpha
 #   define isalpha(x)      iswalpha(x)
index 85b94fc525b7d1842f6a96b38faf580c4a38800a..c07b9108320c795f93311e7a5bf7904553a73bbe 100644 (file)
 #endif
 #include       "defs.h"
 #include       <fcin.h>
+/* on linux pwd.h can include FILE without stdio.h which clashes with sfio_t */
+#if defined(linux)
+ #ifndef __FILE_defined
+  #define __FILE_defined 1
+ #endif
+#endif
 #include       <pwd.h>
 #include       "name.h"
 #include       "variables.h"
index ffe0b39ce4b30ea3a01da99a49024d79542e0734..22496520fc7f0af28e8123589a9073eed97690f6 100644 (file)
  * workaround botched headers that assume <stdio.h>
  */
 
-#if defined(linux)
-#ifndef __FILE
-#define __FILE FILE
-#endif
-#endif
-
-#if !defined(CSRG_BASED)
+#if !defined(CSRG_BASED) && !defined(linux)
 #ifndef FILE
 #define FILE   Sfio_t
 #endif
index 5394d1068868bfea416add7934ed9744f7572032..05703d4e411513cfdc349afa6b60663a281ed3df 100644 (file)
 #define _STDIO_INCLUDED        1
 #endif
 
-#if !defined(CSRG_BASED)
+#if !defined(CSRG_BASED) && !defined(linux)
 #ifndef FILE
 #define FILE   Sfio_t
 #endif
 #endif
 
 typedef struct _sfio_  Sfile_t, Sfio_t, SFIO;
+#if defined(linux)
+typedef struct _sfio_  FILE;
+#endif
 typedef struct _sfdc_  Sfdisc_t;
 typedef int            (*Sfread_f)_ARG_((Sfio_t*, Void_t*, int, Sfdisc_t*));
 typedef int            (*Sfwrite_f)_ARG_((Sfio_t*, const Void_t*, int, Sfdisc_t*));
index 32e2e206c544a9051dc22f7194247d7aaf6515da..aed9be83b32ca61fae19e125abbd966e89cc762b 100644 (file)
 #define stdout         sfstdout
 #define stderr         sfstderr
 #define BUFSIZ         SF_BUFSIZE
+#if !defined(linux)
 #ifdef FILE
 #undef FILE
 #endif
 #define FILE           Sfio_t
+#endif
 
 #include       <sfio.h>
 
index 2b265dc68bb3463bb6939a77256761fe0c3d5bb8..968c9721f084bf8635dec17cf31d824044aeee86 100644 (file)
@@ -120,6 +120,12 @@ __STDPP__directive pragma pp:hide endmntent getmntent
 #define getmntent      ______getmntent
 #endif
 
+/* on linux mntent.h can include FILE without stdio.h which clashes with sfio_t */
+#if defined(linux)
+ #ifndef __FILE_defined
+  #define __FILE_defined 1
+ #endif
+#endif
 #include <mntent.h>
 
 #if defined(__STDPP__directive) && defined(__STDPP__hide)
index 6492401decbf03b1cd98e5424a9fb096f1936079..93f4d48d12699062a63a861e0f225c33e2236e04 100644 (file)
@@ -98,6 +98,12 @@ __STDPP__directive pragma pp:hide getgrgid
 
 #include <ast.h>
 #include <hash.h>
+/* on linux grp.h can include FILE without stdio.h which clashes with sfio_t */
+#if defined(linux)
+ #ifndef __FILE_defined
+  #define __FILE_defined 1
+ #endif
+#endif
 #include <grp.h>
 
 #if defined(__STDPP__directive) && defined(__STDPP__hide)
index 20f45477262363c795894d4c5c938707c7b1a2ea..36ae33c677d3872ce326960c2b2acc1891e788cb 100644 (file)
@@ -98,6 +98,12 @@ __STDPP__directive pragma pp:hide getpwuid
 
 #include <ast.h>
 #include <hash.h>
+/* on linux pwd.h can include FILE without stdio.h which clashes with sfio_t */
+#if defined(linux)
+ #ifndef __FILE_defined
+  #define __FILE_defined 1
+ #endif
+#endif
 #include <pwd.h>
 
 #if defined(__STDPP__directive) && defined(__STDPP__hide)
index 275139350a017fb0e24877eb7e5cecd2ffa700e3..29d26488045fb1b562f8587f0eb3fea55cefb8a9 100644 (file)
@@ -100,6 +100,12 @@ __STDPP__directive pragma pp:hide getgrgid getgrnam getpwnam
 
 #include <ast.h>
 #include <hash.h>
+/* on linux pwd.h and grp.h can include FILE without stdio.h which clashes with sfio_t */
+#if defined(linux)
+ #ifndef __FILE_defined
+  #define __FILE_defined 1
+ #endif
+#endif
 #include <pwd.h>
 #include <grp.h>
 
index ceb679b1644c0ee3fe00a1c53466f337132deb37..e113c68763a899901a886bb90843f5e0b8d6de04 100644 (file)
 
 #if _hdr_wchar && _lib_wctype && _lib_iswctype
 
+/* on linux wchar.h can include FILE without stdio.h which clashes with sfio_t */
+#if defined(linux)
+ #ifndef __FILE_defined
+  #define __FILE_defined 1
+ #endif
+#endif
 #include <wchar.h>
 
 #undef isalnum
index a4b5c543386b9d4444abda71f170bd403b1d03d9..2bbfd5b8080f501601280d0e096210f33b3e30ca 100644 (file)
@@ -99,6 +99,12 @@ __STDPP__directive pragma pp:hide getpwnam getpwuid
 
 #include <ast.h>
 #include <hash.h>
+/* on linux pwd.h can include FILE without stdio.h which clashes with sfio_t */
+#if defined(linux)
+ #ifndef __FILE_defined
+  #define __FILE_defined 1
+ #endif
+#endif
 #include <pwd.h>
 
 #if defined(__STDPP__directive) && defined(__STDPP__hide)
index 1f89259d9437bde2078e4ba5f8e0d4c767555c90..3f296133f23cfb8adb3c7c7482294827833280be 100644 (file)
@@ -96,6 +96,12 @@ static const char id[] = "\n@(#)id (AT&T Bell Laboratories) 07/17/94\0\n";
 
 #include "FEATURE/ids"
 
+/* on linux grp.h pwd.h can include FILE without stdio.h which clashes with sfio_t */
+#if defined(linux)
+ #ifndef __FILE_defined
+  #define __FILE_defined 1
+ #endif
+#endif
 #include <grp.h>
 #include <pwd.h>