*** empty log message ***
authorayin <ayin>
Sat, 30 Jun 2007 23:58:29 +0000 (23:58 +0000)
committerayin <ayin>
Sat, 30 Jun 2007 23:58:29 +0000 (23:58 +0000)
src/misc.C
src/rxvt.h
src/xpm.C

index 4c7b79439954e9a8ff859763ac422e4fd1e3968b..1107918e8d6875a7f1e0a8b8abeec0c95d802b94 100644 (file)
@@ -1,4 +1,4 @@
-/*--------------------------------*-C-*---------------------------------*
+/*----------------------------------------------------------------------*
  * File:       misc.C
  *----------------------------------------------------------------------*
  *
@@ -427,95 +427,5 @@ rxvt_freecommastring (char **cs) NOTHROW
   free (cs);
 }
 
-/*----------------------------------------------------------------------*
- * file searching
- */
-
-#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
- */
-char *
-rxvt_File_search_path (const char *pathlist, const char *file, const char *ext) NOTHROW
-{
-  int             maxpath, len;
-  const char     *p, *path;
-  char            name[256];
-
-  if (!access (file, R_OK))    /* found (plain name) in current directory */
-    return strdup (file);
-
-  /* semi-colon delimited */
-  if ((p = strchr (file, ';')))
-    len = (p - file);
-  else
-    len = strlen (file);
-
-  /* leave room for an extra '/' and trailing '\0' */
-  maxpath = sizeof (name) - (len + (ext ? strlen (ext) : 0) + 2);
-  if (maxpath <= 0)
-    return NULL;
-
-  /* check if we can find it now */
-  strncpy (name, file, len);
-  name[len] = '\0';
-
-  if (!access (name, R_OK))
-    return strdup (name);
-  if (ext)
-    {
-      strcat (name, ext);
-      if (!access (name, R_OK))
-        return strdup (name);
-    }
-  for (path = pathlist; path != NULL && *path != '\0'; path = p)
-    {
-      int             n;
-
-      /* colon delimited */
-      if ((p = strchr (path, ':')) == NULL)
-        p = strchr (path, '\0');
-
-      n = (p - path);
-      if (*p != '\0')
-        p++;
-
-      if (n > 0 && n <= maxpath)
-        {
-          strncpy (name, path, n);
-          if (name[n - 1] != '/')
-            name[n++] = '/';
-          name[n] = '\0';
-          strncat (name, file, len);
-
-          if (!access (name, R_OK))
-            return strdup (name);
-          if (ext)
-            {
-              strcat (name, ext);
-              if (!access (name, R_OK))
-                return strdup (name);
-            }
-        }
-    }
-  return NULL;
-}
-
-char *
-rxvt_File_find (const char *file, const char *ext, const char *path) NOTHROW
-{
-  char           *f;
-
-  if (file == NULL || *file == '\0')
-    return NULL;
-
-  f = rxvt_File_search_path (path, file, ext);
-
-  return f;
-}
-#endif
 
 
index 65226aabf41e65ea948a8895d037d42e9b0c6481..90d6fd2d67e3daaa0b93f44cdda1b159b1857ede 100644 (file)
@@ -136,7 +136,6 @@ char           * rxvt_Str_trim                    (char *str) NOTHROW;
 int              rxvt_Str_escaped                 (char *str) NOTHROW;
 char          ** rxvt_splitcommastring            (const char *cs) NOTHROW;
 void             rxvt_freecommastring             (char **cs) NOTHROW;
-char           * rxvt_File_find                   (const char *file, const char *ext, const char *path) NOTHROW;
 
 /////////////////////////////////////////////////////////////////////////////
 
index c9a018532435b230370f360f92d946223e06c0b3..025ce5f57eb3a8a869f78f1f1532c280f03830bf 100644 (file)
--- a/src/xpm.C
+++ b/src/xpm.C
 
 #ifdef XPM_BACKGROUND
 
+#ifndef HAVE_AFTERIMAGE
+/*
+ * 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
+ */
+static char *
+rxvt_File_search_path (const char *pathlist, const char *file, const char *ext)
+{
+  int             maxpath, len;
+  const char     *p, *path;
+  char            name[256];
+
+  if (!access (file, R_OK))    /* found (plain name) in current directory */
+    return strdup (file);
+
+  /* semi-colon delimited */
+  if ((p = strchr (file, ';')))
+    len = (p - file);
+  else
+    len = strlen (file);
+
+  /* leave room for an extra '/' and trailing '\0' */
+  maxpath = sizeof (name) - (len + (ext ? strlen (ext) : 0) + 2);
+  if (maxpath <= 0)
+    return NULL;
+
+  /* check if we can find it now */
+  strncpy (name, file, len);
+  name[len] = '\0';
+
+  if (!access (name, R_OK))
+    return strdup (name);
+  if (ext)
+    {
+      strcat (name, ext);
+      if (!access (name, R_OK))
+        return strdup (name);
+    }
+  for (path = pathlist; path != NULL && *path != '\0'; path = p)
+    {
+      int             n;
+
+      /* colon delimited */
+      if ((p = strchr (path, ':')) == NULL)
+        p = strchr (path, '\0');
+
+      n = (p - path);
+      if (*p != '\0')
+        p++;
+
+      if (n > 0 && n <= maxpath)
+        {
+          strncpy (name, path, n);
+          if (name[n - 1] != '/')
+            name[n++] = '/';
+          name[n] = '\0';
+          strncat (name, file, len);
+
+          if (!access (name, R_OK))
+            return strdup (name);
+          if (ext)
+            {
+              strcat (name, ext);
+              if (!access (name, R_OK))
+                return strdup (name);
+            }
+        }
+    }
+  return NULL;
+}
+
 /*
  * Calculate tiling sizes and increments
  * At start, p == 0, incr == xpmwidthheight
@@ -103,6 +176,7 @@ rxvt_pixmap_incr (unsigned int *wh, unsigned int *xy, float *incr, float *p, uns
   *incr = cincr;
   *p = cp;
 }
+#endif
 
 /*
  * These GEOM strings indicate absolute size/position:
@@ -432,7 +506,7 @@ rxvt_term::set_bgPixmap (const char *file)
                            | XpmDepth | XpmSize | XpmReturnPixels);
 
       /* search environment variables here too */
-      f = (char *)rxvt_File_find (file, ".xpm", rs[Rs_path]);
+      f = rxvt_File_search_path (rs[Rs_path], file, ".xpm");
       if (f == NULL
           || XpmReadFileToPixmap (dpy, display->root, f,
                                   &bgPixmap.pixmap, NULL,