--- rxvt-unicode/src/misc.C 2005/02/07 01:17:03 1.25 +++ rxvt-unicode/src/misc.C 2006/01/16 17:11:12 1.35 @@ -25,7 +25,6 @@ #include "../config.h" /* NECESSARY */ #include "rxvt.h" /* NECESSARY */ -#include "misc.intpro" /* PROTOS for internal routines */ char * rxvt_wcstombs (const wchar_t *str, int len) @@ -39,6 +38,7 @@ while (len--) { ssize_t l = wcrtomb (dst, *str++, mbs); + if (l < 0) *dst++ = '?'; else @@ -170,7 +170,6 @@ return str ? strdup (str) : 0; } -/* INTPROTO */ char * rxvt_r_basename (const char *str) { @@ -182,7 +181,6 @@ /* * Print an error message */ -/* INTPROTO */ void rxvt_vlog (const char *fmt, va_list arg_ptr) { @@ -196,7 +194,6 @@ write (STDOUT_FILENO, msg, strlen (msg)); } -/* INTPROTO */ void rxvt_log (const char *fmt,...) { @@ -210,7 +207,6 @@ /* * Print an error message */ -/* INTPROTO */ void rxvt_warn (const char *fmt,...) { @@ -223,7 +219,6 @@ va_end (arg_ptr); } -/* INTPROTO */ void rxvt_fatal (const char *fmt,...) { @@ -240,7 +235,6 @@ class rxvt_failure_exception rxvt_failure_exception; -/* INTPROTO */ void rxvt_exit_failure () { @@ -255,7 +249,6 @@ * Match * return: strlen (S2) */ -/* INTPROTO */ int rxvt_Str_match (const char *s1, const char *s2) { @@ -264,7 +257,6 @@ return ((strncmp (s1, s2, n) == 0) ? n : 0); } -/* INTPROTO */ const char * rxvt_Str_skip_space (const char *str) { @@ -279,7 +271,6 @@ * remove leading/trailing space and strip-off leading/trailing quotes. * in place. */ -/* INTPROTO */ char * rxvt_Str_trim (char *str) { @@ -327,7 +318,6 @@ * * returns the converted string length */ -/* INTPROTO */ int rxvt_Str_escaped (char *str) { @@ -404,7 +394,6 @@ * trailing spaces from each entry. Empty strings are properly returned * Caller should free each entry and array when done */ -/* INTPROTO */ char ** rxvt_splitcommastring (const char *cs) { @@ -451,14 +440,13 @@ /* #define DEBUG_SEARCH_PATH */ -#if defined (XPM_BACKGROUND) || (MENUBAR_MAX) +#ifdef XPM_BACKGROUND /* * search for FILE in the current working directory, and within the * colon-delimited PATHLIST, adding the file extension EXT if required. * * FILE is either semi-colon or zero terminated */ -/* INTPROTO */ char * rxvt_File_search_path (const char *pathlist, const char *file, const char *ext) { @@ -531,7 +519,6 @@ return NULL; } -/* INTPROTO */ char * rxvt_File_find (const char *file, const char *ext, const char *path) { @@ -540,12 +527,7 @@ if (file == NULL || *file == '\0') return NULL; - /* search environment variables here too */ - if ((f = rxvt_File_search_path (path, file, ext)) == NULL) -#ifdef PATH_ENV - if ((f = rxvt_File_search_path (getenv (PATH_ENV), file, ext)) == NULL) -#endif - f = rxvt_File_search_path (getenv ("PATH"), file, ext); + f = rxvt_File_search_path (path, file, ext); #ifdef DEBUG_SEARCH_PATH if (f) @@ -554,76 +536,26 @@ return f; } -#endif /* defined (XPM_BACKGROUND) || (MENUBAR_MAX) */ - -/*----------------------------------------------------------------------* - * miscellaneous drawing routines - */ - -/* - * Draw top/left and bottom/right border shadows around windows - */ -#if defined(RXVT_SCROLLBAR) || defined(MENUBAR) -/* INTPROTO */ -void -rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h) -{ - int shadow; - - shadow = (w == 0 || h == 0) ? 1 : SHADOW; - w += x - 1; - h += y - 1; - for (; shadow-- > 0; x++, y++, w--, h--) - { - XDrawLine (display, win, topShadow, x, y, w, y); - XDrawLine (display, win, topShadow, x, y, x, h); - XDrawLine (display, win, botShadow, w, h, w, y + 1); - XDrawLine (display, win, botShadow, w, h, x + 1, h); - } -} #endif -/* button shapes */ -#ifdef MENUBAR -/* INTPROTO */ -void -rxvt_Draw_Triangle (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int type) +// should not be used in interactive programs, for obvious reasons +void rxvt_usleep (int usecs) { - switch (type) - { - case 'r': /* right triangle */ - XDrawLine (display, win, topShadow, x, y, x, y + w); - XDrawLine (display, win, topShadow, x, y, x + w, y + w / 2); - XDrawLine (display, win, botShadow, x, y + w, x + w, y + w / 2); - break; - - case 'l': /* left triangle */ - XDrawLine (display, win, botShadow, x + w, y + w, x + w, y); - XDrawLine (display, win, botShadow, x + w, y + w, x, y + w / 2); - XDrawLine (display, win, topShadow, x, y + w / 2, x + w, y); - break; +#if HAVE_NANOSLEEP + struct timespec ts; - case 'd': /* down triangle */ - XDrawLine (display, win, topShadow, x, y, x + w / 2, y + w); - XDrawLine (display, win, topShadow, x, y, x + w, y); - XDrawLine (display, win, botShadow, x + w, y, x + w / 2, y + w); - break; - - case 'u': /* up triangle */ - XDrawLine (display, win, botShadow, x + w, y + w, x + w / 2, y); - XDrawLine (display, win, botShadow, x + w, y + w, x, y + w); - XDrawLine (display, win, topShadow, x, y + w, x + w / 2, y); - break; -#if 0 - case 's': /* square */ - XDrawLine (display, win, topShadow, x + w, y, x, y); - XDrawLine (display, win, topShadow, x, y, x, y + w); - XDrawLine (display, win, botShadow, x, y + w, x + w, y + w); - XDrawLine (display, win, botShadow, x + w, y + w, x + w, y); - break; -#endif - - } + ts.tv_sec = 0; + ts.tv_nsec = usecs * 1000; + nanosleep (&ts, NULL); +#else + /* use select for timing */ + struct timeval tv; + + tv.tv_sec = 0; + tv.tv_usec = usecs; + select (0, NULL, NULL, NULL, &tv); +#endif } -#endif + /*----------------------- end-of-file (C source) -----------------------*/ +