Module Name:    src
Committed By:   christos
Date:           Fri May 20 02:00:45 UTC 2011

Modified Files:
        src/usr.bin/error: touch.c

Log Message:
counting was off, and setting things to themselves does not work very welll.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/error/touch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/error/touch.c
diff -u src/usr.bin/error/touch.c:1.23 src/usr.bin/error/touch.c:1.24
--- src/usr.bin/error/touch.c:1.23	Thu May 19 18:55:53 2011
+++ src/usr.bin/error/touch.c	Thu May 19 22:00:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: touch.c,v 1.23 2011/05/19 22:55:53 christos Exp $	*/
+/*	$NetBSD: touch.c,v 1.24 2011/05/20 02:00:45 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)touch.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: touch.c,v 1.23 2011/05/19 22:55:53 christos Exp $");
+__RCSID("$NetBSD: touch.c,v 1.24 2011/05/20 02:00:45 christos Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -92,7 +92,7 @@
 {
 	const char *p;
 
-	if (level-- == 0)
+	if (level == 0)
 		return name;
 
 	if (*name == '/') {
@@ -172,7 +172,7 @@
 			    filelevel);
 			if (strcmp(fname, name) != 0) {
 				my_nfiles++;
-				name = name;
+				name = fname;
 			}
 		}
 	}
@@ -215,10 +215,10 @@
 				my_nfiles, plural(my_nfiles), verbform(my_nfiles));
 		if (!terse) {
 			FILEITERATE(fi, 1, my_nfiles) {
+				const char *fname = makename(
+				    (*my_files[fi])->error_text[0], filelevel);
 				fprintf(stdout, "%s\"%s\" (%d)",
-					sep, makename(
-					(*my_files[fi])->error_text[0],
-					filelevel),
+					sep, fname,
 					(int)(my_files[fi+1] - my_files[fi]));
 				sep = ", ";
 			}

Reply via email to