Source-Changes-HG archive

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

[src/trunk]: src/etc Introduce kat() a built-in version of cat(1) that strips...



details:   https://anonhg.NetBSD.org/src/rev/ae5c4c614e2c
branches:  trunk
changeset: 814090:ae5c4c614e2c
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 06 18:49:42 2016 +0000

description:
Introduce kat() a built-in version of cat(1) that strips shell-like comments.

diffstat:

 etc/rc.subr |  16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r 8a0df7f4bdc1 -r ae5c4c614e2c etc/rc.subr
--- a/etc/rc.subr       Sun Mar 06 18:01:28 2016 +0000
+++ b/etc/rc.subr       Sun Mar 06 18:49:42 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: rc.subr,v 1.97 2015/10/31 12:31:37 phx Exp $
+# $NetBSD: rc.subr,v 1.98 2016/03/06 18:49:42 christos Exp $
 #
 # Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1346,4 +1346,18 @@
        esac
 }
 
+kat() {
+       local i
+       local v
+       for i; do
+               while read -r v; do
+                       v="${v%%#*}"
+                       if [ -z "$v" ]; then
+                               continue
+                       fi
+                       echo "$v"
+               done < "$i"
+       done
+}
+
 _rc_subr_loaded=:



Home | Main Index | Thread Index | Old Index