histexpand.c (157184) | histexpand.c (165670) |
---|---|
1/* histexpand.c -- history expansion. */ 2 3/* Copyright (C) 1989-2004 Free Software Foundation, Inc. 4 5 This file contains the GNU History Library (the Library), a set of 6 routines for managing the text of previously typed lines. 7 8 The Library is free software; you can redistribute it and/or modify --- 42 unchanged lines hidden (view full) --- 51 52#define HISTORY_WORD_DELIMITERS " \t\n;&()|<>" 53#define HISTORY_QUOTE_CHARACTERS "\"'`" 54 55#define slashify_in_quotes "\\`\"$" 56 57typedef int _hist_search_func_t PARAMS((const char *, int)); 58 | 1/* histexpand.c -- history expansion. */ 2 3/* Copyright (C) 1989-2004 Free Software Foundation, Inc. 4 5 This file contains the GNU History Library (the Library), a set of 6 routines for managing the text of previously typed lines. 7 8 The Library is free software; you can redistribute it and/or modify --- 42 unchanged lines hidden (view full) --- 51 52#define HISTORY_WORD_DELIMITERS " \t\n;&()|<>" 53#define HISTORY_QUOTE_CHARACTERS "\"'`" 54 55#define slashify_in_quotes "\\`\"$" 56 57typedef int _hist_search_func_t PARAMS((const char *, int)); 58 |
59extern int rl_byte_oriented; /* declared in mbutil.c */ 60 | |
61static char error_pointer; 62 63static char *subst_lhs; 64static char *subst_rhs; 65static int subst_lhs_len; 66static int subst_rhs_len; 67 68static char *get_history_word_specifier PARAMS((char *, char *, int *)); --- 490 unchanged lines hidden (view full) --- 559 560 /* If the character before this `!' is a double or single 561 quote, then this expansion takes place inside of the 562 quoted string. If we have to search for some text ("!foo"), 563 allow the delimiter to end the search string. */ 564#if defined (HANDLE_MULTIBYTE) 565 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 566 { | 59static char error_pointer; 60 61static char *subst_lhs; 62static char *subst_rhs; 63static int subst_lhs_len; 64static int subst_rhs_len; 65 66static char *get_history_word_specifier PARAMS((char *, char *, int *)); --- 490 unchanged lines hidden (view full) --- 557 558 /* If the character before this `!' is a double or single 559 quote, then this expansion takes place inside of the 560 quoted string. If we have to search for some text ("!foo"), 561 allow the delimiter to end the search string. */ 562#if defined (HANDLE_MULTIBYTE) 563 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 564 { |
567 int c, l; | 565 int ch, l; |
568 l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY); | 566 l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY); |
569 c = string[l]; | 567 ch = string[l]; |
570 /* XXX - original patch had i - 1 ??? If i == 0 it would fail. */ | 568 /* XXX - original patch had i - 1 ??? If i == 0 it would fail. */ |
571 if (i && (c == '\'' || c == '"')) 572 quoted_search_delimiter = c; | 569 if (i && (ch == '\'' || ch == '"')) 570 quoted_search_delimiter = ch; |
573 } 574 else 575#endif /* HANDLE_MULTIBYTE */ 576 if (i && (string[i - 1] == '\'' || string[i - 1] == '"')) 577 quoted_search_delimiter = string[i - 1]; 578 579 event = get_history_event (string, &i, quoted_search_delimiter); 580 } --- 844 unchanged lines hidden (view full) --- 1425 if (member (string[i], "<>;&|$")) 1426 { 1427 int peek = string[i + 1]; 1428 1429 if (peek == string[i] && peek != '$') 1430 { 1431 if (peek == '<' && string[i + 2] == '-') 1432 i++; | 571 } 572 else 573#endif /* HANDLE_MULTIBYTE */ 574 if (i && (string[i - 1] == '\'' || string[i - 1] == '"')) 575 quoted_search_delimiter = string[i - 1]; 576 577 event = get_history_event (string, &i, quoted_search_delimiter); 578 } --- 844 unchanged lines hidden (view full) --- 1423 if (member (string[i], "<>;&|$")) 1424 { 1425 int peek = string[i + 1]; 1426 1427 if (peek == string[i] && peek != '$') 1428 { 1429 if (peek == '<' && string[i + 2] == '-') 1430 i++; |
1431 else if (peek == '<' && string[i + 2] == '<') 1432 i++; |
|
1433 i += 2; 1434 return i; 1435 } 1436 else 1437 { 1438 if ((peek == '&' && (string[i] == '>' || string[i] == '<')) || 1439 (peek == '>' && string[i] == '&') || 1440 (peek == '(' && (string[i] == '>' || string[i] == '<')) || /* ) */ --- 153 unchanged lines hidden --- | 1433 i += 2; 1434 return i; 1435 } 1436 else 1437 { 1438 if ((peek == '&' && (string[i] == '>' || string[i] == '<')) || 1439 (peek == '>' && string[i] == '&') || 1440 (peek == '(' && (string[i] == '>' || string[i] == '<')) || /* ) */ --- 153 unchanged lines hidden --- |