Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: backslashes in ifconfig.xxN
On Sun, 12 Sep 2010, Alan Barrett wrote:
> On Sun, 12 Sep 2010, Hauke Fath wrote:
> > after upgrading a netbsd-4 /etc to -current, I find that /etc/rc.d/network
> > trips over the
> >
> > ! /sbin/pppoectl ${int} \
> > myauthproto=pap \
> > 'myauthname=foo' \
> > 'myauthsecret=bar' \
> > hisauthproto=none \
> > max-auth-failure=5
> >
> > section in my /etc/ifconfig.pppoe0, complaining about the backslashes.
Please try this patch. If it works, I'll move the function to rc.subr,
document it, and commit.
--apb (Alan Barrett)
Index: network
--- network 11 Sep 2009 21:25:07 -0000 1.60
+++ network 12 Sep 2010 21:38:43 -0000
@@ -16,6 +16,27 @@ stop_cmd="network_stop"
nl='
' # a newline
+
+collapse_backslash_newline()
+{
+ # Copy input to output, collapsing <backslash><newline>
+ # to nothing, but leaving other backslashes alone.
+ #
+ 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
+}
+
network_start()
{
# set hostname, turn on network
@@ -259,6 +280,7 @@ network_start()
)
;;
esac |
+ collapse_bckslash_newline |
while read -r args; do
case "$args" in
''|"#"*|create)
Home |
Main Index |
Thread Index |
Old Index