histexpand.c (136644) | histexpand.c (157184) |
---|---|
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 --- 192 unchanged lines hidden (view full) --- 201 if (string[i] == '?') 202 { 203 substring_okay++; 204 i++; 205 } 206 207 /* Only a closing `?' or a newline delimit a substring search string. */ 208 for (local_index = i; c = string[i]; i++) | 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 --- 192 unchanged lines hidden (view full) --- 201 if (string[i] == '?') 202 { 203 substring_okay++; 204 i++; 205 } 206 207 /* Only a closing `?' or a newline delimit a substring search string. */ 208 for (local_index = i; c = string[i]; i++) |
209 { |
|
209#if defined (HANDLE_MULTIBYTE) | 210#if defined (HANDLE_MULTIBYTE) |
210 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 211 { 212 int v; 213 mbstate_t ps; | 211 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 212 { 213 int v; 214 mbstate_t ps; |
214 | 215 |
215 memset (&ps, 0, sizeof (mbstate_t)); 216 /* These produce warnings because we're passing a const string to a 217 function that takes a non-const string. */ 218 _rl_adjust_point ((char *)string, i, &ps); 219 if ((v = _rl_get_char_len ((char *)string + i, &ps)) > 1) 220 { 221 i += v - 1; 222 continue; 223 } 224 } 225 else | 216 memset (&ps, 0, sizeof (mbstate_t)); 217 /* These produce warnings because we're passing a const string to a 218 function that takes a non-const string. */ 219 _rl_adjust_point ((char *)string, i, &ps); 220 if ((v = _rl_get_char_len ((char *)string + i, &ps)) > 1) 221 { 222 i += v - 1; 223 continue; 224 } 225 } 226 |
226#endif /* HANDLE_MULTIBYTE */ 227 if ((!substring_okay && (whitespace (c) || c == ':' || 228 (history_search_delimiter_chars && member (c, history_search_delimiter_chars)) || 229 string[i] == delimiting_quote)) || 230 string[i] == '\n' || 231 (substring_okay && string[i] == '?')) 232 break; | 227#endif /* HANDLE_MULTIBYTE */ 228 if ((!substring_okay && (whitespace (c) || c == ':' || 229 (history_search_delimiter_chars && member (c, history_search_delimiter_chars)) || 230 string[i] == delimiting_quote)) || 231 string[i] == '\n' || 232 (substring_okay && string[i] == '?')) 233 break; |
234 } |
|
233 234 which = i - local_index; 235 temp = (char *)xmalloc (1 + which); 236 if (which) 237 strncpy (temp, string + local_index, which); 238 temp[which] = '\0'; 239 240 if (substring_okay && string[i] == '?') --- 1351 unchanged lines hidden --- | 235 236 which = i - local_index; 237 temp = (char *)xmalloc (1 + which); 238 if (which) 239 strncpy (temp, string + local_index, which); 240 temp[which] = '\0'; 241 242 if (substring_okay && string[i] == '?') --- 1351 unchanged lines hidden --- |