3 # Copyright (c) 2010-2016 Devin Teske
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 ############################################################ INCLUDES
31 # Prevent `-d' from being interpreted as a debug flag by common.subr
32 DEBUG_SELF_INITIALIZE=
34 BSDCFG_SHARE="/usr/share/bsdconfig"
35 [ "$_COMMON_SUBR" ] || . $BSDCFG_SHARE/common.subr || exit 1
36 [ "$_SYSRC_SUBR" ] || f_include $BSDCFG_SHARE/sysrc.subr
38 ############################################################ GLOBALS
43 SYSRC_VERSION="7.1 Feb-2,2016"
67 ############################################################ FUNCTIONS
69 # die [$fmt [$opts ...]]
71 # Optionally print a message to stderr before exiting with failure status.
76 [ $# -gt 0 ] && shift 1
77 [ "$fmt" ] && f_err "$fmt\n" "$@"
84 # Prints a short syntax statement and exits.
88 f_err "Usage: %s [OPTIONS] %s\n" "$pgm" \
89 "{name[[+|-]=value] ... | -a | -A | -l | -L [name ...]}"
90 f_err "Try \`%s --help' for more information.\n" "$pgm"
96 # Prints a full syntax statement and exits.
100 local optfmt="\t%-11s%s\n"
101 local envfmt="\t%-17s%s\n"
103 f_err "Usage: %s [OPTIONS] name[[+|-]=value] ...\n" "$pgm"
104 f_err "Usage: %s [OPTIONS] -a | -A\n" "$pgm"
105 f_err "Usage: %s [OPTIONS] -l | -L [name ...]\n" "$pgm"
108 f_err "$optfmt" "-a" \
109 "Dump a list of all non-default configuration variables."
110 f_err "$optfmt" "-A" \
111 "Dump a list of all configuration variables (incl. defaults)."
112 f_err "$optfmt" "-c" \
113 "Check. Return success if set or no changes, else error."
114 f_err "$optfmt" "-d" \
115 "Print a description of the given variable."
116 f_err "$optfmt" "-D" \
117 "Show default value(s) only (this is the same as setting"
119 "RC_CONFS to NULL or passing \`-f' with a NULL file-argument)."
120 f_err "$optfmt" "-e" \
121 "Print query results as \`var=value' (useful for producing"
123 "output to be fed back in). Ignored if \`-n' is specified."
124 f_err "$optfmt" "-E" \
125 "Existing files only with \`-[lL]' or when changing a setting."
126 f_err "$optfmt" "-f file" \
127 "Operate on the specified file(s) instead of rc_conf_files."
129 "Can be specified multiple times for additional files."
130 f_err "$optfmt" "-F" \
131 "Show only the last rc.conf(5) file each directive is in."
132 f_err "$optfmt" "-h" \
133 "Print a short usage statement to stderr and exit."
134 f_err "$optfmt" "--help" \
135 "Print this message to stderr and exit."
136 f_err "$optfmt" "-i" \
137 "Ignore unknown variables."
138 f_err "$optfmt" "-j jail" \
139 "The jid or name of the jail to operate within (overrides"
141 "\`-R dir'; requires jexec(8))."
142 f_err "$optfmt" "-l" \
143 "List configuration files used at startup on stdout and exit."
144 f_err "$optfmt" "-L" \
145 "List all configuration files including rc.conf.d entries."
146 f_err "$optfmt" "-n" \
147 "Show only variable values, not their names."
148 f_err "$optfmt" "-N" \
149 "Show only variable names, not their values."
150 f_err "$optfmt" "-q" \
151 "Quiet. Disable verbose and hide certain errors."
152 f_err "$optfmt" "-s name" \
153 "Process additional \`rc.conf.d' entries for service name."
155 "Ignored if \`-f file' is given."
156 f_err "$optfmt" "-R dir" \
157 "Operate within the root directory \`dir' rather than \`/'."
158 f_err "$optfmt" "-v" \
159 "Verbose. Print the pathname of the specific rc.conf(5)"
161 "file where the directive was found."
162 f_err "$optfmt" "--version" \
163 "Print version information to stdout and exit."
164 f_err "$optfmt" "-x" \
165 "Remove variable(s) from specified file(s)."
168 f_err "ENVIRONMENT:\n"
169 f_err "$envfmt" "RC_CONFS" \
170 "Override default rc_conf_files (even if set to NULL)."
171 f_err "$envfmt" "RC_DEFAULTS" \
172 "Location of \`/etc/defaults/rc.conf' file."
179 # Dump dependencies such as language-file variables and include files to stdout
180 # to be piped-into sh(1) running via jexec(8)/chroot(8). As a security measure,
181 # this prevents existing language files and library files from being loaded in
182 # the jail. This also relaxes the requirement to have these files in every jail
183 # before sysrc can be used on said jail.
188 # Indicate that we are jailed
190 echo export _SYSRC_JAILED=1
193 # Print i18n language variables (their current values are sanitized
194 # and re-printed for interpretation so that the i18n language files
195 # do not need to exist within the jail).
199 msg_cannot_create_permission_denied \
200 msg_permission_denied \
201 msg_previous_syntax_errors \
203 val=$( eval echo \"\$$var\" |
204 awk '{ gsub(/'\''/, "'\''\\'\'\''"); print }' )
209 # Print include dependencies
211 echo DEBUG_SELF_INITIALIZE=
212 cat $BSDCFG_SHARE/common.subr
213 cat $BSDCFG_SHARE/sysrc.subr
216 # escape $string [$var_to_set]
218 # Escape $string contents so that the contents can be properly encapsulated in
219 # single-quotes (making for safe evaluation).
221 # NB: See `bsdconfig includes -dF escape' for relevant information/discussion.
222 # NB: Abridged version of `f_shell_escape()' from bsdconfig(8) `strings.subr'.
226 local __start="$1" __var_to_set="$2" __string=
227 while [ "$__start" ]; do
228 case "$__start" in *\'*)
229 __string="$__string${__start%%\'*}'\\''"
230 __start="${__start#*\'}" continue
234 __string="$__string$__start"
235 if [ "$__var_to_set" ]; then
236 setvar "$__var_to_set" "$__string"
242 ############################################################ MAIN SOURCE
245 # Perform sanity checks
247 [ $# -gt 0 ] || usage # NOTREACHED
250 # Check for `--help' and `--version' command-line option
255 --help) help ;; # NOTREACHED
256 --version) # see GLOBALS
257 echo "$SYSRC_VERSION"
264 # Process command-line flags
266 while getopts aAcdDeEf:Fhij:lLnNqR:s:vxX flag; do
268 a) SHOW_ALL=${SHOW_ALL:-1} ;;
272 D) DEFAULT=1 RC_CONFS= ;;
274 E) EXISTING_ONLY=1 ;;
275 f) DEFAULT= RC_CONFS="$RC_CONFS${RC_CONFS:+ }$OPTARG" ;;
277 h) usage ;; # NOTREACHED
278 i) IGNORE_UNKNOWNS=1 ;;
280 die "%s: Missing or null argument to \`-j' flag" "$pgm"
283 L) LIST_SERVICE_CONFS=1 ;;
286 q) QUIET=1 VERBOSE= ;;
288 die "%s: Missing or null argument to \`-R' flag" "$pgm"
291 die "%s: Missing or null argument to \`-s' flag" "$pgm"
293 v) VERBOSE=1 QUIET= ;;
294 x) DELETE=${DELETE:-1} ;;
296 \?) usage ;; # NOTREACHED
299 shift $(( $OPTIND - 1 ))
304 if [ "$LIST_SERVICE_CONFS" ]; then
308 # List rc_conf_files if no service names given
311 [ $# -eq 0 ] && files=$( f_sysrc_get rc_conf_files )
312 for file in $files; do
313 if [ "$EXISTING_ONLY" ]; then
314 [ -e "$file" -a ! -d "$file" ] || continue
317 "$file"|*" $file"|"$file "*|*" $file "*) continue ;;
322 if [ $# -eq 0 ]; then
323 if [ "$VERBOSE" ]; then
324 echo rc_conf_files: $list
325 elif [ "$SHOW_EQUALS" ]; then
326 echo "rc_conf_files=\"$list\""
331 # List rc.conf.d entries
334 for service in ${*:-$( service -l )}; do
336 f_sysrc_service_configs $service files || retval=$? continue
337 for file in $files; do
338 if [ "$EXISTING_ONLY" ]; then
339 [ -e "$file" -a ! -d "$file" ] || continue
341 if [ ! "$VERBOSE" -a ! "$SHOW_EQUALS" ]; then
343 "$file"|*" $file"|"$file "*|*" $file "*)
350 if [ $# -gt 0 ]; then
351 [ "$slist" ] || retval=$?
353 if [ "$VERBOSE" ]; then
354 [ "$slist" ] && echo "$service: $slist"
356 elif [ "$SHOW_EQUALS" ]; then
357 [ "$slist" ] && echo "$service=\"$slist\""
360 list="$list${slist:+ }$slist"
362 if [ ! "$VERBOSE" -a ! "$SHOW_EQUALS" ]; then
363 if [ $# -eq 0 -o ! "$QUIET" ]; then
365 [ "$list" ] && echo $list
373 # Process `-s name' argument
375 if [ "$SERVICE" -a ! "${RC_CONFS+set}" ]; then
376 if f_sysrc_service_configs "$SERVICE" RC_CONFS; then
377 rc_conf_files=$( f_sysrc_get rc_conf_files )
378 RC_CONFS="$rc_conf_files${RC_CONFS:+ }$RC_CONFS"
386 # Process `-E' option flag
388 if [ "$EXISTING_ONLY" ]; then
390 # To get f_sysrc_*() to ignore missing rc_conf_files, we have to use
391 # RC_CONFS to override the unpreened value. If RC_CONFS already has a
392 # value (`-D', `-f file', `-s name', or inherited from parent), use it.
393 # Otherwise, include filtered contents of rc_conf_files.
396 if [ "${RC_CONFS+set}" ]; then
399 set -- $( f_sysrc_get rc_conf_files )
401 while [ $# -gt 0 ]; do
402 [ -f "$1" ] && echo -n " $1"
406 RC_CONFS="${RC_CONFS# }"
410 # Process `-l' option flag
412 if [ "$LIST_CONFS" ]; then
413 [ $# -eq 0 ] || usage
414 if [ "$DEFAULT" ]; then
416 elif [ "${RC_CONFS+set}" ]; then
419 f_sysrc_get rc_conf_files
425 # [More] Sanity checks (e.g., "sysrc --")
427 [ $# -eq 0 -a ! "$SHOW_ALL" ] && usage # NOTREACHED
430 # Taint-check all rc.conf(5) files
432 errmsg="$pgm: Exiting due to previous syntax errors"
433 if [ "${RC_CONFS+set}" ]; then
434 ( for i in $RC_CONFS; do
435 [ -e "$i" ] || continue
436 /bin/sh -n "$i" || exit $FAILURE
441 /bin/sh -n "$RC_DEFAULTS" || die "$errmsg"
443 for i in $rc_conf_files; do
444 [ -e "$i" ] || continue
445 /bin/sh -n "$i" || exit $FAILURE
452 # Process `-x' (and secret `-X') command-line options
454 errmsg="$pgm: \`-x' option incompatible with \`-a'/\`-A' options"
455 errmsg="$errmsg (use \`-X' to override)"
456 if [ "$DELETE" -a "$SHOW_ALL" ]; then
457 [ "$DELETE" = "2" ] || die "$errmsg"
461 # Pre-flight for `-c' command-line option
463 [ "$CHECK_ONLY" -a "$SHOW_ALL" ] &&
464 die "$pgm: \`-c' option incompatible with \`-a'/\`-A' options"
467 # Process `-e', `-n', and `-N' command-line options
470 [ "$SHOW_FILE" ] && SHOW_EQUALS=
471 [ "$SHOW_NAME" ] || SHOW_EQUALS=
472 [ "$VERBOSE" = "0" ] && VERBOSE=
473 if [ ! "$SHOW_VALUE" ]; then
477 [ "$SHOW_EQUALS" ] && SEP='="'
480 # Process `-j jail' and `-R dir' command-line options
482 if [ "$JAIL" -o "$ROOTDIR" ]; then
484 # Reconstruct the arguments that we want to carry-over
489 $( [ "$DELETE" = "1" ] && echo \ -x )
490 $( [ "$DELETE" = "2" ] && echo \ -X )
491 $( [ "$SHOW_ALL" = "1" ] && echo \ -a )
492 $( [ "$SHOW_ALL" = "2" ] && echo \ -A )
497 ${LIST_SERVICE_CONFS:+-L}
500 ${IGNORE_UNKNOWNS:+-i}
501 $( [ "$SHOW_NAME" ] || echo \ -n )
502 $( [ "$SHOW_VALUE" ] || echo \ -N )
503 $( [ "$SHOW_FILE" ] && echo \ -F )
505 if [ "$SERVICE" ]; then
506 escape "$SERVICE" _SERVICE
507 args="$args -s '$_SERVICE'"
510 if [ "${RC_CONFS+set}" ]; then
511 escape "$RC_CONFS" _RC_CONFS
512 args="$args -f '$_RC_CONFS'"
521 # If both are supplied, `-j jail' supercedes `-R dir'
525 # Re-execute ourselves with sh(1) via jexec(8)
530 ) | env - RC_DEFAULTS="$RC_DEFAULTS" \
531 /usr/sbin/jexec "$JAIL" /bin/sh
533 elif [ "$ROOTDIR" ]; then
535 # Make sure that the root directory specified is not to any
538 # NOTE: To maintain backward compatibility with older jails on
539 # older systems, we will not perform this check if either the
540 # jls(1) or jexec(8) utilities are missing.
542 if f_have jexec && f_have jls; then
543 jid=$( jls jid path |
544 while read JID JROOT; do
545 [ "$JROOT" = "$ROOTDIR" ] || continue
551 # If multiple running jails match the specified root
552 # directory, exit with error.
554 if [ "$jid" -a "${jid%[$IFS]*}" != "$jid" ]; then
555 die "%s: %s: %s" "$pgm" "$ROOTDIR" \
556 "$( echo "Multiple jails claim this" \
557 "directory as their root." \
558 "(use \`-j jail' instead)" )"
562 # If only a single running jail matches the specified
563 # root directory, implicitly use `-j jail'.
567 # Re-execute outselves with sh(1) via jexec(8)
572 ) | env - RC_DEFAULTS="$RC_DEFAULTS" \
573 /usr/sbin/jexec "$jid" /bin/sh
577 # Otherwise, fall through and allow chroot(8)
581 # Re-execute ourselves with sh(1) via chroot(8)
586 ) | env - RC_DEFAULTS="$RC_DEFAULTS" \
587 /usr/sbin/chroot "$ROOTDIR" /bin/sh
593 # Process `-a' or `-A' command-line options
595 if [ "$SHOW_ALL" ]; then
597 # Get a list of variables that are currently set in the rc.conf(5)
598 # files (including `/etc/defaults/rc.conf') by performing a call to
599 # source_rc_confs() in a clean environment.
601 ( # Operate in a sub-shell to protect the parent environment
603 # Set which variables we want to preserve in the environment.
604 # Append the pipe-character (|) to the list of internal field
605 # separation (IFS) characters, allowing us to use the below
606 # list both as an extended grep (-E) pattern and argument list
607 # (required to first get f_clean_env() to preserve these in the
608 # environment and then later to prune them from the list of
609 # variables produced by set(1)).
612 EXCEPT="IFS|EXCEPT|PATH|RC_DEFAULTS|OPTIND|DESCRIBE|SEP"
613 EXCEPT="$EXCEPT|DELETE|SHOW_ALL|SHOW_EQUALS|SHOW_NAME|DEFAULT"
614 EXCEPT="$EXCEPT|SHOW_VALUE|SHOW_FILE|VERBOSE|RC_CONFS|SERVICE"
615 EXCEPT="$EXCEPT|pgm|SUCCESS|FAILURE|CHECK_ONLY|EXISTING_ONLY"
616 EXCEPT="$EXCEPT|LIST_CONFS|LIST_SERVICE_CONFS"
617 EXCEPT="$EXCEPT|f_sysrc_desc_awk|f_sysrc_delete_awk"
620 # Clean the environment (except for our required variables)
621 # and then source the required files.
623 f_clean_env --except $EXCEPT
624 if [ -f "$RC_DEFAULTS" -a -r "$RC_DEFAULTS" ]; then
628 # If passed `-a' (rather than `-A'), re-purge the
629 # environment, removing the rc.conf(5) defaults.
631 [ "$SHOW_ALL" = "1" ] &&
632 f_clean_env --except rc_conf_files $EXCEPT
635 # If `-f file' was passed, set $rc_conf_files to an
636 # explicit value, modifying the default behavior of
639 if [ "${RC_CONFS+set}" ]; then
640 [ "$SHOW_ALL" = "1" -a "$SERVICE" -a \
641 ! "$DEFAULT" ] || rc_conf_files=
642 rc_conf_files="$rc_conf_files $RC_CONFS"
643 rc_conf_files="${rc_conf_files# }"
644 rc_conf_files="${rc_conf_files% }"
650 # If passed `-a' (rather than `-A'), remove
651 # `rc_conf_files' unless it was defined somewhere
652 # other than rc.conf(5) defaults.
654 [ "$SHOW_ALL" = "1" -a \
655 "$( f_sysrc_find rc_conf_files )" = "$RC_DEFAULTS" \
656 ] && unset rc_conf_files
660 awk -F= '/^[[:alpha:]_][[:alnum:]_]*=/ {print $1}' |
661 grep -Ev "^($EXCEPT)$"
664 # If enabled, describe rather than expand value
666 if [ "$DESCRIBE" ]; then
667 echo "$NAME: $( f_sysrc_desc "$NAME" )"
672 # If `-F' is passed, find it and move on
674 if [ "$SHOW_FILE" ]; then
675 [ "$SHOW_NAME" ] && echo -n "$NAME: "
681 # If `-X' is passed, delete the variables
683 if [ "$DELETE" = "2" ]; then
684 f_sysrc_delete "$NAME"
689 echo -n "$( f_sysrc_find "$NAME" ): "
692 # If `-N' is passed, simplify the output
694 if [ ! "$SHOW_VALUE" ]; then
699 echo "${SHOW_NAME:+$NAME$SEP}$(
700 f_sysrc_get "$NAME" )${SHOW_EQUALS:+\"}"
706 # Ignore the remainder of positional arguments.
712 # Process command-line arguments
715 while [ $# -gt 0 ]; do
719 *+) mode=APPEND NAME="${NAME%+}" ;;
720 *-) mode=REMOVE NAME="${NAME%-}" ;;
725 echo "$NAME: $( f_sysrc_desc "$NAME" )"
730 # Like sysctl(8), if both `-d' AND "name=value" is passed,
731 # first describe (done above), then attempt to set
734 # If verbose, prefix line with where the directive lives
735 if [ "$VERBOSE" -a ! "$CHECK_ONLY" ]; then
736 file=$( f_sysrc_find "$NAME" )
737 [ "$file" = "$RC_DEFAULTS" -o ! "$file" ] &&
738 file=$( f_sysrc_get 'rc_conf_files%%[$IFS]*' )
739 if [ "$SHOW_EQUALS" ]; then
747 # If `-x' or `-X' is passed, delete the variable and ignore the
748 # desire to set some value
750 if [ "$DELETE" ]; then
751 f_sysrc_delete "$NAME" || status=$FAILURE
757 # If `-c' is passed, simply compare and move on
759 if [ "$CHECK_ONLY" ]; then
760 if ! IGNORED=$( f_sysrc_get "$NAME?" ); then
763 echo "$NAME: not currently set"
767 value=$( f_sysrc_get "$NAME" )
768 if [ "$value" != "${1#*=}" ]; then
770 if [ "$VERBOSE" ]; then
771 echo -n "$( f_sysrc_find "$NAME" ): "
772 echo -n "$NAME: would change from "
773 echo "\`$value' to \`${1#*=}'"
775 elif [ "$VERBOSE" ]; then
776 echo -n "$( f_sysrc_find "$NAME" ): "
777 echo "$NAME: already set to \`$value'"
784 # Determine both `before' value and appropriate `new' value
788 before=$( f_sysrc_get "$NAME" )
790 delim="${add%"${add#?}"}" # first character
793 ""|[$IFS]|[a-zA-Z0-9./]) delim=" " ;;
801 [ "$b" = "$a" ] && skip=1 break
803 [ "$skip" ] || new="$new$delim$a"
805 new="${new#"$delim"}" IFS="$oldIFS"
806 unset add delim oldIFS a skip b
807 [ "$SHOW_FILE" ] && before=$( f_sysrc_find "$NAME" )
810 before=$( f_sysrc_get "$NAME" )
812 delim="${remove%"${remove#?}"}" # first character
815 ""|[$IFS]|[a-zA-Z0-9./]) delim=" " ;;
823 [ "$r" = "$b" ] && add= break
825 [ "$add" ] && new="$new$delim$b"
827 new="${new#"$delim"}" IFS="$oldIFS"
828 unset remove delim oldIFS b add r
829 [ "$SHOW_FILE" ] && before=$( f_sysrc_find "$NAME" )
832 if [ "$SHOW_FILE" ]; then
833 before=$( f_sysrc_find "$NAME" )
835 before=$( f_sysrc_get "$NAME" )
841 # If `-N' is passed, simplify the output
843 if [ ! "$SHOW_VALUE" ]; then
845 f_sysrc_set "$NAME" "$new"
847 if f_sysrc_set "$NAME" "$new"; then
848 if [ "$SHOW_FILE" ]; then
849 after=$( f_sysrc_find "$NAME" )
851 after=$( f_sysrc_get "$NAME" )
853 echo -n "${SHOW_NAME:+$NAME$SEP}"
854 echo -n "$before${SHOW_EQUALS:+\" #}"
855 echo -n " -> ${SHOW_EQUALS:+\"}$after"
856 echo "${SHOW_EQUALS:+\"}"
861 if ! IGNORED=$( f_sysrc_get "$NAME?" ); then
862 [ "$IGNORE_UNKNOWNS" -o "$QUIET" ] ||
863 echo "$pgm: unknown variable '$NAME'"
869 # The above check told us what we needed for `-c'
870 if [ "$CHECK_ONLY" ]; then
876 # Like sysctl(8), when `-d' is passed, desribe it
877 # (already done above) rather than expanding it
880 if [ "$DESCRIBE" ]; then
886 # If `-x' or `-X' is passed, delete the variable
888 if [ "$DELETE" ]; then
889 f_sysrc_delete "$NAME" || status=$FAILURE
895 # If `-F' is passed, find it and move on
897 if [ "$SHOW_FILE" ]; then
898 [ "$SHOW_NAME" ] && echo -n "$NAME: "
904 if [ "$VERBOSE" ]; then
905 if [ "$SHOW_EQUALS" ]; then
906 echo -n ": $( f_sysrc_find "$NAME" ); "
908 echo -n "$( f_sysrc_find "$NAME" ): "
913 # If `-N' is passed, simplify the output
915 if [ ! "$SHOW_VALUE" ]; then
918 echo "${SHOW_NAME:+$NAME$SEP}$(
919 f_sysrc_get "$NAME" )${SHOW_EQUALS:+\"}"
925 exit $status # $SUCCESS unless error occurred with either `-c' or `-x'
927 ################################################################################
929 ################################################################################