ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/misc.C
(Generate patch)

Comparing rxvt-unicode/src/misc.C (file contents):
Revision 1.45 by ayin, Sat Sep 8 20:55:49 2007 UTC vs.
Revision 1.48 by ayin, Tue Oct 23 21:54:42 2007 UTC

79 *p++ = w; 79 *p++ = w;
80 else if (w < 0x000800) 80 else if (w < 0x000800)
81 *p++ = 0xc0 | ( w >> 6), 81 *p++ = 0xc0 | ( w >> 6),
82 *p++ = 0x80 | ( w & 0x3f); 82 *p++ = 0x80 | ( w & 0x3f);
83 else if (w < 0x010000) 83 else if (w < 0x010000)
84 *p++ = 0xe0 | ( w >> 12 ), 84 *p++ = 0xe0 | ( w >> 12),
85 *p++ = 0x80 | ((w >> 6) & 0x3f), 85 *p++ = 0x80 | ((w >> 6) & 0x3f),
86 *p++ = 0x80 | ( w & 0x3f); 86 *p++ = 0x80 | ( w & 0x3f);
87 else if (w < 0x110000) 87 else if (w < 0x110000)
88 *p++ = 0xf0 | ( w >> 18), 88 *p++ = 0xf0 | ( w >> 18),
89 *p++ = 0x80 | ((w >> 12) & 0x3f), 89 *p++ = 0x80 | ((w >> 12) & 0x3f),
163 163
164 return r; 164 return r;
165} 165}
166 166
167char * 167char *
168rxvt_r_basename (const char *str) NOTHROW 168rxvt_basename (const char *str) NOTHROW
169{ 169{
170 char *base = strrchr (str, '/'); 170 char *base = strrchr (str, '/');
171 171
172 return (char *) (base ? base + 1 : str); 172 return (char *) (base ? base + 1 : str);
173} 173}
235} 235}
236 236
237/* 237/*
238 * remove leading/trailing space in place. 238 * remove leading/trailing space in place.
239 */ 239 */
240char * 240char *
241rxvt_Str_trim (char *str) NOTHROW 241rxvt_strtrim (char *str) NOTHROW
242{ 242{
243 char *r, *s; 243 char *r, *s;
244 244
245 if (!str || !*str) /* shortcut */ 245 if (!str || !*str) /* shortcut */
246 return str; 246 return str;
262} 262}
263 263
264/* 264/*
265 * Split a comma-separated string into an array, stripping leading and 265 * Split a comma-separated string into an array, stripping leading and
266 * trailing spaces from each entry. Empty strings are properly returned 266 * trailing spaces from each entry. Empty strings are properly returned
267 * Caller should free each entry and array when done
268 */ 267 */
269char ** 268char **
270rxvt_splitcommastring (const char *cs) NOTHROW 269rxvt_splitcommastring (const char *cs) NOTHROW
271{ 270{
272 int l, n, p; 271 int l, n, p;
273 const char *s, *t; 272 const char *s, *t;
274 char **ret; 273 char **ret;
288 for ( ; *t && *t != ','; t++) ; 287 for ( ; *t && *t != ','; t++) ;
289 p = t - s; 288 p = t - s;
290 ret[l] = (char *)malloc (p + 1); 289 ret[l] = (char *)malloc (p + 1);
291 strncpy (ret[l], s, p); 290 strncpy (ret[l], s, p);
292 ret[l][p] = '\0'; 291 ret[l][p] = '\0';
293 rxvt_Str_trim (ret[l]); 292 rxvt_strtrim (ret[l]);
294 s = ++t; 293 s = ++t;
295 } 294 }
296 295
297 return ret; 296 return ret;
298} 297}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines