bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AIX patches for coreutils 4.5.7


From: Petter Reinholdtsen
Subject: AIX patches for coreutils 4.5.7
Date: Wed, 19 Feb 2003 12:02:22 +0100

To get coreutils 4.5.7 to compile on AIX, I needed a few changes.

The first change is needed because the native AIX compiler require
bitfield varialbes to be 'int', 'unsigned int' or 'unsigned int'.  AIX
do not have <stdbool.h>, so the code end up with something equvalent
to this:

  typedef enum {false = 0, true = 1} bool;
  struct foo {  bool paren : 1; };

This is not legal C.  The C standard section 6.5.2.1 (Structure and
union specifiers), subsection 8 reads "A bit-field shall have a type
that is a qualified or unqualified version of *signed int* or
*unsigned int*."

The second change is because STAT is already defined in a system
header file (<sys/dir.h>) on AIX.


diff -ur src-4.5.7/src/fmt.c src-4.5.7-local/src/fmt.c
--- src-4.5.7/src/fmt.c 2002-12-15 15:21:45.000000000 +0100
+++ src-4.5.7-local/src/fmt.c   2003-02-18 18:04:01.000000000 +0100
@@ -134,10 +134,10 @@
     const char *text;          /* the text of the word */
     int length;                        /* length of this word */
     int space;                 /* the size of the following space */
-    bool paren:1;              /* starts with open paren */
-    bool period:1;             /* ends in [.?!])* */
-    bool punct:1;              /* ends in punctuation */
-    bool final:1;              /* end of sentence */
+    unsigned int paren:1;      /* starts with open paren */
+    unsigned int period:1;     /* ends in [.?!])* */
+    unsigned int punct:1;      /* ends in punctuation */
+    unsigned int final:1;      /* end of sentence */
 
     /* The remaining fields are computed during the optimization.  */
 
diff -ur src-4.5.7/lib/ftw.c src-4.5.7-local/lib/ftw.c
--- src-4.5.7/lib/ftw.c 2003-02-08 19:18:20.000000000 +0100
+++ src-4.5.7-local/lib/ftw.c   2003-02-18 17:26:23.000000000 +0100
@@ -136,7 +136,8 @@
 # define FTW_NAME ftw
 # define NFTW_NAME nftw
 # define INO_T ino_t
-# define STAT stat
+/* Can't use STAT, as it is defined in /usr/include/sys/dir.h on AIX. */
+# define CU_STAT stat
 # ifdef _LIBC
 #  define LXSTAT __lxstat
 #  define XSTAT __xstat
@@ -217,7 +218,7 @@
 
 
 /* Forward declarations of local functions.  */
-static int ftw_dir (struct ftw_data *data, struct STAT *st) internal_function;
+static int ftw_dir (struct ftw_data *data, struct CU_STAT *st) 
internal_function;
 
 
 static int
@@ -236,7 +237,7 @@
 
 
 static inline int
-add_object (struct ftw_data *data, struct STAT *st)
+add_object (struct ftw_data *data, struct CU_STAT *st)
 {
   struct known_object *newp = malloc (sizeof (struct known_object));
   if (newp == NULL)
@@ -248,7 +249,7 @@
 
 
 static inline int
-find_object (struct ftw_data *data, struct STAT *st)
+find_object (struct ftw_data *data, struct CU_STAT *st)
 {
   struct known_object obj;
   obj.dev = st->st_dev;
@@ -352,7 +353,7 @@
 process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
               size_t namlen)
 {
-  struct STAT st;
+  struct CU_STAT st;
   int result = 0;
   int flag = 0;
   size_t new_buflen;
@@ -464,7 +465,7 @@
 
 static int
 internal_function
-ftw_dir (struct ftw_data *data, struct STAT *st)
+ftw_dir (struct ftw_data *data, struct CU_STAT *st)
 {
   struct dir_data dir;
   struct dirent64 *d;
@@ -638,7 +639,7 @@
             int flags)
 {
   struct ftw_data data;
-  struct STAT st;
+  struct CU_STAT st;
   int result = 0;
   int save_err;
   char *cwd = NULL;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]