Module Name:    src
Committed By:   apb
Date:           Sun Sep 26 18:37:15 UTC 2010

Modified Files:
        src/etc: rc.subr
        src/share/man/man8: rc.subr.8

Log Message:
Add a collapse_backslash_newline function to rc.subr.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/etc/rc.subr
cvs rdiff -u -r1.26 -r1.27 src/share/man/man8/rc.subr.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/rc.subr
diff -u src/etc/rc.subr:1.85 src/etc/rc.subr:1.86
--- src/etc/rc.subr:1.85	Tue Jun  8 18:04:17 2010
+++ src/etc/rc.subr	Sun Sep 26 18:37:14 2010
@@ -1,4 +1,4 @@
-# $NetBSD: rc.subr,v 1.85 2010/06/08 18:04:17 christos Exp $
+# $NetBSD: rc.subr,v 1.86 2010/09/26 18:37:14 apb Exp $
 #
 # Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1194,6 +1194,27 @@
 		echo "terminated with signal $(expr $1 - 128)"
 	fi
 }
-	
+
+#
+# collapse_backslash_newline
+#	Copy input to output, collapsing <backslash><newline>
+#	to nothing, but leaving other backslashes alone.
+#
+collapse_backslash_newline()
+{
+	local line
+	while read -r line ; do
+		case "$line" in
+		*\\)
+			# print it, without the backslash or newline
+			printf "%s" "${line%?}"
+			;;
+		*)
+			# print it, with a newline
+			printf "%s\n" "${line}"
+			;;
+		esac
+	done
+}
 
 _rc_subr_loaded=:

Index: src/share/man/man8/rc.subr.8
diff -u src/share/man/man8/rc.subr.8:1.26 src/share/man/man8/rc.subr.8:1.27
--- src/share/man/man8/rc.subr.8:1.26	Mon Mar 15 19:00:20 2010
+++ src/share/man/man8/rc.subr.8	Sun Sep 26 18:37:15 2010
@@ -1,4 +1,4 @@
-.\" 	$NetBSD: rc.subr.8,v 1.26 2010/03/15 19:00:20 jmmv Exp $
+.\" 	$NetBSD: rc.subr.8,v 1.27 2010/09/26 18:37:15 apb Exp $
 .\"
 .\" Copyright (c) 2002-2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -46,6 +46,8 @@
 .It
 .Ic check_process Ar procname Op Ar interpreter
 .It
+.Ic collapse_backslash_newline
+.It
 .Ic err Ar exitval Ar message
 .It
 .Ic load_rc_config Ar command
@@ -208,6 +210,10 @@
 .Ar interpreter
 is handled as per
 .Ic check_pidfile .
+.It Ic collapse_backslash_newline
+Copy input to output, collapsing
+.Ao backslash Ac Ns Ao newline Ac
+to nothing, but leaving other backslashes alone.
 .It Ic err Ar exitval Ar message
 Display an error message to
 .Em stderr ,

Reply via email to