From 6350eae8e458637096ee44d0968961cfa4c41810 Mon Sep 17 00:00:00 2001 From: Devin Teske Date: Tue, 2 Feb 2016 22:18:43 +0000 Subject: [PATCH] For +=/-=, add . and / to convenience characters sysrc(8) supports key+=value and key-=value, but can be told what the delimiter is by being passed as char1 (e.g., "sysrc key+=",value" to use a comma as the delimiter instead of space). For convenience, if the first char is alpha-numeric, it is assumed you wanted whitespace as the delimiter. However, if you naively (as I just did) execute: sysrc rc_conf_files+=/etc/rc.conf.other the result is unexpected. This commit makes `.' and `/' in-addition to alpha-numeric first-characters to cause the default of whitespace to be used as the delimiter. This also means that you can no longer use these as a delimiter. --- usr.sbin/sysrc/sysrc | 4 ++-- usr.sbin/sysrc/sysrc.8 | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc index e384dff93f6c..aa57f1beb7f2 100644 --- a/usr.sbin/sysrc/sysrc +++ b/usr.sbin/sysrc/sysrc @@ -790,7 +790,7 @@ while [ $# -gt 0 ]; do delim="${add%"${add#?}"}" # first character oldIFS="$IFS" case "$delim" in - ""|[$IFS]|[a-zA-Z0-9]) delim=" " ;; + ""|[$IFS]|[a-zA-Z0-9./]) delim=" " ;; *) IFS="$delim" esac new="$before" @@ -812,7 +812,7 @@ while [ $# -gt 0 ]; do delim="${remove%"${remove#?}"}" # first character oldIFS="$IFS" case "$delim" in - ""|[$IFS]|[a-zA-Z0-9]) delim=" " ;; + ""|[$IFS]|[a-zA-Z0-9./]) delim=" " ;; *) IFS="$delim" esac new= diff --git a/usr.sbin/sysrc/sysrc.8 b/usr.sbin/sysrc/sysrc.8 index c331156f1180..3996b1f9482c 100644 --- a/usr.sbin/sysrc/sysrc.8 +++ b/usr.sbin/sysrc/sysrc.8 @@ -275,6 +275,10 @@ it is added .Pp For convenience, if the first character is alpha-numeric .Pq letters A-Z, a-z, or numbers 0-9 , +dot +.Pq Li . , +or slash +.Pq Li / , .Nm uses the default setting of whitespace as separator. For example, the above and below statements are equivalent since @@ -329,6 +333,10 @@ it is removed .Pp For convenience, if the first character is alpha-numeric .Pq letters A-Z, a-z, or numbers 0-9 , +dot +.Pq Li . , +or slash +.Pq Li / , .Nm uses the default setting of whitespace as separator. For example, the above and below statements are equivalent since