Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manuals: Fix escaping for (some) backslashes #1526

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/echo/echo.1
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ manual page.
.Sh EXAMPLES
Special treatment of options and backslashes:
.Bd -literal -offset indent
$ /bin/echo "-hello\\tworld"
$ /bin/echo "-hello\etworld"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to elaborate on the "maintainability" thing... anybody looking at the source code for echo.1 will recognize the previous text. "Ok, it says \\tworld, which is clearly a \t tab, but with the backslashes escaped."

Whereas the "correct" source is \etworld. Which to my eyes, looks like "some kind of special \e command, followed by tworld. What on earth does tworld mean? That must be a typo, surely!"

-hello\tworld
.Ed
.Pp
Expand All @@ -104,7 +104,7 @@ helloworld
.Pp
Or to achieve the same result:
.Bd -literal -offset indent
$ /bin/echo "hello\\c";/bin/echo world
$ /bin/echo "hello\ec";/bin/echo world
helloworld
.Ed
.Sh SEE ALSO
Expand Down
12 changes: 6 additions & 6 deletions bin/ed/ed.1
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ the standard output of
executed via
.Xr sh 1 .
To read a file whose name begins with a bang, prefix the
name with a backslash (\\).
name with a backslash (\e).
The default filename is set to
.Ar file
only if it is not prefixed with a bang.
Expand Down Expand Up @@ -485,7 +485,7 @@ All
commands are single characters, though some require additional parameters.
If a command's parameters extend over several lines, then
each line except for the last
must be terminated with a backslash (\\).
must be terminated with a backslash (\e).
.Pp
In general, at most one command is allowed per line.
However, most commands accept a print suffix, which is any of
Expand Down Expand Up @@ -579,7 +579,7 @@ Each command in
.Ar command-list
must be on a separate line,
and every line except for the last must be terminated by a backslash
(\\).
(\e).
Any commands are allowed, except for
.Em g ,
.Em G ,
Expand Down Expand Up @@ -765,7 +765,7 @@ then
from the last substitution is used.
Newlines may be embedded in
.Ar replacement
if they are escaped with a backslash (\\).
if they are escaped with a backslash (\e).
.It (.,.)s
Repeat the last substitution.
This form of the
Expand Down Expand Up @@ -883,7 +883,7 @@ The
.Nm
utility does not process
.Ar command
for backslash (\\) escapes.
for backslash (\e) escapes.
However, an unescaped
.Em %
is replaced by the default filename.
Expand Down Expand Up @@ -976,7 +976,7 @@ The
utility processes
.Ar file
arguments for backslash escapes, i.e., in a filename,
any characters preceded by a backslash (\\) are
any characters preceded by a backslash (\e) are
interpreted literally.
.Pp
If a text (non-binary) file is not terminated by a newline character,
Expand Down
6 changes: 3 additions & 3 deletions bin/pax/pax.1
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ As in
.Cm old
is a basic regular expression and
.Cm new
can contain an ampersand (&), \\n (where n is a digit) back-references,
can contain an ampersand (&), \en (where n is a digit) back-references,
or subexpression matching.
The
.Cm old
Expand Down Expand Up @@ -850,7 +850,7 @@ Select a file based on its
name, or when starting with a
.Cm # ,
a numeric gid.
A '\\' can be used to escape the
A '\e' can be used to escape the
.Cm # .
Multiple
.Fl G
Expand Down Expand Up @@ -971,7 +971,7 @@ Select a file based on its
name, or when starting with a
.Cm # ,
a numeric uid.
A '\\' can be used to escape the
A '\e' can be used to escape the
.Cm # .
Multiple
.Fl U
Expand Down
2 changes: 1 addition & 1 deletion bin/stty/stty.1
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ Otherwise control characters
echo as themselves.
.It Cm echoprt Pq Fl echoprt
For printing terminals.
If set, echo erased characters backwards within ``\\''
If set, echo erased characters backwards within ``\e''
and ``/''.
Otherwise, disable this feature.
.It Cm noflsh Pq Fl noflsh
Expand Down
2 changes: 1 addition & 1 deletion bin/timeout/timeout.1
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ signal after 1 minute and send a
.Va SIGKILL
signal 5 seconds later if the process refuses to stop:
.Bd -literal -offset indent
$ timeout -k 5s 1m fetch \\
$ timeout -k 5s 1m fetch \e
> https://download.freebsd.org/ftp/doc/en/books/handbook/book.pdf
.Ed
.Sh SEE ALSO
Expand Down
4 changes: 2 additions & 2 deletions lib/libc/gen/dlinfo.3
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Link_map *map;
dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map);

