Compare commits

...

9 Commits

Author SHA1 Message Date
Jim Meyering
7786c6e2cf . 1996-07-03 04:18:38 +00:00
Jim Meyering
4bd1ffa49a . 1996-07-03 04:05:07 +00:00
Jim Meyering
38762b8f78 (usage): Add omitted \n\ at the end of a line in the usage message. 1996-07-03 04:04:06 +00:00
Jim Meyering
7b2cea5ab2 [!EXIT_SUCCESS]: Define it.
[!EXIT_FAILURE]: Define it.
1996-07-03 04:00:36 +00:00
Jim Meyering
b0d3bfa316 . 1996-07-03 04:00:29 +00:00
Jim Meyering
1672bf6d27 (strndup): Include stdio.h and sys/types.h to
get definition of NULL and size_t on SunOS4.1.3.
1996-07-03 03:59:02 +00:00
Jim Meyering
8736952b0b . 1996-07-03 02:52:20 +00:00
Jim Meyering
bd1fc1c256 . 1996-07-02 04:55:06 +00:00
Jim Meyering
bb4d193ac7 [NEWLINE_REPLACEMENT_STRING]: Define.
(split_3): Translate NL bytes not to NUL, but to
NEWLINE_REPLACEMENT_STRING.
Suggested by Ulrich Drepper.
(main): Translate back to NL-containing filename.
1996-07-02 04:54:51 +00:00
6 changed files with 74 additions and 17 deletions

View File

@@ -21,6 +21,9 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
# include "config.h"
#endif
#include <stdio.h>
#include <sys/types.h>
#ifdef STDC_HEADERS
# include <string.h>
# include <stdlib.h>

View File

@@ -1,3 +1,13 @@
Tue Jul 2 22:56:03 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (VERSION): Bump to 3.12q.
* src/system.h [!EXIT_SUCCESS]: Define it.
[!EXIT_FAILURE]: Define it.
* lib/strndup.c (strndup): Include stdio.h and sys/types.h to
get definition of NULL and size_t on SunOS4.1.3.
Mon Jul 1 23:47:29 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/ln.c (do_link): Update messages to ease translation.

View File

@@ -1,7 +1,27 @@
Tue Jul 2 21:51:40 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (ALL_LINGUAS): Add dutch (nl).
Mon Jul 1 23:50:19 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/md5sum.c [NEWLINE_REPLACEMENT_STRING]: Define.
(split_3): Translate NL bytes not to NUL, but to
NEWLINE_REPLACEMENT_STRING.
Suggested by Ulrich Drepper.
(main): Translate back to NL-containing filename.
Sun Jun 30 22:42:17 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/md5sum.c (split_3): Take an additional parameter, S_LEN.
Adapt caller.
Map translated NEWLINE-containing filename back into the original
NEWLINE-containing name.
(md5_check): Translate NEWLINE bytes to NUL bytes in filename.
Sat Jun 29 18:59:07 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (PACKAGE_VERSION): Add `GNU ' prefix so we see
it in the output of --version. Reported by RMS.
* configure.in (PACKAGE_VERSION): Add `GNU ' prefix so it
appears in the output of --version. Reported by RMS.
Wed Jun 26 21:35:10 1996 Jim Meyering <meyering@na-net.ornl.gov>

View File

@@ -2738,7 +2738,7 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
--version output version information and exit\n\
\n\
By default, color is not used to distinguish types of files. That is\n\
equivalent to using --color=none. Using the --color option without the
equivalent to using --color=none. Using the --color option without the\n\
optional WHEN argument is equivalent to using --color=always. With\n\
--color=auto, color codes are output only if standard output is connected\n\
to a terminal (tty).\n\

View File

@@ -59,6 +59,14 @@
# define TOLOWER(c) (ISUPPER (c) ? tolower (c) : (c))
#endif
/* The string with which to replace NEWLINE characters in filenames.
This is required to make it so md5sum --check can parse the output
of `md5sum FILENAME' for FILENAME contain NL characters. */
#define NEWLINE_REPLACEMENT_STRING "<\"NL'\\>"
#define NEWLINE_REPLACEMENT_STRING_LENGTH \
(sizeof (NEWLINE_REPLACEMENT_STRING) - 1)
/* Nonzero if any of the files read were the standard input. */
static int have_read_stdin;
@@ -136,6 +144,7 @@ split_3 (char *s, size_t s_len, char **u, int *binary, char **w)
message digest information. */
if (s_len >= 32 + 2 + 1)
{
char *p;
*u = &s[i];
/* The first field has to be the 32-character hexadecimal
@@ -155,12 +164,17 @@ split_3 (char *s, size_t s_len, char **u, int *binary, char **w)
significant -- that includes leading and trailing white space. */
*w = &s[i];
/* Translate each NUL byte in the file name to a NEWLINE.
But not the last. */
for (/* empty */ ; i < s_len; ++i)
/* Translate each NEWLINE_REPLACEMENT_STRING in the file name
to a NEWLINE. */
p = &s[i];
while ((p = strstr (p, NEWLINE_REPLACEMENT_STRING)))
{
if (s[i] == '\0')
s[i] = '\n';
size_t len;
*p++ = '\n';
len = s_len - (p - s) - (NEWLINE_REPLACEMENT_STRING_LENGTH - 1) + 1;
memmove (p, p + NEWLINE_REPLACEMENT_STRING_LENGTH - 1, len);
s_len -= NEWLINE_REPLACEMENT_STRING_LENGTH - 1;
}
return 0;
}
@@ -277,8 +291,6 @@ md5_check (const char *checkfile_name, int binary)
if (line[line_length - 1] == '\n')
line[--line_length] = '\0';
/* FIXME: filename might contain NUL bytes. Map then to NEWLINEs
in split_3. */
err = split_3 (line, line_length, &md5num, &type_flag, &filename);
if (err || !hex_digits (md5num))
{
@@ -529,17 +541,17 @@ main (int argc, char **argv)
else
putchar (' ');
/* Translate NEWLINE bytes to NUL bytes.
But first record the length of the filename, FILE. */
/* Translate each NEWLINE byte to the string,
NEWLINE_REPLACEMENT_STRING. But first record
the length of the filename, FILE. */
filename_len = strlen (file);
for (i = 0; i < strlen (file); ++i)
for (i = 0; i < filename_len; ++i)
{
if (file[i] == '\n')
file[i] = '\0';
fputs (NEWLINE_REPLACEMENT_STRING, stdout);
else
putchar (file[i]);
}
/* Use fwrite, not printf, to output FILE --
now it may contain NUL bytes. */
fwrite (file, sizeof (char), filename_len, stdout);
putchar ('\n');
}
}

View File

@@ -179,6 +179,18 @@ extern int errno;
char *getenv ();
#endif /* STDC_HEADERS */
/* The following test is to work around the gross typo in
systems like Sony NEWS-OS Release 4.0C, whereby EXIT_FAILURE
is defined to 0, not 1. */
#if !EXIT_FAILURE
# undef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#else