Allow tabs and returns to occur in text-files
authorFabian Groffen <grobian@gentoo.org>
Thu, 11 Mar 2010 20:59:05 +0000 (20:59 -0000)
committerFabian Groffen <grobian@gentoo.org>
Thu, 11 Mar 2010 20:59:05 +0000 (20:59 -0000)
svn path=/main/branches/prefix/; revision=15819

src/chpathtool.c

index 4c9c0dad0e2aa9e13162b2fc6e879f71dc6b8f0d..31b89fec87e987586ef9a688de59db237a436ec0 100644 (file)
@@ -147,7 +147,9 @@ static int chpath(const char *fi, const char *fo) {
                                /* this is a very stupid assumption, but I don't know
                                 * anything better: if we find a byte that's out of
                                 * ASCII character scope, we assume this is binary */
-                               if (buf[pos] < ' ' || buf[pos] > '~') {
+                               if ((buf[pos] < ' ' || buf[pos] > '~') &&
+                                               strchr("\t\r\n", buf[pos]) == NULL)
+                               {
                                        /* Make sure we don't mess up code, GCC for instance
                                         * hardcodes the result of strlen("string") in
                                         * object code.  This means we can nicely replace