# General functions
#
# Here you can find functions which don't fit to other categories, or are the
# only ones in their "category", so making separate file for them is a waste.
# I will put here also some "commonly used" functions, making other files for
# more specialized ones.


# FindCommand function is used to find out what commands from specified list
# of application names are available and set up a variable containing first
# found command.
# Usage:
# FindCommand <variable name> <command1> <command2> ... <command9>
# <variable name> - a name of a variable to set up; you need to give a name
# without $[] part, for example "TerminalName" (without the quotes)
# <command#> - a list of commands to search for. You can give up to 9 commands
# due to limitations of FVWM function variables system, which let you give
# only 10 variables to a function (first variable is used)

DestroyFunc FindCommand
AddToFunc FindCommand
+ I Test (x $1) SetEnv $0 $1
+ I TestRc (NoMatch) Test (x $2) SetEnv $0 $2
+ I TestRc (NoMatch) Test (x $3) SetEnv $0 $3
+ I TestRc (NoMatch) Test (x $4) SetEnv $0 $4
+ I TestRc (NoMatch) Test (x $5) SetEnv $0 $5
+ I TestRc (NoMatch) Test (x $6) SetEnv $0 $6
+ I TestRc (NoMatch) Test (x $7) SetEnv $0 $7
+ I TestRc (NoMatch) Test (x $8) SetEnv $0 $8
+ I TestRc (NoMatch) Test (x $9) SetEnv $0 $9

# FindCommandAX is similar to FindCommand function, but as the second argument
# you must give a letter which is used to start an application directly (X) or
# in a terminal (A). These letters indicate functions which will be used to
# start selected applications. Examples:
# FindCommandAX DefaultMailClient A mutt pine elmo
# FindCommandAX DefaultMailClient X balsa evolution kmail thunderbird

DestroyFunc FindCommandAX
AddToFunc FindCommandAX
+ I Test (x $2) SetEnv $0 "$1 $2"
+ I TestRc (NoMatch) Test (x $3) SetEnv $0 "$1 $3"
+ I TestRc (NoMatch) Test (x $4) SetEnv $0 "$1 $4"
+ I TestRc (NoMatch) Test (x $5) SetEnv $0 "$1 $5"
+ I TestRc (NoMatch) Test (x $6) SetEnv $0 "$1 $6"
+ I TestRc (NoMatch) Test (x $7) SetEnv $0 "$1 $7"
+ I TestRc (NoMatch) Test (x $8) SetEnv $0 "$1 $8"
+ I TestRc (NoMatch) Test (x $9) SetEnv $0 "$1 $9"

