summaryrefslogtreecommitdiff
path: root/src/md5sum.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-10-04 03:05:37 +0000
committerJim Meyering <jim@meyering.net>1998-10-04 03:05:37 +0000
commit701e23d1e4ed7409d5a538e215f5434e5f777852 (patch)
treee2c9692ba814cd0c3bb6f336f3130cc07f3b5f08 /src/md5sum.c
parent516e60ed10957d163c8f967e5115ccd20f26dcbf (diff)
downloadcoreutils-701e23d1e4ed7409d5a538e215f5434e5f777852.tar.xz
(split_3): Rename local variable, to `escaped_filename'.
(main): Output the leading backslash not just when there's a newline in the file name, but also when there's a backslash.
Diffstat (limited to 'src/md5sum.c')
-rw-r--r--src/md5sum.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/md5sum.c b/src/md5sum.c
index b5834974f..c7b307c25 100644
--- a/src/md5sum.c
+++ b/src/md5sum.c
@@ -132,7 +132,7 @@ static int
split_3 (char *s, size_t s_len, unsigned char **u, int *binary, char **w)
{
size_t i;
- int filename_has_newline = 0;
+ int escaped_filename = 0;
#define ISWHITE(c) ((c) == ' ' || (c) == '\t')
@@ -150,7 +150,7 @@ split_3 (char *s, size_t s_len, unsigned char **u, int *binary, char **w)
if (s[i] == '\\')
{
++i;
- filename_has_newline = 1;
+ escaped_filename = 1;
}
*u = (unsigned char *) &s[i];
@@ -171,7 +171,7 @@ split_3 (char *s, size_t s_len, unsigned char **u, int *binary, char **w)
significant -- that includes leading and trailing white space. */
*w = &s[i];
- if (filename_has_newline)
+ if (escaped_filename)
{
/* Translate each `\n' string in the file name to a NEWLINE,
and each `\\' string to a backslash. */
@@ -575,8 +575,8 @@ verifying checksums"));
size_t i;
/* Output a leading backslash if the file name contains
- a newline. */
- if (strchr (file, '\n'))
+ a newline or backslash. */
+ if (strchr (file, '\n') || strchr (file, '\\'))
putchar ('\\');
for (i = 0; i < 16; ++i)