comparison src/menubar.c @ 219:262b8bb4a523 r20-4b8

Import from CVS: tag r20-4b8
author cvs
date Mon, 13 Aug 2007 10:09:35 +0200
parents acd284d43ca1
children 677f6a0ee643
comparison
equal deleted inserted replaced
218:c9f226976f56 219:262b8bb4a523
201 end = string_char_length (n); 201 end = string_char_length (n);
202 name_data = string_data (n); 202 name_data = string_data (n);
203 203
204 string_result = (Bufbyte *) alloca (end * MAX_EMCHAR_LEN); 204 string_result = (Bufbyte *) alloca (end * MAX_EMCHAR_LEN);
205 string_result_ptr = string_result; 205 string_result_ptr = string_result;
206 for (i = 0; i < end ; i++) 206 for (i = 0; i < end; i++)
207 { 207 {
208 elt = charptr_emchar_n (name_data, i); 208 elt = charptr_emchar (name_data);
209 elt = DOWNCASE (buf, elt); 209 elt = DOWNCASE (buf, elt);
210 if (elt == '%') 210 if (expecting_underscore)
211 expecting_underscore = 1;
212 else if (expecting_underscore)
213 { 211 {
214 expecting_underscore = 0; 212 expecting_underscore = 0;
215 if (elt != '_') 213 switch (elt)
216 { 214 {
215 case '%':
216 /* Allow `%%' to mean `%'. */
217 string_result_ptr += set_charptr_emchar (string_result_ptr, '%');
218 break;
219 case '_':
220 break;
221 default:
217 string_result_ptr += set_charptr_emchar (string_result_ptr, '%'); 222 string_result_ptr += set_charptr_emchar (string_result_ptr, '%');
218 string_result_ptr += set_charptr_emchar (string_result_ptr, elt); 223 string_result_ptr += set_charptr_emchar (string_result_ptr, elt);
219 } 224 }
220 } 225 }
226 else if (elt == '%')
227 expecting_underscore = 1;
221 else 228 else
222 string_result_ptr += set_charptr_emchar (string_result_ptr, elt); 229 string_result_ptr += set_charptr_emchar (string_result_ptr, elt);
230 INC_CHARPTR (name_data);
223 } 231 }
224 232
225 return make_string (string_result, string_result_ptr - string_result); 233 return make_string (string_result, string_result_ptr - string_result);
226 } 234 }
227 235