Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/mtree Now that we have strsvis, use it.



details:   https://anonhg.NetBSD.org/src/rev/56c86816e4b0
branches:  trunk
changeset: 479015:56c86816e4b0
user:      wennmach <wennmach%NetBSD.org@localhost>
date:      Wed Dec 01 22:12:52 1999 +0000

description:
Now that we have strsvis, use it.

diffstat:

 usr.sbin/mtree/create.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (54 lines):

diff -r fadc57c186dd -r 56c86816e4b0 usr.sbin/mtree/create.c
--- a/usr.sbin/mtree/create.c   Wed Dec 01 22:03:43 1999 +0000
+++ b/usr.sbin/mtree/create.c   Wed Dec 01 22:12:52 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: create.c,v 1.24 1999/11/07 20:23:01 wennmach Exp $     */
+/*     $NetBSD: create.c,v 1.25 1999/12/01 22:12:52 wennmach Exp $     */
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)create.c   8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: create.c,v 1.24 1999/11/07 20:23:01 wennmach Exp $");
+__RCSID("$NetBSD: create.c,v 1.25 1999/12/01 22:12:52 wennmach Exp $");
 #endif
 #endif /* not lint */
 
@@ -55,11 +55,13 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
+#include <vis.h>
 #include "mtree.h"
 #include "extern.h"
 
 #define        INDENTNAMELEN   15
 #define        MAXLINELEN      80
+#define VISFLAGS        VIS_CSTYLE
 
 extern int crc_total, ftsoptions;
 extern int dflag, sflag;
@@ -71,6 +73,7 @@
 static mode_t mode;
 static u_long flags;
 static char codebuf[4*MAXPATHLEN + 1];
+static const char extra[] = { ' ', '\t', '\n', '\\', '#', '\0' };
 
 static int     dsort __P((const FTSENT **, const FTSENT **));
 static void    output __P((int *, const char *, ...));
@@ -136,10 +139,11 @@
        int fd, indent;
        char md5buf[33], *md5cp;
 
+       strsvis(codebuf, p->fts_name, VISFLAGS, extra);
        if (S_ISDIR(p->fts_statp->st_mode))
-               indent = printf("%s", encode(codebuf, p->fts_name)); 
+               indent = printf("%s", codebuf); 
        else
-               indent = printf("    %s", encode(codebuf, p->fts_name));
+               indent = printf("    %s", codebuf);
 
        if (indent > INDENTNAMELEN)
                indent = MAXLINELEN;



Home | Main Index | Thread Index | Old Index