Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177744693
D61735.1795184762.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D61735.1795184762.diff
View Options
diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc
--- a/usr.sbin/sysrc/sysrc
+++ b/usr.sbin/sysrc/sysrc
@@ -16,7 +16,7 @@
#
# Version information
#
-SYSRC_VERSION="8.6 Nov-18,2026"
+SYSRC_VERSION="8.7 Nov-18,2026"
#
# Options
@@ -26,6 +26,7 @@
DELETE= # -x / -X
DESCRIBE= # -d
EXISTING_ONLY= # -E
+FILE= # -f file
IGNORE_UNKNOWNS= # -i
JAIL= # -j jail
LIST_CONFS= # -l
@@ -238,7 +239,7 @@
E) EXISTING_ONLY=1 ;;
e) SHOW_EQUALS=1 ;;
F) SHOW_FILE=1 ;;
- f) DEFAULT= RC_CONFS="$RC_CONFS${RC_CONFS:+ }$OPTARG" ;;
+ f) DEFAULT= FILE=1 RC_CONFS="$RC_CONFS${RC_CONFS:+ }$OPTARG" ;;
h) usage ;; # NOTREACHED
i) IGNORE_UNKNOWNS=1 ;;
j) [ "$OPTARG" ] ||
@@ -264,6 +265,31 @@
done
shift $(( $OPTIND - 1 ))
+#
+# Sanity checks
+#
+if [ "$SHOW_ALL" ]; then
+ [ $# -eq 0 ] || usage "-a/-A do not take names" # NOTREACHED
+fi
+if [ "$DESCRIBE" ]; then
+ if [ "$CHECK_ONLY$DELETE$LIST_CONFS$LIST_SERVICE_CONFS$RAW" ]; then
+ if [ "$DELETE" = "2" ]; then
+ # NB: Do not advertise secret `-X' unless it was used
+ usage "-d cannot be combined with -c/-l/-L/-r/-x/-X"
+ # NOTREACHED
+ fi
+ usage "-d cannot be combined with -c/-l/-L/-r/-x" # NOTREACHED
+ fi
+ [ "$FILE" ] && usage "-d and -f are mutually exclusive" # NOTREACHED
+ for item in "$@"; do
+ case "$item" in
+ *=*) usage "-d does not take values" ;; # NOTREACHED
+ esac
+ done
+fi
+[ "$JAIL" -a "$ROOTDIR" ] &&
+ usage "-j and -R are mutually exclusive" # NOTREACHED
+
#
# Process `-L' flag
#
@@ -433,6 +459,14 @@
errmsg="$errmsg (use \`-X' to override)"
if [ "$DELETE" -a "$SHOW_ALL" ]; then
[ "$DELETE" = "2" ] || die "$errmsg"
+elif [ "$DELETE" = "2" ]; then
+ die "-X requires -a/-A" # NOTREACHED
+elif [ "$DELETE" ]; then
+ for item in "$@"; do
+ case "$item" in
+ *=*) die "%s: -x does not take a value" "$item" ;;
+ esac
+ done
fi
#
@@ -726,16 +760,6 @@
fi
fi
- #
- # If `-x' or `-X' is passed, delete the variable and ignore the
- # desire to set some value
- #
- if [ "$DELETE" ]; then
- f_sysrc_delete "$NAME" || status=$FAILURE
- shift 1
- continue
- fi
-
#
# Determine both `before' value and appropriate `new' value
#
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 20, 2:26 PM (12 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41857421
Default Alt Text
D61735.1795184762.diff (2 KB)
Attached To
Mode
D61735: sysrc: Add more sanity checks
Attached
Detach File
Event Timeline