… | |
… | |
36 | |
36 | |
37 | char *dst = r; |
37 | char *dst = r; |
38 | while (len--) |
38 | while (len--) |
39 | { |
39 | { |
40 | ssize_t l = wcrtomb (dst, *str++, mbs); |
40 | ssize_t l = wcrtomb (dst, *str++, mbs); |
|
|
41 | |
41 | if (l < 0) |
42 | if (l < 0) |
42 | *dst++ = '?'; |
43 | *dst++ = '?'; |
43 | else |
44 | else |
44 | dst += l; |
45 | dst += l; |
45 | } |
46 | } |
… | |
… | |
524 | char *f; |
525 | char *f; |
525 | |
526 | |
526 | if (file == NULL || *file == '\0') |
527 | if (file == NULL || *file == '\0') |
527 | return NULL; |
528 | return NULL; |
528 | |
529 | |
529 | /* search environment variables here too */ |
|
|
530 | if ((f = rxvt_File_search_path (path, file, ext)) == NULL) |
530 | f = rxvt_File_search_path (path, file, ext); |
531 | #ifdef PATH_ENV |
|
|
532 | if ((f = rxvt_File_search_path (getenv (PATH_ENV), file, ext)) == NULL) |
|
|
533 | #endif |
|
|
534 | f = rxvt_File_search_path (getenv ("PATH"), file, ext); |
|
|
535 | |
531 | |
536 | #ifdef DEBUG_SEARCH_PATH |
532 | #ifdef DEBUG_SEARCH_PATH |
537 | if (f) |
533 | if (f) |
538 | fprintf (stderr, "found: \"%s\"\n", f); |
534 | fprintf (stderr, "found: \"%s\"\n", f); |
539 | #endif |
535 | #endif |
… | |
… | |
553 | void |
549 | void |
554 | rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h) |
550 | rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h) |
555 | { |
551 | { |
556 | int shadow; |
552 | int shadow; |
557 | |
553 | |
558 | shadow = (w == 0 || h == 0) ? 1 : SHADOW; |
554 | shadow = (w == 0 || h == 0) ? 1 : MENU_SHADOW; |
559 | w += x - 1; |
555 | w += x - 1; |
560 | h += y - 1; |
556 | h += y - 1; |
561 | for (; shadow-- > 0; x++, y++, w--, h--) |
557 | for (; shadow-- > 0; x++, y++, w--, h--) |
562 | { |
558 | { |
563 | XDrawLine (display, win, topShadow, x, y, w, y); |
559 | XDrawLine (display, win, topShadow, x, y, w, y); |
… | |
… | |
608 | #endif |
604 | #endif |
609 | |
605 | |
610 | } |
606 | } |
611 | } |
607 | } |
612 | #endif |
608 | #endif |
|
|
609 | |
|
|
610 | // should not be used in interactive programs, for obvious reasons |
|
|
611 | void rxvt_usleep (int usecs) |
|
|
612 | { |
|
|
613 | #if HAVE_NANOSLEEP |
|
|
614 | struct timespec ts; |
|
|
615 | |
|
|
616 | ts.tv_sec = 0; |
|
|
617 | ts.tv_nsec = usecs * 1000; |
|
|
618 | nanosleep (&ts, NULL); |
|
|
619 | #else |
|
|
620 | /* use select for timing */ |
|
|
621 | struct timeval tv; |
|
|
622 | |
|
|
623 | tv.tv_sec = 0; |
|
|
624 | tv.tv_usec = usecs; |
|
|
625 | select (0, NULL, NULL, NULL, &tv); |
|
|
626 | #endif |
|
|
627 | } |
|
|
628 | |
613 | /*----------------------- end-of-file (C source) -----------------------*/ |
629 | /*----------------------- end-of-file (C source) -----------------------*/ |
|
|
630 | |