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.26 by root, Wed Feb 16 20:32:05 2005 UTC vs.
Revision 1.27 by root, Wed Feb 16 21:37:10 2005 UTC

167rxvt_strdup (const char *str) 167rxvt_strdup (const char *str)
168{ 168{
169 return str ? strdup (str) : 0; 169 return str ? strdup (str) : 0;
170} 170}
171 171
172/* INTPROTO */
173char * 172char *
174rxvt_r_basename (const char *str) 173rxvt_r_basename (const char *str)
175{ 174{
176 char *base = strrchr (str, '/'); 175 char *base = strrchr (str, '/');
177 176
179} 178}
180 179
181/* 180/*
182 * Print an error message 181 * Print an error message
183 */ 182 */
184/* INTPROTO */
185void 183void
186rxvt_vlog (const char *fmt, va_list arg_ptr) 184rxvt_vlog (const char *fmt, va_list arg_ptr)
187{ 185{
188 char msg[1024]; 186 char msg[1024];
189 187
193 (*GET_R->log_hook) (msg); 191 (*GET_R->log_hook) (msg);
194 else 192 else
195 write (STDOUT_FILENO, msg, strlen (msg)); 193 write (STDOUT_FILENO, msg, strlen (msg));
196} 194}
197 195
198/* INTPROTO */
199void 196void
200rxvt_log (const char *fmt,...) 197rxvt_log (const char *fmt,...)
201{ 198{
202 va_list arg_ptr; 199 va_list arg_ptr;
203 200
207} 204}
208 205
209/* 206/*
210 * Print an error message 207 * Print an error message
211 */ 208 */
212/* INTPROTO */
213void 209void
214rxvt_warn (const char *fmt,...) 210rxvt_warn (const char *fmt,...)
215{ 211{
216 va_list arg_ptr; 212 va_list arg_ptr;
217 213
220 va_start (arg_ptr, fmt); 216 va_start (arg_ptr, fmt);
221 rxvt_vlog (fmt, arg_ptr); 217 rxvt_vlog (fmt, arg_ptr);
222 va_end (arg_ptr); 218 va_end (arg_ptr);
223} 219}
224 220
225/* INTPROTO */
226void 221void
227rxvt_fatal (const char *fmt,...) 222rxvt_fatal (const char *fmt,...)
228{ 223{
229 va_list arg_ptr; 224 va_list arg_ptr;
230 225
237 rxvt_exit_failure (); 232 rxvt_exit_failure ();
238} 233}
239 234
240class rxvt_failure_exception rxvt_failure_exception; 235class rxvt_failure_exception rxvt_failure_exception;
241 236
242/* INTPROTO */
243void 237void
244rxvt_exit_failure () 238rxvt_exit_failure ()
245{ 239{
246 throw (rxvt_failure_exception); 240 throw (rxvt_failure_exception);
247} 241}
252 * No Match 246 * No Match
253 * return: 0 247 * return: 0
254 * Match 248 * Match
255 * return: strlen (S2) 249 * return: strlen (S2)
256 */ 250 */
257/* INTPROTO */
258int 251int
259rxvt_Str_match (const char *s1, const char *s2) 252rxvt_Str_match (const char *s1, const char *s2)
260{ 253{
261 int n = strlen (s2); 254 int n = strlen (s2);
262 255
263 return ((strncmp (s1, s2, n) == 0) ? n : 0); 256 return ((strncmp (s1, s2, n) == 0) ? n : 0);
264} 257}
265 258
266/* INTPROTO */
267const char * 259const char *
268rxvt_Str_skip_space (const char *str) 260rxvt_Str_skip_space (const char *str)
269{ 261{
270 if (str) 262 if (str)
271 while (*str && isspace (*str)) 263 while (*str && isspace (*str))
276 268
277/* 269/*
278 * remove leading/trailing space and strip-off leading/trailing quotes. 270 * remove leading/trailing space and strip-off leading/trailing quotes.
279 * in place. 271 * in place.
280 */ 272 */
281/* INTPROTO */
282char * 273char *
283rxvt_Str_trim (char *str) 274rxvt_Str_trim (char *str)
284{ 275{
285 char *r, *s; 276 char *r, *s;
286 277
324 * "M-x" prefixed strings, append "\r" if needed 315 * "M-x" prefixed strings, append "\r" if needed
325 * "\E]" prefixed strings (XTerm escape sequence) append ST if needed 316 * "\E]" prefixed strings (XTerm escape sequence) append ST if needed
326 * 317 *
327 * returns the converted string length 318 * returns the converted string length
328 */ 319 */
329/* INTPROTO */
330int 320int
331rxvt_Str_escaped (char *str) 321rxvt_Str_escaped (char *str)
332{ 322{
333 char ch, *s, *d; 323 char ch, *s, *d;
334 int i, num, append = 0; 324 int i, num, append = 0;
401/* 391/*
402 * Split a comma-separated string into an array, stripping leading and 392 * Split a comma-separated string into an array, stripping leading and
403 * trailing spaces from each entry. Empty strings are properly returned 393 * trailing spaces from each entry. Empty strings are properly returned
404 * Caller should free each entry and array when done 394 * Caller should free each entry and array when done
405 */ 395 */
406/* INTPROTO */
407char ** 396char **
408rxvt_splitcommastring (const char *cs) 397rxvt_splitcommastring (const char *cs)
409{ 398{
410 int l, n, p; 399 int l, n, p;
411 const char *s, *t; 400 const char *s, *t;
455 * search for FILE in the current working directory, and within the 444 * search for FILE in the current working directory, and within the
456 * colon-delimited PATHLIST, adding the file extension EXT if required. 445 * colon-delimited PATHLIST, adding the file extension EXT if required.
457 * 446 *
458 * FILE is either semi-colon or zero terminated 447 * FILE is either semi-colon or zero terminated
459 */ 448 */
460/* INTPROTO */
461char * 449char *
462rxvt_File_search_path (const char *pathlist, const char *file, const char *ext) 450rxvt_File_search_path (const char *pathlist, const char *file, const char *ext)
463{ 451{
464 int maxpath, len; 452 int maxpath, len;
465 const char *p, *path; 453 const char *p, *path;
528 } 516 }
529 } 517 }
530 return NULL; 518 return NULL;
531} 519}
532 520
533/* INTPROTO */
534char * 521char *
535rxvt_File_find (const char *file, const char *ext, const char *path) 522rxvt_File_find (const char *file, const char *ext, const char *path)
536{ 523{
537 char *f; 524 char *f;
538 525
561 548
562/* 549/*
563 * Draw top/left and bottom/right border shadows around windows 550 * Draw top/left and bottom/right border shadows around windows
564 */ 551 */
565#if defined(RXVT_SCROLLBAR) || defined(MENUBAR) 552#if defined(RXVT_SCROLLBAR) || defined(MENUBAR)
566/* INTPROTO */
567void 553void
568rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h) 554rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h)
569{ 555{
570 int shadow; 556 int shadow;
571 557
582} 568}
583#endif 569#endif
584 570
585/* button shapes */ 571/* button shapes */
586#ifdef MENUBAR 572#ifdef MENUBAR
587/* INTPROTO */
588void 573void
589rxvt_Draw_Triangle (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int type) 574rxvt_Draw_Triangle (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int type)
590{ 575{
591 switch (type) 576 switch (type)
592 { 577 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines