diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-05-15 21:19:09 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-05-15 21:19:09 +0000 |
commit | 50972e71ac72c4e624b350ed4e5fa125454d2667 (patch) | |
tree | cdf8bf9cfabb4d12b0d222cd1244b161a3f81e04 | |
parent | e65825e54f1f6e7f5a1f512ebc18a52424ea136b (diff) |
Fix insert-buffer prompt format string. strlcpy returns size_t, not int
(from Han Boetes). Improve error messages (from Han Boetes).
OK otto, jaredy, beck
-rw-r--r-- | usr.bin/mg/buffer.c | 6 | ||||
-rw-r--r-- | usr.bin/mg/dired.c | 13 |
2 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c index c3b66be610d..439d7b781d6 100644 --- a/usr.bin/mg/buffer.c +++ b/usr.bin/mg/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.37 2005/04/03 02:09:28 db Exp $ */ +/* $OpenBSD: buffer.c,v 1.38 2005/05/15 21:19:08 cloder Exp $ */ /* * Buffer handling. @@ -581,9 +581,9 @@ bufferinsert(int f, int n) /* Get buffer to use from user */ if (curbp->b_altb != NULL) bufp = eread("Insert buffer: (default %s) ", bufn, NBUFN, - EFNEW | EFBUF, &(curbp->b_altb->b_bname), NULL); + EFNEW | EFBUF, curbp->b_altb->b_bname); else - bufp = eread("Insert buffer: ", bufn, NBUFN, EFNEW | EFBUF, NULL); + bufp = eread("Insert buffer: ", bufn, NBUFN, EFNEW | EFBUF); if (bufp == NULL) return (ABORT); if (bufp[0] == '\0' && curbp->b_altb != NULL) diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c index da2b108c476..3aa7da5b06d 100644 --- a/usr.bin/mg/dired.c +++ b/usr.bin/mg/dired.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dired.c,v 1.17 2005/04/28 07:14:09 otto Exp $ */ +/* $OpenBSD: dired.c,v 1.18 2005/05/15 21:19:08 cloder Exp $ */ /* dired module for mg 2a */ /* by Robert A. Larson */ @@ -295,7 +295,7 @@ d_copy(int f, int n) { char frname[NFILEN], toname[NFILEN], *bufp; int stat; - int off; + size_t off; BUFFER *bp; if (d_makename(curwp->w_dotp, frname, sizeof(frname)) != FALSE) { @@ -304,7 +304,7 @@ d_copy(int f, int n) } off = strlcpy(toname, curbp->b_fname, sizeof(toname)); if (off >= sizeof(toname) - 1) { /* can't happen, really */ - ewprintf("too long directory name"); + ewprintf("Directory name too long"); return (FALSE); } if ((bufp = eread("Copy %s to: ", toname + off, sizeof(toname) - off, @@ -324,7 +324,8 @@ int d_rename(int f, int n) { char frname[NFILEN], toname[NFILEN], *bufp; - int stat, off; + int stat; + size_t off; BUFFER *bp; if (d_makename(curwp->w_dotp, frname, sizeof(frname)) != FALSE) { @@ -333,7 +334,7 @@ d_rename(int f, int n) } off = strlcpy(toname, curbp->b_fname, sizeof(toname)); if (off >= sizeof(toname) - 1) { /* can't happen, really */ - ewprintf("too long directory name"); + ewprintf("Directory name too long"); return (FALSE); } if ((bufp = eread("Rename %s to: ", toname + off, @@ -453,7 +454,7 @@ int d_create_directory(int f, int n) { char tocreate[MAXPATHLEN], *bufp; - ssize_t off; + size_t off; BUFFER *bp; off = strlcpy(tocreate, curbp->b_fname, sizeof(tocreate)); |