Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/pkg_install/info show_file: add an extra '\n' unles...



details:   https://anonhg.NetBSD.org/src/rev/b72c39391472
branches:  trunk
changeset: 534188:b72c39391472
user:      yamt <yamt%NetBSD.org@localhost>
date:      Fri Jul 19 19:18:26 2002 +0000

description:
show_file: add an extra '\n' unless file ended with '\n'.

diffstat:

 usr.sbin/pkg_install/info/show.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r d440855690f9 -r b72c39391472 usr.sbin/pkg_install/info/show.c
--- a/usr.sbin/pkg_install/info/show.c  Fri Jul 19 19:15:48 2002 +0000
+++ b/usr.sbin/pkg_install/info/show.c  Fri Jul 19 19:18:26 2002 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: show.c,v 1.23 2002/06/09 14:14:50 yamt Exp $   */
+/*     $NetBSD: show.c,v 1.24 2002/07/19 19:18:26 yamt Exp $   */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp";
 #else
-__RCSID("$NetBSD: show.c,v 1.23 2002/06/09 14:14:50 yamt Exp $");
+__RCSID("$NetBSD: show.c,v 1.24 2002/07/19 19:18:26 yamt Exp $");
 #endif
 #endif
 
@@ -104,6 +104,7 @@
        FILE   *fp;
        char    line[1024];
        int     n;
+       int     have_nl = 0;
 
        if (!Quiet) {
                printf("%s%s", InfoPrefix, title);
@@ -113,9 +114,12 @@
        } else {
                while ((n = fread(line, 1, sizeof(line), fp)) != 0) {
                        fwrite(line, 1, n, stdout);
+                       have_nl = (line[n - 1] == '\n');
                }
                (void) fclose(fp);
        }
+       if (!have_nl)
+               printf("\n");
        printf("\n");           /* just in case */
 }
 



Home | Main Index | Thread Index | Old Index