diff options
author | dteske <dteske@FreeBSD.org> | 2016-02-02 22:18:43 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2016-02-02 22:18:43 +0000 |
commit | 6d511d769313fd1dae574a1d395369df219e86b6 (patch) | |
tree | 7a204aed6324ced6e56277a99cd65eb4cd6352fd | |
parent | 34fbc07d367c7631e872f66e3b53df4956e8c89f (diff) | |
download | FreeBSD-src-6d511d769313fd1dae574a1d395369df219e86b6.zip FreeBSD-src-6d511d769313fd1dae574a1d395369df219e86b6.tar.gz |
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.
-rw-r--r-- | usr.sbin/sysrc/sysrc | 4 | ||||
-rw-r--r-- | 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 e384dff..aa57f1b 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 c331156..3996b1f 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 |