--- src/ls.c.orig	Sat Sep 19 13:09:23 1998
+++ src/ls.c	Sat Aug 25 08:47:24 2001
@@ -42,6 +42,7 @@
 
 #include <config.h>
 #include <sys/types.h>
+#include <sys/acl.h>
 
 #if HAVE_INTTYPES_H
 # include <inttypes.h>
@@ -100,6 +101,7 @@
   {
     /* The file name. */
     char *name;
+    char *dirname;
 
     struct stat stat;
 
@@ -1704,12 +1706,15 @@
     {
       /* `path' is the absolute pathname of this file. */
 
-      if (name[0] == '/' || dirname[0] == 0)
-	path = (char *) name;
+      if (name[0] == '/' || dirname[0] == 0) {
+	  path = (char *) name;
+	  files[files_index].dirname = xstrdup("");
+	}
       else
 	{
 	  path = (char *) alloca (strlen (name) + strlen (dirname) + 2);
 	  attach (path, dirname, name);
+	  files[files_index].dirname = xstrdup(dirname);
 	}
 
       if (trace_links)
@@ -2166,13 +2171,41 @@
     }
 }
 
+int
+has_acl(const struct fileinfo *f)
+{
+  acl_entry_t entry;
+  acl_t acl;
+  char filename[MAXPATHLEN];
+  int count, entry_id;
+
+  count = 0;
+
+  if (strlen(f->dirname))
+    snprintf(filename, sizeof(filename), "%s/", f->dirname);
+  strlcat(filename, f->name, sizeof(filename));
+  if ((acl = acl_get_file(filename, ACL_TYPE_ACCESS)) != NULL) {
+    entry_id = ACL_FIRST_ENTRY;
+    /* count the number of ACLs entries set on the file */
+    while (count < 4 && acl_get_entry(acl, entry_id, &entry) == 1) {
+      entry_id = ACL_NEXT_ENTRY;
+      count++;
+    }
+    acl_free(acl);
+  } else
+    /* reset errno if an ACL cannot be obtained */
+    errno = 0;
+
+  return (count > 3 ? 1 : 0);
+}
+
 static void
 print_long_format (const struct fileinfo *f)
 {
-  char modebuf[11];
+  char modebuf[12];
 
   /* 7 fields that may require LONGEST_HUMAN_READABLE bytes,
-     1 10-byte mode string,
+     1 11-byte mode string,
      1 24-byte time string (may be longer in some locales -- see below)
        or LONGEST_HUMAN_READABLE integer,
      9 spaces, one following each of these fields, and
@@ -2196,7 +2229,12 @@
   mode_string (f->stat.st_mode, modebuf);
 #endif
 
-  modebuf[10] = '\0';
+  if (has_acl(f))
+    modebuf[10] = '+';
+  else
+    modebuf[10] = ' ';
+
+  modebuf[11] = '\0';
 
   switch (time_type)
     {
