Author: dteske
Date: Tue Feb  2 22:18:43 2016
New Revision: 295170
URL: https://svnweb.freebsd.org/changeset/base/295170

Log:
  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.

Modified:
  head/usr.sbin/sysrc/sysrc
  head/usr.sbin/sysrc/sysrc.8

Modified: head/usr.sbin/sysrc/sysrc
==============================================================================
--- head/usr.sbin/sysrc/sysrc   Tue Feb  2 21:58:17 2016        (r295169)
+++ head/usr.sbin/sysrc/sysrc   Tue Feb  2 22:18:43 2016        (r295170)
@@ -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=

Modified: head/usr.sbin/sysrc/sysrc.8
==============================================================================
--- head/usr.sbin/sysrc/sysrc.8 Tue Feb  2 21:58:17 2016        (r295169)
+++ head/usr.sbin/sysrc/sysrc.8 Tue Feb  2 22:18:43 2016        (r295170)
@@ -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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to