Skip to content

Instantly share code, notes, and snippets.

@brisingraerowing
Created July 20, 2015 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brisingraerowing/7c17d678363056eaa421 to your computer and use it in GitHub Desktop.
Save brisingraerowing/7c17d678363056eaa421 to your computer and use it in GitHub Desktop.
unchanged:
--- readline-6.3-orig/colors.c 2013-03-20 11:19:08.000000000 -0400
+++ readline-6.3/colors.c 2015-07-20 12:44:31.821014500 -0400
@@ -37,6 +37,10 @@
#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>
@@ -151,12 +155,17 @@
if (S_ISREG (mode))
{
colored_filetype = C_FILE;
-
+#ifdef 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
+#ifdef 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;
@@ -180,15 +189,19 @@
colored_filetype = C_STICKY;
#endif
}
+ #ifdef S_ISLNK
else if (S_ISLNK (mode))
colored_filetype = ((linkok == 0
&& (!strncmp (_rl_color_indicator[C_LINK].string, "target", 6)
|| _rl_color_indicator[C_ORPHAN].string))
? C_ORPHAN : C_LINK);
+ #endif
else if (S_ISFIFO (mode))
colored_filetype = C_FIFO;
+ #ifdef 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))
unchanged:
--- readline-6.3-orig/signals.c 2014-01-10 15:06:48.000000000 -0500
+++ readline-6.3/signals.c 2015-07-20 12:33:07.437472100 -0400
@@ -216,7 +216,9 @@
/* FALLTHROUGH */
case SIGTERM:
+#if defined (SIGHUP)
case SIGHUP:
+#endif
#if defined (SIGTSTP)
case SIGTSTP:
case SIGTTOU:
@@ -397,7 +399,9 @@
sigaddset (&bset, SIGINT);
sigaddset (&bset, SIGTERM);
+#ifdef SIGHUP
sigaddset (&bset, SIGHUP);
+#endif
#if defined (SIGQUIT)
sigaddset (&bset, SIGQUIT);
#endif
@@ -426,7 +430,9 @@
rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
+#ifdef SIGHUP
rl_maybe_set_sighandler (SIGHUP, rl_signal_handler, &old_hup);
+#endif
#if defined (SIGQUIT)
rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
#endif
@@ -491,7 +497,9 @@
overhead */
rl_maybe_restore_sighandler (SIGINT, &old_int);
rl_maybe_restore_sighandler (SIGTERM, &old_term);
+#ifdef SIGHUP
rl_maybe_restore_sighandler (SIGHUP, &old_hup);
+#endif
#if defined (SIGQUIT)
rl_maybe_restore_sighandler (SIGQUIT, &old_quit);
#endif
only in patch2:
unchanged:
--- readline-6.3-orig/input.c 2014-01-10 15:07:08.000000000 -0500
+++ readline-6.3/input.c 2015-07-20 12:37:16.112005600 -0400
@@ -532,11 +532,28 @@
Otherwise (not EINTR), some error occurred, also signifying EOF. */
if (errno != EINTR)
return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
- else if (_rl_caught_signal == SIGHUP || _rl_caught_signal == SIGTERM)
+ else if (
+ #ifdef SIGHUP
+ _rl_caught_signal == SIGHUP ||
+ #endif
+ _rl_caught_signal == SIGTERM)
return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
- else if (_rl_caught_signal == SIGINT || _rl_caught_signal == SIGQUIT)
+ /* keyboard-generated signals of interest */
+ else if (_rl_caught_signal == SIGINT
+ #ifdef SIGQUIT
+ || _rl_caught_signal == SIGQUIT
+ #endif
+ )
RL_CHECK_SIGNALS ();
-
+#ifdef SIGALRM
+ /* non-keyboard-generated signals of interest */
+ else if (_rl_caught_signal == SIGALRM
+#if defined (SIGVTALRM)
+ || _rl_caught_signal == SIGVTALRM
+#endif
+ )
+ RL_CHECK_SIGNALS ();
+#endif
if (rl_signal_event_hook)
(*rl_signal_event_hook) ();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment