Filewatcher File Search
FTP Search
  
Directory 
  
Content Search 
   
pkg://fileutils-4.1-10.4.src.rpm:1292396/fileutils-4.0-spacedir.patch  info  downloads

--- fileutils-4.0/src/df.c.gafton	Wed Jul 28 22:40:10 1999
+++ fileutils-4.0/src/df.c	Wed Jul 28 22:44:35 1999
@@ -204,6 +204,35 @@
 	  : human_readable (n, buf, from_block_size, t_output_block_size));
 }
 
+/* Since the values in a line are separated by spaces, a name cannot
+ * contain a space.  Therefore some programs encode spaces in names
+ * by the strings "\040".  We undo the encoding when reading an entry.
+ * The decoding happens in place.  */
+static char * decode_name (char *buf)
+{
+    char *rp = buf;
+    char *wp = buf;
+
+    do
+	if (rp[0] == '\\' && rp[1] == '0' && rp[2] == '4' && rp[3] == '0') {
+	    /* \040 is a SPACE.  */
+	    *wp++ = ' ';
+	    rp += 3;
+	} else if (rp[0] == '\\' && rp[1] == '0' && rp[2] == '1' && rp[3] == '2') {
+	    /* \012 is a TAB.  */
+	    *wp++ = '\t';
+	    rp += 3;
+	} else if (rp[0] == '\\' && rp[1] == '\\') {
+	    /* We have to escape \\ to be able to represent all characters.  */
+	    *wp++ = '\\';
+	    rp += 1;
+	} else
+	    *wp++ = *rp;
+    while (*rp++ != '\0');
+
+    return buf;
+}
+
 /* Display a space listing for the disk device with absolute path DISK.
    If MOUNT_POINT is non-NULL, it is the path of the root of the
    filesystem on DISK.
@@ -232,7 +261,7 @@
      program reports on the filesystem that the special file is on.
      It would be better to report on the unmounted filesystem,
      but statfs doesn't do that on most systems.  */
-  stat_file = mount_point ? mount_point : disk;
+  stat_file = mount_point ? decode_name((char *) mount_point) : disk;
 
   if (get_fs_usage (stat_file, disk, &fsu))
     {
@@ -360,6 +389,7 @@
       else if (strncmp ("/tmp_mnt/", mount_point, 9) == 0)
 	mount_point += 8;
 #endif
+      /* at this point mount_point should ba already decoded */
       printf (" %s", mount_point);
     }
   putchar ('\n');
Results 1 - 1
Help - FTP Sites List - Software Dir.
Searching half a billion files worldwide
© 1997-2009 MARUHN Internet Solutions