summaryrefslogtreecommitdiff
path: root/cmd-line-utils/readline/kill.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd-line-utils/readline/kill.c')
-rw-r--r--cmd-line-utils/readline/kill.c61
1 files changed, 52 insertions, 9 deletions
diff --git a/cmd-line-utils/readline/kill.c b/cmd-line-utils/readline/kill.c
index 32a661f076f..1d3254c3275 100644
--- a/cmd-line-utils/readline/kill.c
+++ b/cmd-line-utils/readline/kill.c
@@ -21,7 +21,9 @@
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
-#include "config_readline.h"
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
#include <sys/types.h>
@@ -77,7 +79,7 @@ static int rl_yank_nth_arg_internal PARAMS((int, int, int));
of kill material. */
int
rl_set_retained_kills (num)
- int num __attribute__((unused));
+ int num;
{
return 0;
}
@@ -294,7 +296,7 @@ rl_backward_kill_line (direction, ignore)
/* Kill the whole line, no matter where point is. */
int
rl_kill_full_line (count, ignore)
- int count __attribute__((unused)), ignore __attribute__((unused));
+ int count, ignore;
{
rl_begin_undo_group ();
rl_point = 0;
@@ -312,7 +314,7 @@ rl_kill_full_line (count, ignore)
using behaviour that they expect. */
int
rl_unix_word_rubout (count, key)
- int count, key __attribute__((unused));
+ int count, key;
{
int orig_point;
@@ -337,6 +339,47 @@ rl_unix_word_rubout (count, key)
if (rl_editing_mode == emacs_mode)
rl_mark = rl_point;
}
+
+ return 0;
+}
+
+/* This deletes one filename component in a Unix pathname. That is, it
+ deletes backward to directory separator (`/') or whitespace. */
+int
+rl_unix_filename_rubout (count, key)
+ int count, key;
+{
+ int orig_point, c;
+
+ if (rl_point == 0)
+ rl_ding ();
+ else
+ {
+ orig_point = rl_point;
+ if (count <= 0)
+ count = 1;
+
+ while (count--)
+ {
+ c = rl_line_buffer[rl_point - 1];
+ while (rl_point && (whitespace (c) || c == '/'))
+ {
+ rl_point--;
+ c = rl_line_buffer[rl_point - 1];
+ }
+
+ while (rl_point && (whitespace (c) == 0) && c != '/')
+ {
+ rl_point--;
+ c = rl_line_buffer[rl_point - 1];
+ }
+ }
+
+ rl_kill_text (orig_point, rl_point);
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
+ }
+
return 0;
}
@@ -348,7 +391,7 @@ rl_unix_word_rubout (count, key)
doing. */
int
rl_unix_line_discard (count, key)
- int count __attribute__((unused)), key __attribute__((unused));
+ int count, key;
{
if (rl_point == 0)
rl_ding ();
@@ -385,7 +428,7 @@ region_kill_internal (delete)
/* Copy the text in the region to the kill ring. */
int
rl_copy_region_to_kill (count, ignore)
- int count __attribute__((unused)), ignore __attribute__((unused));
+ int count, ignore;
{
return (region_kill_internal (0));
}
@@ -393,7 +436,7 @@ rl_copy_region_to_kill (count, ignore)
/* Kill the text between the point and mark. */
int
rl_kill_region (count, ignore)
- int count __attribute__((unused)), ignore __attribute__((unused));
+ int count, ignore;
{
int r, npoint;
@@ -458,7 +501,7 @@ rl_copy_backward_word (count, key)
/* Yank back the last killed text. This ignores arguments. */
int
rl_yank (count, ignore)
- int count __attribute__((unused)), ignore __attribute__((unused));
+ int count, ignore;
{
if (rl_kill_ring == 0)
{
@@ -477,7 +520,7 @@ rl_yank (count, ignore)
yank back some other text. */
int
rl_yank_pop (count, key)
- int count __attribute__((unused)), key __attribute__((unused));
+ int count, key;
{
int l, n;