updates from han to remove dependency on getopts, but still
provide argument-grouping functionality
This commit is contained in:
parent
ae729342e9
commit
075dc35b5e
2 changed files with 78 additions and 30 deletions
|
@ -1,6 +1,9 @@
|
||||||
(Format: Year/Month/Day)
|
(Format: Year/Month/Day)
|
||||||
Changes for 0.9.6:
|
Changes for 0.9.6:
|
||||||
*03/10/08:
|
*03/10/08:
|
||||||
|
* fluxbox-generate_menu update from Han
|
||||||
|
- replace getopts with portable workaround
|
||||||
|
fluxbox-generate_menu
|
||||||
* fbsetbg updates from Han, and some tweaking (Simon)
|
* fbsetbg updates from Han, and some tweaking (Simon)
|
||||||
fbsetbg
|
fbsetbg
|
||||||
*03/10/06:
|
*03/10/06:
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
# DEALINGS IN THE SOFTWARE.
|
# DEALINGS IN THE SOFTWARE.
|
||||||
#
|
#
|
||||||
# $Id: fluxbox-generate_menu,v 1.53 2003/09/29 11:59:35 fluxgen Exp $
|
# $Id: fluxbox-generate_menu,v 1.54 2003/10/08 14:18:25 rathnor Exp $
|
||||||
|
|
||||||
#
|
#
|
||||||
# Portability notes:
|
# Portability notes:
|
||||||
|
@ -63,7 +63,7 @@ Options:
|
||||||
|
|
||||||
-k Insert a kde menu
|
-k Insert a kde menu
|
||||||
-g Add a gnome menu
|
-g Add a gnome menu
|
||||||
-B enable backgroundmenu
|
-B enable backgrounds menu
|
||||||
-r Don't remove empty menu-entries; for templates
|
-r Don't remove empty menu-entries; for templates
|
||||||
|
|
||||||
-t Favourite terminal
|
-t Favourite terminal
|
||||||
|
@ -609,38 +609,83 @@ if [ ! "${INSTALL}" = Yes ]; then
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
echo "Warning: I could't create ${HOME}/.fluxbox/menuconfig" >&2
|
echo "Warning: I couldn't create ${HOME}/.fluxbox/menuconfig" >&2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
testoption() {
|
||||||
|
if [ -z "$3" -o -n "`echo $3|grep '^-'`" ]; then
|
||||||
|
echo "Error: The option $2 requires an argument." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
case $1 in
|
||||||
|
ex) # executable
|
||||||
|
if find_it "$3"; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "Error: The option $2 needs an executable as argument, and \`$3' is not." >&2
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
di) # directory
|
||||||
|
if [ -d "$3" ]; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "Error: The option $2 needs a directory as argument, and \`$3' is not." >&2
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
fl) # file
|
||||||
|
if [ -r "$3" ]; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "Error: The option $2 needs a readable file as argument, and \`$3' is not." >&2
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
sk) # skip
|
||||||
|
:
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# Get options.
|
# Get options.
|
||||||
while getopts ":Bkhragb:t:p:w:u:n:q:o:m:-:" COMMAND_LINE_ARGUMENT ; do
|
while [ $# -gt 0 ]; do
|
||||||
case "${COMMAND_LINE_ARGUMENT}" in
|
case "$1" in
|
||||||
B) BACKGROUNDMENUITEM=yes ;;
|
-B) BACKGROUNDMENUITEM=yes; shift;;
|
||||||
k) KDEMENU=yes ;;
|
-k) KDEMENU=yes; shift;;
|
||||||
g) GNOMEMENU=yes ;;
|
-g) GNOMEMENU=yes; shift;;
|
||||||
t) MY_TERM=${OPTARG} ;;
|
-t) MY_TERM=${2}; testoption ex $1 $2; shift 2;;
|
||||||
b) MY_BROWSER=${OPTARG} ;;
|
-b) MY_BROWSER=${2}; testoption ex $1 $2; shift 2;;
|
||||||
o) MENUFILENAME=${OPTARG} ;;
|
-o) MENUFILENAME=${2}; testoption fi $1 $2; shift 2;;
|
||||||
p) PREFIX=${OPTARG} ;;
|
-p) PREFIX=${2}; testoption di $1 $2; shift 2;;
|
||||||
n) GNOME_PREFIX=${OPTARG} ;;
|
-n) GNOME_PREFIX=${2}; testoption di $1 $2; shift 2;;
|
||||||
q) KDE_PREFIX=${OPTARG} ;;
|
-q) KDE_PREFIX=${2}; testoption di $1 $2; shift 2;;
|
||||||
m) MENUTITLE=${OPTARG} ;;
|
-m) MENUTITLE=${2}; testoption sk $1 $2; shift 2;;
|
||||||
w) HOMEPAGE=${OPTARG} ;;
|
-w) HOMEPAGE=${2}; testoption sk $1 $2; shift 2;;
|
||||||
u) USERMENU=${OPTARG} ;;
|
-u) USERMENU=${2}; testoption fl $1 $2; shift 2;;
|
||||||
r) REMOVE=no ;;
|
-r) REMOVE=no; shift;;
|
||||||
h) display_help ; exit 0 ;;
|
-h) display_help ; exit 0 ;;
|
||||||
a) display_authors ; exit 0 ;;
|
-a) display_authors ; exit 0 ;;
|
||||||
-) echo "fluxbox-generate_menu doesn't recognize -- gnu-longopts."
|
--*) echo "fluxbox-generate_menu doesn't recognize -- gnu-longopts."
|
||||||
echo 'Use fluxbox-generate_menu -h for a long help message.'
|
echo 'Use fluxbox-generate_menu -h for a long help message.'
|
||||||
display_usage
|
display_usage
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
*) echo 'Use fluxbox-generate_menu -h for a long help message.'
|
-[a-zA-Z][a-zA-Z]*)
|
||||||
display_usage
|
# split concatenated single-letter options apart
|
||||||
exit 1 ;;
|
FIRST="$1"; shift
|
||||||
esac
|
set -- `echo "$FIRST" | sed 's/^-\(.\)\(.*\)/-\1 -\2/'` "$@"
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
echo 1>&2 "fluxbox-generate_menu: unrecognized option "\`"$1'"
|
||||||
|
display_usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check defaults
|
# Check defaults
|
||||||
|
|
||||||
# Can we actually create ${MENUFILENAME}
|
# Can we actually create ${MENUFILENAME}
|
||||||
|
@ -987,5 +1032,5 @@ if [ ! "${REMOVE}" ]; then
|
||||||
clean_up
|
clean_up
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'Menu succesfully generated.'
|
echo 'Menu successfully generated.'
|
||||||
echo 'Use fluxbox-generate_menu -h to read all about the latest features.'
|
echo 'Use fluxbox-generate_menu -h to read about all the latest features.'
|
||||||
|
|
Loading…
Reference in a new issue