while (map != NULL) {
printf("%p: %s\\n", map->l_addr, map->l_name);
printf("%p: %s\en", map->l_addr, map->l_name);
map = map->l_next;
}
.Ed
Expand Down Expand Up @@ -257,7 +257,7 @@ dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info);
path = &info->dls_serpath[0];

for (cnt = 1; cnt <= info->dls_cnt; cnt++, path++) {
(void) printf("%2d: %s\\n", cnt, path->dls_name);
(void) printf("%2d: %s\en", cnt, path->dls_name);
}
.Ed
.Sh SEE ALSO
Expand Down
4 changes: 2 additions & 2 deletions lib/libc/gen/ftw.3
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ nftw_callback(const char *path, const struct stat *sb, int typeflag, struct FTW
break;
}

printf("[%c] %s\\n", type, path);
printf("[%c] %s\en", type, path);

return (0);
}
Expand All @@ -209,7 +209,7 @@ main(int argc, char **argv)
{

if (argc != 2) {
printf("Usage %s <directory>\\n", argv[0]);
printf("Usage %s <directory>\en", argv[0]);
return (EX_USAGE);
} else
return (nftw(argv[1], nftw_callback, /* UNUSED */ 1, 0));
Expand Down
4 changes: 2 additions & 2 deletions lib/libc/stdlib/strfmon.3
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ main(void)
double money = 1234567.89;

if (setlocale(LC_MONETARY, "en_US.UTF-8") == NULL) {
fprintf(stderr, "Unable to setlocale().\\n");
fprintf(stderr, "Unable to setlocale().\en");
return (1);
}

strfmon(string, sizeof(string) - 1, "%n", money);
printf("%s\\n", string);
printf("%s\en", string);

return (0);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/libcasper/services/cap_dns/cap_dns.3
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ error = cap_getnameinfo(capdns, res->ai_addr, res->ai_addrlen, hname, sizeof(hna
if (error != 0)
errx(1, "cap_getnameinfo(): %s: %s", ipstr, gai_strerror(error));

printf("Name associated with %s is %s.\\n", ipstr, hname);
printf("Name associated with %s is %s.\en", ipstr, hname);
.Ed
.Sh SEE ALSO
.Xr cap_enter 2 ,
Expand Down
2 changes: 1 addition & 1 deletion lib/libcasper/services/cap_grp/cap_grp.3
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ group = cap_getgrgid(capgrp, gid[0]);
if (group == NULL)
err(1, "Unable to get name of group");

printf("GID %d is associated with name %s.\\n", gid[0], group->gr_name);
printf("GID %d is associated with name %s.\en", gid[0], group->gr_name);

cap_close(capgrp);
.Ed
Expand Down
2 changes: 1 addition & 1 deletion lib/libcasper/services/cap_pwd/cap_pwd.3
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ passwd = cap_getpwuid(cappwd, uid[0]);
if (passwd == NULL)
err(1, "Unable to get name of user");

printf("UID %d is associated with name %s.\\n", uid[0], passwd->pw_name);
printf("UID %d is associated with name %s.\en", uid[0], passwd->pw_name);

cap_close(cappwd);
.Ed
Expand Down
2 changes: 1 addition & 1 deletion lib/libcasper/services/cap_sysctl/cap_sysctl.3
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ size = sizeof(value);
if (cap_sysctlbyname(capsysctl, name, &value, &size, NULL, 0) < 0)
err(1, "Unable to get value of sysctl");

printf("The value of %s is %d.\\n", name, value);
printf("The value of %s is %d.\en", name, value);

cap_close(capsysctl);
.Ed
Expand Down
4 changes: 2 additions & 2 deletions lib/libdpv/dpv.3
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ Embed escaped newlines within prompt text to force line breaks.
.Pp
.Xr dialog 1
does not display the first character after a series of escaped escape-sequences
(for example, ``\\\\n'' produces ``\\'' instead of ``\\n'').
(for example, ``\e\en'' produces ``\e'' instead of ``\en'').
This is a known issue with
.Xr dialog 1
and does not affect
Expand Down Expand Up @@ -522,7 +522,7 @@ This does not effect
which renders the color escape sequences as plain text.
See
.Do
embedded "\\Z" sequences
embedded "\eZ" sequences
.Dc
in
.Xr dialog 1
Expand Down
2 changes: 1 addition & 1 deletion lib/libgssapi/gss_display_status.3
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ do {
&status_string)

fprintf(stderr,
"%.*s\\n",
"%.*s\en",
(int)status_string.length,
(char *)status_string.value);

Expand Down
2 changes: 1 addition & 1 deletion lib/libmixer/mixer.3
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ if ((m = mixer_open(mix_name)) == NULL)

TAILQ_FOREACH(dp, &m->devs, devs) {
if (M_ISRECSRC(m, dp->devno))
printf("%s\\t%.2f:%.2f\\n",
printf("%s\et%.2f:%.2f\en",
dp->name, dp->vol.left, dp->vol.right);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/libpam/modules/pam_login_access/pam_login_access.8
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ changes the field separator from the default ":".
More than one separator
may be specified.
.It Cm listsep Ns = Ns Ar separators
changes the field separator from the default space (''), tab (\\t) and
changes the field separator from the default space (''), tab (\et) and
comma (,).
More than one separator may be specified.
For example, listsep=;
Expand Down
2 changes: 1 addition & 1 deletion lib/libstdbuf/libstdbuf.3
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ is used to force it to be line-buffered so
.Xr vmstat 8 Ns 's
output will not stall until the full buffer fills.
.Bd -literal -offset indent
# vmstat 1 | LD_PRELOAD=/usr/lib/libstdbuf.so \\
# vmstat 1 | LD_PRELOAD=/usr/lib/libstdbuf.so \e
STDBUF_1=L awk '$2 > 1 || $3 > 1' | cat -n
.Ed
.Pp
Expand Down
2 changes: 1 addition & 1 deletion lib/libutil/login.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ and
characters, which are substituted for a user's home directory and name
respectively.
To pass these characters literally into the environment variable, escape
the character by preceding it with a backslash '\\'.
the character by preceding it with a backslash '\e'.
.Pp
The
.Em host.allow
Expand Down
22 changes: 11 additions & 11 deletions libexec/bootpd/bootptab.5
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ Blank lines and lines beginning with "#" are ignored in the configuration
file.
Host entries are separated from one another by newlines; a single host
entry may be extended over multiple lines if the lines end with a backslash
(\\).
(\e).
It is also acceptable for lines to be longer than 80 characters.
Tags
may appear in any order, with the following exceptions: the hostname must be
Expand All @@ -389,13 +389,13 @@ file follows:
.Bd -literal -offset indent
# Sample bootptab file (domain=andrew.cmu.edu)

\&.default:\\
:hd=/usr/boot:bf=null:\\
:ds=netserver, lancaster:\\
:ns=pcs2, pcs1:\\
:ts=pcs2, pcs1:\\
:sm=255.255.255.0:\\
:gw=gw.cs.cmu.edu:\\
\&.default:\e
:hd=/usr/boot:bf=null:\e
:ds=netserver, lancaster:\e
:ns=pcs2, pcs1:\e
:ts=pcs2, pcs1:\e
:sm=255.255.255.0:\e
:gw=gw.cs.cmu.edu:\e
:hn:to=-18000:

carnegie:ht=6:ha=7FF8100000AF:tc=.default:
Expand All @@ -406,9 +406,9 @@ bairdford:ht=1:ha=08002B02A2F9:tc=.default:
bakerstown:ht=1:ha=08002B0287C8:tc=.default:

# Special domain name server and option tags for next host
butlerjct:ha=08002001560D:ds=128.2.13.42:\\
:T37=0x12345927AD3BCF:\\
:T99="Special ASCII string":\\
butlerjct:ha=08002001560D:ds=128.2.13.42:\e
:T37=0x12345927AD3BCF:\e
:T99="Special ASCII string":\e
:tc=.default:

gastonville:ht=6:ha=7FFF81000A47:tc=.default:
Expand Down
2 changes: 1 addition & 1 deletion libexec/comsat/comsat.8
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ the group execute bit turned on (by a
.Dq Nm biff Cm b ) ,
two bell characters
.Tn ( ASCII
\\007) are printed on the user's terminal.
\e007) are printed on the user's terminal.
.Pp
If
.Ar mailbox-name
Expand Down
2 changes: 1 addition & 1 deletion sbin/ccdconfig/ccdconfig.8
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ and read it from
.Fx .
.Bd -literal
# Create a RAID-0 on Linux:
mdadm --create --chunk=32 --level=0 --raid-devices=2 /dev/md0 \\
mdadm --create --chunk=32 --level=0 --raid-devices=2 /dev/md0 \e
/dev/hda1 /dev/hdb1
# Make the RAID-0 just created available on FreeBSD:
ccdconfig -c /dev/ccd0 32 linux /dev/ada0s1 /dev/ada0s2
Expand Down
2 changes: 1 addition & 1 deletion sbin/dumpon/dumpon.8
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ on the vtnet0 interface, add the following to
.Bd -literal
case $reason in
BOUND|REBIND|REBOOT|RENEW)
if [ "$interface" != vtnet0 ] || [ -n "$old_ip_address" -a \\
if [ "$interface" != vtnet0 ] || [ -n "$old_ip_address" -a \e
"$old_ip_address" = "$new_ip_address" ]; then
break
fi
Expand Down
Loading