Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
	* misc/mntent_r.c (decode_name): Fix decoding of tab, add decoding
	of newline.
	* manual/sysinfo.texi (mtab): Adjust description accordingly.
	Reported by Andries.Brouwer@cwi.nl.
  • Loading branch information
Ulrich Drepper committed Nov 29, 2003
1 parent bb3f482 commit 37369d1
Show file tree
Hide file tree
Showing 4 changed files with 360 additions and 126 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
2003-11-28 Ulrich Drepper <drepper@redhat.com>

* misc/mntent_r.c (decode_name): Fix decoding of tab, add decoding
of newline.
* manual/sysinfo.texi (mtab): Adjust description accordingly.
Reported by Andries.Brouwer@cwi.nl.

* sysdeps/x86_64/fpu/libm-test-ulps: Add some more minor changes
to compensate other setup.

Expand Down
13 changes: 7 additions & 6 deletions manual/sysinfo.texi
Original file line number Diff line number Diff line change
Expand Up @@ -673,12 +673,13 @@ filled with the information from the next entry from the file currently
read.

The file format used prescribes the use of spaces or tab characters to
separate the fields. This makes it harder to use name containing one of
these characters (e.g., mount points using spaces). Therefore these
characters are encoded in the files and the @code{getmntent} function
takes care of the decoding while reading the entries back in.
@code{'\040'} is used to encode a space character, @code{'\012'} to
encode a tab character and @code{'\\'} to encode a backslash.
separate the fields. This makes it harder to use name containing one
of these characters (e.g., mount points using spaces). Therefore
these characters are encoded in the files and the @code{getmntent}
function takes care of the decoding while reading the entries back in.
@code{'\040'} is used to encode a space character, @code{'\011'} to
encode a tab character, @code{'\012'} to encode a newline character,
and @code{'\\'} to encode a backslash.

If there was an error or the end of the file is reached the return value
is @code{NULL}.
Expand Down
8 changes: 7 additions & 1 deletion misc/mntent_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,18 @@ decode_name (char *buf)
*wp++ = ' ';
rp += 3;
}
else if (rp[0] == '\\' && rp[1] == '0' && rp[2] == '1' && rp[3] == '2')
else if (rp[0] == '\\' && rp[1] == '0' && rp[2] == '1' && rp[3] == '1')
{
/* \012 is a TAB. */
*wp++ = '\t';
rp += 3;
}
else if (rp[0] == '\\' && rp[1] == '0' && rp[2] == '1' && rp[3] == '2')
{
/* \012 is a NEWLINE. */
*wp++ = '\n';
rp += 3;
}
else if (rp[0] == '\\' && rp[1] == '\\')
{
/* We have to escape \\ to be able to represent all characters. */
Expand Down
Loading

0 comments on commit 37369d1

Please sign in to comment.