summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/find/find.13
-rw-r--r--usr.bin/gcore/elfcore.c6
-rw-r--r--usr.bin/netstat/inet.c18
-rw-r--r--usr.bin/sed/compile.c26
4 files changed, 29 insertions, 24 deletions
diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1
index 824b917..dee5e04 100644
--- a/usr.bin/find/find.1
+++ b/usr.bin/find/find.1
@@ -312,6 +312,7 @@ character in its pathname relative to
.Dq Pa \&.
for security reasons.
Depth-first traversal processing is implied by this option.
+Following symlinks is incompatible with this option.
.It Ic -depth
Always true;
same as the
@@ -920,7 +921,7 @@ recent than the current time minus one minute.
Use the
.Xr echo 1
command to print out a list of all the files.
-.It Li "find -L /usr/ports/packages -type l -delete"
+.It Li "find -L /usr/ports/packages -type l -exec rm -- {} +"
Delete all broken symbolic links in
.Pa /usr/ports/packages .
.It Li "find /usr/src -name CVS -prune -o -depth +6 -print"
diff --git a/usr.bin/gcore/elfcore.c b/usr.bin/gcore/elfcore.c
index a5acaf1..6c90708 100644
--- a/usr.bin/gcore/elfcore.c
+++ b/usr.bin/gcore/elfcore.c
@@ -158,7 +158,7 @@ elf_coredump(int efd __unused, int fd, pid_t pid)
err(1, "read from %s", memname);
if ((size_t)ngot < nwant)
errx(1, "short read from %s:"
- " wanted %zd, got %zd", memname,
+ " wanted %zu, got %zd", memname,
nwant, ngot);
ngot = write(fd, buf, nwant);
if (ngot == -1)
@@ -414,7 +414,7 @@ readhdrinfo(pid_t pid, prstatus_t *status, prfpregset_t *fpregset,
if ((n = read(fd, &status->pr_reg, sizeof status->pr_reg)) == -1)
err(1, "read error from %s", name);
if ((size_t)n < sizeof(status->pr_reg))
- errx(1, "short read from %s: wanted %zd, got %d", name,
+ errx(1, "short read from %s: wanted %zu, got %d", name,
sizeof status->pr_reg, n);
close(fd);
@@ -425,7 +425,7 @@ readhdrinfo(pid_t pid, prstatus_t *status, prfpregset_t *fpregset,
if ((n = read(fd, fpregset, sizeof *fpregset)) == -1)
err(1, "read error from %s", name);
if ((size_t)n < sizeof(*fpregset))
- errx(1, "short read from %s: wanted %zd, got %d", name,
+ errx(1, "short read from %s: wanted %zu, got %d", name,
sizeof *fpregset, n);
close(fd);
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index da07e1d..65884ad 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -355,6 +355,7 @@ protopr(u_long off, const char *name, int af1, int proto)
} else {
inp = &((struct xinpcb *)xig)->xi_inp;
so = &((struct xinpcb *)xig)->xi_socket;
+ timer = NULL;
}
/* Ignore sockets for protocols other than the desired one. */
@@ -425,7 +426,7 @@ protopr(u_long off, const char *name, int af1, int proto)
printf("%7.7s %7.7s %7.7s %7.7s %7.7s %7.7s %s\n",
"rexmt", "persist", "keep",
"2msl", "delack", "rcvtime",
- "(state)");
+ "(state)");
} else
printf("(state)\n");
}
@@ -529,13 +530,14 @@ protopr(u_long off, const char *name, int af1, int proto)
so->so_rcv.sb_lowat, so->so_snd.sb_lowat,
so->so_rcv.sb_mbcnt, so->so_snd.sb_mbcnt,
so->so_rcv.sb_mbmax, so->so_snd.sb_mbmax);
- printf("%4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d ",
- timer->tt_rexmt / 1000, (timer->tt_rexmt % 1000) / 10,
- timer->tt_persist / 1000, (timer->tt_persist % 1000) / 10,
- timer->tt_keep / 1000, (timer->tt_keep % 1000) / 10,
- timer->tt_2msl / 1000, (timer->tt_2msl % 1000) / 10,
- timer->tt_delack / 1000, (timer->tt_delack % 1000) / 10,
- timer->t_rcvtime / 1000, (timer->t_rcvtime % 1000) / 10);
+ if (timer != NULL)
+ printf("%4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d ",
+ timer->tt_rexmt / 1000, (timer->tt_rexmt % 1000) / 10,
+ timer->tt_persist / 1000, (timer->tt_persist % 1000) / 10,
+ timer->tt_keep / 1000, (timer->tt_keep % 1000) / 10,
+ timer->tt_2msl / 1000, (timer->tt_2msl % 1000) / 10,
+ timer->tt_delack / 1000, (timer->tt_delack % 1000) / 10,
+ timer->t_rcvtime / 1000, (timer->t_rcvtime % 1000) / 10);
}
}
if (istcp && !Lflag) {
diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c
index 53e2af7..cea8e07 100644
--- a/usr.bin/sed/compile.c
+++ b/usr.bin/sed/compile.c
@@ -66,7 +66,7 @@ static struct labhash {
static char *compile_addr(char *, struct s_addr *);
static char *compile_ccl(char **, char *);
-static char *compile_delimited(char *, char *);
+static char *compile_delimited(char *, char *, int);
static char *compile_flags(char *, struct s_subst *);
static regex_t *compile_re(char *, int);
static char *compile_subst(char *, struct s_subst *);
@@ -320,7 +320,7 @@ nonsel: /* Now parse the command */
linenum, fname);
if ((cmd->u.s = calloc(1, sizeof(struct s_subst))) == NULL)
err(1, "malloc");
- p = compile_delimited(p, re);
+ p = compile_delimited(p, re, 0);
if (p == NULL)
errx(1,
"%lu: %s: unterminated substitute pattern", linenum, fname);
@@ -373,7 +373,7 @@ nonsel: /* Now parse the command */
* with the processed string.
*/
static char *
-compile_delimited(char *p, char *d)
+compile_delimited(char *p, char *d, int is_tr)
{
char c;
@@ -387,7 +387,7 @@ compile_delimited(char *p, char *d)
errx(1, "%lu: %s: newline can not be used as a string delimiter",
linenum, fname);
while (*p) {
- if (*p == '[') {
+ if (*p == '[' && *p != c) {
if ((d = compile_ccl(&p, d)) == NULL)
errx(1, "%lu: %s: unbalanced brackets ([])", linenum, fname);
continue;
@@ -399,9 +399,12 @@ compile_delimited(char *p, char *d)
*d++ = '\n';
p += 2;
continue;
- } else if (*p == '\\' && p[1] == '\\')
- *d++ = *p++;
- else if (*p == c) {
+ } else if (*p == '\\' && p[1] == '\\') {
+ if (is_tr)
+ p++;
+ else
+ *d++ = *p++;
+ } else if (*p == c) {
*d = '\0';
return (p + 1);
}
@@ -429,8 +432,7 @@ compile_ccl(char **sp, char *t)
for (c = *s; (*t = *s) != ']' || c != d; s++, t++)
if ((c = *s) == '\0')
return NULL;
- } else if (*s == '\\' && s[1] == 'n')
- *t = '\n', s++;
+ }
return (*s == ']') ? *sp = ++s, ++t : NULL;
}
@@ -654,11 +656,11 @@ compile_tr(char *p, struct s_tr **py)
errx(1,
"%lu: %s: transform pattern can not be delimited by newline or backslash",
linenum, fname);
- p = compile_delimited(p, old);
+ p = compile_delimited(p, old, 1);
if (p == NULL)
errx(1, "%lu: %s: unterminated transform source string",
linenum, fname);
- p = compile_delimited(p - 1, new);
+ p = compile_delimited(p - 1, new, 1);
if (p == NULL)
errx(1, "%lu: %s: unterminated transform target string",
linenum, fname);
@@ -781,7 +783,7 @@ compile_addr(char *p, struct s_addr *a)
++p;
/* FALLTHROUGH */
case '/': /* Context address */
- p = compile_delimited(p, re);
+ p = compile_delimited(p, re, 0);
if (p == NULL)
errx(1, "%lu: %s: unterminated regular expression", linenum, fname);
/* Check for case insensitive regexp flag */
OpenPOWER on IntegriCloud