Module Name: src
Committed By: christos
Date: Mon Dec 28 21:55:38 UTC 2009
Modified Files:
src/lib/libedit: filecomplete.c
Log Message:
improve on the listing display by printing only one character after the
filename not two, and no trailing blanks. I will revisit this when I write
the ls-F code.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libedit/filecomplete.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libedit/filecomplete.c
diff -u src/lib/libedit/filecomplete.c:1.15 src/lib/libedit/filecomplete.c:1.16
--- src/lib/libedit/filecomplete.c:1.15 Sun Feb 15 19:15:45 2009
+++ src/lib/libedit/filecomplete.c Mon Dec 28 16:55:38 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: filecomplete.c,v 1.15 2009/02/16 00:15:45 christos Exp $ */
+/* $NetBSD: filecomplete.c,v 1.16 2009/12/28 21:55:38 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.15 2009/02/16 00:15:45 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.16 2009/12/28 21:55:38 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@@ -359,9 +359,12 @@
idx = 1;
for(; count > 0; count--) {
- for(i = 0; i < limit && matches[idx]; i++, idx++)
- (void)fprintf(el->el_outfile, "%-*s ", (int)max,
- matches[idx]);
+ int more = limit > 0 && matches[0];
+ for(i = 0; more; i++, idx++) {
+ more = ++i < limit && matches[idx + 1];
+ (void)fprintf(el->el_outfile, "%-*s%s", (int)max,
+ matches[idx], more ? " " : "");
+ }
(void)fprintf(el->el_outfile, "\n");
}
}