X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmountlist.c;h=138fd227267b1aba48c432da3c5862a11ecca0c3;hb=abde38362f9239723c9b762d1b2ac41af575e6d5;hp=c2c77b3f0a620a3935127a09f5c216dc3806e8c3;hpb=34bd051ef6e5edb9df5a8f274a7b7afbbdda3470;p=gnulib.git diff --git a/lib/mountlist.c b/lib/mountlist.c index c2c77b3f0..138fd2272 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -151,46 +151,6 @@ xatoi (char *cp) } return val; } - -/* Convert, in place, each unambiguous `\040' sequence in the NUL-terminated - string, STR, to a single space. `unambiguous' means that it must not be - immediately preceded by an odd number of backslash characters. */ - -static void -translate_040_to_space (char *str) -{ - while (1) - { - char *p; - char *backslash = strstr (str, "\\040"); - unsigned int backslash_count = 0; - - if (backslash == NULL) - break; - - /* Count preceding backslashes, going no further than str. */ - for (p = backslash - 1; p >= str && *p == '\\'; p--) - ++backslash_count; - - if (backslash_count % 2 == 1) - { - /* The backslash is escaped; advance past the 040 and - continue searching. */ - str = backslash + 4; - continue; - } - - /* We found an unambiguous `\040'. Replace it with a space - and move everything following it back by 3 bytes. - The source and destination regions may overlap, so we have - to use memmove. */ - *backslash = ' '; - str = backslash + 1; - /* Be sure to copy the trailing NUL byte, too. */ - memmove (str, backslash + 4, strlen (backslash + 4) + 1); - } -} - #endif /* MOUNTED_GETMNTENT1. */ #if MOUNTED_GETMNTINFO @@ -389,11 +349,6 @@ read_filesystem_list (int need_fs_type) else me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ - /* FIXME: do the conversion only if we're using some version of - GNU libc -- which one? */ - /* Convert each `\040' string to a space. */ - translate_040_to_space (me->me_mountdir); - /* Add to the linked list. */ *mtail = me; mtail = &me->me_next; @@ -717,18 +672,3 @@ read_filesystem_list (int need_fs_type) return NULL; } } - -#ifdef TEST -int -main (int argc, char **argv) -{ - int i; - for (i = 1; i < argc; i++) - { - char *p = xstrdup (argv[i]); - translate_040_to_space (p); - printf ("%s: %s\n", argv[i], p); - } - exit (0); -} -#endif