[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Two improvements for dired.c



Hi,

- strlcpy returns size_t, and not int.
- Correct english errormessages.

Index: dired.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/dired.c,v
retrieving revision 1.17
diff -u -p -r1.17 dired.c
--- dired.c	28 Apr 2005 07:14:09 -0000	1.17
+++ dired.c	7 May 2005 15:36:07 -0000
@@ -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));



# Han