1252995Sdteske#!/bin/sh
2252995Sdteske#-
3252995Sdteske# Copyright (c) 2012-2013 Devin Teske
4252995Sdteske# All rights reserved.
5252995Sdteske#
6252995Sdteske# Redistribution and use in source and binary forms, with or without
7252995Sdteske# modification, are permitted provided that the following conditions
8252995Sdteske# are met:
9252995Sdteske# 1. Redistributions of source code must retain the above copyright
10252995Sdteske#    notice, this list of conditions and the following disclaimer.
11252995Sdteske# 2. Redistributions in binary form must reproduce the above copyright
12252995Sdteske#    notice, this list of conditions and the following disclaimer in the
13252995Sdteske#    documentation and/or other materials provided with the distribution.
14252995Sdteske#
15252995Sdteske# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16252995Sdteske# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17252995Sdteske# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18252995Sdteske# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19252995Sdteske# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20252995Sdteske# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21252995Sdteske# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22252995Sdteske# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23252995Sdteske# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24252995Sdteske# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25252995Sdteske# SUCH DAMAGE.
26252995Sdteske#
27252995Sdteske# $FreeBSD$
28252995Sdteske#
29252995Sdteske############################################################ INCLUDES
30252995Sdteske
31252995SdteskeBSDCFG_SHARE="/usr/share/bsdconfig"
32252995Sdteske. $BSDCFG_SHARE/common.subr || exit 1
33252995Sdteskef_dprintf "%s: loading includes..." "$0"
34252995Sdteskef_include $BSDCFG_SHARE/dialog.subr
35252995Sdteskef_include $BSDCFG_SHARE/mustberoot.subr
36252995Sdteskef_include $BSDCFG_SHARE/sysrc.subr
37252995Sdteske
38252995SdteskeBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="110.mouse"
39252995Sdteskef_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
40252995Sdteske
41263791Sdteskef_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
42263791Sdteske	pgm="${ipgm:-$pgm}"
43252995Sdteske
44252995Sdteske############################################################ CONFIGURATION
45252995Sdteske
46252995Sdteske#
47252995Sdteske# Location of moused(8) pidfile
48252995Sdteske#
49252995SdteskeMOUSED_PIDFILE=/var/run/moused.pid
50252995Sdteske
51252995Sdteske############################################################ MAIN
52252995Sdteske
53252995Sdteske# Incorporate rc-file if it exists
54252995Sdteske[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
55252995Sdteske
56252995Sdteske#
57252995Sdteske# Process command-line arguments
58252995Sdteske#
59252995Sdteskewhile getopts h$GETOPTS_STDARGS flag; do
60252995Sdteske	case "$flag" in
61252995Sdteske	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
62252995Sdteske	esac
63252995Sdteskedone
64252995Sdteskeshift $(( $OPTIND - 1 ))
65252995Sdteske
66252995Sdteske#
67252995Sdteske# Initialize
68252995Sdteske#
69252995Sdteskef_dialog_title "$msg_mouse_flags"
70252995Sdteskef_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
71252995Sdteskef_mustberoot_init
72252995Sdteske
73252995Sdteske#
74252995Sdteske# Get the current flags
75252995Sdteske#
76252995Sdteskeflags=$( f_sysrc_get moused_flags )
77252995Sdteske
78252995Sdteske#
79252995Sdteske# Prompt the user with the current value
80252995Sdteske#
81252995Sdteskef_dialog_title "$msg_value_required"
82252995Sdteskef_dialog_input flags "$msg_please_specify_the_mouse_daemon_flags" \
83252995Sdteske               "$flags" || f_die
84252995Sdteskef_dialog_title_restore
85252995Sdteske
86252995Sdteske#
87252995Sdteske# Save the new value
88252995Sdteske#
89263791Sdteskef_eval_catch "$0" f_sysrc_set 'f_sysrc_set moused_flags "%s"' "$flags" || f_die
90252995Sdteske
91252995Sdteskeexit $SUCCESS
92252995Sdteske
93252995Sdteske################################################################################
94252995Sdteske# END
95252995Sdteske################################################################################
96