Import readline 8.0
[deliverable/binutils-gdb.git] / readline / colors.c
index 7859f5d2bc7f4b21c62596d355e8d6692ab7ea6f..53758e0e7741401b3810d869af97e34b392be165 100644 (file)
@@ -2,7 +2,7 @@
 
    Modified by Chet Ramey for Readline.
 
-   Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012, 2015
+   Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012, 2015, 2017
    Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
 #include "posixstat.h" // stat related macros (S_ISREG, ...)
 #include <fcntl.h> // S_ISUID
 
+#ifndef S_ISDIR
+#  define      S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
+#endif
+
 // strlen()
 #if defined (HAVE_STRING_H)
 #  include <string.h>
@@ -66,7 +70,8 @@ COLOR_EXT_TYPE *_rl_color_ext_list = 0;
 
 /* Output a color indicator (which may contain nulls).  */
 void
-_rl_put_indicator (const struct bin_str *ind) {
+_rl_put_indicator (const struct bin_str *ind)
+{
   fwrite (ind->string, ind->len, 1, rl_outstream);
 }
 
@@ -183,11 +188,17 @@ _rl_print_color_indicator (const char *f)
         {
           colored_filetype = C_FILE;
 
+#if defined (S_ISUID)
           if ((mode & S_ISUID) != 0 && is_colored (C_SETUID))
             colored_filetype = C_SETUID;
-          else if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
+          else
+#endif
+#if defined (S_ISGID)
+          if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
             colored_filetype = C_SETGID;
-          else if (is_colored (C_CAP) && 0) //f->has_capability)
+          else
+#endif
+          if (is_colored (C_CAP) && 0) //f->has_capability)
             colored_filetype = C_CAP;
           else if ((mode & S_IXUGO) != 0 && is_colored (C_EXEC))
             colored_filetype = C_EXEC;
@@ -211,12 +222,16 @@ _rl_print_color_indicator (const char *f)
             colored_filetype = C_STICKY;
 #endif
         }
+#if defined (S_ISLNK)
       else if (S_ISLNK (mode))
         colored_filetype = C_LINK;
+#endif
       else if (S_ISFIFO (mode))
         colored_filetype = C_FIFO;
+#if defined (S_ISSOCK)
       else if (S_ISSOCK (mode))
         colored_filetype = C_SOCK;
+#endif
       else if (S_ISBLK (mode))
         colored_filetype = C_BLK;
       else if (S_ISCHR (mode))
This page took 0.024808 seconds and 4 git commands to generate.