Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/bin/ls merge in fixes for printing of strange filenames...
details: https://anonhg.NetBSD.org/src/rev/53613ed41375
branches: netbsd-1-5
changeset: 488268:53613ed41375
user: assar <assar%NetBSD.org@localhost>
date: Mon Jun 26 07:27:44 2000 +0000
description:
merge in fixes for printing of strange filenames in column mode from trunk
approved by releng-1-5
diffstat:
bin/ls/extern.h | 4 ++--
bin/ls/print.c | 11 +++++++----
bin/ls/util.c | 12 +++++++-----
3 files changed, 16 insertions(+), 11 deletions(-)
diffs (98 lines):
diff -r 17ba07faf104 -r 53613ed41375 bin/ls/extern.h
--- a/bin/ls/extern.h Mon Jun 26 05:35:38 2000 +0000
+++ b/bin/ls/extern.h Mon Jun 26 07:27:44 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.11 2000/06/17 16:11:25 assar Exp $ */
+/* $NetBSD: extern.h,v 1.11.2.1 2000/06/26 07:27:44 assar Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -48,7 +48,7 @@
int ls_main __P((int, char *[]));
-void printescaped __P((const char *));
+int printescaped __P((const char *));
void printacol __P((DISPLAY *));
void printcol __P((DISPLAY *));
void printlong __P((DISPLAY *));
diff -r 17ba07faf104 -r 53613ed41375 bin/ls/print.c
--- a/bin/ls/print.c Mon Jun 26 05:35:38 2000 +0000
+++ b/bin/ls/print.c Mon Jun 26 07:27:44 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.28 2000/06/17 16:11:26 assar Exp $ */
+/* $NetBSD: print.c,v 1.28.2.1 2000/06/26 07:27:44 assar Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.5 (Berkeley) 7/28/94";
#else
-__RCSID("$NetBSD: print.c,v 1.28 2000/06/17 16:11:26 assar Exp $");
+__RCSID("$NetBSD: print.c,v 1.28.2.1 2000/06/26 07:27:44 assar Exp $");
#endif
#endif /* not lint */
@@ -133,7 +133,7 @@
else
printtime(sp->st_mtime);
if (f_nonprint)
- printescaped(p->fts_name);
+ (void)printescaped(p->fts_name);
else
(void)printf("%s", p->fts_name);
@@ -306,7 +306,10 @@
if (f_size)
chcnt += printf("%*llu ", sizefield,
(long long)howmany(sp->st_blocks, blocksize));
- chcnt += printf("%s", p->fts_name);
+ if (f_nonprint)
+ chcnt += printescaped(p->fts_name);
+ else
+ chcnt += printf("%s", p->fts_name);
if (f_type || (f_typedir && S_ISDIR(sp->st_mode)))
chcnt += printtype(sp->st_mode);
return (chcnt);
diff -r 17ba07faf104 -r 53613ed41375 bin/ls/util.c
--- a/bin/ls/util.c Mon Jun 26 05:35:38 2000 +0000
+++ b/bin/ls/util.c Mon Jun 26 07:27:44 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.18 2000/06/17 16:11:26 assar Exp $ */
+/* $NetBSD: util.c,v 1.18.2.1 2000/06/26 07:27:45 assar Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)util.c 8.5 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: util.c,v 1.18 2000/06/17 16:11:26 assar Exp $");
+__RCSID("$NetBSD: util.c,v 1.18.2.1 2000/06/26 07:27:45 assar Exp $");
#endif
#endif /* not lint */
@@ -57,17 +57,19 @@
#include "ls.h"
#include "extern.h"
-void
+int
printescaped(src)
const char *src;
{
- int c;
+ unsigned char c;
+ int n;
- while ((c = *src++) != '\0')
+ for (n = 0; (c = *src) != '\0'; ++src, ++n)
if (isprint(c))
(void)putchar(c);
else
(void)putchar('?');
+ return n;
}
void
Home |
Main Index |
Thread Index |
Old Index