Debian Codegraph @

fvwm/components/functions/FindFunctions

raw
1 # These functions are used to find out what commands or files from specified
2 # list are available and set up a variable containing first found command or
3 # file name.
4 #
5 # Usage:
6 # FindCommand <variable name> <command1> <command2> ... <command9>
7 #
8 # <variable name> - a name of a variable to set up; you need to give a name
9 # without $[] part, for example "TerminalName" (without the quotes)
10 #
11 # <command#> - a list of commands to search for. You can give up to 9 commands
12 # due to limitations of FVWM function variables system, which let you give
13 # only 10 variables to a function (first variable is used)
14
15 DestroyFunc FindCommand
16 AddToFunc FindCommand
17 + I Test (x $1) InfoStoreAdd $0 $1
18 + I TestRc (NoMatch) Test (x $2) InfoStoreAdd $0 $2
19 + I TestRc (NoMatch) Test (x $3) InfoStoreAdd $0 $3
20 + I TestRc (NoMatch) Test (x $4) InfoStoreAdd $0 $4
21 + I TestRc (NoMatch) Test (x $5) InfoStoreAdd $0 $5
22 + I TestRc (NoMatch) Test (x $6) InfoStoreAdd $0 $6
23 + I TestRc (NoMatch) Test (x $7) InfoStoreAdd $0 $7
24 + I TestRc (NoMatch) Test (x $8) InfoStoreAdd $0 $8
25 + I TestRc (NoMatch) Test (x $9) InfoStoreAdd $0 $9
26
27 # FindCommandAX is similar to FindCommand function, but as the second argument
28 # you must give a letter which is used to start an application directly (X) or
29 # in a terminal (A). These letters indicate functions which will be used to
30 # start selected applications. Examples:
31 # FindCommandAX DefaultMailClient A mutt pine elmo
32 # FindCommandAX DefaultMailClient X balsa evolution kmail thunderbird
33
34 DestroyFunc FindCommandAX
35 AddToFunc FindCommandAX
36 + I Test (x $2) InfoStoreAdd $0 "$1 $2"
37 + I TestRc (NoMatch) Test (x $3) InfoStoreAdd $0 "$1 $3"
38 + I TestRc (NoMatch) Test (x $4) InfoStoreAdd $0 "$1 $4"
39 + I TestRc (NoMatch) Test (x $5) InfoStoreAdd $0 "$1 $5"
40 + I TestRc (NoMatch) Test (x $6) InfoStoreAdd $0 "$1 $6"
41 + I TestRc (NoMatch) Test (x $7) InfoStoreAdd $0 "$1 $7"
42 + I TestRc (NoMatch) Test (x $8) InfoStoreAdd $0 "$1 $8"
43 + I TestRc (NoMatch) Test (x $9) InfoStoreAdd $0 "$1 $9"
44
45 # FindFile is similar to previous functions, but instead looking for a command
46 # in $PATH you can look for a file in a directory. First argument is a name of
47 # the variable, second one is the directory to look inside, other arguments
48 # are names of the files inside the directory. Name of the first found file
49 # will be put in the variable. Examples:
50 # FindFile SpecialFile $[FVWM_USERDIR]/files file1 file2 file3 file4 file5
51
52 DestroyFunc FindFile
53 AddToFunc FindFile
54 + I Test (f $1/$2) InfoStoreAdd $0 $2
55 + I TestRc (NoMatch) Test (f $1/$3) InfoStoreAdd $0 $3
56 + I TestRc (NoMatch) Test (f $1/$4) InfoStoreAdd $0 $4
57 + I TestRc (NoMatch) Test (f $1/$5) InfoStoreAdd $0 $5
58 + I TestRc (NoMatch) Test (f $1/$6) InfoStoreAdd $0 $6
59 + I TestRc (NoMatch) Test (f $1/$7) InfoStoreAdd $0 $7
60 + I TestRc (NoMatch) Test (f $1/$8) InfoStoreAdd $0 $8
61 + I TestRc (NoMatch) Test (f $1/$9) InfoStoreAdd $0 $9
62
63 # vim:ft=fvwm